From f0def28d9aeeb7f1f9b3d8880a34a05ec59d80ed Mon Sep 17 00:00:00 2001 From: lemon Date: Sun, 14 Aug 2022 07:25:40 +0200 Subject: multiline comment and stuff --- bootstrap/parse.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'bootstrap/parse.c') diff --git a/bootstrap/parse.c b/bootstrap/parse.c index be32985..8707709 100644 --- a/bootstrap/parse.c +++ b/bootstrap/parse.c @@ -394,6 +394,18 @@ lex(struct parser *P) { tok.t = '#FIL'; } else if (!strcmp(s, "#LINE")) { tok.t = '#LIN'; + } else if (!strcmp(s, "#!")) { + if (chr(P) != '{') fatal(P, P->tokspan, "expected '{' after '#!'"); + int bal = 1; + while (bal != 0) { + switch (lex(P).t) { + case '{': ++bal; break; + case '}': --bal; break; + case TKeof: fatal(P, tok.span, "unterminated comment"); + } + } + return lex(P); + } else { fatal(P, P->tokspan, "invalid #keyword"); } -- cgit v1.2.3