feat(parser): add midas lexer to test script

This commit is contained in:
2026-05-13 22:07:23 +02:00
parent 1fc842e23f
commit cc4b5dabf2

15
test.py
View File

@@ -1,9 +1,12 @@
import importlib
from pathlib import Path
from lexer.annotations import AnnotationLexer
from lexer.midas import MidasLexer
from lexer.token import Token
# Frame annotation
mod = importlib.import_module("examples.00_syntax_prototype.01_simple_types")
annotation: str = mod.__annotations__["df"]
@@ -12,4 +15,14 @@ tokens: list[Token] = lexer.process()
print([
f"{t.type.name}('{t.lexeme}')"
for t in tokens
])
])
# Midas type definitions
path: Path = Path("examples") / "00_syntax_prototype" / "02_custom_types.midas"
definitions: str = path.read_text()
midas_lexer: MidasLexer = MidasLexer(definitions, path.name)
tokens = midas_lexer.process()
print([
f"{t.type.name}('{t.lexeme}')"
for t in tokens
])