diff --git a/corpus/functions.txt b/corpus/functions.txt index 94737e7..e863eb3 100644 --- a/corpus/functions.txt +++ b/corpus/functions.txt @@ -59,13 +59,13 @@ function { (statement (expression (function_call - (identifier) + (tool) (expression (identifier))))) (statement (expression (function_call - (identifier) + (tool) (expression (identifier)))))))))))) diff --git a/corpus/while.txt b/corpus/while.txt index 2da8779..57e61f6 100644 --- a/corpus/while.txt +++ b/corpus/while.txt @@ -3,7 +3,7 @@ While Loop ================== while true { - (print "This is a bad idea...") + (output "This is a bad idea...") } --- diff --git a/grammar.js b/grammar.js index a6c61f6..5e14648 100644 --- a/grammar.js +++ b/grammar.js @@ -178,7 +178,7 @@ module.exports = grammar({ ), tool: $ => choice( - 'print', + 'output', 'read', 'write', ), diff --git a/src/grammar.json b/src/grammar.json index b73434c..4e8543a 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -726,7 +726,7 @@ "members": [ { "type": "STRING", - "value": "print" + "value": "output" }, { "type": "STRING", diff --git a/src/node-types.json b/src/node-types.json index 7cb45c8..d9f4da5 100644 --- a/src/node-types.json +++ b/src/node-types.json @@ -598,7 +598,7 @@ "named": false }, { - "type": "print", + "type": "output", "named": false }, { diff --git a/src/parser.c b/src/parser.c index c0f1233..7def698 100644 --- a/src/parser.c +++ b/src/parser.c @@ -55,7 +55,7 @@ enum { anon_sym_while = 36, anon_sym_for = 37, anon_sym_in = 38, - anon_sym_print = 39, + anon_sym_output = 39, anon_sym_read = 40, anon_sym_write = 41, anon_sym_select = 42, @@ -139,7 +139,7 @@ static const char * const ts_symbol_names[] = { [anon_sym_while] = "while", [anon_sym_for] = "for", [anon_sym_in] = "in", - [anon_sym_print] = "print", + [anon_sym_output] = "output", [anon_sym_read] = "read", [anon_sym_write] = "write", [anon_sym_select] = "select", @@ -223,7 +223,7 @@ static const TSSymbol ts_symbol_map[] = { [anon_sym_while] = anon_sym_while, [anon_sym_for] = anon_sym_for, [anon_sym_in] = anon_sym_in, - [anon_sym_print] = anon_sym_print, + [anon_sym_output] = anon_sym_output, [anon_sym_read] = anon_sym_read, [anon_sym_write] = anon_sym_write, [anon_sym_select] = anon_sym_select, @@ -424,7 +424,7 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = false, }, - [anon_sym_print] = { + [anon_sym_output] = { .visible = true, .named = false, }, @@ -1192,7 +1192,7 @@ static bool ts_lex_keywords(TSLexer *lexer, TSStateId state) { case 0: if (lookahead == 'f') ADVANCE(1); if (lookahead == 'i') ADVANCE(2); - if (lookahead == 'p') ADVANCE(3); + if (lookahead == 'o') ADVANCE(3); if (lookahead == 'r') ADVANCE(4); if (lookahead == 's') ADVANCE(5); if (lookahead == 't') ADVANCE(6); @@ -1213,7 +1213,7 @@ static bool ts_lex_keywords(TSLexer *lexer, TSStateId state) { if (lookahead == 'n') ADVANCE(13); END_STATE(); case 3: - if (lookahead == 'r') ADVANCE(14); + if (lookahead == 'u') ADVANCE(14); END_STATE(); case 4: if (lookahead == 'e') ADVANCE(15); @@ -1250,7 +1250,7 @@ static bool ts_lex_keywords(TSLexer *lexer, TSStateId state) { if (lookahead == 't') ADVANCE(26); END_STATE(); case 14: - if (lookahead == 'i') ADVANCE(27); + if (lookahead == 't') ADVANCE(27); END_STATE(); case 15: if (lookahead == 'a') ADVANCE(28); @@ -1290,7 +1290,7 @@ static bool ts_lex_keywords(TSLexer *lexer, TSStateId state) { if (lookahead == 'o') ADVANCE(39); END_STATE(); case 27: - if (lookahead == 'n') ADVANCE(40); + if (lookahead == 'p') ADVANCE(40); END_STATE(); case 28: if (lookahead == 'd') ADVANCE(41); @@ -1329,7 +1329,7 @@ static bool ts_lex_keywords(TSLexer *lexer, TSStateId state) { ACCEPT_TOKEN(anon_sym_into); END_STATE(); case 40: - if (lookahead == 't') ADVANCE(51); + if (lookahead == 'u') ADVANCE(51); END_STATE(); case 41: ACCEPT_TOKEN(anon_sym_read); @@ -1362,10 +1362,10 @@ static bool ts_lex_keywords(TSLexer *lexer, TSStateId state) { if (lookahead == 't') ADVANCE(58); END_STATE(); case 51: - ACCEPT_TOKEN(anon_sym_print); + if (lookahead == 't') ADVANCE(59); END_STATE(); case 52: - if (lookahead == 't') ADVANCE(59); + if (lookahead == 't') ADVANCE(60); END_STATE(); case 53: ACCEPT_TOKEN(anon_sym_table); @@ -1380,18 +1380,21 @@ static bool ts_lex_keywords(TSLexer *lexer, TSStateId state) { ACCEPT_TOKEN(anon_sym_write); END_STATE(); case 57: - if (lookahead == 'o') ADVANCE(60); + if (lookahead == 'o') ADVANCE(61); END_STATE(); case 58: ACCEPT_TOKEN(anon_sym_insert); END_STATE(); case 59: - ACCEPT_TOKEN(anon_sym_select); + ACCEPT_TOKEN(anon_sym_output); END_STATE(); case 60: - if (lookahead == 'n') ADVANCE(61); + ACCEPT_TOKEN(anon_sym_select); END_STATE(); case 61: + if (lookahead == 'n') ADVANCE(62); + END_STATE(); + case 62: ACCEPT_TOKEN(anon_sym_function); END_STATE(); default: @@ -1653,7 +1656,7 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [anon_sym_while] = ACTIONS(1), [anon_sym_for] = ACTIONS(1), [anon_sym_in] = ACTIONS(1), - [anon_sym_print] = ACTIONS(1), + [anon_sym_output] = ACTIONS(1), [anon_sym_read] = ACTIONS(1), [anon_sym_write] = ACTIONS(1), [anon_sym_select] = ACTIONS(1), @@ -6156,7 +6159,7 @@ static const uint16_t ts_small_parse_table[] = { STATE(58), 1, sym_tool, ACTIONS(450), 3, - anon_sym_print, + anon_sym_output, anon_sym_read, anon_sym_write, [5575] = 3, @@ -6165,7 +6168,7 @@ static const uint16_t ts_small_parse_table[] = { STATE(65), 1, sym_tool, ACTIONS(450), 3, - anon_sym_print, + anon_sym_output, anon_sym_read, anon_sym_write, [5587] = 3, @@ -6174,7 +6177,7 @@ static const uint16_t ts_small_parse_table[] = { STATE(52), 1, sym_tool, ACTIONS(450), 3, - anon_sym_print, + anon_sym_output, anon_sym_read, anon_sym_write, [5599] = 3,