Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
5754 lines (5752 sloc) 126 KB
{
"name": "ruby",
"word": "identifier",
"rules": {
"program": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_statements"
},
{
"type": "BLANK"
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "__END__"
},
{
"type": "SYMBOL",
"name": "_line_break"
},
{
"type": "SYMBOL",
"name": "uninterpreted"
}
]
},
{
"type": "BLANK"
}
]
}
]
},
"uninterpreted": {
"type": "PATTERN",
"value": "(.|\\s)*"
},
"_statements": {
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "REPEAT1",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_statement"
},
{
"type": "SYMBOL",
"name": "_terminator"
}
]
},
{
"type": "SYMBOL",
"name": "empty_statement"
}
]
}
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_statement"
},
{
"type": "BLANK"
}
]
}
]
},
{
"type": "SYMBOL",
"name": "_statement"
}
]
},
"begin_block": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "BEGIN"
},
{
"type": "STRING",
"value": "{"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_statements"
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": "}"
}
]
},
"end_block": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "END"
},
{
"type": "STRING",
"value": "{"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_statements"
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": "}"
}
]
},
"_statement": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "undef"
},
{
"type": "SYMBOL",
"name": "alias"
},
{
"type": "SYMBOL",
"name": "if_modifier"
},
{
"type": "SYMBOL",
"name": "unless_modifier"
},
{
"type": "SYMBOL",
"name": "while_modifier"
},
{
"type": "SYMBOL",
"name": "until_modifier"
},
{
"type": "SYMBOL",
"name": "rescue_modifier"
},
{
"type": "SYMBOL",
"name": "begin_block"
},
{
"type": "SYMBOL",
"name": "end_block"
},
{
"type": "SYMBOL",
"name": "_expression"
}
]
},
"method": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "def"
},
{
"type": "SYMBOL",
"name": "_method_rest"
}
]
},
"singleton_method": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "def"
},
{
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "FIELD",
"name": "object",
"content": {
"type": "SYMBOL",
"name": "_variable"
}
},
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "("
},
{
"type": "FIELD",
"name": "object",
"content": {
"type": "SYMBOL",
"name": "_arg"
}
},
{
"type": "STRING",
"value": ")"
}
]
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "."
},
{
"type": "STRING",
"value": "::"
}
]
}
]
},
{
"type": "SYMBOL",
"name": "_method_rest"
}
]
},
"_method_rest": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "name",
"content": {
"type": "SYMBOL",
"name": "_method_name"
}
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "parameters",
"content": {
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "parameters"
},
"named": true,
"value": "method_parameters"
}
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_terminator"
},
{
"type": "BLANK"
}
]
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "FIELD",
"name": "parameters",
"content": {
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "bare_parameters"
},
"named": true,
"value": "method_parameters"
}
},
{
"type": "BLANK"
}
]
},
{
"type": "SYMBOL",
"name": "_terminator"
}
]
}
]
},
{
"type": "SYMBOL",
"name": "_body_statement"
}
]
},
"parameters": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "("
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_formal_parameter"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "SYMBOL",
"name": "_formal_parameter"
}
]
}
}
]
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": ")"
}
]
},
"bare_parameters": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_simple_formal_parameter"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "SYMBOL",
"name": "_formal_parameter"
}
]
}
}
]
},
"block_parameters": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "|"
},
{
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_formal_parameter"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "SYMBOL",
"name": "_formal_parameter"
}
]
}
}
]
},
{
"type": "BLANK"
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "BLANK"
}
]
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ";"
},
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "SYMBOL",
"name": "identifier"
}
]
}
}
]
}
]
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": "|"
}
]
},
"_formal_parameter": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_simple_formal_parameter"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "parameters"
},
"named": true,
"value": "destructured_parameter"
}
]
},
"_simple_formal_parameter": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "SYMBOL",
"name": "splat_parameter"
},
{
"type": "SYMBOL",
"name": "hash_splat_parameter"
},
{
"type": "SYMBOL",
"name": "block_parameter"
},
{
"type": "SYMBOL",
"name": "keyword_parameter"
},
{
"type": "SYMBOL",
"name": "optional_parameter"
}
]
},
"splat_parameter": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "*"
},
{
"type": "FIELD",
"name": "name",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "BLANK"
}
]
}
}
]
},
"hash_splat_parameter": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "**"
},
{
"type": "FIELD",
"name": "name",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "BLANK"
}
]
}
}
]
},
"block_parameter": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "&"
},
{
"type": "FIELD",
"name": "name",
"content": {
"type": "SYMBOL",
"name": "identifier"
}
}
]
},
"keyword_parameter": {
"type": "PREC_RIGHT",
"value": 51,
"content": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "name",
"content": {
"type": "SYMBOL",
"name": "identifier"
}
},
{
"type": "IMMEDIATE_TOKEN",
"content": {
"type": "STRING",
"value": ":"
}
},
{
"type": "FIELD",
"name": "value",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_arg"
},
{
"type": "BLANK"
}
]
}
}
]
}
},
"optional_parameter": {
"type": "PREC",
"value": 51,
"content": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "name",
"content": {
"type": "SYMBOL",
"name": "identifier"
}
},
{
"type": "STRING",
"value": "="
},
{
"type": "FIELD",
"name": "value",
"content": {
"type": "SYMBOL",
"name": "_arg"
}
}
]
}
},
"class": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "class"
},
{
"type": "FIELD",
"name": "name",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "constant"
},
{
"type": "SYMBOL",
"name": "scope_resolution"
}
]
}
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "superclass"
},
{
"type": "BLANK"
}
]
},
{
"type": "SYMBOL",
"name": "_terminator"
},
{
"type": "SYMBOL",
"name": "_body_statement"
}
]
},
"superclass": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "<"
},
{
"type": "SYMBOL",
"name": "_arg"
}
]
},
"singleton_class": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "class"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_singleton_class_left_angle_left_langle"
},
"named": false,
"value": "<<"
},
{
"type": "FIELD",
"name": "value",
"content": {
"type": "SYMBOL",
"name": "_arg"
}
},
{
"type": "SYMBOL",
"name": "_terminator"
},
{
"type": "SYMBOL",
"name": "_body_statement"
}
]
},
"module": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "module"
},
{
"type": "FIELD",
"name": "name",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "constant"
},
{
"type": "SYMBOL",
"name": "scope_resolution"
}
]
}
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_terminator"
},
{
"type": "SYMBOL",
"name": "_body_statement"
}
]
},
{
"type": "STRING",
"value": "end"
}
]
}
]
},
"return_command": {
"type": "PREC_LEFT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "return"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "command_argument_list"
},
"named": true,
"value": "argument_list"
}
]
}
},
"yield_command": {
"type": "PREC_LEFT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "yield"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "command_argument_list"
},
"named": true,
"value": "argument_list"
}
]
}
},
"break_command": {
"type": "PREC_LEFT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "break"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "command_argument_list"
},
"named": true,
"value": "argument_list"
}
]
}
},
"next_command": {
"type": "PREC_LEFT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "next"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "command_argument_list"
},
"named": true,
"value": "argument_list"
}
]
}
},
"return": {
"type": "PREC_LEFT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "return"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "argument_list"
},
{
"type": "BLANK"
}
]
}
]
}
},
"yield": {
"type": "PREC_LEFT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "yield"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "argument_list"
},
{
"type": "BLANK"
}
]
}
]
}
},
"break": {
"type": "PREC_LEFT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "break"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "argument_list"
},
{
"type": "BLANK"
}
]
}
]
}
},
"next": {
"type": "PREC_LEFT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "next"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "argument_list"
},
{
"type": "BLANK"
}
]
}
]
}
},
"redo": {
"type": "PREC_LEFT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "redo"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "argument_list"
},
{
"type": "BLANK"
}
]
}
]
}
},
"retry": {
"type": "PREC_LEFT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "retry"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "argument_list"
},
{
"type": "BLANK"
}
]
}
]
}
},
"if_modifier": {
"type": "PREC",
"value": 16,
"content": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "body",
"content": {
"type": "SYMBOL",
"name": "_statement"
}
},
{
"type": "STRING",
"value": "if"
},
{
"type": "FIELD",
"name": "condition",
"content": {
"type": "SYMBOL",
"name": "_expression"
}
}
]
}
},
"unless_modifier": {
"type": "PREC",
"value": 16,
"content": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "body",
"content": {
"type": "SYMBOL",
"name": "_statement"
}
},
{
"type": "STRING",
"value": "unless"
},
{
"type": "FIELD",
"name": "condition",
"content": {
"type": "SYMBOL",
"name": "_expression"
}
}
]
}
},
"while_modifier": {
"type": "PREC",
"value": 16,
"content": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "body",
"content": {
"type": "SYMBOL",
"name": "_statement"
}
},
{
"type": "STRING",
"value": "while"
},
{
"type": "FIELD",
"name": "condition",
"content": {
"type": "SYMBOL",
"name": "_expression"
}
}
]
}
},
"until_modifier": {
"type": "PREC",
"value": 16,
"content": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "body",
"content": {
"type": "SYMBOL",
"name": "_statement"
}
},
{
"type": "STRING",
"value": "until"
},
{
"type": "FIELD",
"name": "condition",
"content": {
"type": "SYMBOL",
"name": "_expression"
}
}
]
}
},
"rescue_modifier": {
"type": "PREC",
"value": 16,
"content": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "body",
"content": {
"type": "SYMBOL",
"name": "_statement"
}
},
{
"type": "STRING",
"value": "rescue"
},
{
"type": "FIELD",
"name": "handler",
"content": {
"type": "SYMBOL",
"name": "_expression"
}
}
]
}
},
"while": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "while"
},
{
"type": "FIELD",
"name": "condition",
"content": {
"type": "SYMBOL",
"name": "_arg"
}
},
{
"type": "SYMBOL",
"name": "_do"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_statements"
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": "end"
}
]
},
"until": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "until"
},
{
"type": "FIELD",
"name": "condition",
"content": {
"type": "SYMBOL",
"name": "_arg"
}
},
{
"type": "SYMBOL",
"name": "_do"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_statements"
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": "end"
}
]
},
"for": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "for"
},
{
"type": "FIELD",
"name": "pattern",
"content": {
"type": "SYMBOL",
"name": "_mlhs"
}
},
{
"type": "FIELD",
"name": "value",
"content": {
"type": "SYMBOL",
"name": "in"
}
},
{
"type": "SYMBOL",
"name": "_do"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_statements"
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": "end"
}
]
},
"in": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "in"
},
{
"type": "SYMBOL",
"name": "_arg"
}
]
},
"_do": {
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "do"
},
{
"type": "SYMBOL",
"name": "_terminator"
}
]
},
"case": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "case"
},
{
"type": "FIELD",
"name": "value",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_arg"
},
{
"type": "BLANK"
}
]
}
},
{
"type": "SYMBOL",
"name": "_terminator"
},
{
"type": "REPEAT",
"content": {
"type": "STRING",
"value": ";"
}
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "when"
}
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "else"
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": "end"
}
]
},
"when": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "when"
},
{
"type": "FIELD",
"name": "pattern",
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "pattern"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "SYMBOL",
"name": "pattern"
}
]
}
}
]
}
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_terminator"
},
{
"type": "FIELD",
"name": "body",
"content": {
"type": "SYMBOL",
"name": "then"
}
}
]
}
]
},
"pattern": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_arg"
},
{
"type": "SYMBOL",
"name": "splat_argument"
}
]
},
"if": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "if"
},
{
"type": "FIELD",
"name": "condition",
"content": {
"type": "SYMBOL",
"name": "_statement"
}
},
{
"type": "FIELD",
"name": "consequence",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_terminator"
},
{
"type": "SYMBOL",
"name": "then"
}
]
}
},
{
"type": "FIELD",
"name": "alternative",
"content": {
"type": "CHOICE",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "else"
},
{
"type": "SYMBOL",
"name": "elsif"
}
]
},
{
"type": "BLANK"
}
]
}
},
{
"type": "STRING",
"value": "end"
}
]
},
"unless": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "unless"
},
{
"type": "FIELD",
"name": "condition",
"content": {
"type": "SYMBOL",
"name": "_statement"
}
},
{
"type": "FIELD",
"name": "consequence",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_terminator"
},
{
"type": "SYMBOL",
"name": "then"
}
]
}
},
{
"type": "FIELD",
"name": "alternative",
"content": {
"type": "CHOICE",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "else"
},
{
"type": "SYMBOL",
"name": "elsif"
}
]
},
{
"type": "BLANK"
}
]
}
},
{
"type": "STRING",
"value": "end"
}
]
},
"elsif": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "elsif"
},
{
"type": "FIELD",
"name": "condition",
"content": {
"type": "SYMBOL",
"name": "_statement"
}
},
{
"type": "FIELD",
"name": "consequence",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_terminator"
},
{
"type": "SYMBOL",
"name": "then"
}
]
}
},
{
"type": "FIELD",
"name": "alternative",
"content": {
"type": "CHOICE",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "else"
},
{
"type": "SYMBOL",
"name": "elsif"
}
]
},
{
"type": "BLANK"
}
]
}
}
]
},
"else": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "else"
},
{
"type": "FIELD",
"name": "condition",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_terminator"
},
{
"type": "BLANK"
}
]
}
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_statements"
},
{
"type": "BLANK"
}
]
}
]
},
"then": {
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_terminator"
},
{
"type": "SYMBOL",
"name": "_statements"
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_terminator"
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": "then"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_statements"
},
{
"type": "BLANK"
}
]
}
]
}
]
},
"begin": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "begin"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_terminator"
},
{
"type": "BLANK"
}
]
},
{
"type": "SYMBOL",
"name": "_body_statement"
}
]
},
"ensure": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "ensure"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_statements"
},
{
"type": "BLANK"
}
]
}
]
},
"rescue": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "rescue"
},
{
"type": "FIELD",
"name": "exceptions",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "exceptions"
},
{
"type": "BLANK"
}
]
}
},
{
"type": "FIELD",
"name": "variable",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "exception_variable"
},
{
"type": "BLANK"
}
]
}
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_terminator"
},
{
"type": "FIELD",
"name": "body",
"content": {
"type": "SYMBOL",
"name": "then"
}
}
]
}
]
},
"exceptions": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_arg"
},
{
"type": "SYMBOL",
"name": "splat_argument"
}
]
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_arg"
},
{
"type": "SYMBOL",
"name": "splat_argument"
}
]
}
]
}
}
]
},
"exception_variable": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "=>"
},
{
"type": "SYMBOL",
"name": "_lhs"
}
]
},
"_body_statement": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_statements"
},
{
"type": "BLANK"
}
]
},
{
"type": "REPEAT",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "rescue"
},
{
"type": "SYMBOL",
"name": "else"
},
{
"type": "SYMBOL",
"name": "ensure"
}
]
}
},
{
"type": "STRING",
"value": "end"
}
]
},
"_expression": {
"type": "CHOICE",
"members": [
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "command_binary"
},
"named": true,
"value": "binary"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "command_assignment"
},
"named": true,
"value": "assignment"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "command_operator_assignment"
},
"named": true,
"value": "operator_assignment"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "command_call"
},
"named": true,
"value": "method_call"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "return_command"
},
"named": true,
"value": "return"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "yield_command"
},
"named": true,
"value": "yield"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "break_command"
},
"named": true,
"value": "break"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "next_command"
},
"named": true,
"value": "next"
},
{
"type": "SYMBOL",
"name": "_arg"
}
]
},
"_arg": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_primary"
},
{
"type": "SYMBOL",
"name": "assignment"
},
{
"type": "SYMBOL",
"name": "operator_assignment"
},
{
"type": "SYMBOL",
"name": "conditional"
},
{
"type": "SYMBOL",
"name": "range"
},
{
"type": "SYMBOL",
"name": "binary"
},
{
"type": "SYMBOL",
"name": "unary"
}
]
},
"_primary": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "parenthesized_statements"
},
{
"type": "SYMBOL",
"name": "_lhs"
},
{
"type": "SYMBOL",
"name": "array"
},
{
"type": "SYMBOL",
"name": "string_array"
},
{
"type": "SYMBOL",
"name": "symbol_array"
},
{
"type": "SYMBOL",
"name": "hash"
},
{
"type": "SYMBOL",
"name": "subshell"
},
{
"type": "SYMBOL",
"name": "symbol"
},
{
"type": "SYMBOL",
"name": "integer"
},
{
"type": "SYMBOL",
"name": "float"
},
{
"type": "SYMBOL",
"name": "complex"
},
{
"type": "SYMBOL",
"name": "rational"
},
{
"type": "SYMBOL",
"name": "string"
},
{
"type": "SYMBOL",
"name": "character"
},
{
"type": "SYMBOL",
"name": "chained_string"
},
{
"type": "SYMBOL",
"name": "regex"
},
{
"type": "SYMBOL",
"name": "lambda"
},
{
"type": "SYMBOL",
"name": "method"
},
{
"type": "SYMBOL",
"name": "singleton_method"
},
{
"type": "SYMBOL",
"name": "class"
},
{
"type": "SYMBOL",
"name": "singleton_class"
},
{
"type": "SYMBOL",
"name": "module"
},
{
"type": "SYMBOL",
"name": "begin"
},
{
"type": "SYMBOL",
"name": "while"
},
{
"type": "SYMBOL",
"name": "until"
},
{
"type": "SYMBOL",
"name": "if"
},
{
"type": "SYMBOL",
"name": "unless"
},
{
"type": "SYMBOL",
"name": "for"
},
{
"type": "SYMBOL",
"name": "case"
},
{
"type": "SYMBOL",
"name": "return"
},
{
"type": "SYMBOL",
"name": "yield"
},
{
"type": "SYMBOL",
"name": "break"
},
{
"type": "SYMBOL",
"name": "next"
},
{
"type": "SYMBOL",
"name": "redo"
},
{
"type": "SYMBOL",
"name": "retry"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "parenthesized_unary"
},
"named": true,
"value": "unary"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "unary_literal"
},
"named": true,
"value": "unary"
},
{
"type": "SYMBOL",
"name": "heredoc_beginning"
}
]
},
"parenthesized_statements": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "("
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_statements"
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": ")"
}
]
},
"element_reference": {
"type": "PREC_LEFT",
"value": 1,
"content": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "object",
"content": {
"type": "SYMBOL",
"name": "_primary"
}
},
{
"type": "IMMEDIATE_TOKEN",
"content": {
"type": "STRING",
"value": "["
}
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_argument_list_with_trailing_comma"
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": "]"
}
]
}
},
"scope_resolution": {
"type": "PREC_LEFT",
"value": 1,
"content": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "::"
},
{
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "scope",
"content": {
"type": "SYMBOL",
"name": "_primary"
}
},
{
"type": "IMMEDIATE_TOKEN",
"content": {
"type": "STRING",
"value": "::"
}
}
]
}
]
},
{
"type": "FIELD",
"name": "name",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "SYMBOL",
"name": "constant"
}
]
}
}
]
}
},
"call": {
"type": "PREC_LEFT",
"value": 56,
"content": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "receiver",
"content": {
"type": "SYMBOL",
"name": "_primary"
}
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "."
},
{
"type": "STRING",
"value": "&."
}
]
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "heredoc_body"
}
},
{
"type": "FIELD",
"name": "method",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "SYMBOL",
"name": "operator"
},
{
"type": "SYMBOL",
"name": "constant"
},
{
"type": "SYMBOL",
"name": "argument_list"
}
]
}
}
]
}
},
"command_call": {
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "method",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_variable"
},
{
"type": "SYMBOL",
"name": "scope_resolution"
},
{
"type": "SYMBOL",
"name": "call"
}
]
}
},
{
"type": "FIELD",
"name": "arguments",
"content": {
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "command_argument_list"
},
"named": true,
"value": "argument_list"
}
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "method",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_variable"
},
{
"type": "SYMBOL",
"name": "scope_resolution"
},
{
"type": "SYMBOL",
"name": "call"
}
]
}
},
{
"type": "PREC",
"value": 1,
"content": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "arguments",
"content": {
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "command_argument_list"
},
"named": true,
"value": "argument_list"
}
},
{
"type": "FIELD",
"name": "block",
"content": {
"type": "SYMBOL",
"name": "block"
}
}
]
}
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "method",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_variable"
},
{
"type": "SYMBOL",
"name": "scope_resolution"
},
{
"type": "SYMBOL",
"name": "call"
}
]
}
},
{
"type": "PREC",
"value": -1,
"content": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "arguments",
"content": {
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "command_argument_list"
},
"named": true,
"value": "argument_list"
}
},
{
"type": "FIELD",
"name": "block",
"content": {
"type": "SYMBOL",
"name": "do_block"
}
}
]
}
}
]
}
]
},
"method_call": {
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "method",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_variable"
},
{
"type": "SYMBOL",
"name": "scope_resolution"
},
{
"type": "SYMBOL",
"name": "call"
}
]
}
},
{
"type": "FIELD",
"name": "arguments",
"content": {
"type": "SYMBOL",
"name": "argument_list"
}
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "method",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_variable"
},
{
"type": "SYMBOL",
"name": "scope_resolution"
},
{
"type": "SYMBOL",
"name": "call"
}
]
}
},
{
"type": "PREC",
"value": 1,
"content": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "arguments",
"content": {
"type": "SYMBOL",
"name": "argument_list"
}
},
{
"type": "FIELD",
"name": "block",
"content": {
"type": "SYMBOL",
"name": "block"
}
}
]
}
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "method",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_variable"
},
{
"type": "SYMBOL",
"name": "scope_resolution"
},
{
"type": "SYMBOL",
"name": "call"
}
]
}
},
{
"type": "PREC",
"value": -1,
"content": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "arguments",
"content": {
"type": "SYMBOL",
"name": "argument_list"
}
},
{
"type": "FIELD",
"name": "block",
"content": {
"type": "SYMBOL",
"name": "do_block"
}
}
]
}
}
]
},
{
"type": "PREC",
"value": 1,
"content": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "method",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_variable"
},
{
"type": "SYMBOL",
"name": "scope_resolution"
},
{
"type": "SYMBOL",
"name": "call"
}
]
}
},
{
"type": "FIELD",
"name": "block",
"content": {
"type": "SYMBOL",
"name": "block"
}
}
]
}
},
{
"type": "PREC",
"value": -1,
"content": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "method",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_variable"
},
{
"type": "SYMBOL",
"name": "scope_resolution"
},
{
"type": "SYMBOL",
"name": "call"
}
]
}
},
{
"type": "FIELD",
"name": "block",
"content": {
"type": "SYMBOL",
"name": "do_block"
}
}
]
}
}
]
},
"command_argument_list": {
"type": "CHOICE",
"members": [
{
"type": "PREC_RIGHT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_argument"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "heredoc_body"
},
{
"type": "BLANK"
}
]
}
]
},
{
"type": "SYMBOL",
"name": "_argument"
}
]
}
}
]
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "heredoc_body"
}
}
]
}
},
{
"type": "SYMBOL",
"name": "command_call"
}
]
},
"argument_list": {
"type": "PREC_RIGHT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "IMMEDIATE_TOKEN",
"content": {
"type": "STRING",
"value": "("
}
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_argument_list_with_trailing_comma"
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": ")"
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "heredoc_body"
}
}
]
}
},
"_argument_list_with_trailing_comma": {
"type": "PREC_RIGHT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_argument"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "heredoc_body"
},
{
"type": "BLANK"
}
]
}
]
},
{
"type": "SYMBOL",
"name": "_argument"
}
]
}
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "BLANK"
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "heredoc_body"
},
{
"type": "BLANK"
}
]
}
]
}
},
"_argument": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_arg"
},
{
"type": "SYMBOL",
"name": "splat_argument"
},
{
"type": "SYMBOL",
"name": "hash_splat_argument"
},
{
"type": "SYMBOL",
"name": "block_argument"
},
{
"type": "SYMBOL",
"name": "pair"
}
]
},
"splat_argument": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_splat_star"
},
{
"type": "SYMBOL",
"name": "_arg"
}
]
},
"hash_splat_argument": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "**"
},
{
"type": "SYMBOL",
"name": "_arg"
}
]
},
"block_argument": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_block_ampersand"
},
{
"type": "SYMBOL",
"name": "_arg"
}
]
},
"do_block": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "do"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_terminator"
},
{
"type": "BLANK"
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "block_parameters"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_terminator"
},
{
"type": "BLANK"
}
]
}
]
},
{
"type": "BLANK"
}
]
},
{
"type": "SYMBOL",
"name": "_body_statement"
}
]
},
"block": {
"type": "PREC",
"value": 1,
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "{"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "block_parameters"
},
{
"type": "BLANK"
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_statements"
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": "}"
}
]
}
},
"assignment": {
"type": "PREC_RIGHT",
"value": 15,
"content": {
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "left",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_lhs"
},
{
"type": "SYMBOL",
"name": "left_assignment_list"
}
]
}
},
{
"type": "STRING",
"value": "="
},
{
"type": "FIELD",
"name": "right",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_arg"
},
{
"type": "SYMBOL",
"name": "splat_argument"
},
{
"type": "SYMBOL",
"name": "right_assignment_list"
}
]
}
}
]
}
]
}
},
"command_assignment": {
"type": "PREC_RIGHT",
"value": 15,
"content": {
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "left",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_lhs"
},
{
"type": "SYMBOL",
"name": "left_assignment_list"
}
]
}
},
{
"type": "STRING",
"value": "="
},
{
"type": "FIELD",
"name": "right",
"content": {
"type": "SYMBOL",
"name": "_expression"
}
}
]
}
]
}
},
"operator_assignment": {
"type": "PREC_RIGHT",
"value": 15,
"content": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "left",
"content": {
"type": "SYMBOL",
"name": "_lhs"
}
},
{
"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": "&&="
},
{
"type": "STRING",
"value": "&="
},
{
"type": "STRING",
"value": "%="
},
{
"type": "STRING",
"value": ">>="
},
{
"type": "STRING",
"value": "<<="
},
{
"type": "STRING",
"value": "^="
}
]
},
{
"type": "FIELD",
"name": "right",
"content": {
"type": "SYMBOL",
"name": "_arg"
}
}
]
}
},
"command_operator_assignment": {
"type": "PREC_RIGHT",
"value": 15,
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_lhs"
},
{
"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": "&&="
},
{
"type": "STRING",
"value": "&="
},
{
"type": "STRING",
"value": "%="
},
{
"type": "STRING",
"value": ">>="
},
{
"type": "STRING",
"value": "<<="
},
{
"type": "STRING",
"value": "^="
}
]
},
{
"type": "SYMBOL",
"name": "_expression"
}
]
}
},
"conditional": {
"type