From 9d9b5a34f6caca41040d842038a7e7a298d44802 Mon Sep 17 00:00:00 2001 From: Olivier Chafik Date: Fri, 12 Apr 2024 16:15:24 +0100 Subject: [PATCH] grammars: nit --- common/grammar-parser.cpp | 4 +++- grammars/README.md | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/common/grammar-parser.cpp b/common/grammar-parser.cpp index 783290eb5..3282310a9 100644 --- a/common/grammar-parser.cpp +++ b/common/grammar-parser.cpp @@ -98,7 +98,7 @@ namespace grammar_parser { pos++; } if (pos == src) { - throw std::runtime_error(std::string("expecting name at ") + src); + throw std::runtime_error(std::string("expecting integer at ") + src); } return pos; } @@ -159,6 +159,8 @@ namespace grammar_parser { throw std::runtime_error(std::string("expecting preceding item to */+/?/{ at ") + pos); } + // apply transformation to previous symbol (last_sym_start to end) according to + // the following rewrite rules: // S* --> S{0,} // S+ --> S{1,} // S? --> S{0,1} diff --git a/grammars/README.md b/grammars/README.md index 31867cb39..e9adc5a26 100644 --- a/grammars/README.md +++ b/grammars/README.md @@ -64,7 +64,7 @@ Parentheses `()` can be used to group sequences, which allows for embedding alte - `?` 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) +- `{m,n}` repeats the precedent symbol or sequence at betwen `m` and `n` times (included) - `{,n}` repeats the precedent symbol or sequence at most `n` times (included) ## Comments and newlines