Note how to print lexed token names for future reference

This commit is contained in:
Rangi42
2025-07-14 10:25:47 -04:00
parent 35335aadbe
commit 0149122cd0

View File

@@ -2362,6 +2362,9 @@ yy::parser::symbol_type yylex() {
lexerState->lastToken = token.type; lexerState->lastToken = token.type;
lexerState->atLineStart = token.type == T_(NEWLINE) || token.type == T_(EOB); lexerState->atLineStart = token.type == T_(NEWLINE) || token.type == T_(EOB);
// Uncomment this if you want to debug what the lexer is lexing:
// fprintf(stderr, "{lexing %s}\n", yy::parser::symbol_type(token.type).name());
if (std::holds_alternative<uint32_t>(token.value)) { if (std::holds_alternative<uint32_t>(token.value)) {
return yy::parser::symbol_type(token.type, std::get<uint32_t>(token.value)); return yy::parser::symbol_type(token.type, std::get<uint32_t>(token.value));
} else if (std::holds_alternative<std::string>(token.value)) { } else if (std::holds_alternative<std::string>(token.value)) {