diff --git a/crates/swc_css_codegen/src/lib.rs b/crates/swc_css_codegen/src/lib.rs index 5d6c4a822a76..f493ab68ba58 100644 --- a/crates/swc_css_codegen/src/lib.rs +++ b/crates/swc_css_codegen/src/lib.rs @@ -1473,7 +1473,11 @@ where } if is_custom_property { - self.emit_list(&n.value, ListFormat::NotDelimited)?; + self.with_ctx(Ctx { + in_list_of_component_values: true, + ..self.ctx + }) + .emit_list(&n.value, ListFormat::NotDelimited)?; } else { self.emit_list_of_component_values_inner( &n.value, diff --git a/crates/swc_css_codegen/tests/fixture/at-rules/supports/3/output.css b/crates/swc_css_codegen/tests/fixture/at-rules/supports/3/output.css index ee23646ac3b5..f6b130aa0400 100644 --- a/crates/swc_css_codegen/tests/fixture/at-rules/supports/3/output.css +++ b/crates/swc_css_codegen/tests/fixture/at-rules/supports/3/output.css @@ -1,4 +1,4 @@ -@supports (--x: y , z ) { +@supports (--x: y , z) { a { color: red; } diff --git a/crates/swc_css_codegen/tests/fixture/at-rules/supports/3/output.min.css b/crates/swc_css_codegen/tests/fixture/at-rules/supports/3/output.min.css index 89c37c3904b5..8156b817ee06 100644 --- a/crates/swc_css_codegen/tests/fixture/at-rules/supports/3/output.min.css +++ b/crates/swc_css_codegen/tests/fixture/at-rules/supports/3/output.min.css @@ -1 +1 @@ -@supports(--x:y , z ){a{color:red}}@supports(--x: ){a{color:red}}@supports(--x: ){a{color:red}}@supports ( --x y , z ) {a{color:red}}@supports ( --x ) {a{color:red}}@supports ( ) {a{color:red}}@supports ( . --x : y , z ) {a{color:red}} +@supports(--x:y , z){a{color:red}}@supports(--x: ){a{color:red}}@supports(--x: ){a{color:red}}@supports ( --x y , z ) {a{color:red}}@supports ( --x ) {a{color:red}}@supports ( ) {a{color:red}}@supports ( . --x : y , z ) {a{color:red}} diff --git a/crates/swc_css_codegen/tests/fixture/declaration/custom-properties/output.css b/crates/swc_css_codegen/tests/fixture/declaration/custom-properties/output.css index 87d64bead432..0866d93664a0 100644 --- a/crates/swc_css_codegen/tests/fixture/declaration/custom-properties/output.css +++ b/crates/swc_css_codegen/tests/fixture/declaration/custom-properties/output.css @@ -1,11 +1,11 @@ div { --y: ; - --x: var(--y) ; + --x: var(--y); --z: 0px; --foo: if(x > 5) this.width = 10; --bar: ; --bar2: ; - --yz: foo !important; + --yz: foo!important; } div { width: var(--a,); @@ -59,10 +59,10 @@ div { --x: y; } * { - --x: y ; + --x: y; } * { - --x: y, ; + --x: y,; } * { --x: var(y,); @@ -74,7 +74,7 @@ div { --x: (y); } * { - --x: (y) ; + --x: (y); } * { --x: (y); @@ -89,7 +89,7 @@ div { --x: f(y); } * { - --x: f(y) ; + --x: f(y); } * { --x: f(y); @@ -104,7 +104,7 @@ div { --x: [y]; } * { - --x: [y] ; + --x: [y]; } * { --x: [y]; @@ -119,7 +119,7 @@ div { --x: {y}; } * { - --x: {y} ; + --x: {y}; } * { --x: {y}; @@ -130,7 +130,7 @@ div { * { --x: { y}; } -@supports (--x: y , z ) { +@supports (--x: y , z) { a { color: red; } diff --git a/crates/swc_css_codegen/tests/fixture/declaration/custom-properties/output.min.css b/crates/swc_css_codegen/tests/fixture/declaration/custom-properties/output.min.css index 69d66086a8b6..de5ec32583fa 100644 --- a/crates/swc_css_codegen/tests/fixture/declaration/custom-properties/output.min.css +++ b/crates/swc_css_codegen/tests/fixture/declaration/custom-properties/output.min.css @@ -1,2 +1,2 @@ -div{--y: ;--x:var(--y) ;--z:0px;--foo:if(x > 5) this.width = 10;--bar: ;--bar2: ;--yz:foo !important}div{width:var(--a,)}.motion-safe\:shadow-md{--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-1:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), - 0 2px 4px -2px var(--tw-shadow-color)}*{--x: }*{--x: }*{--x: }*{--x: }*{--x: !important}*{--x: !important}*{--x: !important}*{--x: !important}*{--x: !important}*{--x: !important}*{--x: !important}*{--x: !important}*{--x:y}*{--x:y}*{--x:y }*{--x:y, }*{--x:var(y,)}*{--x:var(y, )}*{--x:(y)}*{--x:(y) }*{--x:(y)}*{--x:(y )}*{--x:( y)}*{--x:f(y)}*{--x:f(y) }*{--x:f(y)}*{--x:f(y )}*{--x:f( y)}*{--x:[y]}*{--x:[y] }*{--x:[y]}*{--x:[y ]}*{--x:[ y]}*{--x:{y}}*{--x:{y} }*{--x:{y}}*{--x:{y }}*{--x:{ y}}@supports(--x:y , z ){a{color:red}}@supports(--x: ){a{color:red}}@supports(--x: ){a{color:red}}@supports ( --x ) {a{color:red}}@supports ( ) {a{color:red}}@supports ( . --x : y , z ) {a{color:red}}*{counter-reset:--a --a -a;--dash:-}#test_1 span::before{counter-increment:var(--dash)-;content:counter(--)}#test_2 span::before{counter-increment:var(--dash)-a;content:counter(--a)}#test_3 span::before{counter-increment:var(--dash)a;content:counter(-a)}#control_1 span::before{counter-increment:--;content:counter(--)}#control_2 span::before{counter-increment:--a;content:counter(--a)}#control_3 span::before{counter-increment:-a;content:counter(-a)}*{counter-reset:--a"string"} +div{--y: ;--x:var(--y);--z:0px;--foo:if(x > 5) this.width = 10;--bar: ;--bar2: ;--yz:foo!important}div{width:var(--a,)}.motion-safe\:shadow-md{--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-1:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), + 0 2px 4px -2px var(--tw-shadow-color)}*{--x: }*{--x: }*{--x: }*{--x: }*{--x: !important}*{--x: !important}*{--x: !important}*{--x: !important}*{--x: !important}*{--x: !important}*{--x: !important}*{--x: !important}*{--x:y}*{--x:y}*{--x:y}*{--x:y,}*{--x:var(y,)}*{--x:var(y, )}*{--x:(y)}*{--x:(y)}*{--x:(y)}*{--x:(y )}*{--x:( y)}*{--x:f(y)}*{--x:f(y)}*{--x:f(y)}*{--x:f(y )}*{--x:f( y)}*{--x:[y]}*{--x:[y]}*{--x:[y]}*{--x:[y ]}*{--x:[ y]}*{--x:{y}}*{--x:{y}}*{--x:{y}}*{--x:{y }}*{--x:{ y}}@supports(--x:y , z){a{color:red}}@supports(--x: ){a{color:red}}@supports(--x: ){a{color:red}}@supports ( --x ) {a{color:red}}@supports ( ) {a{color:red}}@supports ( . --x : y , z ) {a{color:red}}*{counter-reset:--a --a -a;--dash:-}#test_1 span::before{counter-increment:var(--dash)-;content:counter(--)}#test_2 span::before{counter-increment:var(--dash)-a;content:counter(--a)}#test_3 span::before{counter-increment:var(--dash)a;content:counter(-a)}#control_1 span::before{counter-increment:--;content:counter(--)}#control_2 span::before{counter-increment:--a;content:counter(--a)}#control_3 span::before{counter-increment:-a;content:counter(-a)}*{counter-reset:--a"string"} diff --git a/crates/swc_css_codegen/tests/fixture/declaration/important/output.css b/crates/swc_css_codegen/tests/fixture/declaration/important/output.css index ce7576d37ef7..d472cc2d1c69 100644 --- a/crates/swc_css_codegen/tests/fixture/declaration/important/output.css +++ b/crates/swc_css_codegen/tests/fixture/declaration/important/output.css @@ -1,5 +1,5 @@ :root { - --foo: red !important; + --foo: red!important; --foo: red!important; } div { @@ -24,7 +24,8 @@ a { } } .foo { - color: red !ie;} + color: red !ie; +} * { --x: !important; } diff --git a/crates/swc_css_codegen/tests/fixture/declaration/important/output.min.css b/crates/swc_css_codegen/tests/fixture/declaration/important/output.min.css index 680a3374f914..6e4565faeef8 100644 --- a/crates/swc_css_codegen/tests/fixture/declaration/important/output.min.css +++ b/crates/swc_css_codegen/tests/fixture/declaration/important/output.min.css @@ -1 +1 @@ -:root{--foo:red !important;--foo:red!important}div{color:red!important;color:red!important;color:red!important;color:red!important;color:red!important;color:red!important}a{b:c!important}.class{& div{color:red!important}}.class{& div{color:red!important}}.foo{color: red !ie;}*{--x: !important}*{--x: !important}*{--x: !important}*{--x: !important}*{--x: !important} +:root{--foo:red!important;--foo:red!important}div{color:red!important;color:red!important;color:red!important;color:red!important;color:red!important;color:red!important}a{b:c!important}.class{& div{color:red!important}}.class{& div{color:red!important}}.foo{color:red !ie}*{--x: !important}*{--x: !important}*{--x: !important}*{--x: !important}*{--x: !important} diff --git a/crates/swc_css_codegen/tests/fixture/preserved-token/custom-properties/output.css b/crates/swc_css_codegen/tests/fixture/preserved-token/custom-properties/output.css index e640df1a7418..a027e3a9ea9e 100644 --- a/crates/swc_css_codegen/tests/fixture/preserved-token/custom-properties/output.css +++ b/crates/swc_css_codegen/tests/fixture/preserved-token/custom-properties/output.css @@ -17,10 +17,10 @@ --x: y; } * { - --x: y ; + --x: y; } * { - --x: y, ; + --x: y,; } * { --x: var(y,); @@ -29,7 +29,7 @@ --x: (y); } * { - --x: (y) ; + --x: (y); } * { --x: (y); @@ -44,7 +44,7 @@ --x: f(y); } * { - --x: f(y) ; + --x: f(y); } * { --x: f(y); @@ -59,7 +59,7 @@ --x: [y]; } * { - --x: [y] ; + --x: [y]; } * { --x: [y]; @@ -74,7 +74,7 @@ --x: {y}; } * { - --x: {y} ; + --x: {y}; } * { --x: {y}; diff --git a/crates/swc_css_codegen/tests/fixture/preserved-token/custom-properties/output.min.css b/crates/swc_css_codegen/tests/fixture/preserved-token/custom-properties/output.min.css index e9d804f4a9fc..0dd2730239ae 100644 --- a/crates/swc_css_codegen/tests/fixture/preserved-token/custom-properties/output.min.css +++ b/crates/swc_css_codegen/tests/fixture/preserved-token/custom-properties/output.min.css @@ -1 +1 @@ -*{--x: }*{--x: }*{--x: }*{--x: }*{--x:y}*{--x:y}*{--x:y }*{--x:y, }*{--x:var(y,)}*{--x:(y)}*{--x:(y) }*{--x:(y)}*{--x:(y )}*{--x:( y)}*{--x:f(y)}*{--x:f(y) }*{--x:f(y)}*{--x:f(y )}*{--x:f( y)}*{--x:[y]}*{--x:[y] }*{--x:[y]}*{--x:[y ]}*{--x:[ y]}*{--x:{y}}*{--x:{y} }*{--x:{y}}*{--x:{y }}*{--x:{ y}} +*{--x: }*{--x: }*{--x: }*{--x: }*{--x:y}*{--x:y}*{--x:y}*{--x:y,}*{--x:var(y,)}*{--x:(y)}*{--x:(y)}*{--x:(y)}*{--x:(y )}*{--x:( y)}*{--x:f(y)}*{--x:f(y)}*{--x:f(y)}*{--x:f(y )}*{--x:f( y)}*{--x:[y]}*{--x:[y]}*{--x:[y]}*{--x:[y ]}*{--x:[ y]}*{--x:{y}}*{--x:{y}}*{--x:{y}}*{--x:{y }}*{--x:{ y}} diff --git a/crates/swc_css_codegen/tests/fixture/qualified_rule/recovery/output.css b/crates/swc_css_codegen/tests/fixture/qualified_rule/recovery/output.css index c2ce1c80cb8c..b0d107f61a8f 100644 --- a/crates/swc_css_codegen/tests/fixture/qualified_rule/recovery/output.css +++ b/crates/swc_css_codegen/tests/fixture/qualified_rule/recovery/output.css @@ -23,7 +23,7 @@ $bad: rule; a { div.major { color: blue } color: red } a { - div: hover { color: blue } color:red; + div: hover { color: blue } color: red; } a { div: hover { color: blue }; diff --git a/crates/swc_css_codegen/tests/fixture/qualified_rule/recovery/output.min.css b/crates/swc_css_codegen/tests/fixture/qualified_rule/recovery/output.min.css index c8ea0b3e704f..17e5b7035f3b 100644 --- a/crates/swc_css_codegen/tests/fixture/qualified_rule/recovery/output.min.css +++ b/crates/swc_css_codegen/tests/fixture/qualified_rule/recovery/output.min.css @@ -1,4 +1,4 @@ {}{color:red}#broken# {color:red}$bad{color:red}$bad {color:red}$bad foo{color:red}$bad foo {color:red}$bad: rule; -a {div.major { color: blue } color: red }a{div:hover{ color: blue }color:red}a{div:hover{ color: blue };color:red} +a {div.major { color: blue } color: red }a{div:hover { color: blue } color: red}a{div:hover{ color: blue };color:red} diff --git a/crates/swc_css_codegen/tests/fixture/style-blocks-contents/hacks/output.css b/crates/swc_css_codegen/tests/fixture/style-blocks-contents/hacks/output.css index 638eedb17c41..33531f6609de 100644 --- a/crates/swc_css_codegen/tests/fixture/style-blocks-contents/hacks/output.css +++ b/crates/swc_css_codegen/tests/fixture/style-blocks-contents/hacks/output.css @@ -135,7 +135,8 @@ body:first-of-type .selector {} |property: value;color: red; } .selector { - property: value !ie;} + property: value !ie; +} @media screen\9 {} @media \0screen\,screen\9 {} @media \0screen {} diff --git a/crates/swc_css_codegen/tests/fixture/style-blocks-contents/hacks/output.min.css b/crates/swc_css_codegen/tests/fixture/style-blocks-contents/hacks/output.min.css index a51089ce3b68..face450d8f19 100644 --- a/crates/swc_css_codegen/tests/fixture/style-blocks-contents/hacks/output.min.css +++ b/crates/swc_css_codegen/tests/fixture/style-blocks-contents/hacks/output.min.css @@ -1 +1 @@ -.selector:not(*:root){}@media screen and (min-width:0\0){}.selector:not(*:root){}@supports(-webkit-appearance:none){}.selector{(;property: value;);}.selector{[;property: value;];}@media \\0 screen {}@media all and (-webkit-min-device-pixel-ratio:0)and (min-resolution:.001dpcm){.selector{}}body:empty .selector{}body:last-child .selector,x:-moz-any-link{}@media \0 all{}body:last-child .selector,x:-moz-any-link,x:default{}body:not(:-moz-handler-blocked) .selector{}@media screen and (-moz-images-in-menus:0){}@media screen and (min--moz-device-pixel-ratio:0){}_::-moz-progress-bar,body:last-child .selector{}@media all and (min--moz-device-pixel-ratio:0)and (min-resolution:.001dpcm){}@media all and (-moz-images-in-menus:0)and (min-resolution:.001dpcm){}@media all and (min--moz-device-pixel-ratio:0){@media(min-width:0px){}}@media all and (-moz-images-in-menus:0){@media(min-width:0px){}}@supports(-moz-appearance:meterbar){}_::-moz-range-track,body:last-child .selector{}@supports(-moz-appearance:meterbar)and (display:flex){}@supports(-moz-appearance:meterbar)and (cursor:zoom-in){}@supports(-moz-appearance:meterbar)and (background-attachment:local){}@supports(-moz-appearance:meterbar)and (image-orientation:90deg){}@supports(-moz-appearance:meterbar)and (all:initial){}@supports(-moz-appearance:meterbar)and (list-style-type:japanese-formal){}@media all and (min--moz-device-pixel-ratio:0)and (min-resolution:30dpcm){}@supports(-moz-appearance:meterbar)and (background-blend-mode:difference,normal){}_:-moz-tree-row(hover),.selector{}_::selection,.selector:not([attr*=""]){}@supports(-webkit-appearance:none){}* html .selector{}.unused-class.selector{}html>body .selector{}*:first-child+html .selector{}.selector,x:-ie7{}*+html .selector{}body *.selector{}.selector\ {}html>body .selector{}head~body .selector{}_::selection,.selector:not([attr*=""]){}:root .selector{}body:last-child .selector{}body:nth-of-type(1) .selector{}body:first-of-type .selector{}.selector:not([attr*=""]){}.selector{_property:value}.selector{-property:value}.selector{property:value\9}.selector{property:value\9}.selector{!property: value;color:red}.selector{$property: value;color:red}.selector{color:red;&property: value;}.selector{*property: value;color:red}.selector{)property: value;color:red}.selector{=property: value;color:red}.selector{%property: value;color:red}.selector{+property: value;color:red}.selector{color:red;@property: value;}.selector{,property: value;color:red}.selector{.property: value;color:red}.selector{/property: value;color:red}.selector{`property: value;color:red}.selector{]property: value;color:red}.selector{#property: value;color:red}.selector{~property: value;color:red}.selector{?property: value;color:red}.selector{:property: value;color:red}.selector{|property: value;color:red}.selector{property: value !ie;}@media screen\9{}@media \0screen\,screen\9 {}@media \0screen{}@media screen and (min-width:0\0){}_:-ms-input-placeholder,:root .selector{}_:-ms-fullscreen,:root .selector{}@media screen and (-ms-high-contrast:active),(-ms-high-contrast:none){}@media screen{@media(min-width:0px){}}.selector:not(*:root){}@supports(-webkit-appearance:none){}.selector{(;property: value;);}.selector{[;property: value;];}html:first-child .selector{}_:-o-prefocus,body:last-child .selector{}@media all and (-webkit-min-device-pixel-ratio:1e4),not all and (-webkit-min-device-pixel-ratio:0){}@media(min-resolution:.001dpcm){_:-o-prefocus,.selector{}}*|html[xmlns*=""] .selector{}@media all and (-webkit-min-device-pixel-ratio:0)and (min-resolution:.001dpcm){.selector{}}.selector:not(*:root){}@supports(-webkit-appearance:none){}.selector{(;property: value;);}.selector{[;property: value;];}@media screen and (min-width:0\0){}@media screen{@media(min-width:0px){}}html:first-child .selector{}html[xmlns*=""] body:last-child .selector{}html[xmlns*=""]:root .selector{}*|html[xmlns*=""] .selector{}_::-moz-svg-foreign-content,:root .selector{}@media \\0 screen {}a{*color : black;_background:white;font-size:big;$(var)-size: 100%;}a{*b:c}div{color:red}selector{property:value;property:normal-value}div{color:red} +.selector:not(*:root){}@media screen and (min-width:0\0){}.selector:not(*:root){}@supports(-webkit-appearance:none){}.selector{(;property: value;);}.selector{[;property: value;];}@media \\0 screen {}@media all and (-webkit-min-device-pixel-ratio:0)and (min-resolution:.001dpcm){.selector{}}body:empty .selector{}body:last-child .selector,x:-moz-any-link{}@media \0 all{}body:last-child .selector,x:-moz-any-link,x:default{}body:not(:-moz-handler-blocked) .selector{}@media screen and (-moz-images-in-menus:0){}@media screen and (min--moz-device-pixel-ratio:0){}_::-moz-progress-bar,body:last-child .selector{}@media all and (min--moz-device-pixel-ratio:0)and (min-resolution:.001dpcm){}@media all and (-moz-images-in-menus:0)and (min-resolution:.001dpcm){}@media all and (min--moz-device-pixel-ratio:0){@media(min-width:0px){}}@media all and (-moz-images-in-menus:0){@media(min-width:0px){}}@supports(-moz-appearance:meterbar){}_::-moz-range-track,body:last-child .selector{}@supports(-moz-appearance:meterbar)and (display:flex){}@supports(-moz-appearance:meterbar)and (cursor:zoom-in){}@supports(-moz-appearance:meterbar)and (background-attachment:local){}@supports(-moz-appearance:meterbar)and (image-orientation:90deg){}@supports(-moz-appearance:meterbar)and (all:initial){}@supports(-moz-appearance:meterbar)and (list-style-type:japanese-formal){}@media all and (min--moz-device-pixel-ratio:0)and (min-resolution:30dpcm){}@supports(-moz-appearance:meterbar)and (background-blend-mode:difference,normal){}_:-moz-tree-row(hover),.selector{}_::selection,.selector:not([attr*=""]){}@supports(-webkit-appearance:none){}* html .selector{}.unused-class.selector{}html>body .selector{}*:first-child+html .selector{}.selector,x:-ie7{}*+html .selector{}body *.selector{}.selector\ {}html>body .selector{}head~body .selector{}_::selection,.selector:not([attr*=""]){}:root .selector{}body:last-child .selector{}body:nth-of-type(1) .selector{}body:first-of-type .selector{}.selector:not([attr*=""]){}.selector{_property:value}.selector{-property:value}.selector{property:value\9}.selector{property:value\9}.selector{!property: value;color:red}.selector{$property: value;color:red}.selector{color:red;&property: value;}.selector{*property: value;color:red}.selector{)property: value;color:red}.selector{=property: value;color:red}.selector{%property: value;color:red}.selector{+property: value;color:red}.selector{color:red;@property: value;}.selector{,property: value;color:red}.selector{.property: value;color:red}.selector{/property: value;color:red}.selector{`property: value;color:red}.selector{]property: value;color:red}.selector{#property: value;color:red}.selector{~property: value;color:red}.selector{?property: value;color:red}.selector{:property: value;color:red}.selector{|property: value;color:red}.selector{property:value !ie}@media screen\9{}@media \0screen\,screen\9 {}@media \0screen{}@media screen and (min-width:0\0){}_:-ms-input-placeholder,:root .selector{}_:-ms-fullscreen,:root .selector{}@media screen and (-ms-high-contrast:active),(-ms-high-contrast:none){}@media screen{@media(min-width:0px){}}.selector:not(*:root){}@supports(-webkit-appearance:none){}.selector{(;property: value;);}.selector{[;property: value;];}html:first-child .selector{}_:-o-prefocus,body:last-child .selector{}@media all and (-webkit-min-device-pixel-ratio:1e4),not all and (-webkit-min-device-pixel-ratio:0){}@media(min-resolution:.001dpcm){_:-o-prefocus,.selector{}}*|html[xmlns*=""] .selector{}@media all and (-webkit-min-device-pixel-ratio:0)and (min-resolution:.001dpcm){.selector{}}.selector:not(*:root){}@supports(-webkit-appearance:none){}.selector{(;property: value;);}.selector{[;property: value;];}@media screen and (min-width:0\0){}@media screen{@media(min-width:0px){}}html:first-child .selector{}html[xmlns*=""] body:last-child .selector{}html[xmlns*=""]:root .selector{}*|html[xmlns*=""] .selector{}_::-moz-svg-foreign-content,:root .selector{}@media \\0 screen {}a{*color : black;_background:white;font-size:big;$(var)-size: 100%;}a{*b:c}div{color:red}selector{property:value;property:normal-value}div{color:red} diff --git a/crates/swc_css_codegen/tests/fixture/values/url/1/output.css b/crates/swc_css_codegen/tests/fixture/values/url/1/output.css index 1928ae376339..07106ac5a9dc 100644 --- a/crates/swc_css_codegen/tests/fixture/values/url/1/output.css +++ b/crates/swc_css_codegen/tests/fixture/values/url/1/output.css @@ -45,7 +45,8 @@ div { background: url('\"foo\"'); } .bar { - background: url(http://example.com/image.svg param(--color var(--primary-color)));} + background: url(http://example.com/image.svg param(--color var(--primary-color); +} .baz { background: url("http://example.com/image.svg" param(--color var(--primary-color))); } diff --git a/crates/swc_css_codegen/tests/fixture/values/url/1/output.min.css b/crates/swc_css_codegen/tests/fixture/values/url/1/output.min.css index 1056ca1c8a32..a9b928a6ea5d 100644 --- a/crates/swc_css_codegen/tests/fixture/values/url/1/output.min.css +++ b/crates/swc_css_codegen/tests/fixture/values/url/1/output.min.css @@ -1 +1 @@ -div{background:url(https://example.com/image.png);background:url(https://example.com/image.png);background:url(https://example.com/image.png);background:url("https://example.com/image.png");background:url("https://example.com/image.png");background:url("https://example.com/image.png");background:url("https://example.com/image.png");background:url(data:image/png;base64,iRxVB0);background:url(#IDofSVGpath);background:url("//aa.com/img.svg"prefetch);background:url("//aa.com/img.svg"foo bar baz func(test));background:url("http://example.com/image.svg"param(--color var(--primary-color)));background:url();background:url("");background:url("");--foo:"http://www.example.com/pinkish.gif";background:src("http://www.example.com/pinkish.gif");background:src("http://www.example.com/pinkish.gif");background:src(var(--foo));background:url(https://example.com/image.png);background:url(https://example.com/image.png);background:url(https://example.com/image.png);background:url(https://example.com/image.png);background:url(image.png힙)}div{background:url(foo.img)red}*{background:url("foo");background:url("f o");background:url("f o");background:url("foo)");background:url("(foo");background:url("(foo)");background:url('"foo"')}.bar{background: url(http://example.com/image.svg param(--color var(--primary-color)));}.baz{background:url("http://example.com/image.svg"param(--color var(--primary-color)))}.foo{background:url(__ident__)} +div{background:url(https://example.com/image.png);background:url(https://example.com/image.png);background:url(https://example.com/image.png);background:url("https://example.com/image.png");background:url("https://example.com/image.png");background:url("https://example.com/image.png");background:url("https://example.com/image.png");background:url(data:image/png;base64,iRxVB0);background:url(#IDofSVGpath);background:url("//aa.com/img.svg"prefetch);background:url("//aa.com/img.svg"foo bar baz func(test));background:url("http://example.com/image.svg"param(--color var(--primary-color)));background:url();background:url("");background:url("");--foo:"http://www.example.com/pinkish.gif";background:src("http://www.example.com/pinkish.gif");background:src("http://www.example.com/pinkish.gif");background:src(var(--foo));background:url(https://example.com/image.png);background:url(https://example.com/image.png);background:url(https://example.com/image.png);background:url(https://example.com/image.png);background:url(image.png힙)}div{background:url(foo.img)red}*{background:url("foo");background:url("f o");background:url("f o");background:url("foo)");background:url("(foo");background:url("(foo)");background:url('"foo"')}.bar{background:url(http://example.com/image.svg param(--color var(--primary-color)}.baz{background:url("http://example.com/image.svg"param(--color var(--primary-color)))}.foo{background:url(__ident__)} diff --git a/crates/swc_css_lints/src/rules/unit_no_unknown.rs b/crates/swc_css_lints/src/rules/unit_no_unknown.rs index 4378364d50c6..1c8d2594a3e3 100644 --- a/crates/swc_css_lints/src/rules/unit_no_unknown.rs +++ b/crates/swc_css_lints/src/rules/unit_no_unknown.rs @@ -48,4 +48,21 @@ impl Visit for UnitNoUnknown { unknown_dimension.visit_children_with(self); } + + fn visit_component_value(&mut self, component_value: &ComponentValue) { + if let ComponentValue::PreservedToken( + token_and_span @ TokenAndSpan { + token: Token::Dimension { unit, .. }, + .. + }, + ) = component_value + { + if self.ignored_units.iter().all(|item| !item.is_match(unit)) { + let message = format!("Unexpected unknown unit \"{}\".", unit); + self.ctx.report(token_and_span, message); + } + } + + component_value.visit_children_with(self); + } } diff --git a/crates/swc_css_lints/tests/rules/fail/unit-no-unknown/default/output.stderr b/crates/swc_css_lints/tests/rules/fail/unit-no-unknown/default/output.stderr index d87da1e688d1..b3eb1e930bc4 100644 --- a/crates/swc_css_lints/tests/rules/fail/unit-no-unknown/default/output.stderr +++ b/crates/swc_css_lints/tests/rules/fail/unit-no-unknown/default/output.stderr @@ -26,7 +26,7 @@ x Unexpected unknown unit "pix". ,-[$DIR/tests/rules/fail/unit-no-unknown/default/input.css:5:1] 5 | a { color: rgb(255pix, 0, 51); } - : ^^^ + : ^^^^^^ `---- x Unexpected unknown unit "pix". diff --git a/crates/swc_css_parser/src/parser/syntax/mod.rs b/crates/swc_css_parser/src/parser/syntax/mod.rs index 69d95223c11e..f87eb11d389a 100644 --- a/crates/swc_css_parser/src/parser/syntax/mod.rs +++ b/crates/swc_css_parser/src/parser/syntax/mod.rs @@ -15,6 +15,9 @@ where { fn parse(&mut self) -> PResult { let start = self.input.cur_span(); + + // Consume a list of rules from input, with the top-level flag set, and set the + // stylesheet’s value to the result. let rules = self .with_ctx(Ctx { is_top_level: true, @@ -23,6 +26,7 @@ where .parse_as::>()?; let last = self.input.last_pos(); + // Return the stylesheet. Ok(Stylesheet { span: Span::new(start.lo, last, Default::default()), rules, @@ -35,6 +39,8 @@ where I: ParserInput, { fn parse(&mut self) -> PResult> { + // To consume a list of rules, given a top-level flag: + // Create an initially empty list of rules. let mut rules = vec![]; @@ -122,10 +128,12 @@ where I: ParserInput, { fn parse(&mut self) -> PResult { + // To consume an at-rule: + // Consume the next input token. Create a new at-rule with its name set to the // value of the current input token, its prelude initially set to an empty list, // and its value initially set to nothing. - let at_rule_span = self.input.cur_span(); + let span = self.input.cur_span(); let at_keyword_name = match bump!(self) { Token::AtKeyword { value, raw } => (value, raw), _ => { @@ -136,11 +144,7 @@ where ( at_keyword_name.0.to_ascii_lowercase(), AtRuleName::DashedIdent(DashedIdent { - span: Span::new( - at_rule_span.lo + BytePos(1), - at_rule_span.hi, - Default::default(), - ), + span: Span::new(span.lo + BytePos(1), span.hi, Default::default()), value: at_keyword_name.0, raw: Some(at_keyword_name.1), }), @@ -149,11 +153,7 @@ where ( at_keyword_name.0.to_ascii_lowercase(), AtRuleName::Ident(Ident { - span: Span::new( - at_rule_span.lo + BytePos(1), - at_rule_span.hi, - Default::default(), - ), + span: Span::new(span.lo + BytePos(1), span.hi, Default::default()), value: at_keyword_name.0, raw: Some(at_keyword_name.1), }), @@ -172,11 +172,11 @@ where // This is a parse error. Return the at-rule. if is!(self, EOF) { self.errors.push(Error::new( - at_rule_span, - ErrorKind::EofButExpected("semicolon or curly block"), + span!(self, span.lo), + ErrorKind::EofButExpected("';' or '{'"), )); - at_rule.span = span!(self, at_rule_span.lo); + at_rule.span = span!(self, span.lo); return Ok(at_rule); } @@ -196,7 +196,7 @@ where Ok(at_rule_prelude) => match at_rule_prelude { None if normalized_at_rule_name == js_word!("layer") => { self.errors.push(Error::new( - at_rule_span, + span, ErrorKind::Expected("at least one name"), )); @@ -220,7 +220,7 @@ where } } }; - at_rule.span = span!(self, at_rule_span.lo); + at_rule.span = span!(self, span.lo); return Ok(at_rule); } @@ -287,7 +287,7 @@ where Some(block) } }; - at_rule.span = span!(self, at_rule_span.lo); + at_rule.span = span!(self, span.lo); return Ok(at_rule); } @@ -314,6 +314,7 @@ where I: ParserInput, { fn parse(&mut self) -> PResult { + // To consume a qualified rule: let create_prelude = |p: &mut Parser, list: Vec| -> PResult { let list_of_component_values = p.create_locv(list); @@ -377,9 +378,10 @@ where // // This is a parse error. Return nothing. if is!(self, EOF) { - let span = self.input.cur_span(); - - return Err(Error::new(span, ErrorKind::Eof)); + return Err(Error::new( + span!(self, span.lo), + ErrorKind::EofButExpected("'{'"), + )); } match cur!(self) { @@ -762,23 +764,29 @@ where I: ParserInput, { fn parse(&mut self) -> PResult { - let span = self.input.cur_span(); + // To consume a declaration: // Consume the next input token. Create a new declaration with its name set // to the value of the current input token and its value initially set to an // empty list. + let span = self.input.cur_span(); let is_dashed_ident = match cur!(self) { Token::Ident { value, .. } => value.starts_with("--"), _ => { return Err(Error::new(span, ErrorKind::Expected("Ident"))); } }; - let name = if is_dashed_ident { DeclarationName::DashedIdent(self.parse()?) } else { DeclarationName::Ident(self.parse()?) }; + let mut declaration = Declaration { + span: Default::default(), + name, + value: vec![], + important: None, + }; // 1. While the next input token is a , consume the next input // token. @@ -792,124 +800,180 @@ where // token. self.input.skip_ws(); - let mut end = self.input.cur_span().hi; - let mut value = vec![]; - // 4. As long as the next input token is anything other than an , // consume a component value and append it to the declaration’s value. - if !is!(self, EOF) { - match is_dashed_ident { - true => { - value.extend(self.parse_declaration_value()?); - } - false => { - loop { - // TODO fix me - self.input.skip_ws(); - - // TODO fix me - if is_one_of!(self, EOF, "!", ";", "}", ")") { - break; - } - - let state = self.input.state(); - let ctx = Ctx { - block_contents_grammar: BlockContentsGrammar::DeclarationValue, - ..self.ctx - }; - let parsed = self.with_ctx(ctx).parse_as::(); - let value_or_token = match parsed { - Ok(value) => value, - Err(err) => { - self.errors.push(err); - self.input.reset(&state); - - let ctx = Ctx { - block_contents_grammar: BlockContentsGrammar::NoGrammar, - ..self.ctx - }; - - self.with_ctx(ctx).parse_as::()? - } - }; + let mut last_whitespaces = (0, 0, 0); + let mut exclamation_point_span = None; + let mut important_ident = None; - value.push(value_or_token); - end = self.input.last_pos(); + loop { + // TODO fix me `)`, workaround + if is_one_of!(self, EOF, ")") { + if important_ident.is_none() { + if let Some(span) = &exclamation_point_span { + // TODO improve me to `` + self.errors.push(Error::new( + *span, + ErrorKind::Unexpected("'!' in "), + )); } } + + break; } - match value.last() { - Some(ComponentValue::PreservedToken(TokenAndSpan { + let component_value = self + .with_ctx(Ctx { + block_contents_grammar: BlockContentsGrammar::NoGrammar, + ..self.ctx + }) + .parse_as::()?; + + match &component_value { + // Optimization for step 5 + ComponentValue::PreservedToken( + token_and_span @ TokenAndSpan { + token: Token::Ident { value, .. }, + .. + }, + ) if exclamation_point_span.is_some() + && value.to_ascii_lowercase() == js_word!("important") => + { + important_ident = Some(token_and_span.clone()); + } + ComponentValue::PreservedToken(TokenAndSpan { span, - token: Token::BadUrl { .. }, + token: Token::Delim { value: '!', .. }, .. - })) - | Some(ComponentValue::PreservedToken(TokenAndSpan { - span, - token: Token::BadString { .. }, + }) => { + exclamation_point_span = Some(*span); + + if important_ident.is_some() { + important_ident = None; + + last_whitespaces = (last_whitespaces.2, 0, 0); + } + } + // Optimization for step 6 + ComponentValue::PreservedToken(TokenAndSpan { + token: Token::WhiteSpace { .. }, .. - })) => { - return Err(Error::new( - *span, - ErrorKind::Unexpected("token in "), - )); + }) => match (&exclamation_point_span, &important_ident) { + (Some(_), Some(_)) => { + last_whitespaces.2 += 1; + } + (Some(_), None) => { + last_whitespaces.1 += 1; + } + (None, None) => { + last_whitespaces.0 += 1; + } + _ => { + unreachable!(); + } + }, + _ => { + last_whitespaces = (0, 0, 0); + + if let Some(span) = &exclamation_point_span { + // TODO improve me to `` + self.errors.push(Error::new( + *span, + ErrorKind::Unexpected("'!' in "), + )); + + important_ident = None; + exclamation_point_span = None; + } } - _ => {} - }; + } + + declaration.value.push(component_value); } // 5. If the last two non-s in the declaration’s value are a // with the value "!" followed by an with a value // that is an ASCII case-insensitive match for "important", remove them from the // declaration’s value and set the declaration’s important flag to true. - self.input.skip_ws(); - - let important = if is!(self, "!") { - let important_flag = self.parse()?; + if let (Some(exclamation_point_span), Some(important_ident)) = + (exclamation_point_span, important_ident) + { + let span = Span::new( + exclamation_point_span.lo, + important_ident.span_hi(), + Default::default(), + ); + let value = match important_ident.token { + Token::Ident { value, raw } => (value, raw), + _ => { + unreachable!(); + } + }; + let value = Ident { + span: important_ident.span, + value: value.0, + raw: Some(value.1), + }; - end = self.input.last_pos(); + declaration.important = Some(ImportantFlag { span, value }); + } - Some(important_flag) + // 6. While the last token in the declaration’s value is a , + // remove that token. + let len = if declaration.important.is_some() { + declaration.value.len() + - (last_whitespaces.0 + last_whitespaces.1 + last_whitespaces.2 + 2) } else { - None + declaration.value.len() - (last_whitespaces.0 + last_whitespaces.1 + last_whitespaces.2) }; - // 6. While the last token in the declaration’s value is a , - // remove that token. - self.input.skip_ws(); + declaration.value.truncate(len); - // 7. Return the declaration. - Ok(Declaration { - span: Span::new(span.lo, end, Default::default()), - name, - value, - important, - }) - } -} + // Update span + // TODO for commit history + if let Some(important) = &declaration.important { + declaration.span = Span::new(span.lo, important.span_hi(), Default::default()); + } else if let Some(last) = declaration.value.last() { + declaration.span = Span::new(span.lo, last.span_hi(), Default::default()); + } else { + declaration.span = span!(self, span.lo); + } -impl Parse for Parser -where - I: ParserInput, -{ - fn parse(&mut self) -> PResult { - let span = self.input.cur_span(); + if is_dashed_ident { + // Don't parse custom properties + // + // 7. Return the declaration. + return Ok(declaration); + } - expect!(self, "!"); + // Grammar parsing + let locv = self.create_locv(declaration.value); - self.input.skip_ws(); + declaration.value = match self.parse_according_to_grammar(&locv, |parser| { + let mut values = vec![]; - let ident: Ident = self.parse()?; + loop { + if is!(parser, EOF) { + break; + } - if &*ident.value.to_ascii_lowercase() != "important" { - return Err(Error::new(span, ErrorKind::Expected("important"))); - } + values.push(parser.parse_generic_value()?); + } - Ok(ImportantFlag { - span: span!(self, span.lo), - value: ident, - }) + Ok(values) + }) { + Ok(values) => values, + Err(err) => { + if *err.kind() != ErrorKind::Ignore { + self.errors.push(err); + } + + locv.children + } + }; + + // 7. Return the declaration. + Ok(declaration) } } @@ -918,137 +982,31 @@ where I: ParserInput, { fn parse(&mut self) -> PResult { - match self.ctx.block_contents_grammar { - BlockContentsGrammar::NoGrammar => { - // Consume the next input token. - match cur!(self) { - // If the current input token is a <{-token>, <[-token>, or <(-token>, consume a - // simple block and return it. - tok!("[") | tok!("(") | tok!("{") => { - let block = self.parse()?; - - Ok(ComponentValue::SimpleBlock(block)) - } - // Otherwise, if the current input token is a , consume a - // function and return it. - tok!("function") => Ok(ComponentValue::Function(self.parse()?)), - // Otherwise, return the current input token. - _ => { - let token = self.input.bump(); + match cur!(self) { + // If the current input token is a <{-token>, <[-token>, or <(-token>, consume a + // simple block and return it. + tok!("[") | tok!("(") | tok!("{") => { + let block = self.parse()?; - match token { - Some(t) => Ok(ComponentValue::PreservedToken(t)), - _ => { - unreachable!(); - } - } - } - } + Ok(ComponentValue::SimpleBlock(block)) } - _ => { - // TODO refactor me - self.input.skip_ws(); - - let span = self.input.cur_span(); - - match cur!(self) { - tok!(",") | tok!("/") | tok!(";") => { - return Ok(ComponentValue::Delimiter(self.parse()?)); - } - - tok!("string") => { - return Ok(ComponentValue::Str(self.parse()?)); - } + // Otherwise, if the current input token is a , consume a + // function and return it. + tok!("function") => { + let function = self.parse()?; - tok!("url") => { - return Ok(ComponentValue::Url(self.parse()?)); - } - - Token::Function { value, .. } => match &*value.to_ascii_lowercase() { - "url" | "src" => { - return Ok(ComponentValue::Url(self.parse()?)); - } - "rgb" | "rgba" | "hsl" | "hsla" | "hwb" | "lab" | "lch" | "oklab" - | "oklch" | "color" | "device-cmyk" | "color-mix" | "color-contrast" => { - return Ok(ComponentValue::Color(self.parse()?)); - } - _ => { - return Ok(ComponentValue::Function(self.parse()?)); - } - }, - - tok!("percentage") => { - return Ok(ComponentValue::Percentage(self.parse()?)); - } - - tok!("dimension") => return Ok(ComponentValue::Dimension(self.parse()?)), - - Token::Number { type_flag, .. } => { - if *type_flag == NumberType::Integer { - return Ok(ComponentValue::Integer(self.parse()?)); - } - - return Ok(ComponentValue::Number(self.parse()?)); - } - - Token::Ident { value, .. } => { - if value.starts_with("--") { - return Ok(ComponentValue::DashedIdent(self.parse()?)); - } else if &*value.to_ascii_lowercase() == "u" - && peeked_is_one_of!(self, "+", "number", "dimension") - { - return Ok(ComponentValue::UnicodeRange(self.parse()?)); - } - - return Ok(ComponentValue::Ident(self.parse()?)); - } - - tok!("[") | tok!("(") | tok!("{") => { - let ctx = Ctx { - block_contents_grammar: BlockContentsGrammar::NoGrammar, - ..self.ctx - }; - let mut block = self.with_ctx(ctx).parse_as::()?; - let locv = self.create_locv(block.value); - - block.value = match self.parse_according_to_grammar(&locv, |parser| { - let mut values = vec![]; - - loop { - parser.input.skip_ws(); - - if is!(parser, EOF) { - break; - } - - let component_value = parser.parse()?; - - values.push(component_value); - } - - Ok(values) - }) { - Ok(values) => values, - Err(err) => { - if *err.kind() != ErrorKind::Ignore { - self.errors.push(err); - } - - locv.children - } - }; - - return Ok(ComponentValue::SimpleBlock(block)); - } + Ok(ComponentValue::Function(function)) + } + // Otherwise, return the current input token. + _ => { + let token = self.input.bump(); - tok!("#") => { - return Ok(ComponentValue::Color(self.parse()?)); + match token { + Some(t) => Ok(ComponentValue::PreservedToken(t)), + _ => { + unreachable!(); } - - _ => {} } - - Err(Error::new(span, ErrorKind::Expected("Declaration value"))) } } } @@ -1059,6 +1017,10 @@ where I: ParserInput, { fn parse(&mut self) -> PResult { + // To consume a simple block: + + // Create a simple block with its associated token set to the current input + // token and with its value initially set to an empty list. let span = self.input.cur_span(); let name = match cur!(self) { tok!("{") | tok!("(") | tok!("[") => self.input.bump().unwrap(), @@ -1069,8 +1031,6 @@ where )); } }; - // Create a simple block with its associated token set to the current input - // token and with its value initially set to an empty list. let mut simple_block = SimpleBlock { span: Default::default(), name, @@ -1082,9 +1042,19 @@ where // // This is a parse error. Return the block. if is!(self, EOF) { - let span = self.input.cur_span(); + let mirror = match &simple_block.name.token { + Token::LBracket => "']'", + Token::LParen => "')'", + Token::LBrace => "'}'", + _ => { + unreachable!(); + } + }; - self.errors.push(Error::new(span, ErrorKind::Eof)); + self.errors.push(Error::new( + span!(self, span.lo), + ErrorKind::EofButExpected(mirror), + )); break; } @@ -1124,6 +1094,107 @@ where } } +impl Parse for Parser +where + I: ParserInput, +{ + fn parse(&mut self) -> PResult { + // Note: This algorithm assumes that the current input token has already been + // checked to be a . + // + // To consume a function: + + // Create a function with its name equal to the value of the current input token + // and with its value initially set to an empty list. + let span = self.input.cur_span(); + let ident = match bump!(self) { + Token::Function { value, raw } => (value, raw), + _ => { + unreachable!() + } + }; + let function_name = &*ident.0.to_ascii_lowercase(); + let name = Ident { + span: swc_common::Span::new(span.lo, span.hi - BytePos(1), Default::default()), + value: ident.0, + raw: Some(ident.1), + }; + + let mut function = Function { + span: Default::default(), + name, + value: vec![], + }; + + let mut with_error = false; + + // Repeatedly consume the next input token and process it as follows: + loop { + // + // This is a parse error. Return the function. + if is!(self, EOF) { + self.errors.push(Error::new( + span!(self, span.lo), + ErrorKind::EofButExpected("')'"), + )); + + break; + } + + match cur!(self) { + // <)-token> + // Return the function. + tok!(")") => { + bump!(self); + + break; + } + // anything else + // Reconsume the current input token. Consume a component value and append the + // returned value to the function’s value. + _ => match self.ctx.block_contents_grammar { + BlockContentsGrammar::NoGrammar => { + let ctx = Ctx { + block_contents_grammar: BlockContentsGrammar::NoGrammar, + ..self.ctx + }; + + let component_value = self.with_ctx(ctx).parse_as::()?; + + function.value.push(component_value); + } + _ => { + if with_error { + function.value.push(self.parse()?); + } else { + let state = self.input.state(); + let values = self.parse_function_values(function_name); + + match values { + Ok(values) => { + function.value.extend(values); + } + Err(err) => { + self.errors.push(err); + self.input.reset(&state); + + with_error = true; + + function.value.push(self.parse()?); + } + } + } + } + }, + } + } + + function.span = span!(self, span.lo); + + return Ok(function); + } +} + impl Parse for Parser where I: ParserInput, @@ -1136,6 +1207,9 @@ where }; let mut children = vec![]; + // Repeatedly consume a component value from input until an is + // returned, appending the returned values (except the final ) into a + // list. Return the list. loop { if is!(self, EOF) { break; diff --git a/crates/swc_css_parser/src/parser/values_and_units/mod.rs b/crates/swc_css_parser/src/parser/values_and_units/mod.rs index 476b764d2a43..bcb74a232bde 100644 --- a/crates/swc_css_parser/src/parser/values_and_units/mod.rs +++ b/crates/swc_css_parser/src/parser/values_and_units/mod.rs @@ -11,84 +11,195 @@ impl Parser where I: ParserInput, { - /// Parse value as . - pub(super) fn parse_declaration_value(&mut self) -> PResult> { - let mut value = vec![]; - let mut balance_stack: Vec> = vec![]; + pub(super) fn parse_generic_value(&mut self) -> PResult { + self.input.skip_ws(); - // The production matches any sequence of one or more - // tokens, so long as the sequence does not contain ... - loop { - if is!(self, EOF) { - break; + let span = self.input.cur_span(); + + match cur!(self) { + tok!(",") | tok!("/") | tok!(";") => { + return Ok(ComponentValue::Delimiter(self.parse()?)); } - match cur!(self) { - // ... , , - tok!("bad-string") | tok!("bad-url") => break, + tok!("string") => { + return Ok(ComponentValue::Str(self.parse()?)); + } - // ... unmatched <)-token>, <]-token>, or <}-token>, - tok!(")") | tok!("]") | tok!("}") => { - let value = match cur!(self) { - tok!(")") => ')', - tok!("]") => ']', - tok!("}") => '}', - _ => { - unreachable!(); - } - }; + tok!("url") => { + return Ok(ComponentValue::Url(self.parse()?)); + } - let balance_close_type = match balance_stack.pop() { - Some(v) => v, - None => None, - }; + Token::Function { value, .. } => match &*value.to_ascii_lowercase() { + "url" | "src" => { + return Ok(ComponentValue::Url(self.parse()?)); + } + "rgb" | "rgba" | "hsl" | "hsla" | "hwb" | "lab" | "lch" | "oklab" | "oklch" + | "color" | "device-cmyk" | "color-mix" | "color-contrast" => { + return Ok(ComponentValue::Color(self.parse()?)); + } + _ => { + return Ok(ComponentValue::Function( + self.with_ctx(Ctx { + block_contents_grammar: BlockContentsGrammar::DeclarationValue, + ..self.ctx + }) + .parse_as::()?, + )); + } + }, - if Some(value) != balance_close_type { - break; - } + tok!("percentage") => { + return Ok(ComponentValue::Percentage(self.parse()?)); + } + + tok!("dimension") => return Ok(ComponentValue::Dimension(self.parse()?)), + + Token::Number { type_flag, .. } => { + if *type_flag == NumberType::Integer { + return Ok(ComponentValue::Integer(self.parse()?)); } - tok!("function") | tok!("(") | tok!("[") | tok!("{") => { - let value = match cur!(self) { - tok!("function") | tok!("(") => ')', - tok!("[") => ']', - tok!("{") => '}', - _ => { - unreachable!(); - } - }; + return Ok(ComponentValue::Number(self.parse()?)); + } - balance_stack.push(Some(value)); + Token::Ident { value, .. } => { + if value.starts_with("--") { + return Ok(ComponentValue::DashedIdent(self.parse()?)); + } else if &*value.to_ascii_lowercase() == "u" + && peeked_is_one_of!(self, "+", "number", "dimension") + { + return Ok(ComponentValue::UnicodeRange(self.parse()?)); } - // ... or top-level tokens - tok!(";") => { - if balance_stack.is_empty() { - break; + return Ok(ComponentValue::Ident(self.parse()?)); + } + + tok!("[") | tok!("(") | tok!("{") => { + let ctx = Ctx { + block_contents_grammar: BlockContentsGrammar::NoGrammar, + ..self.ctx + }; + let mut block = self.with_ctx(ctx).parse_as::()?; + let locv = self.create_locv(block.value); + + block.value = match self.parse_according_to_grammar(&locv, |parser| { + let mut values = vec![]; + + loop { + parser.input.skip_ws(); + + if is!(parser, EOF) { + break; + } + + let component_value = parser.parse_generic_value()?; + + values.push(component_value); } - } - // ... or tokens with a value of "!" - tok!("!") => { - if balance_stack.is_empty() { - break; + Ok(values) + }) { + Ok(values) => values, + Err(err) => { + if *err.kind() != ErrorKind::Ignore { + self.errors.push(err); + } + + locv.children } - } + }; - _ => {} + return Ok(ComponentValue::SimpleBlock(block)); } - let token = self.input.bump(); - - match token { - Some(token) => value.push(ComponentValue::PreservedToken(token)), - None => break, + tok!("#") => { + return Ok(ComponentValue::Color(self.parse()?)); } + + _ => {} } - Ok(value) + Err(Error::new(span, ErrorKind::Expected("Declaration value"))) } + /// Parse value as . + // pub(super) fn validate_declaration_value(&mut self) -> PResult> { + // let mut value = vec![]; + // let mut balance_stack: Vec> = vec![]; + // + // // The production matches any sequence of one or more + // // tokens, so long as the sequence does not contain ... + // loop { + // if is!(self, EOF) { + // break; + // } + // + // match cur!(self) { + // // ... , , + // tok!("bad-string") | tok!("bad-url") => { break; }, + // + // // ... unmatched <)-token>, <]-token>, or <}-token>, + // tok!(")") | tok!("]") | tok!("}") => { + // let value = match cur!(self) { + // tok!(")") => ')', + // tok!("]") => ']', + // tok!("}") => '}', + // _ => { + // unreachable!(); + // } + // }; + // + // let balance_close_type = match balance_stack.pop() { + // Some(v) => v, + // None => None, + // }; + // + // if Some(value) != balance_close_type { + // break; + // } + // } + // + // tok!("function") | tok!("(") | tok!("[") | tok!("{") => { + // let value = match cur!(self) { + // tok!("function") | tok!("(") => ')', + // tok!("[") => ']', + // tok!("{") => '}', + // _ => { + // unreachable!(); + // } + // }; + // + // balance_stack.push(Some(value)); + // } + // + // // ... or top-level tokens + // tok!(";") => { + // if balance_stack.is_empty() { + // break; + // } + // } + // + // // ... or tokens with a value of "!" + // tok!("!") => { + // if balance_stack.is_empty() { + // break; + // } + // } + // + // _ => {} + // } + // + // let token = self.input.bump(); + // + // match token { + // Some(token) => value.push(ComponentValue::PreservedToken(token)), + // None => break, + // } + // } + // + // Ok(value) + // } + /// Parse value as . pub(super) fn parse_any_value(&mut self) -> PResult> { let mut tokens = vec![]; @@ -360,7 +471,15 @@ where } tok!("number") => Ok(Some(ComponentValue::Number(parser.parse()?))), Token::Function { value, .. } if is_math_function(value) => { - Ok(Some(ComponentValue::Function(parser.parse()?))) + Ok(Some(ComponentValue::Function( + parser + .with_ctx(Ctx { + block_contents_grammar: + BlockContentsGrammar::DeclarationValue, + ..parser.ctx + }) + .parse_as::()?, + ))) } tok!("ident") => { is_legacy_syntax = false; @@ -418,7 +537,15 @@ where } } Token::Function { value, .. } if is_math_function(value) => { - Ok(Some(ComponentValue::Function(parser.parse()?))) + Ok(Some(ComponentValue::Function( + parser + .with_ctx(Ctx { + block_contents_grammar: + BlockContentsGrammar::DeclarationValue, + ..parser.ctx + }) + .parse_as::()?, + ))) } _ => { if !has_variable_before { @@ -473,7 +600,15 @@ where } tok!("number") => Ok(Some(ComponentValue::Number(parser.parse()?))), Token::Function { value, .. } if is_math_function(value) => { - Ok(Some(ComponentValue::Function(parser.parse()?))) + Ok(Some(ComponentValue::Function( + parser + .with_ctx(Ctx { + block_contents_grammar: + BlockContentsGrammar::DeclarationValue, + ..parser.ctx + }) + .parse_as::()?, + ))) } tok!("ident") if !is_legacy_syntax => { let ident: Ident = parser.parse()?; @@ -517,7 +652,15 @@ where Ok(Some(ComponentValue::Percentage(parser.parse()?))) } Token::Function { value, .. } if is_math_function(value) => { - Ok(Some(ComponentValue::Function(parser.parse()?))) + Ok(Some(ComponentValue::Function( + parser + .with_ctx(Ctx { + block_contents_grammar: + BlockContentsGrammar::DeclarationValue, + ..parser.ctx + }) + .parse_as::()?, + ))) } tok!("ident") => { let ident: Ident = parser.parse()?; @@ -585,7 +728,15 @@ where } tok!("number") => Ok(Some(ComponentValue::Number(parser.parse()?))), Token::Function { value, .. } if is_math_function(value) => { - Ok(Some(ComponentValue::Function(parser.parse()?))) + Ok(Some(ComponentValue::Function( + parser + .with_ctx(Ctx { + block_contents_grammar: + BlockContentsGrammar::DeclarationValue, + ..parser.ctx + }) + .parse_as::()?, + ))) } tok!("ident") if !is_legacy_syntax => { let ident: Ident = parser.parse()?; @@ -629,7 +780,15 @@ where Ok(Some(ComponentValue::Percentage(parser.parse()?))) } Token::Function { value, .. } if is_math_function(value) => { - Ok(Some(ComponentValue::Function(parser.parse()?))) + Ok(Some(ComponentValue::Function( + parser + .with_ctx(Ctx { + block_contents_grammar: + BlockContentsGrammar::DeclarationValue, + ..parser.ctx + }) + .parse_as::()?, + ))) } tok!("ident") => { let ident: Ident = parser.parse()?; @@ -682,7 +841,15 @@ where Ok(Some(ComponentValue::AlphaValue(parser.parse()?))) } Token::Function { value, .. } if is_math_function(value) => { - Ok(Some(ComponentValue::Function(parser.parse()?))) + Ok(Some(ComponentValue::Function( + parser + .with_ctx(Ctx { + block_contents_grammar: + BlockContentsGrammar::DeclarationValue, + ..parser.ctx + }) + .parse_as::()?, + ))) } _ => { if !has_variable_before { @@ -716,7 +883,15 @@ where Ok(Some(ComponentValue::AlphaValue(parser.parse()?))) } Token::Function { value, .. } if is_math_function(value) => { - Ok(Some(ComponentValue::Function(parser.parse()?))) + Ok(Some(ComponentValue::Function( + parser + .with_ctx(Ctx { + block_contents_grammar: + BlockContentsGrammar::DeclarationValue, + ..parser.ctx + }) + .parse_as::()?, + ))) } tok!("ident") => { let ident: Ident = parser.parse()?; @@ -790,7 +965,15 @@ where Ok(Some(ComponentValue::Hue(parser.parse()?))) } Token::Function { value, .. } if is_math_function(value) => { - Ok(Some(ComponentValue::Function(parser.parse()?))) + Ok(Some(ComponentValue::Function( + parser + .with_ctx(Ctx { + block_contents_grammar: + BlockContentsGrammar::DeclarationValue, + ..parser.ctx + }) + .parse_as::()?, + ))) } tok!("ident") => { let ident: Ident = parser.parse()?; @@ -835,7 +1018,15 @@ where } tok!("number") => Ok(Some(ComponentValue::Number(parser.parse()?))), Token::Function { value, .. } if is_math_function(value) => { - Ok(Some(ComponentValue::Function(parser.parse()?))) + Ok(Some(ComponentValue::Function( + parser + .with_ctx(Ctx { + block_contents_grammar: + BlockContentsGrammar::DeclarationValue, + ..parser.ctx + }) + .parse_as::()?, + ))) } tok!("ident") => { let ident: Ident = parser.parse()?; @@ -898,7 +1089,15 @@ where Ok(Some(ComponentValue::Percentage(parser.parse()?))) } Token::Function { value, .. } if is_math_function(value) => { - Ok(Some(ComponentValue::Function(parser.parse()?))) + Ok(Some(ComponentValue::Function( + parser + .with_ctx(Ctx { + block_contents_grammar: + BlockContentsGrammar::DeclarationValue, + ..parser.ctx + }) + .parse_as::()?, + ))) } tok!("ident") => { let ident: Ident = parser.parse()?; @@ -947,7 +1146,15 @@ where Ok(Some(ComponentValue::Number(parser.parse()?))) } Token::Function { value, .. } if is_math_function(value) => { - Ok(Some(ComponentValue::Function(parser.parse()?))) + Ok(Some(ComponentValue::Function( + parser + .with_ctx(Ctx { + block_contents_grammar: + BlockContentsGrammar::DeclarationValue, + ..parser.ctx + }) + .parse_as::()?, + ))) } tok!("ident") => { let ident: Ident = parser.parse()?; @@ -1015,7 +1222,15 @@ where Ok(Some(ComponentValue::Percentage(parser.parse()?))) } Token::Function { value, .. } if is_math_function(value) => { - Ok(Some(ComponentValue::Function(parser.parse()?))) + Ok(Some(ComponentValue::Function( + parser + .with_ctx(Ctx { + block_contents_grammar: + BlockContentsGrammar::DeclarationValue, + ..parser.ctx + }) + .parse_as::()?, + ))) } tok!("ident") => { let ident: Ident = parser.parse()?; @@ -1064,7 +1279,15 @@ where Ok(Some(ComponentValue::Number(parser.parse()?))) } Token::Function { value, .. } if is_math_function(value) => { - Ok(Some(ComponentValue::Function(parser.parse()?))) + Ok(Some(ComponentValue::Function( + parser + .with_ctx(Ctx { + block_contents_grammar: + BlockContentsGrammar::DeclarationValue, + ..parser.ctx + }) + .parse_as::()?, + ))) } tok!("ident") => { let ident: Ident = parser.parse()?; @@ -1110,7 +1333,15 @@ where Ok(Some(ComponentValue::Hue(parser.parse()?))) } Token::Function { value, .. } if is_math_function(value) => { - Ok(Some(ComponentValue::Function(parser.parse()?))) + Ok(Some(ComponentValue::Function( + parser + .with_ctx(Ctx { + block_contents_grammar: + BlockContentsGrammar::DeclarationValue, + ..parser.ctx + }) + .parse_as::()?, + ))) } tok!("ident") => { let ident: Ident = parser.parse()?; @@ -1193,7 +1424,15 @@ where Ok(Some(ComponentValue::AlphaValue(parser.parse()?))) } Token::Function { value, .. } if is_math_function(value) => { - Ok(Some(ComponentValue::Function(parser.parse()?))) + Ok(Some(ComponentValue::Function( + parser + .with_ctx(Ctx { + block_contents_grammar: + BlockContentsGrammar::DeclarationValue, + ..parser.ctx + }) + .parse_as::()?, + ))) } tok!("ident") if !matches!(function_name, "device-cmyk") => { let ident: Ident = parser.parse()?; @@ -1302,7 +1541,15 @@ where Ok(Some(ComponentValue::Percentage(parser.parse()?))) } Token::Function { value, .. } if is_math_function(value) => { - Ok(Some(ComponentValue::Function(parser.parse()?))) + Ok(Some(ComponentValue::Function( + parser + .with_ctx(Ctx { + block_contents_grammar: + BlockContentsGrammar::DeclarationValue, + ..parser.ctx + }) + .parse_as::()?, + ))) } tok!("ident") => { let ident: Ident = parser.parse()?; @@ -1353,7 +1600,14 @@ where "var" | "env" | "constant" ) => { - ComponentValue::Function(self.parse()?) + ComponentValue::Function( + self.with_ctx(Ctx { + block_contents_grammar: + BlockContentsGrammar::DeclarationValue, + ..self.ctx + }) + .parse_as::()?, + ) } tok!("ident") => { let ident: Ident = self.parse()?; @@ -1384,7 +1638,15 @@ where Ok(Some(ComponentValue::Percentage(parser.parse()?))) } Token::Function { value, .. } if is_math_function(value) => { - Ok(Some(ComponentValue::Function(parser.parse()?))) + Ok(Some(ComponentValue::Function( + parser + .with_ctx(Ctx { + block_contents_grammar: + BlockContentsGrammar::DeclarationValue, + ..parser.ctx + }) + .parse_as::()?, + ))) } tok!("ident") => { let ident: Ident = parser.parse()?; @@ -1440,7 +1702,15 @@ where } } Token::Function { value, .. } if is_math_function(value) => { - Ok(Some(ComponentValue::Function(parser.parse()?))) + Ok(Some(ComponentValue::Function( + parser + .with_ctx(Ctx { + block_contents_grammar: + BlockContentsGrammar::DeclarationValue, + ..parser.ctx + }) + .parse_as::()?, + ))) } _ => { if !has_variable_before { @@ -1477,7 +1747,15 @@ where Ok(Some(ComponentValue::AlphaValue(parser.parse()?))) } Token::Function { value, .. } if is_math_function(value) => { - Ok(Some(ComponentValue::Function(parser.parse()?))) + Ok(Some(ComponentValue::Function( + parser + .with_ctx(Ctx { + block_contents_grammar: + BlockContentsGrammar::DeclarationValue, + ..parser.ctx + }) + .parse_as::()?, + ))) } tok!("ident") if !matches!(function_name, "device-cmyk") => { let ident: Ident = parser.parse()?; @@ -1542,14 +1820,7 @@ where break; } - let value = match self.try_parse(|p| { - let ctx = Ctx { - block_contents_grammar: BlockContentsGrammar::DeclarationValue, - ..p.ctx - }; - - p.with_ctx(ctx).parse_as::() - }) { + let value = match self.try_parse(|p| p.parse_generic_value()) { Some(v) => v, None => { if is_one_of!(self, ";", ":") { @@ -1589,7 +1860,13 @@ where { *has_before_variable = true; - Ok(Some(ComponentValue::Function(self.parse()?))) + Ok(Some(ComponentValue::Function( + self.with_ctx(Ctx { + block_contents_grammar: BlockContentsGrammar::DeclarationValue, + ..self.ctx + }) + .parse_as::()?, + ))) } _ => fallback(self, *has_before_variable), } @@ -2275,7 +2552,13 @@ where } // Token::Function { value, .. } if value.as_ref().eq_ignore_ascii_case("device-cmyk") => { - Ok(Color::Function(self.parse()?)) + Ok(Color::Function( + self.with_ctx(Ctx { + block_contents_grammar: BlockContentsGrammar::DeclarationValue, + ..self.ctx + }) + .parse_as::()?, + )) } // _ => match self.parse() { @@ -2316,7 +2599,13 @@ where Ok(AbsoluteColorBase::NamedColorOrTransparent(self.parse()?)) } Token::Function { value, .. } if is_absolute_color_base_function(value) => { - Ok(AbsoluteColorBase::Function(self.parse()?)) + Ok(AbsoluteColorBase::Function( + self.with_ctx(Ctx { + block_contents_grammar: BlockContentsGrammar::DeclarationValue, + ..self.ctx + }) + .parse_as::()?, + )) } _ => { return Err(Error::new( @@ -2427,7 +2716,13 @@ where return Err(Error::new(span, ErrorKind::Expected("math function token"))); } - Ok(CmykComponent::Function(self.parse()?)) + Ok(CmykComponent::Function( + self.with_ctx(Ctx { + block_contents_grammar: BlockContentsGrammar::DeclarationValue, + ..self.ctx + }) + .parse_as::()?, + )) } _ => { unreachable!() @@ -2580,7 +2875,13 @@ where modifiers.push(UrlModifier::Ident(self.parse()?)); } tok!("function") => { - modifiers.push(UrlModifier::Function(self.parse()?)); + modifiers.push(UrlModifier::Function( + self.with_ctx(Ctx { + block_contents_grammar: BlockContentsGrammar::DeclarationValue, + ..self.ctx + }) + .parse_as::()?, + )); } _ => { let span = self.input.cur_span(); @@ -2608,89 +2909,6 @@ where } } -impl Parse for Parser -where - I: ParserInput, -{ - fn parse(&mut self) -> PResult { - let span = self.input.cur_span(); - let ident = match bump!(self) { - Token::Function { value, raw } => (value, raw), - _ => { - unreachable!() - } - }; - let function_name = &*ident.0.to_ascii_lowercase(); - let name = Ident { - span: swc_common::Span::new(span.lo, span.hi - BytePos(1), Default::default()), - value: ident.0, - raw: Some(ident.1), - }; - - // Create a function with its name equal to the value of the current input token - // and with its value initially set to an empty list. - let mut function = Function { - span: Default::default(), - name, - value: vec![], - }; - - // Repeatedly consume the next input token and process it as follows: - loop { - // - // This is a parse error. Return the function. - if is!(self, EOF) { - break; - } - - match cur!(self) { - // <)-token> - // Return the function. - tok!(")") => { - bump!(self); - - break; - } - // anything else - // Reconsume the current input token. Consume a component value and append the - // returned value to the function’s value. - _ => match self.ctx.block_contents_grammar { - BlockContentsGrammar::NoGrammar => { - let ctx = Ctx { - block_contents_grammar: BlockContentsGrammar::NoGrammar, - ..self.ctx - }; - - let component_value = self.with_ctx(ctx).parse_as::()?; - - function.value.push(component_value); - } - _ => { - let state = self.input.state(); - let values = self.parse_function_values(function_name); - - match values { - Ok(values) => { - function.value.extend(values); - } - Err(err) => { - self.errors.push(err); - self.input.reset(&state); - - function.value.push(self.parse()?); - } - } - } - }, - } - } - - function.span = span!(self, span.lo); - - return Ok(function); - } -} - // = // u '+' '?'* | // u '?'* | @@ -3292,7 +3510,13 @@ where Ok(CalcValue::Sum(calc_sum_in_parens)) } - tok!("function") => Ok(CalcValue::Function(self.parse()?)), + tok!("function") => Ok(CalcValue::Function( + self.with_ctx(Ctx { + block_contents_grammar: BlockContentsGrammar::DeclarationValue, + ..self.ctx + }) + .parse_as::()?, + )), _ => { let span = self.input.cur_span(); diff --git a/crates/swc_css_parser/tests/fixture/csstree/1/output.json b/crates/swc_css_parser/tests/fixture/csstree/1/output.json index 60a4ac03d540..5bce9650a128 100644 --- a/crates/swc_css_parser/tests/fixture/csstree/1/output.json +++ b/crates/swc_css_parser/tests/fixture/csstree/1/output.json @@ -2331,7 +2331,7 @@ "type": "Declaration", "span": { "start": 815, - "end": 827, + "end": 850, "ctxt": 0 }, "name": { @@ -2346,102 +2346,103 @@ }, "value": [ { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { "start": 826, - "end": 827, - "ctxt": 0 - }, - "token": "LBrace" - }, - { - "type": "PreservedToken", - "span": { - "start": 827, - "end": 828, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 828, - "end": 837, - "ctxt": 0 - }, - "token": { - "Ident": { - "value": "something", - "raw": "something" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 837, - "end": 838, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 838, - "end": 839, - "ctxt": 0 - }, - "token": { - "Delim": { - "value": "!" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 839, - "end": 848, + "end": 850, "ctxt": 0 }, - "token": { - "Ident": { - "value": "important", - "raw": "important" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 848, - "end": 849, - "ctxt": 0 + "name": { + "type": "PreservedToken", + "span": { + "start": 826, + "end": 827, + "ctxt": 0 + }, + "token": "LBrace" }, - "token": { - "WhiteSpace": { - "value": " " + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 827, + "end": 828, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 828, + "end": 837, + "ctxt": 0 + }, + "token": { + "Ident": { + "value": "something", + "raw": "something" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 837, + "end": 838, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 838, + "end": 839, + "ctxt": 0 + }, + "token": { + "Delim": { + "value": "!" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 839, + "end": 848, + "ctxt": 0 + }, + "token": { + "Ident": { + "value": "important", + "raw": "important" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 848, + "end": 849, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 849, - "end": 850, - "ctxt": 0 - }, - "token": "RBrace" + ] } ], "important": null @@ -2465,53 +2466,41 @@ }, "value": [ { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { "start": 871, - "end": 872, - "ctxt": 0 - }, - "token": "LParen" - }, - { - "type": "PreservedToken", - "span": { - "start": 872, - "end": 873, - "ctxt": 0 - }, - "token": "LBracket" - }, - { - "type": "PreservedToken", - "span": { - "start": 873, - "end": 874, - "ctxt": 0 - }, - "token": "RBracket" - }, - { - "type": "PreservedToken", - "span": { - "start": 874, "end": 875, "ctxt": 0 }, - "token": "RParen" - }, - { - "type": "PreservedToken", - "span": { - "start": 875, - "end": 876, - "ctxt": 0 + "name": { + "type": "PreservedToken", + "span": { + "start": 871, + "end": 872, + "ctxt": 0 + }, + "token": "LParen" }, - "token": { - "WhiteSpace": { - "value": " " + "value": [ + { + "type": "SimpleBlock", + "span": { + "start": 872, + "end": 874, + "ctxt": 0 + }, + "name": { + "type": "PreservedToken", + "span": { + "start": 872, + "end": 873, + "ctxt": 0 + }, + "token": "LBracket" + }, + "value": [] } - } + ] } ], "important": { diff --git a/crates/swc_css_parser/tests/fixture/csstree/1/span.rust-debug b/crates/swc_css_parser/tests/fixture/csstree/1/span.rust-debug index aefceb99a317..ff110b799468 100644 --- a/crates/swc_css_parser/tests/fixture/csstree/1/span.rust-debug +++ b/crates/swc_css_parser/tests/fixture/csstree/1/span.rust-debug @@ -2404,19 +2404,19 @@ x ComponentValue ,-[$DIR/tests/fixture/csstree/1/input.css:27:9] 27 | --custom1: { something !important }; - : ^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x StyleBlock ,-[$DIR/tests/fixture/csstree/1/input.css:27:9] 27 | --custom1: { something !important }; - : ^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x Declaration ,-[$DIR/tests/fixture/csstree/1/input.css:27:9] 27 | --custom1: { something !important }; - : ^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x DeclarationName @@ -2434,7 +2434,13 @@ x ComponentValue ,-[$DIR/tests/fixture/csstree/1/input.css:27:9] 27 | --custom1: { something !important }; - : ^ + : ^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x SimpleBlock + ,-[$DIR/tests/fixture/csstree/1/input.css:27:9] + 27 | --custom1: { something !important }; + : ^^^^^^^^^^^^^^^^^^^^^^^^ `---- x LBrace @@ -2515,18 +2521,6 @@ : ^ `---- - x ComponentValue - ,-[$DIR/tests/fixture/csstree/1/input.css:27:9] - 27 | --custom1: { something !important }; - : ^ - `---- - - x RBrace - ,-[$DIR/tests/fixture/csstree/1/input.css:27:9] - 27 | --custom1: { something !important }; - : ^ - `---- - x ComponentValue ,-[$DIR/tests/fixture/csstree/1/input.css:28:9] 28 | --custom2: ([]) !important; @@ -2560,61 +2554,37 @@ x ComponentValue ,-[$DIR/tests/fixture/csstree/1/input.css:28:9] 28 | --custom2: ([]) !important; - : ^ - `---- - - x LParen - ,-[$DIR/tests/fixture/csstree/1/input.css:28:9] - 28 | --custom2: ([]) !important; - : ^ - `---- - - x ComponentValue - ,-[$DIR/tests/fixture/csstree/1/input.css:28:9] - 28 | --custom2: ([]) !important; - : ^ - `---- - - x LBracket - ,-[$DIR/tests/fixture/csstree/1/input.css:28:9] - 28 | --custom2: ([]) !important; - : ^ + : ^^^^ `---- - x ComponentValue + x SimpleBlock ,-[$DIR/tests/fixture/csstree/1/input.css:28:9] 28 | --custom2: ([]) !important; - : ^ + : ^^^^ `---- - x RBracket + x LParen ,-[$DIR/tests/fixture/csstree/1/input.css:28:9] 28 | --custom2: ([]) !important; - : ^ + : ^ `---- x ComponentValue ,-[$DIR/tests/fixture/csstree/1/input.css:28:9] 28 | --custom2: ([]) !important; - : ^ + : ^^ `---- - x RParen - ,-[$DIR/tests/fixture/csstree/1/input.css:28:9] - 28 | --custom2: ([]) !important; - : ^ - `---- - - x ComponentValue + x SimpleBlock ,-[$DIR/tests/fixture/csstree/1/input.css:28:9] 28 | --custom2: ([]) !important; - : ^ + : ^^ `---- - x WhiteSpace { value: Atom(' ' type=inline) } + x LBracket ,-[$DIR/tests/fixture/csstree/1/input.css:28:9] 28 | --custom2: ([]) !important; - : ^ + : ^ `---- x ImportantFlag diff --git a/crates/swc_css_parser/tests/fixture/function/calc/output.json b/crates/swc_css_parser/tests/fixture/function/calc/output.json index 16a6ba7703f0..620195d6a2d8 100644 --- a/crates/swc_css_parser/tests/fixture/function/calc/output.json +++ b/crates/swc_css_parser/tests/fixture/function/calc/output.json @@ -277,7 +277,7 @@ "type": "Declaration", "span": { "start": 55, - "end": 69, + "end": 80, "ctxt": 0 }, "name": { @@ -292,97 +292,94 @@ }, "value": [ { - "type": "PreservedToken", + "type": "Function", "span": { "start": 64, - "end": 69, - "ctxt": 0 - }, - "token": { - "Function": { - "value": "calc", - "raw": "calc" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 69, - "end": 72, - "ctxt": 0 - }, - "token": { - "Percentage": { - "value": 10.0, - "raw": "10" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 72, - "end": 73, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 73, - "end": 74, - "ctxt": 0 - }, - "token": { - "Delim": { - "value": "+" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 74, - "end": 75, + "end": 80, "ctxt": 0 }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 75, - "end": 79, - "ctxt": 0 + "name": { + "type": "Ident", + "span": { + "start": 64, + "end": 68, + "ctxt": 0 + }, + "value": "calc", + "raw": "calc" }, - "token": { - "Dimension": { - "value": 30.0, - "raw_value": "30", - "unit": "px", - "raw_unit": "px", - "type": "integer" + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 69, + "end": 72, + "ctxt": 0 + }, + "token": { + "Percentage": { + "value": 10.0, + "raw": "10" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 72, + "end": 73, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 73, + "end": 74, + "ctxt": 0 + }, + "token": { + "Delim": { + "value": "+" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 74, + "end": 75, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 75, + "end": 79, + "ctxt": 0 + }, + "token": { + "Dimension": { + "value": 30.0, + "raw_value": "30", + "unit": "px", + "raw_unit": "px", + "type": "integer" + } + } } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 79, - "end": 80, - "ctxt": 0 - }, - "token": "RParen" + ] } ], "important": null diff --git a/crates/swc_css_parser/tests/fixture/function/calc/span.rust-debug b/crates/swc_css_parser/tests/fixture/function/calc/span.rust-debug index 47ac272ba108..bd60bc372ec0 100644 --- a/crates/swc_css_parser/tests/fixture/function/calc/span.rust-debug +++ b/crates/swc_css_parser/tests/fixture/function/calc/span.rust-debug @@ -497,19 +497,19 @@ x ComponentValue ,-[$DIR/tests/fixture/function/calc/input.css:6:5] 6 | --width: calc(10% + 30px); - : ^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x StyleBlock ,-[$DIR/tests/fixture/function/calc/input.css:6:5] 6 | --width: calc(10% + 30px); - : ^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x Declaration ,-[$DIR/tests/fixture/function/calc/input.css:6:5] 6 | --width: calc(10% + 30px); - : ^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x DeclarationName @@ -527,13 +527,19 @@ x ComponentValue ,-[$DIR/tests/fixture/function/calc/input.css:6:5] 6 | --width: calc(10% + 30px); - : ^^^^^ + : ^^^^^^^^^^^^^^^^ `---- - x Function { value: Atom('calc' type=static), raw: Atom('calc' type=static) } + x Function + ,-[$DIR/tests/fixture/function/calc/input.css:6:5] + 6 | --width: calc(10% + 30px); + : ^^^^^^^^^^^^^^^^ + `---- + + x Ident ,-[$DIR/tests/fixture/function/calc/input.css:6:5] 6 | --width: calc(10% + 30px); - : ^^^^^ + : ^^^^ `---- x ComponentValue @@ -596,18 +602,6 @@ : ^^^^ `---- - x ComponentValue - ,-[$DIR/tests/fixture/function/calc/input.css:6:5] - 6 | --width: calc(10% + 30px); - : ^ - `---- - - x RParen - ,-[$DIR/tests/fixture/function/calc/input.css:6:5] - 6 | --width: calc(10% + 30px); - : ^ - `---- - x ComponentValue ,-[$DIR/tests/fixture/function/calc/input.css:8:5] 8 | width: calc(0px); diff --git a/crates/swc_css_parser/tests/fixture/rome/custom-properties/output.json b/crates/swc_css_parser/tests/fixture/rome/custom-properties/output.json index 600bbf1cd93f..1f7fc4cae200 100644 --- a/crates/swc_css_parser/tests/fixture/rome/custom-properties/output.json +++ b/crates/swc_css_parser/tests/fixture/rome/custom-properties/output.json @@ -372,7 +372,7 @@ "type": "Declaration", "span": { "start": 149, - "end": 165, + "end": 166, "ctxt": 0 }, "name": { @@ -387,27 +387,23 @@ }, "value": [ { - "type": "PreservedToken", + "type": "Function", "span": { "start": 161, - "end": 165, - "ctxt": 0 - }, - "token": { - "Function": { - "value": "foo", - "raw": "foo" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 165, "end": 166, "ctxt": 0 }, - "token": "RParen" + "name": { + "type": "Ident", + "span": { + "start": 161, + "end": 164, + "ctxt": 0 + }, + "value": "foo", + "raw": "foo" + }, + "value": [] } ], "important": null @@ -416,7 +412,7 @@ "type": "Declaration", "span": { "start": 169, - "end": 192, + "end": 198, "ctxt": 0 }, "name": { @@ -431,50 +427,43 @@ }, "value": [ { - "type": "PreservedToken", + "type": "Function", "span": { "start": 188, - "end": 192, + "end": 198, "ctxt": 0 }, - "token": { - "Function": { - "value": "foo", - "raw": "foo" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 192, - "end": 196, - "ctxt": 0 + "name": { + "type": "Ident", + "span": { + "start": 188, + "end": 191, + "ctxt": 0 + }, + "value": "foo", + "raw": "foo" }, - "token": { - "Function": { - "value": "bar", - "raw": "bar" + "value": [ + { + "type": "Function", + "span": { + "start": 192, + "end": 197, + "ctxt": 0 + }, + "name": { + "type": "Ident", + "span": { + "start": 192, + "end": 195, + "ctxt": 0 + }, + "value": "bar", + "raw": "bar" + }, + "value": [] } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 196, - "end": 197, - "ctxt": 0 - }, - "token": "RParen" - }, - { - "type": "PreservedToken", - "span": { - "start": 197, - "end": 198, - "ctxt": 0 - }, - "token": "RParen" + ] } ], "important": null @@ -483,7 +472,7 @@ "type": "Declaration", "span": { "start": 201, - "end": 217, + "end": 219, "ctxt": 0 }, "name": { @@ -498,35 +487,36 @@ }, "value": [ { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { "start": 216, - "end": 217, + "end": 219, "ctxt": 0 }, - "token": "LParen" - }, - { - "type": "PreservedToken", - "span": { - "start": 217, - "end": 218, - "ctxt": 0 + "name": { + "type": "PreservedToken", + "span": { + "start": 216, + "end": 217, + "ctxt": 0 + }, + "token": "LParen" }, - "token": { - "WhiteSpace": { - "value": " " + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 217, + "end": 218, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 218, - "end": 219, - "ctxt": 0 - }, - "token": "RParen" + ] } ], "important": null @@ -535,7 +525,7 @@ "type": "Declaration", "span": { "start": 222, - "end": 233, + "end": 235, "ctxt": 0 }, "name": { @@ -550,35 +540,36 @@ }, "value": [ { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { "start": 232, - "end": 233, + "end": 235, "ctxt": 0 }, - "token": "LBrace" - }, - { - "type": "PreservedToken", - "span": { - "start": 233, - "end": 234, - "ctxt": 0 + "name": { + "type": "PreservedToken", + "span": { + "start": 232, + "end": 233, + "ctxt": 0 + }, + "token": "LBrace" }, - "token": { - "WhiteSpace": { - "value": " " + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 233, + "end": 234, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 234, - "end": 235, - "ctxt": 0 - }, - "token": "RBrace" + ] } ], "important": null @@ -587,7 +578,7 @@ "type": "Declaration", "span": { "start": 238, - "end": 251, + "end": 253, "ctxt": 0 }, "name": { @@ -602,35 +593,36 @@ }, "value": [ { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { "start": 250, - "end": 251, + "end": 253, "ctxt": 0 }, - "token": "LBracket" - }, - { - "type": "PreservedToken", - "span": { - "start": 251, - "end": 252, - "ctxt": 0 + "name": { + "type": "PreservedToken", + "span": { + "start": 250, + "end": 251, + "ctxt": 0 + }, + "token": "LBracket" }, - "token": { - "WhiteSpace": { - "value": " " + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 251, + "end": 252, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 252, - "end": 253, - "ctxt": 0 - }, - "token": "RBracket" + ] } ], "important": null @@ -709,7 +701,7 @@ "type": "Declaration", "span": { "start": 317, - "end": 352, + "end": 355, "ctxt": 0 }, "name": { @@ -751,22 +743,22 @@ } }, { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { "start": 353, - "end": 354, - "ctxt": 0 - }, - "token": "LBrace" - }, - { - "type": "PreservedToken", - "span": { - "start": 354, "end": 355, "ctxt": 0 }, - "token": "RBrace" + "name": { + "type": "PreservedToken", + "span": { + "start": 353, + "end": 354, + "ctxt": 0 + }, + "token": "LBrace" + }, + "value": [] } ], "important": null @@ -775,7 +767,7 @@ "type": "Declaration", "span": { "start": 358, - "end": 390, + "end": 393, "ctxt": 0 }, "name": { @@ -817,22 +809,22 @@ } }, { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { "start": 391, - "end": 392, - "ctxt": 0 - }, - "token": "LBrace" - }, - { - "type": "PreservedToken", - "span": { - "start": 392, "end": 393, "ctxt": 0 }, - "token": "RBrace" + "name": { + "type": "PreservedToken", + "span": { + "start": 391, + "end": 392, + "ctxt": 0 + }, + "token": "LBrace" + }, + "value": [] } ], "important": null @@ -901,7 +893,7 @@ "type": "Declaration", "span": { "start": 449, - "end": 471, + "end": 476, "ctxt": 0 }, "name": { @@ -916,31 +908,32 @@ }, "value": [ { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { "start": 470, - "end": 471, - "ctxt": 0 - }, - "token": "LParen" - }, - { - "type": "PreservedToken", - "span": { - "start": 471, - "end": 475, - "ctxt": 0 - }, - "token": "CDO" - }, - { - "type": "PreservedToken", - "span": { - "start": 475, "end": 476, "ctxt": 0 }, - "token": "RParen" + "name": { + "type": "PreservedToken", + "span": { + "start": 470, + "end": 471, + "ctxt": 0 + }, + "token": "LParen" + }, + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 471, + "end": 475, + "ctxt": 0 + }, + "token": "CDO" + } + ] } ], "important": null @@ -949,7 +942,7 @@ "type": "Declaration", "span": { "start": 479, - "end": 501, + "end": 505, "ctxt": 0 }, "name": { @@ -964,31 +957,32 @@ }, "value": [ { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { "start": 500, - "end": 501, - "ctxt": 0 - }, - "token": "LParen" - }, - { - "type": "PreservedToken", - "span": { - "start": 501, - "end": 504, - "ctxt": 0 - }, - "token": "CDC" - }, - { - "type": "PreservedToken", - "span": { - "start": 504, "end": 505, "ctxt": 0 }, - "token": "RParen" + "name": { + "type": "PreservedToken", + "span": { + "start": 500, + "end": 501, + "ctxt": 0 + }, + "token": "LParen" + }, + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 501, + "end": 504, + "ctxt": 0 + }, + "token": "CDC" + } + ] } ], "important": null diff --git a/crates/swc_css_parser/tests/fixture/rome/custom-properties/span.rust-debug b/crates/swc_css_parser/tests/fixture/rome/custom-properties/span.rust-debug index dca75d85661a..624008c2cbba 100644 --- a/crates/swc_css_parser/tests/fixture/rome/custom-properties/span.rust-debug +++ b/crates/swc_css_parser/tests/fixture/rome/custom-properties/span.rust-debug @@ -488,19 +488,19 @@ x ComponentValue ,-[$DIR/tests/fixture/rome/custom-properties/input.css:10:5] 10 | --function: foo(); - : ^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^ `---- x StyleBlock ,-[$DIR/tests/fixture/rome/custom-properties/input.css:10:5] 10 | --function: foo(); - : ^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^ `---- x Declaration ,-[$DIR/tests/fixture/rome/custom-properties/input.css:10:5] 10 | --function: foo(); - : ^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^ `---- x DeclarationName @@ -518,43 +518,37 @@ x ComponentValue ,-[$DIR/tests/fixture/rome/custom-properties/input.css:10:5] 10 | --function: foo(); - : ^^^^ + : ^^^^^ `---- - x Function { value: Atom('foo' type=inline), raw: Atom('foo' type=inline) } + x Function ,-[$DIR/tests/fixture/rome/custom-properties/input.css:10:5] 10 | --function: foo(); - : ^^^^ + : ^^^^^ `---- - x ComponentValue + x Ident ,-[$DIR/tests/fixture/rome/custom-properties/input.css:10:5] 10 | --function: foo(); - : ^ - `---- - - x RParen - ,-[$DIR/tests/fixture/rome/custom-properties/input.css:10:5] - 10 | --function: foo(); - : ^ + : ^^^ `---- x ComponentValue ,-[$DIR/tests/fixture/rome/custom-properties/input.css:11:5] 11 | --nested-function: foo(bar()); - : ^^^^^^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x StyleBlock ,-[$DIR/tests/fixture/rome/custom-properties/input.css:11:5] 11 | --nested-function: foo(bar()); - : ^^^^^^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x Declaration ,-[$DIR/tests/fixture/rome/custom-properties/input.css:11:5] 11 | --nested-function: foo(bar()); - : ^^^^^^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x DeclarationName @@ -572,67 +566,55 @@ x ComponentValue ,-[$DIR/tests/fixture/rome/custom-properties/input.css:11:5] 11 | --nested-function: foo(bar()); - : ^^^^ + : ^^^^^^^^^^ `---- - x Function { value: Atom('foo' type=inline), raw: Atom('foo' type=inline) } + x Function ,-[$DIR/tests/fixture/rome/custom-properties/input.css:11:5] 11 | --nested-function: foo(bar()); - : ^^^^ + : ^^^^^^^^^^ `---- - x ComponentValue - ,-[$DIR/tests/fixture/rome/custom-properties/input.css:11:5] - 11 | --nested-function: foo(bar()); - : ^^^^ - `---- - - x Function { value: Atom('bar' type=inline), raw: Atom('bar' type=inline) } + x Ident ,-[$DIR/tests/fixture/rome/custom-properties/input.css:11:5] 11 | --nested-function: foo(bar()); - : ^^^^ + : ^^^ `---- x ComponentValue ,-[$DIR/tests/fixture/rome/custom-properties/input.css:11:5] 11 | --nested-function: foo(bar()); - : ^ + : ^^^^^ `---- - x RParen - ,-[$DIR/tests/fixture/rome/custom-properties/input.css:11:5] - 11 | --nested-function: foo(bar()); - : ^ - `---- - - x ComponentValue + x Function ,-[$DIR/tests/fixture/rome/custom-properties/input.css:11:5] 11 | --nested-function: foo(bar()); - : ^ + : ^^^^^ `---- - x RParen + x Ident ,-[$DIR/tests/fixture/rome/custom-properties/input.css:11:5] 11 | --nested-function: foo(bar()); - : ^ + : ^^^ `---- x ComponentValue ,-[$DIR/tests/fixture/rome/custom-properties/input.css:12:5] 12 | --parentheses: ( ); - : ^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^ `---- x StyleBlock ,-[$DIR/tests/fixture/rome/custom-properties/input.css:12:5] 12 | --parentheses: ( ); - : ^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^ `---- x Declaration ,-[$DIR/tests/fixture/rome/custom-properties/input.css:12:5] 12 | --parentheses: ( ); - : ^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^ `---- x DeclarationName @@ -650,7 +632,13 @@ x ComponentValue ,-[$DIR/tests/fixture/rome/custom-properties/input.css:12:5] 12 | --parentheses: ( ); - : ^ + : ^^^ + `---- + + x SimpleBlock + ,-[$DIR/tests/fixture/rome/custom-properties/input.css:12:5] + 12 | --parentheses: ( ); + : ^^^ `---- x LParen @@ -671,34 +659,22 @@ : ^ `---- - x ComponentValue - ,-[$DIR/tests/fixture/rome/custom-properties/input.css:12:5] - 12 | --parentheses: ( ); - : ^ - `---- - - x RParen - ,-[$DIR/tests/fixture/rome/custom-properties/input.css:12:5] - 12 | --parentheses: ( ); - : ^ - `---- - x ComponentValue ,-[$DIR/tests/fixture/rome/custom-properties/input.css:13:5] 13 | --braces: { }; - : ^^^^^^^^^^^ + : ^^^^^^^^^^^^^ `---- x StyleBlock ,-[$DIR/tests/fixture/rome/custom-properties/input.css:13:5] 13 | --braces: { }; - : ^^^^^^^^^^^ + : ^^^^^^^^^^^^^ `---- x Declaration ,-[$DIR/tests/fixture/rome/custom-properties/input.css:13:5] 13 | --braces: { }; - : ^^^^^^^^^^^ + : ^^^^^^^^^^^^^ `---- x DeclarationName @@ -716,7 +692,13 @@ x ComponentValue ,-[$DIR/tests/fixture/rome/custom-properties/input.css:13:5] 13 | --braces: { }; - : ^ + : ^^^ + `---- + + x SimpleBlock + ,-[$DIR/tests/fixture/rome/custom-properties/input.css:13:5] + 13 | --braces: { }; + : ^^^ `---- x LBrace @@ -737,34 +719,22 @@ : ^ `---- - x ComponentValue - ,-[$DIR/tests/fixture/rome/custom-properties/input.css:13:5] - 13 | --braces: { }; - : ^ - `---- - - x RBrace - ,-[$DIR/tests/fixture/rome/custom-properties/input.css:13:5] - 13 | --braces: { }; - : ^ - `---- - x ComponentValue ,-[$DIR/tests/fixture/rome/custom-properties/input.css:14:5] 14 | --brackets: [ ]; - : ^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^ `---- x StyleBlock ,-[$DIR/tests/fixture/rome/custom-properties/input.css:14:5] 14 | --brackets: [ ]; - : ^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^ `---- x Declaration ,-[$DIR/tests/fixture/rome/custom-properties/input.css:14:5] 14 | --brackets: [ ]; - : ^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^ `---- x DeclarationName @@ -782,7 +752,13 @@ x ComponentValue ,-[$DIR/tests/fixture/rome/custom-properties/input.css:14:5] 14 | --brackets: [ ]; - : ^ + : ^^^ + `---- + + x SimpleBlock + ,-[$DIR/tests/fixture/rome/custom-properties/input.css:14:5] + 14 | --brackets: [ ]; + : ^^^ `---- x LBracket @@ -803,18 +779,6 @@ : ^ `---- - x ComponentValue - ,-[$DIR/tests/fixture/rome/custom-properties/input.css:14:5] - 14 | --brackets: [ ]; - : ^ - `---- - - x RBracket - ,-[$DIR/tests/fixture/rome/custom-properties/input.css:14:5] - 14 | --brackets: [ ]; - : ^ - `---- - x ComponentValue ,-[$DIR/tests/fixture/rome/custom-properties/input.css:15:5] 15 | --at-keyword-unknown: @foobar; @@ -902,19 +866,19 @@ x ComponentValue ,-[$DIR/tests/fixture/rome/custom-properties/input.css:17:5] 17 | --at-keyword-unknown-block: @foobar {}; - : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x StyleBlock ,-[$DIR/tests/fixture/rome/custom-properties/input.css:17:5] 17 | --at-keyword-unknown-block: @foobar {}; - : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x Declaration ,-[$DIR/tests/fixture/rome/custom-properties/input.css:17:5] 17 | --at-keyword-unknown-block: @foobar {}; - : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x DeclarationName @@ -956,43 +920,37 @@ x ComponentValue ,-[$DIR/tests/fixture/rome/custom-properties/input.css:17:5] 17 | --at-keyword-unknown-block: @foobar {}; - : ^ + : ^^ `---- - x LBrace - ,-[$DIR/tests/fixture/rome/custom-properties/input.css:17:5] - 17 | --at-keyword-unknown-block: @foobar {}; - : ^ - `---- - - x ComponentValue + x SimpleBlock ,-[$DIR/tests/fixture/rome/custom-properties/input.css:17:5] 17 | --at-keyword-unknown-block: @foobar {}; - : ^ + : ^^ `---- - x RBrace + x LBrace ,-[$DIR/tests/fixture/rome/custom-properties/input.css:17:5] 17 | --at-keyword-unknown-block: @foobar {}; - : ^ + : ^ `---- x ComponentValue ,-[$DIR/tests/fixture/rome/custom-properties/input.css:18:5] 18 | --at-keyword-known-block: @media {}; - : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x StyleBlock ,-[$DIR/tests/fixture/rome/custom-properties/input.css:18:5] 18 | --at-keyword-known-block: @media {}; - : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x Declaration ,-[$DIR/tests/fixture/rome/custom-properties/input.css:18:5] 18 | --at-keyword-known-block: @media {}; - : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x DeclarationName @@ -1034,25 +992,19 @@ x ComponentValue ,-[$DIR/tests/fixture/rome/custom-properties/input.css:18:5] 18 | --at-keyword-known-block: @media {}; - : ^ + : ^^ `---- - x LBrace - ,-[$DIR/tests/fixture/rome/custom-properties/input.css:18:5] - 18 | --at-keyword-known-block: @media {}; - : ^ - `---- - - x ComponentValue + x SimpleBlock ,-[$DIR/tests/fixture/rome/custom-properties/input.css:18:5] 18 | --at-keyword-known-block: @media {}; - : ^ + : ^^ `---- - x RBrace + x LBrace ,-[$DIR/tests/fixture/rome/custom-properties/input.css:18:5] 18 | --at-keyword-known-block: @media {}; - : ^ + : ^ `---- x ComponentValue @@ -1142,19 +1094,19 @@ x ComponentValue ,-[$DIR/tests/fixture/rome/custom-properties/input.css:21:5] 21 | --cdo-not-top-level: (); - : ^^^^^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x StyleBlock ,-[$DIR/tests/fixture/rome/custom-properties/input.css:22:5] 22 | --cdc-not-top-level: (-->); - : ^^^^^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x Declaration ,-[$DIR/tests/fixture/rome/custom-properties/input.css:22:5] 22 | --cdc-not-top-level: (-->); - : ^^^^^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x DeclarationName @@ -1238,7 +1184,13 @@ x ComponentValue ,-[$DIR/tests/fixture/rome/custom-properties/input.css:22:5] 22 | --cdc-not-top-level: (-->); - : ^ + : ^^^^^ + `---- + + x SimpleBlock + ,-[$DIR/tests/fixture/rome/custom-properties/input.css:22:5] + 22 | --cdc-not-top-level: (-->); + : ^^^^^ `---- x LParen @@ -1258,15 +1210,3 @@ 22 | --cdc-not-top-level: (-->); : ^^^ `---- - - x ComponentValue - ,-[$DIR/tests/fixture/rome/custom-properties/input.css:22:5] - 22 | --cdc-not-top-level: (-->); - : ^ - `---- - - x RParen - ,-[$DIR/tests/fixture/rome/custom-properties/input.css:22:5] - 22 | --cdc-not-top-level: (-->); - : ^ - `---- diff --git a/crates/swc_css_parser/tests/fixture/style-block/output.json b/crates/swc_css_parser/tests/fixture/style-block/output.json index 97a2708e70c0..3ced83496c60 100644 --- a/crates/swc_css_parser/tests/fixture/style-block/output.json +++ b/crates/swc_css_parser/tests/fixture/style-block/output.json @@ -4037,7 +4037,7 @@ "type": "Declaration", "span": { "start": 1312, - "end": 1326, + "end": 1369, "ctxt": 0 }, "name": { @@ -4052,181 +4052,182 @@ }, "value": [ { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { "start": 1325, - "end": 1326, - "ctxt": 0 - }, - "token": "LBrace" - }, - { - "type": "PreservedToken", - "span": { - "start": 1326, - "end": 1335, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": "\n " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1335, - "end": 1340, - "ctxt": 0 - }, - "token": { - "Ident": { - "value": "width", - "raw": "width" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1340, - "end": 1341, - "ctxt": 0 - }, - "token": "Colon" - }, - { - "type": "PreservedToken", - "span": { - "start": 1341, - "end": 1342, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1342, - "end": 1343, - "ctxt": 0 - }, - "token": { - "Number": { - "value": 0.0, - "raw": "0", - "type": "integer" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1343, - "end": 1344, - "ctxt": 0 - }, - "token": "Semi" - }, - { - "type": "PreservedToken", - "span": { - "start": 1344, - "end": 1353, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": "\n " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1353, - "end": 1359, - "ctxt": 0 - }, - "token": { - "Ident": { - "value": "height", - "raw": "height" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1359, - "end": 1360, - "ctxt": 0 - }, - "token": "Colon" - }, - { - "type": "PreservedToken", - "span": { - "start": 1360, - "end": 1361, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1361, - "end": 1362, - "ctxt": 0 - }, - "token": { - "Number": { - "value": 0.0, - "raw": "0", - "type": "integer" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1362, - "end": 1363, + "end": 1369, "ctxt": 0 }, - "token": "Semi" - }, - { - "type": "PreservedToken", - "span": { - "start": 1363, - "end": 1368, - "ctxt": 0 + "name": { + "type": "PreservedToken", + "span": { + "start": 1325, + "end": 1326, + "ctxt": 0 + }, + "token": "LBrace" }, - "token": { - "WhiteSpace": { - "value": "\n " + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 1326, + "end": 1335, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": "\n " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1335, + "end": 1340, + "ctxt": 0 + }, + "token": { + "Ident": { + "value": "width", + "raw": "width" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1340, + "end": 1341, + "ctxt": 0 + }, + "token": "Colon" + }, + { + "type": "PreservedToken", + "span": { + "start": 1341, + "end": 1342, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1342, + "end": 1343, + "ctxt": 0 + }, + "token": { + "Number": { + "value": 0.0, + "raw": "0", + "type": "integer" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1343, + "end": 1344, + "ctxt": 0 + }, + "token": "Semi" + }, + { + "type": "PreservedToken", + "span": { + "start": 1344, + "end": 1353, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": "\n " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1353, + "end": 1359, + "ctxt": 0 + }, + "token": { + "Ident": { + "value": "height", + "raw": "height" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1359, + "end": 1360, + "ctxt": 0 + }, + "token": "Colon" + }, + { + "type": "PreservedToken", + "span": { + "start": 1360, + "end": 1361, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1361, + "end": 1362, + "ctxt": 0 + }, + "token": { + "Number": { + "value": 0.0, + "raw": "0", + "type": "integer" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1362, + "end": 1363, + "ctxt": 0 + }, + "token": "Semi" + }, + { + "type": "PreservedToken", + "span": { + "start": 1363, + "end": 1368, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": "\n " + } + } } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1368, - "end": 1369, - "ctxt": 0 - }, - "token": "RBrace" + ] } ], "important": null @@ -4235,7 +4236,7 @@ "type": "Declaration", "span": { "start": 1375, - "end": 1390, + "end": 1439, "ctxt": 0 }, "name": { @@ -4250,198 +4251,186 @@ }, "value": [ { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { "start": 1389, - "end": 1390, - "ctxt": 0 - }, - "token": "LBrace" - }, - { - "type": "PreservedToken", - "span": { - "start": 1390, - "end": 1399, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": "\n " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1399, - "end": 1404, - "ctxt": 0 - }, - "token": { - "Ident": { - "value": "width", - "raw": "width" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1404, - "end": 1405, - "ctxt": 0 - }, - "token": "Colon" - }, - { - "type": "PreservedToken", - "span": { - "start": 1405, - "end": 1406, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1406, - "end": 1410, - "ctxt": 0 - }, - "token": { - "Dimension": { - "value": 16.0, - "raw_value": "16", - "unit": "px", - "raw_unit": "px", - "type": "integer" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1410, - "end": 1411, - "ctxt": 0 - }, - "token": "Semi" - }, - { - "type": "PreservedToken", - "span": { - "start": 1411, - "end": 1420, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": "\n " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1420, - "end": 1426, - "ctxt": 0 - }, - "token": { - "Ident": { - "value": "height", - "raw": "height" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1426, - "end": 1427, - "ctxt": 0 - }, - "token": "Colon" - }, - { - "type": "PreservedToken", - "span": { - "start": 1427, - "end": 1428, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1428, - "end": 1432, - "ctxt": 0 - }, - "token": { - "Dimension": { - "value": 16.0, - "raw_value": "16", - "unit": "px", - "raw_unit": "px", - "type": "integer" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1432, - "end": 1433, - "ctxt": 0 - }, - "token": "Semi" - }, - { - "type": "PreservedToken", - "span": { - "start": 1433, - "end": 1438, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": "\n " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1438, "end": 1439, "ctxt": 0 }, - "token": "RBrace" - }, - { - "type": "PreservedToken", - "span": { - "start": 1439, - "end": 1440, - "ctxt": 0 + "name": { + "type": "PreservedToken", + "span": { + "start": 1389, + "end": 1390, + "ctxt": 0 + }, + "token": "LBrace" }, - "token": { - "WhiteSpace": { - "value": "\n" + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 1390, + "end": 1399, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": "\n " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1399, + "end": 1404, + "ctxt": 0 + }, + "token": { + "Ident": { + "value": "width", + "raw": "width" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1404, + "end": 1405, + "ctxt": 0 + }, + "token": "Colon" + }, + { + "type": "PreservedToken", + "span": { + "start": 1405, + "end": 1406, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1406, + "end": 1410, + "ctxt": 0 + }, + "token": { + "Dimension": { + "value": 16.0, + "raw_value": "16", + "unit": "px", + "raw_unit": "px", + "type": "integer" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1410, + "end": 1411, + "ctxt": 0 + }, + "token": "Semi" + }, + { + "type": "PreservedToken", + "span": { + "start": 1411, + "end": 1420, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": "\n " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1420, + "end": 1426, + "ctxt": 0 + }, + "token": { + "Ident": { + "value": "height", + "raw": "height" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1426, + "end": 1427, + "ctxt": 0 + }, + "token": "Colon" + }, + { + "type": "PreservedToken", + "span": { + "start": 1427, + "end": 1428, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1428, + "end": 1432, + "ctxt": 0 + }, + "token": { + "Dimension": { + "value": 16.0, + "raw_value": "16", + "unit": "px", + "raw_unit": "px", + "type": "integer" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1432, + "end": 1433, + "ctxt": 0 + }, + "token": "Semi" + }, + { + "type": "PreservedToken", + "span": { + "start": 1433, + "end": 1438, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": "\n " + } + } } - } + ] } ], "important": null diff --git a/crates/swc_css_parser/tests/fixture/style-block/span.rust-debug b/crates/swc_css_parser/tests/fixture/style-block/span.rust-debug index 98a25db4194a..843cb0e8a0b3 100644 --- a/crates/swc_css_parser/tests/fixture/style-block/span.rust-debug +++ b/crates/swc_css_parser/tests/fixture/style-block/span.rust-debug @@ -4346,20 +4346,26 @@ x ComponentValue ,-[$DIR/tests/fixture/style-block/input.css:106:5] - 106 | --zero-size: { - : ^^^^^^^^^^^^^^ + 106 | ,-> --zero-size: { + 107 | | width: 0; + 108 | | height: 0; + 109 | `-> }; `---- x StyleBlock ,-[$DIR/tests/fixture/style-block/input.css:106:5] - 106 | --zero-size: { - : ^^^^^^^^^^^^^^ + 106 | ,-> --zero-size: { + 107 | | width: 0; + 108 | | height: 0; + 109 | `-> }; `---- x Declaration ,-[$DIR/tests/fixture/style-block/input.css:106:5] - 106 | --zero-size: { - : ^^^^^^^^^^^^^^ + 106 | ,-> --zero-size: { + 107 | | width: 0; + 108 | | height: 0; + 109 | `-> }; `---- x DeclarationName @@ -4376,8 +4382,18 @@ x ComponentValue ,-[$DIR/tests/fixture/style-block/input.css:106:5] - 106 | --zero-size: { - : ^ + 106 | ,-> --zero-size: { + 107 | | width: 0; + 108 | | height: 0; + 109 | `-> }; + `---- + + x SimpleBlock + ,-[$DIR/tests/fixture/style-block/input.css:106:5] + 106 | ,-> --zero-size: { + 107 | | width: 0; + 108 | | height: 0; + 109 | `-> }; `---- x LBrace @@ -4545,34 +4561,28 @@ 109 | `-> }; `---- - x ComponentValue - ,-[$DIR/tests/fixture/style-block/input.css:109:5] - 109 | }; - : ^ - `---- - - x RBrace - ,-[$DIR/tests/fixture/style-block/input.css:109:5] - 109 | }; - : ^ - `---- - x ComponentValue ,-[$DIR/tests/fixture/style-block/input.css:110:5] - 110 | --small-icon: { - : ^^^^^^^^^^^^^^^ + 110 | ,-> --small-icon: { + 111 | | width: 16px; + 112 | | height: 16px; + 113 | `-> } `---- x StyleBlock ,-[$DIR/tests/fixture/style-block/input.css:110:5] - 110 | --small-icon: { - : ^^^^^^^^^^^^^^^ + 110 | ,-> --small-icon: { + 111 | | width: 16px; + 112 | | height: 16px; + 113 | `-> } `---- x Declaration ,-[$DIR/tests/fixture/style-block/input.css:110:5] - 110 | --small-icon: { - : ^^^^^^^^^^^^^^^ + 110 | ,-> --small-icon: { + 111 | | width: 16px; + 112 | | height: 16px; + 113 | `-> } `---- x DeclarationName @@ -4589,8 +4599,18 @@ x ComponentValue ,-[$DIR/tests/fixture/style-block/input.css:110:5] - 110 | --small-icon: { - : ^ + 110 | ,-> --small-icon: { + 111 | | width: 16px; + 112 | | height: 16px; + 113 | `-> } + `---- + + x SimpleBlock + ,-[$DIR/tests/fixture/style-block/input.css:110:5] + 110 | ,-> --small-icon: { + 111 | | width: 16px; + 112 | | height: 16px; + 113 | `-> } `---- x LBrace @@ -4757,30 +4777,3 @@ 112 | ,-> height: 16px; 113 | `-> } `---- - - x ComponentValue - ,-[$DIR/tests/fixture/style-block/input.css:113:5] - 113 | } - : ^ - `---- - - x RBrace - ,-[$DIR/tests/fixture/style-block/input.css:113:5] - 113 | } - : ^ - `---- - - x ComponentValue - ,-[$DIR/tests/fixture/style-block/input.css:113:5] - 113 | } - : ^ - 114 | ; - `---- - - x WhiteSpace { value: Atom(' - | ' type=inline) } - ,-[$DIR/tests/fixture/style-block/input.css:113:5] - 113 | } - : ^ - 114 | ; - `---- diff --git a/crates/swc_css_parser/tests/fixture/value/custom-property/output.json b/crates/swc_css_parser/tests/fixture/value/custom-property/output.json index 4459013c2b48..ebeed8a1c6eb 100644 --- a/crates/swc_css_parser/tests/fixture/value/custom-property/output.json +++ b/crates/swc_css_parser/tests/fixture/value/custom-property/output.json @@ -251,19 +251,6 @@ "raw": "value" } } - }, - { - "type": "PreservedToken", - "span": { - "start": 116, - "end": 117, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } } ], "important": { @@ -316,19 +303,6 @@ "raw": "value" } } - }, - { - "type": "PreservedToken", - "span": { - "start": 151, - "end": 152, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } } ], "important": { @@ -369,42 +343,39 @@ }, "value": [ { - "type": "PreservedToken", + "type": "Function", "span": { "start": 182, - "end": 187, + "end": 189, "ctxt": 0 }, - "token": { - "Function": { - "value": "calc", - "raw": "calc" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 187, - "end": 188, - "ctxt": 0 + "name": { + "type": "Ident", + "span": { + "start": 182, + "end": 186, + "ctxt": 0 + }, + "value": "calc", + "raw": "calc" }, - "token": { - "Number": { - "value": 1.0, - "raw": "1", - "type": "integer" + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 187, + "end": 188, + "ctxt": 0 + }, + "token": { + "Number": { + "value": 1.0, + "raw": "1", + "type": "integer" + } + } } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 188, - "end": 189, - "ctxt": 0 - }, - "token": "RParen" + ] } ], "important": { @@ -709,7 +680,7 @@ "type": "Declaration", "span": { "start": 411, - "end": 428, + "end": 434, "ctxt": 0 }, "name": { @@ -724,96 +695,93 @@ }, "value": [ { - "type": "PreservedToken", + "type": "Function", "span": { "start": 423, - "end": 428, - "ctxt": 0 - }, - "token": { - "Function": { - "value": "calc", - "raw": "calc" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 428, - "end": 429, - "ctxt": 0 - }, - "token": { - "Number": { - "value": 1.0, - "raw": "1", - "type": "integer" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 429, - "end": 430, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 430, - "end": 431, - "ctxt": 0 - }, - "token": { - "Delim": { - "value": "+" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 431, - "end": 432, + "end": 434, "ctxt": 0 }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 432, - "end": 433, - "ctxt": 0 + "name": { + "type": "Ident", + "span": { + "start": 423, + "end": 427, + "ctxt": 0 + }, + "value": "calc", + "raw": "calc" }, - "token": { - "Number": { - "value": 1.0, - "raw": "1", - "type": "integer" + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 428, + "end": 429, + "ctxt": 0 + }, + "token": { + "Number": { + "value": 1.0, + "raw": "1", + "type": "integer" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 429, + "end": 430, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 430, + "end": 431, + "ctxt": 0 + }, + "token": { + "Delim": { + "value": "+" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 431, + "end": 432, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 432, + "end": 433, + "ctxt": 0 + }, + "token": { + "Number": { + "value": 1.0, + "raw": "1", + "type": "integer" + } + } } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 433, - "end": 434, - "ctxt": 0 - }, - "token": "RParen" + ] } ], "important": null @@ -822,7 +790,7 @@ "type": "Declaration", "span": { "start": 440, - "end": 456, + "end": 463, "ctxt": 0 }, "name": { @@ -837,41 +805,38 @@ }, "value": [ { - "type": "PreservedToken", + "type": "Function", "span": { "start": 452, - "end": 456, + "end": 463, "ctxt": 0 }, - "token": { - "Function": { - "value": "var", - "raw": "var" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 456, - "end": 462, - "ctxt": 0 + "name": { + "type": "Ident", + "span": { + "start": 452, + "end": 455, + "ctxt": 0 + }, + "value": "var", + "raw": "var" }, - "token": { - "Ident": { - "value": "--unit", - "raw": "--unit" + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 456, + "end": 462, + "ctxt": 0 + }, + "token": { + "Ident": { + "value": "--unit", + "raw": "--unit" + } + } } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 462, - "end": 463, - "ctxt": 0 - }, - "token": "RParen" + ] } ], "important": null @@ -950,7 +915,7 @@ "type": "Declaration", "span": { "start": 547, - "end": 564, + "end": 572, "ctxt": 0 }, "name": { @@ -965,189 +930,190 @@ }, "value": [ { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { "start": 563, - "end": 564, + "end": 572, "ctxt": 0 }, - "token": "LBracket" - }, - { - "type": "PreservedToken", - "span": { - "start": 564, - "end": 565, - "ctxt": 0 + "name": { + "type": "PreservedToken", + "span": { + "start": 563, + "end": 564, + "ctxt": 0 + }, + "token": "LBracket" }, - "token": { - "Number": { - "value": 1.0, - "raw": "1", - "type": "integer" + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 564, + "end": 565, + "ctxt": 0 + }, + "token": { + "Number": { + "value": 1.0, + "raw": "1", + "type": "integer" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 565, + "end": 566, + "ctxt": 0 + }, + "token": "Comma" + }, + { + "type": "PreservedToken", + "span": { + "start": 566, + "end": 567, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 567, + "end": 568, + "ctxt": 0 + }, + "token": { + "Number": { + "value": 2.0, + "raw": "2", + "type": "integer" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 568, + "end": 569, + "ctxt": 0 + }, + "token": "Comma" + }, + { + "type": "PreservedToken", + "span": { + "start": 569, + "end": 570, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 570, + "end": 571, + "ctxt": 0 + }, + "token": { + "Number": { + "value": 3.0, + "raw": "3", + "type": "integer" + } + } } - } + ] + } + ], + "important": null + }, + { + "type": "Declaration", + "span": { + "start": 578, + "end": 597, + "ctxt": 0 + }, + "name": { + "type": "DashedIdent", + "span": { + "start": 578, + "end": 593, + "ctxt": 0 }, + "value": "square-block1", + "raw": "--square-block1" + }, + "value": [ { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { - "start": 565, - "end": 566, + "start": 595, + "end": 597, "ctxt": 0 }, - "token": "Comma" + "name": { + "type": "PreservedToken", + "span": { + "start": 595, + "end": 596, + "ctxt": 0 + }, + "token": "LBracket" + }, + "value": [] + } + ], + "important": null + }, + { + "type": "Declaration", + "span": { + "start": 603, + "end": 621, + "ctxt": 0 + }, + "name": { + "type": "DashedIdent", + "span": { + "start": 603, + "end": 618, + "ctxt": 0 }, + "value": "square-block2", + "raw": "--square-block2" + }, + "value": [ { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { - "start": 566, - "end": 567, + "start": 619, + "end": 621, "ctxt": 0 }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 567, - "end": 568, - "ctxt": 0 - }, - "token": { - "Number": { - "value": 2.0, - "raw": "2", - "type": "integer" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 568, - "end": 569, - "ctxt": 0 - }, - "token": "Comma" - }, - { - "type": "PreservedToken", - "span": { - "start": 569, - "end": 570, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 570, - "end": 571, - "ctxt": 0 - }, - "token": { - "Number": { - "value": 3.0, - "raw": "3", - "type": "integer" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 571, - "end": 572, - "ctxt": 0 - }, - "token": "RBracket" - } - ], - "important": null - }, - { - "type": "Declaration", - "span": { - "start": 578, - "end": 596, - "ctxt": 0 - }, - "name": { - "type": "DashedIdent", - "span": { - "start": 578, - "end": 593, - "ctxt": 0 - }, - "value": "square-block1", - "raw": "--square-block1" - }, - "value": [ - { - "type": "PreservedToken", - "span": { - "start": 595, - "end": 596, - "ctxt": 0 - }, - "token": "LBracket" - }, - { - "type": "PreservedToken", - "span": { - "start": 596, - "end": 597, - "ctxt": 0 - }, - "token": "RBracket" - } - ], - "important": null - }, - { - "type": "Declaration", - "span": { - "start": 603, - "end": 620, - "ctxt": 0 - }, - "name": { - "type": "DashedIdent", - "span": { - "start": 603, - "end": 618, - "ctxt": 0 - }, - "value": "square-block2", - "raw": "--square-block2" - }, - "value": [ - { - "type": "PreservedToken", - "span": { - "start": 619, - "end": 620, - "ctxt": 0 - }, - "token": "LBracket" - }, - { - "type": "PreservedToken", - "span": { - "start": 620, - "end": 621, - "ctxt": 0 + "name": { + "type": "PreservedToken", + "span": { + "start": 619, + "end": 620, + "ctxt": 0 + }, + "token": "LBracket" }, - "token": "RBracket" + "value": [] } ], "important": null @@ -1156,7 +1122,7 @@ "type": "Declaration", "span": { "start": 627, - "end": 643, + "end": 651, "ctxt": 0 }, "name": { @@ -1171,111 +1137,112 @@ }, "value": [ { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { "start": 642, - "end": 643, - "ctxt": 0 - }, - "token": "LParen" - }, - { - "type": "PreservedToken", - "span": { - "start": 643, - "end": 644, - "ctxt": 0 - }, - "token": { - "Number": { - "value": 1.0, - "raw": "1", - "type": "integer" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 644, - "end": 645, - "ctxt": 0 - }, - "token": "Comma" - }, - { - "type": "PreservedToken", - "span": { - "start": 645, - "end": 646, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 646, - "end": 647, - "ctxt": 0 - }, - "token": { - "Number": { - "value": 2.0, - "raw": "2", - "type": "integer" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 647, - "end": 648, - "ctxt": 0 - }, - "token": "Comma" - }, - { - "type": "PreservedToken", - "span": { - "start": 648, - "end": 649, + "end": 651, "ctxt": 0 }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 649, - "end": 650, - "ctxt": 0 + "name": { + "type": "PreservedToken", + "span": { + "start": 642, + "end": 643, + "ctxt": 0 + }, + "token": "LParen" }, - "token": { - "Number": { - "value": 3.0, - "raw": "3", - "type": "integer" + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 643, + "end": 644, + "ctxt": 0 + }, + "token": { + "Number": { + "value": 1.0, + "raw": "1", + "type": "integer" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 644, + "end": 645, + "ctxt": 0 + }, + "token": "Comma" + }, + { + "type": "PreservedToken", + "span": { + "start": 645, + "end": 646, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 646, + "end": 647, + "ctxt": 0 + }, + "token": { + "Number": { + "value": 2.0, + "raw": "2", + "type": "integer" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 647, + "end": 648, + "ctxt": 0 + }, + "token": "Comma" + }, + { + "type": "PreservedToken", + "span": { + "start": 648, + "end": 649, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 649, + "end": 650, + "ctxt": 0 + }, + "token": { + "Number": { + "value": 3.0, + "raw": "3", + "type": "integer" + } + } } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 650, - "end": 651, - "ctxt": 0 - }, - "token": "RParen" + ] } ], "important": null @@ -1284,7 +1251,7 @@ "type": "Declaration", "span": { "start": 657, - "end": 674, + "end": 675, "ctxt": 0 }, "name": { @@ -1299,22 +1266,22 @@ }, "value": [ { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { "start": 673, - "end": 674, - "ctxt": 0 - }, - "token": "LParen" - }, - { - "type": "PreservedToken", - "span": { - "start": 674, "end": 675, "ctxt": 0 }, - "token": "RParen" + "name": { + "type": "PreservedToken", + "span": { + "start": 673, + "end": 674, + "ctxt": 0 + }, + "token": "LParen" + }, + "value": [] } ], "important": null @@ -1323,7 +1290,7 @@ "type": "Declaration", "span": { "start": 681, - "end": 697, + "end": 698, "ctxt": 0 }, "name": { @@ -1338,22 +1305,22 @@ }, "value": [ { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { "start": 696, - "end": 697, - "ctxt": 0 - }, - "token": "LParen" - }, - { - "type": "PreservedToken", - "span": { - "start": 697, "end": 698, "ctxt": 0 }, - "token": "RParen" + "name": { + "type": "PreservedToken", + "span": { + "start": 696, + "end": 697, + "ctxt": 0 + }, + "token": "LParen" + }, + "value": [] } ], "important": null @@ -1362,7 +1329,7 @@ "type": "Declaration", "span": { "start": 704, - "end": 722, + "end": 730, "ctxt": 0 }, "name": { @@ -1377,111 +1344,112 @@ }, "value": [ { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { "start": 721, - "end": 722, - "ctxt": 0 - }, - "token": "LBrace" - }, - { - "type": "PreservedToken", - "span": { - "start": 722, - "end": 723, + "end": 730, "ctxt": 0 }, - "token": { - "Number": { - "value": 1.0, - "raw": "1", - "type": "integer" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 723, - "end": 724, - "ctxt": 0 + "name": { + "type": "PreservedToken", + "span": { + "start": 721, + "end": 722, + "ctxt": 0 + }, + "token": "LBrace" }, - "token": "Comma" - }, - { - "type": "PreservedToken", - "span": { - "start": 724, - "end": 725, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 725, - "end": 726, - "ctxt": 0 - }, - "token": { - "Number": { - "value": 2.0, - "raw": "2", - "type": "integer" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 726, - "end": 727, - "ctxt": 0 - }, - "token": "Comma" - }, - { - "type": "PreservedToken", - "span": { - "start": 727, - "end": 728, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 728, - "end": 729, - "ctxt": 0 - }, - "token": { - "Number": { - "value": 3.0, - "raw": "3", - "type": "integer" + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 722, + "end": 723, + "ctxt": 0 + }, + "token": { + "Number": { + "value": 1.0, + "raw": "1", + "type": "integer" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 723, + "end": 724, + "ctxt": 0 + }, + "token": "Comma" + }, + { + "type": "PreservedToken", + "span": { + "start": 724, + "end": 725, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 725, + "end": 726, + "ctxt": 0 + }, + "token": { + "Number": { + "value": 2.0, + "raw": "2", + "type": "integer" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 726, + "end": 727, + "ctxt": 0 + }, + "token": "Comma" + }, + { + "type": "PreservedToken", + "span": { + "start": 727, + "end": 728, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 728, + "end": 729, + "ctxt": 0 + }, + "token": { + "Number": { + "value": 3.0, + "raw": "3", + "type": "integer" + } + } } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 729, - "end": 730, - "ctxt": 0 - }, - "token": "RBrace" + ] } ], "important": null @@ -1490,7 +1458,7 @@ "type": "Declaration", "span": { "start": 736, - "end": 755, + "end": 756, "ctxt": 0 }, "name": { @@ -1505,22 +1473,22 @@ }, "value": [ { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { "start": 754, - "end": 755, - "ctxt": 0 - }, - "token": "LBrace" - }, - { - "type": "PreservedToken", - "span": { - "start": 755, "end": 756, "ctxt": 0 }, - "token": "RBrace" + "name": { + "type": "PreservedToken", + "span": { + "start": 754, + "end": 755, + "ctxt": 0 + }, + "token": "LBrace" + }, + "value": [] } ], "important": null @@ -1529,7 +1497,7 @@ "type": "Declaration", "span": { "start": 762, - "end": 780, + "end": 781, "ctxt": 0 }, "name": { @@ -1544,22 +1512,22 @@ }, "value": [ { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { "start": 779, - "end": 780, - "ctxt": 0 - }, - "token": "LBrace" - }, - { - "type": "PreservedToken", - "span": { - "start": 780, "end": 781, "ctxt": 0 }, - "token": "RBrace" + "name": { + "type": "PreservedToken", + "span": { + "start": 779, + "end": 780, + "ctxt": 0 + }, + "token": "LBrace" + }, + "value": [] } ], "important": null @@ -1568,7 +1536,7 @@ "type": "Declaration", "span": { "start": 789, - "end": 798, + "end": 830, "ctxt": 0 }, "name": { @@ -1583,43 +1551,325 @@ }, "value": [ { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { "start": 797, - "end": 798, + "end": 830, "ctxt": 0 }, - "token": "LBracket" - }, - { - "type": "PreservedToken", - "span": { - "start": 798, - "end": 799, - "ctxt": 0 + "name": { + "type": "PreservedToken", + "span": { + "start": 797, + "end": 798, + "ctxt": 0 + }, + "token": "LBracket" }, - "token": { - "Number": { - "value": 1.0, - "raw": "1", - "type": "integer" + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 798, + "end": 799, + "ctxt": 0 + }, + "token": { + "Number": { + "value": 1.0, + "raw": "1", + "type": "integer" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 799, + "end": 800, + "ctxt": 0 + }, + "token": "Comma" + }, + { + "type": "PreservedToken", + "span": { + "start": 800, + "end": 801, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 801, + "end": 804, + "ctxt": 0 + }, + "token": { + "String": { + "value": "2", + "raw": "\"2\"" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 804, + "end": 805, + "ctxt": 0 + }, + "token": "Comma" + }, + { + "type": "PreservedToken", + "span": { + "start": 805, + "end": 806, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } + }, + { + "type": "SimpleBlock", + "span": { + "start": 806, + "end": 824, + "ctxt": 0 + }, + "name": { + "type": "PreservedToken", + "span": { + "start": 806, + "end": 807, + "ctxt": 0 + }, + "token": "LBrace" + }, + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 807, + "end": 814, + "ctxt": 0 + }, + "token": { + "String": { + "value": "three", + "raw": "\"three\"" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 814, + "end": 815, + "ctxt": 0 + }, + "token": "Colon" + }, + { + "type": "PreservedToken", + "span": { + "start": 815, + "end": 816, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } + }, + { + "type": "SimpleBlock", + "span": { + "start": 816, + "end": 823, + "ctxt": 0 + }, + "name": { + "type": "PreservedToken", + "span": { + "start": 816, + "end": 817, + "ctxt": 0 + }, + "token": "LBrace" + }, + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 817, + "end": 820, + "ctxt": 0 + }, + "token": { + "String": { + "value": "a", + "raw": "\"a\"" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 820, + "end": 821, + "ctxt": 0 + }, + "token": "Colon" + }, + { + "type": "PreservedToken", + "span": { + "start": 821, + "end": 822, + "ctxt": 0 + }, + "token": { + "Number": { + "value": 1.0, + "raw": "1", + "type": "integer" + } + } + } + ] + } + ] + }, + { + "type": "PreservedToken", + "span": { + "start": 824, + "end": 825, + "ctxt": 0 + }, + "token": "Comma" + }, + { + "type": "PreservedToken", + "span": { + "start": 825, + "end": 826, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } + }, + { + "type": "SimpleBlock", + "span": { + "start": 826, + "end": 829, + "ctxt": 0 + }, + "name": { + "type": "PreservedToken", + "span": { + "start": 826, + "end": 827, + "ctxt": 0 + }, + "token": "LBracket" + }, + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 827, + "end": 828, + "ctxt": 0 + }, + "token": { + "Number": { + "value": 4.0, + "raw": "4", + "type": "integer" + } + } + } + ] } - } + ] + } + ], + "important": null + }, + { + "type": "Declaration", + "span": { + "start": 836, + "end": 886, + "ctxt": 0 + }, + "name": { + "type": "DashedIdent", + "span": { + "start": 836, + "end": 848, + "ctxt": 0 }, + "value": "javascript", + "raw": "--javascript" + }, + "value": [ { - "type": "PreservedToken", + "type": "Function", "span": { - "start": 799, - "end": 800, + "start": 850, + "end": 864, "ctxt": 0 }, - "token": "Comma" + "name": { + "type": "Ident", + "span": { + "start": 850, + "end": 858, + "ctxt": 0 + }, + "value": "function", + "raw": "function" + }, + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 859, + "end": 863, + "ctxt": 0 + }, + "token": { + "Ident": { + "value": "rule", + "raw": "rule" + } + } + } + ] }, { "type": "PreservedToken", "span": { - "start": 800, - "end": 801, + "start": 864, + "end": 865, "ctxt": 0 }, "token": { @@ -1629,214 +1879,586 @@ } }, { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { - "start": 801, - "end": 804, + "start": 865, + "end": 886, "ctxt": 0 }, - "token": { - "String": { - "value": "2", - "raw": "\"2\"" + "name": { + "type": "PreservedToken", + "span": { + "start": 865, + "end": 866, + "ctxt": 0 + }, + "token": "LBrace" + }, + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 866, + "end": 867, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 867, + "end": 874, + "ctxt": 0 + }, + "token": { + "Ident": { + "value": "console", + "raw": "console" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 874, + "end": 875, + "ctxt": 0 + }, + "token": { + "Delim": { + "value": "." + } + } + }, + { + "type": "Function", + "span": { + "start": 875, + "end": 884, + "ctxt": 0 + }, + "name": { + "type": "Ident", + "span": { + "start": 875, + "end": 878, + "ctxt": 0 + }, + "value": "log", + "raw": "log" + }, + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 879, + "end": 883, + "ctxt": 0 + }, + "token": { + "Ident": { + "value": "rule", + "raw": "rule" + } + } + } + ] + }, + { + "type": "PreservedToken", + "span": { + "start": 884, + "end": 885, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } } - } + ] + } + ], + "important": null + }, + { + "type": "Declaration", + "span": { + "start": 893, + "end": 904, + "ctxt": 0 + }, + "name": { + "type": "DashedIdent", + "span": { + "start": 893, + "end": 898, + "ctxt": 0 }, + "value": "CDO", + "raw": "--CDO" + }, + "value": [ { "type": "PreservedToken", "span": { - "start": 804, - "end": 805, + "start": 900, + "end": 904, "ctxt": 0 }, - "token": "Comma" - }, - { - "type": "PreservedToken", - "span": { - "start": 805, - "end": 806, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 806, - "end": 807, - "ctxt": 0 - }, - "token": "LBrace" + "token": "CDO" + } + ], + "important": null + }, + { + "type": "Declaration", + "span": { + "start": 910, + "end": 920, + "ctxt": 0 + }, + "name": { + "type": "DashedIdent", + "span": { + "start": 910, + "end": 915, + "ctxt": 0 }, + "value": "CDC", + "raw": "--CDC" + }, + "value": [ { "type": "PreservedToken", "span": { - "start": 807, - "end": 814, + "start": 917, + "end": 920, "ctxt": 0 }, - "token": { - "String": { - "value": "three", - "raw": "\"three\"" - } - } + "token": "CDC" + } + ], + "important": null + }, + { + "type": "Declaration", + "span": { + "start": 927, + "end": 976, + "ctxt": 0 + }, + "name": { + "type": "DashedIdent", + "span": { + "start": 927, + "end": 945, + "ctxt": 0 }, + "value": "complex-balanced", + "raw": "--complex-balanced" + }, + "value": [ { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { - "start": 814, - "end": 815, + "start": 946, + "end": 966, "ctxt": 0 }, - "token": "Colon" - }, - { - "type": "PreservedToken", - "span": { - "start": 815, - "end": 816, - "ctxt": 0 + "name": { + "type": "PreservedToken", + "span": { + "start": 946, + "end": 947, + "ctxt": 0 + }, + "token": "LBrace" }, - "token": { - "WhiteSpace": { - "value": " " + "value": [ + { + "type": "SimpleBlock", + "span": { + "start": 947, + "end": 965, + "ctxt": 0 + }, + "name": { + "type": "PreservedToken", + "span": { + "start": 947, + "end": 948, + "ctxt": 0 + }, + "token": "LBracket" + }, + "value": [ + { + "type": "SimpleBlock", + "span": { + "start": 948, + "end": 954, + "ctxt": 0 + }, + "name": { + "type": "PreservedToken", + "span": { + "start": 948, + "end": 949, + "ctxt": 0 + }, + "token": "LParen" + }, + "value": [ + { + "type": "SimpleBlock", + "span": { + "start": 949, + "end": 953, + "ctxt": 0 + }, + "name": { + "type": "PreservedToken", + "span": { + "start": 949, + "end": 950, + "ctxt": 0 + }, + "token": "LBrace" + }, + "value": [ + { + "type": "SimpleBlock", + "span": { + "start": 950, + "end": 952, + "ctxt": 0 + }, + "name": { + "type": "PreservedToken", + "span": { + "start": 950, + "end": 951, + "ctxt": 0 + }, + "token": "LParen" + }, + "value": [] + } + ] + } + ] + }, + { + "type": "SimpleBlock", + "span": { + "start": 954, + "end": 956, + "ctxt": 0 + }, + "name": { + "type": "PreservedToken", + "span": { + "start": 954, + "end": 955, + "ctxt": 0 + }, + "token": "LParen" + }, + "value": [] + }, + { + "type": "SimpleBlock", + "span": { + "start": 956, + "end": 958, + "ctxt": 0 + }, + "name": { + "type": "PreservedToken", + "span": { + "start": 956, + "end": 957, + "ctxt": 0 + }, + "token": "LParen" + }, + "value": [] + }, + { + "type": "SimpleBlock", + "span": { + "start": 958, + "end": 964, + "ctxt": 0 + }, + "name": { + "type": "PreservedToken", + "span": { + "start": 958, + "end": 959, + "ctxt": 0 + }, + "token": "LBracket" + }, + "value": [ + { + "type": "SimpleBlock", + "span": { + "start": 959, + "end": 963, + "ctxt": 0 + }, + "name": { + "type": "PreservedToken", + "span": { + "start": 959, + "end": 960, + "ctxt": 0 + }, + "token": "LParen" + }, + "value": [ + { + "type": "SimpleBlock", + "span": { + "start": 960, + "end": 962, + "ctxt": 0 + }, + "name": { + "type": "PreservedToken", + "span": { + "start": 960, + "end": 961, + "ctxt": 0 + }, + "token": "LBrace" + }, + "value": [] + } + ] + } + ] + } + ] } - } + ] }, { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { - "start": 816, - "end": 817, + "start": 966, + "end": 972, "ctxt": 0 }, - "token": "LBrace" - }, - { - "type": "PreservedToken", - "span": { - "start": 817, - "end": 820, - "ctxt": 0 + "name": { + "type": "PreservedToken", + "span": { + "start": 966, + "end": 967, + "ctxt": 0 + }, + "token": "LBracket" }, - "token": { - "String": { - "value": "a", - "raw": "\"a\"" + "value": [ + { + "type": "SimpleBlock", + "span": { + "start": 967, + "end": 971, + "ctxt": 0 + }, + "name": { + "type": "PreservedToken", + "span": { + "start": 967, + "end": 968, + "ctxt": 0 + }, + "token": "LBrace" + }, + "value": [ + { + "type": "SimpleBlock", + "span": { + "start": 968, + "end": 970, + "ctxt": 0 + }, + "name": { + "type": "PreservedToken", + "span": { + "start": 968, + "end": 969, + "ctxt": 0 + }, + "token": "LParen" + }, + "value": [] + } + ] } - } + ] }, { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { - "start": 820, - "end": 821, + "start": 972, + "end": 976, "ctxt": 0 }, - "token": "Colon" - }, - { - "type": "PreservedToken", - "span": { - "start": 821, - "end": 822, - "ctxt": 0 + "name": { + "type": "PreservedToken", + "span": { + "start": 972, + "end": 973, + "ctxt": 0 + }, + "token": "LParen" }, - "token": { - "Number": { - "value": 1.0, - "raw": "1", - "type": "integer" + "value": [ + { + "type": "SimpleBlock", + "span": { + "start": 973, + "end": 975, + "ctxt": 0 + }, + "name": { + "type": "PreservedToken", + "span": { + "start": 973, + "end": 974, + "ctxt": 0 + }, + "token": "LBracket" + }, + "value": [] } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 822, - "end": 823, - "ctxt": 0 - }, - "token": "RBrace" - }, - { - "type": "PreservedToken", - "span": { - "start": 823, - "end": 824, - "ctxt": 0 - }, - "token": "RBrace" + ] + } + ], + "important": null + }, + { + "type": "Declaration", + "span": { + "start": 982, + "end": 1011, + "ctxt": 0 + }, + "name": { + "type": "DashedIdent", + "span": { + "start": 982, + "end": 998, + "ctxt": 0 }, + "value": "fake-important", + "raw": "--fake-important" + }, + "value": [ { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { - "start": 824, - "end": 825, + "start": 999, + "end": 1011, "ctxt": 0 }, - "token": "Comma" - }, - { - "type": "PreservedToken", - "span": { - "start": 825, - "end": 826, - "ctxt": 0 + "name": { + "type": "PreservedToken", + "span": { + "start": 999, + "end": 1000, + "ctxt": 0 + }, + "token": "LBrace" }, - "token": { - "WhiteSpace": { - "value": " " + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 1000, + "end": 1001, + "ctxt": 0 + }, + "token": { + "Delim": { + "value": "!" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1001, + "end": 1010, + "ctxt": 0 + }, + "token": { + "Ident": { + "value": "important", + "raw": "important" + } + } } - } + ] + } + ], + "important": null + }, + { + "type": "Declaration", + "span": { + "start": 1017, + "end": 1047, + "ctxt": 0 + }, + "name": { + "type": "DashedIdent", + "span": { + "start": 1017, + "end": 1042, + "ctxt": 0 }, + "value": "semicolon-not-top-level", + "raw": "--semicolon-not-top-level" + }, + "value": [ { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { - "start": 826, - "end": 827, + "start": 1044, + "end": 1047, "ctxt": 0 }, - "token": "LBracket" - }, - { - "type": "PreservedToken", - "span": { - "start": 827, - "end": 828, - "ctxt": 0 + "name": { + "type": "PreservedToken", + "span": { + "start": 1044, + "end": 1045, + "ctxt": 0 + }, + "token": "LParen" }, - "token": { - "Number": { - "value": 4.0, - "raw": "4", - "type": "integer" + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 1045, + "end": 1046, + "ctxt": 0 + }, + "token": "Semi" } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 828, - "end": 829, - "ctxt": 0 - }, - "token": "RBracket" - }, - { - "type": "PreservedToken", - "span": { - "start": 829, - "end": 830, - "ctxt": 0 - }, - "token": "RBracket" + ] } ], "important": null @@ -1844,178 +2466,52 @@ { "type": "Declaration", "span": { - "start": 836, - "end": 859, + "start": 1053, + "end": 1079, "ctxt": 0 }, "name": { "type": "DashedIdent", "span": { - "start": 836, - "end": 848, + "start": 1053, + "end": 1074, "ctxt": 0 }, - "value": "javascript", - "raw": "--javascript" + "value": "delim-not-top-level", + "raw": "--delim-not-top-level" }, "value": [ { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { - "start": 850, - "end": 859, + "start": 1076, + "end": 1079, "ctxt": 0 }, - "token": { - "Function": { - "value": "function", - "raw": "function" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 859, - "end": 863, - "ctxt": 0 - }, - "token": { - "Ident": { - "value": "rule", - "raw": "rule" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 863, - "end": 864, - "ctxt": 0 - }, - "token": "RParen" - }, - { - "type": "PreservedToken", - "span": { - "start": 864, - "end": 865, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 865, - "end": 866, - "ctxt": 0 - }, - "token": "LBrace" - }, - { - "type": "PreservedToken", - "span": { - "start": 866, - "end": 867, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 867, - "end": 874, - "ctxt": 0 - }, - "token": { - "Ident": { - "value": "console", - "raw": "console" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 874, - "end": 875, - "ctxt": 0 - }, - "token": { - "Delim": { - "value": "." - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 875, - "end": 879, - "ctxt": 0 - }, - "token": { - "Function": { - "value": "log", - "raw": "log" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 879, - "end": 883, - "ctxt": 0 - }, - "token": { - "Ident": { - "value": "rule", - "raw": "rule" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 883, - "end": 884, - "ctxt": 0 - }, - "token": "RParen" - }, - { - "type": "PreservedToken", - "span": { - "start": 884, - "end": 885, - "ctxt": 0 + "name": { + "type": "PreservedToken", + "span": { + "start": 1076, + "end": 1077, + "ctxt": 0 + }, + "token": "LParen" }, - "token": { - "WhiteSpace": { - "value": " " + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 1077, + "end": 1078, + "ctxt": 0 + }, + "token": { + "Delim": { + "value": "!" + } + } } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 885, - "end": 886, - "ctxt": 0 - }, - "token": "RBrace" + ] } ], "important": null @@ -2023,59 +2519,198 @@ { "type": "Declaration", "span": { - "start": 893, - "end": 904, + "start": 1085, + "end": 1142, "ctxt": 0 }, "name": { "type": "DashedIdent", "span": { - "start": 893, - "end": 898, + "start": 1085, + "end": 1096, "ctxt": 0 }, - "value": "CDO", - "raw": "--CDO" + "value": "zero-size", + "raw": "--zero-size" }, "value": [ { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { - "start": 900, - "end": 904, + "start": 1098, + "end": 1142, "ctxt": 0 }, - "token": "CDO" - } - ], - "important": null - }, - { - "type": "Declaration", - "span": { - "start": 910, - "end": 920, - "ctxt": 0 - }, - "name": { - "type": "DashedIdent", - "span": { - "start": 910, - "end": 915, - "ctxt": 0 - }, - "value": "CDC", - "raw": "--CDC" - }, - "value": [ - { - "type": "PreservedToken", - "span": { - "start": 917, - "end": 920, - "ctxt": 0 + "name": { + "type": "PreservedToken", + "span": { + "start": 1098, + "end": 1099, + "ctxt": 0 + }, + "token": "LBrace" }, - "token": "CDC" + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 1099, + "end": 1108, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": "\n " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1108, + "end": 1113, + "ctxt": 0 + }, + "token": { + "Ident": { + "value": "width", + "raw": "width" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1113, + "end": 1114, + "ctxt": 0 + }, + "token": "Colon" + }, + { + "type": "PreservedToken", + "span": { + "start": 1114, + "end": 1115, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1115, + "end": 1116, + "ctxt": 0 + }, + "token": { + "Number": { + "value": 0.0, + "raw": "0", + "type": "integer" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1116, + "end": 1117, + "ctxt": 0 + }, + "token": "Semi" + }, + { + "type": "PreservedToken", + "span": { + "start": 1117, + "end": 1126, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": "\n " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1126, + "end": 1132, + "ctxt": 0 + }, + "token": { + "Ident": { + "value": "height", + "raw": "height" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1132, + "end": 1133, + "ctxt": 0 + }, + "token": "Colon" + }, + { + "type": "PreservedToken", + "span": { + "start": 1133, + "end": 1134, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1134, + "end": 1135, + "ctxt": 0 + }, + "token": { + "Number": { + "value": 0.0, + "raw": "0", + "type": "integer" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1135, + "end": 1136, + "ctxt": 0 + }, + "token": "Semi" + }, + { + "type": "PreservedToken", + "span": { + "start": 1136, + "end": 1141, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": "\n " + } + } + } + ] } ], "important": null @@ -2083,869 +2718,202 @@ { "type": "Declaration", "span": { - "start": 927, - "end": 947, + "start": 1148, + "end": 1212, "ctxt": 0 }, "name": { "type": "DashedIdent", "span": { - "start": 927, - "end": 945, + "start": 1148, + "end": 1160, "ctxt": 0 }, - "value": "complex-balanced", - "raw": "--complex-balanced" + "value": "small-icon", + "raw": "--small-icon" }, "value": [ { - "type": "PreservedToken", - "span": { - "start": 946, - "end": 947, - "ctxt": 0 - }, - "token": "LBrace" - }, - { - "type": "PreservedToken", - "span": { - "start": 947, - "end": 948, - "ctxt": 0 - }, - "token": "LBracket" - }, - { - "type": "PreservedToken", - "span": { - "start": 948, - "end": 949, - "ctxt": 0 - }, - "token": "LParen" - }, - { - "type": "PreservedToken", - "span": { - "start": 949, - "end": 950, - "ctxt": 0 - }, - "token": "LBrace" - }, - { - "type": "PreservedToken", + "type": "SimpleBlock", "span": { - "start": 950, - "end": 951, + "start": 1162, + "end": 1212, "ctxt": 0 }, - "token": "LParen" - }, - { - "type": "PreservedToken", - "span": { - "start": 951, - "end": 952, - "ctxt": 0 + "name": { + "type": "PreservedToken", + "span": { + "start": 1162, + "end": 1163, + "ctxt": 0 + }, + "token": "LBrace" }, - "token": "RParen" - }, - { - "type": "PreservedToken", - "span": { - "start": 952, - "end": 953, - "ctxt": 0 - }, - "token": "RBrace" - }, - { - "type": "PreservedToken", - "span": { - "start": 953, - "end": 954, - "ctxt": 0 - }, - "token": "RParen" - }, - { - "type": "PreservedToken", - "span": { - "start": 954, - "end": 955, - "ctxt": 0 - }, - "token": "LParen" - }, - { - "type": "PreservedToken", - "span": { - "start": 955, - "end": 956, - "ctxt": 0 - }, - "token": "RParen" - }, - { - "type": "PreservedToken", - "span": { - "start": 956, - "end": 957, - "ctxt": 0 - }, - "token": "LParen" - }, - { - "type": "PreservedToken", - "span": { - "start": 957, - "end": 958, - "ctxt": 0 - }, - "token": "RParen" - }, - { - "type": "PreservedToken", - "span": { - "start": 958, - "end": 959, - "ctxt": 0 - }, - "token": "LBracket" - }, - { - "type": "PreservedToken", - "span": { - "start": 959, - "end": 960, - "ctxt": 0 - }, - "token": "LParen" - }, - { - "type": "PreservedToken", - "span": { - "start": 960, - "end": 961, - "ctxt": 0 - }, - "token": "LBrace" - }, - { - "type": "PreservedToken", - "span": { - "start": 961, - "end": 962, - "ctxt": 0 - }, - "token": "RBrace" - }, - { - "type": "PreservedToken", - "span": { - "start": 962, - "end": 963, - "ctxt": 0 - }, - "token": "RParen" - }, - { - "type": "PreservedToken", - "span": { - "start": 963, - "end": 964, - "ctxt": 0 - }, - "token": "RBracket" - }, - { - "type": "PreservedToken", - "span": { - "start": 964, - "end": 965, - "ctxt": 0 - }, - "token": "RBracket" - }, - { - "type": "PreservedToken", - "span": { - "start": 965, - "end": 966, - "ctxt": 0 - }, - "token": "RBrace" - }, - { - "type": "PreservedToken", - "span": { - "start": 966, - "end": 967, - "ctxt": 0 - }, - "token": "LBracket" - }, - { - "type": "PreservedToken", - "span": { - "start": 967, - "end": 968, - "ctxt": 0 - }, - "token": "LBrace" - }, - { - "type": "PreservedToken", - "span": { - "start": 968, - "end": 969, - "ctxt": 0 - }, - "token": "LParen" - }, - { - "type": "PreservedToken", - "span": { - "start": 969, - "end": 970, - "ctxt": 0 - }, - "token": "RParen" - }, - { - "type": "PreservedToken", - "span": { - "start": 970, - "end": 971, - "ctxt": 0 - }, - "token": "RBrace" - }, - { - "type": "PreservedToken", - "span": { - "start": 971, - "end": 972, - "ctxt": 0 - }, - "token": "RBracket" - }, - { - "type": "PreservedToken", - "span": { - "start": 972, - "end": 973, - "ctxt": 0 - }, - "token": "LParen" - }, - { - "type": "PreservedToken", - "span": { - "start": 973, - "end": 974, - "ctxt": 0 - }, - "token": "LBracket" - }, - { - "type": "PreservedToken", - "span": { - "start": 974, - "end": 975, - "ctxt": 0 - }, - "token": "RBracket" - }, - { - "type": "PreservedToken", - "span": { - "start": 975, - "end": 976, - "ctxt": 0 - }, - "token": "RParen" - } - ], - "important": null - }, - { - "type": "Declaration", - "span": { - "start": 982, - "end": 1000, - "ctxt": 0 - }, - "name": { - "type": "DashedIdent", - "span": { - "start": 982, - "end": 998, - "ctxt": 0 - }, - "value": "fake-important", - "raw": "--fake-important" - }, - "value": [ - { - "type": "PreservedToken", - "span": { - "start": 999, - "end": 1000, - "ctxt": 0 - }, - "token": "LBrace" - }, - { - "type": "PreservedToken", - "span": { - "start": 1000, - "end": 1001, - "ctxt": 0 - }, - "token": { - "Delim": { - "value": "!" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1001, - "end": 1010, - "ctxt": 0 - }, - "token": { - "Ident": { - "value": "important", - "raw": "important" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1010, - "end": 1011, - "ctxt": 0 - }, - "token": "RBrace" - } - ], - "important": null - }, - { - "type": "Declaration", - "span": { - "start": 1017, - "end": 1045, - "ctxt": 0 - }, - "name": { - "type": "DashedIdent", - "span": { - "start": 1017, - "end": 1042, - "ctxt": 0 - }, - "value": "semicolon-not-top-level", - "raw": "--semicolon-not-top-level" - }, - "value": [ - { - "type": "PreservedToken", - "span": { - "start": 1044, - "end": 1045, - "ctxt": 0 - }, - "token": "LParen" - }, - { - "type": "PreservedToken", - "span": { - "start": 1045, - "end": 1046, - "ctxt": 0 - }, - "token": "Semi" - }, - { - "type": "PreservedToken", - "span": { - "start": 1046, - "end": 1047, - "ctxt": 0 - }, - "token": "RParen" - } - ], - "important": null - }, - { - "type": "Declaration", - "span": { - "start": 1053, - "end": 1077, - "ctxt": 0 - }, - "name": { - "type": "DashedIdent", - "span": { - "start": 1053, - "end": 1074, - "ctxt": 0 - }, - "value": "delim-not-top-level", - "raw": "--delim-not-top-level" - }, - "value": [ - { - "type": "PreservedToken", - "span": { - "start": 1076, - "end": 1077, - "ctxt": 0 - }, - "token": "LParen" - }, - { - "type": "PreservedToken", - "span": { - "start": 1077, - "end": 1078, - "ctxt": 0 - }, - "token": { - "Delim": { - "value": "!" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1078, - "end": 1079, - "ctxt": 0 - }, - "token": "RParen" - } - ], - "important": null - }, - { - "type": "Declaration", - "span": { - "start": 1085, - "end": 1099, - "ctxt": 0 - }, - "name": { - "type": "DashedIdent", - "span": { - "start": 1085, - "end": 1096, - "ctxt": 0 - }, - "value": "zero-size", - "raw": "--zero-size" - }, - "value": [ - { - "type": "PreservedToken", - "span": { - "start": 1098, - "end": 1099, - "ctxt": 0 - }, - "token": "LBrace" - }, - { - "type": "PreservedToken", - "span": { - "start": 1099, - "end": 1108, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": "\n " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1108, - "end": 1113, - "ctxt": 0 - }, - "token": { - "Ident": { - "value": "width", - "raw": "width" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1113, - "end": 1114, - "ctxt": 0 - }, - "token": "Colon" - }, - { - "type": "PreservedToken", - "span": { - "start": 1114, - "end": 1115, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1115, - "end": 1116, - "ctxt": 0 - }, - "token": { - "Number": { - "value": 0.0, - "raw": "0", - "type": "integer" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1116, - "end": 1117, - "ctxt": 0 - }, - "token": "Semi" - }, - { - "type": "PreservedToken", - "span": { - "start": 1117, - "end": 1126, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": "\n " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1126, - "end": 1132, - "ctxt": 0 - }, - "token": { - "Ident": { - "value": "height", - "raw": "height" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1132, - "end": 1133, - "ctxt": 0 - }, - "token": "Colon" - }, - { - "type": "PreservedToken", - "span": { - "start": 1133, - "end": 1134, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1134, - "end": 1135, - "ctxt": 0 - }, - "token": { - "Number": { - "value": 0.0, - "raw": "0", - "type": "integer" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1135, - "end": 1136, - "ctxt": 0 - }, - "token": "Semi" - }, - { - "type": "PreservedToken", - "span": { - "start": 1136, - "end": 1141, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": "\n " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1141, - "end": 1142, - "ctxt": 0 - }, - "token": "RBrace" - } - ], - "important": null - }, - { - "type": "Declaration", - "span": { - "start": 1148, - "end": 1163, - "ctxt": 0 - }, - "name": { - "type": "DashedIdent", - "span": { - "start": 1148, - "end": 1160, - "ctxt": 0 - }, - "value": "small-icon", - "raw": "--small-icon" - }, - "value": [ - { - "type": "PreservedToken", - "span": { - "start": 1162, - "end": 1163, - "ctxt": 0 - }, - "token": "LBrace" - }, - { - "type": "PreservedToken", - "span": { - "start": 1163, - "end": 1172, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": "\n " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1172, - "end": 1177, - "ctxt": 0 - }, - "token": { - "Ident": { - "value": "width", - "raw": "width" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1177, - "end": 1178, - "ctxt": 0 - }, - "token": "Colon" - }, - { - "type": "PreservedToken", - "span": { - "start": 1178, - "end": 1179, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1179, - "end": 1183, - "ctxt": 0 - }, - "token": { - "Dimension": { - "value": 16.0, - "raw_value": "16", - "unit": "px", - "raw_unit": "px", - "type": "integer" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1183, - "end": 1184, - "ctxt": 0 - }, - "token": "Semi" - }, - { - "type": "PreservedToken", - "span": { - "start": 1184, - "end": 1193, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": "\n " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1193, - "end": 1199, - "ctxt": 0 - }, - "token": { - "Ident": { - "value": "height", - "raw": "height" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1199, - "end": 1200, - "ctxt": 0 - }, - "token": "Colon" - }, - { - "type": "PreservedToken", - "span": { - "start": 1200, - "end": 1201, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1201, - "end": 1205, - "ctxt": 0 - }, - "token": { - "Dimension": { - "value": 16.0, - "raw_value": "16", - "unit": "px", - "raw_unit": "px", - "type": "integer" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1205, - "end": 1206, - "ctxt": 0 - }, - "token": "Semi" - }, - { - "type": "PreservedToken", - "span": { - "start": 1206, - "end": 1211, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": "\n " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 1211, - "end": 1212, - "ctxt": 0 - }, - "token": "RBrace" - }, - { - "type": "PreservedToken", - "span": { - "start": 1212, - "end": 1217, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": "\n " + "value": [ + { + "type": "PreservedToken", + "span": { + "start": 1163, + "end": 1172, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": "\n " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1172, + "end": 1177, + "ctxt": 0 + }, + "token": { + "Ident": { + "value": "width", + "raw": "width" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1177, + "end": 1178, + "ctxt": 0 + }, + "token": "Colon" + }, + { + "type": "PreservedToken", + "span": { + "start": 1178, + "end": 1179, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1179, + "end": 1183, + "ctxt": 0 + }, + "token": { + "Dimension": { + "value": 16.0, + "raw_value": "16", + "unit": "px", + "raw_unit": "px", + "type": "integer" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1183, + "end": 1184, + "ctxt": 0 + }, + "token": "Semi" + }, + { + "type": "PreservedToken", + "span": { + "start": 1184, + "end": 1193, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": "\n " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1193, + "end": 1199, + "ctxt": 0 + }, + "token": { + "Ident": { + "value": "height", + "raw": "height" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1199, + "end": 1200, + "ctxt": 0 + }, + "token": "Colon" + }, + { + "type": "PreservedToken", + "span": { + "start": 1200, + "end": 1201, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": " " + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1201, + "end": 1205, + "ctxt": 0 + }, + "token": { + "Dimension": { + "value": 16.0, + "raw_value": "16", + "unit": "px", + "raw_unit": "px", + "type": "integer" + } + } + }, + { + "type": "PreservedToken", + "span": { + "start": 1205, + "end": 1206, + "ctxt": 0 + }, + "token": "Semi" + }, + { + "type": "PreservedToken", + "span": { + "start": 1206, + "end": 1211, + "ctxt": 0 + }, + "token": { + "WhiteSpace": { + "value": "\n " + } + } } - } + ] } ], "important": null diff --git a/crates/swc_css_parser/tests/fixture/value/custom-property/span.rust-debug b/crates/swc_css_parser/tests/fixture/value/custom-property/span.rust-debug index a7094dcd6cd2..6458efb4210e 100644 --- a/crates/swc_css_parser/tests/fixture/value/custom-property/span.rust-debug +++ b/crates/swc_css_parser/tests/fixture/value/custom-property/span.rust-debug @@ -487,18 +487,6 @@ : ^^^^^ `---- - x ComponentValue - ,-[$DIR/tests/fixture/value/custom-property/input.css:6:5] - 6 | --important2: value !important; - : ^ - `---- - - x WhiteSpace { value: Atom(' ' type=inline) } - ,-[$DIR/tests/fixture/value/custom-property/input.css:6:5] - 6 | --important2: value !important; - : ^ - `---- - x ImportantFlag ,-[$DIR/tests/fixture/value/custom-property/input.css:6:5] 6 | --important2: value !important; @@ -553,18 +541,6 @@ : ^^^^^ `---- - x ComponentValue - ,-[$DIR/tests/fixture/value/custom-property/input.css:7:5] - 7 | --important3:value !important; - : ^ - `---- - - x WhiteSpace { value: Atom(' ' type=inline) } - ,-[$DIR/tests/fixture/value/custom-property/input.css:7:5] - 7 | --important3:value !important; - : ^ - `---- - x ImportantFlag ,-[$DIR/tests/fixture/value/custom-property/input.css:7:5] 7 | --important3:value !important; @@ -610,37 +586,31 @@ x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:8:5] 8 | --important4: calc(1)!important; - : ^^^^^ - `---- - - x Function { value: Atom('calc' type=static), raw: Atom('calc' type=static) } - ,-[$DIR/tests/fixture/value/custom-property/input.css:8:5] - 8 | --important4: calc(1)!important; - : ^^^^^ + : ^^^^^^^ `---- - x ComponentValue + x Function ,-[$DIR/tests/fixture/value/custom-property/input.css:8:5] 8 | --important4: calc(1)!important; - : ^ + : ^^^^^^^ `---- - x Number { value: 1.0, raw: Atom('1' type=inline), type_flag: Integer } + x Ident ,-[$DIR/tests/fixture/value/custom-property/input.css:8:5] 8 | --important4: calc(1)!important; - : ^ + : ^^^^ `---- x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:8:5] 8 | --important4: calc(1)!important; - : ^ + : ^ `---- - x RParen + x Number { value: 1.0, raw: Atom('1' type=inline), type_flag: Integer } ,-[$DIR/tests/fixture/value/custom-property/input.css:8:5] 8 | --important4: calc(1)!important; - : ^ + : ^ `---- x ImportantFlag @@ -1000,19 +970,19 @@ x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:21:5] 21 | --function: calc(1 + 1); - : ^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^ `---- x StyleBlock ,-[$DIR/tests/fixture/value/custom-property/input.css:21:5] 21 | --function: calc(1 + 1); - : ^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^ `---- x Declaration ,-[$DIR/tests/fixture/value/custom-property/input.css:21:5] 21 | --function: calc(1 + 1); - : ^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^ `---- x DeclarationName @@ -1030,13 +1000,19 @@ x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:21:5] 21 | --function: calc(1 + 1); - : ^^^^^ + : ^^^^^^^^^^^ + `---- + + x Function + ,-[$DIR/tests/fixture/value/custom-property/input.css:21:5] + 21 | --function: calc(1 + 1); + : ^^^^^^^^^^^ `---- - x Function { value: Atom('calc' type=static), raw: Atom('calc' type=static) } + x Ident ,-[$DIR/tests/fixture/value/custom-property/input.css:21:5] 21 | --function: calc(1 + 1); - : ^^^^^ + : ^^^^ `---- x ComponentValue @@ -1099,34 +1075,22 @@ : ^ `---- - x ComponentValue - ,-[$DIR/tests/fixture/value/custom-property/input.css:21:5] - 21 | --function: calc(1 + 1); - : ^ - `---- - - x RParen - ,-[$DIR/tests/fixture/value/custom-property/input.css:21:5] - 21 | --function: calc(1 + 1); - : ^ - `---- - x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:22:5] 22 | --variable: var(--unit); - : ^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^ `---- x StyleBlock ,-[$DIR/tests/fixture/value/custom-property/input.css:22:5] 22 | --variable: var(--unit); - : ^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^ `---- x Declaration ,-[$DIR/tests/fixture/value/custom-property/input.css:22:5] 22 | --variable: var(--unit); - : ^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^ `---- x DeclarationName @@ -1144,37 +1108,31 @@ x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:22:5] 22 | --variable: var(--unit); - : ^^^^ - `---- - - x Function { value: Atom('var' type=static), raw: Atom('var' type=static) } - ,-[$DIR/tests/fixture/value/custom-property/input.css:22:5] - 22 | --variable: var(--unit); - : ^^^^ + : ^^^^^^^^^^^ `---- - x ComponentValue + x Function ,-[$DIR/tests/fixture/value/custom-property/input.css:22:5] 22 | --variable: var(--unit); - : ^^^^^^ + : ^^^^^^^^^^^ `---- - x Ident { value: Atom('--unit' type=inline), raw: Atom('--unit' type=inline) } + x Ident ,-[$DIR/tests/fixture/value/custom-property/input.css:22:5] 22 | --variable: var(--unit); - : ^^^^^^ + : ^^^ `---- x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:22:5] 22 | --variable: var(--unit); - : ^ + : ^^^^^^ `---- - x RParen + x Ident { value: Atom('--unit' type=inline), raw: Atom('--unit' type=inline) } ,-[$DIR/tests/fixture/value/custom-property/input.css:22:5] 22 | --variable: var(--unit); - : ^ + : ^^^^^^ `---- x ComponentValue @@ -1264,19 +1222,19 @@ x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:27:5] 27 | --square-block: [1, 2, 3]; - : ^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x StyleBlock ,-[$DIR/tests/fixture/value/custom-property/input.css:27:5] 27 | --square-block: [1, 2, 3]; - : ^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x Declaration ,-[$DIR/tests/fixture/value/custom-property/input.css:27:5] 27 | --square-block: [1, 2, 3]; - : ^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x DeclarationName @@ -1294,7 +1252,13 @@ x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:27:5] 27 | --square-block: [1, 2, 3]; - : ^ + : ^^^^^^^^^ + `---- + + x SimpleBlock + ,-[$DIR/tests/fixture/value/custom-property/input.css:27:5] + 27 | --square-block: [1, 2, 3]; + : ^^^^^^^^^ `---- x LBracket @@ -1387,34 +1351,22 @@ : ^ `---- - x ComponentValue - ,-[$DIR/tests/fixture/value/custom-property/input.css:27:5] - 27 | --square-block: [1, 2, 3]; - : ^ - `---- - - x RBracket - ,-[$DIR/tests/fixture/value/custom-property/input.css:27:5] - 27 | --square-block: [1, 2, 3]; - : ^ - `---- - x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:28:5] 28 | --square-block1: []; - : ^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^ `---- x StyleBlock ,-[$DIR/tests/fixture/value/custom-property/input.css:28:5] 28 | --square-block1: []; - : ^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^ `---- x Declaration ,-[$DIR/tests/fixture/value/custom-property/input.css:28:5] 28 | --square-block1: []; - : ^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^ `---- x DeclarationName @@ -1432,43 +1384,37 @@ x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:28:5] 28 | --square-block1: []; - : ^ - `---- - - x LBracket - ,-[$DIR/tests/fixture/value/custom-property/input.css:28:5] - 28 | --square-block1: []; - : ^ + : ^^ `---- - x ComponentValue + x SimpleBlock ,-[$DIR/tests/fixture/value/custom-property/input.css:28:5] 28 | --square-block1: []; - : ^ + : ^^ `---- - x RBracket + x LBracket ,-[$DIR/tests/fixture/value/custom-property/input.css:28:5] 28 | --square-block1: []; - : ^ + : ^ `---- x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:29:5] 29 | --square-block2:[]; - : ^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^ `---- x StyleBlock ,-[$DIR/tests/fixture/value/custom-property/input.css:29:5] 29 | --square-block2:[]; - : ^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^ `---- x Declaration ,-[$DIR/tests/fixture/value/custom-property/input.css:29:5] 29 | --square-block2:[]; - : ^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^ `---- x DeclarationName @@ -1486,43 +1432,37 @@ x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:29:5] 29 | --square-block2:[]; - : ^ - `---- - - x LBracket - ,-[$DIR/tests/fixture/value/custom-property/input.css:29:5] - 29 | --square-block2:[]; - : ^ + : ^^ `---- - x ComponentValue + x SimpleBlock ,-[$DIR/tests/fixture/value/custom-property/input.css:29:5] 29 | --square-block2:[]; - : ^ + : ^^ `---- - x RBracket + x LBracket ,-[$DIR/tests/fixture/value/custom-property/input.css:29:5] 29 | --square-block2:[]; - : ^ + : ^ `---- x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:30:5] 30 | --round-block: (1, 2, 3); - : ^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^ `---- x StyleBlock ,-[$DIR/tests/fixture/value/custom-property/input.css:30:5] 30 | --round-block: (1, 2, 3); - : ^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^ `---- x Declaration ,-[$DIR/tests/fixture/value/custom-property/input.css:30:5] 30 | --round-block: (1, 2, 3); - : ^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^ `---- x DeclarationName @@ -1540,7 +1480,13 @@ x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:30:5] 30 | --round-block: (1, 2, 3); - : ^ + : ^^^^^^^^^ + `---- + + x SimpleBlock + ,-[$DIR/tests/fixture/value/custom-property/input.css:30:5] + 30 | --round-block: (1, 2, 3); + : ^^^^^^^^^ `---- x LParen @@ -1633,34 +1579,22 @@ : ^ `---- - x ComponentValue - ,-[$DIR/tests/fixture/value/custom-property/input.css:30:5] - 30 | --round-block: (1, 2, 3); - : ^ - `---- - - x RParen - ,-[$DIR/tests/fixture/value/custom-property/input.css:30:5] - 30 | --round-block: (1, 2, 3); - : ^ - `---- - x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:31:5] 31 | --round-block1: (); - : ^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^ `---- x StyleBlock ,-[$DIR/tests/fixture/value/custom-property/input.css:31:5] 31 | --round-block1: (); - : ^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^ `---- x Declaration ,-[$DIR/tests/fixture/value/custom-property/input.css:31:5] 31 | --round-block1: (); - : ^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^ `---- x DeclarationName @@ -1678,43 +1612,37 @@ x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:31:5] 31 | --round-block1: (); - : ^ - `---- - - x LParen - ,-[$DIR/tests/fixture/value/custom-property/input.css:31:5] - 31 | --round-block1: (); - : ^ + : ^^ `---- - x ComponentValue + x SimpleBlock ,-[$DIR/tests/fixture/value/custom-property/input.css:31:5] 31 | --round-block1: (); - : ^ + : ^^ `---- - x RParen + x LParen ,-[$DIR/tests/fixture/value/custom-property/input.css:31:5] 31 | --round-block1: (); - : ^ + : ^ `---- x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:32:5] 32 | --round-block2:(); - : ^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^ `---- x StyleBlock ,-[$DIR/tests/fixture/value/custom-property/input.css:32:5] 32 | --round-block2:(); - : ^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^ `---- x Declaration ,-[$DIR/tests/fixture/value/custom-property/input.css:32:5] 32 | --round-block2:(); - : ^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^ `---- x DeclarationName @@ -1732,43 +1660,37 @@ x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:32:5] 32 | --round-block2:(); - : ^ - `---- - - x LParen - ,-[$DIR/tests/fixture/value/custom-property/input.css:32:5] - 32 | --round-block2:(); - : ^ + : ^^ `---- - x ComponentValue + x SimpleBlock ,-[$DIR/tests/fixture/value/custom-property/input.css:32:5] 32 | --round-block2:(); - : ^ + : ^^ `---- - x RParen + x LParen ,-[$DIR/tests/fixture/value/custom-property/input.css:32:5] 32 | --round-block2:(); - : ^ + : ^ `---- x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:33:5] 33 | --bracket-block: {1, 2, 3}; - : ^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x StyleBlock ,-[$DIR/tests/fixture/value/custom-property/input.css:33:5] 33 | --bracket-block: {1, 2, 3}; - : ^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x Declaration ,-[$DIR/tests/fixture/value/custom-property/input.css:33:5] 33 | --bracket-block: {1, 2, 3}; - : ^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x DeclarationName @@ -1786,7 +1708,13 @@ x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:33:5] 33 | --bracket-block: {1, 2, 3}; - : ^ + : ^^^^^^^^^ + `---- + + x SimpleBlock + ,-[$DIR/tests/fixture/value/custom-property/input.css:33:5] + 33 | --bracket-block: {1, 2, 3}; + : ^^^^^^^^^ `---- x LBrace @@ -1879,34 +1807,22 @@ : ^ `---- - x ComponentValue - ,-[$DIR/tests/fixture/value/custom-property/input.css:33:5] - 33 | --bracket-block: {1, 2, 3}; - : ^ - `---- - - x RBrace - ,-[$DIR/tests/fixture/value/custom-property/input.css:33:5] - 33 | --bracket-block: {1, 2, 3}; - : ^ - `---- - x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:34:5] 34 | --bracket-block1: {}; - : ^^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^ `---- x StyleBlock ,-[$DIR/tests/fixture/value/custom-property/input.css:34:5] 34 | --bracket-block1: {}; - : ^^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^ `---- x Declaration ,-[$DIR/tests/fixture/value/custom-property/input.css:34:5] 34 | --bracket-block1: {}; - : ^^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^ `---- x DeclarationName @@ -1924,43 +1840,37 @@ x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:34:5] 34 | --bracket-block1: {}; - : ^ - `---- - - x LBrace - ,-[$DIR/tests/fixture/value/custom-property/input.css:34:5] - 34 | --bracket-block1: {}; - : ^ + : ^^ `---- - x ComponentValue + x SimpleBlock ,-[$DIR/tests/fixture/value/custom-property/input.css:34:5] 34 | --bracket-block1: {}; - : ^ + : ^^ `---- - x RBrace + x LBrace ,-[$DIR/tests/fixture/value/custom-property/input.css:34:5] 34 | --bracket-block1: {}; - : ^ + : ^ `---- x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:35:5] 35 | --bracket-block2:{}; - : ^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^ `---- x StyleBlock ,-[$DIR/tests/fixture/value/custom-property/input.css:35:5] 35 | --bracket-block2:{}; - : ^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^ `---- x Declaration ,-[$DIR/tests/fixture/value/custom-property/input.css:35:5] 35 | --bracket-block2:{}; - : ^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^ `---- x DeclarationName @@ -1978,43 +1888,37 @@ x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:35:5] 35 | --bracket-block2:{}; - : ^ + : ^^ `---- - x LBrace + x SimpleBlock ,-[$DIR/tests/fixture/value/custom-property/input.css:35:5] 35 | --bracket-block2:{}; - : ^ + : ^^ `---- - x ComponentValue - ,-[$DIR/tests/fixture/value/custom-property/input.css:35:5] - 35 | --bracket-block2:{}; - : ^ - `---- - - x RBrace + x LBrace ,-[$DIR/tests/fixture/value/custom-property/input.css:35:5] 35 | --bracket-block2:{}; - : ^ + : ^ `---- x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:38:5] 38 | --JSON: [1, "2", {"three": {"a":1}}, [4]]; - : ^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x StyleBlock ,-[$DIR/tests/fixture/value/custom-property/input.css:38:5] 38 | --JSON: [1, "2", {"three": {"a":1}}, [4]]; - : ^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x Declaration ,-[$DIR/tests/fixture/value/custom-property/input.css:38:5] 38 | --JSON: [1, "2", {"three": {"a":1}}, [4]]; - : ^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x DeclarationName @@ -2032,7 +1936,13 @@ x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:38:5] 38 | --JSON: [1, "2", {"three": {"a":1}}, [4]]; - : ^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x SimpleBlock + ,-[$DIR/tests/fixture/value/custom-property/input.css:38:5] + 38 | --JSON: [1, "2", {"three": {"a":1}}, [4]]; + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x LBracket @@ -2116,7 +2026,13 @@ x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:38:5] 38 | --JSON: [1, "2", {"three": {"a":1}}, [4]]; - : ^ + : ^^^^^^^^^^^^^^^^^^ + `---- + + x SimpleBlock + ,-[$DIR/tests/fixture/value/custom-property/input.css:38:5] + 38 | --JSON: [1, "2", {"three": {"a":1}}, [4]]; + : ^^^^^^^^^^^^^^^^^^ `---- x LBrace @@ -2164,7 +2080,13 @@ x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:38:5] 38 | --JSON: [1, "2", {"three": {"a":1}}, [4]]; - : ^ + : ^^^^^^^ + `---- + + x SimpleBlock + ,-[$DIR/tests/fixture/value/custom-property/input.css:38:5] + 38 | --JSON: [1, "2", {"three": {"a":1}}, [4]]; + : ^^^^^^^ `---- x LBrace @@ -2209,30 +2131,6 @@ : ^ `---- - x ComponentValue - ,-[$DIR/tests/fixture/value/custom-property/input.css:38:5] - 38 | --JSON: [1, "2", {"three": {"a":1}}, [4]]; - : ^ - `---- - - x RBrace - ,-[$DIR/tests/fixture/value/custom-property/input.css:38:5] - 38 | --JSON: [1, "2", {"three": {"a":1}}, [4]]; - : ^ - `---- - - x ComponentValue - ,-[$DIR/tests/fixture/value/custom-property/input.css:38:5] - 38 | --JSON: [1, "2", {"three": {"a":1}}, [4]]; - : ^ - `---- - - x RBrace - ,-[$DIR/tests/fixture/value/custom-property/input.css:38:5] - 38 | --JSON: [1, "2", {"three": {"a":1}}, [4]]; - : ^ - `---- - x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:38:5] 38 | --JSON: [1, "2", {"three": {"a":1}}, [4]]; @@ -2260,7 +2158,13 @@ x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:38:5] 38 | --JSON: [1, "2", {"three": {"a":1}}, [4]]; - : ^ + : ^^^ + `---- + + x SimpleBlock + ,-[$DIR/tests/fixture/value/custom-property/input.css:38:5] + 38 | --JSON: [1, "2", {"three": {"a":1}}, [4]]; + : ^^^ `---- x LBracket @@ -2281,46 +2185,22 @@ : ^ `---- - x ComponentValue - ,-[$DIR/tests/fixture/value/custom-property/input.css:38:5] - 38 | --JSON: [1, "2", {"three": {"a":1}}, [4]]; - : ^ - `---- - - x RBracket - ,-[$DIR/tests/fixture/value/custom-property/input.css:38:5] - 38 | --JSON: [1, "2", {"three": {"a":1}}, [4]]; - : ^ - `---- - - x ComponentValue - ,-[$DIR/tests/fixture/value/custom-property/input.css:38:5] - 38 | --JSON: [1, "2", {"three": {"a":1}}, [4]]; - : ^ - `---- - - x RBracket - ,-[$DIR/tests/fixture/value/custom-property/input.css:38:5] - 38 | --JSON: [1, "2", {"three": {"a":1}}, [4]]; - : ^ - `---- - x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:39:5] 39 | --javascript: function(rule) { console.log(rule) }; - : ^^^^^^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x StyleBlock ,-[$DIR/tests/fixture/value/custom-property/input.css:39:5] 39 | --javascript: function(rule) { console.log(rule) }; - : ^^^^^^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x Declaration ,-[$DIR/tests/fixture/value/custom-property/input.css:39:5] 39 | --javascript: function(rule) { console.log(rule) }; - : ^^^^^^^^^^^^^^^^^^^^^^^ + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x DeclarationName @@ -2338,37 +2218,31 @@ x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:39:5] 39 | --javascript: function(rule) { console.log(rule) }; - : ^^^^^^^^^ - `---- - - x Function { value: Atom('function' type=static), raw: Atom('function' type=static) } - ,-[$DIR/tests/fixture/value/custom-property/input.css:39:5] - 39 | --javascript: function(rule) { console.log(rule) }; - : ^^^^^^^^^ + : ^^^^^^^^^^^^^^ `---- - x ComponentValue + x Function ,-[$DIR/tests/fixture/value/custom-property/input.css:39:5] 39 | --javascript: function(rule) { console.log(rule) }; - : ^^^^ + : ^^^^^^^^^^^^^^ `---- - x Ident { value: Atom('rule' type=inline), raw: Atom('rule' type=inline) } + x Ident ,-[$DIR/tests/fixture/value/custom-property/input.css:39:5] 39 | --javascript: function(rule) { console.log(rule) }; - : ^^^^ + : ^^^^^^^^ `---- x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:39:5] 39 | --javascript: function(rule) { console.log(rule) }; - : ^ + : ^^^^ `---- - x RParen + x Ident { value: Atom('rule' type=inline), raw: Atom('rule' type=inline) } ,-[$DIR/tests/fixture/value/custom-property/input.css:39:5] 39 | --javascript: function(rule) { console.log(rule) }; - : ^ + : ^^^^ `---- x ComponentValue @@ -2386,7 +2260,13 @@ x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:39:5] 39 | --javascript: function(rule) { console.log(rule) }; - : ^ + : ^^^^^^^^^^^^^^^^^^^^^ + `---- + + x SimpleBlock + ,-[$DIR/tests/fixture/value/custom-property/input.css:39:5] + 39 | --javascript: function(rule) { console.log(rule) }; + : ^^^^^^^^^^^^^^^^^^^^^ `---- x LBrace @@ -2434,37 +2314,31 @@ x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:39:5] 39 | --javascript: function(rule) { console.log(rule) }; - : ^^^^ + : ^^^^^^^^^ `---- - x Function { value: Atom('log' type=inline), raw: Atom('log' type=inline) } + x Function ,-[$DIR/tests/fixture/value/custom-property/input.css:39:5] 39 | --javascript: function(rule) { console.log(rule) }; - : ^^^^ + : ^^^^^^^^^ `---- - x ComponentValue - ,-[$DIR/tests/fixture/value/custom-property/input.css:39:5] - 39 | --javascript: function(rule) { console.log(rule) }; - : ^^^^ - `---- - - x Ident { value: Atom('rule' type=inline), raw: Atom('rule' type=inline) } + x Ident ,-[$DIR/tests/fixture/value/custom-property/input.css:39:5] 39 | --javascript: function(rule) { console.log(rule) }; - : ^^^^ + : ^^^ `---- x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:39:5] 39 | --javascript: function(rule) { console.log(rule) }; - : ^ + : ^^^^ `---- - x RParen + x Ident { value: Atom('rule' type=inline), raw: Atom('rule' type=inline) } ,-[$DIR/tests/fixture/value/custom-property/input.css:39:5] 39 | --javascript: function(rule) { console.log(rule) }; - : ^ + : ^^^^ `---- x ComponentValue @@ -2479,18 +2353,6 @@ : ^ `---- - x ComponentValue - ,-[$DIR/tests/fixture/value/custom-property/input.css:39:5] - 39 | --javascript: function(rule) { console.log(rule) }; - : ^ - `---- - - x RBrace - ,-[$DIR/tests/fixture/value/custom-property/input.css:39:5] - 39 | --javascript: function(rule) { console.log(rule) }; - : ^ - `---- - x ComponentValue ,-[$DIR/tests/fixture/value/custom-property/input.css:41:5] 41 | --CDO: