css: Don't import CSS too early

First, finish parsing the import rule including the semicolon. Then try
to actually import.

test: css/parser/at-invalid-01.css
This commit is contained in:
Benjamin Otte 2012-01-15 19:20:34 +01:00
parent 4653c7017f
commit 1b0231b743

View File

@ -1790,7 +1790,12 @@ parse_import (GtkCssScanner *scanner)
return TRUE;
}
if (gtk_css_scanner_would_recurse (scanner, file))
if (!_gtk_css_parser_try (scanner->parser, ";", TRUE))
{
gtk_css_provider_invalid_token (scanner->provider, scanner, "semicolon");
_gtk_css_parser_resync (scanner->parser, TRUE, 0);
}
else if (gtk_css_scanner_would_recurse (scanner, file))
{
char *path = g_file_get_path (file);
gtk_css_provider_error (scanner->provider,
@ -1810,12 +1815,6 @@ parse_import (GtkCssScanner *scanner)
NULL);
}
if (!_gtk_css_parser_try (scanner->parser, ";", TRUE))
{
gtk_css_provider_invalid_token (scanner->provider, scanner, "semicolon");
_gtk_css_parser_resync (scanner->parser, TRUE, 0);
}
g_object_unref (file);
gtk_css_scanner_pop_section (scanner, GTK_CSS_SECTION_IMPORT);