From 0c21f7787368b6d05f651ecb63984077bcd66db0 Mon Sep 17 00:00:00 2001 From: Thomas Jarosch Date: Fri, 9 Jan 2015 22:50:42 +0100 Subject: [PATCH] MC: Add ability to show skipped (=non-compiled) patterns --- tools/matchcompiler.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/matchcompiler.py b/tools/matchcompiler.py index c7a508885..0cd21b1b2 100755 --- a/tools/matchcompiler.py +++ b/tools/matchcompiler.py @@ -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'):