From 9b16bda965b29b6ba5ce3178abf8e4655e5af044 Mon Sep 17 00:00:00 2001 From: Shinichiro Hamaji Date: Fri, 19 Jun 2015 14:25:17 +0900 Subject: [C++] Parse all kinds of rules --- eval.cc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'eval.cc') diff --git a/eval.cc b/eval.cc index 93357b3..16791fa 100644 --- a/eval.cc +++ b/eval.cc @@ -87,13 +87,18 @@ void Evaluator::EvalRule(const RuleAST* ast) { if (expr->find_first_not_of(" \t\n;") == string::npos) return; - Rule* rule = new Rule; - rule->loc = loc_; - rule->Parse(*expr); + Rule* rule; + RuleVar rule_var; + ParseRule(loc_, *expr, &rule, &rule_var); + + if (rule) { + LOG("Rule: %s", rule->DebugString().c_str()); + rules_.push_back(rule); + last_rule_ = rule; + return; + } - LOG("Rule: %s", rule->DebugString().c_str()); - rules_.push_back(rule); - last_rule_ = rule; + CHECK(false); } void Evaluator::EvalCommand(const CommandAST* ast) { -- cgit v1.2.3