Node structure
Fields in a node structure:
- context
-
A number passed from the parent indicating its precedence context that the expression is embedded it.
- precedence
-
A number as determined by the operator at this level.
- parens
-
'true' if we should to add parenthesis based on context and precedence values; '' if not. We don't nest equal precedence for unuary ops. The unary op precedence is given by UNARY_OP_PRECEDENCE
*item type
The string name for the node. It can be used to determine the overall structure. For example a 'binop' node will have a body with a node left-hand side, the string operation name and a body right-hand side. Right now the type names are a little funky, but over time I hope these will less so.
* item sep (optional)
A string indicating how to separate the the strings extracted from the texts
field. The field is subject to format expansion. In particular tt can have '%;' in it to indicate we are separating statements. the body.
* item texts
A reference to a list containing either:
* item a tuple with a strings, and a op address * a DeparseTreee::Node object
* item text
Text representation of the node. Eventually this will diasppear and, you'll use one of the node-to-string conversion routines.
* item maybe_parens
If this node is embedded in the parent above, whether we need to add parenthesis. The keys is a hash ref hash reference