tree-sitter-css/src/grammar.json

361 lines
7.1 KiB
JSON
Raw Normal View History

2018-09-30 22:59:56 +00:00
{
"name": "css",
"rules": {
"stylesheet": {
"type": "REPEAT",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "rule_set"
},
{
"type": "SYMBOL",
"name": "import_statement"
}
]
}
},
"import_statement": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "@import"
}
]
},
"rule_set": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "selectors"
},
{
"type": "SYMBOL",
"name": "block"
}
]
},
"selectors": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_selector"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "SYMBOL",
"name": "_selector"
}
]
}
}
]
},
"block": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "{"
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "declaration"
}
},
{
"type": "STRING",
"value": "}"
}
]
},
"_selector": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "universal_selector"
},
{
"type": "SYMBOL",
"name": "type_selector"
},
{
"type": "SYMBOL",
"name": "class_selector"
},
{
"type": "SYMBOL",
"name": "id_selector"
},
{
"type": "SYMBOL",
"name": "attribute_selector"
},
{
"type": "SYMBOL",
"name": "child_selector"
},
{
"type": "SYMBOL",
"name": "descendant_selector"
}
]
},
"universal_selector": {
"type": "STRING",
"value": "*"
},
"type_selector": {
"type": "SYMBOL",
"name": "identifier"
},
"class_selector": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "."
},
{
"type": "SYMBOL",
"name": "identifier"
}
]
},
"id_selector": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "#"
},
{
"type": "SYMBOL",
"name": "identifier"
}
]
},
"attribute_selector": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "["
},
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_selector"
},
{
"type": "IMMEDIATE_TOKEN",
"content": {
"type": "STRING",
"value": "["
}
}
]
}
]
},
{
"type": "SYMBOL",
"name": "property_name"
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "="
},
{
"type": "STRING",
"value": "~="
},
{
"type": "STRING",
"value": "^="
},
{
"type": "STRING",
"value": "|="
},
{
"type": "STRING",
"value": "*="
},
{
"type": "STRING",
"value": "$="
}
]
},
{
"type": "SYMBOL",
"name": "property_value"
}
]
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": "]"
}
]
},
"child_selector": {
"type": "PREC_LEFT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_selector"
},
{
"type": "STRING",
"value": ">"
},
{
"type": "SYMBOL",
"name": "_selector"
}
]
}
},
"descendant_selector": {
"type": "PREC_LEFT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_selector"
},
{
"type": "SYMBOL",
"name": "_selector"
}
]
}
},
"declaration": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "property_name"
},
{
"type": "STRING",
"value": ":"
},
{
"type": "SYMBOL",
"name": "property_value"
},
{
"type": "STRING",
"value": ";"
}
]
},
"property_name": {
"type": "SYMBOL",
"name": "identifier"
},
"identifier": {
"type": "PATTERN",
"value": "[a-zA-Z-_]+"
},
"property_value": {
"type": "PATTERN",
"value": "[^;()\\[\\]]+"
},
"comment": {
"type": "TOKEN",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "//"
},
{
"type": "PATTERN",
"value": ".*"
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "/*"
},
{
"type": "PATTERN",
"value": "[^*]*\\*+([^\\/*][^*]*\\*+)*"
},
{
"type": "STRING",
"value": "/"
}
]
}
]
}
}
},
"extras": [
{
"type": "PATTERN",
"value": "\\s"
},
{
"type": "SYMBOL",
"name": "comment"
}
],
"conflicts": [],
"externals": [],
"inline": []
}