I added CodeLiteral to the bonsai model, to represent literals that cannot be handled by basic Python types.
It comes in handy when describing None values, so that Python Nones in the parsed files are not mixed with
Nones in the bonsai AST, with catastrophic outcomes. This has been implemented by the class CodeNull.
Another handy use is to describe composite literals, as seen in the class CodeCompositeLiteral. While it could be replaced by a plain Python list (an element for each item in the composite literal), its result attribute makes for more reusable code in cases where, like Python, more than one type of composite literal exist (tuples, lists, dictionaries...).
I added
CodeLiteral
to the bonsai model, to represent literals that cannot be handled by basic Python types.It comes in handy when describing
None
values, so that PythonNone
s in the parsed files are not mixed withNone
s in the bonsai AST, with catastrophic outcomes. This has been implemented by the classCodeNull
.Another handy use is to describe composite literals, as seen in the class
CodeCompositeLiteral
. While it could be replaced by a plain Python list (an element for each item in the composite literal), itsresult
attribute makes for more reusable code in cases where, like Python, more than one type of composite literal exist (tuples, lists, dictionaries...).It is already used in the branch davla:feature/py-parser