Skip to content

Commit

Permalink
each constant and predicate can only be defined once
Browse files Browse the repository at this point in the history
  • Loading branch information
alan23273850 committed Aug 25, 2024
1 parent 1a6b114 commit 52bca0f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/timbuk_parser-nobison.cc
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,12 @@ AUTOQ::Automata<Symbol> AUTOQ::Parsing::TimbukParser<Symbol>::ReadAutomaton(cons
if (lhs.empty() || rhs.empty()) {
throw std::runtime_error(AUTOQ_LOG_PREFIX + "Invalid number \"" + str + "\".");
}
constants[lhs] = ComplexParser(rhs).getComplex();
if (constants.find(lhs) == constants.end()) {
constants[lhs] = ComplexParser(rhs).getComplex();
} else {
AUTOQ_ERROR("[ERROR] The constant \"" + lhs + "\" is already defined.");
exit(1);
}
}
}
}
Expand All @@ -973,7 +978,12 @@ AUTOQ::Automata<Symbol> AUTOQ::Parsing::TimbukParser<Symbol>::ReadAutomaton(cons
if (lhs.empty() || rhs.empty()) {
throw std::runtime_error(AUTOQ_LOG_PREFIX + "Invalid number \"" + str + "\".");
}
predicates[lhs] = rhs;
if (predicates.find(lhs) == predicates.end()) {
predicates[lhs] = rhs;
} else {
AUTOQ_ERROR("[ERROR] The predicate \"" + lhs + "\" is already defined.");
exit(1);
}
}
}
}
Expand Down

0 comments on commit 52bca0f

Please sign in to comment.