From 2c382b7363a31e60323a156a29458e7fe3ef9e4e Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 16 Jun 2014 21:33:35 -0700 Subject: [PATCH] Trim trailing whitespace --- spec/compiler/build_tables/get_metadata_spec.cc | 4 ++-- spec/compiler/compiler_specs.cc | 2 +- spec/runtime/languages/golang/statements.txt | 4 ++-- src/compiler/build_tables/build_parse_table.cc | 4 ++-- src/compiler/build_tables/item_set_closure.cc | 12 ++++++------ src/compiler/build_tables/parse_item.cc | 2 +- src/compiler/rules/rules.cc | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/spec/compiler/build_tables/get_metadata_spec.cc b/spec/compiler/build_tables/get_metadata_spec.cc index 59f08092..8129bd96 100644 --- a/spec/compiler/build_tables/get_metadata_spec.cc +++ b/spec/compiler/build_tables/get_metadata_spec.cc @@ -28,13 +28,13 @@ describe("getting metadata for rules", []() { it("returns 0 if the rule does not have the key", [&]() { AssertThat(get_metadata(rule, MetadataKey(0)), Equals(0)); }); - + describe("when the rule contains another metadata rule", [&]() { it("also gets metadata from the inner metadata rule", [&]() { rule = make_shared(make_shared(sym("x"), map({ { key1, 1 } })), map()); - + AssertThat(get_metadata(rule, key1), Equals(1)); }); }); diff --git a/spec/compiler/compiler_specs.cc b/spec/compiler/compiler_specs.cc index b971db39..2fdde15a 100644 --- a/spec/compiler/compiler_specs.cc +++ b/spec/compiler/compiler_specs.cc @@ -5,7 +5,7 @@ int main(int argc, char *argv[]) { "", "--no-color", "--only=" - "compiles the javascript" + "" }; return bandit::run(4, const_cast(args)); } diff --git a/spec/runtime/languages/golang/statements.txt b/spec/runtime/languages/golang/statements.txt index 312447ab..f67dbc59 100644 --- a/spec/runtime/languages/golang/statements.txt +++ b/spec/runtime/languages/golang/statements.txt @@ -42,11 +42,11 @@ package main func main() { if condition1() { } - + if condition2() { } else { } - + if condition3() { } else if condition4() { } diff --git a/src/compiler/build_tables/build_parse_table.cc b/src/compiler/build_tables/build_parse_table.cc index c2605bea..6fbc444f 100644 --- a/src/compiler/build_tables/build_parse_table.cc +++ b/src/compiler/build_tables/build_parse_table.cc @@ -70,12 +70,12 @@ namespace tree_sitter { for (const auto &pair : item_set) { const ParseItem &item = pair.first; const set &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); diff --git a/src/compiler/build_tables/item_set_closure.cc b/src/compiler/build_tables/item_set_closure.cc index 305f26fc..4f315b48 100644 --- a/src/compiler/build_tables/item_set_closure.cc +++ b/src/compiler/build_tables/item_set_closure.cc @@ -27,32 +27,32 @@ namespace tree_sitter { ParseItem item = items_to_process.back().first; set new_lookahead_symbols = items_to_process.back().second; items_to_process.pop_back(); - + set &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 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; } } diff --git a/src/compiler/build_tables/parse_item.cc b/src/compiler/build_tables/parse_item.cc index 280bf620..0096f202 100644 --- a/src/compiler/build_tables/parse_item.cc +++ b/src/compiler/build_tables/parse_item.cc @@ -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) && diff --git a/src/compiler/rules/rules.cc b/src/compiler/rules/rules.cc index 03578002..30a368b7 100644 --- a/src/compiler/rules/rules.cc +++ b/src/compiler/rules/rules.cc @@ -24,7 +24,7 @@ namespace tree_sitter { namespace rules { static const int KEYWORD_PRECEDENCE = 100; - + static rule_ptr metadata(rule_ptr rule, map values) { return std::make_shared(rule, values); }