summaryrefslogtreecommitdiff
path: root/pyparsing/core.py
diff options
context:
space:
mode:
authorptmcg <ptmcg@austin.rr.com>2022-05-18 23:59:30 -0500
committerptmcg <ptmcg@austin.rr.com>2022-05-18 23:59:30 -0500
commit79fe2b54bc08c791383ca81d4701b5afdd3d7390 (patch)
tree54086b76e4f3a9b7c9792c683ebea6a2324b7305 /pyparsing/core.py
parentdbe71461b5a56967ff0abf79ce7c8b0eddb75a66 (diff)
downloadpyparsing-git-79fe2b54bc08c791383ca81d4701b5afdd3d7390.tar.gz
Make expr[:ender] equivalent to expr[...:ender]
Diffstat (limited to 'pyparsing/core.py')
-rw-r--r--pyparsing/core.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/pyparsing/core.py b/pyparsing/core.py
index 4638d19..a806f5b 100644
--- a/pyparsing/core.py
+++ b/pyparsing/core.py
@@ -1651,15 +1651,17 @@ class ParserElement(ABC):
stop_on = NoMatch()
if isinstance(key, slice):
key, stop_on = key.start, key.stop
+ if key is None:
+ key = ...
stop_on_defined = True
elif isinstance(key, tuple) and isinstance(key[-1], slice):
key, stop_on = (key[0], key[1].start), key[1].stop
stop_on_defined = True
# convert single arg keys to tuples
+ if isinstance(key, str_type):
+ key = (key,)
try:
- if isinstance(key, str_type):
- key = (key,)
iter(key)
except TypeError:
key = (key, key)