Browse files

Escape arbitrary values before substituting into re:compile

This fixes trying to compile e.g. ?MODULE, as ? is a regex special character
  • Loading branch information...
1 parent 0dee009 commit 70bd1b65acbbf1f5fbb45b550accb4fba2c3e514 @jwheare jwheare committed with Oct 30, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 support/sublimerl_libparser.py
View
2 support/sublimerl_libparser.py
@@ -283,7 +283,7 @@ def generate_params(self, fun, module):
current_params = []
lineno = 0
# get params
- regex = re.compile(r"%s\((.*)\)\s*->" % fun[0], re.MULTILINE)
+ regex = re.compile(r"%s\((.*)\)\s*->" % re.escape(fun[0]), re.MULTILINE)
for m in regex.finditer(module):
params = m.groups()[0]
# strip out the eventual condition part ('when')

0 comments on commit 70bd1b6

Please sign in to comment.