Support :!~ symbols, add symbol test cases
* Support :!~ symbols, add symbol test cases
This commit updates the lexer to specifically match the symbol :!~.
I also add test cases from
:_
:!~
:''
Fixes tree-sitter/tree-sitter-ruby#143.
* fixup! Support :!~ symbols, add symbol test cases
@@ -280,18 +280,23 @@ struct Scanner {
}
return false;
- // &, ^, |, ~, /, %, !,`
+ // &, ^, |, ~, /, %`
case '&':
case '^':
case '|':
case '~':
case '/':
case '%':
- case '!':
case '`':
advance(lexer);
return true;
+ // !, !=, !~
+ case '!':
+ advance(lexer);
+ if (lexer->lookahead == '=' || lexer->lookahead == '~') advance(lexer);
+ return true;
+
// *, **
case '*':
advance(lexer);
@@ -316,6 +321,7 @@ struct Scanner {
}
bool scan_symbol_identifier(TSLexer *lexer) {
+
if (lexer->lookahead == '@') {
advance(lexer);
if (lexer->lookahead == '@') {
