Simple (shit) working lexer via nlTokStream

Currently only tested on strings but its highly extendable if you modify the getTokType mapping of chars to their nlTokType
This commit is contained in:
Emile Clark-Boman 2025-06-18 01:25:20 +10:00
parent edf164df90
commit 3ce9390be4
8 changed files with 224 additions and 185 deletions

View file

@ -1,4 +1,5 @@
import os
import noether/lexer/tok
import noether/lexer/tokstream
when isMainModule:
@ -7,7 +8,10 @@ when isMainModule:
if paramCount() > 0:
let filename = paramStr(1)
var tokStream = newTokStream(filename, isFile=true)
for tok in toks(tokStream):
var tok: nlTok
while tokStream.nextTok(tok):
echo tok
else:
echo "usage: nlx filename"