lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1522767 [4/5] - in /lucene/dev/branches/lucene5207: dev-tools/scripts/ lucene/ lucene/core/src/java/org/apache/lucene/util/ lucene/core/src/test/org/apache/lucene/util/ lucene/expressions/ lucene/expressions/src/ lucene/expressions/src/jav...
Date Fri, 13 Sep 2013 03:11:18 GMT
Added: lucene/dev/branches/lucene5207/lucene/expressions/src/java/org/apache/lucene/expressions/js/JavascriptParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5207/lucene/expressions/src/java/org/apache/lucene/expressions/js/JavascriptParser.java?rev=1522767&view=auto
==============================================================================
--- lucene/dev/branches/lucene5207/lucene/expressions/src/java/org/apache/lucene/expressions/js/JavascriptParser.java (added)
+++ lucene/dev/branches/lucene5207/lucene/expressions/src/java/org/apache/lucene/expressions/js/JavascriptParser.java Fri Sep 13 03:11:17 2013
@@ -0,0 +1,2207 @@
+// ANTLR GENERATED CODE: DO NOT EDIT
+
+package org.apache.lucene.expressions.js;
+    
+import java.text.ParseException;
+
+
+import org.antlr.runtime.*;
+import java.util.Stack;
+import java.util.List;
+import java.util.ArrayList;
+
+import org.antlr.runtime.tree.*;
+
+
+@SuppressWarnings({"all", "warnings", "unchecked", "cast"})
+class JavascriptParser extends Parser {
+    public static final String[] tokenNames = new String[] {
+        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "AT_ADD", "AT_BIT_AND", "AT_BIT_NOT", "AT_BIT_OR", "AT_BIT_SHL", "AT_BIT_SHR", "AT_BIT_SHU", "AT_BIT_XOR", "AT_BOOL_AND", "AT_BOOL_NOT", "AT_BOOL_OR", "AT_CALL", "AT_COLON", "AT_COMMA", "AT_COMP_EQ", "AT_COMP_GT", "AT_COMP_GTE", "AT_COMP_LT", "AT_COMP_LTE", "AT_COMP_NEQ", "AT_COND_QUE", "AT_DIVIDE", "AT_DOT", "AT_LPAREN", "AT_MODULO", "AT_MULTIPLY", "AT_NEGATE", "AT_RPAREN", "AT_SUBTRACT", "DECIMAL", "DECIMALDIGIT", "DECIMALINTEGER", "EXPONENT", "HEX", "HEXDIGIT", "ID", "OCTAL", "OCTALDIGIT", "WS"
+    };
+
+    public static final int EOF=-1;
+    public static final int AT_ADD=4;
+    public static final int AT_BIT_AND=5;
+    public static final int AT_BIT_NOT=6;
+    public static final int AT_BIT_OR=7;
+    public static final int AT_BIT_SHL=8;
+    public static final int AT_BIT_SHR=9;
+    public static final int AT_BIT_SHU=10;
+    public static final int AT_BIT_XOR=11;
+    public static final int AT_BOOL_AND=12;
+    public static final int AT_BOOL_NOT=13;
+    public static final int AT_BOOL_OR=14;
+    public static final int AT_CALL=15;
+    public static final int AT_COLON=16;
+    public static final int AT_COMMA=17;
+    public static final int AT_COMP_EQ=18;
+    public static final int AT_COMP_GT=19;
+    public static final int AT_COMP_GTE=20;
+    public static final int AT_COMP_LT=21;
+    public static final int AT_COMP_LTE=22;
+    public static final int AT_COMP_NEQ=23;
+    public static final int AT_COND_QUE=24;
+    public static final int AT_DIVIDE=25;
+    public static final int AT_DOT=26;
+    public static final int AT_LPAREN=27;
+    public static final int AT_MODULO=28;
+    public static final int AT_MULTIPLY=29;
+    public static final int AT_NEGATE=30;
+    public static final int AT_RPAREN=31;
+    public static final int AT_SUBTRACT=32;
+    public static final int DECIMAL=33;
+    public static final int DECIMALDIGIT=34;
+    public static final int DECIMALINTEGER=35;
+    public static final int EXPONENT=36;
+    public static final int HEX=37;
+    public static final int HEXDIGIT=38;
+    public static final int ID=39;
+    public static final int OCTAL=40;
+    public static final int OCTALDIGIT=41;
+    public static final int WS=42;
+
+    // delegates
+    public Parser[] getDelegates() {
+        return new Parser[] {};
+    }
+
+    // delegators
+
+
+    public JavascriptParser(TokenStream input) {
+        this(input, new RecognizerSharedState());
+    }
+    public JavascriptParser(TokenStream input, RecognizerSharedState state) {
+        super(input, state);
+    }
+
+protected TreeAdaptor adaptor = new CommonTreeAdaptor();
+
+public void setTreeAdaptor(TreeAdaptor adaptor) {
+    this.adaptor = adaptor;
+}
+public TreeAdaptor getTreeAdaptor() {
+    return adaptor;
+}
+    public String[] getTokenNames() { return JavascriptParser.tokenNames; }
+    public String getGrammarFileName() { return "src/java/org/apache/lucene/expressions/js/Javascript.g"; }
+
+
+
+    @Override
+    public void displayRecognitionError(String[] tokenNames, RecognitionException re) {
+        String message;
+
+        if (re.token == null) {
+            message = " unknown error (missing token).";
+        }
+        else if (re instanceof UnwantedTokenException) {
+            message = " extraneous " + getReadableTokenString(re.token)
+                    +  " at position (" + re.charPositionInLine + ").";
+        }
+        else if (re instanceof MissingTokenException) {
+            message = " missing " + getReadableTokenString(re.token)
+                    +  " at position (" + re.charPositionInLine + ").";
+        }
+        else if (re instanceof NoViableAltException) {
+            switch (re.token.getType()) {
+            case EOF:
+                message = " unexpected end of expression.";
+                break;
+            default:
+                message = " invalid sequence of tokens near " + getReadableTokenString(re.token)
+                        +  " at position (" + re.charPositionInLine + ").";
+                break;
+            }
+        }
+        else {
+            message = " unexpected token " + getReadableTokenString(re.token) 
+                    +  " at position (" + re.charPositionInLine + ").";
+        }
+        ParseException parseException = new ParseException(message, re.charPositionInLine);
+        parseException.initCause(re);
+        throw new RuntimeException(parseException);
+    }
+
+    public static String getReadableTokenString(Token token) {
+        if (token == null) {
+            return "unknown token";
+        }
+
+        switch (token.getType()) {
+        case AT_LPAREN:
+            return "open parenthesis '('";
+        case AT_RPAREN:
+            return "close parenthesis ')'";
+        case AT_COMP_LT:
+            return "less than '<'";
+        case AT_COMP_LTE:
+            return "less than or equal '<='";
+        case AT_COMP_GT:
+            return "greater than '>'";
+        case AT_COMP_GTE:
+            return "greater than or equal '>='";
+        case AT_COMP_EQ:
+            return "equal '=='";
+        case AT_NEGATE:
+            return "negate '!='";
+        case AT_BOOL_NOT:
+            return "boolean not '!'";
+        case AT_BOOL_AND:
+            return "boolean and '&&'";
+        case AT_BOOL_OR:
+            return "boolean or '||'";
+        case AT_COND_QUE:
+            return "conditional '?'";
+        case AT_ADD:
+            return "addition '+'";
+        case AT_SUBTRACT:
+            return "subtraction '-'";
+        case AT_MULTIPLY:
+            return "multiplication '*'";
+        case AT_DIVIDE:
+            return "division '/'";
+        case AT_MODULO:
+            return "modulo '%'";
+        case AT_BIT_SHL:
+            return "bit shift left '<<'";
+        case AT_BIT_SHR:
+            return "bit shift right '>>'";
+        case AT_BIT_SHU:
+            return "unsigned bit shift right '>>>'";
+        case AT_BIT_AND:
+            return "bitwise and '&'";
+        case AT_BIT_OR:
+            return "bitwise or '|'";
+        case AT_BIT_XOR:
+            return "bitwise xor '^'";
+        case AT_BIT_NOT:
+            return "bitwise not '~'";
+        case ID:
+            return "identifier '" + token.getText() + "'";
+        case DECIMAL:
+            return "decimal '" + token.getText() + "'";
+        case OCTAL:
+            return "octal '" + token.getText() + "'";
+        case HEX:
+            return "hex '" + token.getText() + "'";
+        case EOF:
+            return "end of expression";
+        default:
+            return "'" + token.getText() + "'";
+        }
+    }
+
+
+
+    public static class expression_return extends ParserRuleReturnScope {
+        CommonTree tree;
+        public Object getTree() { return tree; }
+    };
+
+
+    // $ANTLR start "expression"
+    // src/java/org/apache/lucene/expressions/js/Javascript.g:250:1: expression : conditional EOF !;
+    public final JavascriptParser.expression_return expression() throws RecognitionException {
+        JavascriptParser.expression_return retval = new JavascriptParser.expression_return();
+        retval.start = input.LT(1);
+
+
+        CommonTree root_0 = null;
+
+        Token EOF2=null;
+        JavascriptParser.conditional_return conditional1 =null;
+
+
+        CommonTree EOF2_tree=null;
+
+        try {
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:251:5: ( conditional EOF !)
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:251:7: conditional EOF !
+            {
+            root_0 = (CommonTree)adaptor.nil();
+
+
+            pushFollow(FOLLOW_conditional_in_expression737);
+            conditional1=conditional();
+
+            state._fsp--;
+
+            adaptor.addChild(root_0, conditional1.getTree());
+
+            EOF2=(Token)match(input,EOF,FOLLOW_EOF_in_expression739); 
+
+            }
+
+            retval.stop = input.LT(-1);
+
+
+            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+
+        }
+
+        finally {
+        	// do for sure before leaving
+        }
+        return retval;
+    }
+    // $ANTLR end "expression"
+
+
+    public static class conditional_return extends ParserRuleReturnScope {
+        CommonTree tree;
+        public Object getTree() { return tree; }
+    };
+
+
+    // $ANTLR start "conditional"
+    // src/java/org/apache/lucene/expressions/js/Javascript.g:254:1: conditional : logical_or ( AT_COND_QUE ^ conditional AT_COLON ! conditional )? ;
+    public final JavascriptParser.conditional_return conditional() throws RecognitionException {
+        JavascriptParser.conditional_return retval = new JavascriptParser.conditional_return();
+        retval.start = input.LT(1);
+
+
+        CommonTree root_0 = null;
+
+        Token AT_COND_QUE4=null;
+        Token AT_COLON6=null;
+        JavascriptParser.logical_or_return logical_or3 =null;
+
+        JavascriptParser.conditional_return conditional5 =null;
+
+        JavascriptParser.conditional_return conditional7 =null;
+
+
+        CommonTree AT_COND_QUE4_tree=null;
+        CommonTree AT_COLON6_tree=null;
+
+        try {
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:255:5: ( logical_or ( AT_COND_QUE ^ conditional AT_COLON ! conditional )? )
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:255:7: logical_or ( AT_COND_QUE ^ conditional AT_COLON ! conditional )?
+            {
+            root_0 = (CommonTree)adaptor.nil();
+
+
+            pushFollow(FOLLOW_logical_or_in_conditional757);
+            logical_or3=logical_or();
+
+            state._fsp--;
+
+            adaptor.addChild(root_0, logical_or3.getTree());
+
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:255:18: ( AT_COND_QUE ^ conditional AT_COLON ! conditional )?
+            int alt1=2;
+            int LA1_0 = input.LA(1);
+
+            if ( (LA1_0==AT_COND_QUE) ) {
+                alt1=1;
+            }
+            switch (alt1) {
+                case 1 :
+                    // src/java/org/apache/lucene/expressions/js/Javascript.g:255:19: AT_COND_QUE ^ conditional AT_COLON ! conditional
+                    {
+                    AT_COND_QUE4=(Token)match(input,AT_COND_QUE,FOLLOW_AT_COND_QUE_in_conditional760); 
+                    AT_COND_QUE4_tree = 
+                    (CommonTree)adaptor.create(AT_COND_QUE4)
+                    ;
+                    root_0 = (CommonTree)adaptor.becomeRoot(AT_COND_QUE4_tree, root_0);
+
+
+                    pushFollow(FOLLOW_conditional_in_conditional763);
+                    conditional5=conditional();
+
+                    state._fsp--;
+
+                    adaptor.addChild(root_0, conditional5.getTree());
+
+                    AT_COLON6=(Token)match(input,AT_COLON,FOLLOW_AT_COLON_in_conditional765); 
+
+                    pushFollow(FOLLOW_conditional_in_conditional768);
+                    conditional7=conditional();
+
+                    state._fsp--;
+
+                    adaptor.addChild(root_0, conditional7.getTree());
+
+                    }
+                    break;
+
+            }
+
+
+            }
+
+            retval.stop = input.LT(-1);
+
+
+            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+
+        }
+
+        finally {
+        	// do for sure before leaving
+        }
+        return retval;
+    }
+    // $ANTLR end "conditional"
+
+
+    public static class logical_or_return extends ParserRuleReturnScope {
+        CommonTree tree;
+        public Object getTree() { return tree; }
+    };
+
+
+    // $ANTLR start "logical_or"
+    // src/java/org/apache/lucene/expressions/js/Javascript.g:258:1: logical_or : logical_and ( AT_BOOL_OR ^ logical_and )* ;
+    public final JavascriptParser.logical_or_return logical_or() throws RecognitionException {
+        JavascriptParser.logical_or_return retval = new JavascriptParser.logical_or_return();
+        retval.start = input.LT(1);
+
+
+        CommonTree root_0 = null;
+
+        Token AT_BOOL_OR9=null;
+        JavascriptParser.logical_and_return logical_and8 =null;
+
+        JavascriptParser.logical_and_return logical_and10 =null;
+
+
+        CommonTree AT_BOOL_OR9_tree=null;
+
+        try {
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:259:5: ( logical_and ( AT_BOOL_OR ^ logical_and )* )
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:259:7: logical_and ( AT_BOOL_OR ^ logical_and )*
+            {
+            root_0 = (CommonTree)adaptor.nil();
+
+
+            pushFollow(FOLLOW_logical_and_in_logical_or787);
+            logical_and8=logical_and();
+
+            state._fsp--;
+
+            adaptor.addChild(root_0, logical_and8.getTree());
+
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:259:19: ( AT_BOOL_OR ^ logical_and )*
+            loop2:
+            do {
+                int alt2=2;
+                int LA2_0 = input.LA(1);
+
+                if ( (LA2_0==AT_BOOL_OR) ) {
+                    alt2=1;
+                }
+
+
+                switch (alt2) {
+            	case 1 :
+            	    // src/java/org/apache/lucene/expressions/js/Javascript.g:259:20: AT_BOOL_OR ^ logical_and
+            	    {
+            	    AT_BOOL_OR9=(Token)match(input,AT_BOOL_OR,FOLLOW_AT_BOOL_OR_in_logical_or790); 
+            	    AT_BOOL_OR9_tree = 
+            	    (CommonTree)adaptor.create(AT_BOOL_OR9)
+            	    ;
+            	    root_0 = (CommonTree)adaptor.becomeRoot(AT_BOOL_OR9_tree, root_0);
+
+
+            	    pushFollow(FOLLOW_logical_and_in_logical_or793);
+            	    logical_and10=logical_and();
+
+            	    state._fsp--;
+
+            	    adaptor.addChild(root_0, logical_and10.getTree());
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop2;
+                }
+            } while (true);
+
+
+            }
+
+            retval.stop = input.LT(-1);
+
+
+            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+
+        }
+
+        finally {
+        	// do for sure before leaving
+        }
+        return retval;
+    }
+    // $ANTLR end "logical_or"
+
+
+    public static class logical_and_return extends ParserRuleReturnScope {
+        CommonTree tree;
+        public Object getTree() { return tree; }
+    };
+
+
+    // $ANTLR start "logical_and"
+    // src/java/org/apache/lucene/expressions/js/Javascript.g:262:1: logical_and : bitwise_or ( AT_BOOL_AND ^ bitwise_or )* ;
+    public final JavascriptParser.logical_and_return logical_and() throws RecognitionException {
+        JavascriptParser.logical_and_return retval = new JavascriptParser.logical_and_return();
+        retval.start = input.LT(1);
+
+
+        CommonTree root_0 = null;
+
+        Token AT_BOOL_AND12=null;
+        JavascriptParser.bitwise_or_return bitwise_or11 =null;
+
+        JavascriptParser.bitwise_or_return bitwise_or13 =null;
+
+
+        CommonTree AT_BOOL_AND12_tree=null;
+
+        try {
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:263:5: ( bitwise_or ( AT_BOOL_AND ^ bitwise_or )* )
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:263:7: bitwise_or ( AT_BOOL_AND ^ bitwise_or )*
+            {
+            root_0 = (CommonTree)adaptor.nil();
+
+
+            pushFollow(FOLLOW_bitwise_or_in_logical_and812);
+            bitwise_or11=bitwise_or();
+
+            state._fsp--;
+
+            adaptor.addChild(root_0, bitwise_or11.getTree());
+
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:263:18: ( AT_BOOL_AND ^ bitwise_or )*
+            loop3:
+            do {
+                int alt3=2;
+                int LA3_0 = input.LA(1);
+
+                if ( (LA3_0==AT_BOOL_AND) ) {
+                    alt3=1;
+                }
+
+
+                switch (alt3) {
+            	case 1 :
+            	    // src/java/org/apache/lucene/expressions/js/Javascript.g:263:19: AT_BOOL_AND ^ bitwise_or
+            	    {
+            	    AT_BOOL_AND12=(Token)match(input,AT_BOOL_AND,FOLLOW_AT_BOOL_AND_in_logical_and815); 
+            	    AT_BOOL_AND12_tree = 
+            	    (CommonTree)adaptor.create(AT_BOOL_AND12)
+            	    ;
+            	    root_0 = (CommonTree)adaptor.becomeRoot(AT_BOOL_AND12_tree, root_0);
+
+
+            	    pushFollow(FOLLOW_bitwise_or_in_logical_and818);
+            	    bitwise_or13=bitwise_or();
+
+            	    state._fsp--;
+
+            	    adaptor.addChild(root_0, bitwise_or13.getTree());
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop3;
+                }
+            } while (true);
+
+
+            }
+
+            retval.stop = input.LT(-1);
+
+
+            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+
+        }
+
+        finally {
+        	// do for sure before leaving
+        }
+        return retval;
+    }
+    // $ANTLR end "logical_and"
+
+
+    public static class bitwise_or_return extends ParserRuleReturnScope {
+        CommonTree tree;
+        public Object getTree() { return tree; }
+    };
+
+
+    // $ANTLR start "bitwise_or"
+    // src/java/org/apache/lucene/expressions/js/Javascript.g:266:1: bitwise_or : bitwise_xor ( AT_BIT_OR ^ bitwise_xor )* ;
+    public final JavascriptParser.bitwise_or_return bitwise_or() throws RecognitionException {
+        JavascriptParser.bitwise_or_return retval = new JavascriptParser.bitwise_or_return();
+        retval.start = input.LT(1);
+
+
+        CommonTree root_0 = null;
+
+        Token AT_BIT_OR15=null;
+        JavascriptParser.bitwise_xor_return bitwise_xor14 =null;
+
+        JavascriptParser.bitwise_xor_return bitwise_xor16 =null;
+
+
+        CommonTree AT_BIT_OR15_tree=null;
+
+        try {
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:267:5: ( bitwise_xor ( AT_BIT_OR ^ bitwise_xor )* )
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:267:7: bitwise_xor ( AT_BIT_OR ^ bitwise_xor )*
+            {
+            root_0 = (CommonTree)adaptor.nil();
+
+
+            pushFollow(FOLLOW_bitwise_xor_in_bitwise_or837);
+            bitwise_xor14=bitwise_xor();
+
+            state._fsp--;
+
+            adaptor.addChild(root_0, bitwise_xor14.getTree());
+
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:267:19: ( AT_BIT_OR ^ bitwise_xor )*
+            loop4:
+            do {
+                int alt4=2;
+                int LA4_0 = input.LA(1);
+
+                if ( (LA4_0==AT_BIT_OR) ) {
+                    alt4=1;
+                }
+
+
+                switch (alt4) {
+            	case 1 :
+            	    // src/java/org/apache/lucene/expressions/js/Javascript.g:267:20: AT_BIT_OR ^ bitwise_xor
+            	    {
+            	    AT_BIT_OR15=(Token)match(input,AT_BIT_OR,FOLLOW_AT_BIT_OR_in_bitwise_or840); 
+            	    AT_BIT_OR15_tree = 
+            	    (CommonTree)adaptor.create(AT_BIT_OR15)
+            	    ;
+            	    root_0 = (CommonTree)adaptor.becomeRoot(AT_BIT_OR15_tree, root_0);
+
+
+            	    pushFollow(FOLLOW_bitwise_xor_in_bitwise_or843);
+            	    bitwise_xor16=bitwise_xor();
+
+            	    state._fsp--;
+
+            	    adaptor.addChild(root_0, bitwise_xor16.getTree());
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop4;
+                }
+            } while (true);
+
+
+            }
+
+            retval.stop = input.LT(-1);
+
+
+            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+
+        }
+
+        finally {
+        	// do for sure before leaving
+        }
+        return retval;
+    }
+    // $ANTLR end "bitwise_or"
+
+
+    public static class bitwise_xor_return extends ParserRuleReturnScope {
+        CommonTree tree;
+        public Object getTree() { return tree; }
+    };
+
+
+    // $ANTLR start "bitwise_xor"
+    // src/java/org/apache/lucene/expressions/js/Javascript.g:270:1: bitwise_xor : bitwise_and ( AT_BIT_XOR ^ bitwise_and )* ;
+    public final JavascriptParser.bitwise_xor_return bitwise_xor() throws RecognitionException {
+        JavascriptParser.bitwise_xor_return retval = new JavascriptParser.bitwise_xor_return();
+        retval.start = input.LT(1);
+
+
+        CommonTree root_0 = null;
+
+        Token AT_BIT_XOR18=null;
+        JavascriptParser.bitwise_and_return bitwise_and17 =null;
+
+        JavascriptParser.bitwise_and_return bitwise_and19 =null;
+
+
+        CommonTree AT_BIT_XOR18_tree=null;
+
+        try {
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:271:5: ( bitwise_and ( AT_BIT_XOR ^ bitwise_and )* )
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:271:7: bitwise_and ( AT_BIT_XOR ^ bitwise_and )*
+            {
+            root_0 = (CommonTree)adaptor.nil();
+
+
+            pushFollow(FOLLOW_bitwise_and_in_bitwise_xor862);
+            bitwise_and17=bitwise_and();
+
+            state._fsp--;
+
+            adaptor.addChild(root_0, bitwise_and17.getTree());
+
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:271:19: ( AT_BIT_XOR ^ bitwise_and )*
+            loop5:
+            do {
+                int alt5=2;
+                int LA5_0 = input.LA(1);
+
+                if ( (LA5_0==AT_BIT_XOR) ) {
+                    alt5=1;
+                }
+
+
+                switch (alt5) {
+            	case 1 :
+            	    // src/java/org/apache/lucene/expressions/js/Javascript.g:271:20: AT_BIT_XOR ^ bitwise_and
+            	    {
+            	    AT_BIT_XOR18=(Token)match(input,AT_BIT_XOR,FOLLOW_AT_BIT_XOR_in_bitwise_xor865); 
+            	    AT_BIT_XOR18_tree = 
+            	    (CommonTree)adaptor.create(AT_BIT_XOR18)
+            	    ;
+            	    root_0 = (CommonTree)adaptor.becomeRoot(AT_BIT_XOR18_tree, root_0);
+
+
+            	    pushFollow(FOLLOW_bitwise_and_in_bitwise_xor868);
+            	    bitwise_and19=bitwise_and();
+
+            	    state._fsp--;
+
+            	    adaptor.addChild(root_0, bitwise_and19.getTree());
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop5;
+                }
+            } while (true);
+
+
+            }
+
+            retval.stop = input.LT(-1);
+
+
+            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+
+        }
+
+        finally {
+        	// do for sure before leaving
+        }
+        return retval;
+    }
+    // $ANTLR end "bitwise_xor"
+
+
+    public static class bitwise_and_return extends ParserRuleReturnScope {
+        CommonTree tree;
+        public Object getTree() { return tree; }
+    };
+
+
+    // $ANTLR start "bitwise_and"
+    // src/java/org/apache/lucene/expressions/js/Javascript.g:274:1: bitwise_and : equality ( AT_BIT_AND ^ equality )* ;
+    public final JavascriptParser.bitwise_and_return bitwise_and() throws RecognitionException {
+        JavascriptParser.bitwise_and_return retval = new JavascriptParser.bitwise_and_return();
+        retval.start = input.LT(1);
+
+
+        CommonTree root_0 = null;
+
+        Token AT_BIT_AND21=null;
+        JavascriptParser.equality_return equality20 =null;
+
+        JavascriptParser.equality_return equality22 =null;
+
+
+        CommonTree AT_BIT_AND21_tree=null;
+
+        try {
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:275:5: ( equality ( AT_BIT_AND ^ equality )* )
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:275:8: equality ( AT_BIT_AND ^ equality )*
+            {
+            root_0 = (CommonTree)adaptor.nil();
+
+
+            pushFollow(FOLLOW_equality_in_bitwise_and888);
+            equality20=equality();
+
+            state._fsp--;
+
+            adaptor.addChild(root_0, equality20.getTree());
+
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:275:17: ( AT_BIT_AND ^ equality )*
+            loop6:
+            do {
+                int alt6=2;
+                int LA6_0 = input.LA(1);
+
+                if ( (LA6_0==AT_BIT_AND) ) {
+                    alt6=1;
+                }
+
+
+                switch (alt6) {
+            	case 1 :
+            	    // src/java/org/apache/lucene/expressions/js/Javascript.g:275:18: AT_BIT_AND ^ equality
+            	    {
+            	    AT_BIT_AND21=(Token)match(input,AT_BIT_AND,FOLLOW_AT_BIT_AND_in_bitwise_and891); 
+            	    AT_BIT_AND21_tree = 
+            	    (CommonTree)adaptor.create(AT_BIT_AND21)
+            	    ;
+            	    root_0 = (CommonTree)adaptor.becomeRoot(AT_BIT_AND21_tree, root_0);
+
+
+            	    pushFollow(FOLLOW_equality_in_bitwise_and894);
+            	    equality22=equality();
+
+            	    state._fsp--;
+
+            	    adaptor.addChild(root_0, equality22.getTree());
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop6;
+                }
+            } while (true);
+
+
+            }
+
+            retval.stop = input.LT(-1);
+
+
+            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+
+        }
+
+        finally {
+        	// do for sure before leaving
+        }
+        return retval;
+    }
+    // $ANTLR end "bitwise_and"
+
+
+    public static class equality_return extends ParserRuleReturnScope {
+        CommonTree tree;
+        public Object getTree() { return tree; }
+    };
+
+
+    // $ANTLR start "equality"
+    // src/java/org/apache/lucene/expressions/js/Javascript.g:278:1: equality : relational ( ( AT_COMP_EQ | AT_COMP_NEQ ) ^ relational )* ;
+    public final JavascriptParser.equality_return equality() throws RecognitionException {
+        JavascriptParser.equality_return retval = new JavascriptParser.equality_return();
+        retval.start = input.LT(1);
+
+
+        CommonTree root_0 = null;
+
+        Token set24=null;
+        JavascriptParser.relational_return relational23 =null;
+
+        JavascriptParser.relational_return relational25 =null;
+
+
+        CommonTree set24_tree=null;
+
+        try {
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:279:5: ( relational ( ( AT_COMP_EQ | AT_COMP_NEQ ) ^ relational )* )
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:279:7: relational ( ( AT_COMP_EQ | AT_COMP_NEQ ) ^ relational )*
+            {
+            root_0 = (CommonTree)adaptor.nil();
+
+
+            pushFollow(FOLLOW_relational_in_equality913);
+            relational23=relational();
+
+            state._fsp--;
+
+            adaptor.addChild(root_0, relational23.getTree());
+
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:279:18: ( ( AT_COMP_EQ | AT_COMP_NEQ ) ^ relational )*
+            loop7:
+            do {
+                int alt7=2;
+                int LA7_0 = input.LA(1);
+
+                if ( (LA7_0==AT_COMP_EQ||LA7_0==AT_COMP_NEQ) ) {
+                    alt7=1;
+                }
+
+
+                switch (alt7) {
+            	case 1 :
+            	    // src/java/org/apache/lucene/expressions/js/Javascript.g:279:19: ( AT_COMP_EQ | AT_COMP_NEQ ) ^ relational
+            	    {
+            	    set24=(Token)input.LT(1);
+
+            	    set24=(Token)input.LT(1);
+
+            	    if ( input.LA(1)==AT_COMP_EQ||input.LA(1)==AT_COMP_NEQ ) {
+            	        input.consume();
+            	        root_0 = (CommonTree)adaptor.becomeRoot(
+            	        (CommonTree)adaptor.create(set24)
+            	        , root_0);
+            	        state.errorRecovery=false;
+            	    }
+            	    else {
+            	        MismatchedSetException mse = new MismatchedSetException(null,input);
+            	        throw mse;
+            	    }
+
+
+            	    pushFollow(FOLLOW_relational_in_equality925);
+            	    relational25=relational();
+
+            	    state._fsp--;
+
+            	    adaptor.addChild(root_0, relational25.getTree());
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop7;
+                }
+            } while (true);
+
+
+            }
+
+            retval.stop = input.LT(-1);
+
+
+            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+
+        }
+
+        finally {
+        	// do for sure before leaving
+        }
+        return retval;
+    }
+    // $ANTLR end "equality"
+
+
+    public static class relational_return extends ParserRuleReturnScope {
+        CommonTree tree;
+        public Object getTree() { return tree; }
+    };
+
+
+    // $ANTLR start "relational"
+    // src/java/org/apache/lucene/expressions/js/Javascript.g:282:1: relational : shift ( ( AT_COMP_LT | AT_COMP_GT | AT_COMP_LTE | AT_COMP_GTE ) ^ shift )* ;
+    public final JavascriptParser.relational_return relational() throws RecognitionException {
+        JavascriptParser.relational_return retval = new JavascriptParser.relational_return();
+        retval.start = input.LT(1);
+
+
+        CommonTree root_0 = null;
+
+        Token set27=null;
+        JavascriptParser.shift_return shift26 =null;
+
+        JavascriptParser.shift_return shift28 =null;
+
+
+        CommonTree set27_tree=null;
+
+        try {
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:283:5: ( shift ( ( AT_COMP_LT | AT_COMP_GT | AT_COMP_LTE | AT_COMP_GTE ) ^ shift )* )
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:283:7: shift ( ( AT_COMP_LT | AT_COMP_GT | AT_COMP_LTE | AT_COMP_GTE ) ^ shift )*
+            {
+            root_0 = (CommonTree)adaptor.nil();
+
+
+            pushFollow(FOLLOW_shift_in_relational944);
+            shift26=shift();
+
+            state._fsp--;
+
+            adaptor.addChild(root_0, shift26.getTree());
+
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:283:13: ( ( AT_COMP_LT | AT_COMP_GT | AT_COMP_LTE | AT_COMP_GTE ) ^ shift )*
+            loop8:
+            do {
+                int alt8=2;
+                int LA8_0 = input.LA(1);
+
+                if ( ((LA8_0 >= AT_COMP_GT && LA8_0 <= AT_COMP_LTE)) ) {
+                    alt8=1;
+                }
+
+
+                switch (alt8) {
+            	case 1 :
+            	    // src/java/org/apache/lucene/expressions/js/Javascript.g:283:14: ( AT_COMP_LT | AT_COMP_GT | AT_COMP_LTE | AT_COMP_GTE ) ^ shift
+            	    {
+            	    set27=(Token)input.LT(1);
+
+            	    set27=(Token)input.LT(1);
+
+            	    if ( (input.LA(1) >= AT_COMP_GT && input.LA(1) <= AT_COMP_LTE) ) {
+            	        input.consume();
+            	        root_0 = (CommonTree)adaptor.becomeRoot(
+            	        (CommonTree)adaptor.create(set27)
+            	        , root_0);
+            	        state.errorRecovery=false;
+            	    }
+            	    else {
+            	        MismatchedSetException mse = new MismatchedSetException(null,input);
+            	        throw mse;
+            	    }
+
+
+            	    pushFollow(FOLLOW_shift_in_relational964);
+            	    shift28=shift();
+
+            	    state._fsp--;
+
+            	    adaptor.addChild(root_0, shift28.getTree());
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop8;
+                }
+            } while (true);
+
+
+            }
+
+            retval.stop = input.LT(-1);
+
+
+            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+
+        }
+
+        finally {
+        	// do for sure before leaving
+        }
+        return retval;
+    }
+    // $ANTLR end "relational"
+
+
+    public static class shift_return extends ParserRuleReturnScope {
+        CommonTree tree;
+        public Object getTree() { return tree; }
+    };
+
+
+    // $ANTLR start "shift"
+    // src/java/org/apache/lucene/expressions/js/Javascript.g:286:1: shift : additive ( ( AT_BIT_SHL | AT_BIT_SHR | AT_BIT_SHU ) ^ additive )* ;
+    public final JavascriptParser.shift_return shift() throws RecognitionException {
+        JavascriptParser.shift_return retval = new JavascriptParser.shift_return();
+        retval.start = input.LT(1);
+
+
+        CommonTree root_0 = null;
+
+        Token set30=null;
+        JavascriptParser.additive_return additive29 =null;
+
+        JavascriptParser.additive_return additive31 =null;
+
+
+        CommonTree set30_tree=null;
+
+        try {
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:287:5: ( additive ( ( AT_BIT_SHL | AT_BIT_SHR | AT_BIT_SHU ) ^ additive )* )
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:287:7: additive ( ( AT_BIT_SHL | AT_BIT_SHR | AT_BIT_SHU ) ^ additive )*
+            {
+            root_0 = (CommonTree)adaptor.nil();
+
+
+            pushFollow(FOLLOW_additive_in_shift983);
+            additive29=additive();
+
+            state._fsp--;
+
+            adaptor.addChild(root_0, additive29.getTree());
+
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:287:16: ( ( AT_BIT_SHL | AT_BIT_SHR | AT_BIT_SHU ) ^ additive )*
+            loop9:
+            do {
+                int alt9=2;
+                int LA9_0 = input.LA(1);
+
+                if ( ((LA9_0 >= AT_BIT_SHL && LA9_0 <= AT_BIT_SHU)) ) {
+                    alt9=1;
+                }
+
+
+                switch (alt9) {
+            	case 1 :
+            	    // src/java/org/apache/lucene/expressions/js/Javascript.g:287:17: ( AT_BIT_SHL | AT_BIT_SHR | AT_BIT_SHU ) ^ additive
+            	    {
+            	    set30=(Token)input.LT(1);
+
+            	    set30=(Token)input.LT(1);
+
+            	    if ( (input.LA(1) >= AT_BIT_SHL && input.LA(1) <= AT_BIT_SHU) ) {
+            	        input.consume();
+            	        root_0 = (CommonTree)adaptor.becomeRoot(
+            	        (CommonTree)adaptor.create(set30)
+            	        , root_0);
+            	        state.errorRecovery=false;
+            	    }
+            	    else {
+            	        MismatchedSetException mse = new MismatchedSetException(null,input);
+            	        throw mse;
+            	    }
+
+
+            	    pushFollow(FOLLOW_additive_in_shift999);
+            	    additive31=additive();
+
+            	    state._fsp--;
+
+            	    adaptor.addChild(root_0, additive31.getTree());
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop9;
+                }
+            } while (true);
+
+
+            }
+
+            retval.stop = input.LT(-1);
+
+
+            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+
+        }
+
+        finally {
+        	// do for sure before leaving
+        }
+        return retval;
+    }
+    // $ANTLR end "shift"
+
+
+    public static class additive_return extends ParserRuleReturnScope {
+        CommonTree tree;
+        public Object getTree() { return tree; }
+    };
+
+
+    // $ANTLR start "additive"
+    // src/java/org/apache/lucene/expressions/js/Javascript.g:290:1: additive : multiplicative ( ( AT_ADD | AT_SUBTRACT ) ^ multiplicative )* ;
+    public final JavascriptParser.additive_return additive() throws RecognitionException {
+        JavascriptParser.additive_return retval = new JavascriptParser.additive_return();
+        retval.start = input.LT(1);
+
+
+        CommonTree root_0 = null;
+
+        Token set33=null;
+        JavascriptParser.multiplicative_return multiplicative32 =null;
+
+        JavascriptParser.multiplicative_return multiplicative34 =null;
+
+
+        CommonTree set33_tree=null;
+
+        try {
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:291:5: ( multiplicative ( ( AT_ADD | AT_SUBTRACT ) ^ multiplicative )* )
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:291:7: multiplicative ( ( AT_ADD | AT_SUBTRACT ) ^ multiplicative )*
+            {
+            root_0 = (CommonTree)adaptor.nil();
+
+
+            pushFollow(FOLLOW_multiplicative_in_additive1018);
+            multiplicative32=multiplicative();
+
+            state._fsp--;
+
+            adaptor.addChild(root_0, multiplicative32.getTree());
+
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:291:22: ( ( AT_ADD | AT_SUBTRACT ) ^ multiplicative )*
+            loop10:
+            do {
+                int alt10=2;
+                int LA10_0 = input.LA(1);
+
+                if ( (LA10_0==AT_ADD||LA10_0==AT_SUBTRACT) ) {
+                    alt10=1;
+                }
+
+
+                switch (alt10) {
+            	case 1 :
+            	    // src/java/org/apache/lucene/expressions/js/Javascript.g:291:23: ( AT_ADD | AT_SUBTRACT ) ^ multiplicative
+            	    {
+            	    set33=(Token)input.LT(1);
+
+            	    set33=(Token)input.LT(1);
+
+            	    if ( input.LA(1)==AT_ADD||input.LA(1)==AT_SUBTRACT ) {
+            	        input.consume();
+            	        root_0 = (CommonTree)adaptor.becomeRoot(
+            	        (CommonTree)adaptor.create(set33)
+            	        , root_0);
+            	        state.errorRecovery=false;
+            	    }
+            	    else {
+            	        MismatchedSetException mse = new MismatchedSetException(null,input);
+            	        throw mse;
+            	    }
+
+
+            	    pushFollow(FOLLOW_multiplicative_in_additive1030);
+            	    multiplicative34=multiplicative();
+
+            	    state._fsp--;
+
+            	    adaptor.addChild(root_0, multiplicative34.getTree());
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop10;
+                }
+            } while (true);
+
+
+            }
+
+            retval.stop = input.LT(-1);
+
+
+            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+
+        }
+
+        finally {
+        	// do for sure before leaving
+        }
+        return retval;
+    }
+    // $ANTLR end "additive"
+
+
+    public static class multiplicative_return extends ParserRuleReturnScope {
+        CommonTree tree;
+        public Object getTree() { return tree; }
+    };
+
+
+    // $ANTLR start "multiplicative"
+    // src/java/org/apache/lucene/expressions/js/Javascript.g:294:1: multiplicative : unary ( ( AT_MULTIPLY | AT_DIVIDE | AT_MODULO ) ^ unary )* ;
+    public final JavascriptParser.multiplicative_return multiplicative() throws RecognitionException {
+        JavascriptParser.multiplicative_return retval = new JavascriptParser.multiplicative_return();
+        retval.start = input.LT(1);
+
+
+        CommonTree root_0 = null;
+
+        Token set36=null;
+        JavascriptParser.unary_return unary35 =null;
+
+        JavascriptParser.unary_return unary37 =null;
+
+
+        CommonTree set36_tree=null;
+
+        try {
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:295:5: ( unary ( ( AT_MULTIPLY | AT_DIVIDE | AT_MODULO ) ^ unary )* )
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:295:7: unary ( ( AT_MULTIPLY | AT_DIVIDE | AT_MODULO ) ^ unary )*
+            {
+            root_0 = (CommonTree)adaptor.nil();
+
+
+            pushFollow(FOLLOW_unary_in_multiplicative1049);
+            unary35=unary();
+
+            state._fsp--;
+
+            adaptor.addChild(root_0, unary35.getTree());
+
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:295:13: ( ( AT_MULTIPLY | AT_DIVIDE | AT_MODULO ) ^ unary )*
+            loop11:
+            do {
+                int alt11=2;
+                int LA11_0 = input.LA(1);
+
+                if ( (LA11_0==AT_DIVIDE||(LA11_0 >= AT_MODULO && LA11_0 <= AT_MULTIPLY)) ) {
+                    alt11=1;
+                }
+
+
+                switch (alt11) {
+            	case 1 :
+            	    // src/java/org/apache/lucene/expressions/js/Javascript.g:295:14: ( AT_MULTIPLY | AT_DIVIDE | AT_MODULO ) ^ unary
+            	    {
+            	    set36=(Token)input.LT(1);
+
+            	    set36=(Token)input.LT(1);
+
+            	    if ( input.LA(1)==AT_DIVIDE||(input.LA(1) >= AT_MODULO && input.LA(1) <= AT_MULTIPLY) ) {
+            	        input.consume();
+            	        root_0 = (CommonTree)adaptor.becomeRoot(
+            	        (CommonTree)adaptor.create(set36)
+            	        , root_0);
+            	        state.errorRecovery=false;
+            	    }
+            	    else {
+            	        MismatchedSetException mse = new MismatchedSetException(null,input);
+            	        throw mse;
+            	    }
+
+
+            	    pushFollow(FOLLOW_unary_in_multiplicative1065);
+            	    unary37=unary();
+
+            	    state._fsp--;
+
+            	    adaptor.addChild(root_0, unary37.getTree());
+
+            	    }
+            	    break;
+
+            	default :
+            	    break loop11;
+                }
+            } while (true);
+
+
+            }
+
+            retval.stop = input.LT(-1);
+
+
+            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+
+        }
+
+        finally {
+        	// do for sure before leaving
+        }
+        return retval;
+    }
+    // $ANTLR end "multiplicative"
+
+
+    public static class unary_return extends ParserRuleReturnScope {
+        CommonTree tree;
+        public Object getTree() { return tree; }
+    };
+
+
+    // $ANTLR start "unary"
+    // src/java/org/apache/lucene/expressions/js/Javascript.g:298:1: unary : ( postfix | AT_ADD ! unary | unary_operator ^ unary );
+    public final JavascriptParser.unary_return unary() throws RecognitionException {
+        JavascriptParser.unary_return retval = new JavascriptParser.unary_return();
+        retval.start = input.LT(1);
+
+
+        CommonTree root_0 = null;
+
+        Token AT_ADD39=null;
+        JavascriptParser.postfix_return postfix38 =null;
+
+        JavascriptParser.unary_return unary40 =null;
+
+        JavascriptParser.unary_operator_return unary_operator41 =null;
+
+        JavascriptParser.unary_return unary42 =null;
+
+
+        CommonTree AT_ADD39_tree=null;
+
+        try {
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:299:5: ( postfix | AT_ADD ! unary | unary_operator ^ unary )
+            int alt12=3;
+            switch ( input.LA(1) ) {
+            case AT_LPAREN:
+            case DECIMAL:
+            case HEX:
+            case ID:
+            case OCTAL:
+                {
+                alt12=1;
+                }
+                break;
+            case AT_ADD:
+                {
+                alt12=2;
+                }
+                break;
+            case AT_BIT_NOT:
+            case AT_BOOL_NOT:
+            case AT_SUBTRACT:
+                {
+                alt12=3;
+                }
+                break;
+            default:
+                NoViableAltException nvae =
+                    new NoViableAltException("", 12, 0, input);
+
+                throw nvae;
+
+            }
+
+            switch (alt12) {
+                case 1 :
+                    // src/java/org/apache/lucene/expressions/js/Javascript.g:299:7: postfix
+                    {
+                    root_0 = (CommonTree)adaptor.nil();
+
+
+                    pushFollow(FOLLOW_postfix_in_unary1084);
+                    postfix38=postfix();
+
+                    state._fsp--;
+
+                    adaptor.addChild(root_0, postfix38.getTree());
+
+                    }
+                    break;
+                case 2 :
+                    // src/java/org/apache/lucene/expressions/js/Javascript.g:300:7: AT_ADD ! unary
+                    {
+                    root_0 = (CommonTree)adaptor.nil();
+
+
+                    AT_ADD39=(Token)match(input,AT_ADD,FOLLOW_AT_ADD_in_unary1092); 
+
+                    pushFollow(FOLLOW_unary_in_unary1095);
+                    unary40=unary();
+
+                    state._fsp--;
+
+                    adaptor.addChild(root_0, unary40.getTree());
+
+                    }
+                    break;
+                case 3 :
+                    // src/java/org/apache/lucene/expressions/js/Javascript.g:301:7: unary_operator ^ unary
+                    {
+                    root_0 = (CommonTree)adaptor.nil();
+
+
+                    pushFollow(FOLLOW_unary_operator_in_unary1103);
+                    unary_operator41=unary_operator();
+
+                    state._fsp--;
+
+                    root_0 = (CommonTree)adaptor.becomeRoot(unary_operator41.getTree(), root_0);
+
+                    pushFollow(FOLLOW_unary_in_unary1106);
+                    unary42=unary();
+
+                    state._fsp--;
+
+                    adaptor.addChild(root_0, unary42.getTree());
+
+                    }
+                    break;
+
+            }
+            retval.stop = input.LT(-1);
+
+
+            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+
+        }
+
+        finally {
+        	// do for sure before leaving
+        }
+        return retval;
+    }
+    // $ANTLR end "unary"
+
+
+    public static class unary_operator_return extends ParserRuleReturnScope {
+        CommonTree tree;
+        public Object getTree() { return tree; }
+    };
+
+
+    // $ANTLR start "unary_operator"
+    // src/java/org/apache/lucene/expressions/js/Javascript.g:304:1: unary_operator : ( AT_SUBTRACT -> AT_NEGATE | AT_BIT_NOT | AT_BOOL_NOT );
+    public final JavascriptParser.unary_operator_return unary_operator() throws RecognitionException {
+        JavascriptParser.unary_operator_return retval = new JavascriptParser.unary_operator_return();
+        retval.start = input.LT(1);
+
+
+        CommonTree root_0 = null;
+
+        Token AT_SUBTRACT43=null;
+        Token AT_BIT_NOT44=null;
+        Token AT_BOOL_NOT45=null;
+
+        CommonTree AT_SUBTRACT43_tree=null;
+        CommonTree AT_BIT_NOT44_tree=null;
+        CommonTree AT_BOOL_NOT45_tree=null;
+        RewriteRuleTokenStream stream_AT_SUBTRACT=new RewriteRuleTokenStream(adaptor,"token AT_SUBTRACT");
+
+        try {
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:305:5: ( AT_SUBTRACT -> AT_NEGATE | AT_BIT_NOT | AT_BOOL_NOT )
+            int alt13=3;
+            switch ( input.LA(1) ) {
+            case AT_SUBTRACT:
+                {
+                alt13=1;
+                }
+                break;
+            case AT_BIT_NOT:
+                {
+                alt13=2;
+                }
+                break;
+            case AT_BOOL_NOT:
+                {
+                alt13=3;
+                }
+                break;
+            default:
+                NoViableAltException nvae =
+                    new NoViableAltException("", 13, 0, input);
+
+                throw nvae;
+
+            }
+
+            switch (alt13) {
+                case 1 :
+                    // src/java/org/apache/lucene/expressions/js/Javascript.g:305:7: AT_SUBTRACT
+                    {
+                    AT_SUBTRACT43=(Token)match(input,AT_SUBTRACT,FOLLOW_AT_SUBTRACT_in_unary_operator1123);  
+                    stream_AT_SUBTRACT.add(AT_SUBTRACT43);
+
+
+                    // AST REWRITE
+                    // elements: 
+                    // token labels: 
+                    // rule labels: retval
+                    // token list labels: 
+                    // rule list labels: 
+                    // wildcard labels: 
+                    retval.tree = root_0;
+                    RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
+
+                    root_0 = (CommonTree)adaptor.nil();
+                    // 305:19: -> AT_NEGATE
+                    {
+                        adaptor.addChild(root_0, 
+                        (CommonTree)adaptor.create(AT_NEGATE, "AT_NEGATE")
+                        );
+
+                    }
+
+
+                    retval.tree = root_0;
+
+                    }
+                    break;
+                case 2 :
+                    // src/java/org/apache/lucene/expressions/js/Javascript.g:306:7: AT_BIT_NOT
+                    {
+                    root_0 = (CommonTree)adaptor.nil();
+
+
+                    AT_BIT_NOT44=(Token)match(input,AT_BIT_NOT,FOLLOW_AT_BIT_NOT_in_unary_operator1135); 
+                    AT_BIT_NOT44_tree = 
+                    (CommonTree)adaptor.create(AT_BIT_NOT44)
+                    ;
+                    adaptor.addChild(root_0, AT_BIT_NOT44_tree);
+
+
+                    }
+                    break;
+                case 3 :
+                    // src/java/org/apache/lucene/expressions/js/Javascript.g:307:7: AT_BOOL_NOT
+                    {
+                    root_0 = (CommonTree)adaptor.nil();
+
+
+                    AT_BOOL_NOT45=(Token)match(input,AT_BOOL_NOT,FOLLOW_AT_BOOL_NOT_in_unary_operator1143); 
+                    AT_BOOL_NOT45_tree = 
+                    (CommonTree)adaptor.create(AT_BOOL_NOT45)
+                    ;
+                    adaptor.addChild(root_0, AT_BOOL_NOT45_tree);
+
+
+                    }
+                    break;
+
+            }
+            retval.stop = input.LT(-1);
+
+
+            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+
+        }
+
+        finally {
+        	// do for sure before leaving
+        }
+        return retval;
+    }
+    // $ANTLR end "unary_operator"
+
+
+    public static class postfix_return extends ParserRuleReturnScope {
+        CommonTree tree;
+        public Object getTree() { return tree; }
+    };
+
+
+    // $ANTLR start "postfix"
+    // src/java/org/apache/lucene/expressions/js/Javascript.g:310:1: postfix : ( primary | ID arguments -> ^( AT_CALL ID ( arguments )? ) );
+    public final JavascriptParser.postfix_return postfix() throws RecognitionException {
+        JavascriptParser.postfix_return retval = new JavascriptParser.postfix_return();
+        retval.start = input.LT(1);
+
+
+        CommonTree root_0 = null;
+
+        Token ID47=null;
+        JavascriptParser.primary_return primary46 =null;
+
+        JavascriptParser.arguments_return arguments48 =null;
+
+
+        CommonTree ID47_tree=null;
+        RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID");
+        RewriteRuleSubtreeStream stream_arguments=new RewriteRuleSubtreeStream(adaptor,"rule arguments");
+        try {
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:311:5: ( primary | ID arguments -> ^( AT_CALL ID ( arguments )? ) )
+            int alt14=2;
+            int LA14_0 = input.LA(1);
+
+            if ( (LA14_0==ID) ) {
+                int LA14_1 = input.LA(2);
+
+                if ( (LA14_1==EOF||(LA14_1 >= AT_ADD && LA14_1 <= AT_BIT_AND)||(LA14_1 >= AT_BIT_OR && LA14_1 <= AT_BOOL_AND)||LA14_1==AT_BOOL_OR||(LA14_1 >= AT_COLON && LA14_1 <= AT_DIVIDE)||(LA14_1 >= AT_MODULO && LA14_1 <= AT_MULTIPLY)||(LA14_1 >= AT_RPAREN && LA14_1 <= AT_SUBTRACT)) ) {
+                    alt14=1;
+                }
+                else if ( (LA14_1==AT_LPAREN) ) {
+                    alt14=2;
+                }
+                else {
+                    NoViableAltException nvae =
+                        new NoViableAltException("", 14, 1, input);
+
+                    throw nvae;
+
+                }
+            }
+            else if ( (LA14_0==AT_LPAREN||LA14_0==DECIMAL||LA14_0==HEX||LA14_0==OCTAL) ) {
+                alt14=1;
+            }
+            else {
+                NoViableAltException nvae =
+                    new NoViableAltException("", 14, 0, input);
+
+                throw nvae;
+
+            }
+            switch (alt14) {
+                case 1 :
+                    // src/java/org/apache/lucene/expressions/js/Javascript.g:311:7: primary
+                    {
+                    root_0 = (CommonTree)adaptor.nil();
+
+
+                    pushFollow(FOLLOW_primary_in_postfix1160);
+                    primary46=primary();
+
+                    state._fsp--;
+
+                    adaptor.addChild(root_0, primary46.getTree());
+
+                    }
+                    break;
+                case 2 :
+                    // src/java/org/apache/lucene/expressions/js/Javascript.g:312:7: ID arguments
+                    {
+                    ID47=(Token)match(input,ID,FOLLOW_ID_in_postfix1168);  
+                    stream_ID.add(ID47);
+
+
+                    pushFollow(FOLLOW_arguments_in_postfix1170);
+                    arguments48=arguments();
+
+                    state._fsp--;
+
+                    stream_arguments.add(arguments48.getTree());
+
+                    // AST REWRITE
+                    // elements: arguments, ID
+                    // token labels: 
+                    // rule labels: retval
+                    // token list labels: 
+                    // rule list labels: 
+                    // wildcard labels: 
+                    retval.tree = root_0;
+                    RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
+
+                    root_0 = (CommonTree)adaptor.nil();
+                    // 312:20: -> ^( AT_CALL ID ( arguments )? )
+                    {
+                        // src/java/org/apache/lucene/expressions/js/Javascript.g:312:23: ^( AT_CALL ID ( arguments )? )
+                        {
+                        CommonTree root_1 = (CommonTree)adaptor.nil();
+                        root_1 = (CommonTree)adaptor.becomeRoot(
+                        (CommonTree)adaptor.create(AT_CALL, "AT_CALL")
+                        , root_1);
+
+                        adaptor.addChild(root_1, 
+                        stream_ID.nextNode()
+                        );
+
+                        // src/java/org/apache/lucene/expressions/js/Javascript.g:312:36: ( arguments )?
+                        if ( stream_arguments.hasNext() ) {
+                            adaptor.addChild(root_1, stream_arguments.nextTree());
+
+                        }
+                        stream_arguments.reset();
+
+                        adaptor.addChild(root_0, root_1);
+                        }
+
+                    }
+
+
+                    retval.tree = root_0;
+
+                    }
+                    break;
+
+            }
+            retval.stop = input.LT(-1);
+
+
+            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+
+        }
+
+        finally {
+        	// do for sure before leaving
+        }
+        return retval;
+    }
+    // $ANTLR end "postfix"
+
+
+    public static class primary_return extends ParserRuleReturnScope {
+        CommonTree tree;
+        public Object getTree() { return tree; }
+    };
+
+
+    // $ANTLR start "primary"
+    // src/java/org/apache/lucene/expressions/js/Javascript.g:315:1: primary : ( ID | numeric | AT_LPAREN ! conditional AT_RPAREN !);
+    public final JavascriptParser.primary_return primary() throws RecognitionException {
+        JavascriptParser.primary_return retval = new JavascriptParser.primary_return();
+        retval.start = input.LT(1);
+
+
+        CommonTree root_0 = null;
+
+        Token ID49=null;
+        Token AT_LPAREN51=null;
+        Token AT_RPAREN53=null;
+        JavascriptParser.numeric_return numeric50 =null;
+
+        JavascriptParser.conditional_return conditional52 =null;
+
+
+        CommonTree ID49_tree=null;
+        CommonTree AT_LPAREN51_tree=null;
+        CommonTree AT_RPAREN53_tree=null;
+
+        try {
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:316:5: ( ID | numeric | AT_LPAREN ! conditional AT_RPAREN !)
+            int alt15=3;
+            switch ( input.LA(1) ) {
+            case ID:
+                {
+                alt15=1;
+                }
+                break;
+            case DECIMAL:
+            case HEX:
+            case OCTAL:
+                {
+                alt15=2;
+                }
+                break;
+            case AT_LPAREN:
+                {
+                alt15=3;
+                }
+                break;
+            default:
+                NoViableAltException nvae =
+                    new NoViableAltException("", 15, 0, input);
+
+                throw nvae;
+
+            }
+
+            switch (alt15) {
+                case 1 :
+                    // src/java/org/apache/lucene/expressions/js/Javascript.g:316:7: ID
+                    {
+                    root_0 = (CommonTree)adaptor.nil();
+
+
+                    ID49=(Token)match(input,ID,FOLLOW_ID_in_primary1198); 
+                    ID49_tree = 
+                    (CommonTree)adaptor.create(ID49)
+                    ;
+                    adaptor.addChild(root_0, ID49_tree);
+
+
+                    }
+                    break;
+                case 2 :
+                    // src/java/org/apache/lucene/expressions/js/Javascript.g:317:7: numeric
+                    {
+                    root_0 = (CommonTree)adaptor.nil();
+
+
+                    pushFollow(FOLLOW_numeric_in_primary1206);
+                    numeric50=numeric();
+
+                    state._fsp--;
+
+                    adaptor.addChild(root_0, numeric50.getTree());
+
+                    }
+                    break;
+                case 3 :
+                    // src/java/org/apache/lucene/expressions/js/Javascript.g:318:7: AT_LPAREN ! conditional AT_RPAREN !
+                    {
+                    root_0 = (CommonTree)adaptor.nil();
+
+
+                    AT_LPAREN51=(Token)match(input,AT_LPAREN,FOLLOW_AT_LPAREN_in_primary1214); 
+
+                    pushFollow(FOLLOW_conditional_in_primary1217);
+                    conditional52=conditional();
+
+                    state._fsp--;
+
+                    adaptor.addChild(root_0, conditional52.getTree());
+
+                    AT_RPAREN53=(Token)match(input,AT_RPAREN,FOLLOW_AT_RPAREN_in_primary1219); 
+
+                    }
+                    break;
+
+            }
+            retval.stop = input.LT(-1);
+
+
+            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+
+        }
+
+        finally {
+        	// do for sure before leaving
+        }
+        return retval;
+    }
+    // $ANTLR end "primary"
+
+
+    public static class arguments_return extends ParserRuleReturnScope {
+        CommonTree tree;
+        public Object getTree() { return tree; }
+    };
+
+
+    // $ANTLR start "arguments"
+    // src/java/org/apache/lucene/expressions/js/Javascript.g:321:1: arguments : AT_LPAREN ! ( conditional ( AT_COMMA ! conditional )* )? AT_RPAREN !;
+    public final JavascriptParser.arguments_return arguments() throws RecognitionException {
+        JavascriptParser.arguments_return retval = new JavascriptParser.arguments_return();
+        retval.start = input.LT(1);
+
+
+        CommonTree root_0 = null;
+
+        Token AT_LPAREN54=null;
+        Token AT_COMMA56=null;
+        Token AT_RPAREN58=null;
+        JavascriptParser.conditional_return conditional55 =null;
+
+        JavascriptParser.conditional_return conditional57 =null;
+
+
+        CommonTree AT_LPAREN54_tree=null;
+        CommonTree AT_COMMA56_tree=null;
+        CommonTree AT_RPAREN58_tree=null;
+
+        try {
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:322:5: ( AT_LPAREN ! ( conditional ( AT_COMMA ! conditional )* )? AT_RPAREN !)
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:322:7: AT_LPAREN ! ( conditional ( AT_COMMA ! conditional )* )? AT_RPAREN !
+            {
+            root_0 = (CommonTree)adaptor.nil();
+
+
+            AT_LPAREN54=(Token)match(input,AT_LPAREN,FOLLOW_AT_LPAREN_in_arguments1237); 
+
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:322:18: ( conditional ( AT_COMMA ! conditional )* )?
+            int alt17=2;
+            int LA17_0 = input.LA(1);
+
+            if ( (LA17_0==AT_ADD||LA17_0==AT_BIT_NOT||LA17_0==AT_BOOL_NOT||LA17_0==AT_LPAREN||(LA17_0 >= AT_SUBTRACT && LA17_0 <= DECIMAL)||LA17_0==HEX||(LA17_0 >= ID && LA17_0 <= OCTAL)) ) {
+                alt17=1;
+            }
+            switch (alt17) {
+                case 1 :
+                    // src/java/org/apache/lucene/expressions/js/Javascript.g:322:19: conditional ( AT_COMMA ! conditional )*
+                    {
+                    pushFollow(FOLLOW_conditional_in_arguments1241);
+                    conditional55=conditional();
+
+                    state._fsp--;
+
+                    adaptor.addChild(root_0, conditional55.getTree());
+
+                    // src/java/org/apache/lucene/expressions/js/Javascript.g:322:31: ( AT_COMMA ! conditional )*
+                    loop16:
+                    do {
+                        int alt16=2;
+                        int LA16_0 = input.LA(1);
+
+                        if ( (LA16_0==AT_COMMA) ) {
+                            alt16=1;
+                        }
+
+
+                        switch (alt16) {
+                    	case 1 :
+                    	    // src/java/org/apache/lucene/expressions/js/Javascript.g:322:32: AT_COMMA ! conditional
+                    	    {
+                    	    AT_COMMA56=(Token)match(input,AT_COMMA,FOLLOW_AT_COMMA_in_arguments1244); 
+
+                    	    pushFollow(FOLLOW_conditional_in_arguments1247);
+                    	    conditional57=conditional();
+
+                    	    state._fsp--;
+
+                    	    adaptor.addChild(root_0, conditional57.getTree());
+
+                    	    }
+                    	    break;
+
+                    	default :
+                    	    break loop16;
+                        }
+                    } while (true);
+
+
+                    }
+                    break;
+
+            }
+
+
+            AT_RPAREN58=(Token)match(input,AT_RPAREN,FOLLOW_AT_RPAREN_in_arguments1253); 
+
+            }
+
+            retval.stop = input.LT(-1);
+
+
+            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+
+        }
+
+        finally {
+        	// do for sure before leaving
+        }
+        return retval;
+    }
+    // $ANTLR end "arguments"
+
+
+    public static class numeric_return extends ParserRuleReturnScope {
+        CommonTree tree;
+        public Object getTree() { return tree; }
+    };
+
+
+    // $ANTLR start "numeric"
+    // src/java/org/apache/lucene/expressions/js/Javascript.g:325:1: numeric : ( HEX | OCTAL | DECIMAL );
+    public final JavascriptParser.numeric_return numeric() throws RecognitionException {
+        JavascriptParser.numeric_return retval = new JavascriptParser.numeric_return();
+        retval.start = input.LT(1);
+
+
+        CommonTree root_0 = null;
+
+        Token set59=null;
+
+        CommonTree set59_tree=null;
+
+        try {
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:326:5: ( HEX | OCTAL | DECIMAL )
+            // src/java/org/apache/lucene/expressions/js/Javascript.g:
+            {
+            root_0 = (CommonTree)adaptor.nil();
+
+
+            set59=(Token)input.LT(1);
+
+            if ( input.LA(1)==DECIMAL||input.LA(1)==HEX||input.LA(1)==OCTAL ) {
+                input.consume();
+                adaptor.addChild(root_0, 
+                (CommonTree)adaptor.create(set59)
+                );
+                state.errorRecovery=false;
+            }
+            else {
+                MismatchedSetException mse = new MismatchedSetException(null,input);
+                throw mse;
+            }
+
+
+            }
+
+            retval.stop = input.LT(-1);
+
+
+            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+
+        }
+
+        finally {
+        	// do for sure before leaving
+        }
+        return retval;
+    }
+    // $ANTLR end "numeric"
+
+    // Delegated rules
+
+
+ 
+
+    public static final BitSet FOLLOW_conditional_in_expression737 = new BitSet(new long[]{0x0000000000000000L});
+    public static final BitSet FOLLOW_EOF_in_expression739 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_logical_or_in_conditional757 = new BitSet(new long[]{0x0000000001000002L});
+    public static final BitSet FOLLOW_AT_COND_QUE_in_conditional760 = new BitSet(new long[]{0x000001A308002050L});
+    public static final BitSet FOLLOW_conditional_in_conditional763 = new BitSet(new long[]{0x0000000000010000L});
+    public static final BitSet FOLLOW_AT_COLON_in_conditional765 = new BitSet(new long[]{0x000001A308002050L});
+    public static final BitSet FOLLOW_conditional_in_conditional768 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_logical_and_in_logical_or787 = new BitSet(new long[]{0x0000000000004002L});
+    public static final BitSet FOLLOW_AT_BOOL_OR_in_logical_or790 = new BitSet(new long[]{0x000001A308002050L});
+    public static final BitSet FOLLOW_logical_and_in_logical_or793 = new BitSet(new long[]{0x0000000000004002L});
+    public static final BitSet FOLLOW_bitwise_or_in_logical_and812 = new BitSet(new long[]{0x0000000000001002L});
+    public static final BitSet FOLLOW_AT_BOOL_AND_in_logical_and815 = new BitSet(new long[]{0x000001A308002050L});
+    public static final BitSet FOLLOW_bitwise_or_in_logical_and818 = new BitSet(new long[]{0x0000000000001002L});
+    public static final BitSet FOLLOW_bitwise_xor_in_bitwise_or837 = new BitSet(new long[]{0x0000000000000082L});
+    public static final BitSet FOLLOW_AT_BIT_OR_in_bitwise_or840 = new BitSet(new long[]{0x000001A308002050L});
+    public static final BitSet FOLLOW_bitwise_xor_in_bitwise_or843 = new BitSet(new long[]{0x0000000000000082L});
+    public static final BitSet FOLLOW_bitwise_and_in_bitwise_xor862 = new BitSet(new long[]{0x0000000000000802L});
+    public static final BitSet FOLLOW_AT_BIT_XOR_in_bitwise_xor865 = new BitSet(new long[]{0x000001A308002050L});
+    public static final BitSet FOLLOW_bitwise_and_in_bitwise_xor868 = new BitSet(new long[]{0x0000000000000802L});
+    public static final BitSet FOLLOW_equality_in_bitwise_and888 = new BitSet(new long[]{0x0000000000000022L});
+    public static final BitSet FOLLOW_AT_BIT_AND_in_bitwise_and891 = new BitSet(new long[]{0x000001A308002050L});
+    public static final BitSet FOLLOW_equality_in_bitwise_and894 = new BitSet(new long[]{0x0000000000000022L});
+    public static final BitSet FOLLOW_relational_in_equality913 = new BitSet(new long[]{0x0000000000840002L});
+    public static final BitSet FOLLOW_set_in_equality916 = new BitSet(new long[]{0x000001A308002050L});
+    public static final BitSet FOLLOW_relational_in_equality925 = new BitSet(new long[]{0x0000000000840002L});
+    public static final BitSet FOLLOW_shift_in_relational944 = new BitSet(new long[]{0x0000000000780002L});
+    public static final BitSet FOLLOW_set_in_relational947 = new BitSet(new long[]{0x000001A308002050L});
+    public static final BitSet FOLLOW_shift_in_relational964 = new BitSet(new long[]{0x0000000000780002L});
+    public static final BitSet FOLLOW_additive_in_shift983 = new BitSet(new long[]{0x0000000000000702L});
+    public static final BitSet FOLLOW_set_in_shift986 = new BitSet(new long[]{0x000001A308002050L});
+    public static final BitSet FOLLOW_additive_in_shift999 = new BitSet(new long[]{0x0000000000000702L});
+    public static final BitSet FOLLOW_multiplicative_in_additive1018 = new BitSet(new long[]{0x0000000100000012L});
+    public static final BitSet FOLLOW_set_in_additive1021 = new BitSet(new long[]{0x000001A308002050L});
+    public static final BitSet FOLLOW_multiplicative_in_additive1030 = new BitSet(new long[]{0x0000000100000012L});
+    public static final BitSet FOLLOW_unary_in_multiplicative1049 = new BitSet(new long[]{0x0000000032000002L});
+    public static final BitSet FOLLOW_set_in_multiplicative1052 = new BitSet(new long[]{0x000001A308002050L});
+    public static final BitSet FOLLOW_unary_in_multiplicative1065 = new BitSet(new long[]{0x0000000032000002L});
+    public static final BitSet FOLLOW_postfix_in_unary1084 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_AT_ADD_in_unary1092 = new BitSet(new long[]{0x000001A308002050L});
+    public static final BitSet FOLLOW_unary_in_unary1095 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_unary_operator_in_unary1103 = new BitSet(new long[]{0x000001A308002050L});
+    public static final BitSet FOLLOW_unary_in_unary1106 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_AT_SUBTRACT_in_unary_operator1123 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_AT_BIT_NOT_in_unary_operator1135 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_AT_BOOL_NOT_in_unary_operator1143 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_primary_in_postfix1160 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_ID_in_postfix1168 = new BitSet(new long[]{0x0000000008000000L});
+    public static final BitSet FOLLOW_arguments_in_postfix1170 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_ID_in_primary1198 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_numeric_in_primary1206 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_AT_LPAREN_in_primary1214 = new BitSet(new long[]{0x000001A308002050L});
+    public static final BitSet FOLLOW_conditional_in_primary1217 = new BitSet(new long[]{0x0000000080000000L});
+    public static final BitSet FOLLOW_AT_RPAREN_in_primary1219 = new BitSet(new long[]{0x0000000000000002L});
+    public static final BitSet FOLLOW_AT_LPAREN_in_arguments1237 = new BitSet(new long[]{0x000001A388002050L});
+    public static final BitSet FOLLOW_conditional_in_arguments1241 = new BitSet(new long[]{0x0000000080020000L});
+    public static final BitSet FOLLOW_AT_COMMA_in_arguments1244 = new BitSet(new long[]{0x000001A308002050L});
+    public static final BitSet FOLLOW_conditional_in_arguments1247 = new BitSet(new long[]{0x0000000080020000L});
+    public static final BitSet FOLLOW_AT_RPAREN_in_arguments1253 = new BitSet(new long[]{0x0000000000000002L});
+
+}
\ No newline at end of file

Added: lucene/dev/branches/lucene5207/lucene/expressions/src/java/org/apache/lucene/expressions/js/package.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5207/lucene/expressions/src/java/org/apache/lucene/expressions/js/package.html?rev=1522767&view=auto
==============================================================================
--- lucene/dev/branches/lucene5207/lucene/expressions/src/java/org/apache/lucene/expressions/js/package.html (added)
+++ lucene/dev/branches/lucene5207/lucene/expressions/src/java/org/apache/lucene/expressions/js/package.html Fri Sep 13 03:11:17 2013
@@ -0,0 +1,44 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+<head>
+  <title>Javascript expressions</title>
+</head>
+<body>
+<h1>Javascript expressions</h1>
+<p>A Javascript expression is a numeric expression specified using an expression syntax that's based on JavaScript expressions. You can construct expressions using:</p>
+<ul>
+<li>Integer, floating point, hex and octal literals</li>
+<li>Arithmetic operators: <code>+ - * / %</code></li>
+<li>Bitwise operators: <code>| &amp; ^ ~ &lt;&lt; &gt;&gt; &gt;&gt;&gt;</code></li>
+<li>Boolean operators (including the ternary operator): <code>&& || ! ?:</code></li>
+<li>Comparison operators: <code>&lt; &lt;= == &gt;= &gt;</code></li>
+<li>Common mathematic functions: <code>abs ceil erf exp floor ln log2 log10 max min sqrt pow</code></li>
+<li>Trigonometric library functions: <code>acosh acos asinh asin atanh atan cosh cos sinh sin tanh tan</code></li>
+<li>Miscellaneous functions: <code>min, max</code></li>
+<li>Arbitrary external variables - see {@link org.apache.lucene.expressions.Bindings}</li>
+</ul>
+
+<p>
+JavaScript order of precedence rules apply for operators. Shortcut evaluation is used for logical operators—the second argument is only evaluated if the value of the expression cannot be determined after evaluating the first argument. For example, in the expression <code>a || b</code>, <code>b</code> is only evaluated if a is not true.
+</p>
+
+<p>
+  To compile an expression, use {@link org.apache.lucene.expressions.js.JavascriptCompiler}.
+</p>
+</body>
+</html>
\ No newline at end of file

Added: lucene/dev/branches/lucene5207/lucene/expressions/src/java/org/apache/lucene/expressions/package.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5207/lucene/expressions/src/java/org/apache/lucene/expressions/package.html?rev=1522767&view=auto
==============================================================================
--- lucene/dev/branches/lucene5207/lucene/expressions/src/java/org/apache/lucene/expressions/package.html (added)
+++ lucene/dev/branches/lucene5207/lucene/expressions/src/java/org/apache/lucene/expressions/package.html Fri Sep 13 03:11:17 2013
@@ -0,0 +1,39 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+<head>
+  <title>expressions</title>
+</head>
+<body>
+<h1>expressions</h1>
+<p>
+{@link org.apache.lucene.expressions.Expression} - result of compiling an expression, which can
+evaluate it for a given document.  Each expression can have external variables which evaluate
+will retrieve from passed FunctionValues.
+</p>
+
+<p>
+{@link org.apache.lucene.expressions.Bindings} - abstraction for binding external variables
+to a way to get a value for those variables for a particular document (ValueSource)
+</p>
+
+<p>
+{@link org.apache.lucene.expressions.SimpleBindings} - default implementation of bindings which provide easy ways to bind sort fields and other expressions to external variables
+</p>
+
+</body>
+</html>
\ No newline at end of file

Added: lucene/dev/branches/lucene5207/lucene/expressions/src/java/overview.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5207/lucene/expressions/src/java/overview.html?rev=1522767&view=auto
==============================================================================
--- lucene/dev/branches/lucene5207/lucene/expressions/src/java/overview.html (added)
+++ lucene/dev/branches/lucene5207/lucene/expressions/src/java/overview.html Fri Sep 13 03:11:17 2013
@@ -0,0 +1,41 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+  <head>
+    <title>Apache Lucene Expressions Module</title>
+  </head>
+  <body>
+
+  <h1>The Expressions Module for Apache Lucene</h1>
+
+  <p>
+    The expressions module is new to Lucene 4.6. It provides an API for dynamically computing per-document values based on string expressions.
+  </p>
+  <p>
+    The module is organized in two sections:
+    <ol>
+      <li>{@link org.apache.lucene.expressions} - The abstractions and simple utilities for common operations like sorting on an expression</li>
+      <li>{@link org.apache.lucene.expressions.js} - A compiler for a subset of JavaScript expressions</li>
+    </ol>
+  </p>
+  <p>
+    For sample code showing how to use the API, see {@link org.apache.lucene.expressions.TestDemoExpressions}.
+  </p>
+  <p>
+
+  </body>
+</html>
\ No newline at end of file

Added: lucene/dev/branches/lucene5207/lucene/expressions/src/test/org/apache/lucene/expressions/TestDemoExpressions.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5207/lucene/expressions/src/test/org/apache/lucene/expressions/TestDemoExpressions.java?rev=1522767&view=auto
==============================================================================
--- lucene/dev/branches/lucene5207/lucene/expressions/src/test/org/apache/lucene/expressions/TestDemoExpressions.java (added)
+++ lucene/dev/branches/lucene5207/lucene/expressions/src/test/org/apache/lucene/expressions/TestDemoExpressions.java Fri Sep 13 03:11:17 2013
@@ -0,0 +1,113 @@
+package org.apache.lucene.expressions;
+
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.NumericDocValuesField;
+import org.apache.lucene.expressions.js.JavascriptCompiler;
+import org.apache.lucene.index.DirectoryReader;
+import org.apache.lucene.index.RandomIndexWriter;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.search.CheckHits;
+import org.apache.lucene.search.FieldDoc;
+import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.Sort;
+import org.apache.lucene.search.SortField;
+import org.apache.lucene.search.TermQuery;
+import org.apache.lucene.search.TopFieldDocs;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.util.LuceneTestCase;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** simple demo of using expressions */
+public class  TestDemoExpressions extends LuceneTestCase {
+  IndexSearcher searcher;
+  DirectoryReader reader;
+  Directory dir;
+  
+  @Override
+  public void setUp() throws Exception {
+    super.setUp();
+    dir = newDirectory();
+    RandomIndexWriter iw = new RandomIndexWriter(random(), dir);
+    
+    Document doc = new Document();
+    doc.add(newStringField("id", "1", Field.Store.YES));
+    doc.add(newTextField("body", "some contents and more contents", Field.Store.NO));
+    doc.add(new NumericDocValuesField("popularity", 5));
+    iw.addDocument(doc);
+    
+    doc = new Document();
+    doc.add(newStringField("id", "2", Field.Store.YES));
+    doc.add(newTextField("body", "another document with different contents", Field.Store.NO));
+    doc.add(new NumericDocValuesField("popularity", 20));
+    iw.addDocument(doc);
+    
+    doc = new Document();
+    doc.add(newStringField("id", "3", Field.Store.YES));
+    doc.add(newTextField("body", "crappy contents", Field.Store.NO));
+    doc.add(new NumericDocValuesField("popularity", 2));
+    iw.addDocument(doc);
+    
+    reader = iw.getReader();
+    searcher = new IndexSearcher(reader);
+    iw.close();
+  }
+  
+  @Override
+  public void tearDown() throws Exception {
+    reader.close();
+    dir.close();
+    super.tearDown();
+  }
+  
+  /** an example of how to rank by an expression */
+  public void test() throws Exception {
+    // compile an expression:
+    Expression expr = JavascriptCompiler.compile("sqrt(_score) + ln(popularity)");
+    
+    // we use SimpleBindings: which just maps variables to SortField instances
+    SimpleBindings bindings = new SimpleBindings();    
+    bindings.add(new SortField("_score", SortField.Type.SCORE));
+    bindings.add(new SortField("popularity", SortField.Type.INT));
+    
+    // create a sort field and sort by it (reverse order)
+    Sort sort = new Sort(expr.getSortField(bindings, true));
+    Query query = new TermQuery(new Term("body", "contents"));
+    searcher.search(query, null, 3, sort);
+  }
+  
+  /** tests the returned sort values are correct */
+  public void testSortValues() throws Exception {
+    Expression expr = JavascriptCompiler.compile("sqrt(_score)");
+    
+    SimpleBindings bindings = new SimpleBindings();    
+    bindings.add(new SortField("_score", SortField.Type.SCORE));
+    
+    Sort sort = new Sort(expr.getSortField(bindings, true));
+    Query query = new TermQuery(new Term("body", "contents"));
+    TopFieldDocs td = searcher.search(query, null, 3, sort, true, true);
+    for (int i = 0; i < 3; i++) {
+      FieldDoc d = (FieldDoc) td.scoreDocs[i];
+      float expected = (float) Math.sqrt(d.score);
+      float actual = ((Double)d.fields[0]).floatValue();
+      assertEquals(expected, actual, CheckHits.explainToleranceDelta(expected, actual));
+    }
+  }
+}



Mime
View raw message