From ba8f9797cb4f0c06d6a9ff11b51470a15eb81ee0 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 18 Apr 2015 20:06:23 +0200 Subject: Allow specifying actions for groups terminals Also, more refactoring. --- src/grammar.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/grammar.hpp') diff --git a/src/grammar.hpp b/src/grammar.hpp index 6e766c7..41c6316 100644 --- a/src/grammar.hpp +++ b/src/grammar.hpp @@ -48,14 +48,14 @@ struct grammar_t { std::vector> extra_args; - void add_rule(const rule_t &rule) { + void add_rule(const item_t &item, const std::vector> &variables, const std::string &action) { if (rules.empty()) { item_t init(""); - init.get_rhs().push_back(symbol_t::make_nonterm(rule.item.get_lhs())); - rules.emplace_back(solar::rule_t {std::move(init), std::vector>(), std::string()}); + init.get_rhs().push_back(symbol_t::make_nonterm(item.get_lhs())); + rules.push_back({std::move(init), std::vector>(), std::string()}); } - rules.push_back(rule); + rules.push_back({item, variables, action}); } const std::string & get_nonterm_type(const std::string &sym) const { -- cgit v1.2.3