1import os 2import antlr3 3import testbase 4import unittest 5 6class t019lexer(testbase.ANTLRTest): 7 def setUp(self): 8 self.compileGrammar() 9 10 11 def testValid(self): 12 inputPath = os.path.splitext(__file__)[0] + '.input' 13 with open(inputPath) as f: 14 stream = antlr3.StringStream(f.read()) 15 lexer = self.getLexer(stream) 16 17 while True: 18 token = lexer.nextToken() 19 if token.type == antlr3.EOF: 20 break 21 22if __name__ == '__main__': 23 unittest.main() 24