diff options
| -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; } |
