def check_theory(preconds_only=False): assumes, asserts, macros = get_assumes_and_asserts(preconds_only) errs = [] for logic in im.logics(): try: if logic == 'epr': unstrat, bad_interpreted = get_unstratified_funs( assumes, asserts, macros) if unstrat or bad_interpreted: report_epr_error(unstrat, bad_interpreted) else: for a in chain(assumes, macros): check_can_assume(logic, *a) for a in asserts: check_can_assert(logic, *a) return except iu.IvyError as err: errs.append(err) # if we got here, all logics had errors if len(errs) == 1: raise errs[0] raise iu.ErrorList(errs)
def parse(s): global error_list error_list = [] res = parser.parse(s) if error_list: print error_list raise iu.ErrorList(error_list) return res
def parse(s, nested=False): global error_list global stack if not nested: error_list = [] stack = [] vernum = iu.get_numeric_version() with LexerVersion(vernum): # shallow copy the parser and lexer to try for re-entrance (!!!) res = copy.copy(parser).parse(s, lexer=copy.copy(lexer)) if error_list: raise iu.ErrorList(error_list) return res
def check_theory(): assumes, asserts = get_assumes_and_asserts() unstrat = get_unstratified_funs(assumes, asserts) errs = [] for logic in im.logics(): try: for a in assumes: check_can_assume(logic, *a, unstrat=unstrat) for a in asserts: check_can_assert(logic, *a, unstrat=unstrat) return except iu.IvyError as err: errs.append(err) # if we got here, all logics had errors if len(errs) == 1: raise errs[0] raise iu.ErrorList(errs)