From 70e0a14c8b6122568b451d4d3a07701646324304 Mon Sep 17 00:00:00 2001 From: Wei Zhang Date: Sat, 23 Sep 2023 15:54:30 +0800 Subject: [PATCH] :sparkles: add assign grammar Signed-off-by: Wei Zhang --- grammar.js | 51 ++- src/grammar.json | 168 ++++++++ src/node-types.json | 126 ++++++ src/parser.c | 854 ++++++++++++++++++++++++++++++++--------- test/corpus/assign.txt | 46 +++ 5 files changed, 1069 insertions(+), 176 deletions(-) create mode 100644 test/corpus/assign.txt diff --git a/grammar.js b/grammar.js index c44d063..259ed0b 100644 --- a/grammar.js +++ b/grammar.js @@ -13,7 +13,8 @@ module.exports = grammar({ ), simple_definition: $ => choice( - $.import_definition + $.import_definition, + $.assign_definition ), import_definition: $ => seq( @@ -34,7 +35,53 @@ module.exports = grammar({ as_name: $ => seq( 'as', $.identifier - ) + ), + + assign_definition: $ => choice( + $.assign, + $.augmented_assign, + ), + + // TODO(wei): should be typed + test: _ => /[a-zA-Z0-9."']+/, + + assign: $ => seq( + choice( + $.identifier, + seq( + $.identifier, + repeat(seq(DOT, $.identifier)), + ), + ), + '=', + $.test, + ), + + augassign: _ => choice("+=", + "-=", + "*=", + "**=", + "/=", + "//=", + "%=", + "&=", + "|=", + "^=", + "<<=", + ">>=", + ), + + augmented_assign: $ => seq( + choice( + $.identifier, + seq( + $.identifier, + repeat(seq(DOT, $.identifier)), + ), + ), + $.augassign, + $.test, + ), } }); diff --git a/src/grammar.json b/src/grammar.json index fda58ac..006181c 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -23,6 +23,10 @@ { "type": "SYMBOL", "name": "import_definition" + }, + { + "type": "SYMBOL", + "name": "assign_definition" } ] }, @@ -111,6 +115,170 @@ "name": "identifier" } ] + }, + "assign_definition": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "assign" + }, + { + "type": "SYMBOL", + "name": "augmented_assign" + } + ] + }, + "test": { + "type": "PATTERN", + "value": "[a-zA-Z0-9.\"']+" + }, + "assign": { + "type": "SEQ", + "members": [ + { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "identifier" + }, + { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "identifier" + }, + { + "type": "REPEAT", + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "." + }, + { + "type": "SYMBOL", + "name": "identifier" + } + ] + } + } + ] + } + ] + }, + { + "type": "STRING", + "value": "=" + }, + { + "type": "SYMBOL", + "name": "test" + } + ] + }, + "augassign": { + "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": ">>=" + } + ] + }, + "augmented_assign": { + "type": "SEQ", + "members": [ + { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "identifier" + }, + { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "identifier" + }, + { + "type": "REPEAT", + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "." + }, + { + "type": "SYMBOL", + "name": "identifier" + } + ] + } + } + ] + } + ] + }, + { + "type": "SYMBOL", + "name": "augassign" + }, + { + "type": "SYMBOL", + "name": "test" + } + ] } }, "extras": [ diff --git a/src/node-types.json b/src/node-types.json index 6aae30b..316133e 100644 --- a/src/node-types.json +++ b/src/node-types.json @@ -14,6 +14,72 @@ ] } }, + { + "type": "assign", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + }, + { + "type": "test", + "named": true + } + ] + } + }, + { + "type": "assign_definition", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": true, + "types": [ + { + "type": "assign", + "named": true + }, + { + "type": "augmented_assign", + "named": true + } + ] + } + }, + { + "type": "augassign", + "named": true, + "fields": {} + }, + { + "type": "augmented_assign", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "augassign", + "named": true + }, + { + "type": "identifier", + "named": true + }, + { + "type": "test", + "named": true + } + ] + } + }, { "type": "import_definition", "named": true, @@ -65,6 +131,10 @@ "multiple": false, "required": true, "types": [ + { + "type": "assign_definition", + "named": true + }, { "type": "import_definition", "named": true @@ -87,10 +157,58 @@ ] } }, + { + "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": "as", "named": false @@ -102,5 +220,13 @@ { "type": "import", "named": false + }, + { + "type": "test", + "named": true + }, + { + "type": "|=", + "named": false } ] \ No newline at end of file diff --git a/src/parser.c b/src/parser.c index f26aee2..a2659b0 100644 --- a/src/parser.c +++ b/src/parser.c @@ -6,14 +6,14 @@ #endif #define LANGUAGE_VERSION 14 -#define STATE_COUNT 21 -#define LARGE_STATE_COUNT 2 -#define SYMBOL_COUNT 15 +#define STATE_COUNT 33 +#define LARGE_STATE_COUNT 4 +#define SYMBOL_COUNT 33 #define ALIAS_COUNT 0 -#define TOKEN_COUNT 5 +#define TOKEN_COUNT 19 #define EXTERNAL_TOKEN_COUNT 0 #define FIELD_COUNT 0 -#define MAX_ALIAS_SEQUENCE_LENGTH 3 +#define MAX_ALIAS_SEQUENCE_LENGTH 4 #define PRODUCTION_ID_COUNT 1 enum { @@ -21,16 +21,34 @@ enum { sym_identifier = 2, anon_sym_DOT = 3, anon_sym_as = 4, - sym_source_file = 5, - sym__definition = 6, - sym_simple_definition = 7, - sym_import_definition = 8, - sym_leading_dot = 9, - sym_pkg_name = 10, - sym_as_name = 11, - aux_sym_source_file_repeat1 = 12, - aux_sym_leading_dot_repeat1 = 13, - aux_sym_pkg_name_repeat1 = 14, + sym_test = 5, + anon_sym_EQ = 6, + anon_sym_PLUS_EQ = 7, + anon_sym_DASH_EQ = 8, + anon_sym_STAR_EQ = 9, + anon_sym_STAR_STAR_EQ = 10, + anon_sym_SLASH_EQ = 11, + anon_sym_SLASH_SLASH_EQ = 12, + anon_sym_PERCENT_EQ = 13, + anon_sym_AMP_EQ = 14, + anon_sym_PIPE_EQ = 15, + anon_sym_CARET_EQ = 16, + anon_sym_LT_LT_EQ = 17, + anon_sym_GT_GT_EQ = 18, + sym_source_file = 19, + sym__definition = 20, + sym_simple_definition = 21, + sym_import_definition = 22, + sym_leading_dot = 23, + sym_pkg_name = 24, + sym_as_name = 25, + sym_assign_definition = 26, + sym_assign = 27, + sym_augassign = 28, + sym_augmented_assign = 29, + aux_sym_source_file_repeat1 = 30, + aux_sym_leading_dot_repeat1 = 31, + aux_sym_pkg_name_repeat1 = 32, }; static const char * const ts_symbol_names[] = { @@ -39,6 +57,20 @@ static const char * const ts_symbol_names[] = { [sym_identifier] = "identifier", [anon_sym_DOT] = ".", [anon_sym_as] = "as", + [sym_test] = "test", + [anon_sym_EQ] = "=", + [anon_sym_PLUS_EQ] = "+=", + [anon_sym_DASH_EQ] = "-=", + [anon_sym_STAR_EQ] = "*=", + [anon_sym_STAR_STAR_EQ] = "**=", + [anon_sym_SLASH_EQ] = "/=", + [anon_sym_SLASH_SLASH_EQ] = "//=", + [anon_sym_PERCENT_EQ] = "%=", + [anon_sym_AMP_EQ] = "&=", + [anon_sym_PIPE_EQ] = "|=", + [anon_sym_CARET_EQ] = "^=", + [anon_sym_LT_LT_EQ] = "<<=", + [anon_sym_GT_GT_EQ] = ">>=", [sym_source_file] = "source_file", [sym__definition] = "_definition", [sym_simple_definition] = "simple_definition", @@ -46,6 +78,10 @@ static const char * const ts_symbol_names[] = { [sym_leading_dot] = "leading_dot", [sym_pkg_name] = "pkg_name", [sym_as_name] = "as_name", + [sym_assign_definition] = "assign_definition", + [sym_assign] = "assign", + [sym_augassign] = "augassign", + [sym_augmented_assign] = "augmented_assign", [aux_sym_source_file_repeat1] = "source_file_repeat1", [aux_sym_leading_dot_repeat1] = "leading_dot_repeat1", [aux_sym_pkg_name_repeat1] = "pkg_name_repeat1", @@ -57,6 +93,20 @@ static const TSSymbol ts_symbol_map[] = { [sym_identifier] = sym_identifier, [anon_sym_DOT] = anon_sym_DOT, [anon_sym_as] = anon_sym_as, + [sym_test] = sym_test, + [anon_sym_EQ] = anon_sym_EQ, + [anon_sym_PLUS_EQ] = anon_sym_PLUS_EQ, + [anon_sym_DASH_EQ] = anon_sym_DASH_EQ, + [anon_sym_STAR_EQ] = anon_sym_STAR_EQ, + [anon_sym_STAR_STAR_EQ] = anon_sym_STAR_STAR_EQ, + [anon_sym_SLASH_EQ] = anon_sym_SLASH_EQ, + [anon_sym_SLASH_SLASH_EQ] = anon_sym_SLASH_SLASH_EQ, + [anon_sym_PERCENT_EQ] = anon_sym_PERCENT_EQ, + [anon_sym_AMP_EQ] = anon_sym_AMP_EQ, + [anon_sym_PIPE_EQ] = anon_sym_PIPE_EQ, + [anon_sym_CARET_EQ] = anon_sym_CARET_EQ, + [anon_sym_LT_LT_EQ] = anon_sym_LT_LT_EQ, + [anon_sym_GT_GT_EQ] = anon_sym_GT_GT_EQ, [sym_source_file] = sym_source_file, [sym__definition] = sym__definition, [sym_simple_definition] = sym_simple_definition, @@ -64,6 +114,10 @@ static const TSSymbol ts_symbol_map[] = { [sym_leading_dot] = sym_leading_dot, [sym_pkg_name] = sym_pkg_name, [sym_as_name] = sym_as_name, + [sym_assign_definition] = sym_assign_definition, + [sym_assign] = sym_assign, + [sym_augassign] = sym_augassign, + [sym_augmented_assign] = sym_augmented_assign, [aux_sym_source_file_repeat1] = aux_sym_source_file_repeat1, [aux_sym_leading_dot_repeat1] = aux_sym_leading_dot_repeat1, [aux_sym_pkg_name_repeat1] = aux_sym_pkg_name_repeat1, @@ -90,6 +144,62 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = false, }, + [sym_test] = { + .visible = true, + .named = true, + }, + [anon_sym_EQ] = { + .visible = true, + .named = false, + }, + [anon_sym_PLUS_EQ] = { + .visible = true, + .named = false, + }, + [anon_sym_DASH_EQ] = { + .visible = true, + .named = false, + }, + [anon_sym_STAR_EQ] = { + .visible = true, + .named = false, + }, + [anon_sym_STAR_STAR_EQ] = { + .visible = true, + .named = false, + }, + [anon_sym_SLASH_EQ] = { + .visible = true, + .named = false, + }, + [anon_sym_SLASH_SLASH_EQ] = { + .visible = true, + .named = false, + }, + [anon_sym_PERCENT_EQ] = { + .visible = true, + .named = false, + }, + [anon_sym_AMP_EQ] = { + .visible = true, + .named = false, + }, + [anon_sym_PIPE_EQ] = { + .visible = true, + .named = false, + }, + [anon_sym_CARET_EQ] = { + .visible = true, + .named = false, + }, + [anon_sym_LT_LT_EQ] = { + .visible = true, + .named = false, + }, + [anon_sym_GT_GT_EQ] = { + .visible = true, + .named = false, + }, [sym_source_file] = { .visible = true, .named = true, @@ -118,6 +228,22 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = true, }, + [sym_assign_definition] = { + .visible = true, + .named = true, + }, + [sym_assign] = { + .visible = true, + .named = true, + }, + [sym_augassign] = { + .visible = true, + .named = true, + }, + [sym_augmented_assign] = { + .visible = true, + .named = true, + }, [aux_sym_source_file_repeat1] = { .visible = false, .named = false, @@ -162,6 +288,18 @@ static const TSStateId ts_primary_state_ids[STATE_COUNT] = { [18] = 18, [19] = 19, [20] = 20, + [21] = 21, + [22] = 22, + [23] = 23, + [24] = 24, + [25] = 25, + [26] = 26, + [27] = 27, + [28] = 28, + [29] = 29, + [30] = 30, + [31] = 31, + [32] = 32, }; static bool ts_lex(TSLexer *lexer, TSStateId state) { @@ -169,59 +307,216 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { eof = lexer->eof(lexer); switch (state) { case 0: - if (eof) ADVANCE(8); - if (lookahead == '.') ADVANCE(11); - if (lookahead == 'a') ADVANCE(6); - if (lookahead == 'i') ADVANCE(2); + if (eof) ADVANCE(18); + if (lookahead == '%') ADVANCE(5); + if (lookahead == '&') ADVANCE(6); + if (lookahead == '*') ADVANCE(1); + if (lookahead == '+') ADVANCE(7); + if (lookahead == '-') ADVANCE(8); + if (lookahead == '.') ADVANCE(27); + if (lookahead == '/') ADVANCE(3); + if (lookahead == '<') ADVANCE(4); + if (lookahead == '=') ADVANCE(30); + if (lookahead == '>') ADVANCE(15); + if (lookahead == '^') ADVANCE(9); + if (lookahead == 'a') ADVANCE(24); + if (lookahead == 'i') ADVANCE(20); + if (lookahead == '|') ADVANCE(10); if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' || lookahead == ' ') SKIP(0) + if (('A' <= lookahead && lookahead <= 'Z') || + ('b' <= lookahead && lookahead <= 'z')) ADVANCE(26); END_STATE(); case 1: - if (lookahead == '.') ADVANCE(11); + if (lookahead == '*') ADVANCE(11); + if (lookahead == '=') ADVANCE(33); + END_STATE(); + case 2: + if (lookahead == '.') ADVANCE(27); if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' || - lookahead == ' ') SKIP(1) + lookahead == ' ') SKIP(2) if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(10); - END_STATE(); - case 2: - if (lookahead == 'm') ADVANCE(4); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); END_STATE(); case 3: - if (lookahead == 'o') ADVANCE(5); + if (lookahead == '/') ADVANCE(12); + if (lookahead == '=') ADVANCE(35); END_STATE(); case 4: - if (lookahead == 'p') ADVANCE(3); + if (lookahead == '<') ADVANCE(13); END_STATE(); case 5: - if (lookahead == 'r') ADVANCE(7); + if (lookahead == '=') ADVANCE(37); END_STATE(); case 6: - if (lookahead == 's') ADVANCE(12); + if (lookahead == '=') ADVANCE(38); END_STATE(); case 7: - if (lookahead == 't') ADVANCE(9); + if (lookahead == '=') ADVANCE(31); END_STATE(); case 8: - ACCEPT_TOKEN(ts_builtin_sym_end); + if (lookahead == '=') ADVANCE(32); END_STATE(); case 9: - ACCEPT_TOKEN(anon_sym_import); + if (lookahead == '=') ADVANCE(40); END_STATE(); case 10: + if (lookahead == '=') ADVANCE(39); + END_STATE(); + case 11: + if (lookahead == '=') ADVANCE(34); + END_STATE(); + case 12: + if (lookahead == '=') ADVANCE(36); + END_STATE(); + case 13: + if (lookahead == '=') ADVANCE(41); + END_STATE(); + case 14: + if (lookahead == '=') ADVANCE(42); + END_STATE(); + case 15: + if (lookahead == '>') ADVANCE(14); + END_STATE(); + case 16: + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') SKIP(16) + if (lookahead == '"' || + lookahead == '\'' || + lookahead == '.' || + ('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(29); + END_STATE(); + case 17: + if (eof) ADVANCE(18); + if (lookahead == 'i') ADVANCE(20); + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') SKIP(17) + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + END_STATE(); + case 18: + ACCEPT_TOKEN(ts_builtin_sym_end); + END_STATE(); + case 19: + ACCEPT_TOKEN(anon_sym_import); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + END_STATE(); + case 20: ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'm') ADVANCE(22); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(10); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); END_STATE(); - case 11: + case 21: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'o') ADVANCE(23); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + END_STATE(); + case 22: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'p') ADVANCE(21); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + END_STATE(); + case 23: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 'r') ADVANCE(25); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + END_STATE(); + case 24: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 's') ADVANCE(28); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + END_STATE(); + case 25: + ACCEPT_TOKEN(sym_identifier); + if (lookahead == 't') ADVANCE(19); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + END_STATE(); + case 26: + ACCEPT_TOKEN(sym_identifier); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + END_STATE(); + case 27: ACCEPT_TOKEN(anon_sym_DOT); END_STATE(); - case 12: + case 28: ACCEPT_TOKEN(anon_sym_as); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + END_STATE(); + case 29: + ACCEPT_TOKEN(sym_test); + if (lookahead == '"' || + lookahead == '\'' || + lookahead == '.' || + ('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(29); + END_STATE(); + case 30: + ACCEPT_TOKEN(anon_sym_EQ); + END_STATE(); + case 31: + ACCEPT_TOKEN(anon_sym_PLUS_EQ); + END_STATE(); + case 32: + ACCEPT_TOKEN(anon_sym_DASH_EQ); + END_STATE(); + case 33: + ACCEPT_TOKEN(anon_sym_STAR_EQ); + END_STATE(); + case 34: + ACCEPT_TOKEN(anon_sym_STAR_STAR_EQ); + END_STATE(); + case 35: + ACCEPT_TOKEN(anon_sym_SLASH_EQ); + END_STATE(); + case 36: + ACCEPT_TOKEN(anon_sym_SLASH_SLASH_EQ); + END_STATE(); + case 37: + ACCEPT_TOKEN(anon_sym_PERCENT_EQ); + END_STATE(); + case 38: + ACCEPT_TOKEN(anon_sym_AMP_EQ); + END_STATE(); + case 39: + ACCEPT_TOKEN(anon_sym_PIPE_EQ); + END_STATE(); + case 40: + ACCEPT_TOKEN(anon_sym_CARET_EQ); + END_STATE(); + case 41: + ACCEPT_TOKEN(anon_sym_LT_LT_EQ); + END_STATE(); + case 42: + ACCEPT_TOKEN(anon_sym_GT_GT_EQ); END_STATE(); default: return false; @@ -230,230 +525,441 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { static const TSLexMode ts_lex_modes[STATE_COUNT] = { [0] = {.lex_state = 0}, - [1] = {.lex_state = 0}, + [1] = {.lex_state = 17}, [2] = {.lex_state = 0}, [3] = {.lex_state = 0}, [4] = {.lex_state = 0}, - [5] = {.lex_state = 1}, - [6] = {.lex_state = 0}, - [7] = {.lex_state = 0}, + [5] = {.lex_state = 0}, + [6] = {.lex_state = 17}, + [7] = {.lex_state = 17}, [8] = {.lex_state = 0}, [9] = {.lex_state = 0}, [10] = {.lex_state = 0}, [11] = {.lex_state = 0}, - [12] = {.lex_state = 1}, - [13] = {.lex_state = 1}, - [14] = {.lex_state = 0}, - [15] = {.lex_state = 0}, - [16] = {.lex_state = 0}, - [17] = {.lex_state = 0}, - [18] = {.lex_state = 1}, - [19] = {.lex_state = 1}, - [20] = {.lex_state = 1}, + [12] = {.lex_state = 0}, + [13] = {.lex_state = 2}, + [14] = {.lex_state = 17}, + [15] = {.lex_state = 2}, + [16] = {.lex_state = 17}, + [17] = {.lex_state = 17}, + [18] = {.lex_state = 17}, + [19] = {.lex_state = 17}, + [20] = {.lex_state = 17}, + [21] = {.lex_state = 17}, + [22] = {.lex_state = 2}, + [23] = {.lex_state = 17}, + [24] = {.lex_state = 16}, + [25] = {.lex_state = 2}, + [26] = {.lex_state = 16}, + [27] = {.lex_state = 16}, + [28] = {.lex_state = 0}, + [29] = {.lex_state = 2}, + [30] = {.lex_state = 2}, + [31] = {.lex_state = 16}, + [32] = {.lex_state = 16}, }; static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [0] = { [ts_builtin_sym_end] = ACTIONS(1), [anon_sym_import] = ACTIONS(1), + [sym_identifier] = ACTIONS(1), [anon_sym_DOT] = ACTIONS(1), [anon_sym_as] = ACTIONS(1), + [anon_sym_EQ] = ACTIONS(1), + [anon_sym_PLUS_EQ] = ACTIONS(1), + [anon_sym_DASH_EQ] = ACTIONS(1), + [anon_sym_STAR_EQ] = ACTIONS(1), + [anon_sym_STAR_STAR_EQ] = ACTIONS(1), + [anon_sym_SLASH_EQ] = ACTIONS(1), + [anon_sym_SLASH_SLASH_EQ] = ACTIONS(1), + [anon_sym_PERCENT_EQ] = ACTIONS(1), + [anon_sym_AMP_EQ] = ACTIONS(1), + [anon_sym_PIPE_EQ] = ACTIONS(1), + [anon_sym_CARET_EQ] = ACTIONS(1), + [anon_sym_LT_LT_EQ] = ACTIONS(1), + [anon_sym_GT_GT_EQ] = ACTIONS(1), }, [1] = { - [sym_source_file] = STATE(17), - [sym__definition] = STATE(3), - [sym_simple_definition] = STATE(3), - [sym_import_definition] = STATE(14), - [aux_sym_source_file_repeat1] = STATE(3), + [sym_source_file] = STATE(28), + [sym__definition] = STATE(7), + [sym_simple_definition] = STATE(7), + [sym_import_definition] = STATE(23), + [sym_assign_definition] = STATE(23), + [sym_assign] = STATE(19), + [sym_augmented_assign] = STATE(19), + [aux_sym_source_file_repeat1] = STATE(7), [ts_builtin_sym_end] = ACTIONS(3), [anon_sym_import] = ACTIONS(5), + [sym_identifier] = ACTIONS(7), + }, + [2] = { + [aux_sym_pkg_name_repeat1] = STATE(2), + [ts_builtin_sym_end] = ACTIONS(9), + [anon_sym_import] = ACTIONS(11), + [sym_identifier] = ACTIONS(11), + [anon_sym_DOT] = ACTIONS(13), + [anon_sym_as] = ACTIONS(11), + [anon_sym_EQ] = ACTIONS(9), + [anon_sym_PLUS_EQ] = ACTIONS(9), + [anon_sym_DASH_EQ] = ACTIONS(9), + [anon_sym_STAR_EQ] = ACTIONS(9), + [anon_sym_STAR_STAR_EQ] = ACTIONS(9), + [anon_sym_SLASH_EQ] = ACTIONS(9), + [anon_sym_SLASH_SLASH_EQ] = ACTIONS(9), + [anon_sym_PERCENT_EQ] = ACTIONS(9), + [anon_sym_AMP_EQ] = ACTIONS(9), + [anon_sym_PIPE_EQ] = ACTIONS(9), + [anon_sym_CARET_EQ] = ACTIONS(9), + [anon_sym_LT_LT_EQ] = ACTIONS(9), + [anon_sym_GT_GT_EQ] = ACTIONS(9), + }, + [3] = { + [ts_builtin_sym_end] = ACTIONS(9), + [anon_sym_import] = ACTIONS(11), + [sym_identifier] = ACTIONS(11), + [anon_sym_DOT] = ACTIONS(9), + [anon_sym_as] = ACTIONS(11), + [anon_sym_EQ] = ACTIONS(9), + [anon_sym_PLUS_EQ] = ACTIONS(9), + [anon_sym_DASH_EQ] = ACTIONS(9), + [anon_sym_STAR_EQ] = ACTIONS(9), + [anon_sym_STAR_STAR_EQ] = ACTIONS(9), + [anon_sym_SLASH_EQ] = ACTIONS(9), + [anon_sym_SLASH_SLASH_EQ] = ACTIONS(9), + [anon_sym_PERCENT_EQ] = ACTIONS(9), + [anon_sym_AMP_EQ] = ACTIONS(9), + [anon_sym_PIPE_EQ] = ACTIONS(9), + [anon_sym_CARET_EQ] = ACTIONS(9), + [anon_sym_LT_LT_EQ] = ACTIONS(9), + [anon_sym_GT_GT_EQ] = ACTIONS(9), }, }; static const uint16_t ts_small_parse_table[] = { - [0] = 4, - ACTIONS(7), 1, + [0] = 5, + ACTIONS(16), 1, + anon_sym_DOT, + ACTIONS(18), 1, + anon_sym_EQ, + STATE(5), 1, + aux_sym_pkg_name_repeat1, + STATE(24), 1, + sym_augassign, + ACTIONS(20), 12, + anon_sym_PLUS_EQ, + anon_sym_DASH_EQ, + anon_sym_STAR_EQ, + anon_sym_STAR_STAR_EQ, + anon_sym_SLASH_EQ, + anon_sym_SLASH_SLASH_EQ, + anon_sym_PERCENT_EQ, + anon_sym_AMP_EQ, + anon_sym_PIPE_EQ, + anon_sym_CARET_EQ, + anon_sym_LT_LT_EQ, + anon_sym_GT_GT_EQ, + [27] = 5, + ACTIONS(16), 1, + anon_sym_DOT, + ACTIONS(22), 1, + anon_sym_EQ, + STATE(2), 1, + aux_sym_pkg_name_repeat1, + STATE(27), 1, + sym_augassign, + ACTIONS(20), 12, + anon_sym_PLUS_EQ, + anon_sym_DASH_EQ, + anon_sym_STAR_EQ, + anon_sym_STAR_STAR_EQ, + anon_sym_SLASH_EQ, + anon_sym_SLASH_SLASH_EQ, + anon_sym_PERCENT_EQ, + anon_sym_AMP_EQ, + anon_sym_PIPE_EQ, + anon_sym_CARET_EQ, + anon_sym_LT_LT_EQ, + anon_sym_GT_GT_EQ, + [54] = 6, + ACTIONS(24), 1, ts_builtin_sym_end, - ACTIONS(9), 1, + ACTIONS(26), 1, anon_sym_import, - STATE(14), 1, + ACTIONS(29), 1, + sym_identifier, + STATE(19), 2, + sym_assign, + sym_augmented_assign, + STATE(23), 2, sym_import_definition, - STATE(2), 3, + sym_assign_definition, + STATE(6), 3, sym__definition, sym_simple_definition, aux_sym_source_file_repeat1, - [15] = 4, + [77] = 6, ACTIONS(5), 1, anon_sym_import, - ACTIONS(12), 1, + ACTIONS(7), 1, + sym_identifier, + ACTIONS(32), 1, ts_builtin_sym_end, - STATE(14), 1, + STATE(19), 2, + sym_assign, + sym_augmented_assign, + STATE(23), 2, sym_import_definition, - STATE(2), 3, + sym_assign_definition, + STATE(6), 3, sym__definition, sym_simple_definition, aux_sym_source_file_repeat1, - [30] = 3, + [100] = 4, ACTIONS(16), 1, anon_sym_DOT, - STATE(6), 1, - aux_sym_pkg_name_repeat1, - ACTIONS(14), 3, + ACTIONS(34), 1, ts_builtin_sym_end, - anon_sym_import, - anon_sym_as, - [42] = 5, - ACTIONS(18), 1, - sym_identifier, - ACTIONS(20), 1, - anon_sym_DOT, STATE(10), 1, - sym_pkg_name, - STATE(12), 1, - aux_sym_leading_dot_repeat1, - STATE(18), 1, - sym_leading_dot, - [58] = 3, - ACTIONS(16), 1, - anon_sym_DOT, - STATE(8), 1, aux_sym_pkg_name_repeat1, - ACTIONS(22), 3, - ts_builtin_sym_end, + ACTIONS(36), 3, anon_sym_import, + sym_identifier, anon_sym_as, - [70] = 3, + [115] = 4, ACTIONS(16), 1, anon_sym_DOT, - STATE(9), 1, - aux_sym_pkg_name_repeat1, - ACTIONS(22), 3, + ACTIONS(38), 1, ts_builtin_sym_end, + STATE(2), 1, + aux_sym_pkg_name_repeat1, + ACTIONS(40), 3, anon_sym_import, + sym_identifier, anon_sym_as, - [82] = 3, - ACTIONS(26), 1, + [130] = 4, + ACTIONS(16), 1, anon_sym_DOT, - STATE(8), 1, - aux_sym_pkg_name_repeat1, - ACTIONS(24), 3, + ACTIONS(42), 1, ts_builtin_sym_end, + STATE(2), 1, + aux_sym_pkg_name_repeat1, + ACTIONS(44), 3, anon_sym_import, + sym_identifier, anon_sym_as, - [94] = 3, + [145] = 4, ACTIONS(16), 1, anon_sym_DOT, - STATE(8), 1, - aux_sym_pkg_name_repeat1, - ACTIONS(29), 3, + ACTIONS(42), 1, ts_builtin_sym_end, + STATE(9), 1, + aux_sym_pkg_name_repeat1, + ACTIONS(44), 3, anon_sym_import, + sym_identifier, anon_sym_as, - [106] = 3, - ACTIONS(33), 1, + [160] = 4, + ACTIONS(46), 1, + ts_builtin_sym_end, + ACTIONS(50), 1, anon_sym_as, - STATE(15), 1, + STATE(21), 1, sym_as_name, - ACTIONS(31), 2, - ts_builtin_sym_end, - anon_sym_import, - [117] = 1, - ACTIONS(24), 4, - ts_builtin_sym_end, + ACTIONS(48), 2, anon_sym_import, - anon_sym_DOT, - anon_sym_as, - [124] = 3, - ACTIONS(35), 1, sym_identifier, - ACTIONS(37), 1, + [174] = 5, + ACTIONS(52), 1, + sym_identifier, + ACTIONS(54), 1, anon_sym_DOT, - STATE(13), 1, + STATE(12), 1, + sym_pkg_name, + STATE(15), 1, aux_sym_leading_dot_repeat1, - [134] = 3, - ACTIONS(39), 1, + STATE(30), 1, + sym_leading_dot, + [190] = 2, + ACTIONS(56), 1, + ts_builtin_sym_end, + ACTIONS(58), 2, + anon_sym_import, sym_identifier, - ACTIONS(41), 1, + [198] = 3, + ACTIONS(60), 1, + sym_identifier, + ACTIONS(62), 1, anon_sym_DOT, - STATE(13), 1, + STATE(22), 1, aux_sym_leading_dot_repeat1, - [144] = 1, - ACTIONS(44), 2, + [208] = 2, + ACTIONS(64), 1, ts_builtin_sym_end, + ACTIONS(66), 2, anon_sym_import, - [149] = 1, - ACTIONS(46), 2, + sym_identifier, + [216] = 2, + ACTIONS(68), 1, ts_builtin_sym_end, + ACTIONS(70), 2, anon_sym_import, - [154] = 1, - ACTIONS(48), 2, + sym_identifier, + [224] = 2, + ACTIONS(72), 1, ts_builtin_sym_end, + ACTIONS(74), 2, anon_sym_import, - [159] = 1, - ACTIONS(50), 1, + sym_identifier, + [232] = 2, + ACTIONS(76), 1, ts_builtin_sym_end, - [163] = 1, - ACTIONS(52), 1, + ACTIONS(78), 2, + anon_sym_import, sym_identifier, - [167] = 1, - ACTIONS(54), 1, + [240] = 2, + ACTIONS(80), 1, + ts_builtin_sym_end, + ACTIONS(82), 2, + anon_sym_import, sym_identifier, - [171] = 1, - ACTIONS(56), 1, + [248] = 2, + ACTIONS(84), 1, + ts_builtin_sym_end, + ACTIONS(86), 2, + anon_sym_import, + sym_identifier, + [256] = 3, + ACTIONS(88), 1, + sym_identifier, + ACTIONS(90), 1, + anon_sym_DOT, + STATE(22), 1, + aux_sym_leading_dot_repeat1, + [266] = 2, + ACTIONS(93), 1, + ts_builtin_sym_end, + ACTIONS(95), 2, + anon_sym_import, + sym_identifier, + [274] = 1, + ACTIONS(97), 1, + sym_test, + [278] = 1, + ACTIONS(99), 1, + sym_identifier, + [282] = 1, + ACTIONS(101), 1, + sym_test, + [286] = 1, + ACTIONS(103), 1, + sym_test, + [290] = 1, + ACTIONS(105), 1, + ts_builtin_sym_end, + [294] = 1, + ACTIONS(107), 1, + sym_identifier, + [298] = 1, + ACTIONS(109), 1, sym_identifier, + [302] = 1, + ACTIONS(111), 1, + sym_test, + [306] = 1, + ACTIONS(113), 1, + sym_test, }; static const uint32_t ts_small_parse_table_map[] = { - [SMALL_STATE(2)] = 0, - [SMALL_STATE(3)] = 15, - [SMALL_STATE(4)] = 30, - [SMALL_STATE(5)] = 42, - [SMALL_STATE(6)] = 58, - [SMALL_STATE(7)] = 70, - [SMALL_STATE(8)] = 82, - [SMALL_STATE(9)] = 94, - [SMALL_STATE(10)] = 106, - [SMALL_STATE(11)] = 117, - [SMALL_STATE(12)] = 124, - [SMALL_STATE(13)] = 134, - [SMALL_STATE(14)] = 144, - [SMALL_STATE(15)] = 149, - [SMALL_STATE(16)] = 154, - [SMALL_STATE(17)] = 159, - [SMALL_STATE(18)] = 163, - [SMALL_STATE(19)] = 167, - [SMALL_STATE(20)] = 171, + [SMALL_STATE(4)] = 0, + [SMALL_STATE(5)] = 27, + [SMALL_STATE(6)] = 54, + [SMALL_STATE(7)] = 77, + [SMALL_STATE(8)] = 100, + [SMALL_STATE(9)] = 115, + [SMALL_STATE(10)] = 130, + [SMALL_STATE(11)] = 145, + [SMALL_STATE(12)] = 160, + [SMALL_STATE(13)] = 174, + [SMALL_STATE(14)] = 190, + [SMALL_STATE(15)] = 198, + [SMALL_STATE(16)] = 208, + [SMALL_STATE(17)] = 216, + [SMALL_STATE(18)] = 224, + [SMALL_STATE(19)] = 232, + [SMALL_STATE(20)] = 240, + [SMALL_STATE(21)] = 248, + [SMALL_STATE(22)] = 256, + [SMALL_STATE(23)] = 266, + [SMALL_STATE(24)] = 274, + [SMALL_STATE(25)] = 278, + [SMALL_STATE(26)] = 282, + [SMALL_STATE(27)] = 286, + [SMALL_STATE(28)] = 290, + [SMALL_STATE(29)] = 294, + [SMALL_STATE(30)] = 298, + [SMALL_STATE(31)] = 302, + [SMALL_STATE(32)] = 306, }; static const TSParseActionEntry ts_parse_actions[] = { [0] = {.entry = {.count = 0, .reusable = false}}, [1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(), [3] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 0), - [5] = {.entry = {.count = 1, .reusable = true}}, SHIFT(5), - [7] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), - [9] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(5), - [12] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 1), - [14] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_pkg_name, 1), - [16] = {.entry = {.count = 1, .reusable = true}}, SHIFT(19), - [18] = {.entry = {.count = 1, .reusable = true}}, SHIFT(4), - [20] = {.entry = {.count = 1, .reusable = true}}, SHIFT(12), - [22] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_pkg_name, 2), - [24] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_pkg_name_repeat1, 2), - [26] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_pkg_name_repeat1, 2), SHIFT_REPEAT(19), - [29] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_pkg_name, 3), - [31] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_import_definition, 2), - [33] = {.entry = {.count = 1, .reusable = true}}, SHIFT(20), - [35] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_leading_dot, 1), - [37] = {.entry = {.count = 1, .reusable = true}}, SHIFT(13), - [39] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_leading_dot_repeat1, 2), - [41] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_leading_dot_repeat1, 2), SHIFT_REPEAT(13), - [44] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_simple_definition, 1), - [46] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_import_definition, 3), - [48] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_as_name, 2), - [50] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), - [52] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7), - [54] = {.entry = {.count = 1, .reusable = true}}, SHIFT(11), - [56] = {.entry = {.count = 1, .reusable = true}}, SHIFT(16), + [5] = {.entry = {.count = 1, .reusable = false}}, SHIFT(13), + [7] = {.entry = {.count = 1, .reusable = false}}, SHIFT(4), + [9] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_pkg_name_repeat1, 2), + [11] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_pkg_name_repeat1, 2), + [13] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_pkg_name_repeat1, 2), SHIFT_REPEAT(25), + [16] = {.entry = {.count = 1, .reusable = true}}, SHIFT(25), + [18] = {.entry = {.count = 1, .reusable = true}}, SHIFT(32), + [20] = {.entry = {.count = 1, .reusable = true}}, SHIFT(31), + [22] = {.entry = {.count = 1, .reusable = true}}, SHIFT(26), + [24] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), + [26] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(13), + [29] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(4), + [32] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 1), + [34] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_pkg_name, 1), + [36] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_pkg_name, 1), + [38] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_pkg_name, 3), + [40] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_pkg_name, 3), + [42] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_pkg_name, 2), + [44] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_pkg_name, 2), + [46] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_import_definition, 2), + [48] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_import_definition, 2), + [50] = {.entry = {.count = 1, .reusable = false}}, SHIFT(29), + [52] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8), + [54] = {.entry = {.count = 1, .reusable = true}}, SHIFT(15), + [56] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assign, 3), + [58] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_assign, 3), + [60] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_leading_dot, 1), + [62] = {.entry = {.count = 1, .reusable = true}}, SHIFT(22), + [64] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_augmented_assign, 4), + [66] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_augmented_assign, 4), + [68] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assign, 4), + [70] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_assign, 4), + [72] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_as_name, 2), + [74] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_as_name, 2), + [76] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assign_definition, 1), + [78] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_assign_definition, 1), + [80] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_augmented_assign, 3), + [82] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_augmented_assign, 3), + [84] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_import_definition, 3), + [86] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_import_definition, 3), + [88] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_leading_dot_repeat1, 2), + [90] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_leading_dot_repeat1, 2), SHIFT_REPEAT(22), + [93] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_simple_definition, 1), + [95] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_simple_definition, 1), + [97] = {.entry = {.count = 1, .reusable = true}}, SHIFT(20), + [99] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3), + [101] = {.entry = {.count = 1, .reusable = true}}, SHIFT(17), + [103] = {.entry = {.count = 1, .reusable = true}}, SHIFT(16), + [105] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), + [107] = {.entry = {.count = 1, .reusable = true}}, SHIFT(18), + [109] = {.entry = {.count = 1, .reusable = true}}, SHIFT(11), + [111] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_augassign, 1), + [113] = {.entry = {.count = 1, .reusable = true}}, SHIFT(14), }; #ifdef __cplusplus diff --git a/test/corpus/assign.txt b/test/corpus/assign.txt new file mode 100644 index 0000000..4af65e5 --- /dev/null +++ b/test/corpus/assign.txt @@ -0,0 +1,46 @@ +================== +assign statements +================== + +k = 1 + +--- + +(source_file + (simple_definition + (assign_definition + (assign + (identifier) + (test))))) + +================== +assign statements with select dots +================== + +a.b = "a.b" + +--- + +(source_file + (simple_definition + (assign_definition + (assign + (identifier) + (identifier) + (test))))) + +================== +augmented assign statements +================== + +k += 1 + +--- + +(source_file + (simple_definition + (assign_definition + (augmented_assign + (identifier) + (augassign) + (test)))))