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 macromacro to translate infixrules into infixcases. -
Refactor syntaxCaseto understand theinfixform and matching semantics. -
Add "reverse" support to the pattern matcher (return a shallow-reversed pattern tree) -
Plumb together enforestandexpandTermTreeto keep track of previous syntax/terms. -
Plumb the previous syntax/terms into the macro transformers. -
Rewrite enforestVarStatementso we can lookbehind match on var assignment -
Fix withSyntaxwhich 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 cases:
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 } => { ... }
}