summaryrefslogtreecommitdiff
path: root/pyparsing/core.py
diff options
context:
space:
mode:
authorptmcg <ptmcg@austin.rr.com>2022-05-14 02:41:09 -0500
committerptmcg <ptmcg@austin.rr.com>2022-05-14 02:41:09 -0500
commitfc7c76b6c7f1e876a11e4df6d29212738c2ba723 (patch)
treea6459d8a1f7d65930b46858c9d8d18badf5139c5 /pyparsing/core.py
parent01969ff3dd0e52a7cc104a5f231d4f370bde4a98 (diff)
downloadpyparsing-git-fc7c76b6c7f1e876a11e4df6d29212738c2ba723.tar.gz
Fixed bug in srange (escaped chars inside range set); fixed ignore type annotation in SkipTo
Diffstat (limited to 'pyparsing/core.py')
-rw-r--r--pyparsing/core.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/pyparsing/core.py b/pyparsing/core.py
index 9acba3f..13ff51b 100644
--- a/pyparsing/core.py
+++ b/pyparsing/core.py
@@ -5045,7 +5045,7 @@ class SkipTo(ParseElementEnhance):
self,
other: Union[ParserElement, str],
include: bool = False,
- ignore: bool = None,
+ ignore: typing.Optional[Union[ParserElement, str]] = None,
fail_on: typing.Optional[Union[ParserElement, str]] = None,
*,
failOn: Union[ParserElement, str] = None,
@@ -5660,7 +5660,7 @@ line_end = LineEnd().set_name("line_end")
string_start = StringStart().set_name("string_start")
string_end = StringEnd().set_name("string_end")
-_escapedPunc = Word(_bslash, r"\[]-*.$+^?()~ ", exact=2).set_parse_action(
+_escapedPunc = Regex(r"\\[\\[\]\/\-\*\.\$\+\^\?()~ ]").set_parse_action(
lambda s, l, t: t[0][1]
)
_escapedHexChar = Regex(r"\\0?[xX][0-9a-fA-F]+").set_parse_action(
@@ -5677,7 +5677,7 @@ _reBracketExpr = (
Literal("[")
+ Opt("^").set_results_name("negate")
+ Group(OneOrMore(_charRange | _singleChar)).set_results_name("body")
- + "]"
+ + Literal("]")
)
@@ -5714,7 +5714,7 @@ def srange(s: str) -> str:
)
try:
return "".join(_expanded(part) for part in _reBracketExpr.parse_string(s).body)
- except Exception:
+ except Exception as e:
return ""