From fcbea218a434ae872e184ec3d3043962ba9020f9 Mon Sep 17 00:00:00 2001 From: LordBaryhobal Date: Wed, 13 May 2026 21:31:28 +0200 Subject: [PATCH] feat(parser): add a test script for the annotation lexer --- lexer/token.py | 2 ++ test.py | 15 +++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 test.py diff --git a/lexer/token.py b/lexer/token.py index 3d0b293..e06194c 100644 --- a/lexer/token.py +++ b/lexer/token.py @@ -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() diff --git a/test.py b/test.py new file mode 100644 index 0000000..32c5d97 --- /dev/null +++ b/test.py @@ -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 +]) \ No newline at end of file