mighty

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

commit f61b116fe8b1578f560805deac2c83cf863d3ee1
parent e0dd19e78c6fae540f403c99216fd4a89ab6f20b
Author: citbl <citbl@citbl.org>
Date:   Sun, 24 May 2026 00:03:33 +1000

wip

Diffstat:
Mmtcl/lexer.lua | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/mtcl/lexer.lua b/mtcl/lexer.lua @@ -2,7 +2,7 @@ local lexer = { tokens = {}, file = "", line = 1, - pos = 1, + col = 1, } local a = string.byte("a") @@ -130,17 +130,18 @@ function lexer:lex(file, src) self.col = self.col + 1 end elseif is_alpha(c:byte()) then + print("adding " .. " at col " .. i .. " self col: " .. self.col) word, i = read_ident(i, src) - self.col = i self:add(TK.IDENT, word) + self.col = i elseif is_digit(c:byte()) then number, i, is_float = read_number(i, src) - self.col = i if is_float then self:add(TK.LIT_FLOAT, number) else self:add(TK.LIT_INT, number) end + self.col = i elseif c == ":" then if next() == ":" then self:add(TK.COLONCOLON, "::")