exfmt v0.2.0 Exfmt.Ast.Infix
Handling the conversion of infix operators to Algebgra.
We need to be especially careful when rendering infix operators because we may need to render them differently depending on what the parent call is.
For example, if we had the AST {:*, [], [{:+, [] [1, 2}, 3]}
we might nievely render it like so:
1 + 2 * 3
However :*
binds more tightly than :+
, so it should
actually be rendered with parens like so:
(1 + 2) * 3
Failure to do render with parens results in the :*
and :+
operators to swap positions in the AST.
Link to this section Summary
Functions
A compile time list of all the infix operator atoms
Determine whether an infix operator is to be wrapped in parens in order to render correctly
Link to this section Functions
A compile time list of all the infix operator atoms.
Determine whether an infix operator is to be wrapped in parens in order to render correctly.