I think you will have to put those three productions in separate rules, but I 
will look into it more.

Jim

> -----Original Message-----
> From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-
> boun...@antlr.org] On Behalf Of Alan Condit
> Sent: Wednesday, May 19, 2010 2:06 PM
> To: antlr-interest@antlr.org
> Subject: Re: [antlr-interest] null pointer to ADAPTOR-
> >setTokenBoundaries
> 
> Jim,
> 
> Here is what I have set in options:
> options {
>       backtrack       =       true;
>       memoize         =       true;
>       language        =       C;
>       output          =       AST;
>       ASTLabelType    =       pANTLR3_BASE_TREE;
>       }
> 
> The null is inside 'ctx' inside 'adaptor' at 'setTokenBoundaries'.
> 
> It is inside a function
> /**
> * $ANTLR start line
> *
> /Users/acondit/source/GCCnv/LatheBranch/trunk/Parser/RS274ngc.g:184:1:
> line : ( ( line_number )? ( segment )+ K_NEWLINE -> ^( STMT ( segment
> )+ ) | ( line_number )? K_NEWLINE -> | oword_stmt -> ^( STMT oword_stmt
> ) );
> */
> static RS274ngcParser_line_return
> line(pRS274ngcParser ctx)
> {
> ...
> }
> 
> which I assume, based on the comment, is generated from this rule:
> line  :       line_number? segment+ K_NEWLINE
>               -> ^(STMT segment+)
>       |       line_number? K_NEWLINE
>               ->
>       |       oword_stmt
>               -> ^(STMT oword_stmt)
>       ;
> 
> The grammar is for parsing an existing language not one of my
> invention, and grammatically the newlines delineate a semantic block
> therefore must be known by the parser, but empty lines are discarded
> and therefore should not be in the tree.
> 
> Alan
> ---
> 
> Alan's MachineWorks
> 1085 Tierra Ct.
> Woodburn, OR 97071
> 
> Email -- acon...@alansmachineworks.com
> www.alansmachineworks.com
> 
> Jim wrote--
> Please post more information about your grammar, what the null pointer
> is, etc. It is hard to interpolate, but the common mistake is not
> adding output=AST; to the options, so you do not get a tree adaptor
> created.
> 
> Jim
> > -----Original Message-----
> > From: antlr-interest-bounces at antlr.org
> [mailto:antlr-interest-
> > bounces at antlr.org
> ] On Behalf Of Alan Condit
> 
> > Sent: Wednesday, May 19, 2010 11:25 AM
> > To: antlr-interest at antlr.org
> > Subject: [antlr-interest] null pointer to ADAPTOR->setTokenBoundaries
> >
> > Help!!!
> >
> > I am getting a null pointer to setTokenBoundaries in the following
> line
> > of generated code.
> > "ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start,
> > retval.stop);"
> >
> > The grammar works under Java.  In moving it back to 'C', I changed
> the
> > language option to 'C', added option ASTLabelType=pANTLR3_BASE_TREE;
> > and added the necessary includes to compile and link under Objective-
> C.
> >
> > Is there anything obvious that I am doing wrong?
> >
> > Thanks,
> > Alan
> >
> 
> 
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address




List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to