Réf. : Re: [antlr-interest] Warning/ambiguity suppression

loic.lefevre at bnpparibas.com loic.lefevre at bnpparibas.com
Fri Jul 22 05:23:02 PDT 2005


Good idea but when I do that, I get:

ANTLR Parser Generator   Version 2.7.5 (20050128)   1989-2005 jGuru.com
RosterExpression.g:360:27: This subrule cannot be inverted
.  Only subrules of the form:
    (T1|T2|T3...) or
    ('c1'|'c2'|'c3'...)
may be inverted (ranges are also allowed).
RosterExpression.g:362:28: This subrule cannot be inverted
.  Only subrules of the form:
    (T1|T2|T3...) or
    ('c1'|'c2'|'c3'...)
may be inverted (ranges are also allowed).
Exiting due to errors.

I also tried

TRUE : ("true" ESC) => "true";

TRUE: ("true" ESC) => "true";
FALSE: ("false" ESC) => "false";

but then I get the same (first) warnings.

Loïc




Internet
dragonoe at mcmaster.ca@antlr.org - 22/07/2005 14:06


Envoyé par :      antlr-interest-bounces at antlr.org



Pour : antlr-interest

cc :


Objet :     Re: [antlr-interest] Warning/ambiguity suppression

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]
        ~~~--<***************>--~~~
(See attached file: signature.asc)

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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: =?ISO-8859-1?Q?signature=2Easc?=
Type: application/octet-stream
Size: 196 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20050722/1608e571/ISO-8859-1Qsignature2Easc.obj


More information about the antlr-interest mailing list