Fixed two issues in matchcompiler:

- Use correct findmatch or findsimplematch for verification
- Print failing pattern also for findmatch/findsimplematch
This commit is contained in:
PKEuS 2014-07-02 14:28:21 +02:00
parent b4f0869a71
commit 62d07878d7
1 changed files with 3 additions and 3 deletions

View File

@ -324,7 +324,7 @@ class MatchCompiler:
# ret += ' std::cout << "tok: " << tok->str();\n' # ret += ' std::cout << "tok: " << tok->str();\n'
# ret += ' if (tok->next())\n' # ret += ' if (tok->next())\n'
# ret += ' std::cout << "tok next: " << tok->next()->str();\n' # ret += ' std::cout << "tok next: " << tok->next()->str();\n'
ret += ' throw InternalError(tok, "Internal error. compiled match returned different result than parsed match: " + std::string("' + pattern + '"));\n' ret += ' throw InternalError(tok, "Internal error. compiled match returned different result than parsed match: ' + pattern + '");\n'
ret += ' }\n' ret += ' }\n'
ret += ' return res_compiled_match;\n' ret += ' return res_compiled_match;\n'
ret += '}\n' ret += '}\n'
@ -425,7 +425,7 @@ class MatchCompiler:
origFindMatchName = 'findmatch' origFindMatchName = 'findmatch'
if is_findsimplematch: if is_findsimplematch:
origMatchName = 'findsimplematch' origFindMatchName = 'findsimplematch'
assert(varId is None) assert(varId is None)
ret += ' T * res_compiled_findmatch = findmatch' + \ ret += ' T * res_compiled_findmatch = findmatch' + \
@ -448,7 +448,7 @@ class MatchCompiler:
# Don't use assert() here, it's disabled for optimized builds. # Don't use assert() here, it's disabled for optimized builds.
# We also need to verify builds in 'release' mode # We also need to verify builds in 'release' mode
ret += ' if (res_parsed_findmatch != res_compiled_findmatch) {\n' ret += ' if (res_parsed_findmatch != res_compiled_findmatch) {\n'
ret += ' throw InternalError(tok, "Internal error. compiled findmatch returned different result than parsed findmatch");\n' ret += ' throw InternalError(tok, "Internal error. compiled findmatch returned different result than parsed findmatch: ' + pattern + '");\n'
ret += ' }\n' ret += ' }\n'
ret += ' return res_compiled_findmatch;\n' ret += ' return res_compiled_findmatch;\n'
ret += '}\n' ret += '}\n'