Revert "scanner: use the same lookahead type throughout"

This reverts commit 734a4ccaed.
pull/252/head
Wilfred Hughes 2022-04-10 12:51:15 +07:00
parent 470b15a605
commit 99a2182dbe
1 changed files with 2 additions and 4 deletions

6
src/scanner.c vendored

@ -1,7 +1,5 @@
#include <tree_sitter/parser.h>
#define LOOKAHEAD_TYPE __typeof__(((TSLexer *)0)->lookahead)
enum TokenType {
STRING_FRAGMENT,
INDENTED_STRING_FRAGMENT,
@ -84,7 +82,7 @@ static bool scan_indented_string_fragment(TSLexer *lexer) {
}
}
static bool is_path_char(LOOKAHEAD_TYPE c) {
static bool is_path_char(char c) {
return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '-' || c == '+' || c == '_' || c == '.' || c == '/';
}
@ -93,7 +91,7 @@ static bool scan_path_start(TSLexer *lexer) {
bool have_sep = false;
bool have_after_sep = false;
LOOKAHEAD_TYPE c = lexer->lookahead;
char c = lexer->lookahead;
// unlike string_fragments which which are preceded by initial token (i.e. '"')
// and thus will have all leading external whitespace consumed,