Created by: natefaubion
This is an ongoing PR to track the progress of infix macros. Please chime in at any point. I've broken it down into goals that I'll periodically update so you can see how far along it is:
-
Refactor the macro
macro to translate infixrule
s into infixcase
s. -
Refactor syntaxCase
to understand theinfix
form and matching semantics. -
Add "reverse" support to the pattern matcher (return a shallow-reversed pattern tree) -
Plumb together enforest
andexpandTermTree
to keep track of previous syntax/terms. -
Plumb the previous syntax/terms into the macro transformers. -
Rewrite enforestVarStatement
so we can lookbehind match on var assignment -
Fix withSyntax
which is broken for some reason -
Fix for-let enforestation/hygiene -
Test cases
For the time being, I'm using the following form for infix macros because it's the easiest to parse (anything before the bar is lookbehind, anything after is business as usual):
macro foo {
rule infix { $lhs | $rhs } => { ... }
case infix { $lhs | $name $rhs } => { ... }
}
Another proposed forms for infix case
s:
macro foo {
rule infix { $lhs | $rhs } => { ... }
case infix { $lhs |$name| $rhs } => { ... }
}
And @disnet liked the haskelly:
macro foo {
rule infix { $lhs | $rhs } => { ... }
case infix { $lhs `$name` $rhs } => { ... }
}