|
15 | 15 | import numpy as np |
16 | 16 | from pyparsing import ( |
17 | 17 | Empty, Forward, Literal, NotAny, oneOf, OneOrMore, Optional, |
18 | | - ParseBaseException, ParseExpression, ParseFatalException, ParserElement, |
19 | | - ParseResults, QuotedString, Regex, StringEnd, ZeroOrMore, pyparsing_common) |
| 18 | + ParseBaseException, ParseException, ParseExpression, ParseFatalException, |
| 19 | + ParserElement, ParseResults, QuotedString, Regex, StringEnd, ZeroOrMore, |
| 20 | + pyparsing_common) |
20 | 21 |
|
21 | 22 | import matplotlib as mpl |
22 | 23 | from . import _api, cbook |
@@ -1990,10 +1991,8 @@ def parse(self, s, fonts_object, fontsize, dpi): |
1990 | 1991 | try: |
1991 | 1992 | result = self._expression.parseString(s) |
1992 | 1993 | except ParseBaseException as err: |
1993 | | - raise ValueError("\n".join(["", |
1994 | | - err.line, |
1995 | | - " " * (err.column - 1) + "^", |
1996 | | - str(err)])) from err |
| 1994 | + # explain becomes a plain method on pyparsing 3 (err.explain(0)). |
| 1995 | + raise ValueError("\n" + ParseException.explain(err, 0)) from None |
1997 | 1996 | self._state_stack = None |
1998 | 1997 | self._in_subscript_or_superscript = False |
1999 | 1998 | # prevent operator spacing from leaking into a new expression |
|
0 commit comments