diff options
| author | ptmcg <ptmcg@austin.rr.com> | 2022-11-06 18:14:20 -0600 |
|---|---|---|
| committer | ptmcg <ptmcg@austin.rr.com> | 2022-11-06 18:14:20 -0600 |
| commit | e6c7783b2e129e29165da2882803581e6316d3b2 (patch) | |
| tree | 27d949c1270ddc9ad19081cdb5a1d6e62deee381 | |
| parent | 8309b8a942043dfe28c7a4091264e7298700d050 (diff) | |
| download | pyparsing-git-e6c7783b2e129e29165da2882803581e6316d3b2.tar.gz | |
Add docs that `expr * ...` is a valid alternative to `ZeroOrMore(expr)` (Issue #445)
| -rw-r--r-- | docs/HowToUsePyparsing.rst | 2 | ||||
| -rw-r--r-- | tests/test_unit.py | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/docs/HowToUsePyparsing.rst b/docs/HowToUsePyparsing.rst index ae8bca0..30e5753 100644 --- a/docs/HowToUsePyparsing.rst +++ b/docs/HowToUsePyparsing.rst @@ -182,7 +182,7 @@ Usage notes - ``expr[... ,n]`` is equivalent to ``expr*(0, n)`` (read as "0 to n instances of expr") - - ``expr[...]`` and ``expr[0, ...]`` are equivalent to ``ZeroOrMore(expr)`` + - ``expr[...]``, ``expr[0, ...]`` and ``expr * ...`` are equivalent to ``ZeroOrMore(expr)`` - ``expr[1, ...]`` is equivalent to ``OneOrMore(expr)`` diff --git a/tests/test_unit.py b/tests/test_unit.py index ae9591e..b50117b 100644 --- a/tests/test_unit.py +++ b/tests/test_unit.py @@ -1701,6 +1701,7 @@ class Test02_WithoutPackrat(ppt.TestParseResultsAsserts, TestCase): exprs = [ word[...] + num, + word * ... + num, word[0, ...] + num, word[1, ...] + num, word[2, ...] + num, @@ -1711,6 +1712,7 @@ class Test02_WithoutPackrat(ppt.TestParseResultsAsserts, TestCase): expected_res = [ r"([abcd]+ )*\d+", r"([abcd]+ )*\d+", + r"([abcd]+ )*\d+", r"([abcd]+ )+\d+", r"([abcd]+ ){2,}\d+", r"([abcd]+ ){0,3}\d+", |
