diff options
Diffstat (limited to 'src/parse.y')
-rw-r--r-- | src/parse.y | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/parse.y b/src/parse.y index dba747e..274e374 100644 --- a/src/parse.y +++ b/src/parse.y @@ -3,6 +3,9 @@ } %source { +typedef std::pair<std::vector<solar::symbol_t>, std::vector<std::string>> rhs_t; + + static inline void free_string(std::string *v) { delete v; } @@ -41,7 +44,7 @@ static inline void free_rule(solar::rule_t *v) { %type rule {solar::rule_t *} %destructor rule free_rule -%type rhs {std::pair<std::vector<solar::symbol_t>, std::vector<std::string>> *} +%type rhs {rhs_t *} %type action {std::string *} %destructor action free_string @@ -105,7 +108,7 @@ rule |= SYMBOL_LC(lhs) "|=" rhs(rhs) action(action) { } -rhs |= [new std::pair<std::vector<solar::symbol_t>, std::vector<std::string>>()] +rhs |= [new rhs_t()] rhs |= rhs(rhs) symbol(sym) { rhs->first.push_back(*sym); |