Add a TSLexer.eof() API, use it in generated parsers
This commit is contained in:
parent
a62b7a70f3
commit
d3b7caa565
6 changed files with 24 additions and 11 deletions
|
|
@ -45,7 +45,8 @@ struct TSLexer {
|
|||
void (*advance)(TSLexer *, bool);
|
||||
void (*mark_end)(TSLexer *);
|
||||
uint32_t (*get_column)(TSLexer *);
|
||||
bool (*is_at_included_range_start)(TSLexer *);
|
||||
bool (*is_at_included_range_start)(const TSLexer *);
|
||||
bool (*eof)(const TSLexer *);
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
|
|
@ -126,13 +127,15 @@ struct TSLanguage {
|
|||
#define START_LEXER() \
|
||||
bool result = false; \
|
||||
bool skip = false; \
|
||||
bool eof = false; \
|
||||
int32_t lookahead; \
|
||||
goto start; \
|
||||
next_state: \
|
||||
lexer->advance(lexer, skip); \
|
||||
start: \
|
||||
skip = false; \
|
||||
lookahead = lexer->lookahead;
|
||||
lookahead = lexer->lookahead; \
|
||||
eof = lexer->eof(lexer);
|
||||
|
||||
#define ADVANCE(state_value) \
|
||||
{ \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue