From 997fa05d90e9e1bc02615044fd4f042cb212be65 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 27 Jul 2016 18:04:21 +0200 Subject: Handle indirect sibling selector Adds parsing and handling of the indirect sibling selector, this should mean we can at least parse all CSS3 selectors even if we do not yet support all of them. Also adds tests for previously added CSS3 selectors. Change-Id: I1ce9afb9466044a38bdec167affc21a87837e4a4 Reviewed-by: Simon Hausmann --- util/lexgen/css2-simplified.lexgen | 96 ------------------------------------- util/lexgen/css3-simplified.lexgen | 97 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 96 deletions(-) delete mode 100644 util/lexgen/css2-simplified.lexgen create mode 100644 util/lexgen/css3-simplified.lexgen (limited to 'util') diff --git a/util/lexgen/css2-simplified.lexgen b/util/lexgen/css2-simplified.lexgen deleted file mode 100644 index 01052a1615..0000000000 --- a/util/lexgen/css2-simplified.lexgen +++ /dev/null @@ -1,96 +0,0 @@ -[Options] -case-sensitive -classname = QCssScanner_Generated - -[Code Generator Options] -MapToCode[a-z] = (ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256 -TokenPrefix = QCss:: -FileHeader = ../../src/tools/moc/util/licenseheader.txt - -[Macros] -escape = \\[^\r\n\f0-9a-f] -nmstart = [_a-z]|{escape} -nmchar = [_a-z0-9-]|{escape} -nl = \n|\r\n|\r|\f -string1 = \"([^\n\r\f\\"]|\\{nl}|{escape})*\" -string2 = \'([^\n\r\f\\']|\\{nl}|{escape})*\' -invalid1 = \"([^\n\r\f\\"]|\\{nl}|{escape})* -invalid2 = \'([^\n\r\f\\']|\\{nl}|{escape})* - -ident = -?{nmstart}{nmchar}* -name = {nmchar}+ -num = [0-9]+|[0-9]*"."[0-9]+ -string = {string1}|{string2} -invalid = {invalid1}|{invalid2} -url = ([!#$%&*-~]|{escape})* -s = [ \t\r\n\f] -w = {s}* - -[Tokens] - -S = {s}+ - -handleCommentStart() = \/\* - -CDO = "" -INCLUDES = "~=" -DASHMATCH = "|=" -BEGINSWITH = "^=" -ENDSWITH = "$=" -CONTAINS = "*=" - -LBRACE = {w}"{" -PLUS = {w}"+" -GREATER = {w}">" -COMMA = {w}"," - -STRING = {string} -INVALID = {invalid} - -IDENT = {ident} - -HASH = "#"{name} - -ATKEYWORD_SYM = "@"{ident} - -EXCLAMATION_SYM = "!" - -#EMS = {num}em -#EXS = {num}ex -#LENGTH = {num}px -#LENGTH = {num}cm -#LENGTH = {num}mm -#LENGTH = {num}in -#LENGTH = {num}pt -#LENGTH = {num}pc -#ANGLE = {num}deg -#ANGLE = {num}rad -#ANGLE = {num}grad -#TIME = {num}ms -#TIME = {num}s -#FREQ = {num}hz -#FREQ = {num}khz -#DIMENSION = {num}{ident} -LENGTH = {num}{ident} - -PERCENTAGE = {num}% -NUMBER = {num} - -#URI = "url("{w}{string}{w}")" -#URI = "url("{w}{url}{w}")" -FUNCTION = {ident}"(" - -COLON = : -SEMICOLON = ; -RBRACE = \} -SLASH = / -MINUS = - -DOT = \. -STAR = \* -LBRACKET = \[ -RBRACKET = \] -EQUAL = \= -LPAREN = \( -RPAREN = \) -OR = \| diff --git a/util/lexgen/css3-simplified.lexgen b/util/lexgen/css3-simplified.lexgen new file mode 100644 index 0000000000..99463d524e --- /dev/null +++ b/util/lexgen/css3-simplified.lexgen @@ -0,0 +1,97 @@ +[Options] +case-sensitive +classname = QCssScanner_Generated + +[Code Generator Options] +MapToCode[a-z] = (ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256 +TokenPrefix = QCss:: +FileHeader = ../../src/tools/moc/util/licenseheader.txt + +[Macros] +escape = \\[^\r\n\f0-9a-f] +nmstart = [_a-z]|{escape} +nmchar = [_a-z0-9-]|{escape} +nl = \n|\r\n|\r|\f +string1 = \"([^\n\r\f\\"]|\\{nl}|{escape})*\" +string2 = \'([^\n\r\f\\']|\\{nl}|{escape})*\' +invalid1 = \"([^\n\r\f\\"]|\\{nl}|{escape})* +invalid2 = \'([^\n\r\f\\']|\\{nl}|{escape})* + +ident = -?{nmstart}{nmchar}* +name = {nmchar}+ +num = [0-9]+|[0-9]*"."[0-9]+ +string = {string1}|{string2} +invalid = {invalid1}|{invalid2} +url = ([!#$%&*-~]|{escape})* +s = [ \t\r\n\f] +w = {s}* + +[Tokens] + +S = {s}+ + +handleCommentStart() = \/\* + +CDO = "" +INCLUDES = "~=" +DASHMATCH = "|=" +BEGINSWITH = "^=" +ENDSWITH = "$=" +CONTAINS = "*=" + +LBRACE = {w}"{" +PLUS = {w}"+" +GREATER = {w}">" +COMMA = {w}"," +TILDE= {w}"~" + +STRING = {string} +INVALID = {invalid} + +IDENT = {ident} + +HASH = "#"{name} + +ATKEYWORD_SYM = "@"{ident} + +EXCLAMATION_SYM = "!" + +#EMS = {num}em +#EXS = {num}ex +#LENGTH = {num}px +#LENGTH = {num}cm +#LENGTH = {num}mm +#LENGTH = {num}in +#LENGTH = {num}pt +#LENGTH = {num}pc +#ANGLE = {num}deg +#ANGLE = {num}rad +#ANGLE = {num}grad +#TIME = {num}ms +#TIME = {num}s +#FREQ = {num}hz +#FREQ = {num}khz +#DIMENSION = {num}{ident} +LENGTH = {num}{ident} + +PERCENTAGE = {num}% +NUMBER = {num} + +#URI = "url("{w}{string}{w}")" +#URI = "url("{w}{url}{w}")" +FUNCTION = {ident}"(" + +COLON = : +SEMICOLON = ; +RBRACE = \} +SLASH = / +MINUS = - +DOT = \. +STAR = \* +LBRACKET = \[ +RBRACKET = \] +EQUAL = \= +LPAREN = \( +RPAREN = \) +OR = \| -- cgit v1.2.3