diff options
-rw-r--r-- | src/parse/parse.c | 12 | ||||
-rw-r--r-- | test/data/css/blocks.css | 4 | ||||
-rw-r--r-- | test/data/css/malformed.css | 6 |
3 files changed, 14 insertions, 8 deletions
diff --git a/src/parse/parse.c b/src/parse/parse.c index 10575b9..6e10ffc 100644 --- a/src/parse/parse.c +++ b/src/parse/parse.c @@ -917,9 +917,6 @@ css_error parseAtRule(css_parser *parser) switch (state->substate) { case Initial: -#if !defined(NDEBUG) && defined(DEBUG_EVENTS) - printf("Begin at-rule\n"); -#endif parserutils_vector_clear(parser->tokens); error = getToken(parser, &token); @@ -955,10 +952,6 @@ css_error parseAtRule(css_parser *parser) if (error != CSS_OK) return error; - error = pushBack(parser, token); - if (error != CSS_OK) - return error; - /* Grammar ambiguity: any0 can be followed by '{',';',')',']'. * at-rule can only be followed by '{' and ';'. */ if (token->type == CSS_TOKEN_CHAR && token->data.len == 1) { @@ -971,6 +964,10 @@ css_error parseAtRule(css_parser *parser) } } + error = pushBack(parser, token); + if (error != CSS_OK) + return error; + break; } @@ -993,6 +990,7 @@ css_error parseAtRuleEnd(css_parser *parser) switch (state->substate) { case Initial: #if !defined(NDEBUG) && defined(DEBUG_EVENTS) + printf("Begin at-rule\n"); parserutils_vector_dump(parser->tokens, __func__, tprinter); #endif if (parser->event != NULL) { diff --git a/test/data/css/blocks.css b/test/data/css/blocks.css index 9ecd720..57be2ee 100644 --- a/test/data/css/blocks.css +++ b/test/data/css/blocks.css @@ -2,6 +2,10 @@ @import "simple.css"; +@foo rgb(255,255,255); + +@bar (a,b,c); + @media screen { body { background-color: green; } diff --git a/test/data/css/malformed.css b/test/data/css/malformed.css index e1b6af9..cfcbb23 100644 --- a/test/data/css/malformed.css +++ b/test/data/css/malformed.css @@ -6,7 +6,11 @@ p { color:red; color:; color:green } /* same with expected recovery */ p { color:green; color{;color:maroon} } /* unexpected tokens { } */ p { color:red; color{;color:maroon}; color:green } /* same with recovery */ +@blah <!-- ; +@foo --> { moose } + "Foo bar baz -p ( { ) color: green } +p ( { ) color: green } ) p {color:green} +p { color: green; } |