matchcompiler: merged regular expressions to a single expression

This commit is contained in:
Daniel Marjamäki 2012-12-08 16:22:55 +01:00
parent 410c0f98d9
commit 9fcfb38a1c
1 changed files with 2 additions and 4 deletions

View File

@ -91,10 +91,7 @@ def compilePattern(pattern, nr):
return ret
def findMatchPattern(line):
res = re.search(r'Token::Match[(]([^(,]+),\s*"([^"]+)"[)]', line)
if res == None:
res = re.search(r'Token::simpleMatch[(]([^(,]+),\s*"([^"]+)"[)]', line)
res = re.search(r'Token::s?i?m?p?l?e?Match[(]([^(,]+),\s*"([^"]+)"[)]', line)
return res
def convertFile(srcname, destname):
@ -126,6 +123,7 @@ def convertFile(srcname, destname):
# selftests..
assert(None != findMatchPattern(' Token::Match(tok, ";") '))
assert(None != findMatchPattern(' Token::simpleMatch(tok, ";") '))
assert(None == findMatchPattern(' Token::Match(tok->next(), ";") ')) # function calls are not handled
# convert all lib/*.cpp files