How to access TatSu parserinfo object

74 Views Asked by At

I've just started playing with TatSu and don't have much experience with it yet. I'm successfully parsing a small COBOL code snippet, but would like to access the details that are produced when parserinfo=True. Would anyone have some sample code I can use for this? Here's my code. Thank you in advance.

from tatsu import parse, compile

cobbnf_file = open("cobfd.bnf", "r") cobbnf = cobbnf_file.read()

cobtest_file = open("test.cob", "r") cobtest = cobtest_file.read()

model = compile(cobbnf, "cobol") ast = model.parse(cobtest, parseinfo=True, trace=False)

print(ast)

0

There are 0 best solutions below