315 lines
6.2 KiB
JSON
Generated
315 lines
6.2 KiB
JSON
Generated
{
|
|
"$schema": "https://tree-sitter.github.io/tree-sitter/assets/schemas/grammar.schema.json",
|
|
"name": "tumblr",
|
|
"rules": {
|
|
"template": {
|
|
"type": "REPEAT",
|
|
"content": {
|
|
"type": "SYMBOL",
|
|
"name": "_node"
|
|
}
|
|
},
|
|
"_node": {
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "content"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "block_open"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "block_close"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "lang_tag"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "variable"
|
|
}
|
|
]
|
|
},
|
|
"content": {
|
|
"type": "TOKEN",
|
|
"content": {
|
|
"type": "PREC",
|
|
"value": -1,
|
|
"content": {
|
|
"type": "PATTERN",
|
|
"value": "([^{]|\\{[^A-Za-z/])+"
|
|
}
|
|
}
|
|
},
|
|
"block_open": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "{"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "block_keyword"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": ":"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "block_name"
|
|
},
|
|
{
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "attributes"
|
|
},
|
|
{
|
|
"type": "BLANK"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "}"
|
|
}
|
|
]
|
|
},
|
|
"block_close": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "{"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "/"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "block_keyword"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": ":"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "block_name"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "}"
|
|
}
|
|
]
|
|
},
|
|
"lang_tag": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "{"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "lang_keyword"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": ":"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "lang_text"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "}"
|
|
}
|
|
]
|
|
},
|
|
"variable": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "{"
|
|
},
|
|
{
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "variable_name"
|
|
},
|
|
{
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "-"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "variable_modifier"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "BLANK"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "variable_prefix"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": ":"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "prefix_argument"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "}"
|
|
}
|
|
]
|
|
},
|
|
"attributes": {
|
|
"type": "REPEAT1",
|
|
"content": {
|
|
"type": "SYMBOL",
|
|
"name": "attribute"
|
|
}
|
|
},
|
|
"attribute": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_space"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "attribute_name"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "="
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "attribute_value"
|
|
}
|
|
]
|
|
},
|
|
"attribute_name": {
|
|
"type": "PATTERN",
|
|
"value": "[A-Za-z_][A-Za-z0-9_-]*"
|
|
},
|
|
"attribute_value": {
|
|
"type": "PATTERN",
|
|
"value": "\"[^\"]*\""
|
|
},
|
|
"block_name": {
|
|
"type": "PATTERN",
|
|
"value": "[A-Za-z][A-Za-z0-9_]*"
|
|
},
|
|
"variable_name": {
|
|
"type": "PATTERN",
|
|
"value": "[A-Z][A-Za-z0-9_]*"
|
|
},
|
|
"variable_modifier": {
|
|
"type": "PATTERN",
|
|
"value": "[A-Za-z0-9]+"
|
|
},
|
|
"variable_prefix": {
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "text"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "color"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "font"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "image"
|
|
}
|
|
]
|
|
},
|
|
"prefix_argument": {
|
|
"type": "PATTERN",
|
|
"value": "[A-Za-z][A-Za-z0-9 _-]*"
|
|
},
|
|
"lang_text": {
|
|
"type": "PATTERN",
|
|
"value": "[^}]+"
|
|
},
|
|
"block_keyword": {
|
|
"type": "TOKEN",
|
|
"content": {
|
|
"type": "PREC",
|
|
"value": 1,
|
|
"content": {
|
|
"type": "PATTERN",
|
|
"value": "[Bb][Ll][Oo][Cc][Kk]"
|
|
}
|
|
}
|
|
},
|
|
"lang_keyword": {
|
|
"type": "TOKEN",
|
|
"content": {
|
|
"type": "PREC",
|
|
"value": 1,
|
|
"content": {
|
|
"type": "PATTERN",
|
|
"value": "[Ll][Aa][Nn][Gg]"
|
|
}
|
|
}
|
|
},
|
|
"_space": {
|
|
"type": "PATTERN",
|
|
"value": "[ \\t]+"
|
|
}
|
|
},
|
|
"extras": [],
|
|
"conflicts": [],
|
|
"precedences": [],
|
|
"externals": [],
|
|
"inline": [],
|
|
"supertypes": [],
|
|
"reserved": {}
|
|
} |