feat: tumblr grammar with highlights, injections, and tests
This commit is contained in:
Generated
+264
-9
@@ -2,17 +2,272 @@
|
||||
"$schema": "https://tree-sitter.github.io/tree-sitter/assets/schemas/grammar.schema.json",
|
||||
"name": "tumblr",
|
||||
"rules": {
|
||||
"source_file": {
|
||||
"type": "STRING",
|
||||
"value": "hello"
|
||||
"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": "SYMBOL",
|
||||
"name": "_block_open_start"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "block_name"
|
||||
},
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "attributes"
|
||||
},
|
||||
{
|
||||
"type": "BLANK"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"block_close": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "_block_close_start"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "block_name"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"lang_tag": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "_lang_start"
|
||||
},
|
||||
{
|
||||
"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_open_start": {
|
||||
"type": "PATTERN",
|
||||
"value": "\\{[Bb][Ll][Oo][Cc][Kk]:"
|
||||
},
|
||||
"_block_close_start": {
|
||||
"type": "PATTERN",
|
||||
"value": "\\{\\/[Bb][Ll][Oo][Cc][Kk]:"
|
||||
},
|
||||
"_lang_start": {
|
||||
"type": "PATTERN",
|
||||
"value": "\\{[Ll][Aa][Nn][Gg]:"
|
||||
},
|
||||
"_space": {
|
||||
"type": "PATTERN",
|
||||
"value": "[ \\t]+"
|
||||
}
|
||||
},
|
||||
"extras": [
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": "\\s"
|
||||
}
|
||||
],
|
||||
"extras": [],
|
||||
"conflicts": [],
|
||||
"precedences": [],
|
||||
"externals": [],
|
||||
|
||||
Reference in New Issue
Block a user