All Downloads are FREE. Search and download functionalities are using the official Maven repository.

hudson.model.labels.LabelExpressionParser Maven / Gradle / Ivy

The newest version!
// $ANTLR 3.4 hudson/model/labels/LabelExpression.g 2016-02-08 18:44:26

  package hudson.model.labels;
  import hudson.model.Label;


import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;

@SuppressWarnings({"all", "warnings", "unchecked"})
public class LabelExpressionParser extends Parser {
    public static final String[] tokenNames = new String[] {
        "", "", "", "", "AND", "ATOM", "IDENTIFIER_PART", "IFF", "IMPLIES", "LPAREN", "NOT", "OR", "RPAREN", "STRINGLITERAL", "WS"
    };

    public static final int EOF=-1;
    public static final int AND=4;
    public static final int ATOM=5;
    public static final int IDENTIFIER_PART=6;
    public static final int IFF=7;
    public static final int IMPLIES=8;
    public static final int LPAREN=9;
    public static final int NOT=10;
    public static final int OR=11;
    public static final int RPAREN=12;
    public static final int STRINGLITERAL=13;
    public static final int WS=14;

    // delegates
    public Parser[] getDelegates() {
        return new Parser[] {};
    }

    // delegators


    public LabelExpressionParser(TokenStream input) {
        this(input, new RecognizerSharedState());
    }
    public LabelExpressionParser(TokenStream input, RecognizerSharedState state) {
        super(input, state);
    }

    public String[] getTokenNames() { return LabelExpressionParser.tokenNames; }
    public String getGrammarFileName() { return "hudson/model/labels/LabelExpression.g"; }


      protected Object recoverFromMismatchedToken(IntStream input, int ttype, BitSet follow) throws RecognitionException {
        throw new MismatchedTokenException(ttype, input);
      }



    // $ANTLR start "expr"
    // hudson/model/labels/LabelExpression.g:23:1: expr returns [Label l] : t= term1 EOF ;
    public final Label expr() throws RecognitionException {
        Label l = null;


        Label t =null;


        try {
            // hudson/model/labels/LabelExpression.g:25:3: (t= term1 EOF )
            // hudson/model/labels/LabelExpression.g:25:5: t= term1 EOF
            {
            pushFollow(FOLLOW_term1_in_expr58);
            t=term1();

            state._fsp--;


            match(input,EOF,FOLLOW_EOF_in_expr60); 

             l = t; 

            }

        }
         
        finally {
        	// do for sure before leaving
        }
        return l;
    }
    // $ANTLR end "expr"



    // $ANTLR start "term1"
    // hudson/model/labels/LabelExpression.g:28:1: term1 returns [Label l] : t= term2 ( IFF r= term2 )? ;
    public final Label term1() throws RecognitionException {
        Label l = null;


        Label t =null;

        Label r =null;


        try {
            // hudson/model/labels/LabelExpression.g:30:3: (t= term2 ( IFF r= term2 )? )
            // hudson/model/labels/LabelExpression.g:30:5: t= term2 ( IFF r= term2 )?
            {
            pushFollow(FOLLOW_term2_in_term181);
            t=term2();

            state._fsp--;


            // hudson/model/labels/LabelExpression.g:30:14: ( IFF r= term2 )?
            int alt1=2;
            switch ( input.LA(1) ) {
                case IFF:
                    {
                    alt1=1;
                    }
                    break;
            }

            switch (alt1) {
                case 1 :
                    // hudson/model/labels/LabelExpression.g:30:16: IFF r= term2
                    {
                    match(input,IFF,FOLLOW_IFF_in_term186); 

                    pushFollow(FOLLOW_term2_in_term190);
                    r=term2();

                    state._fsp--;


                     t=t.iff(r); 

                    }
                    break;

            }


             l=t; 

            }

        }
         
        finally {
        	// do for sure before leaving
        }
        return l;
    }
    // $ANTLR end "term1"



