contrib/check-code.py
changeset 19378 9de689d20230
parent 19310 30ea54660d14
child 19380 ee07f9d142c9
equal deleted inserted replaced
19377:0cb996ee8c6d 19378:9de689d20230
   335     for c in checks:
   335     for c in checks:
   336         failandwarn = c[-1]
   336         failandwarn = c[-1]
   337         for pats in failandwarn:
   337         for pats in failandwarn:
   338             for i, pseq in enumerate(pats):
   338             for i, pseq in enumerate(pats):
   339                 # fix-up regexes for multi-line searches
   339                 # fix-up regexes for multi-line searches
   340                 po = p = pseq[0]
   340                 p = pseq[0]
   341                 # \s doesn't match \n
   341                 # \s doesn't match \n
   342                 p = re.sub(r'(?<!\\)\\s', r'[ \\t]', p)
   342                 p = re.sub(r'(?<!\\)\\s', r'[ \\t]', p)
   343                 # [^...] doesn't match newline
   343                 # [^...] doesn't match newline
   344                 p = re.sub(r'(?<!\\)\[\^', r'[^\\n', p)
   344                 p = re.sub(r'(?<!\\)\[\^', r'[^\\n', p)
   345 
   345 
   346                 #print po, '=>', p
       
   347                 pats[i] = (re.compile(p, re.MULTILINE),) + pseq[1:]
   346                 pats[i] = (re.compile(p, re.MULTILINE),) + pseq[1:]
   348         filters = c[2]
   347         filters = c[2]
   349         for i, flt in enumerate(filters):
   348         for i, flt in enumerate(filters):
   350             filters[i] = re.compile(flt[0]), flt[1]
   349             filters[i] = re.compile(flt[0]), flt[1]
   351 _preparepats()
   350 _preparepats()