Add statment tests
This commit is contained in:
parent
ee5ba3bf3f
commit
dd857a8291
@ -10,15 +10,18 @@ x;
|
||||
|
||||
(source
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
(integer))
|
||||
(integer)))
|
||||
(close))
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
(string))
|
||||
(string)))
|
||||
(close))
|
||||
(statement
|
||||
(identifier)
|
||||
(expression
|
||||
(identifier))
|
||||
(close)))
|
||||
|
||||
==================
|
||||
@ -32,19 +35,37 @@ y = "one";
|
||||
|
||||
(source
|
||||
(statement
|
||||
(expression
|
||||
(identifier)
|
||||
(operator
|
||||
(assignment))
|
||||
(operator)
|
||||
(value
|
||||
(integer)))
|
||||
(close))
|
||||
(statement
|
||||
(expression
|
||||
(identifier)
|
||||
(operator)
|
||||
(value
|
||||
(string)))
|
||||
(close)))
|
||||
|
||||
==================
|
||||
Complex Assignment
|
||||
==================
|
||||
|
||||
x = 1 + 1;
|
||||
|
||||
---
|
||||
|
||||
(source
|
||||
(statement
|
||||
(expression
|
||||
(identifier)
|
||||
(operator)
|
||||
(expression
|
||||
(value
|
||||
(integer))
|
||||
(close)))
|
||||
(statement
|
||||
(identifier)
|
||||
(operator
|
||||
(assignment))
|
||||
(statement
|
||||
(operator)
|
||||
(value
|
||||
(string))
|
||||
(close))))
|
||||
|
||||
(integer))))
|
||||
(close)))
|
||||
|
26
grammar.js
26
grammar.js
@ -6,10 +6,22 @@ module.exports = grammar({
|
||||
$.statement,
|
||||
)),
|
||||
|
||||
statement: $ => choice(
|
||||
seq($.value, $.close),
|
||||
seq($.identifier, $.close),
|
||||
seq($.identifier, $.operator, $.statement),
|
||||
statement: $ => seq($.expression, $.close),
|
||||
|
||||
expression: $ => choice(
|
||||
$.identifier,
|
||||
prec(1, $.value),
|
||||
prec(2, seq(
|
||||
choice(
|
||||
$.value,
|
||||
$.identifier,
|
||||
),
|
||||
$.operator,
|
||||
choice(
|
||||
$.value,
|
||||
$.identifier,
|
||||
$.expression,
|
||||
))),
|
||||
),
|
||||
|
||||
close: $ => ";",
|
||||
@ -50,13 +62,7 @@ module.exports = grammar({
|
||||
operator: $ => choice(
|
||||
'+',
|
||||
'-',
|
||||
$.assignment,
|
||||
),
|
||||
|
||||
assignment: $ => choice(
|
||||
'=',
|
||||
'+=',
|
||||
'-=',
|
||||
),
|
||||
}
|
||||
});
|
||||
|
@ -14,10 +14,41 @@
|
||||
}
|
||||
},
|
||||
"statement": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "expression"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "close"
|
||||
}
|
||||
]
|
||||
},
|
||||
"expression": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "identifier"
|
||||
},
|
||||
{
|
||||
"type": "PREC",
|
||||
"value": 1,
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "value"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "PREC",
|
||||
"value": 2,
|
||||
"content": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
@ -25,41 +56,35 @@
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "close"
|
||||
"name": "identifier"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "identifier"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "close"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "identifier"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "operator"
|
||||
},
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "statement"
|
||||
"name": "value"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "identifier"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "expression"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"close": {
|
||||
"type": "STRING",
|
||||
@ -183,26 +208,9 @@
|
||||
"type": "STRING",
|
||||
"value": "-"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "assignment"
|
||||
}
|
||||
]
|
||||
},
|
||||
"assignment": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "="
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "+="
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "-="
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1,14 +1,36 @@
|
||||
[
|
||||
{
|
||||
"type": "assignment",
|
||||
"named": true,
|
||||
"fields": {}
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"named": true,
|
||||
"fields": {}
|
||||
},
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "operator",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "value",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "list",
|
||||
"named": true,
|
||||
@ -27,17 +49,7 @@
|
||||
{
|
||||
"type": "operator",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "assignment",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
"fields": {}
|
||||
},
|
||||
{
|
||||
"type": "source",
|
||||
@ -67,19 +79,7 @@
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "operator",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "statement",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "value",
|
||||
"type": "expression",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
@ -136,10 +136,6 @@
|
||||
"type": "+",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "+=",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": ",",
|
||||
"named": false
|
||||
@ -148,10 +144,6 @@
|
||||
"type": "-",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "-=",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "=",
|
||||
"named": false
|
||||
|
575
src/parser.c
575
src/parser.c
@ -6,11 +6,11 @@
|
||||
#endif
|
||||
|
||||
#define LANGUAGE_VERSION 14
|
||||
#define STATE_COUNT 20
|
||||
#define LARGE_STATE_COUNT 4
|
||||
#define SYMBOL_COUNT 27
|
||||
#define STATE_COUNT 22
|
||||
#define LARGE_STATE_COUNT 10
|
||||
#define SYMBOL_COUNT 25
|
||||
#define ALIAS_COUNT 0
|
||||
#define TOKEN_COUNT 18
|
||||
#define TOKEN_COUNT 16
|
||||
#define EXTERNAL_TOKEN_COUNT 0
|
||||
#define FIELD_COUNT 0
|
||||
#define MAX_ALIAS_SEQUENCE_LENGTH 3
|
||||
@ -32,17 +32,15 @@ enum {
|
||||
anon_sym_PLUS = 13,
|
||||
anon_sym_DASH = 14,
|
||||
anon_sym_EQ = 15,
|
||||
anon_sym_PLUS_EQ = 16,
|
||||
anon_sym_DASH_EQ = 17,
|
||||
sym_source = 18,
|
||||
sym_statement = 19,
|
||||
sym_value = 20,
|
||||
sym_boolean = 21,
|
||||
sym_list = 22,
|
||||
sym_operator = 23,
|
||||
sym_assignment = 24,
|
||||
aux_sym_source_repeat1 = 25,
|
||||
aux_sym_list_repeat1 = 26,
|
||||
sym_source = 16,
|
||||
sym_statement = 17,
|
||||
sym_expression = 18,
|
||||
sym_value = 19,
|
||||
sym_boolean = 20,
|
||||
sym_list = 21,
|
||||
sym_operator = 22,
|
||||
aux_sym_source_repeat1 = 23,
|
||||
aux_sym_list_repeat1 = 24,
|
||||
};
|
||||
|
||||
static const char * const ts_symbol_names[] = {
|
||||
@ -62,15 +60,13 @@ static const char * const ts_symbol_names[] = {
|
||||
[anon_sym_PLUS] = "+",
|
||||
[anon_sym_DASH] = "-",
|
||||
[anon_sym_EQ] = "=",
|
||||
[anon_sym_PLUS_EQ] = "+=",
|
||||
[anon_sym_DASH_EQ] = "-=",
|
||||
[sym_source] = "source",
|
||||
[sym_statement] = "statement",
|
||||
[sym_expression] = "expression",
|
||||
[sym_value] = "value",
|
||||
[sym_boolean] = "boolean",
|
||||
[sym_list] = "list",
|
||||
[sym_operator] = "operator",
|
||||
[sym_assignment] = "assignment",
|
||||
[aux_sym_source_repeat1] = "source_repeat1",
|
||||
[aux_sym_list_repeat1] = "list_repeat1",
|
||||
};
|
||||
@ -92,15 +88,13 @@ static const TSSymbol ts_symbol_map[] = {
|
||||
[anon_sym_PLUS] = anon_sym_PLUS,
|
||||
[anon_sym_DASH] = anon_sym_DASH,
|
||||
[anon_sym_EQ] = anon_sym_EQ,
|
||||
[anon_sym_PLUS_EQ] = anon_sym_PLUS_EQ,
|
||||
[anon_sym_DASH_EQ] = anon_sym_DASH_EQ,
|
||||
[sym_source] = sym_source,
|
||||
[sym_statement] = sym_statement,
|
||||
[sym_expression] = sym_expression,
|
||||
[sym_value] = sym_value,
|
||||
[sym_boolean] = sym_boolean,
|
||||
[sym_list] = sym_list,
|
||||
[sym_operator] = sym_operator,
|
||||
[sym_assignment] = sym_assignment,
|
||||
[aux_sym_source_repeat1] = aux_sym_source_repeat1,
|
||||
[aux_sym_list_repeat1] = aux_sym_list_repeat1,
|
||||
};
|
||||
@ -170,14 +164,6 @@ static const TSSymbolMetadata ts_symbol_metadata[] = {
|
||||
.visible = true,
|
||||
.named = false,
|
||||
},
|
||||
[anon_sym_PLUS_EQ] = {
|
||||
.visible = true,
|
||||
.named = false,
|
||||
},
|
||||
[anon_sym_DASH_EQ] = {
|
||||
.visible = true,
|
||||
.named = false,
|
||||
},
|
||||
[sym_source] = {
|
||||
.visible = true,
|
||||
.named = true,
|
||||
@ -186,6 +172,10 @@ static const TSSymbolMetadata ts_symbol_metadata[] = {
|
||||
.visible = true,
|
||||
.named = true,
|
||||
},
|
||||
[sym_expression] = {
|
||||
.visible = true,
|
||||
.named = true,
|
||||
},
|
||||
[sym_value] = {
|
||||
.visible = true,
|
||||
.named = true,
|
||||
@ -202,10 +192,6 @@ static const TSSymbolMetadata ts_symbol_metadata[] = {
|
||||
.visible = true,
|
||||
.named = true,
|
||||
},
|
||||
[sym_assignment] = {
|
||||
.visible = true,
|
||||
.named = true,
|
||||
},
|
||||
[aux_sym_source_repeat1] = {
|
||||
.visible = false,
|
||||
.named = false,
|
||||
@ -245,6 +231,8 @@ static const TSStateId ts_primary_state_ids[STATE_COUNT] = {
|
||||
[17] = 17,
|
||||
[18] = 18,
|
||||
[19] = 19,
|
||||
[20] = 20,
|
||||
[21] = 21,
|
||||
};
|
||||
|
||||
static bool ts_lex(TSLexer *lexer, TSStateId state) {
|
||||
@ -307,8 +295,11 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
|
||||
lookahead == '`') ADVANCE(10);
|
||||
if (lookahead == '(') ADVANCE(31);
|
||||
if (lookahead == ')') ADVANCE(33);
|
||||
if (lookahead == '+') ADVANCE(34);
|
||||
if (lookahead == ',') ADVANCE(32);
|
||||
if (lookahead == '-') ADVANCE(35);
|
||||
if (lookahead == ';') ADVANCE(12);
|
||||
if (lookahead == '=') ADVANCE(36);
|
||||
if (lookahead == 'f') ADVANCE(1);
|
||||
if (lookahead == 't') ADVANCE(5);
|
||||
if (lookahead == '{') ADVANCE(8);
|
||||
@ -470,21 +461,13 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
|
||||
END_STATE();
|
||||
case 34:
|
||||
ACCEPT_TOKEN(anon_sym_PLUS);
|
||||
if (lookahead == '=') ADVANCE(37);
|
||||
END_STATE();
|
||||
case 35:
|
||||
ACCEPT_TOKEN(anon_sym_DASH);
|
||||
if (lookahead == '=') ADVANCE(38);
|
||||
END_STATE();
|
||||
case 36:
|
||||
ACCEPT_TOKEN(anon_sym_EQ);
|
||||
END_STATE();
|
||||
case 37:
|
||||
ACCEPT_TOKEN(anon_sym_PLUS_EQ);
|
||||
END_STATE();
|
||||
case 38:
|
||||
ACCEPT_TOKEN(anon_sym_DASH_EQ);
|
||||
END_STATE();
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -495,22 +478,24 @@ static const TSLexMode ts_lex_modes[STATE_COUNT] = {
|
||||
[1] = {.lex_state = 0},
|
||||
[2] = {.lex_state = 0},
|
||||
[3] = {.lex_state = 0},
|
||||
[4] = {.lex_state = 0},
|
||||
[4] = {.lex_state = 9},
|
||||
[5] = {.lex_state = 9},
|
||||
[6] = {.lex_state = 9},
|
||||
[7] = {.lex_state = 9},
|
||||
[7] = {.lex_state = 0},
|
||||
[8] = {.lex_state = 9},
|
||||
[9] = {.lex_state = 9},
|
||||
[10] = {.lex_state = 9},
|
||||
[11] = {.lex_state = 0},
|
||||
[12] = {.lex_state = 9},
|
||||
[11] = {.lex_state = 9},
|
||||
[12] = {.lex_state = 0},
|
||||
[13] = {.lex_state = 0},
|
||||
[14] = {.lex_state = 0},
|
||||
[14] = {.lex_state = 9},
|
||||
[15] = {.lex_state = 0},
|
||||
[16] = {.lex_state = 9},
|
||||
[16] = {.lex_state = 0},
|
||||
[17] = {.lex_state = 0},
|
||||
[18] = {.lex_state = 0},
|
||||
[19] = {.lex_state = 0},
|
||||
[20] = {.lex_state = 0},
|
||||
[21] = {.lex_state = 0},
|
||||
};
|
||||
|
||||
static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = {
|
||||
@ -531,16 +516,15 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = {
|
||||
[anon_sym_PLUS] = ACTIONS(1),
|
||||
[anon_sym_DASH] = ACTIONS(1),
|
||||
[anon_sym_EQ] = ACTIONS(1),
|
||||
[anon_sym_PLUS_EQ] = ACTIONS(1),
|
||||
[anon_sym_DASH_EQ] = ACTIONS(1),
|
||||
},
|
||||
[1] = {
|
||||
[sym_source] = STATE(18),
|
||||
[sym_statement] = STATE(2),
|
||||
[sym_value] = STATE(19),
|
||||
[sym_boolean] = STATE(8),
|
||||
[sym_list] = STATE(8),
|
||||
[aux_sym_source_repeat1] = STATE(2),
|
||||
[sym_source] = STATE(21),
|
||||
[sym_statement] = STATE(3),
|
||||
[sym_expression] = STATE(20),
|
||||
[sym_value] = STATE(16),
|
||||
[sym_boolean] = STATE(4),
|
||||
[sym_list] = STATE(4),
|
||||
[aux_sym_source_repeat1] = STATE(3),
|
||||
[ts_builtin_sym_end] = ACTIONS(3),
|
||||
[sym_identifier] = ACTIONS(5),
|
||||
[sym_float] = ACTIONS(7),
|
||||
@ -553,12 +537,31 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = {
|
||||
[anon_sym_LPAREN] = ACTIONS(13),
|
||||
},
|
||||
[2] = {
|
||||
[sym_statement] = STATE(3),
|
||||
[sym_value] = STATE(19),
|
||||
[sym_boolean] = STATE(8),
|
||||
[sym_list] = STATE(8),
|
||||
[aux_sym_source_repeat1] = STATE(3),
|
||||
[sym_statement] = STATE(2),
|
||||
[sym_expression] = STATE(20),
|
||||
[sym_value] = STATE(16),
|
||||
[sym_boolean] = STATE(4),
|
||||
[sym_list] = STATE(4),
|
||||
[aux_sym_source_repeat1] = STATE(2),
|
||||
[ts_builtin_sym_end] = ACTIONS(15),
|
||||
[sym_identifier] = ACTIONS(17),
|
||||
[sym_float] = ACTIONS(20),
|
||||
[sym_integer] = ACTIONS(23),
|
||||
[sym_string] = ACTIONS(20),
|
||||
[sym_function] = ACTIONS(20),
|
||||
[sym_empty] = ACTIONS(20),
|
||||
[anon_sym_true] = ACTIONS(26),
|
||||
[anon_sym_false] = ACTIONS(26),
|
||||
[anon_sym_LPAREN] = ACTIONS(29),
|
||||
},
|
||||
[3] = {
|
||||
[sym_statement] = STATE(2),
|
||||
[sym_expression] = STATE(20),
|
||||
[sym_value] = STATE(16),
|
||||
[sym_boolean] = STATE(4),
|
||||
[sym_list] = STATE(4),
|
||||
[aux_sym_source_repeat1] = STATE(2),
|
||||
[ts_builtin_sym_end] = ACTIONS(32),
|
||||
[sym_identifier] = ACTIONS(5),
|
||||
[sym_float] = ACTIONS(7),
|
||||
[sym_integer] = ACTIONS(9),
|
||||
@ -569,184 +572,151 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = {
|
||||
[anon_sym_false] = ACTIONS(11),
|
||||
[anon_sym_LPAREN] = ACTIONS(13),
|
||||
},
|
||||
[3] = {
|
||||
[sym_statement] = STATE(3),
|
||||
[sym_value] = STATE(19),
|
||||
[sym_boolean] = STATE(8),
|
||||
[sym_list] = STATE(8),
|
||||
[aux_sym_source_repeat1] = STATE(3),
|
||||
[ts_builtin_sym_end] = ACTIONS(17),
|
||||
[sym_identifier] = ACTIONS(19),
|
||||
[sym_float] = ACTIONS(22),
|
||||
[sym_integer] = ACTIONS(25),
|
||||
[sym_string] = ACTIONS(22),
|
||||
[sym_function] = ACTIONS(22),
|
||||
[sym_empty] = ACTIONS(22),
|
||||
[anon_sym_true] = ACTIONS(28),
|
||||
[anon_sym_false] = ACTIONS(28),
|
||||
[anon_sym_LPAREN] = ACTIONS(31),
|
||||
[4] = {
|
||||
[sym_close] = ACTIONS(34),
|
||||
[sym_float] = ACTIONS(34),
|
||||
[sym_integer] = ACTIONS(36),
|
||||
[sym_string] = ACTIONS(34),
|
||||
[sym_function] = ACTIONS(34),
|
||||
[sym_empty] = ACTIONS(34),
|
||||
[anon_sym_true] = ACTIONS(34),
|
||||
[anon_sym_false] = ACTIONS(34),
|
||||
[anon_sym_LPAREN] = ACTIONS(36),
|
||||
[anon_sym_COMMA] = ACTIONS(34),
|
||||
[anon_sym_RPAREN] = ACTIONS(34),
|
||||
[anon_sym_PLUS] = ACTIONS(34),
|
||||
[anon_sym_DASH] = ACTIONS(34),
|
||||
[anon_sym_EQ] = ACTIONS(34),
|
||||
},
|
||||
[5] = {
|
||||
[sym_close] = ACTIONS(38),
|
||||
[sym_float] = ACTIONS(38),
|
||||
[sym_integer] = ACTIONS(40),
|
||||
[sym_string] = ACTIONS(38),
|
||||
[sym_function] = ACTIONS(38),
|
||||
[sym_empty] = ACTIONS(38),
|
||||
[anon_sym_true] = ACTIONS(38),
|
||||
[anon_sym_false] = ACTIONS(38),
|
||||
[anon_sym_LPAREN] = ACTIONS(40),
|
||||
[anon_sym_COMMA] = ACTIONS(38),
|
||||
[anon_sym_RPAREN] = ACTIONS(38),
|
||||
[anon_sym_PLUS] = ACTIONS(38),
|
||||
[anon_sym_DASH] = ACTIONS(38),
|
||||
[anon_sym_EQ] = ACTIONS(38),
|
||||
},
|
||||
[6] = {
|
||||
[sym_close] = ACTIONS(42),
|
||||
[sym_float] = ACTIONS(42),
|
||||
[sym_integer] = ACTIONS(44),
|
||||
[sym_string] = ACTIONS(42),
|
||||
[sym_function] = ACTIONS(42),
|
||||
[sym_empty] = ACTIONS(42),
|
||||
[anon_sym_true] = ACTIONS(42),
|
||||
[anon_sym_false] = ACTIONS(42),
|
||||
[anon_sym_LPAREN] = ACTIONS(44),
|
||||
[anon_sym_COMMA] = ACTIONS(42),
|
||||
[anon_sym_RPAREN] = ACTIONS(42),
|
||||
[anon_sym_PLUS] = ACTIONS(42),
|
||||
[anon_sym_DASH] = ACTIONS(42),
|
||||
[anon_sym_EQ] = ACTIONS(42),
|
||||
},
|
||||
[7] = {
|
||||
[sym_expression] = STATE(19),
|
||||
[sym_value] = STATE(18),
|
||||
[sym_boolean] = STATE(4),
|
||||
[sym_list] = STATE(4),
|
||||
[sym_identifier] = ACTIONS(46),
|
||||
[sym_float] = ACTIONS(7),
|
||||
[sym_integer] = ACTIONS(9),
|
||||
[sym_string] = ACTIONS(7),
|
||||
[sym_function] = ACTIONS(7),
|
||||
[sym_empty] = ACTIONS(7),
|
||||
[anon_sym_true] = ACTIONS(11),
|
||||
[anon_sym_false] = ACTIONS(11),
|
||||
[anon_sym_LPAREN] = ACTIONS(13),
|
||||
},
|
||||
[8] = {
|
||||
[sym_value] = STATE(11),
|
||||
[sym_boolean] = STATE(4),
|
||||
[sym_list] = STATE(4),
|
||||
[aux_sym_list_repeat1] = STATE(8),
|
||||
[sym_float] = ACTIONS(48),
|
||||
[sym_integer] = ACTIONS(51),
|
||||
[sym_string] = ACTIONS(48),
|
||||
[sym_function] = ACTIONS(48),
|
||||
[sym_empty] = ACTIONS(48),
|
||||
[anon_sym_true] = ACTIONS(54),
|
||||
[anon_sym_false] = ACTIONS(54),
|
||||
[anon_sym_LPAREN] = ACTIONS(57),
|
||||
[anon_sym_RPAREN] = ACTIONS(60),
|
||||
},
|
||||
[9] = {
|
||||
[sym_value] = STATE(11),
|
||||
[sym_boolean] = STATE(4),
|
||||
[sym_list] = STATE(4),
|
||||
[aux_sym_list_repeat1] = STATE(8),
|
||||
[sym_float] = ACTIONS(7),
|
||||
[sym_integer] = ACTIONS(9),
|
||||
[sym_string] = ACTIONS(7),
|
||||
[sym_function] = ACTIONS(7),
|
||||
[sym_empty] = ACTIONS(7),
|
||||
[anon_sym_true] = ACTIONS(62),
|
||||
[anon_sym_false] = ACTIONS(62),
|
||||
[anon_sym_LPAREN] = ACTIONS(13),
|
||||
[anon_sym_RPAREN] = ACTIONS(64),
|
||||
},
|
||||
};
|
||||
|
||||
static const uint16_t ts_small_parse_table[] = {
|
||||
[0] = 8,
|
||||
ACTIONS(5), 1,
|
||||
sym_identifier,
|
||||
[0] = 7,
|
||||
ACTIONS(9), 1,
|
||||
sym_integer,
|
||||
ACTIONS(13), 1,
|
||||
anon_sym_LPAREN,
|
||||
STATE(13), 1,
|
||||
sym_statement,
|
||||
STATE(19), 1,
|
||||
sym_value,
|
||||
ACTIONS(11), 2,
|
||||
anon_sym_true,
|
||||
anon_sym_false,
|
||||
STATE(8), 2,
|
||||
sym_boolean,
|
||||
sym_list,
|
||||
ACTIONS(7), 4,
|
||||
sym_float,
|
||||
sym_string,
|
||||
sym_function,
|
||||
sym_empty,
|
||||
[30] = 8,
|
||||
ACTIONS(9), 1,
|
||||
sym_integer,
|
||||
ACTIONS(13), 1,
|
||||
anon_sym_LPAREN,
|
||||
ACTIONS(36), 1,
|
||||
anon_sym_RPAREN,
|
||||
STATE(6), 1,
|
||||
STATE(9), 1,
|
||||
aux_sym_list_repeat1,
|
||||
STATE(12), 1,
|
||||
STATE(11), 1,
|
||||
sym_value,
|
||||
ACTIONS(34), 2,
|
||||
anon_sym_true,
|
||||
anon_sym_false,
|
||||
STATE(8), 2,
|
||||
sym_boolean,
|
||||
sym_list,
|
||||
ACTIONS(7), 4,
|
||||
sym_float,
|
||||
sym_string,
|
||||
sym_function,
|
||||
sym_empty,
|
||||
[60] = 8,
|
||||
ACTIONS(41), 1,
|
||||
sym_integer,
|
||||
ACTIONS(47), 1,
|
||||
anon_sym_LPAREN,
|
||||
ACTIONS(50), 1,
|
||||
anon_sym_RPAREN,
|
||||
STATE(6), 1,
|
||||
aux_sym_list_repeat1,
|
||||
STATE(12), 1,
|
||||
sym_value,
|
||||
ACTIONS(44), 2,
|
||||
anon_sym_true,
|
||||
anon_sym_false,
|
||||
STATE(8), 2,
|
||||
sym_boolean,
|
||||
sym_list,
|
||||
ACTIONS(38), 4,
|
||||
sym_float,
|
||||
sym_string,
|
||||
sym_function,
|
||||
sym_empty,
|
||||
[90] = 7,
|
||||
ACTIONS(9), 1,
|
||||
sym_integer,
|
||||
ACTIONS(13), 1,
|
||||
anon_sym_LPAREN,
|
||||
STATE(5), 1,
|
||||
aux_sym_list_repeat1,
|
||||
STATE(12), 1,
|
||||
sym_value,
|
||||
ACTIONS(34), 2,
|
||||
anon_sym_true,
|
||||
anon_sym_false,
|
||||
STATE(8), 2,
|
||||
sym_boolean,
|
||||
sym_list,
|
||||
ACTIONS(7), 4,
|
||||
sym_float,
|
||||
sym_string,
|
||||
sym_function,
|
||||
sym_empty,
|
||||
[117] = 2,
|
||||
ACTIONS(54), 2,
|
||||
sym_integer,
|
||||
anon_sym_LPAREN,
|
||||
ACTIONS(52), 9,
|
||||
sym_close,
|
||||
sym_float,
|
||||
sym_string,
|
||||
sym_function,
|
||||
sym_empty,
|
||||
anon_sym_true,
|
||||
anon_sym_false,
|
||||
anon_sym_COMMA,
|
||||
anon_sym_RPAREN,
|
||||
[133] = 2,
|
||||
ACTIONS(58), 2,
|
||||
sym_integer,
|
||||
anon_sym_LPAREN,
|
||||
ACTIONS(56), 9,
|
||||
sym_close,
|
||||
sym_float,
|
||||
sym_string,
|
||||
sym_function,
|
||||
sym_empty,
|
||||
anon_sym_true,
|
||||
anon_sym_false,
|
||||
anon_sym_COMMA,
|
||||
anon_sym_RPAREN,
|
||||
[149] = 2,
|
||||
ACTIONS(62), 2,
|
||||
anon_sym_true,
|
||||
anon_sym_false,
|
||||
STATE(4), 2,
|
||||
sym_boolean,
|
||||
sym_list,
|
||||
ACTIONS(7), 4,
|
||||
sym_float,
|
||||
sym_string,
|
||||
sym_function,
|
||||
sym_empty,
|
||||
[27] = 3,
|
||||
ACTIONS(70), 1,
|
||||
anon_sym_COMMA,
|
||||
ACTIONS(68), 2,
|
||||
sym_integer,
|
||||
anon_sym_LPAREN,
|
||||
ACTIONS(60), 9,
|
||||
sym_close,
|
||||
ACTIONS(66), 7,
|
||||
sym_float,
|
||||
sym_string,
|
||||
sym_function,
|
||||
sym_empty,
|
||||
anon_sym_true,
|
||||
anon_sym_false,
|
||||
anon_sym_COMMA,
|
||||
anon_sym_RPAREN,
|
||||
[165] = 2,
|
||||
ACTIONS(64), 5,
|
||||
[44] = 2,
|
||||
ACTIONS(72), 5,
|
||||
ts_builtin_sym_end,
|
||||
sym_float,
|
||||
sym_string,
|
||||
sym_function,
|
||||
sym_empty,
|
||||
ACTIONS(66), 5,
|
||||
ACTIONS(74), 5,
|
||||
sym_identifier,
|
||||
sym_integer,
|
||||
anon_sym_true,
|
||||
anon_sym_false,
|
||||
anon_sym_LPAREN,
|
||||
[180] = 3,
|
||||
ACTIONS(72), 1,
|
||||
anon_sym_COMMA,
|
||||
ACTIONS(70), 2,
|
||||
sym_integer,
|
||||
anon_sym_LPAREN,
|
||||
ACTIONS(68), 7,
|
||||
sym_float,
|
||||
sym_string,
|
||||
sym_function,
|
||||
sym_empty,
|
||||
anon_sym_true,
|
||||
anon_sym_false,
|
||||
anon_sym_RPAREN,
|
||||
[197] = 2,
|
||||
ACTIONS(74), 5,
|
||||
ts_builtin_sym_end,
|
||||
[59] = 2,
|
||||
ACTIONS(78), 4,
|
||||
sym_float,
|
||||
sym_string,
|
||||
sym_function,
|
||||
@ -757,35 +727,11 @@ static const uint16_t ts_small_parse_table[] = {
|
||||
anon_sym_true,
|
||||
anon_sym_false,
|
||||
anon_sym_LPAREN,
|
||||
[212] = 2,
|
||||
ACTIONS(80), 4,
|
||||
sym_float,
|
||||
sym_string,
|
||||
sym_function,
|
||||
sym_empty,
|
||||
ACTIONS(78), 5,
|
||||
sym_identifier,
|
||||
sym_integer,
|
||||
anon_sym_true,
|
||||
anon_sym_false,
|
||||
anon_sym_LPAREN,
|
||||
[226] = 2,
|
||||
ACTIONS(84), 4,
|
||||
sym_float,
|
||||
sym_string,
|
||||
sym_function,
|
||||
sym_empty,
|
||||
ACTIONS(82), 5,
|
||||
sym_identifier,
|
||||
sym_integer,
|
||||
anon_sym_true,
|
||||
anon_sym_false,
|
||||
anon_sym_LPAREN,
|
||||
[240] = 2,
|
||||
ACTIONS(86), 2,
|
||||
[73] = 2,
|
||||
ACTIONS(80), 2,
|
||||
sym_integer,
|
||||
anon_sym_LPAREN,
|
||||
ACTIONS(50), 7,
|
||||
ACTIONS(60), 7,
|
||||
sym_float,
|
||||
sym_string,
|
||||
sym_function,
|
||||
@ -793,92 +739,111 @@ static const uint16_t ts_small_parse_table[] = {
|
||||
anon_sym_true,
|
||||
anon_sym_false,
|
||||
anon_sym_RPAREN,
|
||||
[254] = 5,
|
||||
ACTIONS(88), 1,
|
||||
[87] = 3,
|
||||
ACTIONS(82), 1,
|
||||
sym_close,
|
||||
STATE(4), 1,
|
||||
STATE(7), 1,
|
||||
sym_operator,
|
||||
STATE(14), 1,
|
||||
sym_assignment,
|
||||
ACTIONS(90), 2,
|
||||
ACTIONS(84), 3,
|
||||
anon_sym_PLUS,
|
||||
anon_sym_DASH,
|
||||
ACTIONS(92), 3,
|
||||
anon_sym_EQ,
|
||||
anon_sym_PLUS_EQ,
|
||||
anon_sym_DASH_EQ,
|
||||
[273] = 1,
|
||||
ACTIONS(94), 1,
|
||||
ts_builtin_sym_end,
|
||||
[277] = 1,
|
||||
[99] = 3,
|
||||
ACTIONS(82), 1,
|
||||
sym_close,
|
||||
STATE(7), 1,
|
||||
sym_operator,
|
||||
ACTIONS(84), 3,
|
||||
anon_sym_PLUS,
|
||||
anon_sym_DASH,
|
||||
anon_sym_EQ,
|
||||
[111] = 3,
|
||||
ACTIONS(86), 1,
|
||||
sym_close,
|
||||
STATE(7), 1,
|
||||
sym_operator,
|
||||
ACTIONS(84), 3,
|
||||
anon_sym_PLUS,
|
||||
anon_sym_DASH,
|
||||
anon_sym_EQ,
|
||||
[123] = 3,
|
||||
ACTIONS(86), 1,
|
||||
sym_close,
|
||||
STATE(7), 1,
|
||||
sym_operator,
|
||||
ACTIONS(84), 3,
|
||||
anon_sym_PLUS,
|
||||
anon_sym_DASH,
|
||||
anon_sym_EQ,
|
||||
[135] = 1,
|
||||
ACTIONS(86), 1,
|
||||
sym_close,
|
||||
[139] = 1,
|
||||
ACTIONS(88), 1,
|
||||
sym_close,
|
||||
[143] = 1,
|
||||
ACTIONS(90), 1,
|
||||
ts_builtin_sym_end,
|
||||
};
|
||||
|
||||
static const uint32_t ts_small_parse_table_map[] = {
|
||||
[SMALL_STATE(4)] = 0,
|
||||
[SMALL_STATE(5)] = 30,
|
||||
[SMALL_STATE(6)] = 60,
|
||||
[SMALL_STATE(7)] = 90,
|
||||
[SMALL_STATE(8)] = 117,
|
||||
[SMALL_STATE(9)] = 133,
|
||||
[SMALL_STATE(10)] = 149,
|
||||
[SMALL_STATE(11)] = 165,
|
||||
[SMALL_STATE(12)] = 180,
|
||||
[SMALL_STATE(13)] = 197,
|
||||
[SMALL_STATE(14)] = 212,
|
||||
[SMALL_STATE(15)] = 226,
|
||||
[SMALL_STATE(16)] = 240,
|
||||
[SMALL_STATE(17)] = 254,
|
||||
[SMALL_STATE(18)] = 273,
|
||||
[SMALL_STATE(19)] = 277,
|
||||
[SMALL_STATE(10)] = 0,
|
||||
[SMALL_STATE(11)] = 27,
|
||||
[SMALL_STATE(12)] = 44,
|
||||
[SMALL_STATE(13)] = 59,
|
||||
[SMALL_STATE(14)] = 73,
|
||||
[SMALL_STATE(15)] = 87,
|
||||
[SMALL_STATE(16)] = 99,
|
||||
[SMALL_STATE(17)] = 111,
|
||||
[SMALL_STATE(18)] = 123,
|
||||
[SMALL_STATE(19)] = 135,
|
||||
[SMALL_STATE(20)] = 139,
|
||||
[SMALL_STATE(21)] = 143,
|
||||
};
|
||||
|
||||
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, 0),
|
||||
[5] = {.entry = {.count = 1, .reusable = false}}, SHIFT(17),
|
||||
[7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8),
|
||||
[9] = {.entry = {.count = 1, .reusable = false}}, SHIFT(8),
|
||||
[11] = {.entry = {.count = 1, .reusable = false}}, SHIFT(9),
|
||||
[13] = {.entry = {.count = 1, .reusable = false}}, SHIFT(7),
|
||||
[15] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source, 1),
|
||||
[17] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_repeat1, 2),
|
||||
[19] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_repeat1, 2), SHIFT_REPEAT(17),
|
||||
[22] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_repeat1, 2), SHIFT_REPEAT(8),
|
||||
[25] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_repeat1, 2), SHIFT_REPEAT(8),
|
||||
[28] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_repeat1, 2), SHIFT_REPEAT(9),
|
||||
[31] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_repeat1, 2), SHIFT_REPEAT(7),
|
||||
[34] = {.entry = {.count = 1, .reusable = true}}, SHIFT(9),
|
||||
[36] = {.entry = {.count = 1, .reusable = true}}, SHIFT(10),
|
||||
[38] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(8),
|
||||
[41] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(8),
|
||||
[44] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(9),
|
||||
[47] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(7),
|
||||
[50] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2),
|
||||
[52] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_value, 1),
|
||||
[54] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_value, 1),
|
||||
[56] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_boolean, 1),
|
||||
[58] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_boolean, 1),
|
||||
[60] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list, 3),
|
||||
[62] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_list, 3),
|
||||
[64] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_statement, 2),
|
||||
[66] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_statement, 2),
|
||||
[68] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 1),
|
||||
[70] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 1),
|
||||
[72] = {.entry = {.count = 1, .reusable = true}}, SHIFT(16),
|
||||
[74] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_statement, 3),
|
||||
[76] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_statement, 3),
|
||||
[78] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_operator, 1),
|
||||
[80] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_operator, 1),
|
||||
[82] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_assignment, 1),
|
||||
[84] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_assignment, 1),
|
||||
[86] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 2),
|
||||
[88] = {.entry = {.count = 1, .reusable = true}}, SHIFT(11),
|
||||
[90] = {.entry = {.count = 1, .reusable = false}}, SHIFT(14),
|
||||
[92] = {.entry = {.count = 1, .reusable = true}}, SHIFT(15),
|
||||
[94] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(),
|
||||
[5] = {.entry = {.count = 1, .reusable = false}}, SHIFT(15),
|
||||
[7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(4),
|
||||
[9] = {.entry = {.count = 1, .reusable = false}}, SHIFT(4),
|
||||
[11] = {.entry = {.count = 1, .reusable = false}}, SHIFT(5),
|
||||
[13] = {.entry = {.count = 1, .reusable = false}}, SHIFT(10),
|
||||
[15] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_repeat1, 2),
|
||||
[17] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_repeat1, 2), SHIFT_REPEAT(15),
|
||||
[20] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_repeat1, 2), SHIFT_REPEAT(4),
|
||||
[23] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_repeat1, 2), SHIFT_REPEAT(4),
|
||||
[26] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_repeat1, 2), SHIFT_REPEAT(5),
|
||||
[29] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_source_repeat1, 2), SHIFT_REPEAT(10),
|
||||
[32] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source, 1),
|
||||
[34] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_value, 1),
|
||||
[36] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_value, 1),
|
||||
[38] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_boolean, 1),
|
||||
[40] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_boolean, 1),
|
||||
[42] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list, 3),
|
||||
[44] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_list, 3),
|
||||
[46] = {.entry = {.count = 1, .reusable = false}}, SHIFT(17),
|
||||
[48] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(4),
|
||||
[51] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(4),
|
||||
[54] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(5),
|
||||
[57] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(10),
|
||||
[60] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2),
|
||||
[62] = {.entry = {.count = 1, .reusable = true}}, SHIFT(5),
|
||||
[64] = {.entry = {.count = 1, .reusable = true}}, SHIFT(6),
|
||||
[66] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 1),
|
||||
[68] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 1),
|
||||
[70] = {.entry = {.count = 1, .reusable = true}}, SHIFT(14),
|
||||
[72] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_statement, 2),
|
||||
[74] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_statement, 2),
|
||||
[76] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_operator, 1),
|
||||
[78] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_operator, 1),
|
||||
[80] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_list_repeat1, 2),
|
||||
[82] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression, 1),
|
||||
[84] = {.entry = {.count = 1, .reusable = true}}, SHIFT(13),
|
||||
[86] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression, 3),
|
||||
[88] = {.entry = {.count = 1, .reusable = true}}, SHIFT(12),
|
||||
[90] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(),
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Loading…
Reference in New Issue
Block a user