Match or construct a variable name portion.

When matching a name, this pattern extracts a number of name components, and saves the sub-name in variables object in VariablePattern.match return value.

When building a name, this pattern succeeds if the variable is present in VariablePattern.build function argument.

Hierarchy (view full)

Constructors

Properties

id: string

Variable name.

inner?: Pattern
maxComps: number
minComps: number

Methods

  • Build names following the structure of this pattern.

    Parameters

    • Rest...varsL: VarsLike[]

      Sets of variables to be replaced into the name.

    Returns Iterable<Name, any, any>

    Iterable of possible names.

  • Determine whether a name matches the structure of this pattern.

    Parameters

    • name: Name

      Input name.

    Returns Iterable<Vars, any, any>

    • Iterable of extracted fields in possible interpretations.
  • Recognize part of the input name.

    Parameters

    • state: MatchState

    Returns Iterable<MatchState, any, any>

    Iterable of potential matches.

  • Build part of an output name.

    Parameters

    Returns Iterable<BuildState, any, any>

    Iterable of potential constructions.