diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2005-01-05 20:20:32 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2005-01-05 20:20:32 +0000 |
commit | a016a1053984b5b266baa1f031056fdba2010e38 (patch) | |
tree | 0d3a8fbeecde99dd48643a49c00d17655a628d15 /css/scanner.l | |
parent | a5ba474aee2921e5eb39d4dd7dd80c648e44a1b8 (diff) | |
download | netsurf-a016a1053984b5b266baa1f031056fdba2010e38.tar.gz netsurf-a016a1053984b5b266baa1f031056fdba2010e38.tar.bz2 |
[project @ 2005-01-05 20:20:32 by jmb]
Tokeniser now passes whitespace to the parser (fixes ancestor combinators)
svn path=/import/netsurf/; revision=1434
Diffstat (limited to 'css/scanner.l')
-rw-r--r-- | css/scanner.l | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/css/scanner.l b/css/scanner.l index 708a9ebe8..4a9b272b0 100644 --- a/css/scanner.l +++ b/css/scanner.l @@ -45,33 +45,38 @@ start: /*!re2c nonascii = [\200-\377]; -unicode = "\\" [0-9a-f]+ [ \n\r\t\f]?; +unicode = "\\" [0-9a-f]+ ("\r\n" | [ \n\r\t\f])?; escape = unicode | "\\" [ -~\200-\377]; nmchar = [-a-zA-Z0-9_] | nonascii | escape; nmstart = [a-zA-Z_] | nonascii | escape; -ident = nmstart nmchar*; +ident = [-]? nmstart nmchar*; name = nmchar+; num = [+-]? [0-9]+ | [0-9]* "." [0-9]+; nl = "\n" | "\r\n" | "\r" | "\f"; string1 = "\"" ([\t !#$%&(-~] | "\\" nl | "'" | nonascii | escape)* "\""; string2 = "'" ([\t !#$%&(-~] | "\\" nl | "\""| nonascii | escape)* "'"; string = string1 | string2; -w = [ \t\r\n\f]*; +s = [ \t\r\n\f]; +w = s*; any = [\000-\377]; ident { return IDENT; } "@" ident { return ATKEYWORD; } string { return STRING; } "#" name { return HASH; } + num { return NUMBER; } num "%" { return PERCENTAGE; } num ident { return DIMENSION; } + "url(" w string w ")" | "url(" w ([!#$%&*-~]|nonascii|escape)* w ")" { return URI; } "U+" [0-9A-F?]+ ("-" [0-9A-F]+ )? { return UNICODE_RANGE; } + "<!--" { goto start; /* ignore CDO */ } "-->" { goto start; /* ignore CDC */ } + ";" { return SEMI; } "{" { return LBRACE; } "}" { return RBRACE; } @@ -79,22 +84,28 @@ num ident { return DIMENSION; } ")" { return RPAREN; } "[" { return LBRAC; } "]" { return RBRAC; } -[ \t\r\n\f]+ { goto start; /* ignore whitespace */ } -"/*" (any\[*])* "*"+ ((any\[/]) (any\[*])* "*"+)* "/" + +s+ { return S; } + +"/*" (any\[*])* "*"+ ((any\[/*]) (any\[*])* "*"+)* "/" { goto start; /* ignore comments */ } + ident "(" { return FUNCTION; } -"=" { return EQUALS; } + "~=" { return INCLUDES; } "|=" { return DASHMATCH; } "^=" { return PREFIX; } "$=" { return SUFFIX; } "*=" { return SUBSTR; } + +"=" { return EQUALS; } ":" { return COLON; } "," { return COMMA; } "+" { return PLUS; } ">" { return GT; } "." { return DOT; } "*" { return ASTERISK; } + any { return DELIM; } */ |