diff --git a/program.py b/program.py index b918dcf..a9308c2 100644 --- a/program.py +++ b/program.py @@ -52,7 +52,7 @@ class RegexInterpreter(AbstractInterpreter): def isValid(self,f)->bool: - formula = f.s.replace("!", "\\!") + formula = "({0})".format(f.s.replace("!", "\\!")) make_reg = lambda formula,pattern: 'echo "{0}" | grep -P "{1}"'.format(formula,pattern) def check_assertion(formula, pattern): @@ -192,7 +192,7 @@ if len(sys.argv) > 1 : for l in u: print(Formula(l,i).isValid()) else: - print(Formula( sys.argv[1],i).isValid()) + print(Formula( sys.argv[1] if sys.argv[1] != '-g' else sys.argv[2],i).isValid()) else: print("help?")