From 074a7884aaa4b90dbe2717ea9940165ccbc9e71e Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 13 Feb 2015 22:16:27 -0800 Subject: [PATCH] Fix uninitialized variable error --- src/compiler/build_tables/build_lex_table.cc | 1 + src/compiler/lex_table.cc | 2 ++ src/compiler/lex_table.h | 1 + 3 files changed, 4 insertions(+) diff --git a/src/compiler/build_tables/build_lex_table.cc b/src/compiler/build_tables/build_lex_table.cc index 52b350cb..063ee88a 100644 --- a/src/compiler/build_tables/build_lex_table.cc +++ b/src/compiler/build_tables/build_lex_table.cc @@ -85,6 +85,7 @@ class LexTableBuilder { LexItemSet item_set = build_lex_item_set(parse_table->symbols); add_accept_token_actions(item_set, LexTable::ERROR_STATE_ID); add_advance_actions(item_set, LexTable::ERROR_STATE_ID); + add_token_start(item_set, LexTable::ERROR_STATE_ID); } void add_advance_actions(const LexItemSet &item_set, LexStateId state_id) { diff --git a/src/compiler/lex_table.cc b/src/compiler/lex_table.cc index 25548cc1..16e272c4 100644 --- a/src/compiler/lex_table.cc +++ b/src/compiler/lex_table.cc @@ -56,6 +56,8 @@ std::ostream &operator<<(std::ostream &stream, const LexAction &action) { } } +LexState::LexState() : is_token_start(false) {} + set LexState::expected_inputs() const { set result; for (auto &pair : actions) diff --git a/src/compiler/lex_table.h b/src/compiler/lex_table.h index 9184d650..f68533c5 100644 --- a/src/compiler/lex_table.h +++ b/src/compiler/lex_table.h @@ -54,6 +54,7 @@ namespace tree_sitter { class LexState { public: + LexState(); std::map actions; LexAction default_action; std::set expected_inputs() const;