Ensure that there are no duplicate lex states
This commit is contained in:
parent
c9db5499e9
commit
386b124866
11 changed files with 418 additions and 401 deletions
|
|
@ -9,6 +9,7 @@ using std::ostream;
|
|||
using std::to_string;
|
||||
using std::set;
|
||||
using std::vector;
|
||||
using std::function;
|
||||
using rules::Symbol;
|
||||
|
||||
ParseAction::ParseAction(ParseActionType type, ParseStateId state_index,
|
||||
|
|
@ -126,6 +127,16 @@ set<Symbol> ParseState::expected_inputs() const {
|
|||
return result;
|
||||
}
|
||||
|
||||
void ParseState::each_action(function<void(ParseAction *)> fn) {
|
||||
for (auto &entry : actions)
|
||||
for (ParseAction &action : entry.second)
|
||||
fn(&action);
|
||||
}
|
||||
|
||||
bool ParseState::operator==(const ParseState &other) const {
|
||||
return actions == other.actions;
|
||||
}
|
||||
|
||||
set<Symbol> ParseTable::all_symbols() const {
|
||||
set<Symbol> result;
|
||||
for (auto &pair : symbols)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue