summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jambon <martin@returntocorp.com>2021-10-10 01:14:12 -0700
committerGitHub <noreply@github.com>2021-10-10 01:14:12 -0700
commit30d369ba45971a40160de34631ceea05358c9a48 (patch)
tree31fabfc5aa63af98d3244914fef8f3a1eee5bf16
parentaf9646bad98087ebb722c018d16921e4452cc273 (diff)
parentbb8bb8ad58179f4a624c8f13f814c6cdd87328cb (diff)
Merge pull request #111 from tree-sitter/mj-select
Support for 'select' loops
-rw-r--r--corpus/statements.txt35
-rw-r--r--grammar.js2
-rw-r--r--src/grammar.json13
-rw-r--r--src/node-types.json4
-rw-r--r--src/parser.c107961
5 files changed, 54157 insertions, 53858 deletions
diff --git a/corpus/statements.txt b/corpus/statements.txt
index 4c9de3282..8ed98aa39 100644
--- a/corpus/statements.txt
+++ b/corpus/statements.txt
@@ -126,6 +126,41 @@ done
value: (raw_string)))))
====================================
+Select statements
+====================================
+
+select choice in X Y $(ls); do
+ echo $choice
+ break
+done
+
+select ARG; do
+ echo $ARG
+ ARG=''
+done
+
+---
+
+(program
+ (for_statement
+ (variable_name)
+ (word)
+ (word)
+ (command_substitution (command (command_name (word))))
+ (do_group
+ (command
+ (command_name (word))
+ (simple_expansion (variable_name)))
+ (command (command_name (word)))))
+ (for_statement
+ (variable_name)
+ (do_group
+ (command
+ (command_name (word))
+ (simple_expansion (variable_name)))
+ (variable_assignment (variable_name) (raw_string)))))
+
+====================================
C-style for statements
====================================
diff --git a/grammar.js b/grammar.js
index 458b044b5..92036a0d3 100644
--- a/grammar.js
+++ b/grammar.js
@@ -114,7 +114,7 @@ module.exports = grammar({
)),
for_statement: $ => seq(
- 'for',
+ choice('for', 'select'),
field('variable', $._simple_variable_name),
optional(seq(
'in',
diff --git a/src/grammar.json b/src/grammar.json
index 7e5c0d664..8da6fc69b 100644
--- a/src/grammar.json
+++ b/src/grammar.json
@@ -265,8 +265,17 @@
"type": "SEQ",
"members": [
{
- "type": "STRING",
- "value": "for"
+ "type": "CHOICE",
+ "members": [
+ {
+ "type": "STRING",
+ "value": "for"
+ },
+ {
+ "type": "STRING",
+ "value": "select"
+ }
+ ]
},
{
"type": "FIELD",
diff --git a/src/node-types.json b/src/node-types.json
index dea1f4902..1a967a561 100644
--- a/src/node-types.json
+++ b/src/node-types.json
@@ -1612,6 +1612,10 @@
"named": true
},
{
+ "type": "select",
+ "named": false
+ },
+ {
"type": "special_variable_name",
"named": true
},
diff --git a/src/parser.c b/src/parser.c
index a1bae6690..2c3db3ef7 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -14,11 +14,11 @@
#endif
#define LANGUAGE_VERSION 13
-#define STATE_COUNT 3478
+#define STATE_COUNT 3481
#define LARGE_STATE_COUNT 158
-#define SYMBOL_COUNT 162
+#define SYMBOL_COUNT 163
#define ALIAS_COUNT 0
-#define TOKEN_COUNT 101
+#define TOKEN_COUNT 102
#define EXTERNAL_TOKEN_COUNT 15
#define FIELD_COUNT 19
#define MAX_ALIAS_SEQUENCE_LENGTH 10
@@ -28,164 +28,165 @@ enum {
sym_word = 1,
anon_sym_LF = 2,
anon_sym_for = 3,
- anon_sym_in = 4,
- anon_sym_LPAREN_LPAREN = 5,
- anon_sym_RPAREN_RPAREN = 6,
- anon_sym_SEMI = 7,
- anon_sym_while = 8,
- anon_sym_do = 9,
- anon_sym_done = 10,
- anon_sym_if = 11,
- anon_sym_then = 12,
- anon_sym_fi = 13,
- anon_sym_elif = 14,
- anon_sym_else = 15,
- anon_sym_case = 16,
- anon_sym_esac = 17,
- anon_sym_PIPE = 18,
- anon_sym_RPAREN = 19,
- anon_sym_SEMI_SEMI = 20,
- anon_sym_SEMI_AMP = 21,
- anon_sym_SEMI_SEMI_AMP = 22,
- anon_sym_function = 23,
- anon_sym_LPAREN = 24,
- anon_sym_LBRACE = 25,
- anon_sym_RBRACE = 26,
- anon_sym_PIPE_AMP = 27,
- anon_sym_AMP_AMP = 28,
- anon_sym_PIPE_PIPE = 29,
- anon_sym_BANG = 30,
- anon_sym_LBRACK = 31,
- anon_sym_RBRACK = 32,
- anon_sym_LBRACK_LBRACK = 33,
- anon_sym_RBRACK_RBRACK = 34,
- anon_sym_declare = 35,
- anon_sym_typeset = 36,
- anon_sym_export = 37,
- anon_sym_readonly = 38,
- anon_sym_local = 39,
- anon_sym_unset = 40,
- anon_sym_unsetenv = 41,
- anon_sym_EQ_TILDE = 42,
- anon_sym_EQ_EQ = 43,
- anon_sym_EQ = 44,
- anon_sym_PLUS_EQ = 45,
- anon_sym_LT = 46,
- anon_sym_GT = 47,
- anon_sym_GT_GT = 48,
- anon_sym_AMP_GT = 49,
- anon_sym_AMP_GT_GT = 50,
- anon_sym_LT_AMP = 51,
- anon_sym_GT_AMP = 52,
- anon_sym_GT_PIPE = 53,
- anon_sym_LT_LT = 54,
- anon_sym_LT_LT_DASH = 55,
- anon_sym_LT_LT_LT = 56,
- anon_sym_BANG_EQ = 57,
- anon_sym_PLUS = 58,
- anon_sym_DASH = 59,
- anon_sym_DASH_EQ = 60,
- anon_sym_LT_EQ = 61,
- anon_sym_GT_EQ = 62,
- anon_sym_QMARK = 63,
- anon_sym_COLON = 64,
- anon_sym_PLUS_PLUS = 65,
- anon_sym_DASH_DASH = 66,
- anon_sym_DOLLAR = 67,
- sym__special_character = 68,
- anon_sym_DQUOTE = 69,
- sym__string_content = 70,
- sym_raw_string = 71,
- sym_ansii_c_string = 72,
- anon_sym_POUND = 73,
- anon_sym_DOLLAR_LBRACE = 74,
- anon_sym_SLASH = 75,
- anon_sym_COLON_QMARK = 76,
- anon_sym_COLON_DASH = 77,
- anon_sym_PERCENT = 78,
- anon_sym_DOLLAR_LPAREN = 79,
- anon_sym_BQUOTE = 80,
- anon_sym_LT_LPAREN = 81,
- anon_sym_GT_LPAREN = 82,
- sym_comment = 83,
- aux_sym__simple_variable_name_token1 = 84,
- anon_sym_STAR = 85,
- anon_sym_AT = 86,
- anon_sym_0 = 87,
- anon_sym__ = 88,
- sym_test_operator = 89,
- anon_sym_AMP = 90,
- sym_heredoc_start = 91,
- sym__simple_heredoc_body = 92,
- sym__heredoc_body_beginning = 93,
- sym__heredoc_body_middle = 94,
- sym__heredoc_body_end = 95,
- sym_file_descriptor = 96,
- sym__empty_value = 97,
- sym__concat = 98,
- sym_variable_name = 99,
- sym_regex = 100,
- sym_program = 101,
- sym__statements = 102,
- aux_sym__statements2 = 103,
- sym__terminated_statement = 104,
- sym_redirected_statement = 105,
- sym_for_statement = 106,
- sym_c_style_for_statement = 107,
- sym_while_statement = 108,
- sym_do_group = 109,
- sym_if_statement = 110,
- sym_elif_clause = 111,
- sym_else_clause = 112,
- sym_case_statement = 113,
- sym_case_item = 114,
- sym_last_case_item = 115,
- sym_function_definition = 116,
- sym_compound_statement = 117,
- sym_subshell = 118,
- sym_pipeline = 119,
- sym_list = 120,
- sym_negated_command = 121,
- sym_test_command = 122,
- sym_declaration_command = 123,
- sym_unset_command = 124,
- sym_command = 125,
- sym_command_name = 126,
- sym_variable_assignment = 127,
- sym_subscript = 128,
- sym_file_redirect = 129,
- sym_heredoc_redirect = 130,
- sym_heredoc_body = 131,
- sym_herestring_redirect = 132,
- sym__expression = 133,
- sym_binary_expression = 134,
- sym_ternary_expression = 135,
- sym_unary_expression = 136,
- sym_postfix_expression = 137,
- sym_parenthesized_expression = 138,
- sym_concatenation = 139,
- sym_string = 140,
- sym_array = 141,
- sym_simple_expansion = 142,
- sym_string_expansion = 143,
- sym_expansion = 144,
- sym_command_substitution = 145,
- sym_process_substitution = 146,
- aux_sym__statements_repeat1 = 147,
- aux_sym_redirected_statement_repeat1 = 148,
- aux_sym_for_statement_repeat1 = 149,
- aux_sym_if_statement_repeat1 = 150,
- aux_sym_case_statement_repeat1 = 151,
- aux_sym_case_item_repeat1 = 152,
- aux_sym_declaration_command_repeat1 = 153,
- aux_sym_unset_command_repeat1 = 154,
- aux_sym_command_repeat1 = 155,
- aux_sym_command_repeat2 = 156,
- aux_sym_heredoc_body_repeat1 = 157,
- aux_sym__literal_repeat1 = 158,
- aux_sym_concatenation_repeat1 = 159,
- aux_sym_string_repeat1 = 160,
- aux_sym_expansion_repeat1 = 161,
+ anon_sym_select = 4,
+ anon_sym_in = 5,
+ anon_sym_LPAREN_LPAREN = 6,
+ anon_sym_RPAREN_RPAREN = 7,
+ anon_sym_SEMI = 8,
+ anon_sym_while = 9,
+ anon_sym_do = 10,
+ anon_sym_done = 11,
+ anon_sym_if = 12,
+ anon_sym_then = 13,
+ anon_sym_fi = 14,
+ anon_sym_elif = 15,
+ anon_sym_else = 16,
+ anon_sym_case = 17,
+ anon_sym_esac = 18,
+ anon_sym_PIPE = 19,
+ anon_sym_RPAREN = 20,
+ anon_sym_SEMI_SEMI = 21,
+ anon_sym_SEMI_AMP = 22,
+ anon_sym_SEMI_SEMI_AMP = 23,
+ anon_sym_function = 24,
+ anon_sym_LPAREN = 25,
+ anon_sym_LBRACE = 26,
+ anon_sym_RBRACE = 27,
+ anon_sym_PIPE_AMP = 28,
+ anon_sym_AMP_AMP = 29,
+ anon_sym_PIPE_PIPE = 30,
+ anon_sym_BANG = 31,
+ anon_sym_LBRACK = 32,
+ anon_sym_RBRACK = 33,
+ anon_sym_LBRACK_LBRACK = 34,
+ anon_sym_RBRACK_RBRACK = 35,
+ anon_sym_declare = 36,
+ anon_sym_typeset = 37,
+ anon_sym_export = 38,
+ anon_sym_readonly = 39,
+ anon_sym_local = 40,
+ anon_sym_unset = 41,
+ anon_sym_unsetenv = 42,
+ anon_sym_EQ_TILDE = 43,
+ anon_sym_EQ_EQ = 44,
+ anon_sym_EQ = 45,
+ anon_sym_PLUS_EQ = 46,
+ anon_sym_LT = 47,
+ anon_sym_GT = 48,
+ anon_sym_GT_GT = 49,
+ anon_sym_AMP_GT = 50,
+ anon_sym_AMP_GT_GT = 51,
+ anon_sym_LT_AMP = 52,
+ anon_sym_GT_AMP = 53,
+ anon_sym_GT_PIPE = 54,
+ anon_sym_LT_LT = 55,
+ anon_sym_LT_LT_DASH = 56,
+ anon_sym_LT_LT_LT = 57,
+ anon_sym_BANG_EQ = 58,
+ anon_sym_PLUS = 59,
+ anon_sym_DASH = 60,
+ anon_sym_DASH_EQ = 61,
+ anon_sym_LT_EQ = 62,
+ anon_sym_GT_EQ = 63,
+ anon_sym_QMARK = 64,
+ anon_sym_COLON = 65,
+ anon_sym_PLUS_PLUS = 66,
+ anon_sym_DASH_DASH = 67,
+ anon_sym_DOLLAR = 68,
+ sym__special_character = 69,
+ anon_sym_DQUOTE = 70,
+ sym__string_content = 71,
+ sym_raw_string = 72,
+ sym_ansii_c_string = 73,
+ anon_sym_POUND = 74,
+ anon_sym_DOLLAR_LBRACE = 75,
+ anon_sym_SLASH = 76,
+ anon_sym_COLON_QMARK = 77,
+ anon_sym_COLON_DASH = 78,
+ anon_sym_PERCENT = 79,
+ anon_sym_DOLLAR_LPAREN = 80,
+ anon_sym_BQUOTE = 81,
+ anon_sym_LT_LPAREN = 82,
+ anon_sym_GT_LPAREN = 83,
+ sym_comment = 84,
+ aux_sym__simple_variable_name_token1 = 85,
+ anon_sym_STAR = 86,
+ anon_sym_AT = 87,
+ anon_sym_0 = 88,
+ anon_sym__ = 89,
+ sym_test_operator = 90,
+ anon_sym_AMP = 91,
+ sym_heredoc_start = 92,
+ sym__simple_heredoc_body = 93,
+ sym__heredoc_body_beginning = 94,
+ sym__heredoc_body_middle = 95,
+ sym__heredoc_body_end = 96,
+ sym_file_descriptor = 97,
+ sym__empty_value = 98,
+ sym__concat = 99,
+ sym_variable_name = 100,
+ sym_regex = 101,
+ sym_program = 102,
+ sym__statements = 103,
+ aux_sym__statements2 = 104,
+ sym__terminated_statement = 105,
+ sym_redirected_statement = 106,
+ sym_for_statement = 107,
+ sym_c_style_for_statement = 108,
+ sym_while_statement = 109,
+ sym_do_group = 110,
+ sym_if_statement = 111,
+ sym_elif_clause = 112,
+ sym_else_clause = 113,
+ sym_case_statement = 114,
+ sym_case_item = 115,
+ sym_last_case_item = 116,
+ sym_function_definition = 117,
+ sym_compound_statement = 118,
+ sym_subshell = 119,
+ sym_pipeline = 120,
+ sym_list = 121,
+ sym_negated_command = 122,
+ sym_test_command = 123,
+ sym_declaration_command = 124,
+ sym_unset_command = 125,
+ sym_command = 126,
+ sym_command_name = 127,
+ sym_variable_assignment = 128,
+ sym_subscript = 129,
+ sym_file_redirect = 130,
+ sym_heredoc_redirect = 131,
+ sym_heredoc_body = 132,
+ sym_herestring_redirect = 133,
+ sym__expression = 134,
+ sym_binary_expression = 135,
+ sym_ternary_expression = 136,
+ sym_unary_expression = 137,
+ sym_postfix_expression = 138,
+ sym_parenthesized_expression = 139,
+ sym_concatenation = 140,
+ sym_string = 141,
+ sym_array = 142,
+ sym_simple_expansion = 143,
+ sym_string_expansion = 144,
+ sym_expansion = 145,
+ sym_command_substitution = 146,
+ sym_process_substitution = 147,
+ aux_sym__statements_repeat1 = 148,
+ aux_sym_redirected_statement_repeat1 = 149,
+ aux_sym_for_statement_repeat1 = 150,
+ aux_sym_if_statement_repeat1 = 151,
+ aux_sym_case_statement_repeat1 = 152,
+ aux_sym_case_item_repeat1 = 153,
+ aux_sym_declaration_command_repeat1 = 154,
+ aux_sym_unset_command_repeat1 = 155,
+ aux_sym_command_repeat1 = 156,
+ aux_sym_command_repeat2 = 157,
+ aux_sym_heredoc_body_repeat1 = 158,
+ aux_sym__literal_repeat1 = 159,
+ aux_sym_concatenation_repeat1 = 160,
+ aux_sym_string_repeat1 = 161,
+ aux_sym_expansion_repeat1 = 162,
};
static const char * const ts_symbol_names[] = {
@@ -193,6 +194,7 @@ static const char * const ts_symbol_names[] = {
[sym_word] = "word",
[anon_sym_LF] = "\n",
[anon_sym_for] = "for",
+ [anon_sym_select] = "select",
[anon_sym_in] = "in",
[anon_sym_LPAREN_LPAREN] = "((",
[anon_sym_RPAREN_RPAREN] = "))",
@@ -358,6 +360,7 @@ static const TSSymbol ts_symbol_map[] = {
[sym_word] = sym_word,
[anon_sym_LF] = anon_sym_LF,
[anon_sym_for] = anon_sym_for,
+ [anon_sym_select] = anon_sym_select,
[anon_sym_in] = anon_sym_in,
[anon_sym_LPAREN_LPAREN] = anon_sym_LPAREN_LPAREN,
[anon_sym_RPAREN_RPAREN] = anon_sym_RPAREN_RPAREN,
@@ -535,6 +538,10 @@ static const TSSymbolMetadata ts_symbol_metadata[] = {
.visible = true,
.named = false,
},
+ [anon_sym_select] = {
+ .visible = true,
+ .named = false,
+ },
[anon_sym_in] = {
.visible = true,
.named = false,
@@ -2032,10 +2039,10 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
if (lookahead == '\n') SKIP(84)
END_STATE();
case 41:
- if (lookahead == '\n') SKIP(94)
+ if (lookahead == '\n') SKIP(93)
END_STATE();
case 42:
- if (lookahead == '\n') SKIP(93)
+ if (lookahead == '\n') SKIP(94)
END_STATE();
case 43:
if (lookahead == '\n') SKIP(77)
@@ -3037,7 +3044,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
if (lookahead == '[' ||
lookahead == ']' ||
lookahead == '{') ADVANCE(323);
- if (lookahead == '\\') ADVANCE(158);
+ if (lookahead == '\\') ADVANCE(157);
if (lookahead == '`') ADVANCE(345);
if (lookahead == '}') ADVANCE(258);
if (lookahead == '\t' ||
@@ -3063,7 +3070,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
if (lookahead == '[' ||
lookahead == ']' ||
lookahead == '{') ADVANCE(323);
- if (lookahead == '\\') ADVANCE(157);
+ if (lookahead == '\\') ADVANCE(158);
if (lookahead == '`') ADVANCE(345);
if (lookahead == '}') ADVANCE(258);
if (lookahead == '\t' ||
@@ -3581,18 +3588,18 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
case 157:
if (lookahead == '\t' ||
lookahead == '\n' ||
- lookahead == ' ') SKIP(94)
+ lookahead == ' ') SKIP(93)
if (lookahead == 11 ||
- lookahead == '\f') ADVANCE(397);
+ lookahead == '\f') ADVANCE(396);
if (lookahead == '\r') SKIP(41)
if (lookahead != 0) ADVANCE(414);
END_STATE();
case 158:
if (lookahead == '\t' ||
lookahead == '\n' ||
- lookahead == ' ') SKIP(93)
+ lookahead == ' ') SKIP(94)
if (lookahead == 11 ||
- lookahead == '\f') ADVANCE(396);
+ lookahead == '\f') ADVANCE(397);
if (lookahead == '\r') SKIP(42)
if (lookahead != 0) ADVANCE(414);
END_STATE();
@@ -5291,7 +5298,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
if (lookahead == '/') ADVANCE(340);
if (lookahead == ':') ADVANCE(315);
if (lookahead == '=') ADVANCE(278);
- if (lookahead == '\\') ADVANCE(158);
+ if (lookahead == '\\') ADVANCE(157);
if (!sym_word_character_set_10(lookahead)) ADVANCE(414);
END_STATE();
case 397:
@@ -5300,7 +5307,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
if (lookahead == '-') ADVANCE(307);
if (lookahead == ':') ADVANCE(315);
if (lookahead == '=') ADVANCE(278);
- if (lookahead == '\\') ADVANCE(157);
+ if (lookahead == '\\') ADVANCE(158);
if (!sym_word_character_set_10(lookahead)) ADVANCE(414);
END_STATE();
case 398:
@@ -5469,9 +5476,10 @@ static bool ts_lex_keywords(TSLexer *lexer, TSStateId state) {
if (lookahead == 'i') ADVANCE(6);
if (lookahead == 'l') ADVANCE(7);
if (lookahead == 'r') ADVANCE(8);
- if (lookahead == 't') ADVANCE(9);
- if (lookahead == 'u') ADVANCE(10);
- if (lookahead == 'w') ADVANCE(11);
+ if (lookahead == 's') ADVANCE(9);
+ if (lookahead == 't') ADVANCE(10);
+ if (lookahead == 'u') ADVANCE(11);
+ if (lookahead == 'w') ADVANCE(12);
if (lookahead == '\t' ||
lookahead == '\n' ||
lookahead == '\r' ||
@@ -5480,207 +5488,225 @@ static bool ts_lex_keywords(TSLexer *lexer, TSStateId state) {
case 1:
if (('\t' <= lookahead && lookahead <= '\f') ||
lookahead == ' ') SKIP(0)
- if (lookahead == '\r') SKIP(12)
+ if (lookahead == '\r') SKIP(13)
END_STATE();
case 2:
- if (lookahead == 'a') ADVANCE(13);
+ if (lookahead == 'a') ADVANCE(14);
END_STATE();
case 3:
- if (lookahead == 'e') ADVANCE(14);
- if (lookahead == 'o') ADVANCE(15);
+ if (lookahead == 'e') ADVANCE(15);
+ if (lookahead == 'o') ADVANCE(16);
END_STATE();
case 4:
- if (lookahead == 'x') ADVANCE(16);
+ if (lookahead == 'x') ADVANCE(17);
END_STATE();
case 5:
- if (lookahead == 'o') ADVANCE(17);
- if (lookahead == 'u') ADVANCE(18);
+ if (lookahead == 'o') ADVANCE(18);
+ if (lookahead == 'u') ADVANCE(19);
END_STATE();
case 6:
- if (lookahead == 'f') ADVANCE(19);
+ if (lookahead == 'f') ADVANCE(20);
END_STATE();
case 7:
- if (lookahead == 'o') ADVANCE(20);
+ if (lookahead == 'o') ADVANCE(21);
END_STATE();
case 8:
- if (lookahead == 'e') ADVANCE(21);
+ if (lookahead == 'e') ADVANCE(22);
END_STATE();
case 9:
- if (lookahead == 'y') ADVANCE(22);
+ if (lookahead == 'e') ADVANCE(23);
END_STATE();
case 10:
- if (lookahead == 'n') ADVANCE(23);
+ if (lookahead == 'y') ADVANCE(24);
END_STATE();
case 11:
- if (lookahead == 'h') ADVANCE(24);
+ if (lookahead == 'n') ADVANCE(25);
END_STATE();
case 12:
- if (lookahead == '\n') SKIP(0)
+ if (lookahead == 'h') ADVANCE(26);
END_STATE();
case 13:
- if (lookahead == 's') ADVANCE(25);
+ if (lookahead == '\n') SKIP(0)
END_STATE();
case 14:
- if (lookahead == 'c') ADVANCE(26);
+ if (lookahead == 's') ADVANCE(27);
END_STATE();
case 15:
- if (lookahead == 'n') ADVANCE(27);
+ if (lookahead == 'c') ADVANCE(28);
END_STATE();
case 16:
- if (lookahead == 'p') ADVANCE(28);
+ if (lookahead == 'n') ADVANCE(29);
END_STATE();
case 17:
- if (lookahead == 'r') ADVANCE(29);
+ if (lookahead == 'p') ADVANCE(30);
END_STATE();
case 18:
- if (lookahead == 'n') ADVANCE(30);
+ if (lookahead == 'r') ADVANCE(31);
END_STATE();
case 19:
- ACCEPT_TOKEN(anon_sym_if);
+ if (lookahead == 'n') ADVANCE(32);
END_STATE();
case 20:
- if (lookahead == 'c') ADVANCE(31);
+ ACCEPT_TOKEN(anon_sym_if);
END_STATE();
case 21:
- if (lookahead == 'a') ADVANCE(32);
+ if (lookahead == 'c') ADVANCE(33);
END_STATE();
case 22:
- if (lookahead == 'p') ADVANCE(33);
+ if (lookahead == 'a') ADVANCE(34);
END_STATE();
case 23:
- if (lookahead == 's') ADVANCE(34);
+ if (lookahead == 'l') ADVANCE(35);
END_STATE();
case 24:
- if (lookahead == 'i') ADVANCE(35);
+ if (lookahead == 'p') ADVANCE(36);
END_STATE();
case 25:
- if (lookahead == 'e') ADVANCE(36);
+ if (lookahead == 's') ADVANCE(37);
END_STATE();
case 26:
- if (lookahead == 'l') ADVANCE(37);
+ if (lookahead == 'i') ADVANCE(38);
END_STATE();
case 27:
- if (lookahead == 'e') ADVANCE(38);
+ if (lookahead == 'e') ADVANCE(39);
END_STATE();
case 28:
- if (lookahead == 'o') ADVANCE(39);
+ if (lookahead == 'l') ADVANCE(40);
END_STATE();
case 29:
- ACCEPT_TOKEN(anon_sym_for);
+ if (lookahead == 'e') ADVANCE(41);
END_STATE();
case 30:
- if (lookahead == 'c') ADVANCE(40);
+ if (lookahead == 'o') ADVANCE(42);
END_STATE();
case 31:
- if (lookahead == 'a') ADVANCE(41);
+ ACCEPT_TOKEN(anon_sym_for);
END_STATE();
case 32:
- if (lookahead == 'd') ADVANCE(42);
+ if (lookahead == 'c') ADVANCE(43);
END_STATE();
case 33:
- if (lookahead == 'e') ADVANCE(43);
+ if (lookahead == 'a') ADVANCE(44);
END_STATE();
case 34:
- if (lookahead == 'e') ADVANCE(44);
+ if (lookahead == 'd') ADVANCE(45);
END_STATE();
case 35:
- if (lookahead == 'l') ADVANCE(45);
+ if (lookahead == 'e') ADVANCE(46);
END_STATE();
case 36:
- ACCEPT_TOKEN(anon_sym_case);
+ if (lookahead == 'e') ADVANCE(47);
END_STATE();
case 37:
- if (lookahead == 'a') ADVANCE(46);
+ if (lookahead == 'e') ADVANCE(48);
END_STATE();
case 38:
- ACCEPT_TOKEN(anon_sym_done);
+ if (lookahead == 'l') ADVANCE(49);
END_STATE();
case 39:
- if (lookahead == 'r') ADVANCE(47);
+ ACCEPT_TOKEN(anon_sym_case);
END_STATE();
case 40:
- if (lookahead == 't') ADVANCE(48);
+ if (lookahead == 'a') ADVANCE(50);
END_STATE();
case 41:
- if (lookahead == 'l') ADVANCE(49);
+ ACCEPT_TOKEN(anon_sym_done);
END_STATE();
case 42:
- if (lookahead == 'o') ADVANCE(50);
+ if (lookahead == 'r') ADVANCE(51);
END_STATE();
case 43:
- if (lookahead == 's') ADVANCE(51);
+ if (lookahead == 't') ADVANCE(52);
END_STATE();
case 44:
- if (lookahead == 't') ADVANCE(52);
+ if (lookahead == 'l') ADVANCE(53);
END_STATE();
case 45:
- if (lookahead == 'e') ADVANCE(53);
+ if (lookahead == 'o') ADVANCE(54);
END_STATE();
case 46:
- if (lookahead == 'r') ADVANCE(54);
+ if (lookahead == 'c') ADVANCE(55);
END_STATE();
case 47:
- if (lookahead == 't') ADVANCE(55);
+ if (lookahead == 's') ADVANCE(56);
END_STATE();
case 48:
- if (lookahead == 'i') ADVANCE(56);
+ if (lookahead == 't') ADVANCE(57);
END_STATE();
case 49:
- ACCEPT_TOKEN(anon_sym_local);
+ if (lookahead == 'e') ADVANCE(58);
END_STATE();
case 50:
- if (lookahead == 'n') ADVANCE(57);
+ if (lookahead == 'r') ADVANCE(59);
END_STATE();
case 51:
- if (lookahead == 'e') ADVANCE(58);
+ if (lookahead == 't') ADVANCE(60);
END_STATE();
case 52:
- ACCEPT_TOKEN(anon_sym_unset);
- if (lookahead == 'e') ADVANCE(59);
+ if (lookahead == 'i') ADVANCE(61);
END_STATE();
case 53:
- ACCEPT_TOKEN(anon_sym_while);
+ ACCEPT_TOKEN(anon_sym_local);
END_STATE();
case 54:
- if (lookahead == 'e') ADVANCE(60);
+ if (lookahead == 'n') ADVANCE(62);
END_STATE();
case 55:
- ACCEPT_TOKEN(anon_sym_export);
+ if (lookahead == 't') ADVANCE(63);
END_STATE();
case 56:
- if (lookahead == 'o') ADVANCE(61);
+ if (lookahead == 'e') ADVANCE(64);
END_STATE();
case 57:
- if (lookahead == 'l') ADVANCE(62);
+ ACCEPT_TOKEN(anon_sym_unset);
+ if (lookahead == 'e') ADVANCE(65);
END_STATE();
case 58:
- if (lookahead == 't') ADVANCE(63);
+ ACCEPT_TOKEN(anon_sym_while);
END_STATE();
case 59:
- if (lookahead == 'n') ADVANCE(64);
+ if (lookahead == 'e') ADVANCE(66);
END_STATE();
case 60:
- ACCEPT_TOKEN(anon_sym_declare);
+ ACCEPT_TOKEN(anon_sym_export);
END_STATE();
case 61:
- if (lookahead == 'n') ADVANCE(65);
+ if (lookahead == 'o') ADVANCE(67);
END_STATE();
case 62:
- if (lookahead == 'y') ADVANCE(66);
+ if (lookahead == 'l') ADVANCE(68);
END_STATE();
case 63:
- ACCEPT_TOKEN(anon_sym_typeset);
+ ACCEPT_TOKEN(anon_sym_select);
END_STATE();
case 64:
- if (lookahead == 'v') ADVANCE(67);
+ if (lookahead == 't') ADVANCE(69);
END_STATE();
case 65:
- ACCEPT_TOKEN(anon_sym_function);
+ if (lookahead == 'n') ADVANCE(70);
END_STATE();
case 66:
- ACCEPT_TOKEN(anon_sym_readonly);
+ ACCEPT_TOKEN(anon_sym_declare);
END_STATE();
case 67:
+ if (lookahead == 'n') ADVANCE(71);
+ END_STATE();
+ case 68:
+ if (lookahead == 'y') ADVANCE(72);
+ END_STATE();
+ case 69:
+ ACCEPT_TOKEN(anon_sym_typeset);
+ END_STATE();
+ case 70:
+ if (lookahead == 'v') ADVANCE(73);
+ END_STATE();
+ case 71:
+ ACCEPT_TOKEN(anon_sym_function);
+ END_STATE();
+ case 72:
+ ACCEPT_TOKEN(anon_sym_readonly);
+ END_STATE();
+ case 73:
ACCEPT_TOKEN(anon_sym_unsetenv);
END_STATE();
default:
@@ -5713,18 +5739,18 @@ static const TSLexMode ts_lex_modes[STATE_COUNT] = {
[21] = {.lex_state = 198, .external_lex_state = 2},
[22] = {.lex_state = 198, .external_lex_state = 2},
[23] = {.lex_state = 198, .external_lex_state = 2},
- [24] = {.lex_state = 82, .external_lex_state = 2},
+ [24] = {.lex_state = 198, .external_lex_state = 2},
[25] = {.lex_state = 198, .external_lex_state = 2},
[26] = {.lex_state = 198, .external_lex_state = 2},
[27] = {.lex_state = 198, .external_lex_state = 2},
[28] = {.lex_state = 198, .external_lex_state = 2},
[29] = {.lex_state = 198, .external_lex_state = 2},
- [30] = {.lex_state = 82, .external_lex_state = 2},
+ [30] = {.lex_state = 198, .external_lex_state = 2},
[31] = {.lex_state = 82, .external_lex_state = 2},
[32] = {.lex_state = 198, .external_lex_state = 2},
[33] = {.lex_state = 198, .external_lex_state = 2},
[34] = {.lex_state = 198, .external_lex_state = 2},
- [35] = {.lex_state = 198, .external_lex_state = 2},
+ [35] = {.lex_state = 82, .external_lex_state = 2},
[36] = {.lex_state = 198, .external_lex_state = 2},
[37] = {.lex_state = 198, .external_lex_state = 2},
[38] = {.lex_state = 198, .external_lex_state = 2},
@@ -5747,8 +5773,8 @@ static const TSLexMode ts_lex_modes[STATE_COUNT] = {
[55] = {.lex_state = 198, .external_lex_state = 2},
[56] = {.lex_state = 198, .external_lex_state = 2},
[57] = {.lex_state = 198, .external_lex_state = 2},
- [58] = {.lex_state = 83, .external_lex_state = 3},
- [59] = {.lex_state = 198, .external_lex_state = 2},
+ [58] = {.lex_state = 198, .external_lex_state = 2},
+ [59] = {.lex_state = 83, .external_lex_state = 3},
[60] = {.lex_state = 198, .external_lex_state = 2},
[61] = {.lex_state = 198, .external_lex_state = 2},
[62] = {.lex_state = 198, .external_lex_state = 2},
@@ -5766,8 +5792,8 @@ static const TSLexMode ts_lex_modes[STATE_COUNT] = {
[74] = {.lex_state = 198, .external_lex_state = 2},
[75] = {.lex_state = 198, .external_lex_state = 2},
[76] = {.lex_state = 198, .external_lex_state = 2},
- [77] = {.lex_state = 83, .external_lex_state = 3},
- [78] = {.lex_state = 198, .external_lex_state = 2},
+ [77] = {.lex_state = 198, .external_lex_state = 2},
+ [78] = {.lex_state = 83, .external_lex_state = 3},
[79] = {.lex_state = 198, .external_lex_state = 2},
[80] = {.lex_state = 198, .external_lex_state = 2},
[81] = {.lex_state = 198, .external_lex_state = 2},
@@ -5784,8 +5810,8 @@ static const TSLexMode ts_lex_modes[STATE_COUNT] = {
[92] = {.lex_state = 198, .external_lex_state = 2},
[93] = {.lex_state = 198, .external_lex_state = 2},
[94] = {.lex_state = 83, .external_lex_state = 3},
- [95] = {.lex_state = 83, .external_lex_state = 3},
- [96] = {.lex_state = 198, .external_lex_state = 2},
+ [95] = {.lex_state = 198, .external_lex_state = 2},
+ [96] = {.lex_state = 83, .external_lex_state = 3},
[97] = {.lex_state = 198, .external_lex_state = 2},
[98] = {.lex_state = 198, .external_lex_state = 2},
[99] = {.lex_state = 198, .external_lex_state = 2},
@@ -5795,9 +5821,9 @@ static const TSLexMode ts_lex_modes[STATE_COUNT] = {
[103] = {.lex_state = 198, .external_lex_state = 2},
[104] = {.lex_state = 198, .external_lex_state = 2},
[105] = {.lex_state = 198, .external_lex_state = 2},
- [106] = {.lex_state = 198, .external_lex_state = 2},
+ [106] = {.lex_state = 83, .external_lex_state = 3},
[107] = {.lex_state = 198, .external_lex_state = 2},
- [108] = {.lex_state = 198, .external_lex_state = 2},
+ [108] = {.lex_state = 83, .external_lex_state = 3},
[109] = {.lex_state = 198, .external_lex_state = 2},
[110] = {.lex_state = 198, .external_lex_state = 2},
[111] = {.lex_state = 198, .external_lex_state = 2},
@@ -5816,13 +5842,13 @@ static const TSLexMode ts_lex_modes[STATE_COUNT] = {
[124] = {.lex_state = 198, .external_lex_state = 2},
[125] = {.lex_state = 198, .external_lex_state = 2},
[126] = {.lex_state = 198, .external_lex_state = 2},
- [127] = {.lex_state = 198, .external_lex_state = 2},
- [128] = {.lex_state = 198, .external_lex_state = 2},
- [129] = {.lex_state = 83, .external_lex_state = 3},
+ [127] = {.lex_state = 83, .external_lex_state = 3},
+ [128] = {.lex_state = 82, .external_lex_state = 2},
+ [129] = {.lex_state = 198, .external_lex_state = 2},
[130] = {.lex_state = 198, .external_lex_state = 2},
[131] = {.lex_state = 198, .external_lex_state = 2},
- [132] = {.lex_state = 83, .external_lex_state = 3},
- [133] = {.lex_state = 83, .external_lex_state = 3},
+ [132] = {.lex_state = 198, .external_lex_state = 2},
+ [133] = {.lex_state = 198, .external_lex_state = 2},
[134] = {.lex_state = 198, .external_lex_state = 2},
[135] = {.lex_state = 198, .external_lex_state = 2},
[136] = {.lex_state = 198, .external_lex_state = 2},
@@ -5853,142 +5879,142 @@ static const TSLexMode ts_lex_modes[STATE_COUNT] = {
[161] = {.lex_state = 80, .external_lex_state = 5},
[162] = {.lex_state = 80, .external_lex_state = 5},
[163] = {.lex_state = 60, .external_lex_state = 4},
- [164] = {.lex_state = 61, .external_lex_state = 6},
- [165] = {.lex_state = 60, .external_lex_state = 4},
- [166] = {.lex_state = 60, .external_lex_state = 4},
- [167] = {.lex_state = 193, .external_lex_state = 4},
- [168] = {.lex_state = 81, .external_lex_state = 5},
- [169] = {.lex_state = 63, .external_lex_state = 6},
- [170] = {.lex_state = 63, .external_lex_state = 6},
- [171] = {.lex_state = 193, .external_lex_state = 4},
+ [164] = {.lex_state = 60, .external_lex_state = 4},
+ [165] = {.lex_state = 81, .external_lex_state = 5},
+ [166] = {.lex_state = 61, .external_lex_state = 6},
+ [167] = {.lex_state = 198, .external_lex_state = 5},
+ [168] = {.lex_state = 60, .external_lex_state = 4},
+ [169] = {.lex_state = 198, .external_lex_state = 5},
+ [170] = {.lex_state = 193, .external_lex_state = 4},
+ [171] = {.lex_state = 63, .external_lex_state = 6},
[172] = {.lex_state = 193, .external_lex_state = 4},
- [173] = {.lex_state = 198, .external_lex_state = 5},
- [174] = {.lex_state = 193, .external_lex_state = 4},
+ [173] = {.lex_state = 63, .external_lex_state = 6},
+ [174] = {.lex_state = 63, .external_lex_state = 6},
[175] = {.lex_state = 63, .external_lex_state = 6},
- [176] = {.lex_state = 63, .external_lex_state = 6},
+ [176] = {.lex_state = 193, .external_lex_state = 4},
[177] = {.lex_state = 64, .external_lex_state = 4},
- [178] = {.lex_state = 198, .external_lex_state = 5},
- [179] = {.lex_state = 63, .external_lex_state = 6},
+ [178] = {.lex_state = 63, .external_lex_state = 6},
+ [179] = {.lex_state = 64, .external_lex_state = 4},
[180] = {.lex_state = 65, .external_lex_state = 6},
[181] = {.lex_state = 193, .external_lex_state = 4},
[182] = {.lex_state = 193, .external_lex_state = 4},
- [183] = {.lex_state = 64, .external_lex_state = 4},
+ [183] = {.lex_state = 193, .external_lex_state = 4},
[184] = {.lex_state = 66, .external_lex_state = 6},
- [185] = {.lex_state = 193, .external_lex_state = 4},
- [186] = {.lex_state = 67, .external_lex_state = 4},
- [187] = {.lex_state = 8, .external_lex_state = 6},
- [188] = {.lex_state = 66, .external_lex_state = 6},
+ [185] = {.lex_state = 67, .external_lex_state = 4},
+ [186] = {.lex_state = 66, .external_lex_state = 6},
+ [187] = {.lex_state = 82, .external_lex_state = 5},
+ [188] = {.lex_state = 80, .external_lex_state = 2},
[189] = {.lex_state = 64, .external_lex_state = 6},
[190] = {.lex_state = 193, .external_lex_state = 4},
[191] = {.lex_state = 8, .external_lex_state = 6},
- [192] = {.lex_state = 194, .external_lex_state = 6},
- [193] = {.lex_state = 194, .external_lex_state = 6},
- [194] = {.lex_state = 66, .external_lex_state = 6},<