Trim trailing whitespace
This commit is contained in:
parent
c312f985c8
commit
2c382b7363
7 changed files with 15 additions and 15 deletions
|
|
@ -70,12 +70,12 @@ namespace tree_sitter {
|
|||
for (const auto &pair : item_set) {
|
||||
const ParseItem &item = pair.first;
|
||||
const set<Symbol> &lookahead_symbols = pair.second;
|
||||
|
||||
|
||||
if (item.is_done()) {
|
||||
ParseAction action = (item.lhs == rules::START()) ?
|
||||
ParseAction::Accept() :
|
||||
ParseAction::Reduce(item.lhs, item.consumed_symbol_count, item.precedence());
|
||||
|
||||
|
||||
for (auto &lookahead_sym : lookahead_symbols) {
|
||||
auto current_actions = parse_table.states[state_id].actions;
|
||||
auto current_action = current_actions.find(lookahead_sym);
|
||||
|
|
|
|||
|
|
@ -27,32 +27,32 @@ namespace tree_sitter {
|
|||
ParseItem item = items_to_process.back().first;
|
||||
set<Symbol> new_lookahead_symbols = items_to_process.back().second;
|
||||
items_to_process.pop_back();
|
||||
|
||||
|
||||
set<Symbol> &lookahead_symbols = result[item];
|
||||
size_t previous_size = lookahead_symbols.size();
|
||||
lookahead_symbols.insert(new_lookahead_symbols.begin(), new_lookahead_symbols.end());
|
||||
|
||||
if (lookahead_symbols.size() == previous_size)
|
||||
continue;
|
||||
|
||||
|
||||
for (const auto &pair : sym_transitions(item.rule)) {
|
||||
const Symbol &symbol = pair.first;
|
||||
const rule_ptr &next_rule = pair.second;
|
||||
|
||||
|
||||
if (symbol.is_token() || symbol.is_built_in())
|
||||
continue;
|
||||
|
||||
|
||||
set<Symbol> next_lookahead_symbols = first_set(next_rule, grammar);
|
||||
if (rule_can_be_blank(next_rule, grammar))
|
||||
next_lookahead_symbols.insert(lookahead_symbols.begin(), lookahead_symbols.end());
|
||||
|
||||
|
||||
items_to_process.push_back({
|
||||
ParseItem(symbol, grammar.rule(symbol), 0),
|
||||
next_lookahead_symbols
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace tree_sitter {
|
|||
size_t consumed_symbol_count) :
|
||||
Item(lhs, rule),
|
||||
consumed_symbol_count(consumed_symbol_count) {}
|
||||
|
||||
|
||||
bool ParseItem::operator==(const ParseItem &other) const {
|
||||
return
|
||||
(lhs == other.lhs) &&
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace tree_sitter {
|
|||
|
||||
namespace rules {
|
||||
static const int KEYWORD_PRECEDENCE = 100;
|
||||
|
||||
|
||||
static rule_ptr metadata(rule_ptr rule, map<MetadataKey, int> values) {
|
||||
return std::make_shared<Metadata>(rule, values);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue