From f2a46ca8fdb607c9810f657193062b5fb9b02d3f Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Fri, 13 Mar 2026 01:13:01 -0400 Subject: fill in some holes --- lexer.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'lexer.c') diff --git a/lexer.c b/lexer.c index d21a405..7e2f5a4 100644 --- a/lexer.c +++ b/lexer.c @@ -144,12 +144,17 @@ static void lex_char_lit(struct token* p_token) { } static void lex_str_lit(struct token* p_token) { + /* TODO: impl */ +} +static bool lex_complex_operator(enum token_type* p_token_type, char c) { + /* TODO: impl 2 char operators */ + return false; } -enum token_type lex_simple(char c) { +static enum token_type lex_simple_operator(char c) { switch (c) { - case '*': return STAR; /* TODO: *= */ + case '*': return STAR; case '#': return HASHTAG; case '(': return LPAREN; case ')': return RPAREN; @@ -162,6 +167,7 @@ enum token_type lex_simple(char c) { case ',': return COMMA; case '.': return DOT; case '?': return QMARK; + /* TODO: fill in */ } CCC_ERROR("lexer: unexpected token %c", c); } @@ -201,8 +207,8 @@ bool lexer_pop(struct token* p_token) { lex_char_lit(p_token); else if (c == '"') lex_str_lit(p_token); - else - *p_token = (struct token) {.type = lex_simple(c)}; + else if (!lex_complex_operator(&p_token->type, c)) + p_token->type = lex_simple_operator(c); return true; } -- cgit v1.2.3