def setUp(self): super(LanguageTest, self).setUp() # For these tests, restrict logging to ERROR only and # print to stderr. This allows the lexer/parser to inform # us of real problems, without complaining in tests that # don't use all the tokens and/or productions. self.withLogging(stream=sys.stderr, level=logging.ERROR) self.parser = LingoParser()
def _parse_source_file(self, source_file_path): parser = LingoParser() try: with open(source_file_path, 'r') as source_file: self.program_source = source_file.read() self.program_component = parser.parse(self.program_source) except IOError as e: raise CannotOpenSourceFile(source_file_path).from_exception(e) except LingoException as e: raise CannotParseSource(source_file_path).from_exception(e) self.program_block = ProgramBlock(self.program_component)
def setUp(self): self.parser = LingoParser() self.typecheck = TypeCheck(False)