Add 'extra' field to symbol metadata

This stores whether a symbol is only ever used as a ubiquitous token. This will
allow ubiquitous nodes to be reused more effectively: if they are always
ubiquitous, then they can be reused immediately, and otherwise, they must be
broken down in case they need to be used structurally.
This commit is contained in:
Max Brunsfeld 2015-12-02 07:36:31 -08:00
parent f08554e958
commit ad619d95f6
13 changed files with 439 additions and 414 deletions

View file

@ -82,8 +82,13 @@ class ParseState {
LexStateId lex_state_id;
};
struct ParseTableSymbolMetadata {
bool structural;
};
class ParseTable {
public:
std::set<rules::Symbol> all_symbols() const;
ParseStateId add_state();
ParseAction &set_action(ParseStateId state_id, rules::Symbol symbol,
ParseAction action);
@ -91,7 +96,7 @@ class ParseTable {
ParseAction action);
std::vector<ParseState> states;
std::set<rules::Symbol> symbols;
std::map<rules::Symbol, ParseTableSymbolMetadata> symbols;
std::set<const Production *> fragile_productions;
};