chore: something about hemar tree sitter
This commit is contained in:
311
package/hemar/parser/tree-sitter/src/grammar.json
Normal file
311
package/hemar/parser/tree-sitter/src/grammar.json
Normal file
@@ -0,0 +1,311 @@
|
||||
{
|
||||
"$schema": "https://tree-sitter.github.io/tree-sitter/assets/schemas/grammar.schema.json",
|
||||
"name": "hemar",
|
||||
"rules": {
|
||||
"source_file": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "element"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"element": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "interpolation"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "segment"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "zalupa"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "actual_bracket"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "include"
|
||||
}
|
||||
]
|
||||
},
|
||||
"interpolation": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "{["
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "path"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "]}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"segment": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "for"
|
||||
},
|
||||
{
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "element"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "done"
|
||||
}
|
||||
]
|
||||
},
|
||||
"for": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "{["
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "for"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "string"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "in"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "path"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "]}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"done": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "{["
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "done"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "]}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"actual_bracket": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "{["
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "{["
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "]}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"include": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "{["
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "include"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "path"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "]}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"path": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "."
|
||||
},
|
||||
{
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "string"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "index"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "."
|
||||
},
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "string"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "index"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"index": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "["
|
||||
},
|
||||
{
|
||||
"type": "FIELD",
|
||||
"name": "value",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "integer_index"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"integer_index": {
|
||||
"type": "TOKEN",
|
||||
"content": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": "\\d"
|
||||
},
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": "[1-9]\\d*"
|
||||
},
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": "-[1-9]"
|
||||
},
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": "-[1-9]\\d*"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"string": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "TOKEN",
|
||||
"content": {
|
||||
"type": "PREC",
|
||||
"value": -1,
|
||||
"content": {
|
||||
"type": "PATTERN",
|
||||
"value": "[^]\\[{} \\n\\t\\r.\\\\\"]+"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "TOKEN",
|
||||
"content": {
|
||||
"type": "PREC",
|
||||
"value": -1,
|
||||
"content": {
|
||||
"type": "PATTERN",
|
||||
"value": "\"([^\"]|\"\")*\""
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"zalupa": {
|
||||
"type": "TOKEN",
|
||||
"content": {
|
||||
"type": "PREC",
|
||||
"value": -1,
|
||||
"content": {
|
||||
"type": "PATTERN",
|
||||
"value": "(?:\\{[^\\[]|[^{])+"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"extras": [
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": "\\s"
|
||||
}
|
||||
],
|
||||
"conflicts": [],
|
||||
"precedences": [],
|
||||
"externals": [],
|
||||
"inline": [],
|
||||
"supertypes": [],
|
||||
"reserved": {}
|
||||
}
|
||||
Reference in New Issue
Block a user