From e6c7783b2e129e29165da2882803581e6316d3b2 Mon Sep 17 00:00:00 2001 From: ptmcg Date: Sun, 6 Nov 2022 18:14:20 -0600 Subject: Add docs that `expr * ...` is a valid alternative to `ZeroOrMore(expr)` (Issue #445) --- docs/HowToUsePyparsing.rst | 2 +- tests/test_unit.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) 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, @@ -1709,6 +1710,7 @@ class Test02_WithoutPackrat(ppt.TestParseResultsAsserts, TestCase): ] expected_res = [ + r"([abcd]+ )*\d+", r"([abcd]+ )*\d+", r"([abcd]+ )*\d+", r"([abcd]+ )+\d+", -- cgit v1.2.1