From de0fd3f7f00f9f43c0236b7fd2bbe7a53f525c4d Mon Sep 17 00:00:00 2001 From: Olivier Chafik Date: Fri, 12 Apr 2024 16:12:16 +0100 Subject: [PATCH] grammars: document new repetition operators --- grammars/README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/grammars/README.md b/grammars/README.md index e1383fa5c..31867cb39 100644 --- a/grammars/README.md +++ b/grammars/README.md @@ -59,9 +59,13 @@ Parentheses `()` can be used to group sequences, which allows for embedding alte ## Repetition and Optional Symbols -- `*` after a symbol or sequence means that it can be repeated zero or more times. -- `+` denotes that the symbol or sequence should appear one or more times. -- `?` makes the preceding symbol or sequence optional. +- `*` after a symbol or sequence means that it can be repeated zero or more times (equivalent to `{0,}`). +- `+` denotes that the symbol or sequence should appear one or more times (equivalent to `{1,}`). +- `?` makes the preceding symbol or sequence optional (equivalent to `{0,1}`). +- `{m}` repeats the precedent symbol or sequence exactly `m` times +- `{m,}` repeats the precedent symbol or sequence at least `m` times +- `{m,n}` repeats the precedent symbol or sequence at betwen `m` and `n` (included) times (included) +- `{,n}` repeats the precedent symbol or sequence at most `n` times (included) ## Comments and newlines