math_spec.expansion
Macro calls, expanded into the syntax tree before resolution reads it.
A named expression is resolution's: it resolves the entry once and puts that node where the name stood.
expand(node, ns, context)
#
Expand every macro call under node; a comparison stays a comparison and arithmetic stays arithmetic.
| PARAMETER | DESCRIPTION |
|---|---|
node
|
The parsed expression.
TYPE:
|
ns
|
Where the macros are declared.
TYPE:
|
context
|
What an error names.
TYPE:
|
Source code in src/math_spec/expansion.py
macro_signature(name, macro)
#
Human-readable call signature, for error messages.
parse_and_expand(text, ns, context)
#
parse_template(name, macro, context)
#
Parse a macro template, rejecting comparisons.