tree-sitter-logstash/src/grammar.json

1223 lines
24 KiB
JSON

{
"name": "logstash",
"rules": {
"source_file": {
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "plugin_section"
}
]
}
},
"double_quoted_string": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "\""
},
{
"type": "SYMBOL",
"name": "double_contents"
},
{
"type": "STRING",
"value": "\""
}
]
},
"single_quoted_string": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "'"
},
{
"type": "SYMBOL",
"name": "single_contents"
},
{
"type": "STRING",
"value": "'"
}
]
},
"code_string": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "`"
},
{
"type": "SYMBOL",
"name": "code_contents"
},
{
"type": "STRING",
"value": "`"
}
]
},
"code_contents": {
"type": "PATTERN",
"value": "[^`]*"
},
"double_contents": {
"type": "PATTERN",
"value": "[^\"]*"
},
"single_contents": {
"type": "PATTERN",
"value": "[^']*"
},
"number": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "-"
},
{
"type": "BLANK"
}
]
},
{
"type": "PATTERN",
"value": "[0-9]+"
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "."
},
{
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[0-9]"
}
}
]
},
{
"type": "BLANK"
}
]
}
]
},
"boolean": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "true"
},
{
"type": "SYMBOL",
"name": "false"
}
]
},
"true": {
"type": "STRING",
"value": "true"
},
"false": {
"type": "STRING",
"value": "false"
},
"bareword": {
"type": "PATTERN",
"value": "[A-Za-z_][A-Za-z0-9_]+"
},
"boolean_operator": {
"type": "CHOICE",
"members": [
{
"type": "PREC",
"value": 4,
"content": {
"type": "STRING",
"value": "and"
}
},
{
"type": "PREC",
"value": 4,
"content": {
"type": "STRING",
"value": "or"
}
},
{
"type": "PREC",
"value": 3,
"content": {
"type": "STRING",
"value": "xor"
}
},
{
"type": "PREC",
"value": 3,
"content": {
"type": "STRING",
"value": "nand"
}
}
]
},
"regexp_operator": {
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "=~"
},
{
"type": "STRING",
"value": "!~"
}
]
},
"regexp": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "/"
},
{
"type": "REPEAT",
"content": {
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "\\/"
},
{
"type": "PATTERN",
"value": "[^\\/]"
}
]
}
},
{
"type": "STRING",
"value": "/"
}
]
},
"string": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "double_quoted_string"
},
{
"type": "SYMBOL",
"name": "single_quoted_string"
},
{
"type": "SYMBOL",
"name": "code_string"
}
]
},
"cs": {
"type": "REPEAT1",
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "comment"
}
]
}
},
"_comment_char": {
"type": "STRING",
"value": "#"
},
"comment": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_comment_char"
},
{
"type": "SYMBOL",
"name": "_comment_contents"
}
]
},
"_comment_contents": {
"type": "PATTERN",
"value": "[^\\r\\n]*"
},
"carriage_return": {
"type": "PATTERN",
"value": "\\r"
},
"whitespace": {
"type": "PATTERN",
"value": "[ \\t]+"
},
"plugin_section": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "plugin_type"
},
{
"type": "STRING",
"value": "{"
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "branch_or_plugin"
}
},
{
"type": "STRING",
"value": "}"
}
]
},
"plugin_type": {
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "input"
},
{
"type": "STRING",
"value": "filter"
},
{
"type": "STRING",
"value": "output"
}
]
},
"plugin_name": {
"type": "PATTERN",
"value": "[A-Za-z0-9_-]+"
},
"plugin_content": {
"type": "PATTERN",
"value": "[A-Za-z0-9_-]+"
},
"plugin": {
"type": "SEQ",
"members": [
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "bareword"
},
"named": true,
"value": "plugin_name"
},
{
"type": "STRING",
"value": "{"
},
{
"type": "FIELD",
"name": "attributes",
"content": {
"type": "CHOICE",
"members": [
{
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "attribute"
}
},
{
"type": "BLANK"
}
]
}
},
{
"type": "STRING",
"value": "}"
}
]
},
"name": {
"type": "CHOICE",
"members": [
{
"type": "PATTERN",
"value": "[A-Za-z0-9_-]+"
},
{
"type": "SYMBOL",
"name": "string"
}
]
},
"arrow": {
"type": "STRING",
"value": "=>"
},
"attribute": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "name"
},
{
"type": "SYMBOL",
"name": "arrow"
},
{
"type": "SYMBOL",
"name": "value"
}
]
},
"branch": {
"type": "SEQ",
"members": [
{
"type": "PREC",
"value": 10,
"content": {
"type": "SYMBOL",
"name": "if"
}
},
{
"type": "PREC",
"value": 9,
"content": {
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "else_if"
}
}
},
{
"type": "PREC",
"value": 8,
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "else"
},
{
"type": "BLANK"
}
]
}
}
]
},
"if": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "if"
},
{
"type": "SYMBOL",
"name": "condition"
},
{
"type": "STRING",
"value": "{"
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "branch_or_plugin"
}
},
{
"type": "STRING",
"value": "}"
}
]
},
"else_if": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "elseif"
},
{
"type": "SYMBOL",
"name": "condition"
},
{
"type": "STRING",
"value": "{"
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "branch_or_plugin"
}
},
{
"type": "STRING",
"value": "}"
}
]
},
"else": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "else"
},
{
"type": "SYMBOL",
"name": "condition"
},
{
"type": "STRING",
"value": "{"
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "branch_or_plugin"
}
},
{
"type": "STRING",
"value": "}"
}
]
},
"condition": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "expression"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "boolean_operator"
},
{
"type": "SYMBOL",
"name": "expression"
}
]
}
}
]
},
"expression": {
"type": "CHOICE",
"members": [
{
"type": "PREC",
"value": 10,
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "("
},
{
"type": "SYMBOL",
"name": "condition"
},
{
"type": "STRING",
"value": ")"
}
]
}
},
{
"type": "PREC",
"value": 9,
"content": {
"type": "SYMBOL",
"name": "negative_expression"
}
},
{
"type": "PREC",
"value": 8,
"content": {
"type": "SYMBOL",
"name": "in_expression"
}
},
{
"type": "PREC",
"value": 7,
"content": {
"type": "SYMBOL",
"name": "not_in_expression"
}
},
{
"type": "PREC",
"value": 6,
"content": {
"type": "SYMBOL",
"name": "compare_expression"
}
},
{
"type": "PREC",
"value": 5,
"content": {
"type": "SYMBOL",
"name": "regexp_expression"
}
},
{
"type": "PREC",
"value": 4,
"content": {
"type": "SYMBOL",
"name": "rvalue"
}
}
]
},
"negative_expression": {
"type": "CHOICE",
"members": [
{
"type": "PREC",
"value": 1,
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "!"
},
{
"type": "STRING",
"value": "("
},
{
"type": "SYMBOL",
"name": "condition"
},
{
"type": "STRING",
"value": ")"
}
]
}
},
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "!"
},
{
"type": "SYMBOL",
"name": "selector"
}
]
}
]
},
"in_expression": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "rvalue"
},
{
"type": "SYMBOL",
"name": "in_operator"
},
{
"type": "SYMBOL",
"name": "rvalue"
}
]
},
"in_operator": {
"type": "STRING",
"value": "in"
},
"not_in_expression": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "rvalue"
},
{
"type": "SYMBOL",
"name": "not_in_operator"
},
{
"type": "SYMBOL",
"name": "rvalue"
}
]
},
"not_in_operator": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "not"
},
{
"type": "STRING",
"value": "in"
}
]
},
"regexp_expression": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "rvalue"
},
{
"type": "SYMBOL",
"name": "regexp_operator"
},
{
"type": "CHOICE",
"members": [
{
"type": "PREC",
"value": 1,
"content": {
"type": "SYMBOL",
"name": "string"
}
},
{
"type": "SYMBOL",
"name": "regexp"
}
]
}
]
},
"rvalue": {
"type": "CHOICE",
"members": [
{
"type": "PREC",
"value": 10,
"content": {
"type": "SYMBOL",
"name": "string"
}
},
{
"type": "PREC",
"value": 9,
"content": {
"type": "SYMBOL",
"name": "number"
}
},
{
"type": "PREC",
"value": 8,
"content": {
"type": "SYMBOL",
"name": "boolean"
}
},
{
"type": "PREC",
"value": 7,
"content": {
"type": "SYMBOL",
"name": "selector"
}
},
{
"type": "PREC",
"value": 6,
"content": {
"type": "SYMBOL",
"name": "array"
}
},
{
"type": "PREC",
"value": 5,
"content": {
"type": "SYMBOL",
"name": "method_call"
}
},
{
"type": "PREC",
"value": 4,
"content": {
"type": "SYMBOL",
"name": "regexp"
}
}
]
},
"value": {
"type": "CHOICE",
"members": [
{
"type": "PREC",
"value": 10,
"content": {
"type": "SYMBOL",
"name": "plugin"
}
},
{
"type": "PREC",
"value": 9,
"content": {
"type": "SYMBOL",
"name": "bareword"
}
},
{
"type": "PREC",
"value": 8,
"content": {
"type": "SYMBOL",
"name": "string"
}
},
{
"type": "PREC",
"value": 7,
"content": {
"type": "SYMBOL",
"name": "number"
}
},
{
"type": "PREC",
"value": 7,
"content": {
"type": "SYMBOL",
"name": "boolean"
}
},
{
"type": "PREC",
"value": 6,
"content": {
"type": "SYMBOL",
"name": "array"
}
},
{
"type": "PREC",
"value": 5,
"content": {
"type": "SYMBOL",
"name": "hash"
}
}
]
},
"array_value": {
"type": "CHOICE",
"members": [
{
"type": "PREC",
"value": 10,
"content": {
"type": "SYMBOL",
"name": "bareword"
}
},
{
"type": "PREC",
"value": 9,
"content": {
"type": "SYMBOL",
"name": "string"
}
},
{
"type": "PREC",
"value": 8,
"content": {
"type": "SYMBOL",
"name": "number"
}
},
{
"type": "PREC",
"value": 7,
"content": {
"type": "SYMBOL",
"name": "boolean"
}
},
{
"type": "PREC",
"value": 6,
"content": {
"type": "SYMBOL",
"name": "array"
}
},
{
"type": "PREC",
"value": 5,
"content": {
"type": "SYMBOL",
"name": "hash"
}
}
]
},
"selector": {
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "selector_element"
}
},
"selector_element": {
"type": "PATTERN",
"value": "\\[[^\\]\\[,]+\\]"
},
"array": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "["
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "value"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "SYMBOL",
"name": "value"
}
]
}
}
]
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": "]"
}
]
},
"hash": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "{"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "hashentries"
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": "}"
}
]
},
"hashentries": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "hashentry"
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "hashentry"
}
}
]
},
"hashentry": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "name",
"content": {
"type": "CHOICE",
"members": [
{
"type": "PREC",
"value": 10,
"content": {
"type": "SYMBOL",
"name": "number"
}
},
{
"type": "PREC",
"value": 9,
"content": {
"type": "SYMBOL",
"name": "bareword"
}
},
{
"type": "PREC",
"value": 7,
"content": {
"type": "SYMBOL",
"name": "string"
}
}
]
}
},
{
"type": "SYMBOL",
"name": "arrow"
},
{
"type": "SYMBOL",
"name": "value"
}
]
},
"method_call": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "method"
},
{
"type": "STRING",
"value": "("
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "rvalue"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "SYMBOL",
"name": "rvalue"
}
]
}
}
]
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": ")"
}
]
},
"method": {
"type": "SYMBOL",
"name": "bareword"
},
"compare_expression": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "rvalue"
},
{
"type": "SYMBOL",
"name": "compare_operator"
},
{
"type": "SYMBOL",
"name": "rvalue"
}
]
},
"compare_operator": {
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "=="
},
{
"type": "STRING",
"value": "!="
},
{
"type": "STRING",
"value": "<="
},
{
"type": "STRING",
"value": ">="
},
{
"type": "STRING",
"value": "<"
},
{
"type": "STRING",
"value": ">"
}
]
},
"branch_or_plugin": {
"type": "PREC",
"value": 15,
"content": {
"type": "CHOICE",
"members": [
{
"type": "PREC",
"value": 10,
"content": {
"type": "SYMBOL",
"name": "branch"
}
},
{
"type": "PREC",
"value": 9,
"content": {
"type": "SYMBOL",
"name": "plugin"
}
}
]
}
}
},
"extras": [
{
"type": "PATTERN",
"value": "\\s"
},
{
"type": "PATTERN",
"value": "\\r?\\n"
},
{
"type": "SYMBOL",
"name": "comment"
}
],
"conflicts": [],
"precedences": [],
"externals": [],
"inline": [],
"supertypes": []
}