Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Describe possible features for pattern templates #6

Open
quasilyte opened this issue Dec 25, 2017 · 0 comments
Open

Describe possible features for pattern templates #6

quasilyte opened this issue Dec 25, 2017 · 0 comments

Comments

@quasilyte
Copy link
Collaborator

quasilyte commented Dec 25, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant