Handle ambiguities between extra and non-extra tokens using normal GLR splitting
This commit is contained in:
parent
d31934ac77
commit
b76574e01c
8 changed files with 63 additions and 100 deletions
|
|
@ -65,15 +65,6 @@ ParseAction ParseAction::ShiftExtra() {
|
|||
return action;
|
||||
}
|
||||
|
||||
ParseAction ParseAction::ReduceExtra(Symbol symbol) {
|
||||
ParseAction action;
|
||||
action.type = ParseActionTypeReduce;
|
||||
action.extra = true;
|
||||
action.symbol = symbol;
|
||||
action.consumed_symbol_count = 1;
|
||||
return action;
|
||||
}
|
||||
|
||||
ParseAction ParseAction::Reduce(Symbol symbol, size_t consumed_symbol_count,
|
||||
int precedence,
|
||||
rules::Associativity associativity,
|
||||
|
|
@ -133,6 +124,13 @@ bool ParseTableEntry::operator==(const ParseTableEntry &other) const {
|
|||
|
||||
ParseState::ParseState() : lex_state_id(-1) {}
|
||||
|
||||
bool ParseState::has_shift_action() const {
|
||||
for (const auto &pair : entries)
|
||||
if (pair.second.actions.size() > 0 && pair.second.actions.back().type == ParseActionTypeShift)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
set<Symbol> ParseState::expected_inputs() const {
|
||||
set<Symbol> result;
|
||||
for (auto &entry : entries)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue