Skip to content

PathPattern vs IdentifierPattern #605

Open
@MemPage

Description

@MemPage

How to differ between IdentifierPattern and PathPattern when they can be just IDENTIFIER?

Pattern can be either IdentifierPattern or PathPattern.

Rules applied:

Pattern: IdentifierPattern
Pattern->IdentifierPattern

IdentifierPattern: ref? mut? IDENTIFIER (@ Pattern ) ?
IdentifierPattern->IDENTIFIER

And for the PathPattern

PathPattern: PathInExpression
PathPattern->PathInExpression

PathInExpression: ::? PathExprSegment (:: PathExprSegment)*
PathInExpression->PathExprSegment

PathExprSegment:PathIdentSegment (:: GenericArgs)?
PathExprSegment->PathIdentSegment

PathIdentSegment:IDENTIFIER
PathIdentSegment->IDENTIFIER

Not sure if there is a BIGGER rule to solve this out, or just we don't care at the parsing stage, but how to decide is this IDENTIFIER a IdentifierPattern or PathPattern?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-grammarArea: Syntax and parsingA-patternsArea: Patterns

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions