commit 2890510b07d458352206d97a82a8769ad434a829
parent 572b914b0cae05792a721f5e93bac3dca5842ce7
Author: Eyal Sawady <ecs@d2evs.net>
Date: Tue, 20 Oct 2020 23:33:42 -0400
lex: handle comments
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/lex.c b/src/lex.c
@@ -417,6 +417,9 @@ lex2(struct lexer *lexer, struct token *out, int c)
case '=':
out->token = T_DIVEQ;
break;
+ case '/':
+ while ((c = next(lexer, false)) != EOF && c != '\n') ;
+ return lex(lexer, out);
default:
push(lexer, c, false);
out->token = T_DIV;
@@ -550,7 +553,7 @@ lex(struct lexer *lexer, struct token *out)
case '^': // ^ ^=
case '*': // * *=
case '%': // % %=
- case '/': // / /=
+ case '/': // / /= //
case '+': // + +=
case '-': // - -=
case ':': // : ::