diff options
author | ptmcg <ptmcg@austin.rr.com> | 2020-06-25 08:22:33 -0500 |
---|---|---|
committer | ptmcg <ptmcg@austin.rr.com> | 2020-06-25 08:22:33 -0500 |
commit | 09681b470092b3296d654fee96eb580483affc8a (patch) | |
tree | bc71aa85e814481182e0584053ba2f39e58286d7 /pyparsing/exceptions.py | |
parent | efb796099fd77d003dcd49df6a75d1dcc19cefb1 (diff) | |
download | pyparsing-git-09681b470092b3296d654fee96eb580483affc8a.tar.gz |
Collapse _checkRecursion methods; moved 3.0.0 summary from CHANGES to whats_new_in_3_0_0.rst; cleaned up docstrings, Word() examples, restored setName() docstring; added example to ParseException.explain()
Diffstat (limited to 'pyparsing/exceptions.py')
-rw-r--r-- | pyparsing/exceptions.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/pyparsing/exceptions.py b/pyparsing/exceptions.py index 51eed66..2a10180 100644 --- a/pyparsing/exceptions.py +++ b/pyparsing/exceptions.py @@ -163,6 +163,21 @@ class ParseBaseException(Exception): Returns a multi-line string listing the ParserElements and/or function names in the exception's stack trace. + + Example:: + + expr = pp.Word(pp.nums) * 3 + try: + expr.parseString("123 456 A789") + except pp.ParseException as pe: + print(pe.explain(depth=0)) + + prints:: + + 123 456 A789 + ^ + ParseException: Expected W:(0-9), found 'A' (at char 8), (line:1, col:9) + """ return self.explain_exception(self, depth) |