[antlr-interest] Re: help on warning:nondeterminism upon

s2jafer1 s2jafer1 at yahoo.com
Thu Oct 14 01:16:47 PDT 2004



hi martin , 

        still i am getting the same " warning message " even after 

trying the various possible solutions given by you.

can you tell me any other possible method to solve the problem.



--- In antlr-interest at yahoogroups.com, "Martin Probst" <mail at m...> 
wrote:
> > I am getting the " warning:nondeterminism upon "
> > in the line no 244,it corresponds to
> >
> > "createPolicy throws ArchiveSystemApplicationException
> > 	    :
> > CREATE WS POLICY ( WS createPolicyParams)* ( WS createPolicyTypes)
*
> > NEWLINE
> 
> Well, the easiest way to solve those errors is - from my 
experience - to
> just imagine you would be the parser and had to choose which way to 
take.
> 
> In this case, imagine you would be after the policy statement. Now 
the
> next token you see in lookahead is a WS token. Both ways, the way to
> createPolicyParams and the way to the Types start with a 
whitespace. So
> you can't decide which way to go.
> 
> There are several possible solutions. One of them (the possibly 
easiest)
> is to ignore whitespaces within the lexer so the parser doesn't 
have to
> care about them:
> WS: (your whitespace characters)* { $setType(Token.SKIP); }
> 
> Alternatively - if you need whitespaces - you might do this:
> CREATE WS POLICY ( ( WS createPolicyParams ) => WS 
createPolicyParams )*
>   ( ( WS createPolicyTypes ) => WS createPolicyTypes )*
> This solution is worse as it takes some overhead to do the 
lookahead in
> the rule.
> 
> There are more solutions to this, but I would recommend to you to 
check
> whether you can ignore whitespaces. You can always control 
whitespace
> ignoring via a boolean flag within the lexer which can be set in 
certain
> situations (I do that within my grammar):
> WS: (...) { if (wsIgnorable) $setType(Token.SKIP); }
> 
> mfg
> Martin





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the antlr-interest mailing list