1 import antlr3 2 import testbase 3 import unittest 4 5 6 class t038lexerRuleLabel(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('a 2') 22 23 lexer = self.getLexer(cStream) 24 25 while True: 26 t = lexer.nextToken() 27 if t.type == antlr3.EOF: 28 break 29 print t 30 31 32 if __name__ == '__main__': 33 unittest.main() 34