From c717e8063688bdd5fb263b79110f4e6e08d6aed5 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sat, 21 Mar 2026 16:24:20 -0400 Subject: [PATCH] frontend: lexer: Add token for tilde Signed-off-by: Ian Moffett --- frontend/lexer.c | 4 ++++ frontend/parser.c | 1 + include/frontend/token.h | 1 + 3 files changed, 6 insertions(+) diff --git a/frontend/lexer.c b/frontend/lexer.c index 649a1da..82d5016 100644 --- a/frontend/lexer.c +++ b/frontend/lexer.c @@ -281,6 +281,10 @@ lexer_scan(struct quip_state *state, struct token *tokres) lexer_putback(state, c); tokres->type = TT_COLON; return 0; + case '~': + tokres->type = TT_TILDE; + tokres->c = c; + return 0; default: if (lexer_scan_name(state, c, tokres) == 0) { return 0; diff --git a/frontend/parser.c b/frontend/parser.c index 67b8576..a7d1f7e 100644 --- a/frontend/parser.c +++ b/frontend/parser.c @@ -40,6 +40,7 @@ static const char *toktab[] = { [TT_CC] = qtok(".cc"), [TT_LD] = qtok(".ld"), [TT_COLON] = qtok(":"), + [TT_TILDE] = qtok("~"), [TT_COLONDUB] = qtok("::") }; diff --git a/include/frontend/token.h b/include/frontend/token.h index e8f909f..9d15b7c 100644 --- a/include/frontend/token.h +++ b/include/frontend/token.h @@ -21,6 +21,7 @@ typedef enum { TT_CC, /* '.cc' */ TT_LD, /* '.ld' */ TT_COLON, /* ':' */ + TT_TILDE, /* '~' */ TT_COLONDUB, /* '::' */ } tt_t;