diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/parse.cpp | 1047 | ||||
-rw-r--r-- | src/parse.y | 13 |
2 files changed, 549 insertions, 511 deletions
diff --git a/src/parse.cpp b/src/parse.cpp index b68943d..d09522c 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -32,7 +32,7 @@ void parse_free(parse_context_t *parser, void (*free_func)(void *)) { free_func(parser); } -static inline void parse_reduce_2(solar::rule_t * rule, __attribute__((unused)) solar::grammar_t * grammar) { +static inline void parse_reduce_3(solar::rule_t * rule, __attribute__((unused)) solar::grammar_t * grammar) { if (grammar->rules.empty()) { solar::item_t init(""); init.get_rhs().push_back(solar::symbol_t::make_nonterm(rule->item.get_lhs().c_str())); @@ -43,14 +43,14 @@ static inline void parse_reduce_2(solar::rule_t * rule, __attribute__((unused)) delete rule; } -static inline void parse_reduce_3(std::string * nonterm, std::string * type, __attribute__((unused)) solar::grammar_t * grammar) { +static inline void parse_reduce_4(std::string * nonterm, std::string * type, __attribute__((unused)) solar::grammar_t * grammar) { grammar->nonterm_types.insert(std::make_pair(*nonterm, *type)); delete nonterm; delete type; } -static inline void parse_reduce_4(solar::symbol_t * term, std::string * type, std::string * name, __attribute__((unused)) solar::grammar_t * grammar) { +static inline void parse_reduce_5(solar::symbol_t * term, std::string * type, std::string * name, __attribute__((unused)) solar::grammar_t * grammar) { grammar->term_types.insert(std::make_pair(*term, std::make_pair(*type, *name))); delete term; @@ -58,24 +58,24 @@ static inline void parse_reduce_4(solar::symbol_t * term, std::string * type, st delete name; } -static inline void parse_reduce_5(std::string * block, __attribute__((unused)) solar::grammar_t * grammar) { +static inline void parse_reduce_6(std::string * block, __attribute__((unused)) solar::grammar_t * grammar) { grammar->source_block = *block; delete block; } -static inline void parse_reduce_6(std::string * block, __attribute__((unused)) solar::grammar_t * grammar) { +static inline void parse_reduce_7(std::string * block, __attribute__((unused)) solar::grammar_t * grammar) { grammar->header_block = *block; delete block; } -static inline void parse_reduce_7(std::string * type, std::string * name, __attribute__((unused)) solar::grammar_t * grammar) { +static inline void parse_reduce_8(std::string * type, std::string * name, __attribute__((unused)) solar::grammar_t * grammar) { grammar->extra_args.push_back(std::make_pair(*type, *name)); delete type; delete name; } -static inline solar::rule_t * parse_reduce_8(std::string * lhs, std::pair<std::vector<solar::symbol_t>, std::vector<std::string>> * rhs, std::string * action, __attribute__((unused)) solar::grammar_t * grammar) { +static inline solar::rule_t * parse_reduce_9(std::string * lhs, std::pair<std::vector<solar::symbol_t>, std::vector<std::string>> * rhs, std::string * action, __attribute__((unused)) solar::grammar_t * grammar) { auto *ret = new solar::rule_t {solar::item_t(*lhs, rhs->first), rhs->second, *action}; delete lhs; @@ -85,11 +85,11 @@ static inline solar::rule_t * parse_reduce_8(std::string * lhs, std::pair<std::v return ret; } -static inline std::pair<std::vector<solar::symbol_t>, std::vector<std::string>> * parse_reduce_9(__attribute__((unused)) solar::grammar_t * grammar) { +static inline std::pair<std::vector<solar::symbol_t>, std::vector<std::string>> * parse_reduce_10(__attribute__((unused)) solar::grammar_t * grammar) { return new std::pair<std::vector<solar::symbol_t>, std::vector<std::string>>(); } -static inline std::pair<std::vector<solar::symbol_t>, std::vector<std::string>> * parse_reduce_10(std::pair<std::vector<solar::symbol_t>, std::vector<std::string>> * rhs, solar::symbol_t * sym, __attribute__((unused)) solar::grammar_t * grammar) { +static inline std::pair<std::vector<solar::symbol_t>, std::vector<std::string>> * parse_reduce_11(std::pair<std::vector<solar::symbol_t>, std::vector<std::string>> * rhs, solar::symbol_t * sym, __attribute__((unused)) solar::grammar_t * grammar) { rhs->first.push_back(*sym); rhs->second.emplace_back(); delete sym; @@ -97,7 +97,7 @@ static inline std::pair<std::vector<solar::symbol_t>, std::vector<std::string>> return rhs; } -static inline std::pair<std::vector<solar::symbol_t>, std::vector<std::string>> * parse_reduce_11(std::pair<std::vector<solar::symbol_t>, std::vector<std::string>> * rhs, solar::symbol_t * sym, std::string * var, __attribute__((unused)) solar::grammar_t * grammar) { +static inline std::pair<std::vector<solar::symbol_t>, std::vector<std::string>> * parse_reduce_12(std::pair<std::vector<solar::symbol_t>, std::vector<std::string>> * rhs, solar::symbol_t * sym, std::string * var, __attribute__((unused)) solar::grammar_t * grammar) { rhs->first.push_back(*sym); rhs->second.push_back(*var); @@ -107,7 +107,7 @@ static inline std::pair<std::vector<solar::symbol_t>, std::vector<std::string>> return rhs; } -static inline std::pair<std::vector<solar::symbol_t>, std::vector<std::string>> * parse_reduce_12(std::pair<std::vector<solar::symbol_t>, std::vector<std::string>> * rhs, std::string * str, __attribute__((unused)) solar::grammar_t * grammar) { +static inline std::pair<std::vector<solar::symbol_t>, std::vector<std::string>> * parse_reduce_13(std::pair<std::vector<solar::symbol_t>, std::vector<std::string>> * rhs, std::string * str, __attribute__((unused)) solar::grammar_t * grammar) { for (char c : *str) { rhs->first.push_back(solar::symbol_t::make_char(c)); rhs->second.emplace_back(); @@ -118,43 +118,43 @@ static inline std::pair<std::vector<solar::symbol_t>, std::vector<std::string>> return rhs; } -static inline std::string * parse_reduce_13(__attribute__((unused)) solar::grammar_t * grammar) { +static inline std::string * parse_reduce_14(__attribute__((unused)) solar::grammar_t * grammar) { return new std::string; } -static inline std::string * parse_reduce_14(std::string * v, __attribute__((unused)) solar::grammar_t * grammar) { +static inline std::string * parse_reduce_15(std::string * v, __attribute__((unused)) solar::grammar_t * grammar) { return v; } -static inline solar::symbol_t * parse_reduce_15(solar::symbol_t * v, __attribute__((unused)) solar::grammar_t * grammar) { +static inline solar::symbol_t * parse_reduce_16(solar::symbol_t * v, __attribute__((unused)) solar::grammar_t * grammar) { return v; } -static inline solar::symbol_t * parse_reduce_16(std::string * v, __attribute__((unused)) solar::grammar_t * grammar) { +static inline solar::symbol_t * parse_reduce_17(std::string * v, __attribute__((unused)) solar::grammar_t * grammar) { solar::symbol_t *ret = new solar::symbol_t(solar::symbol_t::make_nonterm(*v)); delete v; return ret; } -static inline solar::symbol_t * parse_reduce_17(std::string * v, __attribute__((unused)) solar::grammar_t * grammar) { +static inline solar::symbol_t * parse_reduce_18(std::string * v, __attribute__((unused)) solar::grammar_t * grammar) { solar::symbol_t *ret = new solar::symbol_t(solar::symbol_t::make_term(*v)); delete v; return ret; } -static inline solar::symbol_t * parse_reduce_18(char v, __attribute__((unused)) solar::grammar_t * grammar) { +static inline solar::symbol_t * parse_reduce_19(char v, __attribute__((unused)) solar::grammar_t * grammar) { return new solar::symbol_t(solar::symbol_t::make_char(v)); } -static inline std::string * parse_reduce_19(std::string * v, __attribute__((unused)) solar::grammar_t * grammar) { +static inline std::string * parse_reduce_20(std::string * v, __attribute__((unused)) solar::grammar_t * grammar) { return v; } -static inline std::string * parse_reduce_20(std::string * v, __attribute__((unused)) solar::grammar_t * grammar) { +static inline std::string * parse_reduce_21(std::string * v, __attribute__((unused)) solar::grammar_t * grammar) { return v; } -static inline std::string * parse_reduce_21(std::string * v, __attribute__((unused)) solar::grammar_t * grammar) { +static inline std::string * parse_reduce_22(std::string * v, __attribute__((unused)) solar::grammar_t * grammar) { return v; } @@ -199,27 +199,27 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va case TOK_EXTRA_ARG: parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 3; + parser->stack[++parser->top].state = 4; return 1; case TOK_HEADER: parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 4; + parser->stack[++parser->top].state = 5; return 1; case TOK_SOURCE: parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 5; + parser->stack[++parser->top].state = 6; return 1; case TOK_SYMBOL_LC: parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 6; + parser->stack[++parser->top].state = 7; return 1; case TOK_TYPE: parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 7; + parser->stack[++parser->top].state = 8; return 1; default: @@ -231,37 +231,31 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va switch (token) { case 0: parser->top -= 2; - parse_reduce_2(parser->stack[parser->top + 1].value.symbol_rule, grammar); parser->stack[++parser->top].state = 1; break; case TOK_EXTRA_ARG: parser->top -= 2; - parse_reduce_2(parser->stack[parser->top + 1].value.symbol_rule, grammar); parser->stack[++parser->top].state = 1; break; case TOK_HEADER: parser->top -= 2; - parse_reduce_2(parser->stack[parser->top + 1].value.symbol_rule, grammar); parser->stack[++parser->top].state = 1; break; case TOK_SOURCE: parser->top -= 2; - parse_reduce_2(parser->stack[parser->top + 1].value.symbol_rule, grammar); parser->stack[++parser->top].state = 1; break; case TOK_SYMBOL_LC: parser->top -= 2; - parse_reduce_2(parser->stack[parser->top + 1].value.symbol_rule, grammar); parser->stack[++parser->top].state = 1; break; case TOK_TYPE: parser->top -= 2; - parse_reduce_2(parser->stack[parser->top + 1].value.symbol_rule, grammar); parser->stack[++parser->top].state = 1; break; @@ -272,10 +266,41 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va case 3: switch (token) { - case TOK_BLOCK: - parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 8; - return 1; + 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_EXTRA_ARG: + parser->top -= 1; + parse_reduce_3(parser->stack[parser->top + 0].value.symbol_rule, grammar); + parser->stack[++parser->top].state = 2; + break; + + case TOK_HEADER: + parser->top -= 1; + parse_reduce_3(parser->stack[parser->top + 0].value.symbol_rule, grammar); + parser->stack[++parser->top].state = 2; + break; + + case TOK_SOURCE: + 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 TOK_TYPE: + 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; @@ -308,7 +333,7 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va case 6: switch (token) { - case '|': + case TOK_BLOCK: parser->stack[parser->top].value.token = *value; parser->stack[++parser->top].state = 11; return 1; @@ -320,19 +345,31 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va case 7: switch (token) { + case '|': + parser->stack[parser->top].value.token = *value; + parser->stack[++parser->top].state = 12; + return 1; + + default: + return -1; + } + break; + + case 8: + switch (token) { case TOK_CHAR: parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 13; + parser->stack[++parser->top].state = 14; return 1; case TOK_SYMBOL_LC: parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 14; + parser->stack[++parser->top].state = 15; return 1; case TOK_SYMBOL_UC: parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 15; + parser->stack[++parser->top].state = 16; return 1; default: @@ -340,21 +377,21 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 8: + case 9: switch (token) { case TOK_SYMBOL: parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 17; + parser->stack[++parser->top].state = 18; return 1; case TOK_SYMBOL_LC: parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 18; + parser->stack[++parser->top].state = 19; return 1; case TOK_SYMBOL_UC: parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 19; + parser->stack[++parser->top].state = 20; return 1; default: @@ -362,42 +399,42 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 9: + case 10: switch (token) { case 0: - parser->top -= 3; - parse_reduce_6(parser->stack[parser->top + 2].value.token.str, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 2; + parse_reduce_7(parser->stack[parser->top + 1].value.token.str, grammar); + parser->stack[++parser->top].state = 2; break; case TOK_EXTRA_ARG: - parser->top -= 3; - parse_reduce_6(parser->stack[parser->top + 2].value.token.str, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 2; + parse_reduce_7(parser->stack[parser->top + 1].value.token.str, grammar); + parser->stack[++parser->top].state = 2; break; case TOK_HEADER: - parser->top -= 3; - parse_reduce_6(parser->stack[parser->top + 2].value.token.str, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 2; + parse_reduce_7(parser->stack[parser->top + 1].value.token.str, grammar); + parser->stack[++parser->top].state = 2; break; case TOK_SOURCE: - parser->top -= 3; - parse_reduce_6(parser->stack[parser->top + 2].value.token.str, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 2; + parse_reduce_7(parser->stack[parser->top + 1].value.token.str, grammar); + parser->stack[++parser->top].state = 2; break; case TOK_SYMBOL_LC: - parser->top -= 3; - parse_reduce_6(parser->stack[parser->top + 2].value.token.str, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 2; + parse_reduce_7(parser->stack[parser->top + 1].value.token.str, grammar); + parser->stack[++parser->top].state = 2; break; case TOK_TYPE: - parser->top -= 3; - parse_reduce_6(parser->stack[parser->top + 2].value.token.str, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 2; + parse_reduce_7(parser->stack[parser->top + 1].value.token.str, grammar); + parser->stack[++parser->top].state = 2; break; default: @@ -405,42 +442,42 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 10: + case 11: switch (token) { case 0: - parser->top -= 3; - parse_reduce_5(parser->stack[parser->top + 2].value.token.str, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 2; + parse_reduce_6(parser->stack[parser->top + 1].value.token.str, grammar); + parser->stack[++parser->top].state = 2; break; case TOK_EXTRA_ARG: - parser->top -= 3; - parse_reduce_5(parser->stack[parser->top + 2].value.token.str, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 2; + parse_reduce_6(parser->stack[parser->top + 1].value.token.str, grammar); + parser->stack[++parser->top].state = 2; break; case TOK_HEADER: - parser->top -= 3; - parse_reduce_5(parser->stack[parser->top + 2].value.token.str, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 2; + parse_reduce_6(parser->stack[parser->top + 1].value.token.str, grammar); + parser->stack[++parser->top].state = 2; break; case TOK_SOURCE: - parser->top -= 3; - parse_reduce_5(parser->stack[parser->top + 2].value.token.str, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 2; + parse_reduce_6(parser->stack[parser->top + 1].value.token.str, grammar); + parser->stack[++parser->top].state = 2; break; case TOK_SYMBOL_LC: - parser->top -= 3; - parse_reduce_5(parser->stack[parser->top + 2].value.token.str, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 2; + parse_reduce_6(parser->stack[parser->top + 1].value.token.str, grammar); + parser->stack[++parser->top].state = 2; break; case TOK_TYPE: - parser->top -= 3; - parse_reduce_5(parser->stack[parser->top + 2].value.token.str, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 2; + parse_reduce_6(parser->stack[parser->top + 1].value.token.str, grammar); + parser->stack[++parser->top].state = 2; break; default: @@ -448,11 +485,11 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 11: + case 12: switch (token) { case '=': parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 20; + parser->stack[++parser->top].state = 21; return 1; default: @@ -460,11 +497,11 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 12: + case 13: switch (token) { case TOK_BLOCK: parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 21; + parser->stack[++parser->top].state = 22; return 1; default: @@ -472,95 +509,95 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 13: + case 14: 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.c, grammar); + 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 7: - parser->stack[++parser->top].state = 12; + case 8: + parser->stack[++parser->top].state = 13; break; - case 23: - parser->stack[++parser->top].state = 27; + case 24: + parser->stack[++parser->top].state = 28; 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.c, grammar); + 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 7: - parser->stack[++parser->top].state = 12; + case 8: + parser->stack[++parser->top].state = 13; break; - case 23: - parser->stack[++parser->top].state = 27; + case 24: + parser->stack[++parser->top].state = 28; break; } break; case TOK_STRING: parser->top -= 1; - parser->stack[parser->top].value.symbol_term = parse_reduce_18(parser->stack[parser->top + 0].value.token.c, grammar); + 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 7: - parser->stack[++parser->top].state = 12; + case 8: + parser->stack[++parser->top].state = 13; break; - case 23: - parser->stack[++parser->top].state = 27; + case 24: + parser->stack[++parser->top].state = 28; 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.c, grammar); + 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 7: - parser->stack[++parser->top].state = 12; + case 8: + parser->stack[++parser->top].state = 13; break; - case 23: - parser->stack[++parser->top].state = 27; + case 24: + parser->stack[++parser->top].state = 28; 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.c, grammar); + 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 7: - parser->stack[++parser->top].state = 12; + case 8: + parser->stack[++parser->top].state = 13; break; - case 23: - parser->stack[++parser->top].state = 27; + case 24: + parser->stack[++parser->top].state = 28; break; } break; case '(': parser->top -= 1; - parser->stack[parser->top].value.symbol_term = parse_reduce_18(parser->stack[parser->top + 0].value.token.c, grammar); + 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 7: - parser->stack[++parser->top].state = 12; + case 8: + parser->stack[++parser->top].state = 13; break; - case 23: - parser->stack[++parser->top].state = 27; + case 24: + parser->stack[++parser->top].state = 28; break; } break; case ';': parser->top -= 1; - parser->stack[parser->top].value.symbol_term = parse_reduce_18(parser->stack[parser->top + 0].value.token.c, grammar); + 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 7: - parser->stack[++parser->top].state = 12; + case 8: + parser->stack[++parser->top].state = 13; break; - case 23: - parser->stack[++parser->top].state = 27; + case 24: + parser->stack[++parser->top].state = 28; break; } break; @@ -570,11 +607,11 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 14: + case 15: switch (token) { case TOK_BLOCK: parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 22; + parser->stack[++parser->top].state = 23; return 1; default: @@ -582,95 +619,95 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 15: + case 16: switch (token) { case TOK_BLOCK: parser->top -= 1; - parser->stack[parser->top].value.symbol_term = parse_reduce_17(parser->stack[parser->top + 0].value.token.str, grammar); + 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 7: - parser->stack[++parser->top].state = 12; + case 8: + parser->stack[++parser->top].state = 13; break; - case 23: - parser->stack[++parser->top].state = 27; + case 24: + parser->stack[++parser->top].state = 28; break; } break; case TOK_CHAR: parser->top -= 1; - parser->stack[parser->top].value.symbol_term = parse_reduce_17(parser->stack[parser->top + 0].value.token.str, grammar); + 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 7: - parser->stack[++parser->top].state = 12; + case 8: + parser->stack[++parser->top].state = 13; break; - case 23: - parser->stack[++parser->top].state = 27; + case 24: + parser->stack[++parser->top].state = 28; break; } break; case TOK_STRING: parser->top -= 1; - parser->stack[parser->top].value.symbol_term = parse_reduce_17(parser->stack[parser->top + 0].value.token.str, grammar); + 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 7: - parser->stack[++parser->top].state = 12; + case 8: + parser->stack[++parser->top].state = 13; break; - case 23: - parser->stack[++parser->top].state = 27; + case 24: + parser->stack[++parser->top].state = 28; break; } break; case TOK_SYMBOL_LC: parser->top -= 1; - parser->stack[parser->top].value.symbol_term = parse_reduce_17(parser->stack[parser->top + 0].value.token.str, grammar); + 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 7: - parser->stack[++parser->top].state = 12; + case 8: + parser->stack[++parser->top].state = 13; break; - case 23: - parser->stack[++parser->top].state = 27; + case 24: + parser->stack[++parser->top].state = 28; break; } break; case TOK_SYMBOL_UC: parser->top -= 1; - parser->stack[parser->top].value.symbol_term = parse_reduce_17(parser->stack[parser->top + 0].value.token.str, grammar); + 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 7: - parser->stack[++parser->top].state = 12; + case 8: + parser->stack[++parser->top].state = 13; break; - case 23: - parser->stack[++parser->top].state = 27; + case 24: + parser->stack[++parser->top].state = 28; break; } break; case '(': parser->top -= 1; - parser->stack[parser->top].value.symbol_term = parse_reduce_17(parser->stack[parser->top + 0].value.token.str, grammar); + 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 7: - parser->stack[++parser->top].state = 12; + case 8: + parser->stack[++parser->top].state = 13; break; - case 23: - parser->stack[++parser->top].state = 27; + case 24: + parser->stack[++parser->top].state = 28; break; } break; case ';': parser->top -= 1; - parser->stack[parser->top].value.symbol_term = parse_reduce_17(parser->stack[parser->top + 0].value.token.str, grammar); + 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 7: - parser->stack[++parser->top].state = 12; + case 8: + parser->stack[++parser->top].state = 13; break; - case 23: - parser->stack[++parser->top].state = 27; + case 24: + parser->stack[++parser->top].state = 28; break; } break; @@ -680,42 +717,42 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 16: + case 17: switch (token) { case 0: - parser->top -= 4; - parse_reduce_7(parser->stack[parser->top + 2].value.token.str, parser->stack[parser->top + 3].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 3; + parse_reduce_8(parser->stack[parser->top + 1].value.token.str, parser->stack[parser->top + 2].value.symbol_varname, grammar); + parser->stack[++parser->top].state = 2; break; case TOK_EXTRA_ARG: - parser->top -= 4; - parse_reduce_7(parser->stack[parser->top + 2].value.token.str, parser->stack[parser->top + 3].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 3; + parse_reduce_8(parser->stack[parser->top + 1].value.token.str, parser->stack[parser->top + 2].value.symbol_varname, grammar); + parser->stack[++parser->top].state = 2; break; case TOK_HEADER: - parser->top -= 4; - parse_reduce_7(parser->stack[parser->top + 2].value.token.str, parser->stack[parser->top + 3].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 3; + parse_reduce_8(parser->stack[parser->top + 1].value.token.str, parser->stack[parser->top + 2].value.symbol_varname, grammar); + parser->stack[++parser->top].state = 2; break; case TOK_SOURCE: - parser->top -= 4; - parse_reduce_7(parser->stack[parser->top + 2].value.token.str, parser->stack[parser->top + 3].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 3; + parse_reduce_8(parser->stack[parser->top + 1].value.token.str, parser->stack[parser->top + 2].value.symbol_varname, grammar); + parser->stack[++parser->top].state = 2; break; case TOK_SYMBOL_LC: - parser->top -= 4; - parse_reduce_7(parser->stack[parser->top + 2].value.token.str, parser->stack[parser->top + 3].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 3; + parse_reduce_8(parser->stack[parser->top + 1].value.token.str, parser->stack[parser->top + 2].value.symbol_varname, grammar); + parser->stack[++parser->top].state = 2; break; case TOK_TYPE: - parser->top -= 4; - parse_reduce_7(parser->stack[parser->top + 2].value.token.str, parser->stack[parser->top + 3].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 3; + parse_reduce_8(parser->stack[parser->top + 1].value.token.str, parser->stack[parser->top + 2].value.symbol_varname, grammar); + parser->stack[++parser->top].state = 2; break; default: @@ -723,116 +760,116 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 17: + case 18: switch (token) { case 0: parser->top -= 1; - parser->stack[parser->top].value.symbol_varname = parse_reduce_21(parser->stack[parser->top + 0].value.token.str, grammar); + 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 8: - parser->stack[++parser->top].state = 16; + case 9: + parser->stack[++parser->top].state = 17; break; - case 21: - parser->stack[++parser->top].state = 24; + case 22: + parser->stack[++parser->top].state = 25; break; - case 32: - parser->stack[++parser->top].state = 33; + case 33: + parser->stack[++parser->top].state = 34; break; } break; case TOK_EXTRA_ARG: parser->top -= 1; - parser->stack[parser->top].value.symbol_varname = parse_reduce_21(parser->stack[parser->top + 0].value.token.str, grammar); + 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 8: - parser->stack[++parser->top].state = 16; + case 9: + parser->stack[++parser->top].state = 17; break; - case 21: - parser->stack[++parser->top].state = 24; + case 22: + parser->stack[++parser->top].state = 25; break; - case 32: - parser->stack[++parser->top].state = 33; + case 33: + parser->stack[++parser->top].state = 34; break; } break; case TOK_HEADER: parser->top -= 1; - parser->stack[parser->top].value.symbol_varname = parse_reduce_21(parser->stack[parser->top + 0].value.token.str, grammar); + 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 8: - parser->stack[++parser->top].state = 16; + case 9: + parser->stack[++parser->top].state = 17; break; - case 21: - parser->stack[++parser->top].state = 24; + case 22: + parser->stack[++parser->top].state = 25; break; - case 32: - parser->stack[++parser->top].state = 33; + case 33: + parser->stack[++parser->top].state = 34; break; } break; case TOK_SOURCE: parser->top -= 1; - parser->stack[parser->top].value.symbol_varname = parse_reduce_21(parser->stack[parser->top + 0].value.token.str, grammar); + 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 8: - parser->stack[++parser->top].state = 16; + case 9: + parser->stack[++parser->top].state = 17; break; - case 21: - parser->stack[++parser->top].state = 24; + case 22: + parser->stack[++parser->top].state = 25; break; - case 32: - parser->stack[++parser->top].state = 33; + case 33: + parser->stack[++parser->top].state = 34; 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); + 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 8: - parser->stack[++parser->top].state = 16; + case 9: + parser->stack[++parser->top].state = 17; break; - case 21: - parser->stack[++parser->top].state = 24; + case 22: + parser->stack[++parser->top].state = 25; break; - case 32: - parser->stack[++parser->top].state = 33; + case 33: + parser->stack[++parser->top].state = 34; break; } break; case TOK_TYPE: parser->top -= 1; - parser->stack[parser->top].value.symbol_varname = parse_reduce_21(parser->stack[parser->top + 0].value.token.str, grammar); + 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 8: - parser->stack[++parser->top].state = 16; + case 9: + parser->stack[++parser->top].state = 17; break; - case 21: - parser->stack[++parser->top].state = 24; + case 22: + parser->stack[++parser->top].state = 25; break; - case 32: - parser->stack[++parser->top].state = 33; + case 33: + parser->stack[++parser->top].state = 34; 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); + 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 8: - parser->stack[++parser->top].state = 16; + case 9: + parser->stack[++parser->top].state = 17; break; - case 21: - parser->stack[++parser->top].state = 24; + case 22: + parser->stack[++parser->top].state = 25; break; - case 32: - parser->stack[++parser->top].state = 33; + case 33: + parser->stack[++parser->top].state = 34; break; } break; @@ -842,116 +879,116 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 18: + case 19: switch (token) { case 0: parser->top -= 1; - parser->stack[parser->top].value.symbol_varname = parse_reduce_19(parser->stack[parser->top + 0].value.token.str, grammar); + 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 8: - parser->stack[++parser->top].state = 16; + case 9: + parser->stack[++parser->top].state = 17; break; - case 21: - parser->stack[++parser->top].state = 24; + case 22: + parser->stack[++parser->top].state = 25; break; - case 32: - parser->stack[++parser->top].state = 33; + case 33: + parser->stack[++parser->top].state = 34; break; } break; case TOK_EXTRA_ARG: parser->top -= 1; - parser->stack[parser->top].value.symbol_varname = parse_reduce_19(parser->stack[parser->top + 0].value.token.str, grammar); + 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 8: - parser->stack[++parser->top].state = 16; + case 9: + parser->stack[++parser->top].state = 17; break; - case 21: - parser->stack[++parser->top].state = 24; + case 22: + parser->stack[++parser->top].state = 25; break; - case 32: - parser->stack[++parser->top].state = 33; + case 33: + parser->stack[++parser->top].state = 34; break; } break; case TOK_HEADER: parser->top -= 1; - parser->stack[parser->top].value.symbol_varname = parse_reduce_19(parser->stack[parser->top + 0].value.token.str, grammar); + 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 8: - parser->stack[++parser->top].state = 16; + case 9: + parser->stack[++parser->top].state = 17; break; - case 21: - parser->stack[++parser->top].state = 24; + case 22: + parser->stack[++parser->top].state = 25; break; - case 32: - parser->stack[++parser->top].state = 33; + case 33: + parser->stack[++parser->top].state = 34; break; } break; case TOK_SOURCE: parser->top -= 1; - parser->stack[parser->top].value.symbol_varname = parse_reduce_19(parser->stack[parser->top + 0].value.token.str, grammar); + 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 8: - parser->stack[++parser->top].state = 16; + case 9: + parser->stack[++parser->top].state = 17; break; - case 21: - parser->stack[++parser->top].state = 24; + case 22: + parser->stack[++parser->top].state = 25; break; - case 32: - parser->stack[++parser->top].state = 33; + case 33: + parser->stack[++parser->top].state = 34; break; } break; case TOK_SYMBOL_LC: parser->top -= 1; - parser->stack[parser->top].value.symbol_varname = parse_reduce_19(parser->stack[parser->top + 0].value.token.str, grammar); + 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 8: - parser->stack[++parser->top].state = 16; + case 9: + parser->stack[++parser->top].state = 17; break; - case 21: - parser->stack[++parser->top].state = 24; + case 22: + parser->stack[++parser->top].state = 25; break; - case 32: - parser->stack[++parser->top].state = 33; + case 33: + parser->stack[++parser->top].state = 34; break; } break; case TOK_TYPE: parser->top -= 1; - parser->stack[parser->top].value.symbol_varname = parse_reduce_19(parser->stack[parser->top + 0].value.token.str, grammar); + 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 8: - parser->stack[++parser->top].state = 16; + case 9: + parser->stack[++parser->top].state = 17; break; - case 21: - parser->stack[++parser->top].state = 24; + case 22: + parser->stack[++parser->top].state = 25; break; - case 32: - parser->stack[++parser->top].state = 33; + case 33: + parser->stack[++parser->top].state = 34; break; } break; case ')': parser->top -= 1; - parser->stack[parser->top].value.symbol_varname = parse_reduce_19(parser->stack[parser->top + 0].value.token.str, grammar); + 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 8: - parser->stack[++parser->top].state = 16; + case 9: + parser->stack[++parser->top].state = 17; break; - case 21: - parser->stack[++parser->top].state = 24; + case 22: + parser->stack[++parser->top].state = 25; break; - case 32: - parser->stack[++parser->top].state = 33; + case 33: + parser->stack[++parser->top].state = 34; break; } break; @@ -961,116 +998,116 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 19: + case 20: switch (token) { case 0: parser->top -= 1; - parser->stack[parser->top].value.symbol_varname = parse_reduce_20(parser->stack[parser->top + 0].value.token.str, grammar); + 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 8: - parser->stack[++parser->top].state = 16; + case 9: + parser->stack[++parser->top].state = 17; break; - case 21: - parser->stack[++parser->top].state = 24; + case 22: + parser->stack[++parser->top].state = 25; break; - case 32: - parser->stack[++parser->top].state = 33; + case 33: + parser->stack[++parser->top].state = 34; break; } break; case TOK_EXTRA_ARG: parser->top -= 1; - parser->stack[parser->top].value.symbol_varname = parse_reduce_20(parser->stack[parser->top + 0].value.token.str, grammar); + 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 8: - parser->stack[++parser->top].state = 16; + case 9: + parser->stack[++parser->top].state = 17; break; - case 21: - parser->stack[++parser->top].state = 24; + case 22: + parser->stack[++parser->top].state = 25; break; - case 32: - parser->stack[++parser->top].state = 33; + case 33: + parser->stack[++parser->top].state = 34; break; } break; case TOK_HEADER: parser->top -= 1; - parser->stack[parser->top].value.symbol_varname = parse_reduce_20(parser->stack[parser->top + 0].value.token.str, grammar); + 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 8: - parser->stack[++parser->top].state = 16; + case 9: + parser->stack[++parser->top].state = 17; break; - case 21: - parser->stack[++parser->top].state = 24; + case 22: + parser->stack[++parser->top].state = 25; break; - case 32: - parser->stack[++parser->top].state = 33; + case 33: + parser->stack[++parser->top].state = 34; break; } break; case TOK_SOURCE: parser->top -= 1; - parser->stack[parser->top].value.symbol_varname = parse_reduce_20(parser->stack[parser->top + 0].value.token.str, grammar); + 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 8: - parser->stack[++parser->top].state = 16; + case 9: + parser->stack[++parser->top].state = 17; break; - case 21: - parser->stack[++parser->top].state = 24; + case 22: + parser->stack[++parser->top].state = 25; break; - case 32: - parser->stack[++parser->top].state = 33; + case 33: + parser->stack[++parser->top].state = 34; 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); + 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 8: - parser->stack[++parser->top].state = 16; + case 9: + parser->stack[++parser->top].state = 17; break; - case 21: - parser->stack[++parser->top].state = 24; + case 22: + parser->stack[++parser->top].state = 25; break; - case 32: - parser->stack[++parser->top].state = 33; + case 33: + parser->stack[++parser->top].state = 34; break; } break; case TOK_TYPE: parser->top -= 1; - parser->stack[parser->top].value.symbol_varname = parse_reduce_20(parser->stack[parser->top + 0].value.token.str, grammar); + 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 8: - parser->stack[++parser->top].state = 16; + case 9: + parser->stack[++parser->top].state = 17; break; - case 21: - parser->stack[++parser->top].state = 24; + case 22: + parser->stack[++parser->top].state = 25; break; - case 32: - parser->stack[++parser->top].state = 33; + case 33: + parser->stack[++parser->top].state = 34; 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); + 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 8: - parser->stack[++parser->top].state = 16; + case 9: + parser->stack[++parser->top].state = 17; break; - case 21: - parser->stack[++parser->top].state = 24; + case 22: + parser->stack[++parser->top].state = 25; break; - case 32: - parser->stack[++parser->top].state = 33; + case 33: + parser->stack[++parser->top].state = 34; break; } break; @@ -1080,36 +1117,36 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 20: + case 21: switch (token) { case TOK_BLOCK: - parser->stack[parser->top].value.symbol_rhs = parse_reduce_9(grammar); - parser->stack[++parser->top].state = 23; + parser->stack[parser->top].value.symbol_rhs = parse_reduce_10(grammar); + parser->stack[++parser->top].state = 24; break; case TOK_CHAR: - parser->stack[parser->top].value.symbol_rhs = parse_reduce_9(grammar); - parser->stack[++parser->top].state = 23; + parser->stack[parser->top].value.symbol_rhs = parse_reduce_10(grammar); + parser->stack[++parser->top].state = 24; break; case TOK_STRING: - parser->stack[parser->top].value.symbol_rhs = parse_reduce_9(grammar); - parser->stack[++parser->top].state = 23; + parser->stack[parser->top].value.symbol_rhs = parse_reduce_10(grammar); + parser->stack[++parser->top].state = 24; break; case TOK_SYMBOL_LC: - parser->stack[parser->top].value.symbol_rhs = parse_reduce_9(grammar); - parser->stack[++parser->top].state = 23; + parser->stack[parser->top].value.symbol_rhs = parse_reduce_10(grammar); + parser->stack[++parser->top].state = 24; break; case TOK_SYMBOL_UC: - parser->stack[parser->top].value.symbol_rhs = parse_reduce_9(grammar); - parser->stack[++parser->top].state = 23; + parser->stack[parser->top].value.symbol_rhs = parse_reduce_10(grammar); + parser->stack[++parser->top].state = 24; break; case ';': - parser->stack[parser->top].value.symbol_rhs = parse_reduce_9(grammar); - parser->stack[++parser->top].state = 23; + parser->stack[parser->top].value.symbol_rhs = parse_reduce_10(grammar); + parser->stack[++parser->top].state = 24; break; default: @@ -1117,21 +1154,21 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 21: + case 22: switch (token) { case TOK_SYMBOL: parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 17; + parser->stack[++parser->top].state = 18; return 1; case TOK_SYMBOL_LC: parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 18; + parser->stack[++parser->top].state = 19; return 1; case TOK_SYMBOL_UC: parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 19; + parser->stack[++parser->top].state = 20; return 1; default: @@ -1139,42 +1176,42 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 22: + case 23: switch (token) { case 0: - parser->top -= 4; - parse_reduce_3(parser->stack[parser->top + 2].value.token.str, parser->stack[parser->top + 3].value.token.str, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 3; + parse_reduce_4(parser->stack[parser->top + 1].value.token.str, parser->stack[parser->top + 2].value.token.str, grammar); + parser->stack[++parser->top].state = 2; break; case TOK_EXTRA_ARG: - parser->top -= 4; - parse_reduce_3(parser->stack[parser->top + 2].value.token.str, parser->stack[parser->top + 3].value.token.str, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 3; + parse_reduce_4(parser->stack[parser->top + 1].value.token.str, parser->stack[parser->top + 2].value.token.str, grammar); + parser->stack[++parser->top].state = 2; break; case TOK_HEADER: - parser->top -= 4; - parse_reduce_3(parser->stack[parser->top + 2].value.token.str, parser->stack[parser->top + 3].value.token.str, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 3; + parse_reduce_4(parser->stack[parser->top + 1].value.token.str, parser->stack[parser->top + 2].value.token.str, grammar); + parser->stack[++parser->top].state = 2; break; case TOK_SOURCE: - parser->top -= 4; - parse_reduce_3(parser->stack[parser->top + 2].value.token.str, parser->stack[parser->top + 3].value.token.str, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 3; + parse_reduce_4(parser->stack[parser->top + 1].value.token.str, parser->stack[parser->top + 2].value.token.str, grammar); + parser->stack[++parser->top].state = 2; break; case TOK_SYMBOL_LC: - parser->top -= 4; - parse_reduce_3(parser->stack[parser->top + 2].value.token.str, parser->stack[parser->top + 3].value.token.str, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 3; + parse_reduce_4(parser->stack[parser->top + 1].value.token.str, parser->stack[parser->top + 2].value.token.str, grammar); + parser->stack[++parser->top].state = 2; break; case TOK_TYPE: - parser->top -= 4; - parse_reduce_3(parser->stack[parser->top + 2].value.token.str, parser->stack[parser->top + 3].value.token.str, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 3; + parse_reduce_4(parser->stack[parser->top + 1].value.token.str, parser->stack[parser->top + 2].value.token.str, grammar); + parser->stack[++parser->top].state = 2; break; default: @@ -1182,36 +1219,36 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 23: + case 24: switch (token) { case TOK_BLOCK: parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 28; + parser->stack[++parser->top].state = 29; return 1; case TOK_CHAR: parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 13; + parser->stack[++parser->top].state = 14; return 1; case TOK_STRING: parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 29; + parser->stack[++parser->top].state = 30; return 1; case TOK_SYMBOL_LC: parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 30; + parser->stack[++parser->top].state = 31; return 1; case TOK_SYMBOL_UC: parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 15; + parser->stack[++parser->top].state = 16; return 1; case ';': parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 31; + parser->stack[++parser->top].state = 32; return 1; default: @@ -1219,42 +1256,42 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 24: + case 25: switch (token) { case 0: - parser->top -= 5; - parse_reduce_4(parser->stack[parser->top + 2].value.symbol_term, parser->stack[parser->top + 3].value.token.str, parser->stack[parser->top + 4].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 4; + parse_reduce_5(parser->stack[parser->top + 1].value.symbol_term, parser->stack[parser->top + 2].value.token.str, parser->stack[parser->top + 3].value.symbol_varname, grammar); + parser->stack[++parser->top].state = 2; break; case TOK_EXTRA_ARG: - parser->top -= 5; - parse_reduce_4(parser->stack[parser->top + 2].value.symbol_term, parser->stack[parser->top + 3].value.token.str, parser->stack[parser->top + 4].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 4; + parse_reduce_5(parser->stack[parser->top + 1].value.symbol_term, parser->stack[parser->top + 2].value.token.str, parser->stack[parser->top + 3].value.symbol_varname, grammar); + parser->stack[++parser->top].state = 2; break; case TOK_HEADER: - parser->top -= 5; - parse_reduce_4(parser->stack[parser->top + 2].value.symbol_term, parser->stack[parser->top + 3].value.token.str, parser->stack[parser->top + 4].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 4; + parse_reduce_5(parser->stack[parser->top + 1].value.symbol_term, parser->stack[parser->top + 2].value.token.str, parser->stack[parser->top + 3].value.symbol_varname, grammar); + parser->stack[++parser->top].state = 2; break; case TOK_SOURCE: - parser->top -= 5; - parse_reduce_4(parser->stack[parser->top + 2].value.symbol_term, parser->stack[parser->top + 3].value.token.str, parser->stack[parser->top + 4].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 4; + parse_reduce_5(parser->stack[parser->top + 1].value.symbol_term, parser->stack[parser->top + 2].value.token.str, parser->stack[parser->top + 3].value.symbol_varname, grammar); + parser->stack[++parser->top].state = 2; break; case TOK_SYMBOL_LC: - parser->top -= 5; - parse_reduce_4(parser->stack[parser->top + 2].value.symbol_term, parser->stack[parser->top + 3].value.token.str, parser->stack[parser->top + 4].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 4; + parse_reduce_5(parser->stack[parser->top + 1].value.symbol_term, parser->stack[parser->top + 2].value.token.str, parser->stack[parser->top + 3].value.symbol_varname, grammar); + parser->stack[++parser->top].state = 2; break; case TOK_TYPE: - parser->top -= 5; - parse_reduce_4(parser->stack[parser->top + 2].value.symbol_term, parser->stack[parser->top + 3].value.token.str, parser->stack[parser->top + 4].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 1; + parser->top -= 4; + parse_reduce_5(parser->stack[parser->top + 1].value.symbol_term, parser->stack[parser->top + 2].value.token.str, parser->stack[parser->top + 3].value.symbol_varname, grammar); + parser->stack[++parser->top].state = 2; break; default: @@ -1262,42 +1299,42 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 25: + case 26: switch (token) { case 0: parser->top -= 5; - parser->stack[parser->top].value.symbol_rule = parse_reduce_8(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 = 2; + 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_EXTRA_ARG: parser->top -= 5; - parser->stack[parser->top].value.symbol_rule = parse_reduce_8(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 = 2; + 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_HEADER: parser->top -= 5; - parser->stack[parser->top].value.symbol_rule = parse_reduce_8(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 = 2; + 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_SOURCE: parser->top -= 5; - parser->stack[parser->top].value.symbol_rule = parse_reduce_8(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 = 2; + 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_8(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 = 2; + 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_TYPE: parser->top -= 5; - parser->stack[parser->top].value.symbol_rule = parse_reduce_8(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 = 2; + 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: @@ -1305,47 +1342,47 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 26: + case 27: switch (token) { case TOK_BLOCK: parser->top -= 2; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_10(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.symbol_symbol, grammar); - parser->stack[++parser->top].state = 23; + 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 = 24; break; case TOK_CHAR: parser->top -= 2; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_10(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.symbol_symbol, grammar); - parser->stack[++parser->top].state = 23; + 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 = 24; break; case TOK_STRING: parser->top -= 2; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_10(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.symbol_symbol, grammar); - parser->stack[++parser->top].state = 23; + 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 = 24; break; case TOK_SYMBOL_LC: parser->top -= 2; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_10(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.symbol_symbol, grammar); - parser->stack[++parser->top].state = 23; + 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 = 24; break; case TOK_SYMBOL_UC: parser->top -= 2; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_10(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.symbol_symbol, grammar); - parser->stack[++parser->top].state = 23; + 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 = 24; break; case '(': parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 32; + parser->stack[++parser->top].state = 33; return 1; case ';': parser->top -= 2; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_10(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.symbol_symbol, grammar); - parser->stack[++parser->top].state = 23; + 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 = 24; break; default: @@ -1353,48 +1390,48 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 27: + case 28: switch (token) { case TOK_BLOCK: parser->top -= 1; - parser->stack[parser->top].value.symbol_symbol = parse_reduce_15(parser->stack[parser->top + 0].value.symbol_term, grammar); - parser->stack[++parser->top].state = 26; + parser->stack[parser->top].value.symbol_symbol = parse_reduce_16(parser->stack[parser->top + 0].value.symbol_term, grammar); + parser->stack[++parser->top].state = 27; break; case TOK_CHAR: parser->top -= 1; - parser->stack[parser->top].value.symbol_symbol = parse_reduce_15(parser->stack[parser->top + 0].value.symbol_term, grammar); - parser->stack[++parser->top].state = 26; + parser->stack[parser->top].value.symbol_symbol = parse_reduce_16(parser->stack[parser->top + 0].value.symbol_term, grammar); + parser->stack[++parser->top].state = 27; break; case TOK_STRING: parser->top -= 1; - parser->stack[parser->top].value.symbol_symbol = parse_reduce_15(parser->stack[parser->top + 0].value.symbol_term, grammar); - parser->stack[++parser->top].state = 26; + parser->stack[parser->top].value.symbol_symbol = parse_reduce_16(parser->stack[parser->top + 0].value.symbol_term, grammar); + parser->stack[++parser->top].state = 27; break; case TOK_SYMBOL_LC: parser->top -= 1; - parser->stack[parser->top].value.symbol_symbol = parse_reduce_15(parser->stack[parser->top + 0].value.symbol_term, grammar); - parser->stack[++parser->top].state = 26; + parser->stack[parser->top].value.symbol_symbol = parse_reduce_16(parser->stack[parser->top + 0].value.symbol_term, grammar); + parser->stack[++parser->top].state = 27; break; case TOK_SYMBOL_UC: parser->top -= 1; - parser->stack[parser->top].value.symbol_symbol = parse_reduce_15(parser->stack[parser->top + 0].value.symbol_term, grammar); - parser->stack[++parser->top].state = 26; + parser->stack[parser->top].value.symbol_symbol = parse_reduce_16(parser->stack[parser->top + 0].value.symbol_term, grammar); + parser->stack[++parser->top].state = 27; break; case '(': parser->top -= 1; - parser->stack[parser->top].value.symbol_symbol = parse_reduce_15(parser->stack[parser->top + 0].value.symbol_term, grammar); - parser->stack[++parser->top].state = 26; + parser->stack[parser->top].value.symbol_symbol = parse_reduce_16(parser->stack[parser->top + 0].value.symbol_term, grammar); + parser->stack[++parser->top].state = 27; break; case ';': parser->top -= 1; - parser->stack[parser->top].value.symbol_symbol = parse_reduce_15(parser->stack[parser->top + 0].value.symbol_term, grammar); - parser->stack[++parser->top].state = 26; + parser->stack[parser->top].value.symbol_symbol = parse_reduce_16(parser->stack[parser->top + 0].value.symbol_term, grammar); + parser->stack[++parser->top].state = 27; break; default: @@ -1402,42 +1439,42 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 28: + case 29: switch (token) { case 0: parser->top -= 1; - parser->stack[parser->top].value.symbol_action = parse_reduce_14(parser->stack[parser->top + 0].value.token.str, grammar); - parser->stack[++parser->top].state = 25; + parser->stack[parser->top].value.symbol_action = parse_reduce_15(parser->stack[parser->top + 0].value.token.str, grammar); + parser->stack[++parser->top].state = 26; break; case TOK_EXTRA_ARG: parser->top -= 1; - parser->stack[parser->top].value.symbol_action = parse_reduce_14(parser->stack[parser->top + 0].value.token.str, grammar); - parser->stack[++parser->top].state = 25; + parser->stack[parser->top].value.symbol_action = parse_reduce_15(parser->stack[parser->top + 0].value.token.str, grammar); + parser->stack[++parser->top].state = 26; break; case TOK_HEADER: parser->top -= 1; - parser->stack[parser->top].value.symbol_action = parse_reduce_14(parser->stack[parser->top + 0].value.token.str, grammar); - parser->stack[++parser->top].state = 25; + parser->stack[parser->top].value.symbol_action = parse_reduce_15(parser->stack[parser->top + 0].value.token.str, grammar); + parser->stack[++parser->top].state = 26; break; case TOK_SOURCE: parser->top -= 1; - parser->stack[parser->top].value.symbol_action = parse_reduce_14(parser->stack[parser->top + 0].value.token.str, grammar); - parser->stack[++parser->top].state = 25; + parser->stack[parser->top].value.symbol_action = parse_reduce_15(parser->stack[parser->top + 0].value.token.str, grammar); + parser->stack[++parser->top].state = 26; break; case TOK_SYMBOL_LC: parser->top -= 1; - parser->stack[parser->top].value.symbol_action = parse_reduce_14(parser->stack[parser->top + 0].value.token.str, grammar); - parser->stack[++parser->top].state = 25; + parser->stack[parser->top].value.symbol_action = parse_reduce_15(parser->stack[parser->top + 0].value.token.str, grammar); + parser->stack[++parser->top].state = 26; break; case TOK_TYPE: parser->top -= 1; - parser->stack[parser->top].value.symbol_action = parse_reduce_14(parser->stack[parser->top + 0].value.token.str, grammar); - parser->stack[++parser->top].state = 25; + parser->stack[parser->top].value.symbol_action = parse_reduce_15(parser->stack[parser->top + 0].value.token.str, grammar); + parser->stack[++parser->top].state = 26; break; default: @@ -1445,42 +1482,42 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 29: + case 30: switch (token) { case TOK_BLOCK: parser->top -= 2; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_12(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.token.str, grammar); - parser->stack[++parser->top].state = 23; + 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 = 24; break; case TOK_CHAR: parser->top -= 2; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_12(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.token.str, grammar); - parser->stack[++parser->top].state = 23; + 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 = 24; break; case TOK_STRING: parser->top -= 2; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_12(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.token.str, grammar); - parser->stack[++parser->top].state = 23; + 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 = 24; break; case TOK_SYMBOL_LC: parser->top -= 2; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_12(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.token.str, grammar); - parser->stack[++parser->top].state = 23; + 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 = 24; break; case TOK_SYMBOL_UC: parser->top -= 2; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_12(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.token.str, grammar); - parser->stack[++parser->top].state = 23; + 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 = 24; break; case ';': parser->top -= 2; - parser->stack[parser->top].value.symbol_rhs = parse_reduce_12(parser->stack[parser->top + 0].value.symbol_rhs, parser->stack[parser->top + 1].value.token.str, grammar); - parser->stack[++parser->top].state = 23; + 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 = 24; break; default: @@ -1488,48 +1525,48 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 30: + case 31: switch (token) { case TOK_BLOCK: parser->top -= 1; - parser->stack[parser->top].value.symbol_symbol = parse_reduce_16(parser->stack[parser->top + 0].value.token.str, grammar); - parser->stack[++parser->top].state = 26; + parser->stack[parser->top].value.symbol_symbol = parse_reduce_17(parser->stack[parser->top + 0].value.token.str, grammar); + parser->stack[++parser->top].state = 27; break; case TOK_CHAR: parser->top -= 1; - parser->stack[parser->top].value.symbol_symbol = parse_reduce_16(parser->stack[parser->top + 0].value.token.str, grammar); - parser->stack[++parser->top].state = 26; + parser->stack[parser->top].value.symbol_symbol = parse_reduce_17(parser->stack[parser->top + 0].value.token.str, grammar); + parser->stack[++parser->top].state = 27; break; case TOK_STRING: parser->top -= 1; - parser->stack[parser->top].value.symbol_symbol = parse_reduce_16(parser->stack[parser->top + 0].value.token.str, grammar); - parser->stack[++parser->top].state = 26; + parser->stack[parser->top].value.symbol_symbol = parse_reduce_17(parser->stack[parser->top + 0].value.token.str, grammar); + parser->stack[++parser->top].state = 27; break; case TOK_SYMBOL_LC: parser->top -= 1; - parser->stack[parser->top].value.symbol_symbol = parse_reduce_16(parser->stack[parser->top + 0].value.token.str, grammar); - parser->stack[++parser->top].state = 26; + parser->stack[parser->top].value.symbol_symbol = parse_reduce_17(parser->stack[parser->top + 0].value.token.str, grammar); + parser->stack[++parser->top].state = 27; break; case TOK_SYMBOL_UC: parser->top -= 1; - parser->stack[parser->top].value.symbol_symbol = parse_reduce_16(parser->stack[parser->top + 0].value.token.str, grammar); - parser->stack[++parser->top].state = 26; + parser->stack[parser->top].value.symbol_symbol = parse_reduce_17(parser->stack[parser->top + 0].value.token.str, grammar); + parser->stack[++parser->top].state = 27; break; case '(': parser->top -= 1; - parser->stack[parser->top].value.symbol_symbol = parse_reduce_16(parser->stack[parser->top + 0].value.token.str, grammar); - parser->stack[++parser->top].state = 26; + parser->stack[parser->top].value.symbol_symbol = parse_reduce_17(parser->stack[parser->top + 0].value.token.str, grammar); + parser->stack[++parser->top].state = 27; break; case ';': parser->top -= 1; - parser->stack[parser->top].value.symbol_symbol = parse_reduce_16(parser->stack[parser->top + 0].value.token.str, grammar); - parser->stack[++parser->top].state = 26; + parser->stack[parser->top].value.symbol_symbol = parse_reduce_17(parser->stack[parser->top + 0].value.token.str, grammar); + parser->stack[++parser->top].state = 27; break; default: @@ -1537,42 +1574,42 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 31: + case 32: switch (token) { case 0: parser->top -= 1; - parser->stack[parser->top].value.symbol_action = parse_reduce_13(grammar); - parser->stack[++parser->top].state = 25; + parser->stack[parser->top].value.symbol_action = parse_reduce_14(grammar); + parser->stack[++parser->top].state = 26; break; case TOK_EXTRA_ARG: parser->top -= 1; - parser->stack[parser->top].value.symbol_action = parse_reduce_13(grammar); - parser->stack[++parser->top].state = 25; + parser->stack[parser->top].value.symbol_action = parse_reduce_14(grammar); + parser->stack[++parser->top].state = 26; break; case TOK_HEADER: parser->top -= 1; - parser->stack[parser->top].value.symbol_action = parse_reduce_13(grammar); - parser->stack[++parser->top].state = 25; + parser->stack[parser->top].value.symbol_action = parse_reduce_14(grammar); + parser->stack[++parser->top].state = 26; break; case TOK_SOURCE: parser->top -= 1; - parser->stack[parser->top].value.symbol_action = parse_reduce_13(grammar); - parser->stack[++parser->top].state = 25; + parser->stack[parser->top].value.symbol_action = parse_reduce_14(grammar); + parser->stack[++parser->top].state = 26; break; case TOK_SYMBOL_LC: parser->top -= 1; - parser->stack[parser->top].value.symbol_action = parse_reduce_13(grammar); - parser->stack[++parser->top].state = 25; + parser->stack[parser->top].value.symbol_action = parse_reduce_14(grammar); + parser->stack[++parser->top].state = 26; break; case TOK_TYPE: parser->top -= 1; - parser->stack[parser->top].value.symbol_action = parse_reduce_13(grammar); - parser->stack[++parser->top].state = 25; + parser->stack[parser->top].value.symbol_action = parse_reduce_14(grammar); + parser->stack[++parser->top].state = 26; break; default: @@ -1580,21 +1617,21 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 32: + case 33: switch (token) { case TOK_SYMBOL: parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 17; + parser->stack[++parser->top].state = 18; return 1; case TOK_SYMBOL_LC: parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 18; + parser->stack[++parser->top].state = 19; return 1; case TOK_SYMBOL_UC: parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 19; + parser->stack[++parser->top].state = 20; return 1; default: @@ -1602,11 +1639,11 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 33: + case 34: switch (token) { case ')': parser->stack[parser->top].value.token = *value; - parser->stack[++parser->top].state = 34; + parser->stack[++parser->top].state = 35; return 1; default: @@ -1614,42 +1651,42 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va } break; - case 34: + case 35: switch (token) { case TOK_BLOCK: parser->top -= 5; - 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, parser->stack[parser->top + 3].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 23; + 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 = 24; break; case TOK_CHAR: parser->top -= 5; - 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, parser->stack[parser->top + 3].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 23; + 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 = 24; break; case TOK_STRING: parser->top -= 5; - 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, parser->stack[parser->top + 3].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 23; + 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 = 24; break; case TOK_SYMBOL_LC: parser->top -= 5; - 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, parser->stack[parser->top + 3].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 23; + 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 = 24; break; case TOK_SYMBOL_UC: parser->top -= 5; - 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, parser->stack[parser->top + 3].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 23; + 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 = 24; break; case ';': parser->top -= 5; - 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, parser->stack[parser->top + 3].value.symbol_varname, grammar); - parser->stack[++parser->top].state = 23; + 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 = 24; break; default: diff --git a/src/parse.y b/src/parse.y index 28f13ad..52f53a6 100644 --- a/src/parse.y +++ b/src/parse.y @@ -21,8 +21,9 @@ grammar |=; +grammar |= grammar directive; -grammar |= grammar rule(rule) { +directive |= rule(rule) { if (grammar->rules.empty()) { solar::item_t init(""); init.get_rhs().push_back(solar::symbol_t::make_nonterm(rule->item.get_lhs().c_str())); @@ -33,14 +34,14 @@ grammar |= grammar rule(rule) { delete rule; } -grammar |= grammar TYPE SYMBOL_LC(nonterm) BLOCK(type) { +directive |= TYPE SYMBOL_LC(nonterm) BLOCK(type) { grammar->nonterm_types.insert(std::make_pair(*nonterm, *type)); delete nonterm; delete type; } -grammar |= grammar TYPE term(term) BLOCK(type) varname(name) { +directive |= TYPE term(term) BLOCK(type) varname(name) { grammar->term_types.insert(std::make_pair(*term, std::make_pair(*type, *name))); delete term; @@ -48,17 +49,17 @@ grammar |= grammar TYPE term(term) BLOCK(type) varname(name) { delete name; } -grammar |= grammar SOURCE BLOCK(block) { +directive |= SOURCE BLOCK(block) { grammar->source_block = *block; delete block; } -grammar |= grammar HEADER BLOCK(block) { +directive |= HEADER BLOCK(block) { grammar->header_block = *block; delete block; } -grammar |= grammar EXTRA_ARG BLOCK(type) varname(name) { +directive |= EXTRA_ARG BLOCK(type) varname(name) { grammar->extra_args.push_back(std::make_pair(*type, *name)); delete type; |