16
global lexer, parser, parser2
20
lexer = SimpleLexer.Lexer(sys.stdin);
23
sys.stdout.write("first parser" + '\n')
24
parser = SimpleParser.Parser(lexer)
27
# Now we need to get the inputState from the first parser
28
# this includes data about guessing and stuff like it.
29
# If we don't do this and create the second parser
30
# with just the lexer object we might (doh! will!) miss tokens
31
# read for lookahead tests.
32
self.inputstate = parser.getInputState()
34
# When first parser runs out, invoke secnond parser
35
sys.stdout.write("second parser" + '\n')
36
parser2 = SimpleParser2.Parser(self.inputstate)
39
except antlr.ANTLRException, e:
40
sys.stderr.write("exception: " + str(e) + '\n')
41
#apply(traceback.print_exception, sys.exc_info())
43
sys.stderr.write("exception: " + str(e) + '\n')
44
#apply(traceback.print_exception, sys.exc_info())
46
if __name__ == '__main__':