[antlr-interest] Extracting portions of code
Benhur
krupa_gadde at yahoo.com
Thu Oct 10 21:40:11 PDT 2002
Hi all,
I am Krupa Benhur, who is working on PL/SQL grammar. I have written
grammar for the same and used "^" notation for tokens to make them
as root nodes. I have many sub-rules as part of my grammar like
this -
plsql_block:
(("declare")? (declare_spec)+)?
("begin"^)?
seq_of_statements
("exception" exception_handler (exception_handler)*)?
("end" (label_name)? SEMI!)?
;
seq_of_statements:
assignment_statement
| if_statement
| sql_statement^
;
I have also written grammar for sql_statement. I am able to apply
this grammar for any PL/SQL program and see the tree generated. Now,
using this grammar, I want to extract the sql_statement part from
the PL/SQL file and write the same to another file. Can some one
give me code sample for the same.
I feel I need to use findAll(AST target) and findAllPartial(AST sub)
member functions of the abstract class BaseAST. I am not sure on how
to pass AST as a parameter to this findAll member function. I will
be very happy if some one can help me in this regard.
Thanks in advace
Benhur
krupa_gadde at yahoo.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list