Improve diff

This commit is contained in:
Andrew Helwer 2022-01-07 10:16:20 -05:00
parent ace81f6267
commit bfb692d2f7

View file

@ -152,6 +152,27 @@ static void ts_lexer_goto(Lexer *self, Length position) {
}
}
// Advance to the next character in the source code, retrieving a new
// chunk of source code if needed.
static void ts_lexer__advance(TSLexer *_self, bool skip) {
Lexer *self = (Lexer *)_self;
if (!self->chunk) return;
if (skip) {
LOG("skip", self->data.lookahead);
} else {
LOG("consume", self->data.lookahead);
}
ts_lexer__do_advance(self, skip);
}
// Advance without logging.
static void ts_lexer__advance_no_log(Lexer *self, bool skip) {
if (!self->chunk) return;
ts_lexer__do_advance(self, skip);
}
// Intended to be called only from functions below that control logging.
static void ts_lexer__do_advance(Lexer *self, bool skip) {
if (self->lookahead_size) {
@ -195,27 +216,6 @@ static void ts_lexer__do_advance(Lexer *self, bool skip) {
}
}
// Advance to the next character in the source code, retrieving a new
// chunk of source code if needed.
static void ts_lexer__advance(TSLexer *_self, bool skip) {
Lexer *self = (Lexer *)_self;
if (!self->chunk) return;
if (skip) {
LOG("skip", self->data.lookahead);
} else {
LOG("consume", self->data.lookahead);
}
ts_lexer__do_advance(self, skip);
}
// Advance without logging.
static void ts_lexer__advance_no_log(Lexer *self, bool skip) {
if (!self->chunk) return;
ts_lexer__do_advance(self, skip);
}
// Mark that a token match has completed. This can be called multiple
// times if a longer match is found later.
static void ts_lexer__mark_end(TSLexer *_self) {
@ -265,7 +265,6 @@ static uint32_t ts_lexer__get_column(TSLexer *_self) {
return result;
}
// Is the lexer at a boundary between two disjoint included ranges of
// source code? This is exposed as an API because some languages' external
// scanners need to perform custom actions at these boundaries.