[antlr-interest] Known bug for antlr v3.2?

loic.lefevre at bnpparibas.com loic.lefevre at bnpparibas.com
Thu Dec 3 09:37:49 PST 2009


Hello,
while testing some gated semantic predicate:

address
@init{int n=1;}:
        ( {n<=12}?=> c=CHAR {n++;} )+
        {
            // check for address validity
            final String t = $address.text;
            if( t.length() != 12 ) {
                throw new InvalidSWIFTBlock1AddressException( t, 
$c.getLine(), $c.getCharPositionInLine() );
            }
        }
        ;
        catch[MismatchedTokenException mte] { throw new 
InvalidSWIFTBlock1AddressException( mte.token.getText(), mte.line, 
mte.charPositionInLine ); }


I encoutered problem after Java source generation:

    class DFA1 extends DFA {

        public DFA1(BaseRecognizer recognizer) {
            this.recognizer = recognizer;
            this.decisionNumber = 1;
            this.eot = DFA1_eot;
            this.eof = DFA1_eof;
            this.min = DFA1_min;
            this.max = DFA1_max;
            this.accept = DFA1_accept;
            this.special = DFA1_special;
            this.transition = DFA1_transition;
        }
        public String getDescription() {
            return "()+ loopback of 67:1: ({...}? =>c= CHAR )+";
        }
        public int specialStateTransition(int s, IntStream _input) throws 
NoViableAltException {
            TokenStream input = (TokenStream)_input;
                int _s = s;
            switch ( s ) {
                    case 0 : 
                        int LA1_23 = input.LA(1);

 
                        int index1_23 = input.index();
                        input.rewind();
                        s = -1;
                        if ( (LA1_23==CHAR) ) {s = 24;}

                        else if ( (LA1_23==12) && ((n<=12))) {s = 14;}

The Java compiler says:

SWIFTMTParser.java:865: cannot find
 symbol
symbol  : variable n
location: class 
com.bnpparibas.acetp.foxhound.spec2009.parser.SWIFTMTParser.DFA1
                        else if ( (LA1_23==12) && ((n<=12))) {s = 14;}


I've tried to modify something using -Xminswitchalts 100 but I don't know 
what to do to correct this issue.
Is it a known antlr bug?

Regards,
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. 
Do not print this message unless it is necessary,
consider the environment.

                ---------------------------------------------

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.
N'imprimez ce message que si necessaire,
pensez a l'environnement.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20091203/ee4a8699/attachment.html 


More information about the antlr-interest mailing list