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

Nested expression matching #79

Closed
wess opened this issue Jul 17, 2018 · 1 comment
Closed

Nested expression matching #79

wess opened this issue Jul 17, 2018 · 1 comment

Comments

@wess
Copy link

wess commented Jul 17, 2018

One awesome thing would be ability to nest pattern matches/calls within your grammar, like a PEG, Antlr, or even a Flex/Bison:

Example:

statement = [a-zA-Z0-9]+
statements = statement + statements

It might do this, just didn't see anything in the docs about it.

ps. awesome work on regex support!

@SwiftStudies
Copy link
Owner

Yes this is fully supported (nerdy term for it is left hand recursion). STLR equivalent is:

statement = /[a-zA-Z0-9]+ /
statements = statement statements

Although this could be done more efficiently as just

statement = /[a-zA-Z0-0]+ /
statements = statement+

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

2 participants