Start adding fields

This commit is contained in:
Max Brunsfeld 2019-12-10 13:18:29 -08:00
parent 2a3aec5635
commit de690d849a
5 changed files with 81663 additions and 79644 deletions

View File

@ -9,11 +9,18 @@ cat foo | grep -v bar
(program
(pipeline
(command (command_name (word)))
(command (command_name (word))))
(command
name: (command_name (word)))
(command
name: (command_name (word))))
(pipeline
(command (command_name (word)) (word))
(command (command_name (word)) (word) (word))))
(command
name: (command_name (word))
argument: (word))
(command
name: (command_name (word))
argument: (word)
argument: (word))))
===================================
Lists
@ -48,10 +55,12 @@ done
(program
(while_statement
(command (command_name (word)) (word))
(do_group
(command (command_name (word)) (word))
(command (command_name (word)) (word)))))
condition: (command
name: (command_name (word))
argument: (word))
body: (do_group
(command name: (command_name (word)) argument: (word))
(command name: (command_name (word)) argument: (word)))))
====================================
While statements with IO redirects
@ -65,12 +74,18 @@ done < <(cat file)
(program
(redirected_statement
(while_statement
(command (command_name (word)) (word))
(do_group
(command (command_name (word)) (simple_expansion (variable_name)))))
(file_redirect (process_substitution
(command (command_name (word)) (word))))))
body: (while_statement
condition: (command
name: (command_name (word))
argument: (word))
body: (do_group
(command
name: (command_name (word))
argument: (simple_expansion (variable_name)))))
redirect: (file_redirect
destination: (process_substitution (command
name: (command_name (word))
argument: (word))))))
====================================
For statements
@ -89,17 +104,26 @@ done
(program
(for_statement
(variable_name)
(word)
(word)
(command_substitution (command (command_name (word)) (word) (word)))
(do_group
(command (command_name (word)) (simple_expansion (variable_name)))))
variable: (variable_name)
value: (word)
value: (word)
value: (command_substitution (command
name: (command_name (word))
argument: (word)
argument: (word)))
body: (do_group
(command
name: (command_name (word))
argument: (simple_expansion (variable_name)))))
(for_statement
(variable_name)
(do_group
(command (command_name (word)) (simple_expansion (variable_name)))
(variable_assignment (variable_name) (raw_string)))))
variable: (variable_name)
body: (do_group
(command
name: (command_name (word))
argument: (simple_expansion (variable_name)))
(variable_assignment
name: (variable_name)
value: (raw_string)))))
====================================
C-style for statements

View File

@ -97,45 +97,45 @@ module.exports = grammar({
),
redirected_statement: $ => prec(-1, seq(
$._statement,
repeat1(choice(
field('body', $._statement),
field('redirect', repeat1(choice(
$.file_redirect,
$.heredoc_redirect,
$.herestring_redirect
))
)))
)),
for_statement: $ => seq(
'for',
$._simple_variable_name,
field('variable', $._simple_variable_name),
optional(seq(
'in',
repeat1($._literal)
field('value', repeat1($._literal))
)),
$._terminator,
$.do_group
field('body', $.do_group)
),
c_style_for_statement: $ => seq(
'for',
'((',
optional($._expression),
field('initializer', optional($._expression)),
$._terminator,
optional($._expression),
field('condition', optional($._expression)),
$._terminator,
optional($._expression),
field('update', optional($._expression)),
'))',
optional(';'),
choice(
field('body', choice(
$.do_group,
$.compound_statement
)
))
),
while_statement: $ => seq(
'while',
$._terminated_statement,
$.do_group
field('condition', $._terminated_statement),
field('body', $.do_group)
),
do_group: $ => seq(
@ -146,7 +146,7 @@ module.exports = grammar({
if_statement: $ => seq(
'if',
$._terminated_statement,
field('condition', $._terminated_statement),
'then',
optional($._statements2),
repeat($.elif_clause),
@ -168,7 +168,7 @@ module.exports = grammar({
case_statement: $ => seq(
'case',
$._literal,
field('value', $._literal),
optional($._terminator),
'in',
$._terminator,
@ -180,16 +180,16 @@ module.exports = grammar({
),
case_item: $ => seq(
$._literal,
repeat(seq('|', $._literal)),
field('value', $._literal),
repeat(seq('|', field('value', $._literal))),
')',
optional($._statements),
prec(1, ';;')
),
last_case_item: $ => seq(
$._literal,
repeat(seq('|', $._literal)),
field('value', $._literal),
repeat(seq('|', field('value', $._literal))),
')',
optional($._statements),
optional(prec(1, ';;'))
@ -197,19 +197,22 @@ module.exports = grammar({
function_definition: $ => seq(
choice(
seq('function', $.word, optional(seq('(', ')'))),
seq($.word, '(', ')')
seq(
'function',
field('name', $.word),
optional(seq('(', ')'))
),
$.compound_statement
seq(
field('name', $.word),
'(', ')'
)
),
field('body', $.compound_statement)
),
compound_statement: $ => seq(
'{',
repeat(seq(
$._statement,
optional(seq('\n', $.heredoc_body)),
$._terminator
)),
optional($._statements2),
'}'
),
@ -272,47 +275,47 @@ module.exports = grammar({
$.variable_assignment,
$.file_redirect
)),
$.command_name,
repeat(choice(
field('name', $.command_name),
repeat(field('argument', choice(
$._literal,
seq(
choice('=~', '=='),
choice($._literal, $.regex)
)
))
)))
)),
command_name: $ => $._literal,
variable_assignment: $ => seq(
choice(
field('name', choice(
$.variable_name,
$.subscript
),
)),
choice(
'=',
'+='
),
choice(
field('value', choice(
$._literal,
$.array,
$._empty_value
)
))
),
subscript: $ => seq(
$.variable_name,
field('name', $.variable_name),
'[',
$._literal,
field('index', $._literal),
optional($._concat),
']',
optional($._concat)
),
file_redirect: $ => prec.left(seq(
optional($.file_descriptor),
field('descriptor', optional($.file_descriptor)),
choice('<', '>', '>>', '&>', '&>>', '<&', '>&'),
$._literal
field('destination', $._literal)
)),
heredoc_redirect: $ => seq(
@ -351,20 +354,20 @@ module.exports = grammar({
binary_expression: $ => prec.left(choice(
seq(
$._expression,
choice(
field('left', $._expression),
field('operator', choice(
'=', '==', '=~', '!=',
'+', '-', '+=', '-=',
'<', '>', '<=', '>=',
'||', '&&',
$.test_operator
),
$._expression
)),
field('right', $._expression)
),
seq(
$._expression,
choice('==', '=~'),
$.regex
field('left', $._expression),
field('operator', choice('==', '=~')),
field('right', $.regex)
)
)),

163
src/grammar.json vendored
View File

@ -227,10 +227,17 @@
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "body",
"content": {
"type": "SYMBOL",
"name": "_statement"
}
},
{
"type": "FIELD",
"name": "redirect",
"content": {
"type": "REPEAT1",
"content": {
"type": "CHOICE",
@ -250,6 +257,7 @@
]
}
}
}
]
}
},
@ -261,8 +269,12 @@
"value": "for"
},
{
"type": "FIELD",
"name": "variable",
"content": {
"type": "SYMBOL",
"name": "_simple_variable_name"
}
},
{
"type": "CHOICE",
@ -275,12 +287,16 @@
"value": "in"
},
{
"type": "FIELD",
"name": "value",
"content": {
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "_literal"
}
}
}
]
},
{
@ -293,9 +309,13 @@
"name": "_terminator"
},
{
"type": "FIELD",
"name": "body",
"content": {
"type": "SYMBOL",
"name": "do_group"
}
}
]
},
"c_style_for_statement": {
@ -310,6 +330,9 @@
"value": "(("
},
{
"type": "FIELD",
"name": "initializer",
"content": {
"type": "CHOICE",
"members": [
{
@ -320,12 +343,16 @@
"type": "BLANK"
}
]
}
},
{
"type": "SYMBOL",
"name": "_terminator"
},
{
"type": "FIELD",
"name": "condition",
"content": {
"type": "CHOICE",
"members": [
{
@ -336,12 +363,16 @@
"type": "BLANK"
}
]
}
},
{
"type": "SYMBOL",
"name": "_terminator"
},
{
"type": "FIELD",
"name": "update",
"content": {
"type": "CHOICE",
"members": [
{
@ -352,6 +383,7 @@
"type": "BLANK"
}
]
}
},
{
"type": "STRING",
@ -370,6 +402,9 @@
]
},
{
"type": "FIELD",
"name": "body",
"content": {
"type": "CHOICE",
"members": [
{
@ -382,6 +417,7 @@
}
]
}
}
]
},
"while_statement": {
@ -392,13 +428,21 @@
"value": "while"
},
{
"type": "FIELD",
"name": "condition",
"content": {
"type": "SYMBOL",
"name": "_terminated_statement"
}
},
{
"type": "FIELD",
"name": "body",
"content": {
"type": "SYMBOL",
"name": "do_group"
}
}
]
},
"do_group": {
@ -434,8 +478,12 @@
"value": "if"
},
{
"type": "FIELD",
"name": "condition",
"content": {
"type": "SYMBOL",
"name": "_terminated_statement"
}
},
{
"type": "STRING",
@ -536,8 +584,12 @@
"value": "case"
},
{
"type": "FIELD",
"name": "value",
"content": {
"type": "SYMBOL",
"name": "_literal"
}
},
{
"type": "CHOICE",
@ -598,8 +650,12 @@
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "value",
"content": {
"type": "SYMBOL",
"name": "_literal"
}
},
{
"type": "REPEAT",
@ -611,9 +667,13 @@
"value": "|"
},
{
"type": "FIELD",
"name": "value",
"content": {
"type": "SYMBOL",
"name": "_literal"
}
}
]
}
},
@ -647,8 +707,12 @@
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "value",
"content": {
"type": "SYMBOL",
"name": "_literal"
}
},
{
"type": "REPEAT",
@ -660,9 +724,13 @@
"value": "|"
},
{
"type": "FIELD",
"name": "value",
"content": {
"type": "SYMBOL",
"name": "_literal"
}
}
]
}
},
@ -714,8 +782,12 @@
"value": "function"
},
{
"type": "FIELD",
"name": "name",
"content": {
"type": "SYMBOL",
"name": "word"
}
},
{
"type": "CHOICE",
@ -744,8 +816,12 @@
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "name",
"content": {
"type": "SYMBOL",
"name": "word"
}
},
{
"type": "STRING",
@ -760,9 +836,13 @@
]
},
{
"type": "FIELD",
"name": "body",
"content": {
"type": "SYMBOL",
"name": "compound_statement"
}
}
]
},
"compound_statement": {
@ -772,43 +852,18 @@
"type": "STRING",
"value": "{"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_statement"
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "\n"
},
{
"type": "SYMBOL",
"name": "heredoc_body"
}
]
"name": "_statements2"
},
{
"type": "BLANK"
}
]
},
{
"type": "SYMBOL",
"name": "_terminator"
}
]
}
},
{
"type": "STRING",
"value": "}"
@ -1094,11 +1149,18 @@
}
},
{
"type": "FIELD",
"name": "name",
"content": {
"type": "SYMBOL",
"name": "command_name"
}
},
{
"type": "REPEAT",
"content": {
"type": "FIELD",
"name": "argument",
"content": {
"type": "CHOICE",
"members": [
@ -1140,6 +1202,7 @@
]
}
}
}
]
}
},
@ -1151,6 +1214,9 @@
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "name",
"content": {
"type": "CHOICE",
"members": [
{
@ -1162,6 +1228,7 @@
"name": "subscript"
}
]
}
},
{
"type": "CHOICE",
@ -1177,6 +1244,9 @@
]
},
{
"type": "FIELD",
"name": "value",
"content": {
"type": "CHOICE",
"members": [
{
@ -1193,22 +1263,31 @@
}
]
}
}
]
},
"subscript": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "name",
"content": {
"type": "SYMBOL",
"name": "variable_name"
}
},
{
"type": "STRING",
"value": "["
},
{
"type": "FIELD",
"name": "index",
"content": {
"type": "SYMBOL",
"name": "_literal"
}
},
{
"type": "CHOICE",
@ -1247,6 +1326,9 @@
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "descriptor",
"content": {
"type": "CHOICE",
"members": [
{
@ -1257,6 +1339,7 @@
"type": "BLANK"
}
]
}
},
{
"type": "CHOICE",
@ -1292,9 +1375,13 @@
]
},
{
"type": "FIELD",
"name": "destination",
"content": {
"type": "SYMBOL",
"name": "_literal"
}
}
]
}
},
@ -1414,10 +1501,17 @@
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "left",
"content": {
"type": "SYMBOL",
"name": "_expression"
}
},
{
"type": "FIELD",
"name": "operator",
"content": {
"type": "CHOICE",
"members": [
{
@ -1481,21 +1575,33 @@
"name": "test_operator"
}
]
}
},
{
"type": "FIELD",
"name": "right",
"content": {
"type": "SYMBOL",
"name": "_expression"
}
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "left",
"content": {
"type": "SYMBOL",
"name": "_expression"
}
},
{
"type": "FIELD",
"name": "operator",
"content": {
"type": "CHOICE",
"members": [
{
@ -1507,11 +1613,16 @@
"value": "=~"
}
]
}
},
{
"type": "FIELD",
"name": "right",
"content": {
"type": "SYMBOL",
"name": "regex"
}
}
]
}
]

