Created by: natefaubion
This adds a new form to the pattern language for named groups. Where normal groups use the $(...)
and $[...]
forms, named groups use the $foo:(...)
and $foo:[...]
forms. The full syntax matched will be bound to the name. Additionally, if you decide to use names within the group, they will be concatenated with the group name, so $foo:($bar)
will bind to $foo$bar
in the template.
This addition also simplifies the implementation for identity rules, as now an identity rule is equivalent to rule { $id:(...) } => { $id }
.
loadPattern
was also refactored to return a pattern object directly instead of having syntaxCase
and macroclass
do it themselves in an extra step.
Fixes #319 (closed)