summaryrefslogtreecommitdiff
path: root/pyparsing/core.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyparsing/core.py')
-rw-r--r--pyparsing/core.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/pyparsing/core.py b/pyparsing/core.py
index ae7dcb6..03371ab 100644
--- a/pyparsing/core.py
+++ b/pyparsing/core.py
@@ -1552,6 +1552,9 @@ class ParserElement(ABC):
return _PendingSkip(self, must_skip=True)
if isinstance(other, str_type):
+ # `expr | ""` is equivalent to `Opt(expr)`
+ if other == "":
+ return Opt(self)
other = self._literalStringClass(other)
if not isinstance(other, ParserElement):
return NotImplemented