ISymbol -> Symbol

Interned symbols are now the main type of symbol in use
This commit is contained in:
Max Brunsfeld 2014-04-28 20:43:27 -07:00
parent faf80aadac
commit 25eda9d889
45 changed files with 248 additions and 250 deletions

View file

@ -7,11 +7,11 @@ namespace tree_sitter {
using std::to_string;
using std::set;
using std::vector;
using rules::ISymbol;
using rules::Symbol;
ParseAction::ParseAction(ParseActionType type,
size_t state_index,
ISymbol symbol,
Symbol symbol,
size_t consumed_symbol_count,
set<int> precedence_values) :
type(type),
@ -22,23 +22,23 @@ namespace tree_sitter {
ParseAction::ParseAction() :
type(ParseActionTypeError),
symbol(ISymbol(-1)),
symbol(Symbol(-1)),
state_index(-1),
consumed_symbol_count(0) {}
ParseAction ParseAction::Error() {
return ParseAction(ParseActionTypeError, -1, ISymbol(-1), 0, { 0 });
return ParseAction(ParseActionTypeError, -1, Symbol(-1), 0, { 0 });
}
ParseAction ParseAction::Accept() {
return ParseAction(ParseActionTypeAccept, -1, ISymbol(-1), 0, { 0 });
return ParseAction(ParseActionTypeAccept, -1, Symbol(-1), 0, { 0 });
}
ParseAction ParseAction::Shift(size_t state_index, set<int> precedence_values) {
return ParseAction(ParseActionTypeShift, state_index, ISymbol(-1), 0, precedence_values);
return ParseAction(ParseActionTypeShift, state_index, Symbol(-1), 0, precedence_values);
}
ParseAction ParseAction::Reduce(ISymbol symbol, size_t consumed_symbol_count, int precedence) {
ParseAction ParseAction::Reduce(Symbol symbol, size_t consumed_symbol_count, int precedence) {
return ParseAction(ParseActionTypeReduce, -1, symbol, consumed_symbol_count, { precedence });
}
@ -66,8 +66,8 @@ namespace tree_sitter {
ParseState::ParseState() : lex_state_id(-1) {}
set<ISymbol> ParseState::expected_inputs() const {
set<ISymbol> result;
set<Symbol> ParseState::expected_inputs() const {
set<Symbol> result;
for (auto &pair : actions)
result.insert(pair.first);
return result;
@ -90,7 +90,7 @@ namespace tree_sitter {
return states.size() - 1;
}
void ParseTable::add_action(ParseStateId id, ISymbol symbol, ParseAction action) {
void ParseTable::add_action(ParseStateId id, Symbol symbol, ParseAction action) {
symbols.insert(symbol);
states[id].actions[symbol] = action;
}