frontend: lexer: Add token for tilde

Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
2026-03-21 16:24:20 -04:00
parent 046e49c7b3
commit c717e80636
3 changed files with 6 additions and 0 deletions

View File

@@ -281,6 +281,10 @@ lexer_scan(struct quip_state *state, struct token *tokres)
lexer_putback(state, c); lexer_putback(state, c);
tokres->type = TT_COLON; tokres->type = TT_COLON;
return 0; return 0;
case '~':
tokres->type = TT_TILDE;
tokres->c = c;
return 0;
default: default:
if (lexer_scan_name(state, c, tokres) == 0) { if (lexer_scan_name(state, c, tokres) == 0) {
return 0; return 0;

View File

@@ -40,6 +40,7 @@ static const char *toktab[] = {
[TT_CC] = qtok(".cc"), [TT_CC] = qtok(".cc"),
[TT_LD] = qtok(".ld"), [TT_LD] = qtok(".ld"),
[TT_COLON] = qtok(":"), [TT_COLON] = qtok(":"),
[TT_TILDE] = qtok("~"),
[TT_COLONDUB] = qtok("::") [TT_COLONDUB] = qtok("::")
}; };

View File

@@ -21,6 +21,7 @@ typedef enum {
TT_CC, /* '.cc' */ TT_CC, /* '.cc' */
TT_LD, /* '.ld' */ TT_LD, /* '.ld' */
TT_COLON, /* ':' */ TT_COLON, /* ':' */
TT_TILDE, /* '~' */
TT_COLONDUB, /* '::' */ TT_COLONDUB, /* '::' */
} tt_t; } tt_t;