MC: Add ability to show skipped (=non-compiled) patterns
This commit is contained in:
parent
5b4f543c3b
commit
0c21f77873
|
@ -25,8 +25,9 @@ import argparse
|
|||
|
||||
class MatchCompiler:
|
||||
|
||||
def __init__(self, verify_mode=False):
|
||||
def __init__(self, verify_mode=False, show_skipped=False):
|
||||
self._verifyMode = verify_mode
|
||||
self._showSkipped = show_skipped
|
||||
self._reset()
|
||||
|
||||
def _reset(self):
|
||||
|
@ -398,6 +399,8 @@ class MatchCompiler:
|
|||
|
||||
res = re.match(r'\s*"((?:.|\\")*?)"\s*$', raw_pattern)
|
||||
if res is None:
|
||||
if self._showSkipped:
|
||||
print("[SKIPPING] match pattern: " + raw_pattern)
|
||||
break # Non-const pattern - bailout
|
||||
|
||||
pattern = res.group(1)
|
||||
|
@ -552,6 +555,8 @@ class MatchCompiler:
|
|||
|
||||
res = re.match(r'\s*"((?:.|\\")*?)"\s*$', pattern)
|
||||
if res is None:
|
||||
if self._showSkipped:
|
||||
print("[SKIPPING] findmatch pattern: " + pattern)
|
||||
break # Non-const pattern - bailout
|
||||
|
||||
pattern = res.group(1)
|
||||
|
@ -648,9 +653,12 @@ def main():
|
|||
description='Compile Token::Match() calls into native C++ code')
|
||||
parser.add_argument('--verify', action='store_true', default=False,
|
||||
help='verify compiled matches against on-the-fly parser. Slow!')
|
||||
parser.add_argument('--show-skipped', action='store_true', default=False,
|
||||
help='show skipped (non-static) patterns')
|
||||
args = parser.parse_args()
|
||||
|
||||
mc = MatchCompiler(verify_mode=args.verify)
|
||||
mc = MatchCompiler(verify_mode=args.verify,
|
||||
show_skipped=args.show_skipped)
|
||||
|
||||
# convert all lib/*.cpp files
|
||||
for f in glob.glob('lib/*.cpp'):
|
||||
|
|
Loading…
Reference in New Issue