### ----------------------------------------------------
### -- CSS::Grammar
### -- Licenses: Artistic-2.0
### -- Authors: David Warring
### -- File: t/css3-syntax.json
### ----------------------------------------------------
// attributes
[ "simple-selector", { "input" : "span[hello='Cleveland'][goodbye='Columbus']", "ast" : { "simple-selector" : [ { "qname" : { "element-name" : "span" } }, { "attrib" : [ { "ident" : "hello" }, { "op" : "=" }, { "string" : "Cleveland" } ] }, { "attrib" : [ { "ident" : "goodbye" }, { "op" : "=" }, { "string" : "Columbus" } ] } ] } } ]
[ "simple-selector", { "input" : "object[type^='image/']", "ast" : { "simple-selector" : [ { "qname" : { "element-name" : "object" } }, { "attrib" : [ { "ident" : "type" }, { "op" : "^=" }, { "string" : "image/" } ] } ] } } ]
[ "simple-selector", { "input" : "object[a=b][c~=d][e|=f]", "ast" : { "simple-selector" : [ { "qname" : { "element-name" : "object" } }, { "attrib" : [ { "ident" : "a" }, { "op" : "=" }, { "ident" : "b" } ] }, { "attrib" : [ { "ident" : "c" }, { "op" : "~=" }, { "ident" : "d" } ] }, { "attrib" : [ { "ident" : "e" }, { "op" : "|=" }, { "ident" : "f" } ] } ] } } ]
[ "simple-selector", { "input" : "Object[a^=b][c$=d][e*=f]", "ast" : { "simple-selector" : [ { "qname" : { "element-name" : "Object" } }, { "attrib" : [ { "ident" : "a" }, { "op" : "^=" }, { "ident" : "b" } ] }, { "attrib" : [ { "ident" : "c" }, { "op" : "$=" }, { "ident" : "d" } ] }, { "attrib" : [ { "ident" : "e" }, { "op" : "*=" }, { "ident" : "f" } ] } ] } } ]
// An+B microsyntax
[ "AnB-expr", { "input" : "odd", "ast" : [ { "keyw" : "odd" } ] } ]
[ "AnB-expr", { "input" : "even", "ast" : [ { "keyw" : "even" } ] } ]
[ "AnB-expr", { "input" : "3n + 1", "ast" : [ { "int" : 3 }, { "op" : "n" }, { "op" : "+" }, { "int" : 1 } ] } ]
[ "AnB-expr", { "input" : "-2", "ast" : [ { "op" : "-" }, { "int" : 2 } ] } ]
// http://www.w3.org/TR/2014/CR-css-syntax-3-20140220/#tokenization
// 4.1 Token Railroad Diagrams
[ "comment", { "input" : "/* anything but * followed by / */", "ast" : null } ]
[ "ws", { "input" : [ " ", "\t", "\r", "\n" ], "ast" : null } ]
[ "xdigit", { "input" : [ "0", "9", "a", "f" ], "ast" : null } ]
[ "escape", { "input" : [ "\\Z", "\\0", "\\12345", "\\0abc " ], "ast" : null } ]
[ "ws", { "input" : " /*foo*/ \n", "ast" : null } ]
[ "Ident", { "input" : [ "Hi", "_hi", "-_AaZz09\\42\u1234" ], "ast" : null } ]
// not implemented: <function-token>
[ "ws", { "input" : " /*foo*/ \n", "ast" : null } ]
[ "at-keyw", { "input" : "@page", "ast" : null } ]
// <id> :== <hash-token>
[ "id", { "input" : [ "#id-12_3", "#\\0123 b" ], "ast" : null } ]
[ "string", { "input" : [ "'abc\\abc \\\\nx\"y'", "\"xx'yy\\n\\nz\"" ], "ast" : null } ]
[ "url", { "input" : [ "url( abc.png )", "url( 'def.gif' )" ], "ast" : null } ]
[ "num", { "input" : [ "12.3", "123e-1", ".123E2", "12300E-3", "1.23E+01" ], "ast" : { "num" : 12.3 } } ]
[ "dimension", { "input" : "12mm", "ast" : { "mm" : 12 } } ]
// this only works in :lax mode
[ "any-dimension", { "input" : "12Furlongs", "ast" : { "num" : 12, "units:unknown" : "furlongs" } } ]
[ "percentage", { "input" : [ "90%", "9e1%", "+090%" ], "ast" : { "percent" : 90 } } ]
[ "unicode-range", { "input" : [ "U+200-2Ff", "U+2??" ], "ast" : { "unicode-range" : [ 512, 767 ] } } ]
[ "term", { "input" : "U+2??a", "ast" : { "unicode-range" : [ 8202, 12282 ] } } ]
[ "attribute-selector", { "input" : [ "~=", "|=", "^=", "$=", "*=", "||" ], "ast" : null } ]


