tree-sitter-plpgsql/src/grammar.json

348 lines
6.9 KiB
JSON
Raw Normal View History

2021-08-21 20:15:42 +03:00
{
"name": "plpgsql",
"rules": {
"source_file": {
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "_statement"
}
},
"_statement": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "create_function_statement"
}
]
},
{
"type": "STRING",
"value": ";"
}
]
},
"create_function_statement": {
"type": "SEQ",
"members": [
{
"type": "ALIAS",
"content": {
"type": "PATTERN",
"value": "CREATE"
},
"named": false,
"value": "CREATE"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "or_replace"
},
{
"type": "BLANK"
}
]
},
{
"type": "ALIAS",
"content": {
"type": "PATTERN",
"value": "FUNCTION"
},
"named": false,
"value": "FUNCTION"
},
{
"type": "SYMBOL",
"name": "function_signature"
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "ALIAS",
"content": {
"type": "PATTERN",
"value": "RETURNS"
},
"named": false,
"value": "RETURNS"
},
{
"type": "SYMBOL",
"name": "identifier"
}
]
},
{
"type": "BLANK"
}
]
},
{
"type": "ALIAS",
"content": {
"type": "PATTERN",
"value": "AS"
},
"named": false,
"value": "AS"
},
{
"type": "SYMBOL",
"name": "block"
},
{
"type": "ALIAS",
"content": {
"type": "PATTERN",
"value": "LANGUAGE"
},
"named": false,
"value": "LANGUAGE"
},
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "function_volatility"
},
{
"type": "BLANK"
}
]
}
]
},
"function_volatility": {
"type": "CHOICE",
"members": [
{
"type": "ALIAS",
"content": {
"type": "PATTERN",
"value": "IMMUTABLE"
},
"named": false,
"value": "IMMUTABLE"
},
{
"type": "ALIAS",
"content": {
"type": "PATTERN",
"value": "STABLE"
},
"named": false,
"value": "STABLE"
},
{
"type": "ALIAS",
"content": {
"type": "PATTERN",
"value": "VOLATILE"
},
"named": false,
"value": "VOLATILE"
}
]
},
"block": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "dollar_quote"
},
{
"type": "SYMBOL",
"name": "dollar_quote"
}
]
},
"dollar_quote": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "$"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": "$"
}
]
},
"function_signature": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "SYMBOL",
"name": "function_parameters"
}
]
},
"function_parameters": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "("
},
{
"type": "CHOICE",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "function_parameter"
},
{
"type": "BLANK"
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "function_parameter"
},
{
"type": "REPEAT1",
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "SYMBOL",
"name": "function_parameter"
}
]
}
}
]
}
]
},
{
"type": "STRING",
"value": ")"
}
]
},
"function_parameter": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "name",
"content": {
"type": "SYMBOL",
"name": "identifier"
}
},
{
"type": "FIELD",
"name": "type",
"content": {
"type": "SYMBOL",
"name": "_type"
}
}
]
},
"or_replace": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "OR"
},
{
"type": "STRING",
"value": "REPLACE"
}
]
},
"_type": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_type"
},
{
"type": "STRING",
"value": "["
},
{
"type": "STRING",
"value": "]"
}
]
}
]
},
"identifier": {
"type": "PATTERN",
"value": "[a-zA-Z0-9_]+[.a-zA-Z0-9_]*"
}
},
"extras": [
{
"type": "PATTERN",
"value": "\\s"
}
],
"conflicts": [],
"precedences": [],
"externals": [],
"inline": [],
"supertypes": []
}