kolejny minor

This commit is contained in:
emilekm2142 2019-05-30 20:11:35 +02:00
parent 388a68e1fc
commit eb9b86707f

View File

@ -57,15 +57,15 @@ class RegexInterpreter(AbstractInterpreter):
make_reg = lambda formula,pattern: 'echo "{0}" | grep -P "{1}"'.format(formula,pattern) make_reg = lambda formula,pattern: 'echo "{0}" | grep -P "{1}"'.format(formula,pattern)
def check_assertion(formula, pattern): def check_assertion(formula, pattern):
cmd = make_reg(formula,pattern) cmd = make_reg(formula,pattern)
print("EXECUTING... ",cmd) #print("EXECUTING... ",cmd)
result = subprocess.run([cmd], shell=True, stdout=subprocess.PIPE) result = subprocess.run([cmd], shell=True, stdout=subprocess.PIPE)
return len(result.stdout)>0 return not len(result.stdout)>0
cmd =make_reg(formula,'^(\((?:[^()]++|(?1))*\))$') cmd =make_reg(formula,'^(\((?:[^()]++|(?1))*\))$')
print("EXECUTING... ",cmd) #print("EXECUTING... ",cmd)
result = subprocess.run([cmd], shell=True, stdout=subprocess.PIPE) result = subprocess.run([cmd], shell=True, stdout=subprocess.PIPE)
return None
isValid = len(result.stdout)>0 isValid = len(result.stdout)>0
if not isValid: return False if not isValid: return False
@ -182,7 +182,7 @@ if len(sys.argv) > 1 :
i = ProperInterpreter() i = ProperInterpreter()
if '-g' in sys.argv: if '-g' in sys.argv:
i = RegexInterpreter() i = RegexInterpreter()
print(sys.argv) #print(sys.argv)
if '-f' in sys.argv: if '-f' in sys.argv:
#open from file #open from file