[antlr-interest] Warning/ambiguity suppression

Olivier Dragon dragonoe at mcmaster.ca
Fri Jul 22 05:06:21 PDT 2005


You could use predicates and match a non-identifier character after the
word (you could have a variable named trueThat or falseData).

TRUE:
	("true" ~(IDENTCHAR))=> "true" ;
FALSE:
	("false" ~(IDENTCHAR))=> "false" ;

protected IDENTCHAR:
	('a'..'z'|'A'..'Z'|'0'..'9'|'_') ;

On Fri, Jul 22, 2005 at 12:23:01PM +0200, loic.lefevre at bnpparibas.com wrote:
> 
> Hello,
> I'm currently working on a grammar to handle expressions.
> I've used the Java grammar part dealing with expressions.
> Finally, my grammar is finished but I've got warnings:
> 
> antlr:prepare-filesystem:
>     [mkdir] Created dir: headless\target\generated\antlr
> ANTLR Parser Generator   Version 2.7.5 (20050128)   1989-2005 jGuru.com
> RosterExpression.g: warning:lexical nondeterminism between rules TRUE and
> IDENT upon
> RosterExpression.g:     k==1:'t'
> RosterExpression.g:     k==2:'r'
> RosterExpression.g:     k==3:'u'
> RosterExpression.g:     k==4:'e'
> RosterExpression.g: warning:lexical nondeterminism between rules FALSE and
> IDENT upon
> RosterExpression.g:     k==1:'f'
> RosterExpression.g:     k==2:'a'
> RosterExpression.g:     k==3:'l'
> RosterExpression.g:     k==4:'s'
> 
> Can someone explain me how to suppress them?
> I've tried to change the k option, but it doesn't wok.
> 
> See grammar in attachment:
> 
> (See attached file: RosterExpression.g)
> 
> Loïc
> 
> This message and any attachments (the "message") is
> intended solely for the addressees and is confidential. 
> If you receive this message in error, please delete it and 
> immediately notify the sender. Any use not in accord with 
> its purpose, any dissemination or disclosure, either whole 
> or partial, is prohibited except formal approval. The internet
> can not guarantee the integrity of this message. 
> BNP PARIBAS (and its subsidiaries) shall (will) not 
> therefore be liable for the message if modified. 
> 
>                 ---------------------------------------------
> 
> Ce message et toutes les pieces jointes (ci-apres le 
> "message") sont etablis a l'intention exclusive de ses 
> destinataires et sont confidentiels. Si vous recevez ce 
> message par erreur, merci de le detruire et d'en avertir 
> immediatement l'expediteur. Toute utilisation de ce 
> message non conforme a sa destination, toute diffusion 
> ou toute publication, totale ou partielle, est interdite, sauf 
> autorisation expresse. L'internet ne permettant pas 
> d'assurer l'integrite de ce message, BNP PARIBAS (et ses
> filiales) decline(nt) toute responsabilite au titre de ce 
> message, dans l'hypothese ou il aurait ete modifie.
> 



-- 
          __-/|    ? ?     |\-__
     __--/  /  \   (^^)   /  \  \--__
  _-/   /   /  /\ / ( )  /\  \   \   \-_
 /  /   /  /  /  (   ^^ ~  \  \  \   \  \
 / Oli Dragon    ( dragonoe at mcmaster.ca \
/  B.Eng. Sfwr   (     )    \    \  \    \
/  /  /    /__--_ (   ) __--__\    \  \  \
|  /  /  _/        \_ \_       \_  \  \  |
 \/  / _/            \_ \_       \_ \  \/
  \_/ /                -\_\        \ \_/
    \/                    )         \/
                        *~
        ___--<***************>--___
       [http://dragon.homelinux.org]
        ~~~--<***************>--~~~
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20050722/d9a07d9e/attachment.bin


More information about the antlr-interest mailing list