Rework LR conflict resolution

* Unify precedence/associativity-based resolution with the
  search for a whitelisted conflict
* Improve conflict error messages
This commit is contained in:
Max Brunsfeld 2016-11-17 17:29:10 -08:00
parent 7968da672f
commit 32387400c6
20 changed files with 719 additions and 910 deletions

View file

@ -26,30 +26,30 @@ enum ParseActionType {
class ParseAction {
ParseAction(ParseActionType type, ParseStateId state_index,
rules::Symbol symbol, size_t consumed_symbol_count,
PrecedenceRange range, rules::Associativity, const Production *);
const Production *);
public:
ParseAction();
static ParseAction Accept();
static ParseAction Error();
static ParseAction Shift(ParseStateId state_index, PrecedenceRange precedence);
static ParseAction Shift(ParseStateId state_index);
static ParseAction Recover(ParseStateId state_index);
static ParseAction Reduce(rules::Symbol symbol, size_t consumed_symbol_count,
int precedence, rules::Associativity,
const Production &);
static ParseAction ShiftExtra();
bool operator==(const ParseAction &) const;
bool operator<(const ParseAction &) const;
rules::Associativity associativity() const;
int precedence() const;
ParseActionType type;
bool extra;
bool fragile;
rules::Symbol symbol;
ParseStateId state_index;
size_t consumed_symbol_count;
PrecedenceRange precedence_range;
rules::Associativity associativity;
rules::Symbol symbol;
size_t consumed_symbol_count;
const Production *production;
};