717
src/node-types.json vendored
View File

@ -53,9 +53,137 @@
{
"type": "binary_expression",
"named": true,
"fields": {},
"children": {
"multiple": true,
"fields": {
"left": {
"multiple": false,
"required": true,
"types": [
{
"type": "ansii_c_string",
"named": true
},
{
"type": "binary_expression",
"named": true
},
{
"type": "command_substitution",
"named": true
},
{
"type": "concatenation",
"named": true
},
{
"type": "expansion",
"named": true
},
{
"type": "parenthesized_expression",
"named": true
},
{
"type": "postfix_expression",
"named": true
},
{
"type": "process_substitution",
"named": true
},
{
"type": "raw_string",
"named": true
},
{
"type": "simple_expansion",
"named": true
},
{
"type": "string",
"named": true
},
{
"type": "string_expansion",
"named": true
},
{
"type": "unary_expression",
"named": true
},
{
"type": "word",
"named": true
}
]
},
"operator": {
"multiple": false,
"required": true,
"types": [
{
"type": "!=",
"named": false
},
{
"type": "&&",
"named": false
},
{
"type": "+",
"named": false
},
{
"type": "+=",
"named": false
},
{
"type": "-",
"named": false
},
{
"type": "-=",
"named": false
},
{
"type": "<",
"named": false
},
{
"type": "<=",
"named": false
},
{
"type": "=",
"named": false
},
{
"type": "==",
"named": false
},
{
"type": "=~",
"named": false
},
{
"type": ">",
"named": false
},
{
"type": ">=",
"named": false
},
{
"type": "test_operator",
"named": true
},
{
"type": "||",
"named": false
}
]
},
"right": {
"multiple": false,
"required": true,
"types": [
{
@ -110,10 +238,6 @@
"type": "string_expansion",
"named": true
},
{
"type": "test_operator",
"named": true
},
{
"type": "unary_expression",
"named": true
@ -124,14 +248,29 @@
}
]
}
}
},
{
"type": "c_style_for_statement",
"named": true,
"fields": {},
"children": {
"multiple": true,
"fields": {
"body": {
"multiple": false,
"required": true,
"types": [
{
"type": "compound_statement",
"named": true
},
{
"type": "do_group",
"named": true
}
]
},
"condition": {
"multiple": false,
"required": false,
"types": [
{
"type": "ansii_c_string",
@ -146,7 +285,65 @@
"named": true
},
{
"type": "compound_statement",
"type": "concatenation",
"named": true
},
{
"type": "expansion",
"named": true
},
{
"type": "parenthesized_expression",
"named": true
},
{
"type": "postfix_expression",
"named": true
},
{
"type": "process_substitution",
"named": true
},
{
"type": "raw_string",
"named": true
},
{
"type": "simple_expansion",
"named": true
},
{
"type": "string",
"named": true
},
{
"type": "string_expansion",
"named": true
},
{
"type": "unary_expression",
"named": true
},
{
"type": "word",
"named": true
}
]
},
"initializer": {
"multiple": false,
"required": false,
"types": [
{
"type": "ansii_c_string",
"named": true
},
{
"type": "binary_expression",
"named": true
},
{
"type": "command_substitution",
"named": true
},
{
@ -154,7 +351,65 @@
"named": true
},
{
"type": "do_group",
"type": "expansion",
"named": true
},
{
"type": "parenthesized_expression",
"named": true
},
{
"type": "postfix_expression",
"named": true
},
{
"type": "process_substitution",
"named": true
},
{
"type": "raw_string",
"named": true
},
{
"type": "simple_expansion",
"named": true
},
{
"type": "string",
"named": true
},
{
"type": "string_expansion",
"named": true
},
{
"type": "unary_expression",
"named": true
},
{
"type": "word",
"named": true
}
]
},
"update": {
"multiple": false,
"required": false,
"types": [
{
"type": "ansii_c_string",
"named": true
},
{
"type": "binary_expression",
"named": true
},
{
"type": "command_substitution",
"named": true
},
{
"type": "concatenation",
"named": true
},
{
@ -199,12 +454,13 @@
}
]
}
}
},
{
"type": "case_item",
"named": true,
"fields": {},
"children": {
"fields": {
"value": {
"multiple": true,
"required": true,
"types": [
@ -212,6 +468,49 @@
"type": "ansii_c_string",
"named": true
},
{
"type": "command_substitution",
"named": true
},
{
"type": "concatenation",
"named": true
},
{
"type": "expansion",
"named": true
},
{
"type": "process_substitution",
"named": true
},
{
"type": "raw_string",
"named": true
},
{
"type": "simple_expansion",
"named": true
},
{
"type": "string",
"named": true
},
{
"type": "string_expansion",
"named": true
},
{
"type": "word",
"named": true
}
]
}
},
"children": {
"multiple": true,
"required": false,
"types": [
{
"type": "c_style_for_statement",
"named": true
@ -224,26 +523,14 @@
"type": "command",
"named": true
},
{
"type": "command_substitution",
"named": true
},
{
"type": "compound_statement",
"named": true
},
{
"type": "concatenation",
"named": true
},
{
"type": "declaration_command",
"named": true
},
{
"type": "expansion",
"named": true
},
{
"type": "for_statement",
"named": true
@ -272,30 +559,10 @@
"type": "pipeline",
"named": true
},
{
"type": "process_substitution",
"named": true
},
{
"type": "raw_string",
"named": true
},
{
"type": "redirected_statement",
"named": true
},
{
"type": "simple_expansion",
"named": true
},
{
"type": "string",
"named": true
},
{
"type": "string_expansion",
"named": true
},
{
"type": "subshell",
"named": true
@ -315,10 +582,6 @@
{
"type": "while_statement",
"named": true
},
{
"type": "word",
"named": true
}
]
}
@ -326,19 +589,15 @@
{
"type": "case_statement",
"named": true,
"fields": {},
"children": {
"multiple": true,
"fields": {
"value": {
"multiple": false,
"required": true,
"types": [
{
"type": "ansii_c_string",
"named": true
},
{
"type": "case_item",
"named": true
},
{
"type": "command_substitution",
"named": true
@ -378,20 +637,35 @@
]
}
},
"children": {
"multiple": true,
"required": false,
"types": [
{
"type": "case_item",
"named": true
}
]
}
},
{
"type": "command",
"named": true,
"fields": {},
"children": {
"fields": {
"argument": {
"multiple": true,
"required": true,
"required": false,
"types": [
{
"type": "ansii_c_string",
"named": true
"type": "==",
"named": false
},
{
"type": "command_name",
"type": "=~",
"named": false
},
{
"type": "ansii_c_string",
"named": true
},
{
@ -406,10 +680,6 @@
"type": "expansion",
"named": true
},
{
"type": "file_redirect",
"named": true
},
{
"type": "process_substitution",
"named": true
@ -435,11 +705,32 @@
"named": true
},
{
"type": "variable_assignment",
"type": "word",
"named": true
}
]
},
"name": {
"multiple": false,
"required": true,
"types": [
{
"type": "command_name",
"named": true
}
]
}
},
"children": {
"multiple": true,
"required": false,
"types": [
{
"type": "file_redirect",
"named": true
},
{
"type": "word",
"type": "variable_assignment",
"named": true
}
]
@ -1091,9 +1382,19 @@
{
"type": "file_redirect",
"named": true,
"fields": {},
"children": {
"multiple": true,
"fields": {
"descriptor": {
"multiple": false,
"required": false,
"types": [
{
"type": "file_descriptor",
"named": true
}
]
},
"destination": {
"multiple": false,
"required": true,
"types": [
{
@ -1112,10 +1413,6 @@
"type": "expansion",
"named": true
},
{
"type": "file_descriptor",
"named": true
},
{
"type": "process_substitution",
"named": true
@ -1142,14 +1439,25 @@
}
]
}
}
},
{
"type": "for_statement",
"named": true,
"fields": {},
"children": {
"multiple": true,
"fields": {
"body": {
"multiple": false,
"required": true,
"types": [
{
"type": "do_group",
"named": true
}
]
},
"value": {
"multiple": false,
"required": false,
"types": [
{
"type": "ansii_c_string",
@ -1163,10 +1471,6 @@
"type": "concatenation",
"named": true
},
{
"type": "do_group",
"named": true
},
{
"type": "expansion",
"named": true
@ -1191,35 +1495,49 @@
"type": "string_expansion",
"named": true
},
{
"type": "variable_name",
"named": true
},
{
"type": "word",
"named": true
}
]
},
"variable": {
"multiple": false,
"required": true,
"types": [
{
"type": "variable_name",
"named": true
}
]
}
}
},
{
"type": "function_definition",
"named": true,
"fields": {},
"children": {
"multiple": true,
"fields": {
"body": {
"multiple": false,
"required": true,
"types": [
{
"type": "compound_statement",
"named": true
}
]
},
"name": {
"multiple": false,
"required": true,
"types": [
{
"type": "word",
"named": true
}
]
}
}
},
{
"type": "heredoc_body",
@ -1313,10 +1631,101 @@
{
"type": "if_statement",
"named": true,
"fields": {},
"fields": {
"condition": {
"multiple": false,
"required": true,
"types": [
{
"type": "\n",
"named": false
},
{
"type": "&",
"named": false
},
{
"type": ";",
"named": false
},
{
"type": ";;",
"named": false
},
{
"type": "c_style_for_statement",
"named": true
},
{
"type": "case_statement",
"named": true
},
{
"type": "command",
"named": true
},
{
"type": "compound_statement",
"named": true
},
{
"type": "declaration_command",
"named": true
},
{
"type": "for_statement",
"named": true
},
{
"type": "function_definition",
"named": true
},
{
"type": "if_statement",
"named": true
},
{
"type": "list",
"named": true
},
{
"type": "negated_command",
"named": true
},
{
"type": "pipeline",
"named": true
},
{
"type": "redirected_statement",
"named": true
},
{
"type": "subshell",
"named": true
},
{
"type": "test_command",
"named": true
},
{
"type": "unset_command",
"named": true
},
{
"type": "variable_assignment",
"named": true
},
{
"type": "while_statement",
"named": true
}
]
}
},
"children": {
"multiple": true,
"required": true,
"required": false,
"types": [
{
"type": "c_style_for_statement",
@ -1885,9 +2294,9 @@
{
"type": "redirected_statement",
"named": true,
"fields": {},
"children": {
"multiple": true,
"fields": {
"body": {
"multiple": false,
"required": true,
"types": [
{
@ -1910,10 +2319,6 @@
"type": "declaration_command",
"named": true
},
{
"type": "file_redirect",
"named": true
},
{
"type": "for_statement",
"named": true
@ -1922,14 +2327,6 @@
"type": "function_definition",
"named": true
},
{
"type": "heredoc_redirect",
"named": true
},
{
"type": "herestring_redirect",
"named": true
},
{
"type": "if_statement",
"named": true
@ -1971,6 +2368,25 @@
"named": true
}
]
},
"redirect": {
"multiple": false,
"required": true,
"types": [
{
"type": "file_redirect",
"named": true
},
{
"type": "heredoc_redirect",
"named": true
},
{
"type": "herestring_redirect",
"named": true
}
]
}
}
},
{
@ -2037,9 +2453,9 @@
{
"type": "subscript",
"named": true,
"fields": {},
"children": {
"multiple": true,
"fields": {
"index": {
"multiple": false,
"required": true,
"types": [
{
@ -2078,15 +2494,22 @@
"type": "string_expansion",
"named": true
},
{
"type": "variable_name",
"named": true
},
{
"type": "word",
"named": true
}
]
},
"name": {
"multiple": false,
"required": true,
"types": [
{
"type": "variable_name",
"named": true
}
]
}
}
},
{
@ -2368,9 +2791,23 @@
{
"type": "variable_assignment",
"named": true,
"fields": {},
"children": {
"multiple": true,
"fields": {
"name": {
"multiple": false,
"required": true,
"types": [
{
"type": "subscript",
"named": true
},
{
"type": "variable_name",
"named": true
}
]
},
"value": {
"multiple": false,
"required": true,
"types": [
{
@ -2413,29 +2850,48 @@
"type": "string_expansion",
"named": true
},
{
"type": "subscript",
"named": true
},
{
"type": "variable_name",
"named": true
},
{
"type": "word",
"named": true
}
]
}
}
},
{
"type": "while_statement",
"named": true,
"fields": {},
"children": {
"multiple": true,
"fields": {
"body": {
"multiple": false,
"required": true,
"types": [
{
"type": "do_group",
"named": true
}
]
},
"condition": {
"multiple": false,
"required": true,
"types": [
{
"type": "\n",
"named": false
},
{
"type": "&",
"named": false
},
{
"type": ";",
"named": false
},
{
"type": ";;",
"named": false
},
{
"type": "c_style_for_statement",
"named": true
@ -2456,10 +2912,6 @@
"type": "declaration_command",
"named": true
},
{
"type": "do_group",
"named": true
},
{
"type": "for_statement",
"named": true
@ -2510,6 +2962,7 @@
}
]
}
}
},
{
"type": "\n",

158672
src/parser.c vendored

File diff suppressed because it is too large Load Diff