1 import os 2 import antlr3 3 import testbase 4 import unittest 5 6 class 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 22 if __name__ == '__main__': 23 unittest.main() 24