commit b0399d3cbdf97d17d42f6302952e04200513b1df
parent dc63b8ccfc2adecfba21bb09cd9a1917ae4e2dd0
Author: Eyal Sawady <ecs@d2evs.net>
Date: Sun, 27 Dec 2020 21:39:49 -0500
lex: fix tracing on comments
We need to call _lex instead of lex to avoid emmitting multiple traces.
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/lex.c b/src/lex.c
@@ -614,6 +614,8 @@ lex_label(struct lexer *lexer, struct token *out)
return out->token;
}
+static enum lexical_token _lex(struct lexer *lexer, struct token *out);
+
static enum lexical_token
lex2(struct lexer *lexer, struct token *out, uint32_t c)
{
@@ -663,7 +665,8 @@ lex2(struct lexer *lexer, struct token *out, uint32_t c)
break;
case '/':
while ((c = next(lexer, NULL, false)) != UTF8_INVALID && c != '\n') ;
- return lex(lexer, out);
+ trace(TR_LEX, "comment");
+ return _lex(lexer, out);
default:
push(lexer, c, false);
out->token = T_DIV;