| 27 | | * Writing an Interpreter with Lex, Yacc, and Memphis |
| 28 | | http://memphis.compilertools.net/interpreter.html |
| 29 | | * The Lex & Yacc Page |
| 30 | | http://dinosaur.compilertools.net/ |
| | 27 | * A Lex Style |
| | 28 | * Writing an Interpreter with Lex, Yacc, and Memphis |
| | 29 | http://memphis.compilertools.net/interpreter.html |
| | 30 | * The Lex & Yacc Page |
| | 31 | http://dinosaur.compilertools.net/ |
| | 32 | |
| | 33 | * B Manual Coded Parser |
| | 34 | * Interpreter Pattern |
| | 35 | http://www.cs.mcgill.ca/~hv/classes/CS400/01.hchen/doc/interpreter/interpreter.html |
| | 42 | |
| | 43 | CSSDOC Css Model (Experimental) |
| | 44 | The Css Syntax Implementaiton in CSSDOC reflects it's own tokens on a somehow higher level compared to the W3C Core/Macro/Token Lex-Based Syntax. |
| | 45 | |
| | 46 | stylesheet |
| | 47 | | |
| | 48 | +---+--+-----+---------+ |
| | 49 | | | | | | |
| | 50 | (CDO CDC S) statement comment Note: CDO, CDC and S are not a CSSDOC Parser Token |
| | 51 | | |
| | 52 | +-----+------+------+ |
| | 53 | | | | |
| | 54 | ruleset at-rule comment |
| | 55 | | | |
| | 56 | +---+----+ block (recursion) |
| | 57 | /|\ | |
| | 58 | selectors comment |
| | 59 | | |
| | 60 | +---------+ |
| | 61 | /|\ | |
| | 62 | declarations comment |
| | 63 | |
| | 64 | |
| | 65 | comment |
| | 66 | | |
| | 67 | +-----+-----+ |
| | 68 | | /|\ |
| | 69 | text tags |
| | 70 | |
| | 71 | |
| | 72 | W3C Core/Macro/Token Syntax: |
| | 73 | |
| | 74 | W3C Core Syntax: |
| | 75 | stylesheet : [ CDO | CDC | S | statement ]*; |
| | 76 | statement : ruleset | at-rule; |
| | 77 | at-rule : ATKEYWORD S* any* [ block | ';' S* ]; |
| | 78 | ruleset : selector? '{' S* declaration? [ ';' S* declaration? ]* '}' S*; |
| | 79 | block : '{' S* [ any | block | ATKEYWORD S* | ';' S* ]* '}' S*; |
| | 80 | selector : any+; |
| | 81 | declaration : DELIM? property S* ':' S* value; |
| | 82 | property : IDENT; |
| | 83 | value : [ any | block | ATKEYWORD S* ]+; |
| | 84 | any : [ IDENT | NUMBER | PERCENTAGE | DIMENSION | STRING |
| | 85 | | DELIM | URI | HASH | UNICODE-RANGE | INCLUDES |
| | 86 | | DASHMATCH | FUNCTION S* any* ')' |
| | 87 | | '(' S* any* ')' | '[' S* any* ']' ] S*; |
| | 88 | |
| | 89 | W3C Macros: |
| | 90 | ident [-]?{nmstart}{nmchar}* |
| | 91 | name {nmchar}+ |
| | 92 | nmstart [_a-z]|{nonascii}|{escape} |
| | 93 | nonascii [^\0-\177] |
| | 94 | unicode \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])? |
| | 95 | escape {unicode}|\\[^\n\r\f0-9a-f] |
| | 96 | nmchar [_a-z0-9-]|{nonascii}|{escape} |
| | 97 | num [0-9]+|[0-9]*\.[0-9]+ |
| | 98 | string {string1}|{string2} |
| | 99 | string1 \"([^\n\r\f\\"]|\\{nl}|{escape})*\" |
| | 100 | string2 \'([^\n\r\f\\']|\\{nl}|{escape})*\' |
| | 101 | invalid {invalid1}|{invalid2} |
| | 102 | invalid1 \"([^\n\r\f\\"]|\\{nl}|{escape})* |
| | 103 | invalid2 \'([^\n\r\f\\']|\\{nl}|{escape})* |
| | 104 | nl \n|\r\n|\r|\f |
| | 105 | w [ \t\r\n\f]* |
| | 106 | |
| | 107 | W3C Tokens: |
| | 108 | IDENT {ident} |
| | 109 | ATKEYWORD @{ident} |
| | 110 | STRING {string} |
| | 111 | INVALID {invalid} |
| | 112 | HASH #{name} |
| | 113 | NUMBER {num} |
| | 114 | PERCENTAGE {num}% |
| | 115 | DIMENSION {num}{ident} |
| | 116 | URI url\({w}{string}{w}\) |
| | 117 | |url\({w}([!#$%&*-~]|{nonascii}|{escape})*{w}\) |
| | 118 | UNICODE-RANGE U\+[0-9a-f?]{1,6}(-[0-9a-f]{1,6})? |
| | 119 | CDO <!-- |
| | 120 | CDC --> |
| | 121 | ; ; |
| | 122 | { \{ |
| | 123 | } \} |
| | 124 | ( \( |
| | 125 | ) \) |
| | 126 | [ \[ |
| | 127 | ] \] |
| | 128 | S [ \t\r\n\f]+ |
| | 129 | COMMENT \/\*[^*]*\*+([^/*][^*]*\*+)*\/ |
| | 130 | FUNCTION {ident}\( |
| | 131 | INCLUDES ~= |
| | 132 | DASHMATCH |= |
| | 133 | DELIM any other character not matched by the above rules, and neither a single nor a double quote |