Fix precedence of comments vs '/' operator
This commit is contained in:
parent
155a57d3ab
commit
174f306e2a
6 changed files with 1247 additions and 1234 deletions
|
|
@ -161,6 +161,9 @@ namespace tree_sitter_examples {
|
|||
{ "type_name", sym("_identifier") },
|
||||
{ "_identifier", pattern("\\a[\\w_]*") },
|
||||
{ "number", pattern("\\d+(\\.\\d+)?") },
|
||||
{ "comment", pattern("//[^\n]*") },
|
||||
|
||||
// TODO - make it clear how this number relates to the
|
||||
// precedence used by the `keyword` helper.
|
||||
{ "comment", token(prec(1000, pattern("//[^\n]*"))) },
|
||||
}).ubiquitous_tokens({ "comment" });
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -322,6 +322,7 @@ LEX_FN() {
|
|||
ADVANCE(27);
|
||||
LEX_ERROR();
|
||||
case ts_lex_state_error:
|
||||
START_TOKEN();
|
||||
if (lookahead == '\0')
|
||||
ADVANCE(25);
|
||||
if (('\t' <= lookahead && lookahead <= '\n') ||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue