1
0
dust/tree-sitter-dust/src/grammar.json

1197 lines
23 KiB
JSON
Raw Normal View History

{
"name": "dust",
"word": "identifier",
"rules": {
"root": {
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "item"
}
},
"item": {
"type": "PREC_LEFT",
"value": 0,
"content": {
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "statement"
}
}
},
"statement": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "comment"
},
{
"type": "SYMBOL",
"name": "assignment"
},
{
"type": "SYMBOL",
"name": "expression"
},
{
"type": "SYMBOL",
"name": "if_else"
},
{
"type": "SYMBOL",
"name": "insert"
},
{
"type": "SYMBOL",
"name": "select"
},
{
"type": "SYMBOL",
"name": "while"
},
{
"type": "SYMBOL",
"name": "async"
},
{
"type": "SYMBOL",
"name": "for"
},
{
"type": "SYMBOL",
"name": "transform"
},
{
"type": "SYMBOL",
"name": "filter"
2023-10-18 22:18:41 +00:00
},
{
"type": "SYMBOL",
"name": "find"
2023-10-19 01:50:45 +00:00
},
{
"type": "SYMBOL",
"name": "remove"
}
]
},
"comment": {
"type": "SEQ",
"members": [
{
"type": "PATTERN",
"value": "[#]+.*"
}
]
},
"expression": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_expression_kind"
},
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "("
},
{
"type": "SYMBOL",
"name": "_expression_kind"
},
{
"type": "STRING",
"value": ")"
}
]
}
]
},
"_expression_kind": {
"type": "PREC_RIGHT",
"value": 0,
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "value"
},
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "SYMBOL",
"name": "function_call"
},
2023-10-21 17:19:01 +00:00
{
"type": "SYMBOL",
"name": "tool"
},
{
"type": "SYMBOL",
"name": "math"
},
{
"type": "SYMBOL",
"name": "logic"
}
]
}
},
"identifier": {
"type": "PATTERN",
"value": "[a-z|_|.]+[0-9]?"
},
"value": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "integer"
},
{
"type": "SYMBOL",
"name": "float"
},
{
"type": "SYMBOL",
"name": "string"
},
{
"type": "SYMBOL",
"name": "boolean"
},
{
"type": "SYMBOL",
"name": "list"
},
{
"type": "SYMBOL",
"name": "function"
},
{
"type": "SYMBOL",
"name": "table"
},
{
"type": "SYMBOL",
"name": "map"
}
]
},
"integer": {
"type": "PATTERN",
"value": "[-]?[0-9]+"
},
"float": {
"type": "PATTERN",
"value": "[-]?[0-9]+[.]{1}[0-9]*"
},
"string": {
"type": "PATTERN",
"value": "(\"[^\"]*?\")|('[^']*?')|(`[^`]*?`)"
},
"boolean": {
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "true"
},
{
"type": "STRING",
"value": "false"
}
]
},
"list": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "["
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "expression"
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "BLANK"
}
]
}
]
}
},
{
"type": "STRING",
"value": "]"
}
]
},
"function": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "function"
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "<"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "BLANK"
}
]
}
]
}
},
{
"type": "STRING",
"value": ">"
}
]
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": "{"
},
{
"type": "SYMBOL",
"name": "item"
},
{
"type": "STRING",
"value": "}"
}
]
},
"table": {
2023-10-18 23:26:49 +00:00
"type": "PREC_RIGHT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "table"
},
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "<"
},
{
"type": "REPEAT1",
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "BLANK"
}
]
}
]
}
},
{
"type": "STRING",
"value": ">"
}
2023-10-18 23:26:49 +00:00
]
},
{
"type": "SYMBOL",
"name": "expression"
}
2023-10-18 23:26:49 +00:00
]
}
},
"map": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "{"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "STRING",
"value": "="
},
{
"type": "SYMBOL",
"name": "expression"
}
]
}
},
{
"type": "STRING",
"value": "}"
}
]
},
"math": {
"type": "PREC_LEFT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "expression"
},
{
"type": "SYMBOL",
"name": "math_operator"
},
{
"type": "SYMBOL",
"name": "expression"
}
]
}
},
"math_operator": {
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "+"
},
{
"type": "STRING",
"value": "-"
},
{
"type": "STRING",
"value": "*"
},
{
"type": "STRING",
"value": "/"
},
{
"type": "STRING",
"value": "%"
}
]
},
"logic": {
"type": "PREC_RIGHT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "expression"
},
{
"type": "SYMBOL",
"name": "logic_operator"
},
{
"type": "SYMBOL",
"name": "expression"
}
]
}
},
"logic_operator": {
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "=="
},
{
"type": "STRING",
"value": "!="
},
{
"type": "STRING",
"value": "&&"
},
{
"type": "STRING",
"value": "||"
},
{
"type": "STRING",
"value": ">"
},
{
"type": "STRING",
"value": "<"
},
{
"type": "STRING",
"value": ">="
},
{
"type": "STRING",
"value": "<="
}
]
},
"assignment": {
"type": "PREC_RIGHT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "SYMBOL",
"name": "assignment_operator"
},
{
"type": "SYMBOL",
"name": "statement"
}
]
}
},
"assignment_operator": {
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "="
},
{
"type": "STRING",
"value": "+="
},
{
"type": "STRING",
"value": "-="
}
]
},
"if_else": {
"type": "PREC_LEFT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "if"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "else_if"
}
]
}
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "else"
}
]
},
{
"type": "BLANK"
}
]
}
]
}
},
"if": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "if"
},
{
"type": "SYMBOL",
"name": "expression"
},
{
"type": "STRING",
"value": "{"
},
{
"type": "SYMBOL",
"name": "statement"
},
{
"type": "STRING",
"value": "}"
}
]
},
"else_if": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "else if"
},
{
"type": "SYMBOL",
"name": "expression"
},
{
"type": "STRING",
"value": "{"
},
{
"type": "SYMBOL",
"name": "statement"
},
{
"type": "STRING",
"value": "}"
}
]
},
"else": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "else"
},
{
"type": "STRING",
"value": "{"
},
{
"type": "SYMBOL",
"name": "statement"
},
{
"type": "STRING",
"value": "}"
}
]
},
"function_call": {
"type": "PREC_RIGHT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "("
},
{
2023-10-21 17:04:17 +00:00
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "expression"
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "BLANK"
}
]
}
]
}
},
{
"type": "STRING",
"value": ")"
}
]
}
},
"while": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "while"
},
{
"type": "SYMBOL",
"name": "expression"
},
{
"type": "STRING",
"value": "{"
},
{
"type": "SYMBOL",
"name": "item"
},
{
"type": "STRING",
"value": "}"
}
]
},
"for": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "for"
},
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "STRING",
"value": "in"
},
{
"type": "SYMBOL",
"name": "expression"
},
{
"type": "STRING",
"value": "{"
},
{
"type": "SYMBOL",
"name": "item"
},
{
"type": "STRING",
"value": "}"
}
]
},
"transform": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "transform"
},
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "STRING",
"value": "in"
},
{
"type": "SYMBOL",
"name": "expression"
},
{
"type": "STRING",
"value": "{"
},
{
"type": "SYMBOL",
"name": "item"
},
{
"type": "STRING",
"value": "}"
}
]
},
"filter": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "filter"
},
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "STRING",
"value": "in"
},
{
"type": "SYMBOL",
"name": "expression"
},
{
"type": "STRING",
"value": "{"
},
{
"type": "SYMBOL",
"name": "item"
},
{
"type": "STRING",
"value": "}"
}
]
},
2023-10-18 22:18:41 +00:00
"find": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "find"
},
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "STRING",
"value": "in"
},
{
"type": "SYMBOL",
"name": "expression"
},
{
"type": "STRING",
"value": "{"
},
{
"type": "SYMBOL",
"name": "item"
},
{
"type": "STRING",
"value": "}"
}
]
},
2023-10-19 01:50:45 +00:00
"remove": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "remove"
},
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "STRING",
"value": "in"
},
{
"type": "SYMBOL",
"name": "expression"
},
{
"type": "STRING",
"value": "{"
},
{
"type": "SYMBOL",
"name": "item"
},
{
"type": "STRING",
"value": "}"
}
]
},
"select": {
"type": "PREC_RIGHT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "select"
},
{
2023-10-21 17:04:17 +00:00
"type": "STRING",
"value": "<"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "BLANK"
}
]
}
]
}
},
{
"type": "STRING",
"value": ">"
},
{
"type": "STRING",
"value": "from"
},
{
"type": "SYMBOL",
2023-10-21 17:04:17 +00:00
"name": "expression"
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "STRING",
2023-10-21 17:04:17 +00:00
"value": "{"
},
{
"type": "SYMBOL",
2023-10-21 17:04:17 +00:00
"name": "item"
},
{
"type": "STRING",
"value": "}"
}
]
},
{
"type": "BLANK"
}
]
}
]
}
},
"insert": {
"type": "PREC_RIGHT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "insert"
},
{
"type": "STRING",
"value": "into"
},
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "SYMBOL",
"name": "expression"
}
]
}
},
"async": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "async"
},
{
"type": "STRING",
"value": "{"
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "statement"
}
},
{
"type": "STRING",
"value": "}"
}
]
2023-10-21 17:04:17 +00:00
},
2023-10-21 17:19:01 +00:00
"tool": {
"type": "PREC_RIGHT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "("
},
{
"type": "SYMBOL",
"name": "_tool_kind"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "expression"
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "BLANK"
}
]
}
]
}
},
{
"type": "STRING",
"value": ")"
}
]
}
},
"_tool_kind": {
"type": "CHOICE",
2023-10-21 17:04:17 +00:00
"members": [
2023-10-21 20:38:20 +00:00
{
"type": "STRING",
"value": "assert"
},
{
"type": "STRING",
"value": "assert_equal"
},
{
"type": "STRING",
"value": "help"
},
{
"type": "STRING",
"value": "length"
},
2023-10-21 17:04:17 +00:00
{
"type": "STRING",
2023-10-21 17:19:01 +00:00
"value": "output"
2023-10-21 17:04:17 +00:00
},
{
2023-10-21 17:19:01 +00:00
"type": "STRING",
"value": "output_error"
},
2023-10-22 18:27:18 +00:00
{
"type": "STRING",
"value": "type"
},
2023-10-22 20:41:37 +00:00
{
"type": "STRING",
"value": "workdir"
},
2023-10-21 17:04:17 +00:00
{
"type": "STRING",
2023-10-21 20:38:20 +00:00
"value": "append"
2023-10-21 17:04:17 +00:00
},
{
2023-10-21 17:19:01 +00:00
"type": "STRING",
2023-10-21 20:38:20 +00:00
"value": "metadata"
2023-10-21 17:19:01 +00:00
},
{
"type": "STRING",
2023-10-21 20:38:20 +00:00
"value": "move"
2023-10-21 17:19:01 +00:00
},
{
"type": "STRING",
"value": "read"
},
2023-10-21 20:38:20 +00:00
{
"type": "STRING",
"value": "remove"
},
2023-10-21 17:19:01 +00:00
{
"type": "STRING",
"value": "write"
2023-10-21 20:38:20 +00:00
},
{
"type": "STRING",
"value": "from_json"
},
{
"type": "STRING",
"value": "to_json"
},
{
"type": "STRING",
"value": "to_string"
},
{
"type": "STRING",
"value": "bash"
},
{
"type": "STRING",
"value": "fish"
},
{
"type": "STRING",
"value": "raw"
},
{
"type": "STRING",
"value": "sh"
},
{
"type": "STRING",
"value": "zsh"
2023-10-22 18:48:34 +00:00
},
{
"type": "STRING",
"value": "random"
},
{
"type": "STRING",
"value": "random_boolean"
},
{
"type": "STRING",
"value": "random_float"
},
{
"type": "STRING",
"value": "random_integer"
2023-10-22 20:32:55 +00:00
},
{
"type": "STRING",
2023-10-22 20:41:37 +00:00
"value": "columns"
2023-10-22 20:32:55 +00:00
},
{
"type": "STRING",
2023-10-22 20:41:37 +00:00
"value": "rows"
2023-10-21 17:04:17 +00:00
}
]
}
},
"extras": [
{
"type": "PATTERN",
"value": "\\s"
}
],
"conflicts": [],
"precedences": [],
"externals": [],
"inline": [],
"supertypes": []
}