Match compiler: Add cmdline handling

This commit is contained in:
Thomas Jarosch 2013-01-09 19:41:03 +01:00
parent 97e1e50139
commit de36324d62
1 changed files with 8 additions and 3 deletions

View File

@ -4,6 +4,7 @@ import os
import sys import sys
import re import re
import glob import glob
import argparse
class MatchCompiler: class MatchCompiler:
def __init__(self, verify_mode=False): def __init__(self, verify_mode=False):
@ -503,9 +504,13 @@ if not os.path.exists(build_dir):
if not os.path.isdir(build_dir): if not os.path.isdir(build_dir):
raise Exception(build_dir + ' is not a directory') raise Exception(build_dir + ' is not a directory')
# TODO: Add cmdline switch for verify mode # Argument handling
# Set to 'True' to enable compiled match verification parser = argparse.ArgumentParser(description='Compile Token::Match() calls into native C++ code')
mc = MatchCompiler(verify_mode=False) parser.add_argument('--verify', action='store_true', default=False,
help='verify compiled matches against on-the-fly parser. Slow!')
args = parser.parse_args()
mc = MatchCompiler(verify_mode=args.verify)
# convert all lib/*.cpp files # convert all lib/*.cpp files
for f in glob.glob('lib/*.cpp'): for f in glob.glob('lib/*.cpp'):