feat(parser): add a test script for the annotation lexer

This commit is contained in:
2026-05-13 21:31:28 +02:00
parent 10ee4991c3
commit fcbea218a4
2 changed files with 17 additions and 0 deletions

View File

@@ -9,6 +9,8 @@ class TokenType(Enum):
# Punctuation
LEFT_PAREN = auto()
RIGHT_PAREN = auto()
LEFT_BRACKET = auto()
RIGHT_BRACKET = auto()
COLON = auto()
COMMA = auto()
UNDERSCORE = auto()

15
test.py Normal file
View File

@@ -0,0 +1,15 @@
import importlib
from lexer.annotations import AnnotationLexer
from lexer.token import Token
mod = importlib.import_module("examples.00_syntax_prototype.01_simple_types")
annotation: str = mod.__annotations__["df"]
lexer: AnnotationLexer = AnnotationLexer(annotation, "01_simple_types.py")
tokens: list[Token] = lexer.process()
print([
f"{t.type.name}('{t.lexeme}')"
for t in tokens
])