##// END OF EJS Templates
check-code: introduce function for using re2 when available...
Simon Heimberg -
r19310:30ea5466 default
parent child Browse files
Show More
@@ -10,6 +10,20 b''
10 10 import re, glob, os, sys
11 11 import keyword
12 12 import optparse
13 try:
14 import re2
15 except ImportError:
16 re2 = None
17
18 def compilere(pat, multiline=False):
19 if multiline:
20 pat = '(?m)' + pat
21 if re2:
22 try:
23 return re2.compile(pat)
24 except re2.error:
25 pass
26 return re.compile(pat)
13 27
14 28 def repquote(m):
15 29 t = re.sub(r"\w", "x", m.group('text'))
General Comments 0
You need to be logged in to leave comments. Login now