Marcin Ciura
2014-01-08 15:18:03 UTC
As I understand it, line
http://sourceforge.net/p/pyparsing/code/255/tree/trunk/src/pyparsing.py#l1843has
a bug introduced in version 2.0.1. Previously, the line was
self.escCharReplacePattern = re.escape(self.escChar)+"(.)"
Now, it is
self.escCharReplacePattern = re.escape(self.escChar)+("([%s])" % charset)
Note that the character class is [%s]. I suppose it should be [^%s]. Then,
this test passes:
import pyparsing
quoted_string = pyparsing.QuotedString('"', unquoteResults=True,
escChar='\\')
assert quoted_string.parseString(r'"\\foo"').asList()[0] == r'\foo'
-- Marcin
http://sourceforge.net/p/pyparsing/code/255/tree/trunk/src/pyparsing.py#l1843has
a bug introduced in version 2.0.1. Previously, the line was
self.escCharReplacePattern = re.escape(self.escChar)+"(.)"
Now, it is
self.escCharReplacePattern = re.escape(self.escChar)+("([%s])" % charset)
Note that the character class is [%s]. I suppose it should be [^%s]. Then,
this test passes:
import pyparsing
quoted_string = pyparsing.QuotedString('"', unquoteResults=True,
escChar='\\')
assert quoted_string.parseString(r'"\\foo"').asList()[0] == r'\foo'
-- Marcin