mirror of https://github.com/Mikaela/Limnoria.git
Fix for bug #848475.
This commit is contained in:
parent
86b41dd4a6
commit
210809ab99
|
@ -1,3 +1,6 @@
|
||||||
|
* Fixed bug #848475 -- bad error message from regexp-expecting
|
||||||
|
commands.
|
||||||
|
|
||||||
* Stopped listing the plugin dispatcher command in the list of
|
* Stopped listing the plugin dispatcher command in the list of
|
||||||
commands for that plugin.
|
commands for that plugin.
|
||||||
|
|
||||||
|
|
|
@ -209,7 +209,10 @@ def perlReToPythonRe(s):
|
||||||
"""Converts a string representation of a Perl regular expression (i.e.,
|
"""Converts a string representation of a Perl regular expression (i.e.,
|
||||||
m/^foo$/i or /foo|bar/) to a Python regular expression.
|
m/^foo$/i or /foo|bar/) to a Python regular expression.
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
(kind, regexp, flags) = nonEscapedSlashes.split(s)
|
(kind, regexp, flags) = nonEscapedSlashes.split(s)
|
||||||
|
except ValueError: # Unpack list of wrong size.
|
||||||
|
raise ValueError, 'Must be of the form m/.../ or /.../'
|
||||||
regexp = regexp.replace('\\/', '/')
|
regexp = regexp.replace('\\/', '/')
|
||||||
if kind not in ('', 'm'):
|
if kind not in ('', 'm'):
|
||||||
raise ValueError, 'Invalid kind: must be in ("", "m")'
|
raise ValueError, 'Invalid kind: must be in ("", "m")'
|
||||||
|
@ -229,7 +232,10 @@ def perlReToReplacer(s):
|
||||||
s/foo/bar/g or s/foo/bar/i) to a Python function doing the equivalent
|
s/foo/bar/g or s/foo/bar/i) to a Python function doing the equivalent
|
||||||
replacement.
|
replacement.
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
(kind, regexp, replace, flags) = nonEscapedSlashes.split(s)
|
(kind, regexp, replace, flags) = nonEscapedSlashes.split(s)
|
||||||
|
except ValueError: # Unpack list of wrong size.
|
||||||
|
raise ValueError, 'Must be of the form s/.../.../'
|
||||||
replace = replace.replace('\\/', '/')
|
replace = replace.replace('\\/', '/')
|
||||||
if kind != 's':
|
if kind != 's':
|
||||||
raise ValueError, 'Invalid kind: must be "s"'
|
raise ValueError, 'Invalid kind: must be "s"'
|
||||||
|
|
|
@ -73,4 +73,7 @@ class UtilitiesTestCase(PluginTestCase, PluginDocumentation):
|
||||||
self.assertNotRegexp('re m/foo/ bar', 'has no attribute')
|
self.assertNotRegexp('re m/foo/ bar', 'has no attribute')
|
||||||
self.assertResponse('re m/a\S+y/ "the bot angryman is hairy"','angry')
|
self.assertResponse('re m/a\S+y/ "the bot angryman is hairy"','angry')
|
||||||
|
|
||||||
|
def testReNoEscapingUnpackListOfWrongSize(self):
|
||||||
|
self.assertNotRegexp('re foo bar baz', 'unpack list of wrong size')
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
|
Loading…
Reference in New Issue