diff options
| author | Carson Fleming <[email protected]> | 2026-03-13 01:13:01 -0400 |
|---|---|---|
| committer | Carson Fleming <[email protected]> | 2026-03-13 01:13:01 -0400 |
| commit | f2a46ca8fdb607c9810f657193062b5fb9b02d3f (patch) | |
| tree | 2d09445e431c043d4b3ac09f63c3d5340ec5d736 /lexer.c | |
| parent | ce5888af995771534dae5ffe9f5e6e3852aba734 (diff) | |
| download | ccc-f2a46ca8fdb607c9810f657193062b5fb9b02d3f.tar.gz | |
fill in some holes
Diffstat (limited to 'lexer.c')
| -rw-r--r-- | lexer.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -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; } |
