sic

The sic programming language, compiler and tools (WIP)
Log | Files | Refs

commit be550ebbc7fcacdf82759b2249f2485166ec15ff
parent 407194a44947ada45cf0baaa0c458077156a2eb2
Author: citbl <citbl@citbl.org>
Date:   Sun, 10 May 2026 20:42:57 +1000

cleanup

Diffstat:
Msrc/common.h | 2--
Msrc/lexer.c | 9++++++---
2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/common.h b/src/common.h @@ -75,8 +75,6 @@ typedef struct Lexer_State { size_t pos; size_t line; size_t col; - bool in_string; - bool in_comment; } Lexer_State; typedef struct Lexer { diff --git a/src/lexer.c b/src/lexer.c @@ -87,6 +87,12 @@ static void run_until_char(Lexer *lex, char c) static void lex_number(Lexer *lex) { + char c; + while (1) { + advance(lex); + c = peek(lex); + if (c != '.' && !isdigit(c)) break; + } } Lexer *lexer_lex(Lexer *lex) @@ -98,7 +104,6 @@ Lexer *lexer_lex(Lexer *lex) lex->tokens = calloc(250, sizeof(Token)); lex->state.pos = 0; - lex->state.in_string = false; // longest valid token first while (lex->state.pos <= len) { @@ -115,7 +120,6 @@ Lexer *lexer_lex(Lexer *lex) switch (c) { case '\"': - lex->state.in_string = true; t.type = LIT_STRING; advance(lex); c = lex->code[lex->state.pos]; @@ -125,7 +129,6 @@ Lexer *lexer_lex(Lexer *lex) c = lex->code[++lex->state.pos]; } advance(lex); - lex->state.in_string = false; add_token(lex, t); continue; case EOF: