[antlr-interest] Run time errors with findAllPartial function

Krupa Benhur krupa_gadde at yahoo.com
Thu Oct 24 07:03:13 PDT 2002


Hi All, 

I have written the following grammar in EBNF form for one of the sub-rule. 

select_expression: 
"select"^ ( "all"! | "distinct"! )? select_list ("into" column_name)? 
table_reference_list_from 
(where_condition_whole)? 
( connect_clause )? 
( group_clause )? 
( set_clause ) ? 
( order_clause ) ? 
( update_clause ) ? 
{ #select_expression = #([SELECT_EXPRESSION,"select_expression"], #select_expression); } ;

I have written the following code to access the sub-tree using findAllPartial function 

 ASTFactory astFactory = new ASTFactory();
 ASTEnumeration enum;
 enum = node.findAllPartial((AST)astFactory.make( (new ASTArray(1).add((AST)astFactory.create(PLSqlTokenTypes.LITERAL_select,"select")))));


and getting the below error at runtime----

exception: null
java.lang.NullPointerException
        at antlr.BaseAST.equals(BaseAST.java:88)
        at antlr.BaseAST.equalsTreePartial(BaseAST.java:185)
        at antlr.BaseAST.doWorkForFindAll(BaseAST.java:74)
        at antlr.BaseAST.doWorkForFindAll(BaseAST.java:80)
        at antlr.BaseAST.findAllPartial(BaseAST.java:224)
        at MyParser.ANTLR.visit(ANTLR.java:53)
        at MyParser.ANTLR.main(ANTLR.java:114)

I just used ASTArray(1) because all the other except select_list and table_reference_list_from sub-rules are optional. Can some one help?

Thanks in advance

Benhur




---------------------------------
Get a bigger mailbox -- choose a size that fits your needs.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20021024/9bb6046a/attachment.html


More information about the antlr-interest mailing list