1import antlr3 2import testbase 3import unittest 4 5 6class t040bug80(testbase.ANTLRTest): 7 def setUp(self): 8 self.compileGrammar() 9 10 11 def lexerClass(self, base): 12 class TLexer(base): 13 def recover(self, input, re): 14 # no error recovery yet, just crash! 15 raise 16 17 return TLexer 18 19 20 def testValid1(self): 21 cStream = antlr3.StringStream('defined') 22 lexer = self.getLexer(cStream) 23 while True: 24 t = lexer.nextToken() 25 if t.type == antlr3.EOF: 26 break 27 print t 28 29 30if __name__ == '__main__': 31 unittest.main() 32 33 34