Merge pull request #2798 from tree-sitter/revert-2482-alt-2454

Revert "Alt #2454"
This commit is contained in:
Andrew Hlynskyi 2023-11-29 12:59:59 +02:00 committed by GitHub
commit 24e62e5c79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View file

@ -766,6 +766,7 @@ impl Generator {
indent!(self);
add_line!(self, "START_LEXER();");
add_line!(self, "eof = lexer->eof(lexer);");
add_line!(self, "switch (state) {{");
indent!(self);

View file

@ -129,9 +129,16 @@ struct TSLanguage {
* Lexer Macros
*/
#ifdef _MSC_VER
#define UNUSED __pragma(warning(suppress : 4101))
#else
#define UNUSED __attribute__((unused))
#endif
#define START_LEXER() \
bool result = false; \
bool skip = false; \
UNUSED \
bool eof = false; \
int32_t lookahead; \
goto start; \
@ -139,8 +146,7 @@ struct TSLanguage {
lexer->advance(lexer, skip); \
start: \
skip = false; \
lookahead = lexer->lookahead; \
eof = lexer->eof(lexer);
lookahead = lexer->lookahead;
#define ADVANCE(state_value) \
{ \