Closed The-Arx closed 4 months ago
Describe the bug
When a token is the outermost layer of a tree, transformer raises AttributeError: 'Token' object has no attribute 'children'.
AttributeError: 'Token' object has no attribute 'children'
Here is a simple program causing the bug.
from lark import Lark, Transformer l = Lark("""?start: INT %import common.INT """) class MyTransformer(Transformer): def INT(self, value): return int(value) tree = l.parse("123") # Token('INT', '123') MyTransformer().transform(tree)
Fixed. Thanks for reporting.
Describe the bug
When a token is the outermost layer of a tree, transformer raises
AttributeError: 'Token' object has no attribute 'children'
.Here is a simple program causing the bug.