Skip to content

Describe possible features for pattern templates #6

Description

@quasilyte

Optional patterns: sub-pattern that is enclosed in [ ] , it is considered optional. When that particular sub-pattern is not matched, it's skipped without rejecting the input.
Examples:

`(call append xs [0] 1 2)`
This pattern matches both append(xs, 0, 1, 2) and append(xs, 1, 2).
`(call f [(call g1) (call g2)])`
Optional part can contain arbitrary sub-patterns.
TODO: does `[a b]` pattern mean that b is only matched if a matched or 
it's just a convenient syntax for `[a] [b]`?

Alternation: like A|B in regular expressions.
TODO: make decision on syntax.

Repetitions: like A+ and/or A{min,max} in regular expressions.
TODO: make decision on syntax.

Negative patterns: patterns that fail if they do match.
TODO: make decision on syntax.

Sub-pattern grouping: sub-patterns that are enclosed in { } can be treated as a single sub-pattern. This means that any modifiers or operations that are defined for single sub-pattern become possible for a list of sub-patterns.
TODO: examples.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions