LUCENE-9654: Expressions module gramar antlr code regeneration (#269)

This commit is contained in:
Dawid Weiss 2021-08-27 12:47:19 +02:00 committed by GitHub
parent 3b3f9600c2
commit e470535072
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 1145 additions and 632 deletions

View File

@ -154,6 +154,7 @@ apply from: file('gradle/generation/nori.gradle')
apply from: file('gradle/generation/icu.gradle')
apply from: file('gradle/generation/javacc.gradle')
apply from: file('gradle/generation/forUtil.gradle')
apply from: file('gradle/generation/antlr.gradle')
apply from: file('gradle/datasets/external-datasets.gradle')

View File

@ -0,0 +1,88 @@
import java.nio.file.Files
/*
* 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.
*/
configure(project(":lucene:expressions")) {
configurations {
antlr
}
dependencies {
antlr "org.antlr:antlr4"
}
task generateAntlrInternal() {
description "Regenerate Javascript.g4"
group "generation"
dependsOn configurations.antlr
def generatedPatterns = [
"**/JavascriptBaseVisitor.java",
"**/JavascriptLexer.java",
"**/JavascriptParser.java",
"**/JavascriptVisitor.java",
]
def sourceDir = "src/java/org/apache/lucene/expressions/js"
def inputFiles = file("$sourceDir/Javascript.g4")
def tempOutput = file("$buildDir/antlr")
def outputFiles = fileTree(dir: sourceDir, includes: generatedPatterns)
inputs.files inputFiles
outputs.files outputFiles
doFirst {
project.delete tempOutput
project.javaexec {
main = "org.antlr.v4.Tool"
classpath = configurations.antlr
ignoreExitValue false
args = [
"-no-listener",
"-visitor",
"-package", "org.apache.lucene.expressions.js",
"-o", tempOutput,
inputFiles
]
}
def generatedFiles = fileTree(dir: tempOutput, includes: generatedPatterns)
generatedFiles.each { file ->
modifyFile(file, { text ->
text = text.replaceAll("public ((interface|class) Javascript\\w+)", "\$1")
text = text.replaceAll("// Generated from .*", "// ANTLR GENERATED CODE: DO NOT EDIT")
return text
})
}
project.copy {
from tempOutput
into sourceDir
include generatedPatterns
}
}
}
def generateAntlr = wrapWithPersistentChecksums(
generateAntlrInternal, [ andThenTasks: ["spotlessJava", "spotlessJavaApply"] ])
regenerate.dependsOn generateAntlr
}

View File

@ -37,20 +37,6 @@ configure(rootProject) {
}
}
/**
* Utility function to read a file, apply changes to its content and write it back.
*/
def modifyFile = { File path, Function<String, String> modify ->
Function<String, String> normalizeEols = { text -> text.replace("\r\n", "\n") }
modify = normalizeEols.andThen(modify).andThen(normalizeEols)
String original = path.getText("UTF-8")
String modified = modify.apply(original)
if (!original.equals(modified)) {
path.write(modified, "UTF-8")
}
}
def commonCleanups = { FileTree generatedFiles ->
// This is a minor typo in a comment that nonetheless people have hand-corrected in the past.
generatedFiles.matching({ include "CharStream.java" }).each {file ->

View File

@ -2,6 +2,8 @@ import groovy.json.JsonOutput
import groovy.json.JsonSlurper
import org.apache.commons.codec.digest.DigestUtils
import java.util.function.Function
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -62,6 +64,24 @@ def computeChecksummedEntries = { Task sourceTask ->
return allEntries
}
configure(rootProject) {
ext {
/**
* Utility function to read a file, apply changes to its content and write it back.
*/
modifyFile = { File path, Function<String, String> modify ->
Function<String, String> normalizeEols = { text -> text.replace("\r\n", "\n") }
modify = normalizeEols.andThen(modify).andThen(normalizeEols)
String original = path.getText("UTF-8")
String modified = modify.apply(original)
if (!original.equals(modified)) {
path.write(modified, "UTF-8")
}
}
}
}
configure([
project(":lucene:analysis:common"),
project(":lucene:analysis:icu"),
@ -70,6 +90,7 @@ configure([
project(":lucene:backward-codecs"),
project(":lucene:core"),
project(":lucene:queryparser"),
project(":lucene:expressions"),
]) {
task regenerate() {
description "Rerun any code or static data generation tasks."

View File

@ -59,9 +59,6 @@ configure(project(":lucene").subprojects) { prj ->
break
case ":lucene:expressions":
targetExclude "**/JavascriptLexer.java",
"**/JavascriptParser.java",
"**/JavascriptVisitor.java"
break
case ":lucene:queryparser":

View File

@ -0,0 +1,7 @@
{
"lucene/expressions/src/java/org/apache/lucene/expressions/js/Javascript.g4": "818e89aae0b6c7601051802013898c128fe7c1ba",
"lucene/expressions/src/java/org/apache/lucene/expressions/js/JavascriptBaseVisitor.java": "45e3c7093f3e485a07be507efbdefc5e3d112576",
"lucene/expressions/src/java/org/apache/lucene/expressions/js/JavascriptLexer.java": "f0a53549fb8329dd4181f836d1778417de08550e",
"lucene/expressions/src/java/org/apache/lucene/expressions/js/JavascriptParser.java": "ca9d587e6e98436647370ee5b7c82ae07243ee50",
"lucene/expressions/src/java/org/apache/lucene/expressions/js/JavascriptVisitor.java": "ebf033dc72e63203e5d4d85fd57114dd973482dc"
}

View File

@ -1,54 +1,135 @@
// ANTLR GENERATED CODE: DO NOT EDIT
package org.apache.lucene.expressions.js;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.RuntimeMetaData;
import org.antlr.v4.runtime.Vocabulary;
import org.antlr.v4.runtime.VocabularyImpl;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.misc.*;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
class JavascriptLexer extends Lexer {
static { RuntimeMetaData.checkVersion("4.5.1", RuntimeMetaData.VERSION); }
static {
RuntimeMetaData.checkVersion("4.5.1", RuntimeMetaData.VERSION);
}
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
LP=1, RP=2, COMMA=3, BOOLNOT=4, BWNOT=5, MUL=6, DIV=7, REM=8, ADD=9, SUB=10,
LSH=11, RSH=12, USH=13, LT=14, LTE=15, GT=16, GTE=17, EQ=18, NE=19, BWAND=20,
BWXOR=21, BWOR=22, BOOLAND=23, BOOLOR=24, COND=25, COLON=26, WS=27, VARIABLE=28,
OCTAL=29, HEX=30, DECIMAL=31;
public static String[] modeNames = {
"DEFAULT_MODE"
};
protected static final PredictionContextCache _sharedContextCache = new PredictionContextCache();
public static final int LP = 1,
RP = 2,
COMMA = 3,
BOOLNOT = 4,
BWNOT = 5,
MUL = 6,
DIV = 7,
REM = 8,
ADD = 9,
SUB = 10,
LSH = 11,
RSH = 12,
USH = 13,
LT = 14,
LTE = 15,
GT = 16,
GTE = 17,
EQ = 18,
NE = 19,
BWAND = 20,
BWXOR = 21,
BWOR = 22,
BOOLAND = 23,
BOOLOR = 24,
COND = 25,
COLON = 26,
WS = 27,
VARIABLE = 28,
OCTAL = 29,
HEX = 30,
DECIMAL = 31;
public static String[] modeNames = {"DEFAULT_MODE"};
public static final String[] ruleNames = {
"LP", "RP", "COMMA", "BOOLNOT", "BWNOT", "MUL", "DIV", "REM", "ADD", "SUB",
"LSH", "RSH", "USH", "LT", "LTE", "GT", "GTE", "EQ", "NE", "BWAND", "BWXOR",
"BWOR", "BOOLAND", "BOOLOR", "COND", "COLON", "WS", "VARIABLE", "ARRAY",
"ID", "STRING", "OCTAL", "HEX", "DECIMAL", "INTEGER"
"LP",
"RP",
"COMMA",
"BOOLNOT",
"BWNOT",
"MUL",
"DIV",
"REM",
"ADD",
"SUB",
"LSH",
"RSH",
"USH",
"LT",
"LTE",
"GT",
"GTE",
"EQ",
"NE",
"BWAND",
"BWXOR",
"BWOR",
"BOOLAND",
"BOOLOR",
"COND",
"COLON",
"WS",
"VARIABLE",
"ARRAY",
"ID",
"STRING",
"OCTAL",
"HEX",
"DECIMAL",
"INTEGER"
};
private static final String[] _LITERAL_NAMES = {
null, null, null, null, null, null, null, null, null, null, null, "'<<'",
"'>>'", "'>>>'", null, "'<='", null, "'>='", "'=='", "'!='", null, null,
null, "'&&'", "'||'"
null, null, null, null, null, null, null, null, null, null, null, "'<<'", "'>>'", "'>>>'", null,
"'<='", null, "'>='", "'=='", "'!='", null, null, null, "'&&'", "'||'"
};
private static final String[] _SYMBOLIC_NAMES = {
null, "LP", "RP", "COMMA", "BOOLNOT", "BWNOT", "MUL", "DIV", "REM", "ADD",
"SUB", "LSH", "RSH", "USH", "LT", "LTE", "GT", "GTE", "EQ", "NE", "BWAND",
"BWXOR", "BWOR", "BOOLAND", "BOOLOR", "COND", "COLON", "WS", "VARIABLE",
"OCTAL", "HEX", "DECIMAL"
null,
"LP",
"RP",
"COMMA",
"BOOLNOT",
"BWNOT",
"MUL",
"DIV",
"REM",
"ADD",
"SUB",
"LSH",
"RSH",
"USH",
"LT",
"LTE",
"GT",
"GTE",
"EQ",
"NE",
"BWAND",
"BWXOR",
"BWOR",
"BOOLAND",
"BOOLOR",
"COND",
"COLON",
"WS",
"VARIABLE",
"OCTAL",
"HEX",
"DECIMAL"
};
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
/**
* @deprecated Use {@link #VOCABULARY} instead.
*/
@Deprecated
public static final String[] tokenNames;
/** @deprecated Use {@link #VOCABULARY} instead. */
@Deprecated public static final String[] tokenNames;
static {
tokenNames = new String[_SYMBOLIC_NAMES.length];
for (int i = 0; i < tokenNames.length; i++) {
@ -70,125 +151,133 @@ class JavascriptLexer extends Lexer {
}
@Override
public Vocabulary getVocabulary() {
return VOCABULARY;
}
public JavascriptLexer(CharStream input) {
super(input);
_interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
_interp = new LexerATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache);
}
@Override
public String getGrammarFileName() { return "Javascript.g4"; }
public String getGrammarFileName() {
return "Javascript.g4";
}
@Override
public String[] getRuleNames() { return ruleNames; }
public String[] getRuleNames() {
return ruleNames;
}
@Override
public String getSerializedATN() { return _serializedATN; }
public String getSerializedATN() {
return _serializedATN;
}
@Override
public String[] getModeNames() { return modeNames; }
public String[] getModeNames() {
return modeNames;
}
@Override
public ATN getATN() { return _ATN; }
public ATN getATN() {
return _ATN;
}
public static final String _serializedATN =
"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\2!\u00fe\b\1\4\2\t"+
"\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13"+
"\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+
"\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31\t\31"+
"\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t\37\4 \t \4!"+
"\t!\4\"\t\"\4#\t#\4$\t$\3\2\3\2\3\3\3\3\3\4\3\4\3\5\3\5\3\6\3\6\3\7\3"+
"\7\3\b\3\b\3\t\3\t\3\n\3\n\3\13\3\13\3\f\3\f\3\f\3\r\3\r\3\r\3\16\3\16"+
"\3\16\3\16\3\17\3\17\3\20\3\20\3\20\3\21\3\21\3\22\3\22\3\22\3\23\3\23"+
"\3\23\3\24\3\24\3\24\3\25\3\25\3\26\3\26\3\27\3\27\3\30\3\30\3\30\3\31"+
"\3\31\3\31\3\32\3\32\3\33\3\33\3\34\6\34\u0089\n\34\r\34\16\34\u008a\3"+
"\34\3\34\3\35\3\35\7\35\u0091\n\35\f\35\16\35\u0094\13\35\3\35\3\35\3"+
"\35\7\35\u0099\n\35\f\35\16\35\u009c\13\35\7\35\u009e\n\35\f\35\16\35"+
"\u00a1\13\35\3\36\3\36\3\36\5\36\u00a6\n\36\3\36\3\36\3\37\3\37\7\37\u00ac"+
"\n\37\f\37\16\37\u00af\13\37\3 \3 \3 \3 \3 \3 \7 \u00b7\n \f \16 \u00ba"+
"\13 \3 \3 \3 \3 \3 \3 \3 \7 \u00c3\n \f \16 \u00c6\13 \3 \5 \u00c9\n "+
"\3!\3!\6!\u00cd\n!\r!\16!\u00ce\3\"\3\"\3\"\6\"\u00d4\n\"\r\"\16\"\u00d5"+
"\3#\3#\3#\7#\u00db\n#\f#\16#\u00de\13#\5#\u00e0\n#\3#\3#\6#\u00e4\n#\r"+
"#\16#\u00e5\5#\u00e8\n#\3#\3#\5#\u00ec\n#\3#\6#\u00ef\n#\r#\16#\u00f0"+
"\5#\u00f3\n#\3$\3$\3$\7$\u00f8\n$\f$\16$\u00fb\13$\5$\u00fd\n$\4\u00b8"+
"\u00c4\2%\3\3\5\4\7\5\t\6\13\7\r\b\17\t\21\n\23\13\25\f\27\r\31\16\33"+
"\17\35\20\37\21!\22#\23%\24\'\25)\26+\27-\30/\31\61\32\63\33\65\34\67"+
"\359\36;\2=\2?\2A\37C E!G\2\3\2%\3\2**\3\2++\3\2..\3\2##\3\2\u0080\u0080"+
"\3\2,,\3\2\61\61\3\2\'\'\3\2--\3\2//\3\2>>\3\2@@\3\2((\3\2``\3\2~~\3\2"+
"AA\3\2<<\5\2\13\f\17\17\"\"\3\2\60\60\3\2]]\3\2^_\6\2&&C\\aac|\7\2&&\62"+
";C\\aac|\3\2))\4\2))^^\3\2$$\4\2$$^^\3\2\62\62\3\2\629\4\2ZZzz\5\2\62"+
";CHch\3\2\62;\4\2GGgg\4\2--//\3\2\63;\u0111\2\3\3\2\2\2\2\5\3\2\2\2\2"+
"\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17\3\2\2\2\2\21\3\2"+
"\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2\2\31\3\2\2\2\2\33\3\2\2\2"+
"\2\35\3\2\2\2\2\37\3\2\2\2\2!\3\2\2\2\2#\3\2\2\2\2%\3\2\2\2\2\'\3\2\2"+
"\2\2)\3\2\2\2\2+\3\2\2\2\2-\3\2\2\2\2/\3\2\2\2\2\61\3\2\2\2\2\63\3\2\2"+
"\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17\2\2z,\3\2\2\2{|\t\20\2\2"+
"|.\3\2\2\2}~\7(\2\2~\177\7(\2\2\177\60\3\2\2\2\u0080\u0081\7~\2\2\u0081"+
"\u0082\7~\2\2\u0082\62\3\2\2\2\u0083\u0084\t\21\2\2\u0084\64\3\2\2\2\u0085"+
"\u0086\t\22\2\2\u0086\66\3\2\2\2\u0087\u0089\t\23\2\2\u0088\u0087\3\2"+
"\2\2\u0089\u008a\3\2\2\2\u008a\u0088\3\2\2\2\u008a\u008b\3\2\2\2\u008b"+
"\u008c\3\2\2\2\u008c\u008d\b\34\2\2\u008d8\3\2\2\2\u008e\u0092\5=\37\2"+
"\u008f\u0091\5;\36\2\u0090\u008f\3\2\2\2\u0091\u0094\3\2\2\2\u0092\u0090"+
"\3\2\2\2\u0092\u0093\3\2\2\2\u0093\u009f\3\2\2\2\u0094\u0092\3\2\2\2\u0095"+
"\u0096\t\24\2\2\u0096\u009a\5=\37\2\u0097\u0099\5;\36\2\u0098\u0097\3"+
"\2\2\2\u0099\u009c\3\2\2\2\u009a\u0098\3\2\2\2\u009a\u009b\3\2\2\2\u009b"+
"\u009e\3\2\2\2\u009c\u009a\3\2\2\2\u009d\u0095\3\2\2\2\u009e\u00a1\3\2"+
"\2\2\u009f\u009d\3\2\2\2\u009f\u00a0\3\2\2\2\u00a0:\3\2\2\2\u00a1\u009f"+
"\3\2\2\2\u00a2\u00a5\t\25\2\2\u00a3\u00a6\5? \2\u00a4\u00a6\5G$\2\u00a5"+
"\u00a3\3\2\2\2\u00a5\u00a4\3\2\2\2\u00a6\u00a7\3\2\2\2\u00a7\u00a8\t\26"+
"\2\2\u00a8<\3\2\2\2\u00a9\u00ad\t\27\2\2\u00aa\u00ac\t\30\2\2\u00ab\u00aa"+
"\3\2\2\2\u00ac\u00af\3\2\2\2\u00ad\u00ab\3\2\2\2\u00ad\u00ae\3\2\2\2\u00ae"+
">\3\2\2\2\u00af\u00ad\3\2\2\2\u00b0\u00b8\t\31\2\2\u00b1\u00b2\7^\2\2"+
"\u00b2\u00b7\7)\2\2\u00b3\u00b4\7^\2\2\u00b4\u00b7\7^\2\2\u00b5\u00b7"+
"\n\32\2\2\u00b6\u00b1\3\2\2\2\u00b6\u00b3\3\2\2\2\u00b6\u00b5\3\2\2\2"+
"\u00b7\u00ba\3\2\2\2\u00b8\u00b9\3\2\2\2\u00b8\u00b6\3\2\2\2\u00b9\u00bb"+
"\3\2\2\2\u00ba\u00b8\3\2\2\2\u00bb\u00c9\t\31\2\2\u00bc\u00c4\t\33\2\2"+
"\u00bd\u00be\7^\2\2\u00be\u00c3\7$\2\2\u00bf\u00c0\7^\2\2\u00c0\u00c3"+
"\7^\2\2\u00c1\u00c3\n\34\2\2\u00c2\u00bd\3\2\2\2\u00c2\u00bf\3\2\2\2\u00c2"+
"\u00c1\3\2\2\2\u00c3\u00c6\3\2\2\2\u00c4\u00c5\3\2\2\2\u00c4\u00c2\3\2"+
"\2\2\u00c5\u00c7\3\2\2\2\u00c6\u00c4\3\2\2\2\u00c7\u00c9\t\33\2\2\u00c8"+
"\u00b0\3\2\2\2\u00c8\u00bc\3\2\2\2\u00c9@\3\2\2\2\u00ca\u00cc\t\35\2\2"+
"\u00cb\u00cd\t\36\2\2\u00cc\u00cb\3\2\2\2\u00cd\u00ce\3\2\2\2\u00ce\u00cc"+
"\3\2\2\2\u00ce\u00cf\3\2\2\2\u00cfB\3\2\2\2\u00d0\u00d1\t\35\2\2\u00d1"+
"\u00d3\t\37\2\2\u00d2\u00d4\t \2\2\u00d3\u00d2\3\2\2\2\u00d4\u00d5\3\2"+
"\2\2\u00d5\u00d3\3\2\2\2\u00d5\u00d6\3\2\2\2\u00d6D\3\2\2\2\u00d7\u00df"+
"\5G$\2\u00d8\u00dc\t\24\2\2\u00d9\u00db\t!\2\2\u00da\u00d9\3\2\2\2\u00db"+
"\u00de\3\2\2\2\u00dc\u00da\3\2\2\2\u00dc\u00dd\3\2\2\2\u00dd\u00e0\3\2"+
"\2\2\u00de\u00dc\3\2\2\2\u00df\u00d8\3\2\2\2\u00df\u00e0\3\2\2\2\u00e0"+
"\u00e8\3\2\2\2\u00e1\u00e3\t\24\2\2\u00e2\u00e4\t!\2\2\u00e3\u00e2\3\2"+
"\2\2\u00e4\u00e5\3\2\2\2\u00e5\u00e3\3\2\2\2\u00e5\u00e6\3\2\2\2\u00e6"+
"\u00e8\3\2\2\2\u00e7\u00d7\3\2\2\2\u00e7\u00e1\3\2\2\2\u00e8\u00f2\3\2"+
"\2\2\u00e9\u00eb\t\"\2\2\u00ea\u00ec\t#\2\2\u00eb\u00ea\3\2\2\2\u00eb"+
"\u00ec\3\2\2\2\u00ec\u00ee\3\2\2\2\u00ed\u00ef\t!\2\2\u00ee\u00ed\3\2"+
"\2\2\u00ef\u00f0\3\2\2\2\u00f0\u00ee\3\2\2\2\u00f0\u00f1\3\2\2\2\u00f1"+
"\u00f3\3\2\2\2\u00f2\u00e9\3\2\2\2\u00f2\u00f3\3\2\2\2\u00f3F\3\2\2\2"+
"\u00f4\u00fd\t\35\2\2\u00f5\u00f9\t$\2\2\u00f6\u00f8\t!\2\2\u00f7\u00f6"+
"\3\2\2\2\u00f8\u00fb\3\2\2\2\u00f9\u00f7\3\2\2\2\u00f9\u00fa\3\2\2\2\u00fa"+
"\u00fd\3\2\2\2\u00fb\u00f9\3\2\2\2\u00fc\u00f4\3\2\2\2\u00fc\u00f5\3\2"+
"\2\2\u00fdH\3\2\2\2\31\2\u008a\u0092\u009a\u009f\u00a5\u00ad\u00b6\u00b8"+
"\u00c2\u00c4\u00c8\u00ce\u00d5\u00dc\u00df\u00e5\u00e7\u00eb\u00f0\u00f2"+
"\u00f9\u00fc\3\b\2\2";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\2!\u00fe\b\1\4\2\t"
+ "\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13"
+ "\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"
+ "\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31\t\31"
+ "\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t\37\4 \t \4!"
+ "\t!\4\"\t\"\4#\t#\4$\t$\3\2\3\2\3\3\3\3\3\4\3\4\3\5\3\5\3\6\3\6\3\7\3"
+ "\7\3\b\3\b\3\t\3\t\3\n\3\n\3\13\3\13\3\f\3\f\3\f\3\r\3\r\3\r\3\16\3\16"
+ "\3\16\3\16\3\17\3\17\3\20\3\20\3\20\3\21\3\21\3\22\3\22\3\22\3\23\3\23"
+ "\3\23\3\24\3\24\3\24\3\25\3\25\3\26\3\26\3\27\3\27\3\30\3\30\3\30\3\31"
+ "\3\31\3\31\3\32\3\32\3\33\3\33\3\34\6\34\u0089\n\34\r\34\16\34\u008a\3"
+ "\34\3\34\3\35\3\35\7\35\u0091\n\35\f\35\16\35\u0094\13\35\3\35\3\35\3"
+ "\35\7\35\u0099\n\35\f\35\16\35\u009c\13\35\7\35\u009e\n\35\f\35\16\35"
+ "\u00a1\13\35\3\36\3\36\3\36\5\36\u00a6\n\36\3\36\3\36\3\37\3\37\7\37\u00ac"
+ "\n\37\f\37\16\37\u00af\13\37\3 \3 \3 \3 \3 \3 \7 \u00b7\n \f \16 \u00ba"
+ "\13 \3 \3 \3 \3 \3 \3 \3 \7 \u00c3\n \f \16 \u00c6\13 \3 \5 \u00c9\n "
+ "\3!\3!\6!\u00cd\n!\r!\16!\u00ce\3\"\3\"\3\"\6\"\u00d4\n\"\r\"\16\"\u00d5"
+ "\3#\3#\3#\7#\u00db\n#\f#\16#\u00de\13#\5#\u00e0\n#\3#\3#\6#\u00e4\n#\r"
+ "#\16#\u00e5\5#\u00e8\n#\3#\3#\5#\u00ec\n#\3#\6#\u00ef\n#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0087\u0089\t\23\2\2\u0088\u0087\3\2"
+ "\2\2\u0089\u008a\3\2\2\2\u008a\u0088\3\2\2\2\u008a\u008b\3\2\2\2\u008b"
+ "\u008c\3\2\2\2\u008c\u008d\b\34\2\2\u008d8\3\2\2\2\u008e\u0092\5=\37\2"
+ "\u008f\u0091\5;\36\2\u0090\u008f\3\2\2\2\u0091\u0094\3\2\2\2\u0092\u0090"
+ "\3\2\2\2\u0092\u0093\3\2\2\2\u0093\u009f\3\2\2\2\u0094\u0092\3\2\2\2\u0095"
+ "\u0096\t\24\2\2\u0096\u009a\5=\37\2\u0097\u0099\5;\36\2\u0098\u0097\3"
+ "\2\2\2\u0099\u009c\3\2\2\2\u009a\u0098\3\2\2\2\u009a\u009b\3\2\2\2\u009b"
+ "\u009e\3\2\2\2\u009c\u009a\3\2\2\2\u009d\u0095\3\2\2\2\u009e\u00a1\3\2"
+ "\2\2\u009f\u009d\3\2\2\2\u009f\u00a0\3\2\2\2\u00a0:\3\2\2\2\u00a1\u009f"
+ "\3\2\2\2\u00a2\u00a5\t\25\2\2\u00a3\u00a6\5? \2\u00a4\u00a6\5G$\2\u00a5"
+ "\u00a3\3\2\2\2\u00a5\u00a4\3\2\2\2\u00a6\u00a7\3\2\2\2\u00a7\u00a8\t\26"
+ "\2\2\u00a8<\3\2\2\2\u00a9\u00ad\t\27\2\2\u00aa\u00ac\t\30\2\2\u00ab\u00aa"
+ "\3\2\2\2\u00ac\u00af\3\2\2\2\u00ad\u00ab\3\2\2\2\u00ad\u00ae\3\2\2\2\u00ae"
+ ">\3\2\2\2\u00af\u00ad\3\2\2\2\u00b0\u00b8\t\31\2\2\u00b1\u00b2\7^\2\2"
+ "\u00b2\u00b7\7)\2\2\u00b3\u00b4\7^\2\2\u00b4\u00b7\7^\2\2\u00b5\u00b7"
+ "\n\32\2\2\u00b6\u00b1\3\2\2\2\u00b6\u00b3\3\2\2\2\u00b6\u00b5\3\2\2\2"
+ "\u00b7\u00ba\3\2\2\2\u00b8\u00b9\3\2\2\2\u00b8\u00b6\3\2\2\2\u00b9\u00bb"
+ "\3\2\2\2\u00ba\u00b8\3\2\2\2\u00bb\u00c9\t\31\2\2\u00bc\u00c4\t\33\2\2"
+ "\u00bd\u00be\7^\2\2\u00be\u00c3\7$\2\2\u00bf\u00c0\7^\2\2\u00c0\u00c3"
+ "\7^\2\2\u00c1\u00c3\n\34\2\2\u00c2\u00bd\3\2\2\2\u00c2\u00bf\3\2\2\2\u00c2"
+ "\u00c1\3\2\2\2\u00c3\u00c6\3\2\2\2\u00c4\u00c5\3\2\2\2\u00c4\u00c2\3\2"
+ "\2\2\u00c5\u00c7\3\2\2\2\u00c6\u00c4\3\2\2\2\u00c7\u00c9\t\33\2\2\u00c8"
+ "\u00b0\3\2\2\2\u00c8\u00bc\3\2\2\2\u00c9@\3\2\2\2\u00ca\u00cc\t\35\2\2"
+ "\u00cb\u00cd\t\36\2\2\u00cc\u00cb\3\2\2\2\u00cd\u00ce\3\2\2\2\u00ce\u00cc"
+ "\3\2\2\2\u00ce\u00cf\3\2\2\2\u00cfB\3\2\2\2\u00d0\u00d1\t\35\2\2\u00d1"
+ "\u00d3\t\37\2\2\u00d2\u00d4\t \2\2\u00d3\u00d2\3\2\2\2\u00d4\u00d5\3\2"
+ "\2\2\u00d5\u00d3\3\2\2\2\u00d5\u00d6\3\2\2\2\u00d6D\3\2\2\2\u00d7\u00df"
+ "\5G$\2\u00d8\u00dc\t\24\2\2\u00d9\u00db\t!\2\2\u00da\u00d9\3\2\2\2\u00db"
+ "\u00de\3\2\2\2\u00dc\u00da\3\2\2\2\u00dc\u00dd\3\2\2\2\u00dd\u00e0\3\2"
+ "\2\2\u00de\u00dc\3\2\2\2\u00df\u00d8\3\2\2\2\u00df\u00e0\3\2\2\2\u00e0"
+ "\u00e8\3\2\2\2\u00e1\u00e3\t\24\2\2\u00e2\u00e4\t!\2\2\u00e3\u00e2\3\2"
+ "\2\2\u00e4\u00e5\3\2\2\2\u00e5\u00e3\3\2\2\2\u00e5\u00e6\3\2\2\2\u00e6"
+ "\u00e8\3\2\2\2\u00e7\u00d7\3\2\2\2\u00e7\u00e1\3\2\2\2\u00e8\u00f2\3\2"
+ "\2\2\u00e9\u00eb\t\"\2\2\u00ea\u00ec\t#\2\2\u00eb\u00ea\3\2\2\2\u00eb"
+ "\u00ec\3\2\2\2\u00ec\u00ee\3\2\2\2\u00ed\u00ef\t!\2\2\u00ee\u00ed\3\2"
+ "\2\2\u00ef\u00f0\3\2\2\2\u00f0\u00ee\3\2\2\2\u00f0\u00f1\3\2\2\2\u00f1"
+ "\u00f3\3\2\2\2\u00f2\u00e9\3\2\2\2\u00f2\u00f3\3\2\2\2\u00f3F\3\2\2\2"
+ "\u00f4\u00fd\t\35\2\2\u00f5\u00f9\t$\2\2\u00f6\u00f8\t!\2\2\u00f7\u00f6"
+ "\3\2\2\2\u00f8\u00fb\3\2\2\2\u00f9\u00f7\3\2\2\2\u00f9\u00fa\3\2\2\2\u00fa"
+ "\u00fd\3\2\2\2\u00fb\u00f9\3\2\2\2\u00fc\u00f4\3\2\2\2\u00fc\u00f5\3\2"
+ "\2\2\u00fdH\3\2\2\2\31\2\u008a\u0092\u009a\u009f\u00a5\u00ad\u00b6\u00b8"
+ "\u00c2\u00c4\u00c8\u00ce\u00d5\u00dc\u00df\u00e5\u00e7\u00eb\u00f0\u00f2"
+ "\u00f9\u00fc\3\b\2\2";
public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {

View File

@ -1,122 +1,139 @@
// ANTLR GENERATED CODE: DO NOT EDIT
package org.apache.lucene.expressions.js;
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
/**
* This interface defines a complete generic visitor for a parse tree produced
* by {@link JavascriptParser}.
* This interface defines a complete generic visitor for a parse tree produced by {@link
* JavascriptParser}.
*
* @param <T> The return type of the visit operation. Use {@link Void} for
* operations with no return type.
* @param <T> The return type of the visit operation. Use {@link Void} for operations with no return
* type.
*/
interface JavascriptVisitor<T> extends ParseTreeVisitor<T> {
/**
* Visit a parse tree produced by {@link JavascriptParser#compile}.
*
* @param ctx the parse tree
* @return the visitor result
*/
T visitCompile(JavascriptParser.CompileContext ctx);
/**
* Visit a parse tree produced by the {@code conditional}
* labeled alternative in {@link JavascriptParser#expression}.
* Visit a parse tree produced by the {@code conditional} labeled alternative in {@link
* JavascriptParser#expression}.
*
* @param ctx the parse tree
* @return the visitor result
*/
T visitConditional(JavascriptParser.ConditionalContext ctx);
/**
* Visit a parse tree produced by the {@code boolor}
* labeled alternative in {@link JavascriptParser#expression}.
* Visit a parse tree produced by the {@code boolor} labeled alternative in {@link
* JavascriptParser#expression}.
*
* @param ctx the parse tree
* @return the visitor result
*/
T visitBoolor(JavascriptParser.BoolorContext ctx);
/**
* Visit a parse tree produced by the {@code boolcomp}
* labeled alternative in {@link JavascriptParser#expression}.
* Visit a parse tree produced by the {@code boolcomp} labeled alternative in {@link
* JavascriptParser#expression}.
*
* @param ctx the parse tree
* @return the visitor result
*/
T visitBoolcomp(JavascriptParser.BoolcompContext ctx);
/**
* Visit a parse tree produced by the {@code numeric}
* labeled alternative in {@link JavascriptParser#expression}.
* Visit a parse tree produced by the {@code numeric} labeled alternative in {@link
* JavascriptParser#expression}.
*
* @param ctx the parse tree
* @return the visitor result
*/
T visitNumeric(JavascriptParser.NumericContext ctx);
/**
* Visit a parse tree produced by the {@code addsub}
* labeled alternative in {@link JavascriptParser#expression}.
* Visit a parse tree produced by the {@code addsub} labeled alternative in {@link
* JavascriptParser#expression}.
*
* @param ctx the parse tree
* @return the visitor result
*/
T visitAddsub(JavascriptParser.AddsubContext ctx);
/**
* Visit a parse tree produced by the {@code unary}
* labeled alternative in {@link JavascriptParser#expression}.
* Visit a parse tree produced by the {@code unary} labeled alternative in {@link
* JavascriptParser#expression}.
*
* @param ctx the parse tree
* @return the visitor result
*/
T visitUnary(JavascriptParser.UnaryContext ctx);
/**
* Visit a parse tree produced by the {@code precedence}
* labeled alternative in {@link JavascriptParser#expression}.
* Visit a parse tree produced by the {@code precedence} labeled alternative in {@link
* JavascriptParser#expression}.
*
* @param ctx the parse tree
* @return the visitor result
*/
T visitPrecedence(JavascriptParser.PrecedenceContext ctx);
/**
* Visit a parse tree produced by the {@code muldiv}
* labeled alternative in {@link JavascriptParser#expression}.
* Visit a parse tree produced by the {@code muldiv} labeled alternative in {@link
* JavascriptParser#expression}.
*
* @param ctx the parse tree
* @return the visitor result
*/
T visitMuldiv(JavascriptParser.MuldivContext ctx);
/**
* Visit a parse tree produced by the {@code external}
* labeled alternative in {@link JavascriptParser#expression}.
* Visit a parse tree produced by the {@code external} labeled alternative in {@link
* JavascriptParser#expression}.
*
* @param ctx the parse tree
* @return the visitor result
*/
T visitExternal(JavascriptParser.ExternalContext ctx);
/**
* Visit a parse tree produced by the {@code bwshift}
* labeled alternative in {@link JavascriptParser#expression}.
* Visit a parse tree produced by the {@code bwshift} labeled alternative in {@link
* JavascriptParser#expression}.
*
* @param ctx the parse tree
* @return the visitor result
*/
T visitBwshift(JavascriptParser.BwshiftContext ctx);
/**
* Visit a parse tree produced by the {@code bwor}
* labeled alternative in {@link JavascriptParser#expression}.
* Visit a parse tree produced by the {@code bwor} labeled alternative in {@link
* JavascriptParser#expression}.
*
* @param ctx the parse tree
* @return the visitor result
*/
T visitBwor(JavascriptParser.BworContext ctx);
/**
* Visit a parse tree produced by the {@code booland}
* labeled alternative in {@link JavascriptParser#expression}.
* Visit a parse tree produced by the {@code booland} labeled alternative in {@link
* JavascriptParser#expression}.
*
* @param ctx the parse tree
* @return the visitor result
*/
T visitBooland(JavascriptParser.BoolandContext ctx);
/**
* Visit a parse tree produced by the {@code bwxor}
* labeled alternative in {@link JavascriptParser#expression}.
* Visit a parse tree produced by the {@code bwxor} labeled alternative in {@link
* JavascriptParser#expression}.
*
* @param ctx the parse tree
* @return the visitor result
*/
T visitBwxor(JavascriptParser.BwxorContext ctx);
/**
* Visit a parse tree produced by the {@code bwand}
* labeled alternative in {@link JavascriptParser#expression}.
* Visit a parse tree produced by the {@code bwand} labeled alternative in {@link
* JavascriptParser#expression}.
*
* @param ctx the parse tree
* @return the visitor result
*/
T visitBwand(JavascriptParser.BwandContext ctx);
/**
* Visit a parse tree produced by the {@code booleqne}
* labeled alternative in {@link JavascriptParser#expression}.
* Visit a parse tree produced by the {@code booleqne} labeled alternative in {@link
* JavascriptParser#expression}.
*
* @param ctx the parse tree
* @return the visitor result
*/

View File

@ -14,7 +14,7 @@ io.sgr:s2-geometry-library-java=1.0.0
javax.servlet:javax.servlet-api=3.1.0
junit:junit=4.13.1
net.sourceforge.nekohtml:nekohtml=1.9.17
org.antlr:antlr4-runtime=4.5.1-1
org.antlr:antlr4*=4.5.1-1
org.apache.commons:commons-compress=1.19
org.apache.httpcomponents:httpclient=4.5.13
org.apache.httpcomponents:httpcore=4.4.13