summaryrefslogtreecommitdiff
path: root/lex.c
diff options
context:
space:
mode:
Diffstat (limited to 'lex.c')
-rw-r--r--lex.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lex.c b/lex.c
index 7a1d345..12cd284 100644
--- a/lex.c
+++ b/lex.c
@@ -127,10 +127,19 @@ Token ident_to_keyword(Str ident) {
#define T(t) (l->tok = t)
void lex_next(Lexer *l) {
+recurse:
int i = l->ofs;
+
while (i < l->buf.n && is_space(l->buf.s[i])) {
i++;
}
+
+ if (str_starts(str_skip(l->buf, i), S("/*"))) {
+ Str f = str_find(str_skip(l->buf, i), S("*/"));
+ l->ofs = (f.s - l->buf.s) + 2;
+ goto recurse;
+ }
+
int start_ofs = i;
l->ident = (Str) { &l->buf.s[start_ofs], 0 };
if (i >= l->buf.n) {