Make completion_status() a method on LexItem
This commit is contained in:
parent
c8be143f65
commit
998ae533da
10 changed files with 96 additions and 96 deletions
|
|
@ -38,6 +38,29 @@ describe("LexItem", []() {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("completion_status()", [&]() {
|
||||
it("indicates whether the item is done, its precedence, and whether it is a string", [&]() {
|
||||
LexItem item1(Symbol(0, true), character({ 'a', 'b', 'c' }));
|
||||
AssertThat(item1.completion_status().is_done, IsFalse());
|
||||
AssertThat(item1.completion_status().precedence, Equals(0));
|
||||
AssertThat(item1.completion_status().is_string, IsFalse());
|
||||
|
||||
LexItem item2(Symbol(0, true), choice({
|
||||
metadata(blank(), { {PRECEDENCE, 3}, {IS_STRING, 1} }),
|
||||
character({ 'a', 'b', 'c' })
|
||||
}));
|
||||
|
||||
AssertThat(item2.completion_status().is_done, IsTrue());
|
||||
AssertThat(item2.completion_status().precedence, Equals(3));
|
||||
AssertThat(item2.completion_status().is_string, IsTrue());
|
||||
|
||||
LexItem item3(Symbol(0, true), repeat(character({ ' ', '\t' })));
|
||||
AssertThat(item3.completion_status().is_done, IsTrue());
|
||||
AssertThat(item3.completion_status().precedence, Equals(0));
|
||||
AssertThat(item3.completion_status().is_string, IsFalse());
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("LexItemSet::transitions()", [&]() {
|
||||
|
|
|
|||
2
spec/fixtures/parsers/javascript.c
vendored
2
spec/fixtures/parsers/javascript.c
vendored
|
|
@ -594,7 +594,7 @@ static TSTree *ts_lex(TSLexer *lexer, TSStateId lex_state) {
|
|||
(lookahead == '\n') ||
|
||||
(lookahead == 'g')))
|
||||
ADVANCE(29);
|
||||
ACCEPT_TOKEN(sym_comment);
|
||||
ACCEPT_TOKEN(sym_regex);
|
||||
case 28:
|
||||
if (!((lookahead == 0) ||
|
||||
(lookahead == '\n')))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue