Skip to content

Syntax feature request: subpattern recursion #666

@CAD97

Description

@CAD97

(Note: this is purely about regex-syntax being able to parse the syntax, and not about regex supporting executing them in any manner.)

Specifically, I'd like to see regex-syntax be able to parse the PCRE syntax of (?&name) and/or (?P>name).

Concrete benefits:

  • regex can recognize the syntax and say something along the lines of "subpattern recursion is not supported" and link the docs for why
  • Users of regex-syntax can implement ?(DEFINE)-like functionality, providing "subpatterns as subroutines" for more legible regexes, just replacing the recursion reference with a copy of the subpattern regex. (We're looking into doing this for logos, and I'd much prefer to avoid regex preprocessing.)

I'm happy to do the implementation work if this is something desirable; I'd just need to know where in the Ast enum it'd be best to store this node kind.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions