diff options
author | Preston Pan <preston@nullring.xyz> | 2023-01-06 18:53:42 -0800 |
---|---|---|
committer | Preston Pan <preston@nullring.xyz> | 2023-01-06 18:53:42 -0800 |
commit | 0771dd0e1a143c17920d65d5de8d010aa433ce1c (patch) | |
tree | 1e6ea87bf5b2673bf810db502050e55d66a95f97 /src/lexer.c | |
parent | f32cb9a129ebf1755ea300cf311f487c5b9f0f04 (diff) |
add comments
Diffstat (limited to 'src/lexer.c')
-rw-r--r-- | src/lexer.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lexer.c b/src/lexer.c index db4c44b..29c6542 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -123,18 +123,20 @@ static token_t *lexer_move_with(lexer_t *lexer, token_t *token) { } token_t *lexer_collect_next(lexer_t *lexer) { +start: if (lexer->c == '\0' || lexer->c == EOF) { lexer->finished = true; return NULL; } - if (isspace(lexer->c)) { lexer_ignore_whitespace(lexer); + goto start; } - if (lexer->c == '\0' || lexer->c == EOF) { - lexer->finished = true; - return NULL; + if (lexer->c == ';') { + lexer_skip_comment(lexer); + goto start; } + if (isdigit(lexer->c)) return lexer_collect_num(lexer); else if (is_valid_id_char(lexer->c)) |