Skip to content

Regex UpdateBumpalong logic should be applicable to lazy loops as well #62677

Closed

Description

@stephentoub

The optimization we employ in RegexNode.FinalOptimize to insert an UpdateBumpalong node after a starting loop does so for unbounded {One/Notone/Set}loop{atomic} nodes, but not for {One/Notone/Set}lazy nodes.

case Oneloop when node.N == int.MaxValue:
case Oneloopatomic when node.N == int.MaxValue:
case Notoneloop when node.N == int.MaxValue:
case Notoneloopatomic when node.N == int.MaxValue:
case Setloop when node.N == int.MaxValue:
case Setloopatomic when node.N == int.MaxValue:

It should be applicable for lazy loops as well, as if the match ends up failing, we will have explored the same range, just effectively in the opposite direction. One thing that may need more thought is if we need to special-case not applying this for atomic lazy loops, which will always only check for the minimum bound.

(This code, and other code in RegexNode, can also be cleaned up nicely now that we have improved C# pattern matching support.)

Activity

  1. added this to the 7.0.0 milestone on Dec 11, 2021
  2. ghost added
    untriaged
    on Dec 11, 2021
  3. self-assigned this
    on Jan 3, 2022
  4. ghost added
    in-pr
    on Jan 5, 2022
  5. removed
    untriaged
    on Jan 6, 2022
  6. ghost removed
    in-pr
    on Jan 15, 2022
  7. ghost locked as resolved and limited conversation to collaborators on Feb 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions