summaryrefslogtreecommitdiffstats
path: root/src/parse.cpp
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-04-17 22:27:25 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-04-17 22:29:08 +0200
commit59db91599c0097b80a7ed61c6bb71e046f4d9f54 (patch)
tree82aaa98d7c6186b12d9a2cdb81ac615182d95072 /src/parse.cpp
parent9624984557151e405d62f134e12270475d7ca7e7 (diff)
downloadsolar-59db91599c0097b80a7ed61c6bb71e046f4d9f54.tar
solar-59db91599c0097b80a7ed61c6bb71e046f4d9f54.zip
Move initial rule handling to grammer_t
Diffstat (limited to 'src/parse.cpp')
-rw-r--r--src/parse.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/parse.cpp b/src/parse.cpp
index 9a24c03..bad9e24 100644
--- a/src/parse.cpp
+++ b/src/parse.cpp
@@ -80,13 +80,7 @@ static inline void parse_reduce_8(std::string *type, std::string *name, __attrib
}
static inline void parse_reduce_9(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()));
- grammar->rules.emplace_back(solar::rule_t {std::move(init), vars_t(), std::string()});
- }
-
- grammar->rules.push_back(*rule);
+ grammar->add_rule(*rule);
}
static inline solar::rule_t * parse_reduce_10(std::string *lhs, rhs_t *rhs, std::string *action, __attribute__((unused)) solar::grammar_t *grammar) {return new solar::rule_t {solar::item_t(*lhs, rhs->first), rhs->second, *action};}