Skip to content

Tracking Issue for macro_named_capture_groups #142999

Open
@tgross35

Description

@tgross35

This is a tracking issue for the RFC "Named macro capture groups" (rust-lang/rfcs#3649).
The feature gate for the issue is #![feature(macro_named_capture_groups)].

macro_rules! foo {
    ( $group1( $a:ident ),+ ) => {
        $group1( println!("{}", $a); )+
    }
}

This feature is currently experimental to figure out ideal behavior; an RFC has not yet been accepted.

About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Discussion comments will get marked as off-topic or deleted.
Repeated discussions on the tracking issue may lead to the tracking issue getting locked.

Steps

Unresolved Questions

  • What syntax should be used for groups?
    • $group(..) in the capture is nice, but $group(..) in the capture (expand the group) differs from $metavar(..) (expand a metavar followed by a new group) and context is needed to handle this correctly.
    • $'group was proposed to avoid this.
  • What syntax should be used for expanding the group in-place?
    • Standalone $group is nice but there is no way to expand the entire group and add parens after ($group (..) is ambiguous "expand group with parens" or "expand entire group, follow it by new parens")
    • $...group was proposed to avoid this.

XXX --- list all the "unresolved questions" found in the RFC to ensure they are
not forgotten

Implementation history

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)B-experimentalBlocker: In-tree experiment; RFC pending, not yet approved or unneeded (requires FCP to stabilize).C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCS-tracking-unimplementedStatus: The feature has not been implemented.T-langRelevant to the language team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions