diff options
Diffstat (limited to 'src/parse.cpp')
-rw-r--r-- | src/parse.cpp | 740 |
1 files changed, 26 insertions, 714 deletions
diff --git a/src/parse.cpp b/src/parse.cpp index 7c8b1f2..bca53dc 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -163,20 +163,8 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va switch (parser->stack[parser->top].state) { case 0: switch (token) { - case 0: - parser->stack[++parser->top].state = 1; - break; - - case TOK_SYMBOL_LC: - parser->stack[++parser->top].state = 1; - break; - - case '%': - parser->stack[++parser->top].state = 1; - break; - default: - return -1; + parser->stack[++parser->top].state = 1; } break; @@ -202,48 +190,18 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va case 2: switch (token) { - case 0: - parser->top -= 2; - parser->stack[++parser->top].state = 1; - break; - - case TOK_SYMBOL_LC: - parser->top -= 2; - parser->stack[++parser->top].state = 1; - break; - - case '%': + default: parser->top -= 2; parser->stack[++parser->top].state = 1; - break; - - default: - return -1; } break; case 3: switch (token) { - case 0: - parser->top -= 1; - parse_reduce_3(parser->stack[parser->top + 0].value.symbol_rule, grammar); - parser->stack[++parser->top].state = 2; - break; - - case TOK_SYMBOL_LC: - parser->top -= 1; - parse_reduce_3(parser->stack[parser->top + 0].value.symbol_rule, grammar); - parser->stack[++parser->top].state = 2; - break; - - case '%': + default: parser->top -= 1; parse_reduce_3(parser->stack[parser->top + 0].value.symbol_rule, grammar); parser->stack[++parser->top].state = 2; - break; - - default: - return -1; } break; @@ -348,38 +306,9 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va case 11: switch (token) { - case TOK_BLOCK: - parser->stack[parser->top].value.symbol_rhs = parse_reduce_10(grammar); - parser->stack[++parser->top].state = 16; - break; - - case TOK_CHAR: - parser->stack[parser->top].value.symbol_rhs = parse_reduce_10(grammar); - parser->stack[++parser->top].state = 16; - break; - - case TOK_STRING: - parser->stack[parser->top].value.symbol_rhs = parse_reduce_10(grammar); - parser->stack[++parser->top].state = 16; - break; - - case TOK_SYMBOL_LC: - parser->stack[parser->top].value.symbol_rhs = parse_reduce_10(grammar); - parser->stack[++parser->top].state = 16; - break; - - case TOK_SYMBOL_UC: - parser->stack[parser->top].value.symbol_rhs = parse_reduce_10(grammar); - parser->stack[++parser->top].state = 16; - break; - - case ';': + default: parser->stack[parser->top].value.symbol_rhs = parse_reduce_10(grammar); parser->stack[++parser->top].state = 16; - break; - - default: - return -1; } break; @@ -518,461 +447,105 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va case 21: switch (token) { - case 0: - parser->top -= 5; - parser->stack[parser->top].value.symbol_rule = parse_reduce_9(parser->stack[parser->top + 0].value.token.str, parser->stack[parser->top + 3].value.symbol_rhs, parser->stack[parser->top + 4].value.symbol_action, grammar); - parser->stack[++parser->top].state = 3; - break; - - case TOK_SYMBOL_LC: - parser->top -= 5; - parser->stack[parser->top].value.symbol_rule = parse_reduce_9(parser->stack[parser->top + 0].value.token.str, parser->stack[parser->top + 3].value.symbol_rhs, parser->stack[parser->top + 4].value.symbol_action, grammar); - parser->stack[++parser->top].state = 3; - break; - - case '%': + default: parser->top -= 5; parser->stack[parser->top].value.symbol_rule = parse_reduce_9(parser->stack[parser->top + 0].value.token.str, parser->stack[parser->top + 3].value.symbol_rhs, parser->stack[parser->top + 4].value.symbol_action, grammar); parser->stack[++parser->top].state = 3; - break; - - default: - return -1; } break; case 22: switch (token) { - case TOK_BLOCK: - parser->top -= 2; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_11(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.symbol_symbol, grammar); - parser->stack[++parser->top].state = 16; - break; - - case TOK_CHAR: - parser->top -= 2; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_11(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.symbol_symbol, grammar); - parser->stack[++parser->top].state = 16; - break; - - case TOK_STRING: - parser->top -= 2; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_11(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.symbol_symbol, grammar); - parser->stack[++parser->top].state = 16; - break; - - case TOK_SYMBOL_LC: - parser->top -= 2; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_11(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.symbol_symbol, grammar); - parser->stack[++parser->top].state = 16; - break; - - case TOK_SYMBOL_UC: - parser->top -= 2; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_11(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.symbol_symbol, grammar); - parser->stack[++parser->top].state = 16; - break; - case '(': parser->stack[parser->top].value.token = *value; parser->stack[++parser->top].state = 34; return 1; - case ';': + default: parser->top -= 2; parser->stack[parser->top].value.symbol_rhs = parse_reduce_11(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.symbol_symbol, grammar); parser->stack[++parser->top].state = 16; - break; - - default: - return -1; } break; case 23: switch (token) { - case TOK_BLOCK: - parser->top -= 1; - parser->stack[parser->top].value.symbol_symbol = parse_reduce_16(parser->stack[parser->top + 0].value.symbol_term, grammar); - parser->stack[++parser->top].state = 22; - break; - - case TOK_CHAR: - parser->top -= 1; - parser->stack[parser->top].value.symbol_symbol = parse_reduce_16(parser->stack[parser->top + 0].value.symbol_term, grammar); - parser->stack[++parser->top].state = 22; - break; - - case TOK_STRING: - parser->top -= 1; - parser->stack[parser->top].value.symbol_symbol = parse_reduce_16(parser->stack[parser->top + 0].value.symbol_term, grammar); - parser->stack[++parser->top].state = 22; - break; - - case TOK_SYMBOL_LC: - parser->top -= 1; - parser->stack[parser->top].value.symbol_symbol = parse_reduce_16(parser->stack[parser->top + 0].value.symbol_term, grammar); - parser->stack[++parser->top].state = 22; - break; - - case TOK_SYMBOL_UC: - parser->top -= 1; - parser->stack[parser->top].value.symbol_symbol = parse_reduce_16(parser->stack[parser->top + 0].value.symbol_term, grammar); - parser->stack[++parser->top].state = 22; - break; - - case '(': - parser->top -= 1; - parser->stack[parser->top].value.symbol_symbol = parse_reduce_16(parser->stack[parser->top + 0].value.symbol_term, grammar); - parser->stack[++parser->top].state = 22; - break; - - case ';': + default: parser->top -= 1; parser->stack[parser->top].value.symbol_symbol = parse_reduce_16(parser->stack[parser->top + 0].value.symbol_term, grammar); parser->stack[++parser->top].state = 22; - break; - - default: - return -1; } break; case 24: switch (token) { - case 0: - parser->top -= 1; - parser->stack[parser->top].value.symbol_action = parse_reduce_15(parser->stack[parser->top + 0].value.token.str, grammar); - parser->stack[++parser->top].state = 21; - break; - - case TOK_SYMBOL_LC: - parser->top -= 1; - parser->stack[parser->top].value.symbol_action = parse_reduce_15(parser->stack[parser->top + 0].value.token.str, grammar); - parser->stack[++parser->top].state = 21; - break; - - case '%': + default: parser->top -= 1; parser->stack[parser->top].value.symbol_action = parse_reduce_15(parser->stack[parser->top + 0].value.token.str, grammar); parser->stack[++parser->top].state = 21; - break; - - default: - return -1; } break; case 25: switch (token) { - case TOK_BLOCK: - parser->top -= 1; - parser->stack[parser->top].value.symbol_term = parse_reduce_19(parser->stack[parser->top + 0].value.token.c, grammar); - switch (parser->stack[parser->top].state) { - case 16: - parser->stack[++parser->top].state = 23; - break; - case 33: - parser->stack[++parser->top].state = 38; - break; - } - break; - - case TOK_CHAR: - parser->top -= 1; - parser->stack[parser->top].value.symbol_term = parse_reduce_19(parser->stack[parser->top + 0].value.token.c, grammar); - switch (parser->stack[parser->top].state) { - case 16: - parser->stack[++parser->top].state = 23; - break; - case 33: - parser->stack[++parser->top].state = 38; - break; - } - break; - - case TOK_STRING: - parser->top -= 1; - parser->stack[parser->top].value.symbol_term = parse_reduce_19(parser->stack[parser->top + 0].value.token.c, grammar); - switch (parser->stack[parser->top].state) { - case 16: - parser->stack[++parser->top].state = 23; - break; - case 33: - parser->stack[++parser->top].state = 38; - break; - } - break; - - case TOK_SYMBOL_LC: - parser->top -= 1; - parser->stack[parser->top].value.symbol_term = parse_reduce_19(parser->stack[parser->top + 0].value.token.c, grammar); - switch (parser->stack[parser->top].state) { - case 16: - parser->stack[++parser->top].state = 23; - break; - case 33: - parser->stack[++parser->top].state = 38; - break; - } - break; - - case TOK_SYMBOL_UC: + default: parser->top -= 1; parser->stack[parser->top].value.symbol_term = parse_reduce_19(parser->stack[parser->top + 0].value.token.c, grammar); switch (parser->stack[parser->top].state) { case 16: parser->stack[++parser->top].state = 23; break; - case 33: - parser->stack[++parser->top].state = 38; - break; - } - break; - case '(': - parser->top -= 1; - parser->stack[parser->top].value.symbol_term = parse_reduce_19(parser->stack[parser->top + 0].value.token.c, grammar); - switch (parser->stack[parser->top].state) { - case 16: - parser->stack[++parser->top].state = 23; - break; case 33: parser->stack[++parser->top].state = 38; break; - } - break; - case ';': - parser->top -= 1; - parser->stack[parser->top].value.symbol_term = parse_reduce_19(parser->stack[parser->top + 0].value.token.c, grammar); - switch (parser->stack[parser->top].state) { - case 16: - parser->stack[++parser->top].state = 23; - break; - case 33: - parser->stack[++parser->top].state = 38; - break; } - break; - - default: - return -1; } break; case 26: switch (token) { - case TOK_BLOCK: - parser->top -= 2; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_13(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.token.str, grammar); - parser->stack[++parser->top].state = 16; - break; - - case TOK_CHAR: - parser->top -= 2; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_13(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.token.str, grammar); - parser->stack[++parser->top].state = 16; - break; - - case TOK_STRING: - parser->top -= 2; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_13(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.token.str, grammar); - parser->stack[++parser->top].state = 16; - break; - - case TOK_SYMBOL_LC: - parser->top -= 2; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_13(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.token.str, grammar); - parser->stack[++parser->top].state = 16; - break; - - case TOK_SYMBOL_UC: - parser->top -= 2; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_13(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.token.str, grammar); - parser->stack[++parser->top].state = 16; - break; - - case ';': + default: parser->top -= 2; parser->stack[parser->top].value.symbol_rhs = parse_reduce_13(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.token.str, grammar); parser->stack[++parser->top].state = 16; - break; - - default: - return -1; } break; case 27: switch (token) { - case TOK_BLOCK: - parser->top -= 1; - parser->stack[parser->top].value.symbol_symbol = parse_reduce_17(parser->stack[parser->top + 0].value.token.str, grammar); - parser->stack[++parser->top].state = 22; - break; - - case TOK_CHAR: - parser->top -= 1; - parser->stack[parser->top].value.symbol_symbol = parse_reduce_17(parser->stack[parser->top + 0].value.token.str, grammar); - parser->stack[++parser->top].state = 22; - break; - - case TOK_STRING: - parser->top -= 1; - parser->stack[parser->top].value.symbol_symbol = parse_reduce_17(parser->stack[parser->top + 0].value.token.str, grammar); - parser->stack[++parser->top].state = 22; - break; - - case TOK_SYMBOL_LC: - parser->top -= 1; - parser->stack[parser->top].value.symbol_symbol = parse_reduce_17(parser->stack[parser->top + 0].value.token.str, grammar); - parser->stack[++parser->top].state = 22; - break; - - case TOK_SYMBOL_UC: - parser->top -= 1; - parser->stack[parser->top].value.symbol_symbol = parse_reduce_17(parser->stack[parser->top + 0].value.token.str, grammar); - parser->stack[++parser->top].state = 22; - break; - - case '(': - parser->top -= 1; - parser->stack[parser->top].value.symbol_symbol = parse_reduce_17(parser->stack[parser->top + 0].value.token.str, grammar); - parser->stack[++parser->top].state = 22; - break; - - case ';': + default: parser->top -= 1; parser->stack[parser->top].value.symbol_symbol = parse_reduce_17(parser->stack[parser->top + 0].value.token.str, grammar); parser->stack[++parser->top].state = 22; - break; - - default: - return -1; } break; case 28: switch (token) { - case TOK_BLOCK: - parser->top -= 1; - parser->stack[parser->top].value.symbol_term = parse_reduce_18(parser->stack[parser->top + 0].value.token.str, grammar); - switch (parser->stack[parser->top].state) { - case 16: - parser->stack[++parser->top].state = 23; - break; - case 33: - parser->stack[++parser->top].state = 38; - break; - } - break; - - case TOK_CHAR: - parser->top -= 1; - parser->stack[parser->top].value.symbol_term = parse_reduce_18(parser->stack[parser->top + 0].value.token.str, grammar); - switch (parser->stack[parser->top].state) { - case 16: - parser->stack[++parser->top].state = 23; - break; - case 33: - parser->stack[++parser->top].state = 38; - break; - } - break; - - case TOK_STRING: + default: parser->top -= 1; parser->stack[parser->top].value.symbol_term = parse_reduce_18(parser->stack[parser->top + 0].value.token.str, grammar); switch (parser->stack[parser->top].state) { case 16: parser->stack[++parser->top].state = 23; break; - case 33: - parser->stack[++parser->top].state = 38; - break; - } - break; - case TOK_SYMBOL_LC: - parser->top -= 1; - parser->stack[parser->top].value.symbol_term = parse_reduce_18(parser->stack[parser->top + 0].value.token.str, grammar); - switch (parser->stack[parser->top].state) { - case 16: - parser->stack[++parser->top].state = 23; - break; case 33: parser->stack[++parser->top].state = 38; break; - } - break; - case TOK_SYMBOL_UC: - parser->top -= 1; - parser->stack[parser->top].value.symbol_term = parse_reduce_18(parser->stack[parser->top + 0].value.token.str, grammar); - switch (parser->stack[parser->top].state) { - case 16: - parser->stack[++parser->top].state = 23; - break; - case 33: - parser->stack[++parser->top].state = 38; - break; - } - break; - - case '(': - parser->top -= 1; - parser->stack[parser->top].value.symbol_term = parse_reduce_18(parser->stack[parser->top + 0].value.token.str, grammar); - switch (parser->stack[parser->top].state) { - case 16: - parser->stack[++parser->top].state = 23; - break; - case 33: - parser->stack[++parser->top].state = 38; - break; } - break; - - case ';': - parser->top -= 1; - parser->stack[parser->top].value.symbol_term = parse_reduce_18(parser->stack[parser->top + 0].value.token.str, grammar); - switch (parser->stack[parser->top].state) { - case 16: - parser->stack[++parser->top].state = 23; - break; - case 33: - parser->stack[++parser->top].state = 38; - break; - } - break; - - default: - return -1; } break; case 29: switch (token) { - case 0: - parser->top -= 1; - parser->stack[parser->top].value.symbol_action = parse_reduce_14(grammar); - parser->stack[++parser->top].state = 21; - break; - - case TOK_SYMBOL_LC: - parser->top -= 1; - parser->stack[parser->top].value.symbol_action = parse_reduce_14(grammar); - parser->stack[++parser->top].state = 21; - break; - - case '%': + default: parser->top -= 1; parser->stack[parser->top].value.symbol_action = parse_reduce_14(grammar); parser->stack[++parser->top].state = 21; - break; - - default: - return -1; } break; @@ -1019,14 +592,14 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va parser->stack[++parser->top].state = 25; return 1; - case TOK_SYMBOL_LC: + case TOK_SYMBOL_UC: parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 39; + parser->stack[++parser->top].state = 28; return 1; - case TOK_SYMBOL_UC: + case TOK_SYMBOL_LC: parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 28; + parser->stack[++parser->top].state = 39; return 1; default: @@ -1130,214 +703,67 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va case 41: switch (token) { - case 0: + default: parser->top -= 1; parser->stack[parser->top].value.symbol_varname = parse_reduce_22(parser->stack[parser->top + 0].value.token.str, grammar); switch (parser->stack[parser->top].state) { case 34: parser->stack[++parser->top].state = 40; break; - case 47: - parser->stack[++parser->top].state = 53; - break; - case 56: - parser->stack[++parser->top].state = 57; - break; - } - break; - case TOK_SYMBOL_LC: - parser->top -= 1; - parser->stack[parser->top].value.symbol_varname = parse_reduce_22(parser->stack[parser->top + 0].value.token.str, grammar); - switch (parser->stack[parser->top].state) { - case 34: - parser->stack[++parser->top].state = 40; - break; case 47: parser->stack[++parser->top].state = 53; break; - case 56: - parser->stack[++parser->top].state = 57; - break; - } - break; - case '%': - parser->top -= 1; - parser->stack[parser->top].value.symbol_varname = parse_reduce_22(parser->stack[parser->top + 0].value.token.str, grammar); - switch (parser->stack[parser->top].state) { - case 34: - parser->stack[++parser->top].state = 40; - break; - case 47: - parser->stack[++parser->top].state = 53; - break; case 56: parser->stack[++parser->top].state = 57; break; - } - break; - case ')': - parser->top -= 1; - parser->stack[parser->top].value.symbol_varname = parse_reduce_22(parser->stack[parser->top + 0].value.token.str, grammar); - switch (parser->stack[parser->top].state) { - case 34: - parser->stack[++parser->top].state = 40; - break; - case 47: - parser->stack[++parser->top].state = 53; - break; - case 56: - parser->stack[++parser->top].state = 57; - break; } - break; - - default: - return -1; } break; case 42: switch (token) { - case 0: + default: parser->top -= 1; parser->stack[parser->top].value.symbol_varname = parse_reduce_20(parser->stack[parser->top + 0].value.token.str, grammar); switch (parser->stack[parser->top].state) { case 34: parser->stack[++parser->top].state = 40; break; - case 47: - parser->stack[++parser->top].state = 53; - break; - case 56: - parser->stack[++parser->top].state = 57; - break; - } - break; - case TOK_SYMBOL_LC: - parser->top -= 1; - parser->stack[parser->top].value.symbol_varname = parse_reduce_20(parser->stack[parser->top + 0].value.token.str, grammar); - switch (parser->stack[parser->top].state) { - case 34: - parser->stack[++parser->top].state = 40; - break; case 47: parser->stack[++parser->top].state = 53; break; - case 56: - parser->stack[++parser->top].state = 57; - break; - } - break; - case '%': - parser->top -= 1; - parser->stack[parser->top].value.symbol_varname = parse_reduce_20(parser->stack[parser->top + 0].value.token.str, grammar); - switch (parser->stack[parser->top].state) { - case 34: - parser->stack[++parser->top].state = 40; - break; - case 47: - parser->stack[++parser->top].state = 53; - break; case 56: parser->stack[++parser->top].state = 57; break; - } - break; - case ')': - parser->top -= 1; - parser->stack[parser->top].value.symbol_varname = parse_reduce_20(parser->stack[parser->top + 0].value.token.str, grammar); - switch (parser->stack[parser->top].state) { - case 34: - parser->stack[++parser->top].state = 40; - break; - case 47: - parser->stack[++parser->top].state = 53; - break; - case 56: - parser->stack[++parser->top].state = 57; - break; } - break; - - default: - return -1; } break; case 43: switch (token) { - case 0: + default: parser->top -= 1; parser->stack[parser->top].value.symbol_varname = parse_reduce_21(parser->stack[parser->top + 0].value.token.str, grammar); switch (parser->stack[parser->top].state) { case 34: parser->stack[++parser->top].state = 40; break; - case 47: - parser->stack[++parser->top].state = 53; - break; - case 56: - parser->stack[++parser->top].state = 57; - break; - } - break; - case TOK_SYMBOL_LC: - parser->top -= 1; - parser->stack[parser->top].value.symbol_varname = parse_reduce_21(parser->stack[parser->top + 0].value.token.str, grammar); - switch (parser->stack[parser->top].state) { - case 34: - parser->stack[++parser->top].state = 40; - break; case 47: parser->stack[++parser->top].state = 53; break; - case 56: - parser->stack[++parser->top].state = 57; - break; - } - break; - case '%': - parser->top -= 1; - parser->stack[parser->top].value.symbol_varname = parse_reduce_21(parser->stack[parser->top + 0].value.token.str, grammar); - switch (parser->stack[parser->top].state) { - case 34: - parser->stack[++parser->top].state = 40; - break; - case 47: - parser->stack[++parser->top].state = 53; - break; case 56: parser->stack[++parser->top].state = 57; break; - } - break; - case ')': - parser->top -= 1; - parser->stack[parser->top].value.symbol_varname = parse_reduce_21(parser->stack[parser->top + 0].value.token.str, grammar); - switch (parser->stack[parser->top].state) { - case 34: - parser->stack[++parser->top].state = 40; - break; - case 47: - parser->stack[++parser->top].state = 53; - break; - case 56: - parser->stack[++parser->top].state = 57; - break; } - break; - - default: - return -1; } break; @@ -1401,69 +827,19 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va case 48: switch (token) { - case 0: - parser->top -= 7; - parse_reduce_4(parser->stack[parser->top + 5].value.token.str, parser->stack[parser->top + 6].value.token.str, grammar); - parser->stack[++parser->top].state = 2; - break; - - case TOK_SYMBOL_LC: - parser->top -= 7; - parse_reduce_4(parser->stack[parser->top + 5].value.token.str, parser->stack[parser->top + 6].value.token.str, grammar); - parser->stack[++parser->top].state = 2; - break; - - case '%': + default: parser->top -= 7; parse_reduce_4(parser->stack[parser->top + 5].value.token.str, parser->stack[parser->top + 6].value.token.str, grammar); parser->stack[++parser->top].state = 2; - break; - - default: - return -1; } break; case 49: switch (token) { - case TOK_BLOCK: - parser->top -= 5; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_12(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.symbol_symbol, parser->stack[parser->top + 3].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 16; - break; - - case TOK_CHAR: - parser->top -= 5; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_12(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.symbol_symbol, parser->stack[parser->top + 3].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 16; - break; - - case TOK_STRING: - parser->top -= 5; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_12(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.symbol_symbol, parser->stack[parser->top + 3].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 16; - break; - - case TOK_SYMBOL_LC: - parser->top -= 5; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_12(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.symbol_symbol, parser->stack[parser->top + 3].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 16; - break; - - case TOK_SYMBOL_UC: - parser->top -= 5; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_12(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.symbol_symbol, parser->stack[parser->top + 3].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 16; - break; - - case ';': + default: parser->top -= 5; parser->stack[parser->top].value.symbol_rhs = parse_reduce_12(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.symbol_symbol, parser->stack[parser->top + 3].value.symbol_varname, grammar); parser->stack[++parser->top].state = 16; - break; - - default: - return -1; } break; @@ -1481,76 +857,28 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va case 51: switch (token) { - case 0: - parser->top -= 8; - parse_reduce_7(parser->stack[parser->top + 7].value.token.str, grammar); - parser->stack[++parser->top].state = 2; - break; - - case TOK_SYMBOL_LC: - parser->top -= 8; - parse_reduce_7(parser->stack[parser->top + 7].value.token.str, grammar); - parser->stack[++parser->top].state = 2; - break; - - case '%': + default: parser->top -= 8; parse_reduce_7(parser->stack[parser->top + 7].value.token.str, grammar); parser->stack[++parser->top].state = 2; - break; - - default: - return -1; } break; case 52: switch (token) { - case 0: - parser->top -= 8; - parse_reduce_6(parser->stack[parser->top + 7].value.token.str, grammar); - parser->stack[++parser->top].state = 2; - break; - - case TOK_SYMBOL_LC: - parser->top -= 8; - parse_reduce_6(parser->stack[parser->top + 7].value.token.str, grammar); - parser->stack[++parser->top].state = 2; - break; - - case '%': + default: parser->top -= 8; parse_reduce_6(parser->stack[parser->top + 7].value.token.str, grammar); parser->stack[++parser->top].state = 2; - break; - - default: - return -1; } break; case 53: switch (token) { - case 0: - parser->top -= 8; - parse_reduce_5(parser->stack[parser->top + 5].value.symbol_term, parser->stack[parser->top + 6].value.token.str, parser->stack[parser->top + 7].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 2; - break; - - case TOK_SYMBOL_LC: - parser->top -= 8; - parse_reduce_5(parser->stack[parser->top + 5].value.symbol_term, parser->stack[parser->top + 6].value.token.str, parser->stack[parser->top + 7].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 2; - break; - - case '%': + default: parser->top -= 8; parse_reduce_5(parser->stack[parser->top + 5].value.symbol_term, parser->stack[parser->top + 6].value.token.str, parser->stack[parser->top + 7].value.symbol_varname, grammar); parser->stack[++parser->top].state = 2; - break; - - default: - return -1; } break; @@ -1602,26 +930,10 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va case 57: switch (token) { - case 0: - parser->top -= 12; - parse_reduce_8(parser->stack[parser->top + 10].value.token.str, parser->stack[parser->top + 11].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 2; - break; - - case TOK_SYMBOL_LC: - parser->top -= 12; - parse_reduce_8(parser->stack[parser->top + 10].value.token.str, parser->stack[parser->top + 11].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 2; - break; - - case '%': + default: parser->top -= 12; parse_reduce_8(parser->stack[parser->top + 10].value.token.str, parser->stack[parser->top + 11].value.symbol_varname, grammar); parser->stack[++parser->top].state = 2; - break; - - default: - return -1; } break; |