diff --git a/.travis.yml b/.travis.yml index 66dbd0f1..7c4b84ce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: cpp compiler: - - clang + - gcc install: script/configure.sh script: script/test.sh diff --git a/spec/runtime/helpers/read_test_entries.cc b/spec/runtime/helpers/read_test_entries.cc index 58b47b27..d5c0301b 100644 --- a/spec/runtime/helpers/read_test_entries.cc +++ b/spec/runtime/helpers/read_test_entries.cc @@ -48,9 +48,9 @@ static vector get_test_entries_from_string(string content) { std::smatch matches; regex_search(body, matches, separator_pattern); result.push_back({ - .description = descriptions[i], - .input = body.substr(0, matches.position()), - .tree_string = trim_output(body.substr(matches.position() + matches[0].length())) + descriptions[i], + body.substr(0, matches.position()), + trim_output(body.substr(matches.position() + matches[0].length())) }); } diff --git a/spec/runtime/helpers/spy_reader.cc b/spec/runtime/helpers/spy_reader.cc index 927f3ac2..27f0201a 100644 --- a/spec/runtime/helpers/spy_reader.cc +++ b/spec/runtime/helpers/spy_reader.cc @@ -31,8 +31,8 @@ SpyReader::SpyReader(string content, size_t chunk_size) : position(0), chunk_size(chunk_size), input({ - .read_fn = spy_read, - .seek_fn = spy_seek, - .release_fn = spy_release, - .data = this + this, + spy_read, + spy_seek, + spy_release, }) {} diff --git a/spec/runtime/parser_spec.cc b/spec/runtime/parser_spec.cc index 6135c1c8..300c2a4a 100644 --- a/spec/runtime/parser_spec.cc +++ b/spec/runtime/parser_spec.cc @@ -39,11 +39,7 @@ describe("incremental parsing", [&]() { string inserted_text(", \"key2\": 4"); reader->content.insert(position, inserted_text); - ts_document_edit(doc, { - .position = position, - .bytes_removed = 0, - .bytes_inserted = inserted_text.length() - }); + ts_document_edit(doc, { position, 0, inserted_text.length() }); }); it("updates the parse tree", [&]() { @@ -63,11 +59,7 @@ describe("incremental parsing", [&]() { string inserted_text("\"key2\": 4, "); reader->content.insert(position, inserted_text); - ts_document_edit(doc, { - .position = position, - .bytes_removed = 0, - .bytes_inserted = inserted_text.length() - }); + ts_document_edit(doc, { position, 0, inserted_text.length() }); }); it("2 updates the parse tree", [&]() { diff --git a/src/compiler/build_tables/conflict_manager.cc b/src/compiler/build_tables/conflict_manager.cc index c2df0121..753f0689 100644 --- a/src/compiler/build_tables/conflict_manager.cc +++ b/src/compiler/build_tables/conflict_manager.cc @@ -23,9 +23,8 @@ namespace tree_sitter { } case ParseActionTypeAccept: return "accept"; - case ParseActionTypeError: + default: return "error"; - break; } } diff --git a/src/compiler/generate_code/c_code.cc b/src/compiler/generate_code/c_code.cc index 60f62094..40d3a92c 100644 --- a/src/compiler/generate_code/c_code.cc +++ b/src/compiler/generate_code/c_code.cc @@ -142,6 +142,8 @@ namespace tree_sitter { return "ACCEPT_TOKEN(" + symbol_id(action.symbol) + ");"; case LexActionTypeError: return "LEX_ERROR();"; + default: + return ""; } } diff --git a/src/compiler/lex_table.cc b/src/compiler/lex_table.cc index 273e2c45..056f1ff6 100644 --- a/src/compiler/lex_table.cc +++ b/src/compiler/lex_table.cc @@ -8,7 +8,10 @@ namespace tree_sitter { using rules::Symbol; using rules::CharacterSet; - LexAction::LexAction() : LexAction(LexActionTypeError, -1, Symbol("")) {} + LexAction::LexAction() : + type(LexActionTypeError), + symbol(Symbol("")), + state_index(-1) {} LexAction::LexAction(LexActionType type, size_t state_index, Symbol symbol) : type(type), @@ -42,6 +45,8 @@ namespace tree_sitter { return stream << string("#"; case LexActionTypeAdvance: return stream << string("#"; + default: + return stream; } } diff --git a/src/compiler/parse_table.cc b/src/compiler/parse_table.cc index 2414806e..0c71f317 100644 --- a/src/compiler/parse_table.cc +++ b/src/compiler/parse_table.cc @@ -18,7 +18,11 @@ namespace tree_sitter { state_index(state_index), consumed_symbol_count(consumed_symbol_count) {} - ParseAction::ParseAction() : ParseAction(ParseActionTypeError, -1, Symbol(""), {}) {} + ParseAction::ParseAction() : + type(ParseActionTypeError), + symbol(Symbol("")), + state_index(-1), + consumed_symbol_count(0) {} ParseAction ParseAction::Error() { return ParseAction(ParseActionTypeError, -1, Symbol(""), {}); @@ -53,6 +57,8 @@ namespace tree_sitter { return stream << (string("#"); case ParseActionTypeReduce: return stream << (string("#"); + default: + return stream; } } diff --git a/src/compiler/rules/symbol.cc b/src/compiler/rules/symbol.cc index 96b92a33..babc8100 100644 --- a/src/compiler/rules/symbol.cc +++ b/src/compiler/rules/symbol.cc @@ -36,6 +36,8 @@ namespace tree_sitter { return string("#"; case SymbolTypeBuiltIn: return string("#"; + default: + return ""; } } diff --git a/tree_sitter.gyp b/tree_sitter.gyp index 646a0fd2..c8a470e9 100644 --- a/tree_sitter.gyp +++ b/tree_sitter.gyp @@ -77,8 +77,11 @@ '-Wextra', '-Wno-unused-parameter' ], + 'cflags_c': [ + '-std=c99' + ], 'cflags_cc': [ - '-std=c++11', + '-std=c++0x', ], 'xcode_settings': { 'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',