summaryrefslogtreecommitdiffstats
path: root/src/parse.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/parse.cpp')
-rw-r--r--src/parse.cpp54
1 files changed, 44 insertions, 10 deletions
diff --git a/src/parse.cpp b/src/parse.cpp
index 88245bf..05fad4d 100644
--- a/src/parse.cpp
+++ b/src/parse.cpp
@@ -76,14 +76,12 @@ static inline void parse_reduce_9(std::string *type, std::string *name, __attrib
}
static inline void parse_reduce_10(std::string *lhs, rhs_t *rhs, std::string *action, __attribute__((unused)) grammar_t *grammar) {
- grammar->add_rule({item_t(*lhs, rhs->first), rhs->second, *action});
+ grammar->add_rule(item_t(*lhs, rhs->first), rhs->second, *action);
}
-static inline void parse_reduce_11(std::string *lhs, unsigned char c1, unsigned char c2, __attribute__((unused)) grammar_t *grammar) {
- vars_t vars(1);
-
+static inline void parse_reduce_11(std::string *lhs, unsigned char c1, unsigned char c2, std::string *action, __attribute__((unused)) grammar_t *grammar) {
for (unsigned int c = c1; c <= c2; c++)
- grammar->add_rule({item_t(*lhs, {symbol_t::make_char(c)}), vars, std::string()});
+ grammar->add_rule(item_t(*lhs, {symbol_t::make_char(c)}), vars_t(1), *action);
}
static inline rhs_t * parse_reduce_12(__attribute__((unused)) grammar_t *grammar) {return new rhs_t;}
@@ -536,7 +534,16 @@ static int parse_do_push(parse_context_t *parser, int token, __attribute__((unus
parser->top -= 1;
result.symbol_action = parse_reduce_20(parser->stack[parser->top + 0].value.token.str, grammar);
parser->stack[parser->top].value.symbol_action = result.symbol_action;
- parser->stack[++parser->top].state = 27;
+ switch (parser->stack[parser->top].state) {
+ case 19:
+ parser->stack[++parser->top].state = 27;
+ break;
+
+ case 79:
+ parser->stack[++parser->top].state = 83;
+ break;
+
+ }
}
break;
@@ -567,7 +574,16 @@ static int parse_do_push(parse_context_t *parser, int token, __attribute__((unus
result.symbol_action = parse_reduce_21(parser->stack[parser->top + 0].value.token.str, grammar);
delete(parser->stack[parser->top + 0].value.token.str);
parser->stack[parser->top].value.symbol_action = result.symbol_action;
- parser->stack[++parser->top].state = 27;
+ switch (parser->stack[parser->top].state) {
+ case 19:
+ parser->stack[++parser->top].state = 27;
+ break;
+
+ case 79:
+ parser->stack[++parser->top].state = 83;
+ break;
+
+ }
}
break;
@@ -629,7 +645,16 @@ static int parse_do_push(parse_context_t *parser, int token, __attribute__((unus
parser->top -= 1;
result.symbol_action = parse_reduce_19(grammar);
parser->stack[parser->top].value.symbol_action = result.symbol_action;
- parser->stack[++parser->top].state = 27;
+ switch (parser->stack[parser->top].state) {
+ case 19:
+ parser->stack[++parser->top].state = 27;
+ break;
+
+ case 79:
+ parser->stack[++parser->top].state = 83;
+ break;
+
+ }
}
break;
@@ -1162,8 +1187,16 @@ static int parse_do_push(parse_context_t *parser, int token, __attribute__((unus
case 79:
switch (token) {
+ case TOK_BLOCK:
+ parser->stack[++parser->top].state = 30;
+ return 1;
+
+ case TOK_SQBLOCK:
+ parser->stack[++parser->top].state = 32;
+ return 1;
+
case ';':
- parser->stack[++parser->top].state = 83;
+ parser->stack[++parser->top].state = 36;
return 1;
default:
@@ -1212,8 +1245,9 @@ static int parse_do_push(parse_context_t *parser, int token, __attribute__((unus
switch (token) {
default:
parser->top -= 11;
- parse_reduce_11(parser->stack[parser->top + 0].value.token.str, parser->stack[parser->top + 4].value.token.c, parser->stack[parser->top + 8].value.token.c, grammar);
+ parse_reduce_11(parser->stack[parser->top + 0].value.token.str, parser->stack[parser->top + 4].value.token.c, parser->stack[parser->top + 8].value.token.c, parser->stack[parser->top + 10].value.symbol_action, grammar);
delete(parser->stack[parser->top + 0].value.token.str);
+ delete(parser->stack[parser->top + 10].value.symbol_action);
parser->stack[++parser->top].state = 2;
}
break;