Home | History | Annotate | Download | only in tests
      1 import os
      2 import sys
      3 import antlr3
      4 import testbase
      5 import unittest
      6 
      7 
      8 class t021hoist(testbase.ANTLRTest):
      9     def setUp(self):
     10         self.compileGrammar()
     11         
     12 
     13     def testValid1(self):
     14         cStream = antlr3.StringStream('enum')
     15         lexer = self.getLexer(cStream)
     16         tStream = antlr3.CommonTokenStream(lexer)
     17         parser = self.getParser(tStream)
     18         parser.enableEnum = True
     19         enumIs = parser.stat()
     20 
     21         assert enumIs == 'keyword', repr(enumIs)
     22 
     23 
     24     def testValid2(self):
     25         cStream = antlr3.StringStream('enum')
     26         lexer = self.getLexer(cStream)
     27         tStream = antlr3.CommonTokenStream(lexer)
     28         parser = self.getParser(tStream)
     29         parser.enableEnum = False
     30         enumIs = parser.stat()
     31 
     32         assert enumIs == 'ID', repr(enumIs)
     33 
     34 
     35 
     36 if __name__ == '__main__':
     37     unittest.main()
     38 
     39