-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Labels
Description
Prerequisites
Please answer the following questions for yourself before submitting an issue.
- I am running the latest code. Development is very rapid so there are no tagged versions as of now.
- I carefully followed the README.md.
- I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
- I reviewed the Discussions, and have a new bug or useful enhancement to share.
Feature Description
The grammar is great but I have to manually write out code for strings of minimum and maximum length. I can do them via:
Alpha ::= [a-z]
String ::= Alpha Alpha Alpha Alpha? Alpha?
To make an alphabetic string minimum length 3, maximum length 5. I would like to be able to do:
String ::= [a-z]{3,5}
Alternate syntax:
String ::= [a-z]{5}
For a five-character string.
Motivation
GBNF is already inspired by regex and It's already possible to do this without this enhancement so it is not a critical feature. It would just make the grammar more concise and easier to write. This change wouldn't break any existing grammars.
Possible Implementation
It seems possible to just expand the tokens out like my first example, but I don't know how easy that actually is.
Rybens92, lastrosade, epistoteles and ibehnam