summaryrefslogtreecommitdiffstats
path: root/src/grammar.hpp
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-04-18 20:06:23 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-04-18 20:06:23 +0200
commitba8f9797cb4f0c06d6a9ff11b51470a15eb81ee0 (patch)
tree5bb0d74725bf6e5651af913a9cea6a4c41cf5b80 /src/grammar.hpp
parent30c2141182f4eed1d3549603a7aa92c57b35d129 (diff)
downloadsolar-master.tar
solar-master.zip
Allow specifying actions for groups terminalsHEADmaster
Also, more refactoring.
Diffstat (limited to 'src/grammar.hpp')
-rw-r--r--src/grammar.hpp8
1 files changed, 4 insertions, 4 deletions
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<std::pair<std::string, std::string>> extra_args;
- void add_rule(const rule_t &rule) {
+ void add_rule(const item_t &item, const std::vector<std::pair<std::string, bool>> &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::pair<std::string, bool>>(), std::string()});
+ init.get_rhs().push_back(symbol_t::make_nonterm(item.get_lhs()));
+ rules.push_back({std::move(init), std::vector<std::pair<std::string, bool>>(), std::string()});
}
- rules.push_back(rule);
+ rules.push_back({item, variables, action});
}
const std::string & get_nonterm_type(const std::string &sym) const {