    // $ANTLR start "term2"
    // hudson/model/labels/LabelExpression.g:33:1: term2 returns [Label l] : t= term3 ( IMPLIES r= term3 )? ;
    public final Label term2() throws RecognitionException {
        Label l = null;


        Label t =null;

        Label r =null;


        try {
            // hudson/model/labels/LabelExpression.g:35:3: (t= term3 ( IMPLIES r= term3 )? )
            // hudson/model/labels/LabelExpression.g:35:5: t= term3 ( IMPLIES r= term3 )?
            {
            pushFollow(FOLLOW_term3_in_term2117);
            t=term3();

            state._fsp--;


            // hudson/model/labels/LabelExpression.g:35:13: ( IMPLIES r= term3 )?
            int alt2=2;
            switch ( input.LA(1) ) {
                case IMPLIES:
                    {
                    alt2=1;
                    }
                    break;
            }

            switch (alt2) {
                case 1 :
                    // hudson/model/labels/LabelExpression.g:35:15: IMPLIES r= term3
                    {
                    match(input,IMPLIES,FOLLOW_IMPLIES_in_term2121); 

                    pushFollow(FOLLOW_term3_in_term2125);
                    r=term3();

                    state._fsp--;


                    t=t.implies(r);

                    }
                    break;

            }


             l=t; 

            }

        }
         
        finally {
        	// do for sure before leaving
        }
        return l;
    }
    // $ANTLR end "term2"



    // $ANTLR start "term3"
    // hudson/model/labels/LabelExpression.g:38:1: term3 returns [Label l] : t= term4 ( OR r= term4 )? ;
    public final Label term3() throws RecognitionException {
        Label l = null;


        Label t =null;

        Label r =null;


        try {
            // hudson/model/labels/LabelExpression.g:40:3: (t= term4 ( OR r= term4 )? )
            // hudson/model/labels/LabelExpression.g:40:5: t= term4 ( OR r= term4 )?
            {
            pushFollow(FOLLOW_term4_in_term3152);
            t=term4();

            state._fsp--;


            // hudson/model/labels/LabelExpression.g:40:13: ( OR r= term4 )?
            int alt3=2;
            switch ( input.LA(1) ) {
                case OR:
                    {
                    alt3=1;
                    }
                    break;
            }

            switch (alt3) {
                case 1 :
                    // hudson/model/labels/LabelExpression.g:40:15: OR r= term4
                    {
                    match(input,OR,FOLLOW_OR_in_term3156); 

                    pushFollow(FOLLOW_term4_in_term3160);
                    r=term4();

                    state._fsp--;


                    t=t.or(r);

                    }
                    break;

            }


             l=t; 

            }

        }
         
        finally {
        	// do for sure before leaving
        }
        return l;
    }
    // $ANTLR end "term3"



    // $ANTLR start "term4"
    // hudson/model/labels/LabelExpression.g:43:1: term4 returns [Label l] : t= term5 ( AND r= term5 )? ;
    public final Label term4() throws RecognitionException {
        Label l = null;


        Label t =null;

        Label r =null;


        try {
            // hudson/model/labels/LabelExpression.g:45:3: (t= term5 ( AND r= term5 )? )
            // hudson/model/labels/LabelExpression.g:45:5: t= term5 ( AND r= term5 )?
            {
            pushFollow(FOLLOW_term5_in_term4187);
            t=term5();

            state._fsp--;


            // hudson/model/labels/LabelExpression.g:45:13: ( AND r= term5 )?
            int alt4=2;
            switch ( input.LA(1) ) {
                case AND:
                    {
                    alt4=1;
                    }
                    break;
            }

            switch (alt4) {
                case 1 :
                    // hudson/model/labels/LabelExpression.g:45:15: AND r= term5
                    {
                    match(input,AND,FOLLOW_AND_in_term4191); 

                    pushFollow(FOLLOW_term5_in_term4195);
                    r=term5();

                    state._fsp--;


                    t=t.and(r);

                    }
                    break;

            }


             l=t; 

            }

        }
         
        finally {
        	// do for sure before leaving
        }
        return l;
    }
    // $ANTLR end "term4"



    // $ANTLR start "term5"
    // hudson/model/labels/LabelExpression.g:48:1: term5 returns [Label l] : (t= term6 | NOT x= term6 );
    public final Label term5() throws RecognitionException {
        Label l = null;


        Label t =null;

        Label x =null;


        try {
            // hudson/model/labels/LabelExpression.g:50:3: (t= term6 | NOT x= term6 )
            int alt5=2;
            switch ( input.LA(1) ) {
            case ATOM:
            case LPAREN:
            case STRINGLITERAL:
                {
                alt5=1;
                }
                break;
            case NOT:
                {
                alt5=2;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 5, 0, input);

                throw nvae;

            }

            switch (alt5) {
                case 1 :
                    // hudson/model/labels/LabelExpression.g:50:5: t= term6
                    {
                    pushFollow(FOLLOW_term6_in_term5221);
                    t=term6();

                    state._fsp--;


                     l=t; 

                    }
                    break;
                case 2 :
                    // hudson/model/labels/LabelExpression.g:51:5: NOT x= term6
                    {
                    match(input,NOT,FOLLOW_NOT_in_term5229); 

                    pushFollow(FOLLOW_term6_in_term5233);
                    x=term6();

                    state._fsp--;


                     l=x.not(); 

                    }
                    break;

            }
        }
         
        finally {
        	// do for sure before leaving
        }
        return l;
    }
    // $ANTLR end "term5"



