WIP - try to fix travis build

This commit is contained in:
Max Brunsfeld 2014-04-08 20:34:29 -07:00
parent 2ab9caa87c
commit 6a0a28f4b3
10 changed files with 32 additions and 23 deletions

View file

@ -1,5 +1,5 @@
language: cpp
compiler:
- clang
- gcc
install: script/configure.sh
script: script/test.sh

View file

@ -48,9 +48,9 @@ static vector<TestEntry> 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()))
});
}

View file

@ -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,
}) {}

View file

@ -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", [&]() {

View file

@ -23,9 +23,8 @@ namespace tree_sitter {
}
case ParseActionTypeAccept:
return "accept";
case ParseActionTypeError:
default:
return "error";
break;
}
}

View file

@ -142,6 +142,8 @@ namespace tree_sitter {
return "ACCEPT_TOKEN(" + symbol_id(action.symbol) + ");";
case LexActionTypeError:
return "LEX_ERROR();";
default:
return "";
}
}

View file

@ -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("#<accept ") + action.symbol.name + ">";
case LexActionTypeAdvance:
return stream << string("#<advance ") + to_string(action.state_index) + ">";
default:
return stream;
}
}

View file

@ -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("#<shift ") + to_string(action.state_index) + ">");
case ParseActionTypeReduce:
return stream << (string("#<reduce ") + action.symbol.name + ">");
default:
return stream;
}
}

View file

@ -36,6 +36,8 @@ namespace tree_sitter {
return string("#<aux_sym '") + name + "'>";
case SymbolTypeBuiltIn:
return string("#<builtin_sym '") + name + "'>";
default:
return "";
}
}

View file

@ -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',