When a ParseError is raised and printed, the pattern it tried to match is printed as well. If the pattern has control characters like \n or \r, these will get printed and make the output awkward to read.
The problem is not so bad when the only whitespace characters in the pattern are a regular space and a tab:
>>> p = pe.compile('"a" [ \t] "b"')
>>> p.match("ab")
Traceback (most recent call last):
[...]
pe._errors.ParseError:
line 0, character 0
ab
^
ParseError: `a[\ \ ]b`
But when a \r is part of the pattern, the ParseError name gets overwritten:
>>> p = pe.compile('"a" [ \t\r] "b"')
>>> p.match("ab")
Traceback (most recent call last):
[...]
pe._errors.ParseError:
line 0, character 0
ab
^
]b`seError: `a[\ \ \
The characters should be escaped so it looks more like this:
Also see #59.
When a ParseError is raised and printed, the pattern it tried to match is printed as well. If the pattern has control characters like
\nor\r, these will get printed and make the output awkward to read.The problem is not so bad when the only whitespace characters in the pattern are a regular space and a tab:
But when a
\ris part of the pattern, theParseErrorname gets overwritten:The characters should be escaped so it looks more like this:
Also see #59.