    // $ANTLR start "term6"
    // hudson/model/labels/LabelExpression.g:55:1: term6 returns [Label l] : ( LPAREN t= term1 RPAREN |a= ATOM |s= STRINGLITERAL );
    public final Label term6() throws RecognitionException {
        Label l = null;


        Token a=null;
        Token s=null;
        Label t =null;


        try {
            // hudson/model/labels/LabelExpression.g:57:3: ( LPAREN t= term1 RPAREN |a= ATOM |s= STRINGLITERAL )
            int alt6=3;
            switch ( input.LA(1) ) {
            case LPAREN:
                {
                alt6=1;
                }
                break;
            case ATOM:
                {
                alt6=2;
                }
                break;
            case STRINGLITERAL:
                {
                alt6=3;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 6, 0, input);

                throw nvae;

            }

            switch (alt6) {
                case 1 :
                    // hudson/model/labels/LabelExpression.g:57:5: LPAREN t= term1 RPAREN
                    {
                    match(input,LPAREN,FOLLOW_LPAREN_in_term6256); 

                    pushFollow(FOLLOW_term1_in_term6260);
                    t=term1();

                    state._fsp--;


                    match(input,RPAREN,FOLLOW_RPAREN_in_term6262); 

                     l=t.paren(); 

                    }
                    break;
                case 2 :
                    // hudson/model/labels/LabelExpression.g:59:5: a= ATOM
                    {
                    a=(Token)match(input,ATOM,FOLLOW_ATOM_in_term6276); 

                     l=LabelAtom.get(a.getText()); 

                    }
                    break;
                case 3 :
                    // hudson/model/labels/LabelExpression.g:61:5: s= STRINGLITERAL
                    {
                    s=(Token)match(input,STRINGLITERAL,FOLLOW_STRINGLITERAL_in_term6290); 

                     l=LabelAtom.get(hudson.util.QuotedStringTokenizer.unquote(s.getText())); 

                    }
                    break;

            }
        }
         
        finally {
        	// do for sure before leaving
        }
        return l;
    }
    // $ANTLR end "term6"

    // Delegated rules


 

    public static final BitSet FOLLOW_term1_in_expr58 = new BitSet(new long[]{0x0000000000000000L});
    public static final BitSet FOLLOW_EOF_in_expr60 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_term2_in_term181 = new BitSet(new long[]{0x0000000000000082L});
    public static final BitSet FOLLOW_IFF_in_term186 = new BitSet(new long[]{0x0000000000002620L});
    public static final BitSet FOLLOW_term2_in_term190 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_term3_in_term2117 = new BitSet(new long[]{0x0000000000000102L});
    public static final BitSet FOLLOW_IMPLIES_in_term2121 = new BitSet(new long[]{0x0000000000002620L});
    public static final BitSet FOLLOW_term3_in_term2125 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_term4_in_term3152 = new BitSet(new long[]{0x0000000000000802L});
    public static final BitSet FOLLOW_OR_in_term3156 = new BitSet(new long[]{0x0000000000002620L});
    public static final BitSet FOLLOW_term4_in_term3160 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_term5_in_term4187 = new BitSet(new long[]{0x0000000000000012L});
    public static final BitSet FOLLOW_AND_in_term4191 = new BitSet(new long[]{0x0000000000002620L});
    public static final BitSet FOLLOW_term5_in_term4195 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_term6_in_term5221 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_NOT_in_term5229 = new BitSet(new long[]{0x0000000000002220L});
    public static final BitSet FOLLOW_term6_in_term5233 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_LPAREN_in_term6256 = new BitSet(new long[]{0x0000000000002620L});
    public static final BitSet FOLLOW_term1_in_term6260 = new BitSet(new long[]{0x0000000000001000L});
    public static final BitSet FOLLOW_RPAREN_in_term6262 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ATOM_in_term6276 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_STRINGLITERAL_in_term6290 = new BitSet(new long[]{0x0000000000000002L});

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy