import sys
import antlr4
from Java8Lexer
import Java8Lexer
from Java8Parser
import Java8Parser
from Java8Listener
import Java8Listener
from Java8Visitor
import Java8Visitor
import os
from fnmatch import fnmatch
import time
myfile = "/home/akash/Test/Test1.java"
cStream = antlr4.FileStream(myfile)
lexer = Java8Lexer(cStream)
tStream = antlr4.CommonTokenStream(lexer)
parser = Java8Parser(tStream)
tryStm = Java8Parser.TryStatementContext(parser)
print tryStm
I am using antlr in python2 and I want to findout try catch finally block and parser.compilationUnit() return null list and this code. and here in this code tryStm is also empty list.but my Test1.java have try-catch-finally statement.I got stuck.please tell me correct way to find out try-catch-finally block in a java code.
i have to check if there catch block with try and in finally if there is any return statement and line number of that reutrn statement.thanks in advance.
--
You received this message because you are subscribed to a topic in the Google Groups "antlr-discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/antlr-discussion/Cx50mAJQpx0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to antlr-discussi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.