diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-03-10 17:55:58 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-03-10 17:55:58 +0100 |
commit | eb6c379aeffe3e3ce626fb4ab8fa46dbd7766cbf (patch) | |
tree | b59cee2d85ae474c8edbaea8bfd3f8b64cd26d98 /src/cssparser.cc | |
parent | d4a1b71555071730503f09db02c562e48cf06419 (diff) |
add support for negative numbers in CSS parser
Diffstat (limited to 'src/cssparser.cc')
-rw-r--r-- | src/cssparser.cc | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/cssparser.cc b/src/cssparser.cc index e4637099..0fb0d3d8 100644 --- a/src/cssparser.cc +++ b/src/cssparser.cc @@ -426,7 +426,13 @@ static void Css_next_token(CssParser * parser) } } - // \todo handle negative numbers according to CSS 2.1 + // handle negative numbers + if (c == '-') { + if (i < MAX_STR_LEN - 1) + parser->tval[i++] = c; + c = Css_getc(parser); + } + if (isdigit(c)) { parser->ttype = CSS_TK_DECINT; do { @@ -475,6 +481,12 @@ static void Css_next_token(CssParser * parser) return; } + if (i) { + Css_ungetc(parser); /* ungetc '-' */ + i--; + c = Css_getc(parser); + } + if (isalpha(c) || c == '_' || c == '-') { parser->ttype = CSS_TK_SYMBOL; |