swc/css/parser/tests/fixture/rome/calc/output.json
강동윤 0d63470eba
feat(css): Groundwork for css processor (#2105)
swc_css_ast:
 - Rename `Values` to `SpaceValues`.

swc_css_parser:
 - Add `parse_str`.
 - Make `ErrorKind` `#[non_exhaustive]`.
 - Fix span.

swc_css_visit:
 - Create visitors.
2021-08-20 07:48:08 +00:00

1021 lines
31 KiB
JSON

{
"type": "Stylesheet",
"span": {
"start": 0,
"end": 239,
"ctxt": 0
},
"rules": [
{
"type": "StyleRule",
"span": {
"start": 0,
"end": 238,
"ctxt": 0
},
"selectors": [
{
"type": "ComplexSelector",
"span": {
"start": 0,
"end": 6,
"ctxt": 0
},
"selectors": [
{
"type": "CompoundSelector",
"span": {
"start": 0,
"end": 6,
"ctxt": 0
},
"hasNestPrefix": false,
"combinator": null,
"typeSelector": null,
"subclassSelectors": [
{
"type": "ClassSelector",
"span": {
"start": 0,
"end": 6,
"ctxt": 0
},
"text": {
"type": "Text",
"span": {
"start": 1,
"end": 6,
"ctxt": 0
},
"value": "style"
}
}
]
}
]
}
],
"block": {
"type": "DeclBlock",
"span": {
"start": 7,
"end": 238,
"ctxt": 0
},
"properties": [
{
"type": "Property",
"span": {
"start": 10,
"end": 26,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 10,
"end": 15,
"ctxt": 0
},
"value": "width"
},
"values": [
{
"type": "FnValue",
"span": {
"start": 17,
"end": 26,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 17,
"end": 21,
"ctxt": 0
},
"value": "calc"
},
"args": [
{
"type": "UnitValue",
"span": {
"start": 22,
"end": 25,
"ctxt": 0
},
"value": {
"type": "Number",
"span": {
"start": 22,
"end": 23,
"ctxt": 0
},
"value": 2.0
},
"unit": {
"span": {
"start": 23,
"end": 25,
"ctxt": 0
},
"kind": null
}
}
]
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 29,
"end": 51,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 29,
"end": 34,
"ctxt": 0
},
"value": "width"
},
"values": [
{
"type": "FnValue",
"span": {
"start": 36,
"end": 51,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 36,
"end": 40,
"ctxt": 0
},
"value": "calc"
},
"args": [
{
"type": "BinValue",
"span": {
"start": 41,
"end": 50,
"ctxt": 0
},
"op": "+",
"left": {
"type": "UnitValue",
"span": {
"start": 41,
"end": 44,
"ctxt": 0
},
"value": {
"type": "Number",
"span": {
"start": 41,
"end": 42,
"ctxt": 0
},
"value": 2.0
},
"unit": {
"span": {
"start": 42,
"end": 44,
"ctxt": 0
},
"kind": null
}
},
"right": {
"type": "UnitValue",
"span": {
"start": 47,
"end": 50,
"ctxt": 0
},
"value": {
"type": "Number",
"span": {
"start": 47,
"end": 48,
"ctxt": 0
},
"value": 1.0
},
"unit": {
"span": {
"start": 48,
"end": 50,
"ctxt": 0
},
"kind": null
}
}
}
]
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 54,
"end": 75,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 54,
"end": 59,
"ctxt": 0
},
"value": "width"
},
"values": [
{
"type": "FnValue",
"span": {
"start": 61,
"end": 75,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 61,
"end": 65,
"ctxt": 0
},
"value": "calc"
},
"args": [
{
"type": "BinValue",
"span": {
"start": 66,
"end": 74,
"ctxt": 0
},
"op": "+",
"left": {
"type": "UnitValue",
"span": {
"start": 66,
"end": 69,
"ctxt": 0
},
"value": {
"type": "Number",
"span": {
"start": 66,
"end": 67,
"ctxt": 0
},
"value": 2.0
},
"unit": {
"span": {
"start": 67,
"end": 69,
"ctxt": 0
},
"kind": "em"
}
},
"right": {
"type": "PercentValue",
"span": {
"start": 72,
"end": 74,
"ctxt": 0
},
"value": {
"type": "Number",
"span": {
"start": 72,
"end": 73,
"ctxt": 0
},
"value": 1.0
}
}
}
]
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 78,
"end": 105,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 78,
"end": 83,
"ctxt": 0
},
"value": "width"
},
"values": [
{
"type": "FnValue",
"span": {
"start": 85,
"end": 105,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 85,
"end": 89,
"ctxt": 0
},
"value": "calc"
},
"args": [
{
"type": "BinValue",
"span": {
"start": 90,
"end": 104,
"ctxt": 0
},
"op": "*",
"left": {
"type": "BinValue",
"span": {
"start": 90,
"end": 99,
"ctxt": 0
},
"op": "*",
"left": {
"type": "UnitValue",
"span": {
"start": 90,
"end": 93,
"ctxt": 0
},
"value": {
"type": "Number",
"span": {
"start": 90,
"end": 91,
"ctxt": 0
},
"value": 2.0
},
"unit": {
"span": {
"start": 91,
"end": 93,
"ctxt": 0
},
"kind": "em"
}
},
"right": {
"type": "SpaceValues",
"span": {
"start": 96,
"end": 99,
"ctxt": 0
},
"values": [
{
"type": "PercentValue",
"span": {
"start": 96,
"end": 98,
"ctxt": 0
},
"value": {
"type": "Number",
"span": {
"start": 96,
"end": 97,
"ctxt": 0
},
"value": 2.0
}
}
]
}
},
"right": {
"type": "UnitValue",
"span": {
"start": 101,
"end": 104,
"ctxt": 0
},
"value": {
"type": "Number",
"span": {
"start": 101,
"end": 102,
"ctxt": 0
},
"value": 3.0
},
"unit": {
"span": {
"start": 102,
"end": 104,
"ctxt": 0
},
"kind": null
}
}
}
]
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 108,
"end": 132,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 108,
"end": 113,
"ctxt": 0
},
"value": "width"
},
"values": [
{
"type": "FnValue",
"span": {
"start": 115,
"end": 132,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 115,
"end": 119,
"ctxt": 0
},
"value": "calc"
},
"args": [
{
"type": "BinValue",
"span": {
"start": 120,
"end": 131,
"ctxt": 0
},
"op": "/",
"left": {
"type": "BinValue",
"span": {
"start": 120,
"end": 128,
"ctxt": 0
},
"op": "/",
"left": {
"type": "UnitValue",
"span": {
"start": 120,
"end": 123,
"ctxt": 0
},
"value": {
"type": "Number",
"span": {
"start": 120,
"end": 121,
"ctxt": 0
},
"value": 2.0
},
"unit": {
"span": {
"start": 121,
"end": 123,
"ctxt": 0
},
"kind": "em"
}
},
"right": {
"type": "SpaceValues",
"span": {
"start": 126,
"end": 128,
"ctxt": 0
},
"values": [
{
"type": "Number",
"span": {
"start": 126,
"end": 127,
"ctxt": 0
},
"value": 2.0
}
]
}
},
"right": {
"type": "Number",
"span": {
"start": 130,
"end": 131,
"ctxt": 0
},
"value": 3.0
}
}
]
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 135,
"end": 171,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 135,
"end": 140,
"ctxt": 0
},
"value": "width"
},
"values": [
{
"type": "FnValue",
"span": {
"start": 142,
"end": 171,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 142,
"end": 146,
"ctxt": 0
},
"value": "calc"
},
"args": [
{
"type": "BinValue",
"span": {
"start": 147,
"end": 170,
"ctxt": 0
},
"op": "/",
"left": {
"type": "BinValue",
"span": {
"start": 147,
"end": 161,
"ctxt": 0
},
"op": "/",
"left": {
"type": "UnitValue",
"span": {
"start": 147,
"end": 150,
"ctxt": 0
},
"value": {
"type": "Number",
"span": {
"start": 147,
"end": 148,
"ctxt": 0
},
"value": 2.0
},
"unit": {
"span": {
"start": 148,
"end": 150,
"ctxt": 0
},
"kind": "em"
}
},
"right": {
"type": "SpaceValues",
"span": {
"start": 153,
"end": 161,
"ctxt": 0
},
"values": [
{
"type": "ParenValue",
"span": {
"start": 153,
"end": 160,
"ctxt": 0
},
"value": {
"type": "BinValue",
"span": {
"start": 154,
"end": 159,
"ctxt": 0
},
"op": "-",
"left": {
"type": "Number",
"span": {
"start": 154,
"end": 155,
"ctxt": 0
},
"value": 2.0
},
"right": {
"type": "Number",
"span": {
"start": 158,
"end": 159,
"ctxt": 0
},
"value": 3.0
}
}
}
]
}
},
"right": {
"type": "ParenValue",
"span": {
"start": 163,
"end": 170,
"ctxt": 0
},
"value": {
"type": "BinValue",
"span": {
"start": 164,
"end": 169,
"ctxt": 0
},
"op": "-",
"left": {
"type": "Number",
"span": {
"start": 164,
"end": 165,
"ctxt": 0
},
"value": 2.0
},
"right": {
"type": "Number",
"span": {
"start": 168,
"end": 169,
"ctxt": 0
},
"value": 6.0
}
}
}
}
]
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 174,
"end": 198,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 174,
"end": 179,
"ctxt": 0
},
"value": "width"
},
"values": [
{
"type": "FnValue",
"span": {
"start": 181,
"end": 198,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 181,
"end": 185,
"ctxt": 0
},
"value": "calc"
},
"args": [
{
"type": "BinValue",
"span": {
"start": 186,
"end": 197,
"ctxt": 0
},
"op": "+",
"left": {
"type": "BinValue",
"span": {
"start": 186,
"end": 194,
"ctxt": 0
},
"op": "*",
"left": {
"type": "UnitValue",
"span": {
"start": 186,
"end": 189,
"ctxt": 0
},
"value": {
"type": "Number",
"span": {
"start": 186,
"end": 187,
"ctxt": 0
},
"value": 2.0
},
"unit": {
"span": {
"start": 187,
"end": 189,
"ctxt": 0
},
"kind": "em"
}
},
"right": {
"type": "SpaceValues",
"span": {
"start": 192,
"end": 194,
"ctxt": 0
},
"values": [
{
"type": "Number",
"span": {
"start": 192,
"end": 193,
"ctxt": 0
},
"value": 2.0
}
]
}
},
"right": {
"type": "Number",
"span": {
"start": 196,
"end": 197,
"ctxt": 0
},
"value": 3.0
}
}
]
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 201,
"end": 235,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 201,
"end": 206,
"ctxt": 0
},
"value": "width"
},
"values": [
{
"type": "FnValue",
"span": {
"start": 208,
"end": 235,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 208,
"end": 212,
"ctxt": 0
},
"value": "calc"
},
"args": [
{
"type": "BinValue",
"span": {
"start": 213,
"end": 234,
"ctxt": 0
},
"op": "/",
"left": {
"type": "BinValue",
"span": {
"start": 213,
"end": 231,
"ctxt": 0
},
"op": "+",
"left": {
"type": "BinValue",
"span": {
"start": 213,
"end": 225,
"ctxt": 0
},
"op": "-",
"left": {
"type": "BinValue",
"span": {
"start": 213,
"end": 221,
"ctxt": 0
},
"op": "*",
"left": {
"type": "UnitValue",
"span": {
"start": 213,
"end": 216,
"ctxt": 0
},
"value": {
"type": "Number",
"span": {
"start": 213,
"end": 214,
"ctxt": 0
},
"value": 2.0
},
"unit": {
"span": {
"start": 214,
"end": 216,
"ctxt": 0
},
"kind": "em"
}
},
"right": {
"type": "SpaceValues",
"span": {
"start": 219,
"end": 221,
"ctxt": 0
},
"values": [
{
"type": "Number",
"span": {
"start": 219,
"end": 220,
"ctxt": 0
},
"value": 2.0
}
]
}
},
"right": {
"type": "SpaceValues",
"span": {
"start": 223,
"end": 225,
"ctxt": 0
},
"values": [
{
"type": "Number",
"span": {
"start": 223,
"end": 224,
"ctxt": 0
},
"value": 3.0
}
]
}
},
"right": {
"type": "SpaceValues",
"span": {
"start": 227,
"end": 231,
"ctxt": 0
},
"values": [
{
"type": "UnitValue",
"span": {
"start": 227,
"end": 230,
"ctxt": 0
},
"value": {
"type": "Number",
"span": {
"start": 227,
"end": 228,
"ctxt": 0
},
"value": 3.0
},
"unit": {
"span": {
"start": 228,
"end": 230,
"ctxt": 0
},
"kind": "em"
}
}
]
}
},
"right": {
"type": "Number",
"span": {
"start": 233,
"end": 234,
"ctxt": 0
},
"value": 5.0
}
}
]
}
],
"important": null
}
]
}
}
]
}