matchcompiler: merged regular expressions to a single expression
This commit is contained in:
parent
410c0f98d9
commit
9fcfb38a1c
|
@ -91,10 +91,7 @@ def compilePattern(pattern, nr):
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def findMatchPattern(line):
|
def findMatchPattern(line):
|
||||||
res = re.search(r'Token::Match[(]([^(,]+),\s*"([^"]+)"[)]', line)
|
res = re.search(r'Token::s?i?m?p?l?e?Match[(]([^(,]+),\s*"([^"]+)"[)]', line)
|
||||||
if res == None:
|
|
||||||
res = re.search(r'Token::simpleMatch[(]([^(,]+),\s*"([^"]+)"[)]', line)
|
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def convertFile(srcname, destname):
|
def convertFile(srcname, destname):
|
||||||
|
@ -126,6 +123,7 @@ def convertFile(srcname, destname):
|
||||||
|
|
||||||
# selftests..
|
# selftests..
|
||||||
assert(None != findMatchPattern(' Token::Match(tok, ";") '))
|
assert(None != findMatchPattern(' Token::Match(tok, ";") '))
|
||||||
|
assert(None != findMatchPattern(' Token::simpleMatch(tok, ";") '))
|
||||||
assert(None == findMatchPattern(' Token::Match(tok->next(), ";") ')) # function calls are not handled
|
assert(None == findMatchPattern(' Token::Match(tok->next(), ";") ')) # function calls are not handled
|
||||||
|
|
||||||
# convert all lib/*.cpp files
|
# convert all lib/*.cpp files
|
||||||
|
|
Loading…
Reference in New Issue