Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  // $ANTLR 3.0.1 /home/loris/projects/wildcat-trunk/wildcat/target/checkout/modules/api/src/main/antlr/org/ow2/wildcat/util/Path.g 2009-02-05 09:29:31
  
  package org.ow2.wildcat.util;
  
  
  import java.util.Stack;
  import java.util.List;
 
 public class PathParser extends Parser {
     public static final String[] tokenNames = new String[] {
         "<invalid>""<EOR>""<DOWN>""<UP>""ID""'/'""'#'""'://'""'.'""'..'""'*'"
     };
     public static final int EOF=-1;
     public static final int ID=4;
 
         public PathParser(TokenStream input) {
             super(input);
         }
         
 
     public String[] getTokenNames() { return ; }
     public String getGrammarFileName() { return "/home/loris/projects/wildcat-trunk/wildcat/target/checkout/modules/api/src/main/antlr/org/ow2/wildcat/util/Path.g"; }
 
 
     	protected void mismatch(IntStream inputint ttypeBitSet followthrows RecognitionException {
     		MismatchedTokenException mte = new MismatchedTokenException(ttypeinput);
     		throw mte;
     	}
 
 
     public static class path_return extends ParserRuleReturnScope {
         public String h;
         public List<Stringr;
         public String a;
         public boolean abs;
     };
 
     // $ANTLR start path
     // /home/loris/projects/wildcat-trunk/wildcat/target/checkout/modules/api/src/main/antlr/org/ow2/wildcat/util/Path.g:18:1: path returns [String h, List<String> r, String a, boolean abs] : ( host | '/' )? (res= resource '/' )* (res= resource )? ( '#' attribute )? EOF ;
     public final path_return path() throws RecognitionException {
         path_return retval = new path_return();
         retval.start = .LT(1);
 
         resource_return res = null;
 
         String host1 = null;
 
         attribute_return attribute2 = null;
 
 
 
         	retval.h = null;
         	retval.r = new ArrayList<String> ();
         	retval.a = null;
         	retval.abs = false;
 
         try {
             // /home/loris/projects/wildcat-trunk/wildcat/target/checkout/modules/api/src/main/antlr/org/ow2/wildcat/util/Path.g:25:2: ( ( host | '/' )? (res= resource '/' )* (res= resource )? ( '#' attribute )? EOF )
             // /home/loris/projects/wildcat-trunk/wildcat/target/checkout/modules/api/src/main/antlr/org/ow2/wildcat/util/Path.g:25:4: ( host | '/' )? (res= resource '/' )* (res= resource )? ( '#' attribute )? EOF
             {
             // /home/loris/projects/wildcat-trunk/wildcat/target/checkout/modules/api/src/main/antlr/org/ow2/wildcat/util/Path.g:25:4: ( host | '/' )?
             int alt1=3;
             int LA1_0 = .LA(1);
 
             if ( (LA1_0==) ) {
                 int LA1_1 = .LA(2);
 
                 if ( (LA1_1==7) ) {
                     alt1=1;
                 }
             }
             else if ( (LA1_0==5) ) {
                 alt1=2;
             }
             switch (alt1) {
                 case 1 :
                     // /home/loris/projects/wildcat-trunk/wildcat/target/checkout/modules/api/src/main/antlr/org/ow2/wildcat/util/Path.g:25:5: host
                     {
                     pushFollow();
                     host1=host();
                     --;
 
                     retval.h = host1retval.abs = true;
 
                     }
                     break;
                 case 2 :
                     // /home/loris/projects/wildcat-trunk/wildcat/target/checkout/modules/api/src/main/antlr/org/ow2/wildcat/util/Path.g:25:47: '/'
                     {
                     match(,5,); 
                     retval.abs = true;
 
                     }
                     break;
 
             }
 
            // /home/loris/projects/wildcat-trunk/wildcat/target/checkout/modules/api/src/main/antlr/org/ow2/wildcat/util/Path.g:26:3: (res= resource '/' )*
            loop2:
            do {
                int alt2=2;
                int LA2_0 = .LA(1);
                if ( (LA2_0==||(LA2_0>=8 && LA2_0<=10)) ) {
                    int LA2_1 = .LA(2);
                    if ( (LA2_1==5) ) {
                        alt2=1;
                    }
                }
                switch (alt2) {
            	case 1 :
            	    // /home/loris/projects/wildcat-trunk/wildcat/target/checkout/modules/api/src/main/antlr/org/ow2/wildcat/util/Path.g:26:4: res= resource '/'
            	    {
            	    pushFollow();
            	    res=resource();
            	    --;
            	    match(,5,); 
            	    retval.r.add(.toString(res.start,res.stop));
            	    }
            	    break;
            	default :
            	    break loop2;
                }
            } while (true);
            // /home/loris/projects/wildcat-trunk/wildcat/target/checkout/modules/api/src/main/antlr/org/ow2/wildcat/util/Path.g:27:3: (res= resource )?
            int alt3=2;
            int LA3_0 = .LA(1);
            if ( (LA3_0==||(LA3_0>=8 && LA3_0<=10)) ) {
                alt3=1;
            }
            switch (alt3) {
                case 1 :
                    // /home/loris/projects/wildcat-trunk/wildcat/target/checkout/modules/api/src/main/antlr/org/ow2/wildcat/util/Path.g:27:4: res= resource
                    {
                    pushFollow();
                    res=resource();
                    --;
                    retval.r.add(.toString(res.start,res.stop));
                    }
                    break;
            }
            // /home/loris/projects/wildcat-trunk/wildcat/target/checkout/modules/api/src/main/antlr/org/ow2/wildcat/util/Path.g:28:3: ( '#' attribute )?
            int alt4=2;
            int LA4_0 = .LA(1);
            if ( (LA4_0==6) ) {
                alt4=1;
            }
            switch (alt4) {
                case 1 :
                    // /home/loris/projects/wildcat-trunk/wildcat/target/checkout/modules/api/src/main/antlr/org/ow2/wildcat/util/Path.g:28:4: '#' attribute
                    {
                    match(,6,); 
                    pushFollow();
                    attribute2=attribute();
                    --;
                    retval.a = .toString(attribute2.start,attribute2.stop);
                    }
                    break;
            }
            match(,,); 
            }
            retval.stop = .LT(-1);
        }
             finally {
        }
        return retval;
    }
    // $ANTLR end path
    // $ANTLR start host
    // /home/loris/projects/wildcat-trunk/wildcat/target/checkout/modules/api/src/main/antlr/org/ow2/wildcat/util/Path.g:32:11: protected host returns [String hostname] : i= ID '://' ;
    public final String host() throws RecognitionException {
        String hostname = null;
        Token i=null;
        try {
            // /home/loris/projects/wildcat-trunk/wildcat/target/checkout/modules/api/src/main/antlr/org/ow2/wildcat/util/Path.g:33:2: (i= ID '://' )
            // /home/loris/projects/wildcat-trunk/wildcat/target/checkout/modules/api/src/main/antlr/org/ow2/wildcat/util/Path.g:33:4: i= ID '://'
            {
            i=(Token).LT(1);
            match(,,); 
            match(,7,); 
            hostname = i.getText();
            }
        }
             finally {
        }
        return hostname;
    }
    // $ANTLR end host
    // $ANTLR start address
    // /home/loris/projects/wildcat-trunk/wildcat/target/checkout/modules/api/src/main/antlr/org/ow2/wildcat/util/Path.g:37:11: protected address : ID ;
    public final void address() throws RecognitionException {
        try {
            // /home/loris/projects/wildcat-trunk/wildcat/target/checkout/modules/api/src/main/antlr/org/ow2/wildcat/util/Path.g:37:19: ( ID )
            // /home/loris/projects/wildcat-trunk/wildcat/target/checkout/modules/api/src/main/antlr/org/ow2/wildcat/util/Path.g:37:21: ID
            {
            match(,,); 
            }
        }
             finally {
        }
        return ;
    }
    // $ANTLR end address
    public static class resource_return extends ParserRuleReturnScope {
    };
    // $ANTLR start resource
    // /home/loris/projects/wildcat-trunk/wildcat/target/checkout/modules/api/src/main/antlr/org/ow2/wildcat/util/Path.g:40:11: protected resource : ( '.' | '..' | '*' | ID );
    public final resource_return resource() throws RecognitionException {
        resource_return retval = new resource_return();
        retval.start = .LT(1);
        try {
            // /home/loris/projects/wildcat-trunk/wildcat/target/checkout/modules/api/src/main/antlr/org/ow2/wildcat/util/Path.g:40:20: ( '.' | '..' | '*' | ID )
            // /home/loris/projects/wildcat-trunk/wildcat/target/checkout/modules/api/src/main/antlr/org/ow2/wildcat/util/Path.g:
            {
            if ( .LA(1)==||(.LA(1)>=8 && .LA(1)<=10) ) {
                .consume();
                =false;
            }
            else {
                MismatchedSetException mse =
                    new MismatchedSetException(null,);
                recoverFromMismatchedSet(,mse,);    throw mse;
            }
            }
            retval.stop = .LT(-1);
        }
             finally {
        }
        return retval;
    }
    // $ANTLR end resource
    public static class attribute_return extends ParserRuleReturnScope {
    };
    // $ANTLR start attribute
    // /home/loris/projects/wildcat-trunk/wildcat/target/checkout/modules/api/src/main/antlr/org/ow2/wildcat/util/Path.g:47:11: protected attribute : ( '*' | ID );
    public final attribute_return attribute() throws RecognitionException {
        attribute_return retval = new attribute_return();
        retval.start = .LT(1);
        try {
            // /home/loris/projects/wildcat-trunk/wildcat/target/checkout/modules/api/src/main/antlr/org/ow2/wildcat/util/Path.g:47:21: ( '*' | ID )
            // /home/loris/projects/wildcat-trunk/wildcat/target/checkout/modules/api/src/main/antlr/org/ow2/wildcat/util/Path.g:
            {
            if ( .LA(1)==||.LA(1)==10 ) {
                .consume();
                =false;
            }
            else {
                MismatchedSetException mse =
                    new MismatchedSetException(null,);
                recoverFromMismatchedSet(,mse,);    throw mse;
            }
            }
            retval.stop = .LT(-1);
        }
             finally {
        }
        return retval;
    }
    // $ANTLR end attribute
 
    public static final BitSet FOLLOW_host_in_path51 = new BitSet(new long[]{0x0000000000000750L});
    public static final BitSet FOLLOW_5_in_path56 = new BitSet(new long[]{0x0000000000000750L});
    public static final BitSet FOLLOW_resource_in_path67 = new BitSet(new long[]{0x0000000000000020L});
    public static final BitSet FOLLOW_5_in_path69 = new BitSet(new long[]{0x0000000000000750L});
    public static final BitSet FOLLOW_resource_in_path80 = new BitSet(new long[]{0x0000000000000040L});
    public static final BitSet FOLLOW_6_in_path89 = new BitSet(new long[]{0x0000000000000410L});
    public static final BitSet FOLLOW_attribute_in_path91 = new BitSet(new long[]{0x0000000000000000L});
    public static final BitSet FOLLOW_EOF_in_path99 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ID_in_host118 = new BitSet(new long[]{0x0000000000000080L});
    public static final BitSet FOLLOW_7_in_host120 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ID_in_address135 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_set_in_resource0 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_set_in_attribute0 = new BitSet(new long[]{0x0000000000000002L});
New to GrepCode? Check out our FAQ X