Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   // $ANTLR 3.3 Nov 30, 2010 12:45:30 src\\main\\antlr\\XPathEnhancer.g 2011-06-19 16:21:01
   
   /*
   Based on the XPath 1.0 (http://www.w3.org/TR/1999/REC-xpath-19991116) grammar by Jan-Willem van den Broek, 
   version 1.0, downloaded on 2011-06-18 from http://blog.jwbroek.com/2010/07/antlr-grammar-for-parsing-xpath-10.html
   */
   package org.docx4j.model.datastorage;
   
   
  import java.util.HashMap;
  
  public class XPathEnhancerParser extends Parser {
      public static final String[] tokenNames = new String[] {
          "<invalid>""<EOR>""<DOWN>""<UP>""PATHSEP""ABRPATH""LPAR""RPAR""LBRAC""RBRAC""MINUS""PLUS""DOT""MUL""DOTDOT""AT""COMMA""PIPE""LESS""MORE""LE""GE""COLON""CC""APOS""QUOT""AxisName""NodeType""Literal""Number""NCName""Digits""Whitespace""NCNameStartChar""NCNameChar""PermittedHighSurrogateChar""LowSurrogateChar""'processing-instruction'""'or'""'and'""'='""'!='""'div'""'mod'""'$'"
      };
      public static final int EOF=-1;
      public static final int T__37=37;
      public static final int T__38=38;
      public static final int T__39=39;
      public static final int T__40=40;
      public static final int T__41=41;
      public static final int T__42=42;
      public static final int T__43=43;
      public static final int T__44=44;
      public static final int PATHSEP=4;
      public static final int ABRPATH=5;
      public static final int LPAR=6;
      public static final int RPAR=7;
      public static final int LBRAC=8;
      public static final int RBRAC=9;
      public static final int MINUS=10;
      public static final int PLUS=11;
      public static final int DOT=12;
      public static final int MUL=13;
      public static final int DOTDOT=14;
      public static final int AT=15;
      public static final int COMMA=16;
      public static final int PIPE=17;
      public static final int LESS=18;
      public static final int MORE=19;
      public static final int LE=20;
      public static final int GE=21;
      public static final int COLON=22;
      public static final int CC=23;
      public static final int APOS=24;
      public static final int QUOT=25;
      public static final int AxisName=26;
      public static final int NodeType=27;
      public static final int Literal=28;
      public static final int Number=29;
      public static final int NCName=30;
      public static final int Digits=31;
      public static final int Whitespace=32;
      public static final int NCNameStartChar=33;
      public static final int NCNameChar=34;
      public static final int PermittedHighSurrogateChar=35;
      public static final int LowSurrogateChar=36;
  
      // delegates
      // delegators
  
  
          public XPathEnhancerParser(TokenStream input) {
              this(inputnew RecognizerSharedState());
          }
          public XPathEnhancerParser(TokenStream inputRecognizerSharedState state) {
              super(inputstate);
               
          }
          
      protected StringTemplateGroup templateLib =
        new StringTemplateGroup("XPathEnhancerParserTemplates"AngleBracketTemplateLexer.class);
  
      public void setTemplateLib(StringTemplateGroup templateLib) {
        this. = templateLib;
      }
      public StringTemplateGroup getTemplateLib() {
        return ;
      }
    
allows convenient multi-value initialization: "new STAttrMap().put(...).put(...)"
  
      @SuppressWarnings("unchecked")
      public static class STAttrMap extends HashMap {
        public STAttrMap put(String attrNameObject value) {
         super.put(attrNamevalue);
         return this;
       }
       public STAttrMap put(String attrNameint value) {
         super.put(attrName, new Integer(value));
         return this;
       }
     }
 
     public String[] getTokenNames() { return .; }
     public String getGrammarFileName() { return "src\\main\\antlr\\XPathEnhancer.g"; }
 
 
     private String index;
     private String prefix;
     private int prefixLength;
 
     public static String enhanceXPath(final String prefixfinal int indexfinal String xpath) {
         
       final ANTLRStringStream stringStream = new ANTLRStringStream(xpath);
       final XPathEnhancerLexer xl = new XPathEnhancerLexer(stringStream);
       final TokenRewriteStream trs = new TokenRewriteStream(xl);
       final XPathEnhancerParser xp = new XPathEnhancerParser(trsindexprefix);
         
       try {
         xp.main();
       } catch (RecognitionException e) {
         throw new IllegalArgumentException(xpath + " is no valid XPath expression"e);
       }
       
       final String enhanced = trs.toString();
       return enhanced;     
     }
 
     public XPathEnhancerParser(TokenStream inputfinal int indexfinal String prefix) {
         this(input);
         this. = "" + index;
         this. = prefix;
         this. = prefix.length();
     }
          
     private boolean sharesPrefix(final String path) {
       return path != null && path.startsWith();
     }
 
     private String remainingSuffix(final String path) {
       if (path == null || path.length() < ) {
         return null;
       } else {
         return path.substring();
       }
     }
 
 
     public static class main_return extends ParserRuleReturnScope {
         public StringTemplate st;
         public Object getTemplate() { return ; }
         public String toString() { return ==null?null:.toString(); }
     };
 
     // $ANTLR start "main"
     // src\\main\\antlr\\XPathEnhancer.g:87:1: main : expr ;
     public final XPathEnhancerParser.main_return main() throws RecognitionException {
         retval.start = .LT(1);
 
         try {
             // src\\main\\antlr\\XPathEnhancer.g:88:3: ( expr )
             // src\\main\\antlr\\XPathEnhancer.g:89:3: expr
             {
             pushFollow();
             expr();
 
             .--;
 
 
             }
 
             retval.stop = .LT(-1);
 
         }
         catch (RecognitionException re) {
             reportError(re);
             recover(,re);
         }
         finally {
         }
         return retval;
     }
     // $ANTLR end "main"
 
     public static class locationPath_return extends ParserRuleReturnScope {
         public StringTemplate st;
         public Object getTemplate() { return ; }
         public String toString() { return ==null?null:.toString(); }
     };
 
     // $ANTLR start "locationPath"
     // src\\main\\antlr\\XPathEnhancer.g:92:1: locationPath : ( relativeLocationPath | absoluteLocationPathNoroot );
         retval.start = .LT(1);
 
         try {
             // src\\main\\antlr\\XPathEnhancer.g:93:3: ( relativeLocationPath | absoluteLocationPathNoroot )
             int alt1=2;
             int LA1_0 = .LA(1);
 
             if ( ((LA1_0>= && LA1_0<=)||(LA1_0>= && LA1_0<=)||LA1_0==||LA1_0==37) ) {
                 alt1=1;
             }
             else if ( ((LA1_0>= && LA1_0<=)) ) {
                 alt1=2;
             }
             else {
                 NoViableAltException nvae =
                     new NoViableAltException("", 1, 0, );
 
                 throw nvae;
             }
             switch (alt1) {
                 case 1 :
                     // src\\main\\antlr\\XPathEnhancer.g:94:3: relativeLocationPath
                     {
                     pushFollow();
                     relativeLocationPath();
 
                     .--;
 
 
                     }
                     break;
                 case 2 :
                     // src\\main\\antlr\\XPathEnhancer.g:95:6: absoluteLocationPathNoroot
                     {
                     pushFollow();
                     absoluteLocationPathNoroot();
 
                     .--;
 
 
                     }
                     break;
 
             }
             retval.stop = .LT(-1);
 
         }
         catch (RecognitionException re) {
             reportError(re);
             recover(,re);
         }
         finally {
         }
         return retval;
     }
     // $ANTLR end "locationPath"
 
     public static class absoluteLocationPathNoroot_return extends ParserRuleReturnScope {
         public StringTemplate st;
         public Object getTemplate() { return ; }
         public String toString() { return ==null?null:.toString(); }
     };
 
     // $ANTLR start "absoluteLocationPathNoroot"
     // src\\main\\antlr\\XPathEnhancer.g:98:1: absoluteLocationPathNoroot : originalAbsoluteLocationPathNoroot -> template(sharesPrefix= sharesPrefix($text) commonPrefix= prefix index= index remainingSuffix= remainingSuffix($text) originalPath= $text ) \"<if(sharesPrefix)><commonPrefix>[<index>]<remainingSuffix><else><originalPath><endif>\";
         retval.start = .LT(1);
 
         try {
             // src\\main\\antlr\\XPathEnhancer.g:99:3: ( originalAbsoluteLocationPathNoroot -> template(sharesPrefix= sharesPrefix($text) commonPrefix= prefix index= index remainingSuffix= remainingSuffix($text) originalPath= $text ) \"<if(sharesPrefix)><commonPrefix>[<index>]<remainingSuffix><else><originalPath><endif>\")
             // src\\main\\antlr\\XPathEnhancer.g:100:3: originalAbsoluteLocationPathNoroot
             {
             originalAbsoluteLocationPathNoroot();
 
             .--;
 
 
 
             // TEMPLATE REWRITE
             // 101:3: -> template(sharesPrefix= sharesPrefix($text) commonPrefix= prefix index= index remainingSuffix= remainingSuffix($text) originalPath= $text ) \"<if(sharesPrefix)><commonPrefix>[<index>]<remainingSuffix><else><originalPath><endif>\"
             {
                 retval.st = new StringTemplate("<if(sharesPrefix)><commonPrefix>[<index>]<remainingSuffix><else><originalPath><endif>",
               new STAttrMap().put("sharesPrefix",  sharesPrefix(.toString(retval.start,.LT(-1)))    ).put("commonPrefix",                   ).put("index",                    ).put("remainingSuffix",  remainingSuffix(.toString(retval.start,.LT(-1))) ).put("originalPath",  .toString(retval.start,.LT(-1))                  ));
             }
 
             ((TokenRewriteStream)).replace(
               ((Token)retval.start).getTokenIndex(),
               .LT(-1).getTokenIndex(),
               retval.st);
             }
 
             retval.stop = .LT(-1);
 
         }
         catch (RecognitionException re) {
             reportError(re);
             recover(,re);
         }
         finally {
         }
         return retval;
     }
     // $ANTLR end "absoluteLocationPathNoroot"
 
     public static class originalAbsoluteLocationPathNoroot_return extends ParserRuleReturnScope {
         public StringTemplate st;
         public Object getTemplate() { return ; }
         public String toString() { return ==null?null:.toString(); }
     };
 
     // $ANTLR start "originalAbsoluteLocationPathNoroot"
     // src\\main\\antlr\\XPathEnhancer.g:111:1: originalAbsoluteLocationPathNoroot : ( '/' relativeLocationPath | '//' relativeLocationPath );
         retval.start = .LT(1);
 
         try {
             // src\\main\\antlr\\XPathEnhancer.g:112:3: ( '/' relativeLocationPath | '//' relativeLocationPath )
             int alt2=2;
             int LA2_0 = .LA(1);
 
             if ( (LA2_0==) ) {
                 alt2=1;
             }
             else if ( (LA2_0==) ) {
                 alt2=2;
             }
             else {
                 NoViableAltException nvae =
                     new NoViableAltException("", 2, 0, );
 
                 throw nvae;
             }
             switch (alt2) {
                 case 1 :
                     // src\\main\\antlr\\XPathEnhancer.g:113:3: '/' relativeLocationPath
                     {
                     relativeLocationPath();
 
                     .--;
 
 
                     }
                     break;
                 case 2 :
                     // src\\main\\antlr\\XPathEnhancer.g:114:5: '//' relativeLocationPath
                     {
                     relativeLocationPath();
 
                     .--;
 
 
                     }
                     break;
 
             }
             retval.stop = .LT(-1);
 
         }
         catch (RecognitionException re) {
             reportError(re);
             recover(,re);
         }
         finally {
         }
         return retval;
     }
     // $ANTLR end "originalAbsoluteLocationPathNoroot"
 
     public static class relativeLocationPath_return extends ParserRuleReturnScope {
         public StringTemplate st;
         public Object getTemplate() { return ; }
         public String toString() { return ==null?null:.toString(); }
     };
 
     // $ANTLR start "relativeLocationPath"
     // src\\main\\antlr\\XPathEnhancer.g:117:1: relativeLocationPath : step ( ( '/' | '//' ) step )* ;
         retval.start = .LT(1);
 
         try {
             // src\\main\\antlr\\XPathEnhancer.g:118:3: ( step ( ( '/' | '//' ) step )* )
             // src\\main\\antlr\\XPathEnhancer.g:119:3: step ( ( '/' | '//' ) step )*
             {
             step();
 
             .--;
 
             // src\\main\\antlr\\XPathEnhancer.g:120:3: ( ( '/' | '//' ) step )*
             loop3:
             do {
                 int alt3=2;
                 int LA3_0 = .LA(1);
 
                 if ( ((LA3_0>= && LA3_0<=)) ) {
                     alt3=1;
                 }
 
 
                 switch (alt3) {
             	case 1 :
             	    // src\\main\\antlr\\XPathEnhancer.g:121:5: ( '/' | '//' ) step
             	    {
             	    if ( (.LA(1)>= && .LA(1)<=) ) {
             	        .consume();
             	        .=false;
             	    }
             	    else {
             	        MismatchedSetException mse = new MismatchedSetException(null,);
             	        throw mse;
             	    }
 
             	    pushFollow();
             	    step();
 
             	    .--;
 
 
             	    }
             	    break;
 
             	default :
             	    break loop3;
                 }
             } while (true);
 
 
             }
 
             retval.stop = .LT(-1);
 
         }
         catch (RecognitionException re) {
             reportError(re);
             recover(,re);
         }
         finally {
         }
         return retval;
     }
     // $ANTLR end "relativeLocationPath"
 
     public static class step_return extends ParserRuleReturnScope {
         public StringTemplate st;
         public Object getTemplate() { return ; }
         public String toString() { return ==null?null:.toString(); }
     };
 
     // $ANTLR start "step"
     // src\\main\\antlr\\XPathEnhancer.g:129:1: step : ( axisSpecifier nodeTest ( predicate )* | abbreviatedStep );
     public final XPathEnhancerParser.step_return step() throws RecognitionException {
         retval.start = .LT(1);
 
         try {
             // src\\main\\antlr\\XPathEnhancer.g:130:3: ( axisSpecifier nodeTest ( predicate )* | abbreviatedStep )
             int alt5=2;
             int LA5_0 = .LA(1);
 
             if ( (LA5_0==||LA5_0==||(LA5_0>= && LA5_0<=)||LA5_0==||LA5_0==37) ) {
                 alt5=1;
             }
             else if ( (LA5_0==||LA5_0==) ) {
                 alt5=2;
             }
             else {
                 NoViableAltException nvae =
                     new NoViableAltException("", 5, 0, );
 
                 throw nvae;
             }
             switch (alt5) {
                 case 1 :
                     // src\\main\\antlr\\XPathEnhancer.g:131:3: axisSpecifier nodeTest ( predicate )*
                     {
                     pushFollow();
                     axisSpecifier();
 
                     .--;
 
                     pushFollow();
                     nodeTest();
 
                     .--;
 
                     // src\\main\\antlr\\XPathEnhancer.g:131:26: ( predicate )*
                     loop4:
                     do {
                         int alt4=2;
                         int LA4_0 = .LA(1);
 
                         if ( (LA4_0==) ) {
                             alt4=1;
                         }
 
 
                         switch (alt4) {
                     	case 1 :
                     	    // src\\main\\antlr\\XPathEnhancer.g:131:26: predicate
                     	    {
                     	    pushFollow();
                     	    predicate();
 
                     	    .--;
 
 
                     	    }
                     	    break;
 
                     	default :
                     	    break loop4;
                         }
                     } while (true);
 
 
                     }
                     break;
                 case 2 :
                     // src\\main\\antlr\\XPathEnhancer.g:132:5: abbreviatedStep
                     {
                     pushFollow();
                     abbreviatedStep();
 
                     .--;
 
 
                     }
                     break;
 
             }
             retval.stop = .LT(-1);
 
         }
         catch (RecognitionException re) {
             reportError(re);
             recover(,re);
         }
         finally {
         }
         return retval;
     }
     // $ANTLR end "step"
 
     public static class axisSpecifier_return extends ParserRuleReturnScope {
         public StringTemplate st;
         public Object getTemplate() { return ; }
         public String toString() { return ==null?null:.toString(); }
     };
 
     // $ANTLR start "axisSpecifier"
     // src\\main\\antlr\\XPathEnhancer.g:135:1: axisSpecifier : ( AxisName '::' | ( '@' )? );
         retval.start = .LT(1);
 
         try {
             // src\\main\\antlr\\XPathEnhancer.g:136:3: ( AxisName '::' | ( '@' )? )
             int alt7=2;
             int LA7_0 = .LA(1);
 
             if ( (LA7_0==) ) {
                 int LA7_1 = .LA(2);
 
                 if ( (LA7_1==) ) {
                     alt7=1;
                 }
                 else if ( (LA7_1==||(LA7_1>= && LA7_1<=)||(LA7_1>= && LA7_1<=)||LA7_1==||(LA7_1>= && LA7_1<=)||(LA7_1>=38 && LA7_1<=43)) ) {
                     alt7=2;
                 }
                 else {
                     NoViableAltException nvae =
                         new NoViableAltException("", 7, 1, );
 
                     throw nvae;
                 }
             }
             else if ( (LA7_0==||LA7_0==||LA7_0==||LA7_0==||LA7_0==37) ) {
                 alt7=2;
             }
             else {
                 NoViableAltException nvae =
                     new NoViableAltException("", 7, 0, );
 
                 throw nvae;
             }
             switch (alt7) {
                 case 1 :
                     // src\\main\\antlr\\XPathEnhancer.g:137:3: AxisName '::'
                     {
                     match(,,); 
                     match(,,); 
 
                     }
                     break;
                 case 2 :
                     // src\\main\\antlr\\XPathEnhancer.g:138:5: ( '@' )?
                     {
                     // src\\main\\antlr\\XPathEnhancer.g:138:5: ( '@' )?
                     int alt6=2;
                     int LA6_0 = .LA(1);
 
                     if ( (LA6_0==) ) {
                         alt6=1;
                     }
                     switch (alt6) {
                         case 1 :
                             // src\\main\\antlr\\XPathEnhancer.g:138:5: '@'
                             {
                             match(,,); 
 
                             }
                             break;
 
                     }
 
 
                     }
                     break;
 
             }
             retval.stop = .LT(-1);
 
         }
         catch (RecognitionException re) {
             reportError(re);
             recover(,re);
         }
         finally {
         }
         return retval;
     }
     // $ANTLR end "axisSpecifier"
 
     public static class nodeTest_return extends ParserRuleReturnScope {
         public StringTemplate st;
         public Object getTemplate() { return ; }
         public String toString() { return ==null?null:.toString(); }
     };
 
     // $ANTLR start "nodeTest"
     // src\\main\\antlr\\XPathEnhancer.g:141:1: nodeTest : ( nameTest | NodeType '(' ')' | 'processing-instruction' '(' Literal ')' );
         retval.start = .LT(1);
 
         try {
             // src\\main\\antlr\\XPathEnhancer.g:142:3: ( nameTest | NodeType '(' ')' | 'processing-instruction' '(' Literal ')' )
             int alt8=3;
             switch ( .LA(1) ) {
             case :
             case :
             case :
                 {
                 alt8=1;
                 }
                 break;
             case :
                 {
                 alt8=2;
                 }
                 break;
             case 37:
                 {
                 alt8=3;
                 }
                 break;
             default:
                 NoViableAltException nvae =
                     new NoViableAltException("", 8, 0, );
 
                 throw nvae;
             }
 
             switch (alt8) {
                 case 1 :
                     // src\\main\\antlr\\XPathEnhancer.g:143:3: nameTest
                     {
                     pushFollow();
                     nameTest();
 
                     .--;
 
 
                     }
                     break;
                 case 2 :
                     // src\\main\\antlr\\XPathEnhancer.g:144:5: NodeType '(' ')'
                     {
                     match(,,); 
                     match(,,); 
                     match(,,); 
 
                     }
                     break;
                 case 3 :
                     // src\\main\\antlr\\XPathEnhancer.g:145:5: 'processing-instruction' '(' Literal ')'
                     {
                     match(,37,); 
                     match(,,); 
                     match(,,); 
                     match(,,); 
 
                     }
                     break;
 
             }
             retval.stop = .LT(-1);
 
         }
         catch (RecognitionException re) {
             reportError(re);
             recover(,re);
         }
         finally {
         }
         return retval;
     }
     // $ANTLR end "nodeTest"
 
     public static class predicate_return extends ParserRuleReturnScope {
         public StringTemplate st;
         public Object getTemplate() { return ; }
         public String toString() { return ==null?null:.toString(); }
     };
 
     // $ANTLR start "predicate"
     // src\\main\\antlr\\XPathEnhancer.g:148:1: predicate : '[' expr ']' ;
         retval.start = .LT(1);
 
         try {
             // src\\main\\antlr\\XPathEnhancer.g:149:3: ( '[' expr ']' )
             // src\\main\\antlr\\XPathEnhancer.g:150:3: '[' expr ']'
             {
             match(,,); 
             pushFollow();
             expr();
 
             .--;
 
             match(,,); 
 
             }
 
             retval.stop = .LT(-1);
 
         }
         catch (RecognitionException re) {
             reportError(re);
             recover(,re);
         }
         finally {
         }
         return retval;
     }
     // $ANTLR end "predicate"
 
     public static class abbreviatedStep_return extends ParserRuleReturnScope {
         public StringTemplate st;
         public Object getTemplate() { return ; }
         public String toString() { return ==null?null:.toString(); }
     };
 
     // $ANTLR start "abbreviatedStep"
     // src\\main\\antlr\\XPathEnhancer.g:153:1: abbreviatedStep : ( '.' | '..' );
         retval.start = .LT(1);
 
         try {
             // src\\main\\antlr\\XPathEnhancer.g:154:3: ( '.' | '..' )
             // src\\main\\antlr\\XPathEnhancer.g:
             {
             if ( .LA(1)==||.LA(1)== ) {
                 .consume();
                 .=false;
             }
             else {
                 MismatchedSetException mse = new MismatchedSetException(null,);
                 throw mse;
             }
 
 
             }
 
             retval.stop = .LT(-1);
 
         }
         catch (RecognitionException re) {
             reportError(re);
             recover(,re);
         }
         finally {
         }
         return retval;
     }
     // $ANTLR end "abbreviatedStep"
 
     public static class expr_return extends ParserRuleReturnScope {
         public StringTemplate st;
         public Object getTemplate() { return ; }
         public String toString() { return ==null?null:.toString(); }
     };
 
     // $ANTLR start "expr"
     // src\\main\\antlr\\XPathEnhancer.g:159:1: expr : orExpr ;
     public final XPathEnhancerParser.expr_return expr() throws RecognitionException {
         retval.start = .LT(1);
 
         try {
             // src\\main\\antlr\\XPathEnhancer.g:160:3: ( orExpr )
             // src\\main\\antlr\\XPathEnhancer.g:161:3: orExpr
             {
             pushFollow();
             orExpr();
 
             .--;
 
 
             }
 
             retval.stop = .LT(-1);
 
         }
         catch (RecognitionException re) {
             reportError(re);
             recover(,re);
         }
         finally {
         }
         return retval;
     }
     // $ANTLR end "expr"
 
     public static class primaryExpr_return extends ParserRuleReturnScope {
         public StringTemplate st;
         public Object getTemplate() { return ; }
         public String toString() { return ==null?null:.toString(); }
     };
 
     // $ANTLR start "primaryExpr"
     // src\\main\\antlr\\XPathEnhancer.g:164:1: primaryExpr : ( variableReference | '(' expr ')' | Literal | Number | functionCall );
         retval.start = .LT(1);
 
         try {
             // src\\main\\antlr\\XPathEnhancer.g:165:3: ( variableReference | '(' expr ')' | Literal | Number | functionCall )
             int alt9=5;
             switch ( .LA(1) ) {
             case 44:
                 {
                 alt9=1;
                 }
                 break;
             case :
                 {
                 alt9=2;
                 }
                 break;
             case :
                 {
                 alt9=3;
                 }
                 break;
             case :
                 {
                 alt9=4;
                 }
                 break;
             case :
             case :
                 {
                 alt9=5;
                 }
                 break;
             default:
                 NoViableAltException nvae =
                     new NoViableAltException("", 9, 0, );
 
                 throw nvae;
             }
 
             switch (alt9) {
                 case 1 :
                     // src\\main\\antlr\\XPathEnhancer.g:166:3: variableReference
                     {
                     pushFollow();
                     variableReference();
 
                     .--;
 
 
                     }
                     break;
                 case 2 :
                     // src\\main\\antlr\\XPathEnhancer.g:167:5: '(' expr ')'
                     {
                     match(,,); 
                     pushFollow();
                     expr();
 
                     .--;
 
                     match(,,); 
 
                     }
                     break;
                 case 3 :
                     // src\\main\\antlr\\XPathEnhancer.g:168:5: Literal
                     {
                     match(,,); 
 
                     }
                     break;
                 case 4 :
                     // src\\main\\antlr\\XPathEnhancer.g:169:5: Number
                     {
                     match(,,); 
 
                     }
                     break;
                 case 5 :
                     // src\\main\\antlr\\XPathEnhancer.g:170:5: functionCall
                     {
                     pushFollow();
                     functionCall();
 
                     .--;
 
 
                     }
                     break;
 
             }
             retval.stop = .LT(-1);
 
         }
         catch (RecognitionException re) {
             reportError(re);
             recover(,re);
         }
         finally {
         }
         return retval;
     }
     // $ANTLR end "primaryExpr"
 
     public static class functionCall_return extends ParserRuleReturnScope {
         public StringTemplate st;
         public Object getTemplate() { return ; }
         public String toString() { return ==null?null:.toString(); }
     };
 
     // $ANTLR start "functionCall"
     // src\\main\\antlr\\XPathEnhancer.g:173:1: functionCall : functionName '(' ( expr ( ',' expr )* )? ')' ;
         retval.start = .LT(1);
 
         try {
             // src\\main\\antlr\\XPathEnhancer.g:174:3: ( functionName '(' ( expr ( ',' expr )* )? ')' )
             // src\\main\\antlr\\XPathEnhancer.g:175:3: functionName '(' ( expr ( ',' expr )* )? ')'
             {
             functionName();
 
             .--;
 
             match(,,); 
             // src\\main\\antlr\\XPathEnhancer.g:175:20: ( expr ( ',' expr )* )?
             int alt11=2;
             int LA11_0 = .LA(1);
 
             if ( ((LA11_0>= && LA11_0<=)||LA11_0==||(LA11_0>= && LA11_0<=)||(LA11_0>= && LA11_0<=)||LA11_0==37||LA11_0==44) ) {
                 alt11=1;
             }
             switch (alt11) {
                 case 1 :
                     // src\\main\\antlr\\XPathEnhancer.g:175:21: expr ( ',' expr )*
                     {
                     pushFollow();
                     expr();
 
                     .--;
 
                     // src\\main\\antlr\\XPathEnhancer.g:175:26: ( ',' expr )*
                     loop10:
                     do {
                        int alt10=2;
                        int LA10_0 = .LA(1);
                        if ( (LA10_0==) ) {
                            alt10=1;
                        }
                        switch (alt10) {
                    	case 1 :
                    	    // src\\main\\antlr\\XPathEnhancer.g:175:27: ',' expr
                    	    {
                    	    match(,,); 
                    	    pushFollow();
                    	    expr();
                    	    .--;
                    	    }
                    	    break;
                    	default :
                    	    break loop10;
                        }
                    } while (true);
                    }
                    break;
            }
            }
            retval.stop = .LT(-1);
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(,re);
        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "functionCall"
    public static class unionExprNoRoot_return extends ParserRuleReturnScope {
        public StringTemplate st;
        public Object getTemplate() { return ; }
        public String toString() { return ==null?null:.toString(); }
    };
    // $ANTLR start "unionExprNoRoot"
    // src\\main\\antlr\\XPathEnhancer.g:178:1: unionExprNoRoot : ( pathExprNoRoot ( '|' unionExprNoRoot )? | '/' '|' unionExprNoRoot );
        retval.start = .LT(1);