- Refactor statement parsing with proper precedence handling - Improve block structure parsing with indent/dedent support - Enhance control flow parsing (conditionals, loops) - Add print command support - Improve function declaration parsing - Update scanner for better string and comment handling - Add comprehensive test corpus - Better handling of newlines and statement boundaries
1478 lines
30 KiB
JSON
Generated
1478 lines
30 KiB
JSON
Generated
{
|
|
"name": "stonescript",
|
|
"word": "identifier",
|
|
"rules": {
|
|
"source_file": {
|
|
"type": "REPEAT",
|
|
"content": {
|
|
"type": "SYMBOL",
|
|
"name": "_statement"
|
|
}
|
|
},
|
|
"_statement": {
|
|
"type": "PREC_RIGHT",
|
|
"value": 0,
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "comment"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "block_comment"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "variable_declaration"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "function_declaration"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "for_loop"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "return_statement"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "break_statement"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "continue_statement"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "import_statement"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "conditional"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "else_clause"
|
|
},
|
|
{
|
|
"type": "PREC_DYNAMIC",
|
|
"value": 1,
|
|
"content": {
|
|
"type": "SYMBOL",
|
|
"name": "command"
|
|
}
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "print_command"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "expression_statement"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_newline"
|
|
},
|
|
{
|
|
"type": "BLANK"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"comment": {
|
|
"type": "TOKEN",
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "//"
|
|
},
|
|
{
|
|
"type": "PATTERN",
|
|
"value": ".*"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"block_comment": {
|
|
"type": "TOKEN",
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "/*"
|
|
},
|
|
{
|
|
"type": "PATTERN",
|
|
"value": "[^*]*\\*+(?:[^/*][^*]*\\*+)*"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "/"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"variable_declaration": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "var"
|
|
},
|
|
{
|
|
"type": "FIELD",
|
|
"name": "name",
|
|
"content": {
|
|
"type": "SYMBOL",
|
|
"name": "identifier"
|
|
}
|
|
},
|
|
{
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "="
|
|
},
|
|
{
|
|
"type": "FIELD",
|
|
"name": "value",
|
|
"content": {
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "BLANK"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"function_declaration": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "func"
|
|
},
|
|
{
|
|
"type": "FIELD",
|
|
"name": "name",
|
|
"content": {
|
|
"type": "SYMBOL",
|
|
"name": "identifier"
|
|
}
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "("
|
|
},
|
|
{
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "parameter_list"
|
|
},
|
|
{
|
|
"type": "BLANK"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": ")"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "block"
|
|
}
|
|
]
|
|
},
|
|
"parameter_list": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "identifier"
|
|
},
|
|
{
|
|
"type": "REPEAT",
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": ","
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "identifier"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"for_loop": {
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "for"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "identifier"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "="
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": ".."
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "block"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "for"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "identifier"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": ":"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "block"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"import_statement": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "import"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "module_path"
|
|
}
|
|
]
|
|
},
|
|
"new_statement": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "new"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "module_path"
|
|
}
|
|
]
|
|
},
|
|
"module_path": {
|
|
"type": "PATTERN",
|
|
"value": "[a-zA-Z_][a-zA-Z0-9_\\\\/]*"
|
|
},
|
|
"return_statement": {
|
|
"type": "PREC_RIGHT",
|
|
"value": 0,
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "return"
|
|
},
|
|
{
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "BLANK"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"break_statement": {
|
|
"type": "STRING",
|
|
"value": "break"
|
|
},
|
|
"continue_statement": {
|
|
"type": "STRING",
|
|
"value": "continue"
|
|
},
|
|
"conditional": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "?"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "block"
|
|
}
|
|
]
|
|
},
|
|
"else_clause": {
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": ":?"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "block"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": ":"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "block"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"block": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_indent"
|
|
},
|
|
{
|
|
"type": "REPEAT1",
|
|
"content": {
|
|
"type": "SYMBOL",
|
|
"name": "_statement"
|
|
}
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_dedent"
|
|
}
|
|
]
|
|
},
|
|
"command": {
|
|
"type": "PREC_DYNAMIC",
|
|
"value": 1,
|
|
"content": {
|
|
"type": "PREC_RIGHT",
|
|
"value": 0,
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "identifier"
|
|
},
|
|
{
|
|
"type": "REPEAT1",
|
|
"content": {
|
|
"type": "SYMBOL",
|
|
"name": "_command_arg"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"_command_arg": {
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "identifier"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "number"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "string"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "star_level"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "enchantment_level"
|
|
}
|
|
]
|
|
},
|
|
"star_level": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "*"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "number"
|
|
}
|
|
]
|
|
},
|
|
"enchantment_level": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "+"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "number"
|
|
}
|
|
]
|
|
},
|
|
"print_command": {
|
|
"type": "PREC_RIGHT",
|
|
"value": 0,
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": ">"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": ">o"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": ">h"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": ">`"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": ">c"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": ">f"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "print_args"
|
|
},
|
|
{
|
|
"type": "BLANK"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "REPEAT",
|
|
"content": {
|
|
"type": "SYMBOL",
|
|
"name": "print_continuation"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"print_args": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "print_argument"
|
|
},
|
|
{
|
|
"type": "REPEAT",
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": ","
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "print_argument"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"print_argument": {
|
|
"type": "PREC_LEFT",
|
|
"value": 0,
|
|
"content": {
|
|
"type": "REPEAT1",
|
|
"content": {
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "interpolation"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "string"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "color_code"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "print_text"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"print_text": {
|
|
"type": "PATTERN",
|
|
"value": "[^,@\\r\\n\"]+"
|
|
},
|
|
"interpolation": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "@"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "@"
|
|
}
|
|
]
|
|
},
|
|
"print_continuation": {
|
|
"type": "PREC_RIGHT",
|
|
"value": 0,
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "^"
|
|
},
|
|
{
|
|
"type": "REPEAT",
|
|
"content": {
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "PATTERN",
|
|
"value": "[^@\\r\\n]+"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "interpolation"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"color_code": {
|
|
"type": "PATTERN",
|
|
"value": "#[a-zA-Z0-9]+"
|
|
},
|
|
"expression_statement": {
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
"_expression": {
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "identifier"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "number"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "float"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "string"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "boolean"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "null"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "array"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "member_expression"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "call_expression"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "index_expression"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "unary_expression"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "binary_expression"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "update_expression"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "assignment_expression"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "parenthesized_expression"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "new_statement"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "color_code"
|
|
}
|
|
]
|
|
},
|
|
"member_expression": {
|
|
"type": "PREC_LEFT",
|
|
"value": 15,
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "FIELD",
|
|
"name": "object",
|
|
"content": {
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
}
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "."
|
|
},
|
|
{
|
|
"type": "FIELD",
|
|
"name": "property",
|
|
"content": {
|
|
"type": "SYMBOL",
|
|
"name": "identifier"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"call_expression": {
|
|
"type": "PREC_LEFT",
|
|
"value": 14,
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "FIELD",
|
|
"name": "function",
|
|
"content": {
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
}
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "("
|
|
},
|
|
{
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "argument_list"
|
|
},
|
|
{
|
|
"type": "BLANK"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": ")"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"argument_list": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "REPEAT",
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "comma_sep"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"comma_sep": {
|
|
"type": "STRING",
|
|
"value": ","
|
|
},
|
|
"index_expression": {
|
|
"type": "PREC_LEFT",
|
|
"value": 13,
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "["
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "]"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"unary_expression": {
|
|
"type": "PREC_RIGHT",
|
|
"value": 12,
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "!"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "-"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"binary_expression": {
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "PREC_LEFT",
|
|
"value": 4,
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "|"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "PREC_LEFT",
|
|
"value": 5,
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "&"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "PREC_LEFT",
|
|
"value": 7,
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "!"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "PREC_LEFT",
|
|
"value": 7,
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "="
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "PREC_LEFT",
|
|
"value": 8,
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "<"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "PREC_LEFT",
|
|
"value": 8,
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": ">"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "PREC_LEFT",
|
|
"value": 8,
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "<="
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "PREC_LEFT",
|
|
"value": 8,
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": ">="
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "PREC_LEFT",
|
|
"value": 9,
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "+"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "PREC_LEFT",
|
|
"value": 9,
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "-"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "PREC_LEFT",
|
|
"value": 10,
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "*"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "PREC_LEFT",
|
|
"value": 10,
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "/"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "PREC_LEFT",
|
|
"value": 11,
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "%"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"update_expression": {
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "PREC_LEFT",
|
|
"value": 12,
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "++"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "--"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "PREC_RIGHT",
|
|
"value": 12,
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "++"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "--"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"assignment_expression": {
|
|
"type": "PREC_RIGHT",
|
|
"value": 2,
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "="
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "+="
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "-="
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "*="
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "/="
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"parenthesized_expression": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "("
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": ")"
|
|
}
|
|
]
|
|
},
|
|
"array": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "["
|
|
},
|
|
{
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "array_elements"
|
|
},
|
|
{
|
|
"type": "BLANK"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "]"
|
|
}
|
|
]
|
|
},
|
|
"array_elements": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
},
|
|
{
|
|
"type": "REPEAT",
|
|
"content": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": ","
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_expression"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": ","
|
|
},
|
|
{
|
|
"type": "BLANK"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"identifier": {
|
|
"type": "PATTERN",
|
|
"value": "[a-zA-Z_][a-zA-Z0-9_]*"
|
|
},
|
|
"number": {
|
|
"type": "PATTERN",
|
|
"value": "\\d+"
|
|
},
|
|
"float": {
|
|
"type": "PATTERN",
|
|
"value": "\\d+\\.\\d+"
|
|
},
|
|
"string": {
|
|
"type": "SEQ",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "\""
|
|
},
|
|
{
|
|
"type": "REPEAT",
|
|
"content": {
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "PATTERN",
|
|
"value": "[^\"\\\\]"
|
|
},
|
|
{
|
|
"type": "PATTERN",
|
|
"value": "\\\\."
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "\""
|
|
}
|
|
]
|
|
},
|
|
"boolean": {
|
|
"type": "CHOICE",
|
|
"members": [
|
|
{
|
|
"type": "STRING",
|
|
"value": "true"
|
|
},
|
|
{
|
|
"type": "STRING",
|
|
"value": "false"
|
|
}
|
|
]
|
|
},
|
|
"null": {
|
|
"type": "STRING",
|
|
"value": "null"
|
|
}
|
|
},
|
|
"extras": [
|
|
{
|
|
"type": "PATTERN",
|
|
"value": "[ \\t\\r\\f]"
|
|
},
|
|
{
|
|
"type": "PATTERN",
|
|
"value": "[\\r\\n]\\^"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "comment"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "block_comment"
|
|
}
|
|
],
|
|
"conflicts": [
|
|
[
|
|
"identifier",
|
|
"string"
|
|
],
|
|
[
|
|
"_expression"
|
|
],
|
|
[
|
|
"command"
|
|
],
|
|
[
|
|
"_statement",
|
|
"_expression"
|
|
],
|
|
[
|
|
"binary_expression",
|
|
"assignment_expression"
|
|
],
|
|
[
|
|
"command",
|
|
"_expression"
|
|
]
|
|
],
|
|
"precedences": [],
|
|
"externals": [
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_newline"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_indent"
|
|
},
|
|
{
|
|
"type": "SYMBOL",
|
|
"name": "_dedent"
|
|
}
|
|
],
|
|
"inline": [],
|
|
"supertypes": []
|
|
}
|
|
|