summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-04-10 18:01:10 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-04-10 18:01:10 +0200
commit634e5db20969023f7545ad0780181b0d3085567d (patch)
treed231dd42c6fd48e6ac52aafbf79cd637b6d1e9ea /src
parent650fff74dee63fd69a150470bf9b71c0ea8d4b13 (diff)
downloadsolar-634e5db20969023f7545ad0780181b0d3085567d.tar
solar-634e5db20969023f7545ad0780181b0d3085567d.zip
Don't parse keywords in the lexer
Diffstat (limited to 'src')
-rw-r--r--src/lex.cpp92
-rw-r--r--src/lex.hpp3
-rw-r--r--src/parse.cpp1617
-rw-r--r--src/parse.hpp12
-rw-r--r--src/parse.y10
5 files changed, 800 insertions, 934 deletions
diff --git a/src/lex.cpp b/src/lex.cpp
index 3746c91..9415d8b 100644
--- a/src/lex.cpp
+++ b/src/lex.cpp
@@ -34,26 +34,6 @@
namespace solar {
-
-struct keyword_t {
- const char *keyword;
- int token;
-};
-
-/* the keyword list must be sorted */
-static const keyword_t keywords[] = {
- {"%extra_arg", TOK_EXTRA_ARG},
- {"%header", TOK_HEADER},
- {"%source", TOK_SOURCE},
- {"%type", TOK_TYPE},
-};
-
-static int compare_keywords(const void *v1, const void *v2) {
- const keyword_t *k1 = static_cast<const keyword_t*>(v1), *k2 = static_cast<const keyword_t*>(v2);
- return std::strcmp(k1->keyword, k2->keyword);
-}
-
-
bool lex_t::advance() {
if (start > 0) {
std::memmove(buffer, buffer+start, end - start);
@@ -183,61 +163,6 @@ int lex_t::lex_string(parse_token_value_t *value) {
return TOK_STRING;
}
-/*
-int lex_t::lex_number(parse_token_value_t *value) {
- if (needspace)
- return syntax_error(value);
-
- while (next(false)) {
- char cur = current();
-
- if (cur >= '0' && cur <= '9')
- continue;
-
- if (cur == 'x' || (cur >= 'a' && cur <= 'f') || (cur >= 'A' && cur <= 'F'))
- continue;
-
- break;
- }
-
- char *endptr, *token = get_token();
- value->number = std::strtoull(token, &endptr, 0);
-
- bool ok = !*endptr;
- free(token);
-
- if (!ok)
- return syntax_error(value);
-
- consume(true);
-
- return TOK_UINT;
-}*/
-
-int lex_t::lex_keyword(parse_token_value_t *value) {
- if (needspace)
- return syntax_error(value);
-
- while (next(false)) {
- char cur = current();
-
- if (!((cur >= 'a' && cur <= 'z') || (cur >= '0' && cur <= '9') || cur == '_'))
- break;
- }
-
- std::string *token = get_token();
- const keyword_t key = { .keyword = token->c_str(), .token = 0 };
- const keyword_t *ret = static_cast<const keyword_t*>(bsearch(&key, keywords, array_size(keywords), sizeof(keyword_t), compare_keywords));
- delete token;
-
- if (!ret)
- return syntax_error(value);
-
- consume(true);
-
- return ret->token;
-}
-
int lex_t::unterminated_block(parse_token_value_t *value) {
if (ferror(file))
return io_error(value);
@@ -366,8 +291,18 @@ int lex_t::lex(parse_token_value_t *value) {
case '\r':
next(true);
consume(false);
+ dumb_mode = false;
continue;
+ }
+
+ if (dumb_mode) {
+ token = current();
+ next(true);
+ consume(false);
+ return token;
+ }
+ switch (current()) {
case ';':
case ':':
case '|':
@@ -432,7 +367,12 @@ int lex_t::lex(parse_token_value_t *value) {
return lex_symbol(value);
case '%':
- return lex_keyword(value);
+ dumb_mode = true;
+
+ token = current();
+ next(true);
+ consume(false);
+ return token;
default:
return syntax_error(value);
diff --git a/src/lex.hpp b/src/lex.hpp
index bbf1de2..417c6e4 100644
--- a/src/lex.hpp
+++ b/src/lex.hpp
@@ -51,6 +51,7 @@ private:
std::FILE *file;
bool needspace;
+ bool dumb_mode;
size_t start;
size_t end;
@@ -69,8 +70,6 @@ private:
int unterminated_string(parse_token_value_t *value);
int lex_string(parse_token_value_t *value);
- //int lex_number(parse_token_value_t *value);
- int lex_keyword(parse_token_value_t *value);
int lex_block(parse_token_value_t *value);
int lex_symbol(parse_token_value_t *value);
diff --git a/src/parse.cpp b/src/parse.cpp
index d09522c..7c8b1f2 100644
--- a/src/parse.cpp
+++ b/src/parse.cpp
@@ -167,23 +167,11 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
parser->stack[++parser->top].state = 1;
break;
- case TOK_EXTRA_ARG:
- parser->stack[++parser->top].state = 1;
- break;
-
- case TOK_HEADER:
- parser->stack[++parser->top].state = 1;
- break;
-
- case TOK_SOURCE:
- parser->stack[++parser->top].state = 1;
- break;
-
case TOK_SYMBOL_LC:
parser->stack[++parser->top].state = 1;
break;
- case TOK_TYPE:
+ case '%':
parser->stack[++parser->top].state = 1;
break;
@@ -197,31 +185,16 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
case 0:
return 0;
- case TOK_EXTRA_ARG:
+ case TOK_SYMBOL_LC:
parser->stack[parser->top].value.token = *value;
parser->stack[++parser->top].state = 4;
return 1;
- case TOK_HEADER:
+ case '%':
parser->stack[parser->top].value.token = *value;
parser->stack[++parser->top].state = 5;
return 1;
- case TOK_SOURCE:
- parser->stack[parser->top].value.token = *value;
- parser->stack[++parser->top].state = 6;
- return 1;
-
- case TOK_SYMBOL_LC:
- parser->stack[parser->top].value.token = *value;
- parser->stack[++parser->top].state = 7;
- return 1;
-
- case TOK_TYPE:
- parser->stack[parser->top].value.token = *value;
- parser->stack[++parser->top].state = 8;
- return 1;
-
default:
return -1;
}
@@ -234,27 +207,12 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
parser->stack[++parser->top].state = 1;
break;
- case TOK_EXTRA_ARG:
- parser->top -= 2;
- parser->stack[++parser->top].state = 1;
- break;
-
- case TOK_HEADER:
- parser->top -= 2;
- parser->stack[++parser->top].state = 1;
- break;
-
- case TOK_SOURCE:
- 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 TOK_TYPE:
+ case '%':
parser->top -= 2;
parser->stack[++parser->top].state = 1;
break;
@@ -272,31 +230,13 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
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:
+ case '%':
parser->top -= 1;
parse_reduce_3(parser->stack[parser->top + 0].value.symbol_rule, grammar);
parser->stack[++parser->top].state = 2;
@@ -309,9 +249,9 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
case 4:
switch (token) {
- case TOK_BLOCK:
+ case '|':
parser->stack[parser->top].value.token = *value;
- parser->stack[++parser->top].state = 9;
+ parser->stack[++parser->top].state = 6;
return 1;
default:
@@ -321,7 +261,22 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
case 5:
switch (token) {
- case TOK_BLOCK:
+ case 'e':
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 7;
+ return 1;
+
+ case 'h':
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 8;
+ return 1;
+
+ case 's':
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 9;
+ return 1;
+
+ case 't':
parser->stack[parser->top].value.token = *value;
parser->stack[++parser->top].state = 10;
return 1;
@@ -333,7 +288,7 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
case 6:
switch (token) {
- case TOK_BLOCK:
+ case '=':
parser->stack[parser->top].value.token = *value;
parser->stack[++parser->top].state = 11;
return 1;
@@ -345,7 +300,7 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
case 7:
switch (token) {
- case '|':
+ case 'x':
parser->stack[parser->top].value.token = *value;
parser->stack[++parser->top].state = 12;
return 1;
@@ -357,19 +312,82 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
case 8:
switch (token) {
- case TOK_CHAR:
+ case 'e':
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 13;
+ return 1;
+
+ default:
+ return -1;
+ }
+ break;
+
+ case 9:
+ switch (token) {
+ case 'o':
parser->stack[parser->top].value.token = *value;
parser->stack[++parser->top].state = 14;
return 1;
- case TOK_SYMBOL_LC:
+ default:
+ return -1;
+ }
+ break;
+
+ case 10:
+ switch (token) {
+ case 'y':
parser->stack[parser->top].value.token = *value;
parser->stack[++parser->top].state = 15;
return 1;
+ default:
+ return -1;
+ }
+ break;
+
+ 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.token = *value;
+ parser->stack[parser->top].value.symbol_rhs = parse_reduce_10(grammar);
+ parser->stack[++parser->top].state = 16;
+ break;
+
+ case ';':
+ parser->stack[parser->top].value.symbol_rhs = parse_reduce_10(grammar);
parser->stack[++parser->top].state = 16;
+ break;
+
+ default:
+ return -1;
+ }
+ break;
+
+ case 12:
+ switch (token) {
+ case 't':
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 17;
return 1;
default:
@@ -377,19 +395,33 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
}
break;
- case 9:
+ case 13:
switch (token) {
- case TOK_SYMBOL:
+ case 'a':
parser->stack[parser->top].value.token = *value;
parser->stack[++parser->top].state = 18;
return 1;
- case TOK_SYMBOL_LC:
+ default:
+ return -1;
+ }
+ break;
+
+ case 14:
+ switch (token) {
+ case 'u':
parser->stack[parser->top].value.token = *value;
parser->stack[++parser->top].state = 19;
return 1;
- case TOK_SYMBOL_UC:
+ default:
+ return -1;
+ }
+ break;
+
+ case 15:
+ switch (token) {
+ case 'p':
parser->stack[parser->top].value.token = *value;
parser->stack[++parser->top].state = 20;
return 1;
@@ -399,42 +431,109 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
}
break;
- case 10:
+ case 16:
switch (token) {
- case 0:
- parser->top -= 2;
- parse_reduce_7(parser->stack[parser->top + 1].value.token.str, grammar);
- parser->stack[++parser->top].state = 2;
- break;
+ case TOK_BLOCK:
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 24;
+ return 1;
- case TOK_EXTRA_ARG:
- parser->top -= 2;
- parse_reduce_7(parser->stack[parser->top + 1].value.token.str, grammar);
- parser->stack[++parser->top].state = 2;
- break;
+ case TOK_CHAR:
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 25;
+ return 1;
- case TOK_HEADER:
- parser->top -= 2;
- parse_reduce_7(parser->stack[parser->top + 1].value.token.str, grammar);
- parser->stack[++parser->top].state = 2;
- break;
+ case TOK_STRING:
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 26;
+ return 1;
- case TOK_SOURCE:
- parser->top -= 2;
- parse_reduce_7(parser->stack[parser->top + 1].value.token.str, grammar);
- parser->stack[++parser->top].state = 2;
+ case TOK_SYMBOL_LC:
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 27;
+ return 1;
+
+ case TOK_SYMBOL_UC:
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 28;
+ return 1;
+
+ case ';':
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 29;
+ return 1;
+
+ default:
+ return -1;
+ }
+ break;
+
+ case 17:
+ switch (token) {
+ case 'r':
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 30;
+ return 1;
+
+ default:
+ return -1;
+ }
+ break;
+
+ case 18:
+ switch (token) {
+ case 'd':
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 31;
+ return 1;
+
+ default:
+ return -1;
+ }
+ break;
+
+ case 19:
+ switch (token) {
+ case 'r':
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 32;
+ return 1;
+
+ default:
+ return -1;
+ }
+ break;
+
+ case 20:
+ switch (token) {
+ case 'e':
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 33;
+ return 1;
+
+ default:
+ return -1;
+ }
+ break;
+
+ 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 -= 2;
- parse_reduce_7(parser->stack[parser->top + 1].value.token.str, grammar);
- parser->stack[++parser->top].state = 2;
+ 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_TYPE:
- parser->top -= 2;
- parse_reduce_7(parser->stack[parser->top + 1].value.token.str, grammar);
- parser->stack[++parser->top].state = 2;
+ case '%':
+ 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:
@@ -442,42 +541,47 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
}
break;
- case 11:
+ case 22:
switch (token) {
- case 0:
+ case TOK_BLOCK:
parser->top -= 2;
- parse_reduce_6(parser->stack[parser->top + 1].value.token.str, grammar);
- parser->stack[++parser->top].state = 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_EXTRA_ARG:
+ case TOK_CHAR:
parser->top -= 2;
- parse_reduce_6(parser->stack[parser->top + 1].value.token.str, grammar);
- parser->stack[++parser->top].state = 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_HEADER:
+ case TOK_STRING:
parser->top -= 2;
- parse_reduce_6(parser->stack[parser->top + 1].value.token.str, grammar);
- parser->stack[++parser->top].state = 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_SOURCE:
+ case TOK_SYMBOL_LC:
parser->top -= 2;
- parse_reduce_6(parser->stack[parser->top + 1].value.token.str, grammar);
- parser->stack[++parser->top].state = 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:
+ case TOK_SYMBOL_UC:
parser->top -= 2;
- parse_reduce_6(parser->stack[parser->top + 1].value.token.str, grammar);
- parser->stack[++parser->top].state = 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_TYPE:
+ case '(':
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 34;
+ return 1;
+
+ case ';':
parser->top -= 2;
- parse_reduce_6(parser->stack[parser->top + 1].value.token.str, grammar);
- parser->stack[++parser->top].state = 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:
@@ -485,41 +589,91 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
}
break;
- case 12:
+ case 23:
switch (token) {
- case '=':
- parser->stack[parser->top].value.token = *value;
- parser->stack[++parser->top].state = 21;
- return 1;
+ 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 ';':
+ 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 13:
+ case 24:
switch (token) {
- case TOK_BLOCK:
- parser->stack[parser->top].value.token = *value;
- parser->stack[++parser->top].state = 22;
- return 1;
+ 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 '%':
+ 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 14:
+ 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 8:
- parser->stack[++parser->top].state = 13;
+ case 16:
+ parser->stack[++parser->top].state = 23;
break;
- case 24:
- parser->stack[++parser->top].state = 28;
+ case 33:
+ parser->stack[++parser->top].state = 38;
break;
}
break;
@@ -528,11 +682,11 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
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 8:
- parser->stack[++parser->top].state = 13;
+ case 16:
+ parser->stack[++parser->top].state = 23;
break;
- case 24:
- parser->stack[++parser->top].state = 28;
+ case 33:
+ parser->stack[++parser->top].state = 38;
break;
}
break;
@@ -541,11 +695,11 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
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 8:
- parser->stack[++parser->top].state = 13;
+ case 16:
+ parser->stack[++parser->top].state = 23;
break;
- case 24:
- parser->stack[++parser->top].state = 28;
+ case 33:
+ parser->stack[++parser->top].state = 38;
break;
}
break;
@@ -554,11 +708,11 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
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 8:
- parser->stack[++parser->top].state = 13;
+ case 16:
+ parser->stack[++parser->top].state = 23;
break;
- case 24:
- parser->stack[++parser->top].state = 28;
+ case 33:
+ parser->stack[++parser->top].state = 38;
break;
}
break;
@@ -567,11 +721,11 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
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 8:
- parser->stack[++parser->top].state = 13;
+ case 16:
+ parser->stack[++parser->top].state = 23;
break;
- case 24:
- parser->stack[++parser->top].state = 28;
+ case 33:
+ parser->stack[++parser->top].state = 38;
break;
}
break;
@@ -580,11 +734,11 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
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 8:
- parser->stack[++parser->top].state = 13;
+ case 16:
+ parser->stack[++parser->top].state = 23;
break;
- case 24:
- parser->stack[++parser->top].state = 28;
+ case 33:
+ parser->stack[++parser->top].state = 38;
break;
}
break;
@@ -593,11 +747,11 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
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 8:
- parser->stack[++parser->top].state = 13;
+ case 16:
+ parser->stack[++parser->top].state = 23;
break;
- case 24:
- parser->stack[++parser->top].state = 28;
+ case 33:
+ parser->stack[++parser->top].state = 38;
break;
}
break;
@@ -607,29 +761,109 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
}
break;
- case 15:
+ case 26:
switch (token) {
case TOK_BLOCK:
- parser->stack[parser->top].value.token = *value;
- parser->stack[++parser->top].state = 23;
- return 1;
+ 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 ';':
+ 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 16:
+ 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 ';':
+ 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 8:
- parser->stack[++parser->top].state = 13;
+ case 16:
+ parser->stack[++parser->top].state = 23;
break;
- case 24:
- parser->stack[++parser->top].state = 28;
+ case 33:
+ parser->stack[++parser->top].state = 38;
break;
}
break;
@@ -638,11 +872,11 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
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 8:
- parser->stack[++parser->top].state = 13;
+ case 16:
+ parser->stack[++parser->top].state = 23;
break;
- case 24:
- parser->stack[++parser->top].state = 28;
+ case 33:
+ parser->stack[++parser->top].state = 38;
break;
}
break;
@@ -651,11 +885,11 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
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 8:
- parser->stack[++parser->top].state = 13;
+ case 16:
+ parser->stack[++parser->top].state = 23;
break;
- case 24:
- parser->stack[++parser->top].state = 28;
+ case 33:
+ parser->stack[++parser->top].state = 38;
break;
}
break;
@@ -664,11 +898,11 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
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 8:
- parser->stack[++parser->top].state = 13;
+ case 16:
+ parser->stack[++parser->top].state = 23;
break;
- case 24:
- parser->stack[++parser->top].state = 28;
+ case 33:
+ parser->stack[++parser->top].state = 38;
break;
}
break;
@@ -677,11 +911,11 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
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 8:
- parser->stack[++parser->top].state = 13;
+ case 16:
+ parser->stack[++parser->top].state = 23;
break;
- case 24:
- parser->stack[++parser->top].state = 28;
+ case 33:
+ parser->stack[++parser->top].state = 38;
break;
}
break;
@@ -690,11 +924,11 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
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 8:
- parser->stack[++parser->top].state = 13;
+ case 16:
+ parser->stack[++parser->top].state = 23;
break;
- case 24:
- parser->stack[++parser->top].state = 28;
+ case 33:
+ parser->stack[++parser->top].state = 38;
break;
}
break;
@@ -703,11 +937,11 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
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 8:
- parser->stack[++parser->top].state = 13;
+ case 16:
+ parser->stack[++parser->top].state = 23;
break;
- case 24:
- parser->stack[++parser->top].state = 28;
+ case 33:
+ parser->stack[++parser->top].state = 38;
break;
}
break;
@@ -717,111 +951,197 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
}
break;
- case 17:
+ case 29:
switch (token) {
case 0:
- 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;
+ parser->top -= 1;
+ parser->stack[parser->top].value.symbol_action = parse_reduce_14(grammar);
+ parser->stack[++parser->top].state = 21;
break;
- case TOK_EXTRA_ARG:
- 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;
+ 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 TOK_HEADER:
- 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;
+ case '%':
+ parser->top -= 1;
+ parser->stack[parser->top].value.symbol_action = parse_reduce_14(grammar);
+ parser->stack[++parser->top].state = 21;
break;
- case TOK_SOURCE:
- 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:
+ return -1;
+ }
+ break;
+
+ case 30:
+ switch (token) {
+ case 'a':
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 35;
+ return 1;
+
+ default:
+ return -1;
+ }
+ break;
+
+ case 31:
+ switch (token) {
+ case 'e':
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 36;
+ return 1;
+
+ default:
+ return -1;
+ }
+ break;
+
+ case 32:
+ switch (token) {
+ case 'c':
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 37;
+ return 1;
+
+ default:
+ return -1;
+ }
+ break;
+
+ case 33:
+ switch (token) {
+ case TOK_CHAR:
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 25;
+ return 1;
case TOK_SYMBOL_LC:
- 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;
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 39;
+ return 1;
- case TOK_TYPE:
- 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_UC:
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 28;
+ return 1;
default:
return -1;
}
break;
- case 18:
+ case 34:
switch (token) {
- case 0:
- 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 9:
- parser->stack[++parser->top].state = 17;
- break;
- case 22:
- parser->stack[++parser->top].state = 25;
- break;
- case 33:
- parser->stack[++parser->top].state = 34;
- break;
- }
- break;
+ case TOK_SYMBOL:
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 41;
+ return 1;
- case TOK_EXTRA_ARG:
- 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 9:
- parser->stack[++parser->top].state = 17;
- break;
- case 22:
- parser->stack[++parser->top].state = 25;
- break;
- case 33:
- parser->stack[++parser->top].state = 34;
- break;
- }
- break;
+ case TOK_SYMBOL_LC:
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 42;
+ return 1;
- case TOK_HEADER:
- 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 9:
- parser->stack[++parser->top].state = 17;
- break;
- case 22:
- parser->stack[++parser->top].state = 25;
- break;
- case 33:
- parser->stack[++parser->top].state = 34;
- break;
- }
- break;
+ case TOK_SYMBOL_UC:
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 43;
+ return 1;
+
+ default:
+ return -1;
+ }
+ break;
+
+ case 35:
+ switch (token) {
+ case '_':
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 44;
+ return 1;
+
+ default:
+ return -1;
+ }
+ break;
+
+ case 36:
+ switch (token) {
+ case 'r':
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 45;
+ return 1;
+
+ default:
+ return -1;
+ }
+ break;
+
+ case 37:
+ switch (token) {
+ case 'e':
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 46;
+ return 1;
+
+ default:
+ return -1;
+ }
+ break;
- case TOK_SOURCE:
+ case 38:
+ switch (token) {
+ case TOK_BLOCK:
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 47;
+ return 1;
+
+ default:
+ return -1;
+ }
+ break;
+
+ case 39:
+ switch (token) {
+ case TOK_BLOCK:
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 48;
+ return 1;
+
+ default:
+ return -1;
+ }
+ break;
+
+ case 40:
+ switch (token) {
+ case ')':
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 49;
+ return 1;
+
+ default:
+ return -1;
+ }
+ break;
+
+ case 41:
+ switch (token) {
+ case 0:
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 9:
- parser->stack[++parser->top].state = 17;
+ case 34:
+ parser->stack[++parser->top].state = 40;
break;
- case 22:
- parser->stack[++parser->top].state = 25;
+ case 47:
+ parser->stack[++parser->top].state = 53;
break;
- case 33:
- parser->stack[++parser->top].state = 34;
+ case 56:
+ parser->stack[++parser->top].state = 57;
break;
}
break;
@@ -830,30 +1150,30 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
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 9:
- parser->stack[++parser->top].state = 17;
+ case 34:
+ parser->stack[++parser->top].state = 40;
break;
- case 22:
- parser->stack[++parser->top].state = 25;
+ case 47:
+ parser->stack[++parser->top].state = 53;
break;
- case 33:
- parser->stack[++parser->top].state = 34;
+ case 56:
+ parser->stack[++parser->top].state = 57;
break;
}
break;
- case TOK_TYPE:
+ 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 9:
- parser->stack[++parser->top].state = 17;
+ case 34:
+ parser->stack[++parser->top].state = 40;
break;
- case 22:
- parser->stack[++parser->top].state = 25;
+ case 47:
+ parser->stack[++parser->top].state = 53;
break;
- case 33:
- parser->stack[++parser->top].state = 34;
+ case 56:
+ parser->stack[++parser->top].state = 57;
break;
}
break;
@@ -862,14 +1182,14 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
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 9:
- parser->stack[++parser->top].state = 17;
+ case 34:
+ parser->stack[++parser->top].state = 40;
break;
- case 22:
- parser->stack[++parser->top].state = 25;
+ case 47:
+ parser->stack[++parser->top].state = 53;
break;
- case 33:
- parser->stack[++parser->top].state = 34;
+ case 56:
+ parser->stack[++parser->top].state = 57;
break;
}
break;
@@ -879,68 +1199,20 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
}
break;
- case 19:
+ case 42:
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);
switch (parser->stack[parser->top].state) {
- case 9:
- parser->stack[++parser->top].state = 17;
+ case 34:
+ parser->stack[++parser->top].state = 40;
break;
- case 22:
- parser->stack[++parser->top].state = 25;
+ case 47:
+ parser->stack[++parser->top].state = 53;
break;
- 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);
- switch (parser->stack[parser->top].state) {
- case 9:
- parser->stack[++parser->top].state = 17;
- break;
- case 22:
- parser->stack[++parser->top].state = 25;
- break;
- 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);
- switch (parser->stack[parser->top].state) {
- case 9:
- parser->stack[++parser->top].state = 17;
- break;
- case 22:
- parser->stack[++parser->top].state = 25;
- break;
- 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);
- switch (parser->stack[parser->top].state) {
- case 9:
- parser->stack[++parser->top].state = 17;
- break;
- case 22:
- parser->stack[++parser->top].state = 25;
- break;
- case 33:
- parser->stack[++parser->top].state = 34;
+ case 56:
+ parser->stack[++parser->top].state = 57;
break;
}
break;
@@ -949,30 +1221,30 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
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 9:
- parser->stack[++parser->top].state = 17;
+ case 34:
+ parser->stack[++parser->top].state = 40;
break;
- case 22:
- parser->stack[++parser->top].state = 25;
+ case 47:
+ parser->stack[++parser->top].state = 53;
break;
- case 33:
- parser->stack[++parser->top].state = 34;
+ case 56:
+ parser->stack[++parser->top].state = 57;
break;
}
break;
- case TOK_TYPE:
+ 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 9:
- parser->stack[++parser->top].state = 17;
+ case 34:
+ parser->stack[++parser->top].state = 40;
break;
- case 22:
- parser->stack[++parser->top].state = 25;
+ case 47:
+ parser->stack[++parser->top].state = 53;
break;
- case 33:
- parser->stack[++parser->top].state = 34;
+ case 56:
+ parser->stack[++parser->top].state = 57;
break;
}
break;
@@ -981,14 +1253,14 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
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 9:
- parser->stack[++parser->top].state = 17;
+ case 34:
+ parser->stack[++parser->top].state = 40;
break;
- case 22:
- parser->stack[++parser->top].state = 25;
+ case 47:
+ parser->stack[++parser->top].state = 53;
break;
- case 33:
- parser->stack[++parser->top].state = 34;
+ case 56:
+ parser->stack[++parser->top].state = 57;
break;
}
break;
@@ -998,68 +1270,20 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
}
break;
- case 20:
+ case 43:
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);
switch (parser->stack[parser->top].state) {
- case 9:
- parser->stack[++parser->top].state = 17;
- break;
- case 22:
- parser->stack[++parser->top].state = 25;
- break;
- 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);
- switch (parser->stack[parser->top].state) {
- case 9:
- parser->stack[++parser->top].state = 17;
- break;
- case 22:
- parser->stack[++parser->top].state = 25;
- break;
- 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);
- switch (parser->stack[parser->top].state) {
- case 9:
- parser->stack[++parser->top].state = 17;
- break;
- case 22:
- parser->stack[++parser->top].state = 25;
- break;
- 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);
- switch (parser->stack[parser->top].state) {
- case 9:
- parser->stack[++parser->top].state = 17;
+ case 34:
+ parser->stack[++parser->top].state = 40;
break;
- case 22:
- parser->stack[++parser->top].state = 25;
+ case 47:
+ parser->stack[++parser->top].state = 53;
break;
- case 33:
- parser->stack[++parser->top].state = 34;
+ case 56:
+ parser->stack[++parser->top].state = 57;
break;
}
break;
@@ -1068,30 +1292,30 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
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 9:
- parser->stack[++parser->top].state = 17;
+ case 34:
+ parser->stack[++parser->top].state = 40;
break;
- case 22:
- parser->stack[++parser->top].state = 25;
+ case 47:
+ parser->stack[++parser->top].state = 53;
break;
- case 33:
- parser->stack[++parser->top].state = 34;
+ case 56:
+ parser->stack[++parser->top].state = 57;
break;
}
break;
- case TOK_TYPE:
+ 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 9:
- parser->stack[++parser->top].state = 17;
+ case 34:
+ parser->stack[++parser->top].state = 40;
break;
- case 22:
- parser->stack[++parser->top].state = 25;
+ case 47:
+ parser->stack[++parser->top].state = 53;
break;
- case 33:
- parser->stack[++parser->top].state = 34;
+ case 56:
+ parser->stack[++parser->top].state = 57;
break;
}
break;
@@ -1100,14 +1324,14 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
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 9:
- parser->stack[++parser->top].state = 17;
+ case 34:
+ parser->stack[++parser->top].state = 40;
break;
- case 22:
- parser->stack[++parser->top].state = 25;
+ case 47:
+ parser->stack[++parser->top].state = 53;
break;
- case 33:
- parser->stack[++parser->top].state = 34;
+ case 56:
+ parser->stack[++parser->top].state = 57;
break;
}
break;
@@ -1117,58 +1341,23 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
}
break;
- case 21:
+ case 44:
switch (token) {
- case TOK_BLOCK:
- 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_10(grammar);
- parser->stack[++parser->top].state = 24;
- break;
-
- case TOK_STRING:
- 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_10(grammar);
- parser->stack[++parser->top].state = 24;
- break;
-
- case TOK_SYMBOL_UC:
- 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_10(grammar);
- parser->stack[++parser->top].state = 24;
- break;
+ case 'a':
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 50;
+ return 1;
default:
return -1;
}
break;
- case 22:
+ case 45:
switch (token) {
- case TOK_SYMBOL:
- parser->stack[parser->top].value.token = *value;
- parser->stack[++parser->top].state = 18;
- return 1;
-
- case TOK_SYMBOL_LC:
- parser->stack[parser->top].value.token = *value;
- parser->stack[++parser->top].state = 19;
- return 1;
-
- case TOK_SYMBOL_UC:
+ case TOK_BLOCK:
parser->stack[parser->top].value.token = *value;
- parser->stack[++parser->top].state = 20;
+ parser->stack[++parser->top].state = 51;
return 1;
default:
@@ -1176,79 +1365,33 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
}
break;
- case 23:
+ case 46:
switch (token) {
- case 0:
- 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 -= 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 -= 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 -= 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 -= 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 -= 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_BLOCK:
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 52;
+ return 1;
default:
return -1;
}
break;
- case 24:
+ case 47:
switch (token) {
- case TOK_BLOCK:
- parser->stack[parser->top].value.token = *value;
- parser->stack[++parser->top].state = 29;
- return 1;
-
- case TOK_CHAR:
- parser->stack[parser->top].value.token = *value;
- parser->stack[++parser->top].state = 14;
- return 1;
-
- case TOK_STRING:
+ case TOK_SYMBOL:
parser->stack[parser->top].value.token = *value;
- parser->stack[++parser->top].state = 30;
+ parser->stack[++parser->top].state = 41;
return 1;
case TOK_SYMBOL_LC:
parser->stack[parser->top].value.token = *value;
- parser->stack[++parser->top].state = 31;
+ parser->stack[++parser->top].state = 42;
return 1;
case TOK_SYMBOL_UC:
parser->stack[parser->top].value.token = *value;
- parser->stack[++parser->top].state = 16;
- return 1;
-
- case ';':
- parser->stack[parser->top].value.token = *value;
- parser->stack[++parser->top].state = 32;
+ parser->stack[++parser->top].state = 43;
return 1;
default:
@@ -1256,41 +1399,23 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
}
break;
- case 25:
+ case 48:
switch (token) {
case 0:
- 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 -= 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 -= 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 -= 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->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 -= 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->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_TYPE:
- 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);
+ case '%':
+ 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;
@@ -1299,42 +1424,42 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
}
break;
- case 26:
+ case 49:
switch (token) {
- case 0:
+ case TOK_BLOCK:
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;
+ 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_EXTRA_ARG:
+ case TOK_CHAR:
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;
+ 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_HEADER:
+ case TOK_STRING:
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;
+ 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_SOURCE:
+ 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;
+ 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:
+ case TOK_SYMBOL_UC:
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;
+ 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_TYPE:
+ case ';':
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;
+ 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:
@@ -1342,96 +1467,36 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
}
break;
- case 27:
+ case 50:
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 = 24;
- 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 = 24;
- 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 = 24;
- 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 = 24;
- 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 = 24;
- break;
-
- case '(':
+ case 'r':
parser->stack[parser->top].value.token = *value;
- parser->stack[++parser->top].state = 33;
+ parser->stack[++parser->top].state = 54;
return 1;
- case ';':
- 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 = 24;
- break;
-
default:
return -1;
}
break;
- case 28:
+ case 51:
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 = 27;
- 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 = 27;
- 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 = 27;
+ 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 -= 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 = 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.symbol_term, 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.symbol_term, grammar);
- parser->stack[++parser->top].state = 27;
+ parser->top -= 8;
+ parse_reduce_7(parser->stack[parser->top + 7].value.token.str, grammar);
+ parser->stack[++parser->top].state = 2;
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 = 27;
+ case '%':
+ parser->top -= 8;
+ parse_reduce_7(parser->stack[parser->top + 7].value.token.str, grammar);
+ parser->stack[++parser->top].state = 2;
break;
default:
@@ -1439,42 +1504,24 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
}
break;
- case 29:
+ case 52:
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 = 26;
- break;
-
- case TOK_EXTRA_ARG:
- 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 = 26;
- break;
-
- case TOK_HEADER:
- 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 = 26;
- break;
-
- case TOK_SOURCE:
- 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 = 26;
+ 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 -= 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 = 26;
+ parser->top -= 8;
+ parse_reduce_6(parser->stack[parser->top + 7].value.token.str, grammar);
+ parser->stack[++parser->top].state = 2;
break;
- case TOK_TYPE:
- 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 = 26;
+ case '%':
+ parser->top -= 8;
+ parse_reduce_6(parser->stack[parser->top + 7].value.token.str, grammar);
+ parser->stack[++parser->top].state = 2;
break;
default:
@@ -1482,42 +1529,24 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
}
break;
- case 30:
+ case 53:
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 = 24;
- 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 = 24;
- 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 = 24;
+ 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 -= 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 = 24;
- 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 = 24;
+ 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 ';':
- 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 = 24;
+ case '%':
+ 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:
@@ -1525,113 +1554,45 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
}
break;
- case 31:
+ case 54:
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 = 27;
- 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 = 27;
- 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 = 27;
- 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 = 27;
- 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 = 27;
- 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 = 27;
- 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 = 27;
- break;
+ case 'g':
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 55;
+ return 1;
default:
return -1;
}
break;
- case 32:
+ case 55:
switch (token) {
- case 0:
- parser->top -= 1;
- 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_14(grammar);
- parser->stack[++parser->top].state = 26;
- break;
-
- case TOK_HEADER:
- parser->top -= 1;
- 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_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_14(grammar);
- parser->stack[++parser->top].state = 26;
- break;
-
- case TOK_TYPE:
- parser->top -= 1;
- parser->stack[parser->top].value.symbol_action = parse_reduce_14(grammar);
- parser->stack[++parser->top].state = 26;
- break;
+ case TOK_BLOCK:
+ parser->stack[parser->top].value.token = *value;
+ parser->stack[++parser->top].state = 56;
+ return 1;
default:
return -1;
}
break;
- case 33:
+ case 56:
switch (token) {
case TOK_SYMBOL:
parser->stack[parser->top].value.token = *value;
- parser->stack[++parser->top].state = 18;
+ parser->stack[++parser->top].state = 41;
return 1;
case TOK_SYMBOL_LC:
parser->stack[parser->top].value.token = *value;
- parser->stack[++parser->top].state = 19;
+ parser->stack[++parser->top].state = 42;
return 1;
case TOK_SYMBOL_UC:
parser->stack[parser->top].value.token = *value;
- parser->stack[++parser->top].state = 20;
+ parser->stack[++parser->top].state = 43;
return 1;
default:
@@ -1639,54 +1600,24 @@ int parse_push(parse_context_t *parser, int token, const parse_token_value_t *va
}
break;
- case 34:
+ case 57:
switch (token) {
- case ')':
- parser->stack[parser->top].value.token = *value;
- parser->stack[++parser->top].state = 35;
- return 1;
-
- default:
- return -1;
- }
- break;
-
- case 35:
- 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 = 24;
- 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 = 24;
- 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 = 24;
+ 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 -= 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 = 24;
- 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 = 24;
+ 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 ';':
- 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 = 24;
+ case '%':
+ 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:
diff --git a/src/parse.hpp b/src/parse.hpp
index 86aa095..7b3d73f 100644
--- a/src/parse.hpp
+++ b/src/parse.hpp
@@ -6,14 +6,10 @@
enum parse_token_t {
TOK_BLOCK = 256,
TOK_CHAR = 257,
- TOK_EXTRA_ARG = 258,
- TOK_HEADER = 259,
- TOK_SOURCE = 260,
- TOK_STRING = 261,
- TOK_SYMBOL = 262,
- TOK_SYMBOL_LC = 263,
- TOK_SYMBOL_UC = 264,
- TOK_TYPE = 265,
+ TOK_STRING = 258,
+ TOK_SYMBOL = 259,
+ TOK_SYMBOL_LC = 260,
+ TOK_SYMBOL_UC = 261,
};
typedef struct parse_token_value {
diff --git a/src/parse.y b/src/parse.y
index 52f53a6..259e0de 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -34,14 +34,14 @@ directive |= rule(rule) {
delete rule;
}
-directive |= 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;
}
-directive |= 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;
@@ -49,17 +49,17 @@ directive |= TYPE term(term) BLOCK(type) varname(name) {
delete name;
}
-directive |= SOURCE BLOCK(block) {
+directive |= "%source" BLOCK(block) {
grammar->source_block = *block;
delete block;
}
-directive |= HEADER BLOCK(block) {
+directive |= "%header" BLOCK(block) {
grammar->header_block = *block;
delete block;
}
-directive |= 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;