### ----------------------------------------------------
### -- CSS::Grammar
### -- Licenses: Artistic-2.0
### -- Authors: David Warring
### -- File: t/error-handling.json
### ----------------------------------------------------
[ "declaration-list", { "input" : "background:url('http://www.bg.com/pinkish.gif')", "ast" : [ { "property" : { "ident" : "background", "expr" : [ { "url" : "http://www.bg.com/pinkish.gif" } ] } } ] } ]
[ "declaration-list", { "input" : "background:URL(http://www.bg.com/pinkish.gif)" , "ast": [ { "property" : { "ident" : "background", "expr" : [ { "url" : "http://www.bg.com/pinkish.gif" } ] } } ] } ]
[ "declaration-list", { "input" : "background:URL(http://www.bg.com/pinkish.gif" , "ast": null, "warnings" : [ "dropping term: URL(http://www.bg.com/pinkish.gif", "dropping declaration: background" ] } ]
[ "declaration-list", { "input" : "background:URL('http://www.bg.com/pinkish.gif" , "ast": null, "warnings" : [ "dropping term: URL('http://www.bg.com/pinkish.gif", "dropping declaration: background" ] } ]
[ "ruleset", { "input" : "h1 { color: red; rotation: 70minutes }", "warnings" : [ "unknown units: minutes", "dropping declaration: rotation" ] , "ast": { "ruleset" : { "selectors" : [ { "selector" : [ { "simple-selector" : [ { "qname" : { "element-name" : "h1" } } ] } ] } ], "declarations" : [ { "property" : { "ident" : "color", "expr" : [ { "ident" : "red" } ] } } ] } } } ]
// unclosed parens
[ "ruleset", { "input" : "h1 {kept1:1; color: dropped1 rgb(10,20,30 dropped2; kept2:2;}", "warnings" : [ "dropping term: rgb(10,20,30 dropped2", "dropping declaration: color" ] , "ast": { "ruleset" : { "selectors" : [ { "selector" : [ { "simple-selector" : [ { "qname" : { "element-name" : "h1" } } ] } ] } ], "declarations" : [ { "property" : { "ident" : "kept1", "expr" : [ { "num" : 1 } ] } }, { "property" : { "ident" : "kept2", "expr" : [ { "num" : 2 } ] } } ] } } } ]
[ "ruleset", { "input" : "h1 {content:'Section' counter(hdr-1); color:red}" , "ast": { "ruleset" : { "selectors" : [ { "selector" : [ { "simple-selector" : [ { "qname" : { "element-name" : "h1" } } ] } ] } ], "declarations" : [ { "property" : { "ident" : "content", "expr" : [ { "string" : "Section" }, { "func" : { "ident" : "counter", "expr" : [ { "ident" : "hdr-1" } ] } } ] } }, { "property" : { "ident" : "color", "expr" : [ { "ident" : "red" } ] } } ] } } } ]
// unclosed string. scanner should discard first line
[ "ruleset", { "input" : "h2 {bad: dropme 'http://unclosed-string.org; color:blue;\n background-color:#ccc;}" , "ast": { "ruleset" : { "selectors" : [ { "selector" : [ { "simple-selector" : [ { "qname" : { "element-name" : "h2" } } ] } ] } ], "declarations" : [ { "property" : { "ident" : "background-color", "expr" : [ { "rgb" : [ { "num" : 204 }, { "num" : 204 }, { "num" : 204 } ] } ] } } ] } }, "warnings" : [ "unterminated string: 'http://unclosed-string.org; color:blue;", "dropping term: dropme", "dropping declaration: bad" ] } ]
[ "ruleset", { "input" : "p { color:rgb(10,17); }" , "ast": null, "warnings" : [ "usage: rgb(c,c,c) where c is 0..255 or 0%-100%", "dropping declaration: color" ] } ]
[ "ruleset", { "input" : "p:foo(42) { color:bar(); }" , "ast": { "ruleset" : { "selectors" : [ { "selector" : [ { "simple-selector" : [ { "qname" : { "element-name" : "p" } }, { "pseudo-func" : { "ident" : "foo", "expr" : [ { "num" : 42 } ] } } ] } ] } ], "declarations" : [ { "property" : { "ident" : "color", "expr" : [ { "func" : { "ident" : "bar" } } ] } } ] } } } ]
[ "ruleset", { "input" : "p { color:bar(@42); }" , "ast": null, "warnings" : [ "skipping function arguments: @42", "dropping declaration: color" ] } ]
[ "ruleset", { "input" : "p { color }" , "ast": null, "warnings" : "dropping term: color" } ]
[ "ruleset", { "input" : "p { term1:a; color; term2:b }" , "ast": null, "warnings" : "dropping term: color" } ]
[ "ruleset", { "input" : "p {term1:a; color: }" , "ast": null, "warnings" : "dropping declaration: color" } ]
[ "ruleset", { "input" : "p { term1:a; color:; term2:b }" , "ast": null, "warnings" : "dropping declaration: color" } ]
[ "ruleset", { "input" : "p { term1:a; color{;color:maroon} }" , "ast": null, "warnings" : "dropping term: color{;color:maroon}" } ]
[ "ruleset", { "input" : "p { term1:a; color{;color:maroon}; color:green }" , "ast": null, "warnings" : "dropping term: color{;color:maroon}" } ]
[ "stylesheet", { "input" : "p @here {color: red}" , "ast": null, "warnings" : "dropping: p @here {color: red}" } ]
[ "stylesheet", { "input" : "@foo @bar;" , "ast": null, "warnings" : "dropping: @foo @bar;" } ]
[ "stylesheet", { "input" : "}} {{ - }}" , "ast": null, "warnings" : [ "dropping: }", "dropping: }", "dropping: {{ - }}" ] } ]
// example from http://www.w3.org/TR/2003/WD-css3-syntax-20030813/#rule-sets
// the middle rule is invalid and should be skipped
[ "stylesheet", { "input" : "h1, h2 {color: green }\nh3, h4 & h5 {color: red }\nh6 {color: black }", "warnings" : "dropping: h3, h4 & h5 {color: red }" , "ast": { "stylesheet" : [ { "ruleset" : { "selectors" : [ { "selector" : [ { "simple-selector" : [ { "qname" : { "element-name" : "h1" } } ] } ] }, { "selector" : [ { "simple-selector" : [ { "qname" : { "element-name" : "h2" } } ] } ] } ], "declarations" : [ { "property" : { "ident" : "color", "expr" : [ { "ident" : "green" } ] } } ] } }, { "ruleset" : { "selectors" : [ { "selector" : [ { "simple-selector" : [ { "qname" : { "element-name" : "h6" } } ] } ] } ], "declarations" : [ { "property" : { "ident" : "color", "expr" : [ { "ident" : "black" } ] } } ] } } ] } } ]
[ "stylesheet", { "input" : "@three-dee { @background-lighting { azimuth: 30deg; elevation: 190deg; }  h1 { color: red } }  h1 { color: blue }", "warnings" : "dropping: @three-dee { @background-lighting { azimuth: 30deg; elevation: 190deg; } h1 { color: red } }" , "ast": { "stylesheet" : [ { "ruleset" : { "selectors" : [ { "selector" : [ { "simple-selector" : [ { "qname" : { "element-name" : "h1" } } ] } ] } ], "declarations" : [ { "property" : { "ident" : "color", "expr" : [ { "ident" : "blue" } ] } } ] } } ] } } ]
// try a few extended terms when we don't have the media extensions loaded
[ "stylesheet", { "input" : "@media print and (width: 21cm)  { @page { margin: 3cm; @top-center { content: 'Page ' counter(page); }}}" , "ast": { "stylesheet" : [ ] }, "warnings" : "dropping: @media print and (width: 21cm) { @page { margin: 3cm; @top-center { content: 'Page ' counter(page); }}}" } ]
[ "stylesheet", { "input" : "* foo|* |h1 body:not(.home) h2 + p:first-letter tr:nth-last-child(-n+2) object[type^='image/'] {}" , "ast": { "stylesheet" : [ ] }, "warnings" : "dropping: * foo|* |h1 body:not(.home) h2 + p:first-letter tr:nth-last-child(-n+2) object[type^='image/'] {}" } ]


