Optimizations for backreference conditionals.
()
| 528 | |
| 529 | // Optimizations for backreference conditionals. |
| 530 | func (n *RegexNode) reduceBackreferenceConditional() *RegexNode { |
| 531 | // This isn't so much an optimization as it is changing the tree for consistency. We want |
| 532 | // all engines to be able to trust that every backreference conditional will have two children, |
| 533 | // even though it's optional in the syntax. If it's missing a "not matched" branch, |
| 534 | // we add one that will match empty. |
| 535 | if len(n.Children) == 1 { |
| 536 | n.addChild(&RegexNode{T: NtEmpty, Options: n.Options}) |
| 537 | } |
| 538 | |
| 539 | return n |
| 540 | } |
| 541 | |
| 542 | // / <summary>Optimizations for expression conditionals.</summary> |
| 543 | func (n *RegexNode) reduceExpressionConditional() *RegexNode { |