QuotedString does not escape escape character
Brought to you by:
ptmcg
It should be possible to get any string as the parsed value of QuotedString. In pyparsing 1.5.7 it is not possible to get, as parsed value, the string '\\"'
where '\\'
is the escape character and
'"'
is the quoting character.
More concretely, I would expect the following to print \"
. However, it prints \\"
:
from pyparsing import QuotedString
quotedString = QuotedString(quoteChar='"', escChar='\\')
print quotedString.parseString(r'"\\\""')[0]
To fix this, QuotedString should unescape the substring of twice the escaping character.
Fix has been made and checked into SVN, will ship in 2.0.3 release