Painless: Add support for /regex/

Adds `/regex/` as a regex constructor. A couple of fun points:
1. This makes generic the idea of arbitrary stuff adding a constant.
Both SFunction and LRegex create a statically initialized constant.
Both go through Locals to do this because they LRegex isn't directly
iterable from SScript.
2. Differentiating `/` as-in-division from `/` as-in-start-of-regex
is hard. See:
http://www-archive.mozilla.org/js/language/js20-2002-04/rationale/syntax.html#regular-expressions
The javascript folks have a way, way tougher time of it then we do
because they have semicolon insertion. We have the much simpler
delimiter rules. Even with our simpler life we still have to add
a hack to get lexing `/regex/` to work properly. I chose to add
token-level lookbehind because it seems to be a pretty contained hack.
I considered and rejected lexer modes, a lexer member variable,
having the parser set variables on the lexer (this is a fairly common
solution for js, I believe), and moving regex parsing to the parser
level.
3. I've only added a very small subset of java.util.regex to the
whitelist because it is the subset I needed to test LRegex sanely.
More deserves to be added, and maybe more regex syntax like `=~` and
`==~`. Those can probably be added without too much pain.
This commit is contained in:
Nik Everett 2016-06-12 23:07:13 -04:00
parent f132959c38
commit 6617b53422
22 changed files with 838 additions and 360 deletions

View File

@ -56,7 +56,7 @@ THIS: 'this';
BOOLNOT: '!';
BWNOT: '~';
MUL: '*';
DIV: '/';
DIV: '/' { false == SlashStrategy.slashIsRegex(_factory) }?;
REM: '%';
ADD: '+';
SUB: '-';
@ -102,6 +102,7 @@ INTEGER: ( '0' | [1-9] [0-9]* ) [lLfFdD]?;
DECIMAL: ( '0' | [1-9] [0-9]* ) (DOT [0-9]+)? ( [eE] [+\-]? [0-9]+ )? [fF]?;
STRING: ( '"' ( '\\"' | '\\\\' | ~[\\"] )*? '"' ) | ( '\'' ( '\\\'' | '\\\\' | ~[\\"] )*? '\'' );
REGEX: '/' ( ~('/' | '\n') | '\\' ~'\n' )+ '/' { SlashStrategy.slashIsRegex(_factory) }?;
TRUE: 'true';
FALSE: 'false';

View File

@ -68,13 +68,14 @@ HEX=67
INTEGER=68
DECIMAL=69
STRING=70
TRUE=71
FALSE=72
NULL=73
TYPE=74
ID=75
DOTINTEGER=76
DOTID=77
REGEX=71
TRUE=72
FALSE=73
NULL=74
TYPE=75
ID=76
DOTINTEGER=77
DOTID=78
'{'=3
'}'=4
'['=5
@ -138,6 +139,6 @@ DOTID=77
'<<='=63
'>>='=64
'>>>='=65
'true'=71
'false'=72
'null'=73
'true'=72
'false'=73
'null'=74

View File

@ -157,6 +157,7 @@ primary[boolean c] returns [boolean s = true]
: { !$c }? LP e = expression RP { $s = $e.s; } # exprprec
| { $c }? LP unary[true] RP # chainprec
| STRING # string
| REGEX # regex
| ID # variable
| ID arguments # calllocal
| NEW TYPE arguments # newobject

View File

@ -68,13 +68,14 @@ HEX=67
INTEGER=68
DECIMAL=69
STRING=70
TRUE=71
FALSE=72
NULL=73
TYPE=74
ID=75
DOTINTEGER=76
DOTID=77
REGEX=71
TRUE=72
FALSE=73
NULL=74
TYPE=75
ID=76
DOTINTEGER=77
DOTID=78
'{'=3
'}'=4
'['=5
@ -138,6 +139,6 @@ DOTID=77
'<<='=63
'>>='=64
'>>>='=65
'true'=71
'false'=72
'null'=73
'true'=72
'false'=73
'null'=74

View File

@ -59,6 +59,7 @@ public final class Definition {
"java.time.zone.txt",
"java.util.txt",
"java.util.function.txt",
"java.util.regex.txt",
"java.util.stream.txt",
"joda.time.txt"));

View File

@ -24,11 +24,14 @@ import org.elasticsearch.painless.Definition.MethodKey;
import org.elasticsearch.painless.Definition.Type;
import java.util.ArrayDeque;
import java.util.Collection;
import java.util.Collections;
import java.util.Deque;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
/**
* Tracks user defined methods and variables across compilation phases.
@ -140,6 +143,20 @@ public final class Locals {
}
}
public static final class Constant {
public final Location location;
public final String name;
public final org.objectweb.asm.Type type;
public final Consumer<MethodWriter> initializer;
private Constant(Location location, String name, org.objectweb.asm.Type type, Consumer<MethodWriter> initializer) {
this.location = location;
this.name = name;
this.type = type;
this.initializer = initializer;
}
}
public static final class Parameter {
public final Location location;
public final String name;
@ -154,6 +171,7 @@ public final class Locals {
private final Reserved reserved;
private final Map<MethodKey, Method> methods;
private final Map<String, Constant> constants;
private final Type rtnType;
// TODO: this datastructure runs in linear time for nearly all operations. use linkedhashset instead?
@ -163,6 +181,7 @@ public final class Locals {
public Locals(ExecuteReserved reserved, Map<MethodKey, Method> methods) {
this.reserved = reserved;
this.methods = Collections.unmodifiableMap(methods);
this.constants = new HashMap<>();
this.rtnType = Definition.OBJECT_TYPE;
incrementScope();
@ -205,6 +224,7 @@ public final class Locals {
public Locals(FunctionReserved reserved, Locals locals, Type rtnType, List<Parameter> parameters) {
this.reserved = reserved;
this.methods = locals.methods;
this.constants = locals.constants;
this.rtnType = rtnType;
incrementScope();
@ -302,5 +322,43 @@ public final class Locals {
return variable;
}
/**
* Create a new constant.
*
* @param location the location in the script that is creating it
* @param type the type of the constant
* @param name the name of the constant
* @param initializer code to initialize the constant. It will be called when generating the clinit method and is expected to leave the
* value of the constant on the stack. Generating the load instruction is managed by the caller.
* @return the constant
*/
public Constant addConstant(Location location, org.objectweb.asm.Type type, String name, Consumer<MethodWriter> initializer) {
if (constants.containsKey(name)) {
throw location.createError(new IllegalArgumentException("Constant [" + name + "] is already defined."));
}
Constant constant = new Constant(location, name, type, initializer);
constants.put(name, constant);
return constant;
}
/**
* Create a new constant.
*
* @param location the location in the script that is creating it
* @param type the type of the constant
* @param name the name of the constant
* @param initializer code to initialize the constant. It will be called when generating the clinit method and is expected to leave the
* value of the constant on the stack. Generating the load instruction is managed by the caller.
* @return the constant
*/
public Constant addConstant(Location location, Type type, String name, Consumer<MethodWriter> initializer) {
return addConstant(location, type.type, name, initializer);
}
public Collection<Constant> getConstants() {
return constants.values();
}
}

View File

@ -34,6 +34,7 @@ import java.lang.invoke.MethodType;
import java.util.BitSet;
import java.util.Iterator;
import java.util.Map;
import java.util.regex.Pattern;
/**
* General pool of constants used during the writing phase of compilation.
@ -70,6 +71,14 @@ public final class WriterConstants {
public final static Type METHOD_HANDLE_TYPE = Type.getType(MethodHandle.class);
/**
* A Method instance for {@linkplain Pattern#compile}. This isn't looked up from Definition because we intentionally don't add it there
* so that the script can't create regexes without this syntax. Essentially, our static regex syntax has a monopoly on building regexes
* because it can do it statically. This is both faster and prevents the script from doing something super slow like building a regex
* per time it is run.
*/
public final static Method PATTERN_COMPILE = getAsmMethod(Pattern.class, "compile", String.class);
/** dynamic callsite bootstrap signature */
public final static MethodType DEF_BOOTSTRAP_TYPE =
MethodType.methodType(CallSite.class, MethodHandles.Lookup.class, String.class, MethodType.class, int.class, Object[].class);

View File

@ -33,6 +33,8 @@ final class ErrorHandlingLexer extends PainlessLexer {
ErrorHandlingLexer(CharStream charStream, String sourceName) {
super(charStream);
this.sourceName = sourceName;
// Replace the TokenFactory with a stashing wrapper so we can do token-level lookbehind for regex detection
_factory = new StashingTokenFactory<>(_factory);
}
@Override

View File

@ -28,8 +28,8 @@ class PainlessLexer extends Lexer {
XOR=44, BWOR=45, BOOLAND=46, BOOLOR=47, COND=48, COLON=49, REF=50, ARROW=51,
INCR=52, DECR=53, ASSIGN=54, AADD=55, ASUB=56, AMUL=57, ADIV=58, AREM=59,
AAND=60, AXOR=61, AOR=62, ALSH=63, ARSH=64, AUSH=65, OCTAL=66, HEX=67,
INTEGER=68, DECIMAL=69, STRING=70, TRUE=71, FALSE=72, NULL=73, TYPE=74,
ID=75, DOTINTEGER=76, DOTID=77;
INTEGER=68, DECIMAL=69, STRING=70, REGEX=71, TRUE=72, FALSE=73, NULL=74,
TYPE=75, ID=76, DOTINTEGER=77, DOTID=78;
public static final int AFTER_DOT = 1;
public static String[] modeNames = {
"DEFAULT_MODE", "AFTER_DOT"
@ -44,7 +44,7 @@ class PainlessLexer extends Lexer {
"BOOLAND", "BOOLOR", "COND", "COLON", "REF", "ARROW", "INCR", "DECR",
"ASSIGN", "AADD", "ASUB", "AMUL", "ADIV", "AREM", "AAND", "AXOR", "AOR",
"ALSH", "ARSH", "AUSH", "OCTAL", "HEX", "INTEGER", "DECIMAL", "STRING",
"TRUE", "FALSE", "NULL", "TYPE", "ID", "DOTINTEGER", "DOTID"
"REGEX", "TRUE", "FALSE", "NULL", "TYPE", "ID", "DOTINTEGER", "DOTID"
};
private static final String[] _LITERAL_NAMES = {
@ -55,7 +55,7 @@ class PainlessLexer extends Lexer {
"'>'", "'>='", "'=='", "'==='", "'!='", "'!=='", "'&'", "'^'", "'|'",
"'&&'", "'||'", "'?'", "':'", "'::'", "'->'", "'++'", "'--'", "'='", "'+='",
"'-='", "'*='", "'/='", "'%='", "'&='", "'^='", "'|='", "'<<='", "'>>='",
"'>>>='", null, null, null, null, null, "'true'", "'false'", "'null'"
"'>>>='", null, null, null, null, null, null, "'true'", "'false'", "'null'"
};
private static final String[] _SYMBOLIC_NAMES = {
null, "WS", "COMMENT", "LBRACK", "RBRACK", "LBRACE", "RBRACE", "LP", "RP",
@ -66,7 +66,7 @@ class PainlessLexer extends Lexer {
"BOOLAND", "BOOLOR", "COND", "COLON", "REF", "ARROW", "INCR", "DECR",
"ASSIGN", "AADD", "ASUB", "AMUL", "ADIV", "AREM", "AAND", "AXOR", "AOR",
"ALSH", "ARSH", "AUSH", "OCTAL", "HEX", "INTEGER", "DECIMAL", "STRING",
"TRUE", "FALSE", "NULL", "TYPE", "ID", "DOTINTEGER", "DOTID"
"REGEX", "TRUE", "FALSE", "NULL", "TYPE", "ID", "DOTINTEGER", "DOTID"
};
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
@ -125,21 +125,39 @@ class PainlessLexer extends Lexer {
@Override
public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) {
switch (ruleIndex) {
case 73:
case 27:
return DIV_sempred((RuleContext)_localctx, predIndex);
case 70:
return REGEX_sempred((RuleContext)_localctx, predIndex);
case 74:
return TYPE_sempred((RuleContext)_localctx, predIndex);
}
return true;
}
private boolean DIV_sempred(RuleContext _localctx, int predIndex) {
switch (predIndex) {
case 0:
return false == SlashStrategy.slashIsRegex(_factory) ;
}
return true;
}
private boolean REGEX_sempred(RuleContext _localctx, int predIndex) {
switch (predIndex) {
case 1:
return SlashStrategy.slashIsRegex(_factory) ;
}
return true;
}
private boolean TYPE_sempred(RuleContext _localctx, int predIndex) {
switch (predIndex) {
case 0:
case 2:
return Definition.isSimpleType(getText()) ;
}
return true;
}
public static final String _serializedATN =
"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\2O\u021a\b\1\b\1\4"+
"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\2P\u0228\b\1\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"+
@ -148,184 +166,190 @@ class PainlessLexer extends Lexer {
"+\4,\t,\4-\t-\4.\t.\4/\t/\4\60\t\60\4\61\t\61\4\62\t\62\4\63\t\63\4\64"+
"\t\64\4\65\t\65\4\66\t\66\4\67\t\67\48\t8\49\t9\4:\t:\4;\t;\4<\t<\4=\t"+
"=\4>\t>\4?\t?\4@\t@\4A\tA\4B\tB\4C\tC\4D\tD\4E\tE\4F\tF\4G\tG\4H\tH\4"+
"I\tI\4J\tJ\4K\tK\4L\tL\4M\tM\4N\tN\3\2\6\2\u00a0\n\2\r\2\16\2\u00a1\3"+
"\2\3\2\3\3\3\3\3\3\3\3\7\3\u00aa\n\3\f\3\16\3\u00ad\13\3\3\3\3\3\3\3\3"+
"\3\3\3\7\3\u00b4\n\3\f\3\16\3\u00b7\13\3\3\3\3\3\5\3\u00bb\n\3\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\n\3\n\3\13"+
"I\tI\4J\tJ\4K\tK\4L\tL\4M\tM\4N\tN\4O\tO\3\2\6\2\u00a2\n\2\r\2\16\2\u00a3"+
"\3\2\3\2\3\3\3\3\3\3\3\3\7\3\u00ac\n\3\f\3\16\3\u00af\13\3\3\3\3\3\3\3"+
"\3\3\3\3\7\3\u00b6\n\3\f\3\16\3\u00b9\13\3\3\3\3\3\5\3\u00bd\n\3\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\n\3\n\3\13"+
"\3\13\3\f\3\f\3\r\3\r\3\r\3\16\3\16\3\16\3\16\3\16\3\17\3\17\3\17\3\17"+
"\3\17\3\17\3\20\3\20\3\20\3\21\3\21\3\21\3\21\3\22\3\22\3\22\3\22\3\22"+
"\3\22\3\22\3\22\3\22\3\23\3\23\3\23\3\23\3\23\3\23\3\24\3\24\3\24\3\24"+
"\3\24\3\24\3\24\3\25\3\25\3\25\3\25\3\26\3\26\3\26\3\26\3\27\3\27\3\27"+
"\3\27\3\27\3\27\3\30\3\30\3\30\3\30\3\30\3\30\3\31\3\31\3\31\3\31\3\31"+
"\3\32\3\32\3\33\3\33\3\34\3\34\3\35\3\35\3\36\3\36\3\37\3\37\3 \3 \3!"+
"\3!\3!\3\"\3\"\3\"\3#\3#\3#\3#\3$\3$\3%\3%\3%\3&\3&\3\'\3\'\3\'\3(\3("+
"\3(\3)\3)\3)\3)\3*\3*\3*\3+\3+\3+\3+\3,\3,\3-\3-\3.\3.\3/\3/\3/\3\60\3"+
"\60\3\60\3\61\3\61\3\62\3\62\3\63\3\63\3\63\3\64\3\64\3\64\3\65\3\65\3"+
"\65\3\66\3\66\3\66\3\67\3\67\38\38\38\39\39\39\3:\3:\3:\3;\3;\3;\3<\3"+
"<\3<\3=\3=\3=\3>\3>\3>\3?\3?\3?\3@\3@\3@\3@\3A\3A\3A\3A\3B\3B\3B\3B\3"+
"B\3C\3C\6C\u018c\nC\rC\16C\u018d\3C\5C\u0191\nC\3D\3D\3D\6D\u0196\nD\r"+
"D\16D\u0197\3D\5D\u019b\nD\3E\3E\3E\7E\u01a0\nE\fE\16E\u01a3\13E\5E\u01a5"+
"\nE\3E\5E\u01a8\nE\3F\3F\3F\7F\u01ad\nF\fF\16F\u01b0\13F\5F\u01b2\nF\3"+
"F\3F\6F\u01b6\nF\rF\16F\u01b7\5F\u01ba\nF\3F\3F\5F\u01be\nF\3F\6F\u01c1"+
"\nF\rF\16F\u01c2\5F\u01c5\nF\3F\5F\u01c8\nF\3G\3G\3G\3G\3G\3G\7G\u01d0"+
"\nG\fG\16G\u01d3\13G\3G\3G\3G\3G\3G\3G\3G\7G\u01dc\nG\fG\16G\u01df\13"+
"G\3G\5G\u01e2\nG\3H\3H\3H\3H\3H\3I\3I\3I\3I\3I\3I\3J\3J\3J\3J\3J\3K\3"+
"K\3K\3K\7K\u01f8\nK\fK\16K\u01fb\13K\3K\3K\3L\3L\7L\u0201\nL\fL\16L\u0204"+
"\13L\3M\3M\3M\7M\u0209\nM\fM\16M\u020c\13M\5M\u020e\nM\3M\3M\3N\3N\7N"+
"\u0214\nN\fN\16N\u0217\13N\3N\3N\6\u00ab\u00b5\u01d1\u01dd\2O\4\3\6\4"+
"\b\5\n\6\f\7\16\b\20\t\22\n\24\13\26\f\30\r\32\16\34\17\36\20 \21\"\22"+
"$\23&\24(\25*\26,\27.\30\60\31\62\32\64\33\66\348\35:\36<\37> @!B\"D#"+
"F$H%J&L\'N(P)R*T+V,X-Z.\\/^\60`\61b\62d\63f\64h\65j\66l\67n8p9r:t;v<x"+
"=z>|?~@\u0080A\u0082B\u0084C\u0086D\u0088E\u008aF\u008cG\u008eH\u0090"+
"I\u0092J\u0094K\u0096L\u0098M\u009aN\u009cO\4\2\3\21\5\2\13\f\17\17\""+
"\"\4\2\f\f\17\17\3\2\629\4\2NNnn\4\2ZZzz\5\2\62;CHch\3\2\63;\3\2\62;\b"+
"\2FFHHNNffhhnn\4\2GGgg\4\2--//\4\2HHhh\4\2$$^^\5\2C\\aac|\6\2\62;C\\a"+
"ac|\u0237\2\4\3\2\2\2\2\6\3\2\2\2\2\b\3\2\2\2\2\n\3\2\2\2\2\f\3\2\2\2"+
"\2\16\3\2\2\2\2\20\3\2\2\2\2\22\3\2\2\2\2\24\3\2\2\2\2\26\3\2\2\2\2\30"+
"\3\2\2\2\2\32\3\2\2\2\2\34\3\2\2\2\2\36\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\60"+
"\3\2\2\2\2\62\3\2\2\2\2\64\3\2\2\2\2\66\3\2\2\2\28\3\2\2\2\2:\3\2\2\2"+
"\2<\3\2\2\2\2>\3\2\2\2\2@\3\2\2\2\2B\3\2\2\2\2D\3\2\2\2\2F\3\2\2\2\2H"+
"\3\2\2\2\2J\3\2\2\2\2L\3\2\2\2\2N\3\2\2\2\2P\3\2\2\2\2R\3\2\2\2\2T\3\2"+
"\2\2\2V\3\2\2\2\2X\3\2\2\2\2Z\3\2\2\2\2\\\3\2\2\2\2^\3\2\2\2\2`\3\2\2"+
"\2\2b\3\2\2\2\2d\3\2\2\2\2f\3\2\2\2\2h\3\2\2\2\2j\3\2\2\2\2l\3\2\2\2\2"+
"n\3\2\2\2\2p\3\2\2\2\2r\3\2\2\2\2t\3\2\2\2\2v\3\2\2\2\2x\3\2\2\2\2z\3"+
"\2\2\2\2|\3\2\2\2\2~\3\2\2\2\2\u0080\3\2\2\2\2\u0082\3\2\2\2\2\u0084\3"+
"\2\2\2\2\u0086\3\2\2\2\2\u0088\3\2\2\2\2\u008a\3\2\2\2\2\u008c\3\2\2\2"+
"\2\u008e\3\2\2\2\2\u0090\3\2\2\2\2\u0092\3\2\2\2\2\u0094\3\2\2\2\2\u0096"+
"\3\2\2\2\2\u0098\3\2\2\2\3\u009a\3\2\2\2\3\u009c\3\2\2\2\4\u009f\3\2\2"+
"\2\6\u00ba\3\2\2\2\b\u00be\3\2\2\2\n\u00c0\3\2\2\2\f\u00c2\3\2\2\2\16"+
"\u00c4\3\2\2\2\20\u00c6\3\2\2\2\22\u00c8\3\2\2\2\24\u00ca\3\2\2\2\26\u00ce"+
"\3\2\2\2\30\u00d0\3\2\2\2\32\u00d2\3\2\2\2\34\u00d5\3\2\2\2\36\u00da\3"+
"\2\2\2 \u00e0\3\2\2\2\"\u00e3\3\2\2\2$\u00e7\3\2\2\2&\u00f0\3\2\2\2(\u00f6"+
"\3\2\2\2*\u00fd\3\2\2\2,\u0101\3\2\2\2.\u0105\3\2\2\2\60\u010b\3\2\2\2"+
"\62\u0111\3\2\2\2\64\u0116\3\2\2\2\66\u0118\3\2\2\28\u011a\3\2\2\2:\u011c"+
"\3\2\2\2<\u011e\3\2\2\2>\u0120\3\2\2\2@\u0122\3\2\2\2B\u0124\3\2\2\2D"+
"\u0127\3\2\2\2F\u012a\3\2\2\2H\u012e\3\2\2\2J\u0130\3\2\2\2L\u0133\3\2"+
"\2\2N\u0135\3\2\2\2P\u0138\3\2\2\2R\u013b\3\2\2\2T\u013f\3\2\2\2V\u0142"+
"\3\2\2\2X\u0146\3\2\2\2Z\u0148\3\2\2\2\\\u014a\3\2\2\2^\u014c\3\2\2\2"+
"`\u014f\3\2\2\2b\u0152\3\2\2\2d\u0154\3\2\2\2f\u0156\3\2\2\2h\u0159\3"+
"\2\2\2j\u015c\3\2\2\2l\u015f\3\2\2\2n\u0162\3\2\2\2p\u0164\3\2\2\2r\u0167"+
"\3\2\2\2t\u016a\3\2\2\2v\u016d\3\2\2\2x\u0170\3\2\2\2z\u0173\3\2\2\2|"+
"\u0176\3\2\2\2~\u0179\3\2\2\2\u0080\u017c\3\2\2\2\u0082\u0180\3\2\2\2"+
"\u0084\u0184\3\2\2\2\u0086\u0189\3\2\2\2\u0088\u0192\3\2\2\2\u008a\u01a4"+
"\3\2\2\2\u008c\u01b1\3\2\2\2\u008e\u01e1\3\2\2\2\u0090\u01e3\3\2\2\2\u0092"+
"\u01e8\3\2\2\2\u0094\u01ee\3\2\2\2\u0096\u01f3\3\2\2\2\u0098\u01fe\3\2"+
"\2\2\u009a\u020d\3\2\2\2\u009c\u0211\3\2\2\2\u009e\u00a0\t\2\2\2\u009f"+
"\u009e\3\2\2\2\u00a0\u00a1\3\2\2\2\u00a1\u009f\3\2\2\2\u00a1\u00a2\3\2"+
"\2\2\u00a2\u00a3\3\2\2\2\u00a3\u00a4\b\2\2\2\u00a4\5\3\2\2\2\u00a5\u00a6"+
"\7\61\2\2\u00a6\u00a7\7\61\2\2\u00a7\u00ab\3\2\2\2\u00a8\u00aa\13\2\2"+
"\2\u00a9\u00a8\3\2\2\2\u00aa\u00ad\3\2\2\2\u00ab\u00ac\3\2\2\2\u00ab\u00a9"+
"\3\2\2\2\u00ac\u00ae\3\2\2\2\u00ad\u00ab\3\2\2\2\u00ae\u00bb\t\3\2\2\u00af"+
"\u00b0\7\61\2\2\u00b0\u00b1\7,\2\2\u00b1\u00b5\3\2\2\2\u00b2\u00b4\13"+
"\2\2\2\u00b3\u00b2\3\2\2\2\u00b4\u00b7\3\2\2\2\u00b5\u00b6\3\2\2\2\u00b5"+
"\u00b3\3\2\2\2\u00b6\u00b8\3\2\2\2\u00b7\u00b5\3\2\2\2\u00b8\u00b9\7,"+
"\2\2\u00b9\u00bb\7\61\2\2\u00ba\u00a5\3\2\2\2\u00ba\u00af\3\2\2\2\u00bb"+
"\u00bc\3\2\2\2\u00bc\u00bd\b\3\2\2\u00bd\7\3\2\2\2\u00be\u00bf\7}\2\2"+
"\u00bf\t\3\2\2\2\u00c0\u00c1\7\177\2\2\u00c1\13\3\2\2\2\u00c2\u00c3\7"+
"]\2\2\u00c3\r\3\2\2\2\u00c4\u00c5\7_\2\2\u00c5\17\3\2\2\2\u00c6\u00c7"+
"\7*\2\2\u00c7\21\3\2\2\2\u00c8\u00c9\7+\2\2\u00c9\23\3\2\2\2\u00ca\u00cb"+
"\7\60\2\2\u00cb\u00cc\3\2\2\2\u00cc\u00cd\b\n\3\2\u00cd\25\3\2\2\2\u00ce"+
"\u00cf\7.\2\2\u00cf\27\3\2\2\2\u00d0\u00d1\7=\2\2\u00d1\31\3\2\2\2\u00d2"+
"\u00d3\7k\2\2\u00d3\u00d4\7h\2\2\u00d4\33\3\2\2\2\u00d5\u00d6\7g\2\2\u00d6"+
"\u00d7\7n\2\2\u00d7\u00d8\7u\2\2\u00d8\u00d9\7g\2\2\u00d9\35\3\2\2\2\u00da"+
"\u00db\7y\2\2\u00db\u00dc\7j\2\2\u00dc\u00dd\7k\2\2\u00dd\u00de\7n\2\2"+
"\u00de\u00df\7g\2\2\u00df\37\3\2\2\2\u00e0\u00e1\7f\2\2\u00e1\u00e2\7"+
"q\2\2\u00e2!\3\2\2\2\u00e3\u00e4\7h\2\2\u00e4\u00e5\7q\2\2\u00e5\u00e6"+
"\7t\2\2\u00e6#\3\2\2\2\u00e7\u00e8\7e\2\2\u00e8\u00e9\7q\2\2\u00e9\u00ea"+
"\7p\2\2\u00ea\u00eb\7v\2\2\u00eb\u00ec\7k\2\2\u00ec\u00ed\7p\2\2\u00ed"+
"\u00ee\7w\2\2\u00ee\u00ef\7g\2\2\u00ef%\3\2\2\2\u00f0\u00f1\7d\2\2\u00f1"+
"\u00f2\7t\2\2\u00f2\u00f3\7g\2\2\u00f3\u00f4\7c\2\2\u00f4\u00f5\7m\2\2"+
"\u00f5\'\3\2\2\2\u00f6\u00f7\7t\2\2\u00f7\u00f8\7g\2\2\u00f8\u00f9\7v"+
"\2\2\u00f9\u00fa\7w\2\2\u00fa\u00fb\7t\2\2\u00fb\u00fc\7p\2\2\u00fc)\3"+
"\2\2\2\u00fd\u00fe\7p\2\2\u00fe\u00ff\7g\2\2\u00ff\u0100\7y\2\2\u0100"+
"+\3\2\2\2\u0101\u0102\7v\2\2\u0102\u0103\7t\2\2\u0103\u0104\7{\2\2\u0104"+
"-\3\2\2\2\u0105\u0106\7e\2\2\u0106\u0107\7c\2\2\u0107\u0108\7v\2\2\u0108"+
"\u0109\7e\2\2\u0109\u010a\7j\2\2\u010a/\3\2\2\2\u010b\u010c\7v\2\2\u010c"+
"\u010d\7j\2\2\u010d\u010e\7t\2\2\u010e\u010f\7q\2\2\u010f\u0110\7y\2\2"+
"\u0110\61\3\2\2\2\u0111\u0112\7v\2\2\u0112\u0113\7j\2\2\u0113\u0114\7"+
"k\2\2\u0114\u0115\7u\2\2\u0115\63\3\2\2\2\u0116\u0117\7#\2\2\u0117\65"+
"\3\2\2\2\u0118\u0119\7\u0080\2\2\u0119\67\3\2\2\2\u011a\u011b\7,\2\2\u011b"+
"9\3\2\2\2\u011c\u011d\7\61\2\2\u011d;\3\2\2\2\u011e\u011f\7\'\2\2\u011f"+
"=\3\2\2\2\u0120\u0121\7-\2\2\u0121?\3\2\2\2\u0122\u0123\7/\2\2\u0123A"+
"\3\2\2\2\u0124\u0125\7>\2\2\u0125\u0126\7>\2\2\u0126C\3\2\2\2\u0127\u0128"+
"\7@\2\2\u0128\u0129\7@\2\2\u0129E\3\2\2\2\u012a\u012b\7@\2\2\u012b\u012c"+
"\7@\2\2\u012c\u012d\7@\2\2\u012dG\3\2\2\2\u012e\u012f\7>\2\2\u012fI\3"+
"\2\2\2\u0130\u0131\7>\2\2\u0131\u0132\7?\2\2\u0132K\3\2\2\2\u0133\u0134"+
"\7@\2\2\u0134M\3\2\2\2\u0135\u0136\7@\2\2\u0136\u0137\7?\2\2\u0137O\3"+
"\2\2\2\u0138\u0139\7?\2\2\u0139\u013a\7?\2\2\u013aQ\3\2\2\2\u013b\u013c"+
"\7?\2\2\u013c\u013d\7?\2\2\u013d\u013e\7?\2\2\u013eS\3\2\2\2\u013f\u0140"+
"\7#\2\2\u0140\u0141\7?\2\2\u0141U\3\2\2\2\u0142\u0143\7#\2\2\u0143\u0144"+
"\7?\2\2\u0144\u0145\7?\2\2\u0145W\3\2\2\2\u0146\u0147\7(\2\2\u0147Y\3"+
"\2\2\2\u0148\u0149\7`\2\2\u0149[\3\2\2\2\u014a\u014b\7~\2\2\u014b]\3\2"+
"\2\2\u014c\u014d\7(\2\2\u014d\u014e\7(\2\2\u014e_\3\2\2\2\u014f\u0150"+
"\7~\2\2\u0150\u0151\7~\2\2\u0151a\3\2\2\2\u0152\u0153\7A\2\2\u0153c\3"+
"\2\2\2\u0154\u0155\7<\2\2\u0155e\3\2\2\2\u0156\u0157\7<\2\2\u0157\u0158"+
"\7<\2\2\u0158g\3\2\2\2\u0159\u015a\7/\2\2\u015a\u015b\7@\2\2\u015bi\3"+
"\2\2\2\u015c\u015d\7-\2\2\u015d\u015e\7-\2\2\u015ek\3\2\2\2\u015f\u0160"+
"\7/\2\2\u0160\u0161\7/\2\2\u0161m\3\2\2\2\u0162\u0163\7?\2\2\u0163o\3"+
"\2\2\2\u0164\u0165\7-\2\2\u0165\u0166\7?\2\2\u0166q\3\2\2\2\u0167\u0168"+
"\7/\2\2\u0168\u0169\7?\2\2\u0169s\3\2\2\2\u016a\u016b\7,\2\2\u016b\u016c"+
"\7?\2\2\u016cu\3\2\2\2\u016d\u016e\7\61\2\2\u016e\u016f\7?\2\2\u016fw"+
"\3\2\2\2\u0170\u0171\7\'\2\2\u0171\u0172\7?\2\2\u0172y\3\2\2\2\u0173\u0174"+
"\7(\2\2\u0174\u0175\7?\2\2\u0175{\3\2\2\2\u0176\u0177\7`\2\2\u0177\u0178"+
"\7?\2\2\u0178}\3\2\2\2\u0179\u017a\7~\2\2\u017a\u017b\7?\2\2\u017b\177"+
"\3\2\2\2\u017c\u017d\7>\2\2\u017d\u017e\7>\2\2\u017e\u017f\7?\2\2\u017f"+
"\u0081\3\2\2\2\u0180\u0181\7@\2\2\u0181\u0182\7@\2\2\u0182\u0183\7?\2"+
"\2\u0183\u0083\3\2\2\2\u0184\u0185\7@\2\2\u0185\u0186\7@\2\2\u0186\u0187"+
"\7@\2\2\u0187\u0188\7?\2\2\u0188\u0085\3\2\2\2\u0189\u018b\7\62\2\2\u018a"+
"\u018c\t\4\2\2\u018b\u018a\3\2\2\2\u018c\u018d\3\2\2\2\u018d\u018b\3\2"+
"\2\2\u018d\u018e\3\2\2\2\u018e\u0190\3\2\2\2\u018f\u0191\t\5\2\2\u0190"+
"\u018f\3\2\2\2\u0190\u0191\3\2\2\2\u0191\u0087\3\2\2\2\u0192\u0193\7\62"+
"\2\2\u0193\u0195\t\6\2\2\u0194\u0196\t\7\2\2\u0195\u0194\3\2\2\2\u0196"+
"\u0197\3\2\2\2\u0197\u0195\3\2\2\2\u0197\u0198\3\2\2\2\u0198\u019a\3\2"+
"\2\2\u0199\u019b\t\5\2\2\u019a\u0199\3\2\2\2\u019a\u019b\3\2\2\2\u019b"+
"\u0089\3\2\2\2\u019c\u01a5\7\62\2\2\u019d\u01a1\t\b\2\2\u019e\u01a0\t"+
"\t\2\2\u019f\u019e\3\2\2\2\u01a0\u01a3\3\2\2\2\u01a1\u019f\3\2\2\2\u01a1"+
"\u01a2\3\2\2\2\u01a2\u01a5\3\2\2\2\u01a3\u01a1\3\2\2\2\u01a4\u019c\3\2"+
"\2\2\u01a4\u019d\3\2\2\2\u01a5\u01a7\3\2\2\2\u01a6\u01a8\t\n\2\2\u01a7"+
"\u01a6\3\2\2\2\u01a7\u01a8\3\2\2\2\u01a8\u008b\3\2\2\2\u01a9\u01b2\7\62"+
"\2\2\u01aa\u01ae\t\b\2\2\u01ab\u01ad\t\t\2\2\u01ac\u01ab\3\2\2\2\u01ad"+
"\u01b0\3\2\2\2\u01ae\u01ac\3\2\2\2\u01ae\u01af\3\2\2\2\u01af\u01b2\3\2"+
"\2\2\u01b0\u01ae\3\2\2\2\u01b1\u01a9\3\2\2\2\u01b1\u01aa\3\2\2\2\u01b2"+
"\u01b9\3\2\2\2\u01b3\u01b5\5\24\n\2\u01b4\u01b6\t\t\2\2\u01b5\u01b4\3"+
"\2\2\2\u01b6\u01b7\3\2\2\2\u01b7\u01b5\3\2\2\2\u01b7\u01b8\3\2\2\2\u01b8"+
"\u01ba\3\2\2\2\u01b9\u01b3\3\2\2\2\u01b9\u01ba\3\2\2\2\u01ba\u01c4\3\2"+
"\2\2\u01bb\u01bd\t\13\2\2\u01bc\u01be\t\f\2\2\u01bd\u01bc\3\2\2\2\u01bd"+
"\u01be\3\2\2\2\u01be\u01c0\3\2\2\2\u01bf\u01c1\t\t\2\2\u01c0\u01bf\3\2"+
"\2\2\u01c1\u01c2\3\2\2\2\u01c2\u01c0\3\2\2\2\u01c2\u01c3\3\2\2\2\u01c3"+
"\u01c5\3\2\2\2\u01c4\u01bb\3\2\2\2\u01c4\u01c5\3\2\2\2\u01c5\u01c7\3\2"+
"\2\2\u01c6\u01c8\t\r\2\2\u01c7\u01c6\3\2\2\2\u01c7\u01c8\3\2\2\2\u01c8"+
"\u008d\3\2\2\2\u01c9\u01d1\7$\2\2\u01ca\u01cb\7^\2\2\u01cb\u01d0\7$\2"+
"\2\u01cc\u01cd\7^\2\2\u01cd\u01d0\7^\2\2\u01ce\u01d0\n\16\2\2\u01cf\u01ca"+
"\3\2\2\2\u01cf\u01cc\3\2\2\2\u01cf\u01ce\3\2\2\2\u01d0\u01d3\3\2\2\2\u01d1"+
"\u01d2\3\2\2\2\u01d1\u01cf\3\2\2\2\u01d2\u01d4\3\2\2\2\u01d3\u01d1\3\2"+
"\2\2\u01d4\u01e2\7$\2\2\u01d5\u01dd\7)\2\2\u01d6\u01d7\7^\2\2\u01d7\u01dc"+
"\7)\2\2\u01d8\u01d9\7^\2\2\u01d9\u01dc\7^\2\2\u01da\u01dc\n\16\2\2\u01db"+
"\u01d6\3\2\2\2\u01db\u01d8\3\2\2\2\u01db\u01da\3\2\2\2\u01dc\u01df\3\2"+
"\2\2\u01dd\u01de\3\2\2\2\u01dd\u01db\3\2\2\2\u01de\u01e0\3\2\2\2\u01df"+
"\u01dd\3\2\2\2\u01e0\u01e2\7)\2\2\u01e1\u01c9\3\2\2\2\u01e1\u01d5\3\2"+
"\2\2\u01e2\u008f\3\2\2\2\u01e3\u01e4\7v\2\2\u01e4\u01e5\7t\2\2\u01e5\u01e6"+
"\7w\2\2\u01e6\u01e7\7g\2\2\u01e7\u0091\3\2\2\2\u01e8\u01e9\7h\2\2\u01e9"+
"\u01ea\7c\2\2\u01ea\u01eb\7n\2\2\u01eb\u01ec\7u\2\2\u01ec\u01ed\7g\2\2"+
"\u01ed\u0093\3\2\2\2\u01ee\u01ef\7p\2\2\u01ef\u01f0\7w\2\2\u01f0\u01f1"+
"\7n\2\2\u01f1\u01f2\7n\2\2\u01f2\u0095\3\2\2\2\u01f3\u01f9\5\u0098L\2"+
"\u01f4\u01f5\5\24\n\2\u01f5\u01f6\5\u0098L\2\u01f6\u01f8\3\2\2\2\u01f7"+
"\u01f4\3\2\2\2\u01f8\u01fb\3\2\2\2\u01f9\u01f7\3\2\2\2\u01f9\u01fa\3\2"+
"\2\2\u01fa\u01fc\3\2\2\2\u01fb\u01f9\3\2\2\2\u01fc\u01fd\6K\2\2\u01fd"+
"\u0097\3\2\2\2\u01fe\u0202\t\17\2\2\u01ff\u0201\t\20\2\2\u0200\u01ff\3"+
"\2\2\2\u0201\u0204\3\2\2\2\u0202\u0200\3\2\2\2\u0202\u0203\3\2\2\2\u0203"+
"\u0099\3\2\2\2\u0204\u0202\3\2\2\2\u0205\u020e\7\62\2\2\u0206\u020a\t"+
"\b\2\2\u0207\u0209\t\t\2\2\u0208\u0207\3\2\2\2\u0209\u020c\3\2\2\2\u020a"+
"\u0208\3\2\2\2\u020a\u020b\3\2\2\2\u020b\u020e\3\2\2\2\u020c\u020a\3\2"+
"\2\2\u020d\u0205\3\2\2\2\u020d\u0206\3\2\2\2\u020e\u020f\3\2\2\2\u020f"+
"\u0210\bM\4\2\u0210\u009b\3\2\2\2\u0211\u0215\t\17\2\2\u0212\u0214\t\20"+
"\2\2\u0213\u0212\3\2\2\2\u0214\u0217\3\2\2\2\u0215\u0213\3\2\2\2\u0215"+
"\u0216\3\2\2\2\u0216\u0218\3\2\2\2\u0217\u0215\3\2\2\2\u0218\u0219\bN"+
"\4\2\u0219\u009d\3\2\2\2!\2\3\u00a1\u00ab\u00b5\u00ba\u018d\u0190\u0197"+
"\u019a\u01a1\u01a4\u01a7\u01ae\u01b1\u01b7\u01b9\u01bd\u01c2\u01c4\u01c7"+
"\u01cf\u01d1\u01db\u01dd\u01e1\u01f9\u0202\u020a\u020d\u0215\5\b\2\2\4"+
"\3\2\4\2\2";
"\3\32\3\32\3\33\3\33\3\34\3\34\3\35\3\35\3\35\3\36\3\36\3\37\3\37\3 \3"+
" \3!\3!\3!\3\"\3\"\3\"\3#\3#\3#\3#\3$\3$\3%\3%\3%\3&\3&\3\'\3\'\3\'\3"+
"(\3(\3(\3)\3)\3)\3)\3*\3*\3*\3+\3+\3+\3+\3,\3,\3-\3-\3.\3.\3/\3/\3/\3"+
"\60\3\60\3\60\3\61\3\61\3\62\3\62\3\63\3\63\3\63\3\64\3\64\3\64\3\65\3"+
"\65\3\65\3\66\3\66\3\66\3\67\3\67\38\38\38\39\39\39\3:\3:\3:\3;\3;\3;"+
"\3<\3<\3<\3=\3=\3=\3>\3>\3>\3?\3?\3?\3@\3@\3@\3@\3A\3A\3A\3A\3B\3B\3B"+
"\3B\3B\3C\3C\6C\u018f\nC\rC\16C\u0190\3C\5C\u0194\nC\3D\3D\3D\6D\u0199"+
"\nD\rD\16D\u019a\3D\5D\u019e\nD\3E\3E\3E\7E\u01a3\nE\fE\16E\u01a6\13E"+
"\5E\u01a8\nE\3E\5E\u01ab\nE\3F\3F\3F\7F\u01b0\nF\fF\16F\u01b3\13F\5F\u01b5"+
"\nF\3F\3F\6F\u01b9\nF\rF\16F\u01ba\5F\u01bd\nF\3F\3F\5F\u01c1\nF\3F\6"+
"F\u01c4\nF\rF\16F\u01c5\5F\u01c8\nF\3F\5F\u01cb\nF\3G\3G\3G\3G\3G\3G\7"+
"G\u01d3\nG\fG\16G\u01d6\13G\3G\3G\3G\3G\3G\3G\3G\7G\u01df\nG\fG\16G\u01e2"+
"\13G\3G\5G\u01e5\nG\3H\3H\3H\3H\6H\u01eb\nH\rH\16H\u01ec\3H\3H\3H\3I\3"+
"I\3I\3I\3I\3J\3J\3J\3J\3J\3J\3K\3K\3K\3K\3K\3L\3L\3L\3L\7L\u0206\nL\f"+
"L\16L\u0209\13L\3L\3L\3M\3M\7M\u020f\nM\fM\16M\u0212\13M\3N\3N\3N\7N\u0217"+
"\nN\fN\16N\u021a\13N\5N\u021c\nN\3N\3N\3O\3O\7O\u0222\nO\fO\16O\u0225"+
"\13O\3O\3O\6\u00ad\u00b7\u01d4\u01e0\2P\4\3\6\4\b\5\n\6\f\7\16\b\20\t"+
"\22\n\24\13\26\f\30\r\32\16\34\17\36\20 \21\"\22$\23&\24(\25*\26,\27."+
"\30\60\31\62\32\64\33\66\348\35:\36<\37> @!B\"D#F$H%J&L\'N(P)R*T+V,X-"+
"Z.\\/^\60`\61b\62d\63f\64h\65j\66l\67n8p9r:t;v<x=z>|?~@\u0080A\u0082B"+
"\u0084C\u0086D\u0088E\u008aF\u008cG\u008eH\u0090I\u0092J\u0094K\u0096"+
"L\u0098M\u009aN\u009cO\u009eP\4\2\3\23\5\2\13\f\17\17\"\"\4\2\f\f\17\17"+
"\3\2\629\4\2NNnn\4\2ZZzz\5\2\62;CHch\3\2\63;\3\2\62;\b\2FFHHNNffhhnn\4"+
"\2GGgg\4\2--//\4\2HHhh\4\2$$^^\4\2\f\f\61\61\3\2\f\f\5\2C\\aac|\6\2\62"+
";C\\aac|\u0247\2\4\3\2\2\2\2\6\3\2\2\2\2\b\3\2\2\2\2\n\3\2\2\2\2\f\3\2"+
"\2\2\2\16\3\2\2\2\2\20\3\2\2\2\2\22\3\2\2\2\2\24\3\2\2\2\2\26\3\2\2\2"+
"\2\30\3\2\2\2\2\32\3\2\2\2\2\34\3\2\2\2\2\36\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\60\3\2\2\2\2\62\3\2\2\2\2\64\3\2\2\2\2\66\3\2\2\2\28\3\2\2\2\2:\3"+
"\2\2\2\2<\3\2\2\2\2>\3\2\2\2\2@\3\2\2\2\2B\3\2\2\2\2D\3\2\2\2\2F\3\2\2"+
"\2\2H\3\2\2\2\2J\3\2\2\2\2L\3\2\2\2\2N\3\2\2\2\2P\3\2\2\2\2R\3\2\2\2\2"+
"T\3\2\2\2\2V\3\2\2\2\2X\3\2\2\2\2Z\3\2\2\2\2\\\3\2\2\2\2^\3\2\2\2\2`\3"+
"\2\2\2\2b\3\2\2\2\2d\3\2\2\2\2f\3\2\2\2\2h\3\2\2\2\2j\3\2\2\2\2l\3\2\2"+
"\2\2n\3\2\2\2\2p\3\2\2\2\2r\3\2\2\2\2t\3\2\2\2\2v\3\2\2\2\2x\3\2\2\2\2"+
"z\3\2\2\2\2|\3\2\2\2\2~\3\2\2\2\2\u0080\3\2\2\2\2\u0082\3\2\2\2\2\u0084"+
"\3\2\2\2\2\u0086\3\2\2\2\2\u0088\3\2\2\2\2\u008a\3\2\2\2\2\u008c\3\2\2"+
"\2\2\u008e\3\2\2\2\2\u0090\3\2\2\2\2\u0092\3\2\2\2\2\u0094\3\2\2\2\2\u0096"+
"\3\2\2\2\2\u0098\3\2\2\2\2\u009a\3\2\2\2\3\u009c\3\2\2\2\3\u009e\3\2\2"+
"\2\4\u00a1\3\2\2\2\6\u00bc\3\2\2\2\b\u00c0\3\2\2\2\n\u00c2\3\2\2\2\f\u00c4"+
"\3\2\2\2\16\u00c6\3\2\2\2\20\u00c8\3\2\2\2\22\u00ca\3\2\2\2\24\u00cc\3"+
"\2\2\2\26\u00d0\3\2\2\2\30\u00d2\3\2\2\2\32\u00d4\3\2\2\2\34\u00d7\3\2"+
"\2\2\36\u00dc\3\2\2\2 \u00e2\3\2\2\2\"\u00e5\3\2\2\2$\u00e9\3\2\2\2&\u00f2"+
"\3\2\2\2(\u00f8\3\2\2\2*\u00ff\3\2\2\2,\u0103\3\2\2\2.\u0107\3\2\2\2\60"+
"\u010d\3\2\2\2\62\u0113\3\2\2\2\64\u0118\3\2\2\2\66\u011a\3\2\2\28\u011c"+
"\3\2\2\2:\u011e\3\2\2\2<\u0121\3\2\2\2>\u0123\3\2\2\2@\u0125\3\2\2\2B"+
"\u0127\3\2\2\2D\u012a\3\2\2\2F\u012d\3\2\2\2H\u0131\3\2\2\2J\u0133\3\2"+
"\2\2L\u0136\3\2\2\2N\u0138\3\2\2\2P\u013b\3\2\2\2R\u013e\3\2\2\2T\u0142"+
"\3\2\2\2V\u0145\3\2\2\2X\u0149\3\2\2\2Z\u014b\3\2\2\2\\\u014d\3\2\2\2"+
"^\u014f\3\2\2\2`\u0152\3\2\2\2b\u0155\3\2\2\2d\u0157\3\2\2\2f\u0159\3"+
"\2\2\2h\u015c\3\2\2\2j\u015f\3\2\2\2l\u0162\3\2\2\2n\u0165\3\2\2\2p\u0167"+
"\3\2\2\2r\u016a\3\2\2\2t\u016d\3\2\2\2v\u0170\3\2\2\2x\u0173\3\2\2\2z"+
"\u0176\3\2\2\2|\u0179\3\2\2\2~\u017c\3\2\2\2\u0080\u017f\3\2\2\2\u0082"+
"\u0183\3\2\2\2\u0084\u0187\3\2\2\2\u0086\u018c\3\2\2\2\u0088\u0195\3\2"+
"\2\2\u008a\u01a7\3\2\2\2\u008c\u01b4\3\2\2\2\u008e\u01e4\3\2\2\2\u0090"+
"\u01e6\3\2\2\2\u0092\u01f1\3\2\2\2\u0094\u01f6\3\2\2\2\u0096\u01fc\3\2"+
"\2\2\u0098\u0201\3\2\2\2\u009a\u020c\3\2\2\2\u009c\u021b\3\2\2\2\u009e"+
"\u021f\3\2\2\2\u00a0\u00a2\t\2\2\2\u00a1\u00a0\3\2\2\2\u00a2\u00a3\3\2"+
"\2\2\u00a3\u00a1\3\2\2\2\u00a3\u00a4\3\2\2\2\u00a4\u00a5\3\2\2\2\u00a5"+
"\u00a6\b\2\2\2\u00a6\5\3\2\2\2\u00a7\u00a8\7\61\2\2\u00a8\u00a9\7\61\2"+
"\2\u00a9\u00ad\3\2\2\2\u00aa\u00ac\13\2\2\2\u00ab\u00aa\3\2\2\2\u00ac"+
"\u00af\3\2\2\2\u00ad\u00ae\3\2\2\2\u00ad\u00ab\3\2\2\2\u00ae\u00b0\3\2"+
"\2\2\u00af\u00ad\3\2\2\2\u00b0\u00bd\t\3\2\2\u00b1\u00b2\7\61\2\2\u00b2"+
"\u00b3\7,\2\2\u00b3\u00b7\3\2\2\2\u00b4\u00b6\13\2\2\2\u00b5\u00b4\3\2"+
"\2\2\u00b6\u00b9\3\2\2\2\u00b7\u00b8\3\2\2\2\u00b7\u00b5\3\2\2\2\u00b8"+
"\u00ba\3\2\2\2\u00b9\u00b7\3\2\2\2\u00ba\u00bb\7,\2\2\u00bb\u00bd\7\61"+
"\2\2\u00bc\u00a7\3\2\2\2\u00bc\u00b1\3\2\2\2\u00bd\u00be\3\2\2\2\u00be"+
"\u00bf\b\3\2\2\u00bf\7\3\2\2\2\u00c0\u00c1\7}\2\2\u00c1\t\3\2\2\2\u00c2"+
"\u00c3\7\177\2\2\u00c3\13\3\2\2\2\u00c4\u00c5\7]\2\2\u00c5\r\3\2\2\2\u00c6"+
"\u00c7\7_\2\2\u00c7\17\3\2\2\2\u00c8\u00c9\7*\2\2\u00c9\21\3\2\2\2\u00ca"+
"\u00cb\7+\2\2\u00cb\23\3\2\2\2\u00cc\u00cd\7\60\2\2\u00cd\u00ce\3\2\2"+
"\2\u00ce\u00cf\b\n\3\2\u00cf\25\3\2\2\2\u00d0\u00d1\7.\2\2\u00d1\27\3"+
"\2\2\2\u00d2\u00d3\7=\2\2\u00d3\31\3\2\2\2\u00d4\u00d5\7k\2\2\u00d5\u00d6"+
"\7h\2\2\u00d6\33\3\2\2\2\u00d7\u00d8\7g\2\2\u00d8\u00d9\7n\2\2\u00d9\u00da"+
"\7u\2\2\u00da\u00db\7g\2\2\u00db\35\3\2\2\2\u00dc\u00dd\7y\2\2\u00dd\u00de"+
"\7j\2\2\u00de\u00df\7k\2\2\u00df\u00e0\7n\2\2\u00e0\u00e1\7g\2\2\u00e1"+
"\37\3\2\2\2\u00e2\u00e3\7f\2\2\u00e3\u00e4\7q\2\2\u00e4!\3\2\2\2\u00e5"+
"\u00e6\7h\2\2\u00e6\u00e7\7q\2\2\u00e7\u00e8\7t\2\2\u00e8#\3\2\2\2\u00e9"+
"\u00ea\7e\2\2\u00ea\u00eb\7q\2\2\u00eb\u00ec\7p\2\2\u00ec\u00ed\7v\2\2"+
"\u00ed\u00ee\7k\2\2\u00ee\u00ef\7p\2\2\u00ef\u00f0\7w\2\2\u00f0\u00f1"+
"\7g\2\2\u00f1%\3\2\2\2\u00f2\u00f3\7d\2\2\u00f3\u00f4\7t\2\2\u00f4\u00f5"+
"\7g\2\2\u00f5\u00f6\7c\2\2\u00f6\u00f7\7m\2\2\u00f7\'\3\2\2\2\u00f8\u00f9"+
"\7t\2\2\u00f9\u00fa\7g\2\2\u00fa\u00fb\7v\2\2\u00fb\u00fc\7w\2\2\u00fc"+
"\u00fd\7t\2\2\u00fd\u00fe\7p\2\2\u00fe)\3\2\2\2\u00ff\u0100\7p\2\2\u0100"+
"\u0101\7g\2\2\u0101\u0102\7y\2\2\u0102+\3\2\2\2\u0103\u0104\7v\2\2\u0104"+
"\u0105\7t\2\2\u0105\u0106\7{\2\2\u0106-\3\2\2\2\u0107\u0108\7e\2\2\u0108"+
"\u0109\7c\2\2\u0109\u010a\7v\2\2\u010a\u010b\7e\2\2\u010b\u010c\7j\2\2"+
"\u010c/\3\2\2\2\u010d\u010e\7v\2\2\u010e\u010f\7j\2\2\u010f\u0110\7t\2"+
"\2\u0110\u0111\7q\2\2\u0111\u0112\7y\2\2\u0112\61\3\2\2\2\u0113\u0114"+
"\7v\2\2\u0114\u0115\7j\2\2\u0115\u0116\7k\2\2\u0116\u0117\7u\2\2\u0117"+
"\63\3\2\2\2\u0118\u0119\7#\2\2\u0119\65\3\2\2\2\u011a\u011b\7\u0080\2"+
"\2\u011b\67\3\2\2\2\u011c\u011d\7,\2\2\u011d9\3\2\2\2\u011e\u011f\7\61"+
"\2\2\u011f\u0120\6\35\2\2\u0120;\3\2\2\2\u0121\u0122\7\'\2\2\u0122=\3"+
"\2\2\2\u0123\u0124\7-\2\2\u0124?\3\2\2\2\u0125\u0126\7/\2\2\u0126A\3\2"+
"\2\2\u0127\u0128\7>\2\2\u0128\u0129\7>\2\2\u0129C\3\2\2\2\u012a\u012b"+
"\7@\2\2\u012b\u012c\7@\2\2\u012cE\3\2\2\2\u012d\u012e\7@\2\2\u012e\u012f"+
"\7@\2\2\u012f\u0130\7@\2\2\u0130G\3\2\2\2\u0131\u0132\7>\2\2\u0132I\3"+
"\2\2\2\u0133\u0134\7>\2\2\u0134\u0135\7?\2\2\u0135K\3\2\2\2\u0136\u0137"+
"\7@\2\2\u0137M\3\2\2\2\u0138\u0139\7@\2\2\u0139\u013a\7?\2\2\u013aO\3"+
"\2\2\2\u013b\u013c\7?\2\2\u013c\u013d\7?\2\2\u013dQ\3\2\2\2\u013e\u013f"+
"\7?\2\2\u013f\u0140\7?\2\2\u0140\u0141\7?\2\2\u0141S\3\2\2\2\u0142\u0143"+
"\7#\2\2\u0143\u0144\7?\2\2\u0144U\3\2\2\2\u0145\u0146\7#\2\2\u0146\u0147"+
"\7?\2\2\u0147\u0148\7?\2\2\u0148W\3\2\2\2\u0149\u014a\7(\2\2\u014aY\3"+
"\2\2\2\u014b\u014c\7`\2\2\u014c[\3\2\2\2\u014d\u014e\7~\2\2\u014e]\3\2"+
"\2\2\u014f\u0150\7(\2\2\u0150\u0151\7(\2\2\u0151_\3\2\2\2\u0152\u0153"+
"\7~\2\2\u0153\u0154\7~\2\2\u0154a\3\2\2\2\u0155\u0156\7A\2\2\u0156c\3"+
"\2\2\2\u0157\u0158\7<\2\2\u0158e\3\2\2\2\u0159\u015a\7<\2\2\u015a\u015b"+
"\7<\2\2\u015bg\3\2\2\2\u015c\u015d\7/\2\2\u015d\u015e\7@\2\2\u015ei\3"+
"\2\2\2\u015f\u0160\7-\2\2\u0160\u0161\7-\2\2\u0161k\3\2\2\2\u0162\u0163"+
"\7/\2\2\u0163\u0164\7/\2\2\u0164m\3\2\2\2\u0165\u0166\7?\2\2\u0166o\3"+
"\2\2\2\u0167\u0168\7-\2\2\u0168\u0169\7?\2\2\u0169q\3\2\2\2\u016a\u016b"+
"\7/\2\2\u016b\u016c\7?\2\2\u016cs\3\2\2\2\u016d\u016e\7,\2\2\u016e\u016f"+
"\7?\2\2\u016fu\3\2\2\2\u0170\u0171\7\61\2\2\u0171\u0172\7?\2\2\u0172w"+
"\3\2\2\2\u0173\u0174\7\'\2\2\u0174\u0175\7?\2\2\u0175y\3\2\2\2\u0176\u0177"+
"\7(\2\2\u0177\u0178\7?\2\2\u0178{\3\2\2\2\u0179\u017a\7`\2\2\u017a\u017b"+
"\7?\2\2\u017b}\3\2\2\2\u017c\u017d\7~\2\2\u017d\u017e\7?\2\2\u017e\177"+
"\3\2\2\2\u017f\u0180\7>\2\2\u0180\u0181\7>\2\2\u0181\u0182\7?\2\2\u0182"+
"\u0081\3\2\2\2\u0183\u0184\7@\2\2\u0184\u0185\7@\2\2\u0185\u0186\7?\2"+
"\2\u0186\u0083\3\2\2\2\u0187\u0188\7@\2\2\u0188\u0189\7@\2\2\u0189\u018a"+
"\7@\2\2\u018a\u018b\7?\2\2\u018b\u0085\3\2\2\2\u018c\u018e\7\62\2\2\u018d"+
"\u018f\t\4\2\2\u018e\u018d\3\2\2\2\u018f\u0190\3\2\2\2\u0190\u018e\3\2"+
"\2\2\u0190\u0191\3\2\2\2\u0191\u0193\3\2\2\2\u0192\u0194\t\5\2\2\u0193"+
"\u0192\3\2\2\2\u0193\u0194\3\2\2\2\u0194\u0087\3\2\2\2\u0195\u0196\7\62"+
"\2\2\u0196\u0198\t\6\2\2\u0197\u0199\t\7\2\2\u0198\u0197\3\2\2\2\u0199"+
"\u019a\3\2\2\2\u019a\u0198\3\2\2\2\u019a\u019b\3\2\2\2\u019b\u019d\3\2"+
"\2\2\u019c\u019e\t\5\2\2\u019d\u019c\3\2\2\2\u019d\u019e\3\2\2\2\u019e"+
"\u0089\3\2\2\2\u019f\u01a8\7\62\2\2\u01a0\u01a4\t\b\2\2\u01a1\u01a3\t"+
"\t\2\2\u01a2\u01a1\3\2\2\2\u01a3\u01a6\3\2\2\2\u01a4\u01a2\3\2\2\2\u01a4"+
"\u01a5\3\2\2\2\u01a5\u01a8\3\2\2\2\u01a6\u01a4\3\2\2\2\u01a7\u019f\3\2"+
"\2\2\u01a7\u01a0\3\2\2\2\u01a8\u01aa\3\2\2\2\u01a9\u01ab\t\n\2\2\u01aa"+
"\u01a9\3\2\2\2\u01aa\u01ab\3\2\2\2\u01ab\u008b\3\2\2\2\u01ac\u01b5\7\62"+
"\2\2\u01ad\u01b1\t\b\2\2\u01ae\u01b0\t\t\2\2\u01af\u01ae\3\2\2\2\u01b0"+
"\u01b3\3\2\2\2\u01b1\u01af\3\2\2\2\u01b1\u01b2\3\2\2\2\u01b2\u01b5\3\2"+
"\2\2\u01b3\u01b1\3\2\2\2\u01b4\u01ac\3\2\2\2\u01b4\u01ad\3\2\2\2\u01b5"+
"\u01bc\3\2\2\2\u01b6\u01b8\5\24\n\2\u01b7\u01b9\t\t\2\2\u01b8\u01b7\3"+
"\2\2\2\u01b9\u01ba\3\2\2\2\u01ba\u01b8\3\2\2\2\u01ba\u01bb\3\2\2\2\u01bb"+
"\u01bd\3\2\2\2\u01bc\u01b6\3\2\2\2\u01bc\u01bd\3\2\2\2\u01bd\u01c7\3\2"+
"\2\2\u01be\u01c0\t\13\2\2\u01bf\u01c1\t\f\2\2\u01c0\u01bf\3\2\2\2\u01c0"+
"\u01c1\3\2\2\2\u01c1\u01c3\3\2\2\2\u01c2\u01c4\t\t\2\2\u01c3\u01c2\3\2"+
"\2\2\u01c4\u01c5\3\2\2\2\u01c5\u01c3\3\2\2\2\u01c5\u01c6\3\2\2\2\u01c6"+
"\u01c8\3\2\2\2\u01c7\u01be\3\2\2\2\u01c7\u01c8\3\2\2\2\u01c8\u01ca\3\2"+
"\2\2\u01c9\u01cb\t\r\2\2\u01ca\u01c9\3\2\2\2\u01ca\u01cb\3\2\2\2\u01cb"+
"\u008d\3\2\2\2\u01cc\u01d4\7$\2\2\u01cd\u01ce\7^\2\2\u01ce\u01d3\7$\2"+
"\2\u01cf\u01d0\7^\2\2\u01d0\u01d3\7^\2\2\u01d1\u01d3\n\16\2\2\u01d2\u01cd"+
"\3\2\2\2\u01d2\u01cf\3\2\2\2\u01d2\u01d1\3\2\2\2\u01d3\u01d6\3\2\2\2\u01d4"+
"\u01d5\3\2\2\2\u01d4\u01d2\3\2\2\2\u01d5\u01d7\3\2\2\2\u01d6\u01d4\3\2"+
"\2\2\u01d7\u01e5\7$\2\2\u01d8\u01e0\7)\2\2\u01d9\u01da\7^\2\2\u01da\u01df"+
"\7)\2\2\u01db\u01dc\7^\2\2\u01dc\u01df\7^\2\2\u01dd\u01df\n\16\2\2\u01de"+
"\u01d9\3\2\2\2\u01de\u01db\3\2\2\2\u01de\u01dd\3\2\2\2\u01df\u01e2\3\2"+
"\2\2\u01e0\u01e1\3\2\2\2\u01e0\u01de\3\2\2\2\u01e1\u01e3\3\2\2\2\u01e2"+
"\u01e0\3\2\2\2\u01e3\u01e5\7)\2\2\u01e4\u01cc\3\2\2\2\u01e4\u01d8\3\2"+
"\2\2\u01e5\u008f\3\2\2\2\u01e6\u01ea\7\61\2\2\u01e7\u01eb\n\17\2\2\u01e8"+
"\u01e9\7^\2\2\u01e9\u01eb\n\20\2\2\u01ea\u01e7\3\2\2\2\u01ea\u01e8\3\2"+
"\2\2\u01eb\u01ec\3\2\2\2\u01ec\u01ea\3\2\2\2\u01ec\u01ed\3\2\2\2\u01ed"+
"\u01ee\3\2\2\2\u01ee\u01ef\7\61\2\2\u01ef\u01f0\6H\3\2\u01f0\u0091\3\2"+
"\2\2\u01f1\u01f2\7v\2\2\u01f2\u01f3\7t\2\2\u01f3\u01f4\7w\2\2\u01f4\u01f5"+
"\7g\2\2\u01f5\u0093\3\2\2\2\u01f6\u01f7\7h\2\2\u01f7\u01f8\7c\2\2\u01f8"+
"\u01f9\7n\2\2\u01f9\u01fa\7u\2\2\u01fa\u01fb\7g\2\2\u01fb\u0095\3\2\2"+
"\2\u01fc\u01fd\7p\2\2\u01fd\u01fe\7w\2\2\u01fe\u01ff\7n\2\2\u01ff\u0200"+
"\7n\2\2\u0200\u0097\3\2\2\2\u0201\u0207\5\u009aM\2\u0202\u0203\5\24\n"+
"\2\u0203\u0204\5\u009aM\2\u0204\u0206\3\2\2\2\u0205\u0202\3\2\2\2\u0206"+
"\u0209\3\2\2\2\u0207\u0205\3\2\2\2\u0207\u0208\3\2\2\2\u0208\u020a\3\2"+
"\2\2\u0209\u0207\3\2\2\2\u020a\u020b\6L\4\2\u020b\u0099\3\2\2\2\u020c"+
"\u0210\t\21\2\2\u020d\u020f\t\22\2\2\u020e\u020d\3\2\2\2\u020f\u0212\3"+
"\2\2\2\u0210\u020e\3\2\2\2\u0210\u0211\3\2\2\2\u0211\u009b\3\2\2\2\u0212"+
"\u0210\3\2\2\2\u0213\u021c\7\62\2\2\u0214\u0218\t\b\2\2\u0215\u0217\t"+
"\t\2\2\u0216\u0215\3\2\2\2\u0217\u021a\3\2\2\2\u0218\u0216\3\2\2\2\u0218"+
"\u0219\3\2\2\2\u0219\u021c\3\2\2\2\u021a\u0218\3\2\2\2\u021b\u0213\3\2"+
"\2\2\u021b\u0214\3\2\2\2\u021c\u021d\3\2\2\2\u021d\u021e\bN\4\2\u021e"+
"\u009d\3\2\2\2\u021f\u0223\t\21\2\2\u0220\u0222\t\22\2\2\u0221\u0220\3"+
"\2\2\2\u0222\u0225\3\2\2\2\u0223\u0221\3\2\2\2\u0223\u0224\3\2\2\2\u0224"+
"\u0226\3\2\2\2\u0225\u0223\3\2\2\2\u0226\u0227\bO\4\2\u0227\u009f\3\2"+
"\2\2#\2\3\u00a3\u00ad\u00b7\u00bc\u0190\u0193\u019a\u019d\u01a4\u01a7"+
"\u01aa\u01b1\u01b4\u01ba\u01bc\u01c0\u01c5\u01c7\u01ca\u01d2\u01d4\u01de"+
"\u01e0\u01e4\u01ea\u01ec\u0207\u0210\u0218\u021b\u0223\5\b\2\2\4\3\2\4"+
"\2\2";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {

View File

@ -25,8 +25,8 @@ class PainlessParser extends Parser {
XOR=44, BWOR=45, BOOLAND=46, BOOLOR=47, COND=48, COLON=49, REF=50, ARROW=51,
INCR=52, DECR=53, ASSIGN=54, AADD=55, ASUB=56, AMUL=57, ADIV=58, AREM=59,
AAND=60, AXOR=61, AOR=62, ALSH=63, ARSH=64, AUSH=65, OCTAL=66, HEX=67,
INTEGER=68, DECIMAL=69, STRING=70, TRUE=71, FALSE=72, NULL=73, TYPE=74,
ID=75, DOTINTEGER=76, DOTID=77;
INTEGER=68, DECIMAL=69, STRING=70, REGEX=71, TRUE=72, FALSE=73, NULL=74,
TYPE=75, ID=76, DOTINTEGER=77, DOTID=78;
public static final int
RULE_source = 0, RULE_function = 1, RULE_parameters = 2, RULE_statement = 3,
RULE_trailer = 4, RULE_block = 5, RULE_empty = 6, RULE_initializer = 7,
@ -52,7 +52,7 @@ class PainlessParser extends Parser {
"'>'", "'>='", "'=='", "'==='", "'!='", "'!=='", "'&'", "'^'", "'|'",
"'&&'", "'||'", "'?'", "':'", "'::'", "'->'", "'++'", "'--'", "'='", "'+='",
"'-='", "'*='", "'/='", "'%='", "'&='", "'^='", "'|='", "'<<='", "'>>='",
"'>>>='", null, null, null, null, null, "'true'", "'false'", "'null'"
"'>>>='", null, null, null, null, null, null, "'true'", "'false'", "'null'"
};
private static final String[] _SYMBOLIC_NAMES = {
null, "WS", "COMMENT", "LBRACK", "RBRACK", "LBRACE", "RBRACE", "LP", "RP",
@ -63,7 +63,7 @@ class PainlessParser extends Parser {
"BOOLAND", "BOOLOR", "COND", "COLON", "REF", "ARROW", "INCR", "DECR",
"ASSIGN", "AADD", "ASUB", "AMUL", "ADIV", "AREM", "AAND", "AXOR", "AOR",
"ALSH", "ARSH", "AUSH", "OCTAL", "HEX", "INTEGER", "DECIMAL", "STRING",
"TRUE", "FALSE", "NULL", "TYPE", "ID", "DOTINTEGER", "DOTID"
"REGEX", "TRUE", "FALSE", "NULL", "TYPE", "ID", "DOTINTEGER", "DOTID"
};
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
@ -2228,6 +2228,15 @@ class PainlessParser extends Parser {
this.s = ctx.s;
}
}
public static class RegexContext extends PrimaryContext {
public TerminalNode REGEX() { return getToken(PainlessParser.REGEX, 0); }
public RegexContext(PrimaryContext ctx) { copyFrom(ctx); }
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof PainlessParserVisitor ) return ((PainlessParserVisitor<? extends T>)visitor).visitRegex(this);
else return visitor.visitChildren(this);
}
}
public static class StringContext extends PrimaryContext {
public TerminalNode STRING() { return getToken(PainlessParser.STRING, 0); }
public StringContext(PrimaryContext ctx) { copyFrom(ctx); }
@ -2303,7 +2312,7 @@ class PainlessParser extends Parser {
PrimaryContext _localctx = new PrimaryContext(_ctx, getState(), c);
enterRule(_localctx, 34, RULE_primary);
try {
setState(390);
setState(391);
switch ( getInterpreter().adaptivePredict(_input,29,_ctx) ) {
case 1:
_localctx = new ExprprecContext(_localctx);
@ -2343,32 +2352,40 @@ class PainlessParser extends Parser {
}
break;
case 4:
_localctx = new VariableContext(_localctx);
_localctx = new RegexContext(_localctx);
enterOuterAlt(_localctx, 4);
{
setState(384);
match(ID);
match(REGEX);
}
break;
case 5:
_localctx = new CalllocalContext(_localctx);
_localctx = new VariableContext(_localctx);
enterOuterAlt(_localctx, 5);
{
setState(385);
match(ID);
setState(386);
arguments();
}
break;
case 6:
_localctx = new NewobjectContext(_localctx);
_localctx = new CalllocalContext(_localctx);
enterOuterAlt(_localctx, 6);
{
setState(386);
match(ID);
setState(387);
match(NEW);
arguments();
}
break;
case 7:
_localctx = new NewobjectContext(_localctx);
enterOuterAlt(_localctx, 7);
{
setState(388);
match(TYPE);
match(NEW);
setState(389);
match(TYPE);
setState(390);
arguments();
}
break;
@ -2410,23 +2427,23 @@ class PainlessParser extends Parser {
SecondaryContext _localctx = new SecondaryContext(_ctx, getState(), s);
enterRule(_localctx, 36, RULE_secondary);
try {
setState(396);
setState(397);
switch ( getInterpreter().adaptivePredict(_input,30,_ctx) ) {
case 1:
enterOuterAlt(_localctx, 1);
{
setState(392);
if (!( _localctx.s )) throw new FailedPredicateException(this, " $s ");
setState(393);
if (!( _localctx.s )) throw new FailedPredicateException(this, " $s ");
setState(394);
dot();
}
break;
case 2:
enterOuterAlt(_localctx, 2);
{
setState(394);
if (!( _localctx.s )) throw new FailedPredicateException(this, " $s ");
setState(395);
if (!( _localctx.s )) throw new FailedPredicateException(this, " $s ");
setState(396);
brace();
}
break;
@ -2484,17 +2501,17 @@ class PainlessParser extends Parser {
enterRule(_localctx, 38, RULE_dot);
int _la;
try {
setState(403);
setState(404);
switch ( getInterpreter().adaptivePredict(_input,31,_ctx) ) {
case 1:
_localctx = new CallinvokeContext(_localctx);
enterOuterAlt(_localctx, 1);
{
setState(398);
match(DOT);
setState(399);
match(DOTID);
match(DOT);
setState(400);
match(DOTID);
setState(401);
arguments();
}
break;
@ -2502,9 +2519,9 @@ class PainlessParser extends Parser {
_localctx = new FieldaccessContext(_localctx);
enterOuterAlt(_localctx, 2);
{
setState(401);
match(DOT);
setState(402);
match(DOT);
setState(403);
_la = _input.LA(1);
if ( !(_la==DOTINTEGER || _la==DOTID) ) {
_errHandler.recoverInline(this);
@ -2558,11 +2575,11 @@ class PainlessParser extends Parser {
_localctx = new BraceaccessContext(_localctx);
enterOuterAlt(_localctx, 1);
{
setState(405);
match(LBRACE);
setState(406);
expression(0);
match(LBRACE);
setState(407);
expression(0);
setState(408);
match(RBRACE);
}
}
@ -2609,34 +2626,34 @@ class PainlessParser extends Parser {
enterOuterAlt(_localctx, 1);
{
{
setState(409);
setState(410);
match(LP);
setState(418);
setState(419);
switch ( getInterpreter().adaptivePredict(_input,33,_ctx) ) {
case 1:
{
setState(410);
setState(411);
argument();
setState(415);
setState(416);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==COMMA) {
{
{
setState(411);
match(COMMA);
setState(412);
match(COMMA);
setState(413);
argument();
}
}
setState(417);
setState(418);
_errHandler.sync(this);
_la = _input.LA(1);
}
}
break;
}
setState(420);
setState(421);
match(RP);
}
}
@ -2677,26 +2694,26 @@ class PainlessParser extends Parser {
ArgumentContext _localctx = new ArgumentContext(_ctx, getState());
enterRule(_localctx, 44, RULE_argument);
try {
setState(425);
setState(426);
switch ( getInterpreter().adaptivePredict(_input,34,_ctx) ) {
case 1:
enterOuterAlt(_localctx, 1);
{
setState(422);
setState(423);
expression(0);
}
break;
case 2:
enterOuterAlt(_localctx, 2);
{
setState(423);
setState(424);
lambda();
}
break;
case 3:
enterOuterAlt(_localctx, 3);
{
setState(424);
setState(425);
funcref();
}
break;
@ -2748,54 +2765,54 @@ class PainlessParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
setState(440);
setState(441);
switch (_input.LA(1)) {
case TYPE:
case ID:
{
setState(427);
setState(428);
lamtype();
}
break;
case LP:
{
setState(428);
setState(429);
match(LP);
setState(437);
setState(438);
_la = _input.LA(1);
if (_la==TYPE || _la==ID) {
{
setState(429);
setState(430);
lamtype();
setState(434);
setState(435);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==COMMA) {
{
{
setState(430);
match(COMMA);
setState(431);
match(COMMA);
setState(432);
lamtype();
}
}
setState(436);
setState(437);
_errHandler.sync(this);
_la = _input.LA(1);
}
}
}
setState(439);
setState(440);
match(RP);
}
break;
default:
throw new NoViableAltException(this);
}
setState(442);
match(ARROW);
setState(443);
match(ARROW);
setState(444);
block();
}
}
@ -2833,16 +2850,16 @@ class PainlessParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
setState(446);
setState(447);
_la = _input.LA(1);
if (_la==TYPE) {
{
setState(445);
setState(446);
decltype();
}
}
setState(448);
setState(449);
match(ID);
}
}
@ -2885,33 +2902,33 @@ class PainlessParser extends Parser {
FuncrefContext _localctx = new FuncrefContext(_ctx, getState());
enterRule(_localctx, 50, RULE_funcref);
try {
setState(454);
setState(455);
switch ( getInterpreter().adaptivePredict(_input,39,_ctx) ) {
case 1:
enterOuterAlt(_localctx, 1);
{
setState(450);
setState(451);
classFuncref();
}
break;
case 2:
enterOuterAlt(_localctx, 2);
{
setState(451);
setState(452);
constructorFuncref();
}
break;
case 3:
enterOuterAlt(_localctx, 3);
{
setState(452);
setState(453);
capturingFuncref();
}
break;
case 4:
enterOuterAlt(_localctx, 4);
{
setState(453);
setState(454);
localFuncref();
}
break;
@ -2949,11 +2966,11 @@ class PainlessParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
setState(456);
match(TYPE);
setState(457);
match(REF);
match(TYPE);
setState(458);
match(REF);
setState(459);
match(ID);
}
}
@ -2991,11 +3008,11 @@ class PainlessParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
setState(460);
decltype();
setState(461);
match(REF);
decltype();
setState(462);
match(REF);
setState(463);
match(NEW);
}
}
@ -3033,11 +3050,11 @@ class PainlessParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
setState(464);
match(ID);
setState(465);
match(REF);
match(ID);
setState(466);
match(REF);
setState(467);
match(ID);
}
}
@ -3073,11 +3090,11 @@ class PainlessParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
setState(468);
match(THIS);
setState(469);
match(REF);
match(THIS);
setState(470);
match(REF);
setState(471);
match(ID);
}
}
@ -3182,7 +3199,7 @@ class PainlessParser extends Parser {
}
public static final String _serializedATN =
"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3O\u01db\4\2\t\2\4"+
"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3P\u01dc\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"+
@ -3211,27 +3228,27 @@ class PainlessParser extends Parser {
"\22\3\22\3\22\3\22\3\22\3\22\3\22\6\22\u0168\n\22\r\22\16\22\u0169\3\22"+
"\3\22\7\22\u016e\n\22\f\22\16\22\u0171\13\22\5\22\u0173\n\22\5\22\u0175"+
"\n\22\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23"+
"\3\23\3\23\3\23\3\23\3\23\5\23\u0189\n\23\3\24\3\24\3\24\3\24\5\24\u018f"+
"\n\24\3\25\3\25\3\25\3\25\3\25\5\25\u0196\n\25\3\26\3\26\3\26\3\26\3\27"+
"\3\27\3\27\3\27\7\27\u01a0\n\27\f\27\16\27\u01a3\13\27\5\27\u01a5\n\27"+
"\3\27\3\27\3\30\3\30\3\30\5\30\u01ac\n\30\3\31\3\31\3\31\3\31\3\31\7\31"+
"\u01b3\n\31\f\31\16\31\u01b6\13\31\5\31\u01b8\n\31\3\31\5\31\u01bb\n\31"+
"\3\31\3\31\3\31\3\32\5\32\u01c1\n\32\3\32\3\32\3\33\3\33\3\33\3\33\5\33"+
"\u01c9\n\33\3\34\3\34\3\34\3\34\3\35\3\35\3\35\3\35\3\36\3\36\3\36\3\36"+
"\3\37\3\37\3\37\3\37\3\37\2\3\36 \2\4\6\b\n\f\16\20\22\24\26\30\32\34"+
"\36 \"$&(*,.\60\62\64\668:<\2\f\3\28C\3\2\35\37\3\2 !\3\2\"$\3\2%(\3\2"+
"),\3\2\66\67\3\2DG\4\2\33\34 !\3\2NO\u0207\2A\3\2\2\2\4L\3\2\2\2\6Q\3"+
"\2\2\2\b\u00af\3\2\2\2\n\u00b3\3\2\2\2\f\u00b5\3\2\2\2\16\u00be\3\2\2"+
"\2\20\u00c2\3\2\2\2\22\u00c4\3\2\2\2\24\u00c6\3\2\2\2\26\u00cf\3\2\2\2"+
"\30\u00d7\3\2\2\2\32\u00dc\3\2\2\2\34\u00e8\3\2\2\2\36\u00f3\3\2\2\2 "+
"\u0150\3\2\2\2\"\u0174\3\2\2\2$\u0188\3\2\2\2&\u018e\3\2\2\2(\u0195\3"+
"\2\2\2*\u0197\3\2\2\2,\u019b\3\2\2\2.\u01ab\3\2\2\2\60\u01ba\3\2\2\2\62"+
"\u01c0\3\2\2\2\64\u01c8\3\2\2\2\66\u01ca\3\2\2\28\u01ce\3\2\2\2:\u01d2"+
"\3\2\2\2<\u01d6\3\2\2\2>@\5\4\3\2?>\3\2\2\2@C\3\2\2\2A?\3\2\2\2AB\3\2"+
"\3\23\3\23\3\23\3\23\3\23\3\23\5\23\u018a\n\23\3\24\3\24\3\24\3\24\5\24"+
"\u0190\n\24\3\25\3\25\3\25\3\25\3\25\5\25\u0197\n\25\3\26\3\26\3\26\3"+
"\26\3\27\3\27\3\27\3\27\7\27\u01a1\n\27\f\27\16\27\u01a4\13\27\5\27\u01a6"+
"\n\27\3\27\3\27\3\30\3\30\3\30\5\30\u01ad\n\30\3\31\3\31\3\31\3\31\3\31"+
"\7\31\u01b4\n\31\f\31\16\31\u01b7\13\31\5\31\u01b9\n\31\3\31\5\31\u01bc"+
"\n\31\3\31\3\31\3\31\3\32\5\32\u01c2\n\32\3\32\3\32\3\33\3\33\3\33\3\33"+
"\5\33\u01ca\n\33\3\34\3\34\3\34\3\34\3\35\3\35\3\35\3\35\3\36\3\36\3\36"+
"\3\36\3\37\3\37\3\37\3\37\3\37\2\3\36 \2\4\6\b\n\f\16\20\22\24\26\30\32"+
"\34\36 \"$&(*,.\60\62\64\668:<\2\f\3\28C\3\2\35\37\3\2 !\3\2\"$\3\2%("+
"\3\2),\3\2\66\67\3\2DG\4\2\33\34 !\3\2OP\u0209\2A\3\2\2\2\4L\3\2\2\2\6"+
"Q\3\2\2\2\b\u00af\3\2\2\2\n\u00b3\3\2\2\2\f\u00b5\3\2\2\2\16\u00be\3\2"+
"\2\2\20\u00c2\3\2\2\2\22\u00c4\3\2\2\2\24\u00c6\3\2\2\2\26\u00cf\3\2\2"+
"\2\30\u00d7\3\2\2\2\32\u00dc\3\2\2\2\34\u00e8\3\2\2\2\36\u00f3\3\2\2\2"+
" \u0150\3\2\2\2\"\u0174\3\2\2\2$\u0189\3\2\2\2&\u018f\3\2\2\2(\u0196\3"+
"\2\2\2*\u0198\3\2\2\2,\u019c\3\2\2\2.\u01ac\3\2\2\2\60\u01bb\3\2\2\2\62"+
"\u01c1\3\2\2\2\64\u01c9\3\2\2\2\66\u01cb\3\2\2\28\u01cf\3\2\2\2:\u01d3"+
"\3\2\2\2<\u01d7\3\2\2\2>@\5\4\3\2?>\3\2\2\2@C\3\2\2\2A?\3\2\2\2AB\3\2"+
"\2\2BG\3\2\2\2CA\3\2\2\2DF\5\b\5\2ED\3\2\2\2FI\3\2\2\2GE\3\2\2\2GH\3\2"+
"\2\2HJ\3\2\2\2IG\3\2\2\2JK\7\2\2\3K\3\3\2\2\2LM\5\26\f\2MN\7M\2\2NO\5"+
"\6\4\2OP\5\f\7\2P\5\3\2\2\2Q]\7\t\2\2RS\5\26\f\2SZ\7M\2\2TU\7\f\2\2UV"+
"\5\26\f\2VW\7M\2\2WY\3\2\2\2XT\3\2\2\2Y\\\3\2\2\2ZX\3\2\2\2Z[\3\2\2\2"+
"\2\2HJ\3\2\2\2IG\3\2\2\2JK\7\2\2\3K\3\3\2\2\2LM\5\26\f\2MN\7N\2\2NO\5"+
"\6\4\2OP\5\f\7\2P\5\3\2\2\2Q]\7\t\2\2RS\5\26\f\2SZ\7N\2\2TU\7\f\2\2UV"+
"\5\26\f\2VW\7N\2\2WY\3\2\2\2XT\3\2\2\2Y\\\3\2\2\2ZX\3\2\2\2Z[\3\2\2\2"+
"[^\3\2\2\2\\Z\3\2\2\2]R\3\2\2\2]^\3\2\2\2^_\3\2\2\2_`\7\n\2\2`\7\3\2\2"+
"\2ab\7\16\2\2bc\7\t\2\2cd\5\36\20\2de\7\n\2\2ei\5\n\6\2fg\7\17\2\2gj\5"+
"\n\6\2hj\6\5\2\2if\3\2\2\2ih\3\2\2\2j\u00b0\3\2\2\2kl\7\20\2\2lm\7\t\2"+
@ -3244,7 +3261,7 @@ class PainlessParser extends Parser {
"\2\2\2\u0087\u0088\3\2\2\2\u0088\u008b\7\n\2\2\u0089\u008c\5\n\6\2\u008a"+
"\u008c\5\16\b\2\u008b\u0089\3\2\2\2\u008b\u008a\3\2\2\2\u008c\u00b0\3"+
"\2\2\2\u008d\u008e\7\22\2\2\u008e\u008f\7\t\2\2\u008f\u0090\5\26\f\2\u0090"+
"\u0091\7M\2\2\u0091\u0092\7\63\2\2\u0092\u0093\5\36\20\2\u0093\u0094\7"+
"\u0091\7N\2\2\u0091\u0092\7\63\2\2\u0092\u0093\5\36\20\2\u0093\u0094\7"+
"\n\2\2\u0094\u0095\5\n\6\2\u0095\u00b0\3\2\2\2\u0096\u0097\5\24\13\2\u0097"+
"\u0098\5\34\17\2\u0098\u00b0\3\2\2\2\u0099\u009a\7\23\2\2\u009a\u00b0"+
"\5\34\17\2\u009b\u009c\7\24\2\2\u009c\u00b0\5\34\17\2\u009d\u009e\7\25"+
@ -3266,12 +3283,12 @@ class PainlessParser extends Parser {
"\5\36\20\2\u00c5\23\3\2\2\2\u00c6\u00c7\5\26\f\2\u00c7\u00cc\5\30\r\2"+
"\u00c8\u00c9\7\f\2\2\u00c9\u00cb\5\30\r\2\u00ca\u00c8\3\2\2\2\u00cb\u00ce"+
"\3\2\2\2\u00cc\u00ca\3\2\2\2\u00cc\u00cd\3\2\2\2\u00cd\25\3\2\2\2\u00ce"+
"\u00cc\3\2\2\2\u00cf\u00d4\7L\2\2\u00d0\u00d1\7\7\2\2\u00d1\u00d3\7\b"+
"\u00cc\3\2\2\2\u00cf\u00d4\7M\2\2\u00d0\u00d1\7\7\2\2\u00d1\u00d3\7\b"+
"\2\2\u00d2\u00d0\3\2\2\2\u00d3\u00d6\3\2\2\2\u00d4\u00d2\3\2\2\2\u00d4"+
"\u00d5\3\2\2\2\u00d5\27\3\2\2\2\u00d6\u00d4\3\2\2\2\u00d7\u00da\7M\2\2"+
"\u00d5\3\2\2\2\u00d5\27\3\2\2\2\u00d6\u00d4\3\2\2\2\u00d7\u00da\7N\2\2"+
"\u00d8\u00d9\78\2\2\u00d9\u00db\5\36\20\2\u00da\u00d8\3\2\2\2\u00da\u00db"+
"\3\2\2\2\u00db\31\3\2\2\2\u00dc\u00dd\7\30\2\2\u00dd\u00de\7\t\2\2\u00de"+
"\u00df\7L\2\2\u00df\u00e0\7M\2\2\u00e0\u00e1\7\n\2\2\u00e1\u00e2\5\f\7"+
"\u00df\7M\2\2\u00df\u00e0\7N\2\2\u00e0\u00e1\7\n\2\2\u00e1\u00e2\5\f\7"+
"\2\u00e2\33\3\2\2\2\u00e3\u00e9\7\r\2\2\u00e4\u00e9\7\2\2\3\u00e5\u00e6"+
"\b\17\1\2\u00e6\u00e7\7\6\2\2\u00e7\u00e9\b\17\1\2\u00e8\u00e3\3\2\2\2"+
"\u00e8\u00e4\3\2\2\2\u00e8\u00e5\3\2\2\2\u00e9\35\3\2\2\2\u00ea\u00eb"+
@ -3303,9 +3320,9 @@ class PainlessParser extends Parser {
"\2\2\u0135\u0151\5\"\22\2\u0136\u0137\6\21\17\3\u0137\u0138\5\"\22\2\u0138"+
"\u0139\t\b\2\2\u0139\u0151\3\2\2\2\u013a\u013b\6\21\20\3\u013b\u0151\5"+
"\"\22\2\u013c\u013d\6\21\21\3\u013d\u013e\t\t\2\2\u013e\u0151\b\21\1\2"+
"\u013f\u0140\6\21\22\3\u0140\u0141\7I\2\2\u0141\u0151\b\21\1\2\u0142\u0143"+
"\6\21\23\3\u0143\u0144\7J\2\2\u0144\u0151\b\21\1\2\u0145\u0146\6\21\24"+
"\3\u0146\u0147\7K\2\2\u0147\u0151\b\21\1\2\u0148\u0149\6\21\25\3\u0149"+
"\u013f\u0140\6\21\22\3\u0140\u0141\7J\2\2\u0141\u0151\b\21\1\2\u0142\u0143"+
"\6\21\23\3\u0143\u0144\7K\2\2\u0144\u0151\b\21\1\2\u0145\u0146\6\21\24"+
"\3\u0146\u0147\7L\2\2\u0147\u0151\b\21\1\2\u0148\u0149\6\21\25\3\u0149"+
"\u014a\t\n\2\2\u014a\u0151\5 \21\2\u014b\u014c\7\t\2\2\u014c\u014d\5\26"+
"\f\2\u014d\u014e\7\n\2\2\u014e\u014f\5 \21\2\u014f\u0151\3\2\2\2\u0150"+
"\u0133\3\2\2\2\u0150\u0136\3\2\2\2\u0150\u013a\3\2\2\2\u0150\u013c\3\2"+
@ -3316,7 +3333,7 @@ class PainlessParser extends Parser {
"\u015a\5\26\f\2\u015a\u015e\5(\25\2\u015b\u015d\5&\24\2\u015c\u015b\3"+
"\2\2\2\u015d\u0160\3\2\2\2\u015e\u015c\3\2\2\2\u015e\u015f\3\2\2\2\u015f"+
"\u0175\3\2\2\2\u0160\u015e\3\2\2\2\u0161\u0162\7\26\2\2\u0162\u0167\7"+
"L\2\2\u0163\u0164\7\7\2\2\u0164\u0165\5\36\20\2\u0165\u0166\7\b\2\2\u0166"+
"M\2\2\u0163\u0164\7\7\2\2\u0164\u0165\5\36\20\2\u0165\u0166\7\b\2\2\u0166"+
"\u0168\3\2\2\2\u0167\u0163\3\2\2\2\u0168\u0169\3\2\2\2\u0169\u0167\3\2"+
"\2\2\u0169\u016a\3\2\2\2\u016a\u0172\3\2\2\2\u016b\u016f\5(\25\2\u016c"+
"\u016e\5&\24\2\u016d\u016c\3\2\2\2\u016e\u0171\3\2\2\2\u016f\u016d\3\2"+
@ -3324,41 +3341,42 @@ class PainlessParser extends Parser {
"\u016b\3\2\2\2\u0172\u0173\3\2\2\2\u0173\u0175\3\2\2\2\u0174\u0152\3\2"+
"\2\2\u0174\u0159\3\2\2\2\u0174\u0161\3\2\2\2\u0175#\3\2\2\2\u0176\u0177"+
"\6\23\26\3\u0177\u0178\7\t\2\2\u0178\u0179\5\36\20\2\u0179\u017a\7\n\2"+
"\2\u017a\u017b\b\23\1\2\u017b\u0189\3\2\2\2\u017c\u017d\6\23\27\3\u017d"+
"\u017e\7\t\2\2\u017e\u017f\5 \21\2\u017f\u0180\7\n\2\2\u0180\u0189\3\2"+
"\2\2\u0181\u0189\7H\2\2\u0182\u0189\7M\2\2\u0183\u0184\7M\2\2\u0184\u0189"+
"\5,\27\2\u0185\u0186\7\26\2\2\u0186\u0187\7L\2\2\u0187\u0189\5,\27\2\u0188"+
"\u0176\3\2\2\2\u0188\u017c\3\2\2\2\u0188\u0181\3\2\2\2\u0188\u0182\3\2"+
"\2\2\u0188\u0183\3\2\2\2\u0188\u0185\3\2\2\2\u0189%\3\2\2\2\u018a\u018b"+
"\6\24\30\3\u018b\u018f\5(\25\2\u018c\u018d\6\24\31\3\u018d\u018f\5*\26"+
"\2\u018e\u018a\3\2\2\2\u018e\u018c\3\2\2\2\u018f\'\3\2\2\2\u0190\u0191"+
"\7\13\2\2\u0191\u0192\7O\2\2\u0192\u0196\5,\27\2\u0193\u0194\7\13\2\2"+
"\u0194\u0196\t\13\2\2\u0195\u0190\3\2\2\2\u0195\u0193\3\2\2\2\u0196)\3"+
"\2\2\2\u0197\u0198\7\7\2\2\u0198\u0199\5\36\20\2\u0199\u019a\7\b\2\2\u019a"+
"+\3\2\2\2\u019b\u01a4\7\t\2\2\u019c\u01a1\5.\30\2\u019d\u019e\7\f\2\2"+
"\u019e\u01a0\5.\30\2\u019f\u019d\3\2\2\2\u01a0\u01a3\3\2\2\2\u01a1\u019f"+
"\3\2\2\2\u01a1\u01a2\3\2\2\2\u01a2\u01a5\3\2\2\2\u01a3\u01a1\3\2\2\2\u01a4"+
"\u019c\3\2\2\2\u01a4\u01a5\3\2\2\2\u01a5\u01a6\3\2\2\2\u01a6\u01a7\7\n"+
"\2\2\u01a7-\3\2\2\2\u01a8\u01ac\5\36\20\2\u01a9\u01ac\5\60\31\2\u01aa"+
"\u01ac\5\64\33\2\u01ab\u01a8\3\2\2\2\u01ab\u01a9\3\2\2\2\u01ab\u01aa\3"+
"\2\2\2\u01ac/\3\2\2\2\u01ad\u01bb\5\62\32\2\u01ae\u01b7\7\t\2\2\u01af"+
"\u01b4\5\62\32\2\u01b0\u01b1\7\f\2\2\u01b1\u01b3\5\62\32\2\u01b2\u01b0"+
"\3\2\2\2\u01b3\u01b6\3\2\2\2\u01b4\u01b2\3\2\2\2\u01b4\u01b5\3\2\2\2\u01b5"+
"\u01b8\3\2\2\2\u01b6\u01b4\3\2\2\2\u01b7\u01af\3\2\2\2\u01b7\u01b8\3\2"+
"\2\2\u01b8\u01b9\3\2\2\2\u01b9\u01bb\7\n\2\2\u01ba\u01ad\3\2\2\2\u01ba"+
"\u01ae\3\2\2\2\u01bb\u01bc\3\2\2\2\u01bc\u01bd\7\65\2\2\u01bd\u01be\5"+
"\f\7\2\u01be\61\3\2\2\2\u01bf\u01c1\5\26\f\2\u01c0\u01bf\3\2\2\2\u01c0"+
"\u01c1\3\2\2\2\u01c1\u01c2\3\2\2\2\u01c2\u01c3\7M\2\2\u01c3\63\3\2\2\2"+
"\u01c4\u01c9\5\66\34\2\u01c5\u01c9\58\35\2\u01c6\u01c9\5:\36\2\u01c7\u01c9"+
"\5<\37\2\u01c8\u01c4\3\2\2\2\u01c8\u01c5\3\2\2\2\u01c8\u01c6\3\2\2\2\u01c8"+
"\u01c7\3\2\2\2\u01c9\65\3\2\2\2\u01ca\u01cb\7L\2\2\u01cb\u01cc\7\64\2"+
"\2\u01cc\u01cd\7M\2\2\u01cd\67\3\2\2\2\u01ce\u01cf\5\26\f\2\u01cf\u01d0"+
"\7\64\2\2\u01d0\u01d1\7\26\2\2\u01d19\3\2\2\2\u01d2\u01d3\7M\2\2\u01d3"+
"\u01d4\7\64\2\2\u01d4\u01d5\7M\2\2\u01d5;\3\2\2\2\u01d6\u01d7\7\32\2\2"+
"\u01d7\u01d8\7\64\2\2\u01d8\u01d9\7M\2\2\u01d9=\3\2\2\2*AGZ]iq~\u0082"+
"\u0086\u008b\u00a6\u00af\u00b3\u00b9\u00c2\u00cc\u00d4\u00da\u00e8\u00f3"+
"\u012e\u0130\u0150\u0156\u015e\u0169\u016f\u0172\u0174\u0188\u018e\u0195"+
"\u01a1\u01a4\u01ab\u01b4\u01b7\u01ba\u01c0\u01c8";
"\2\u017a\u017b\b\23\1\2\u017b\u018a\3\2\2\2\u017c\u017d\6\23\27\3\u017d"+
"\u017e\7\t\2\2\u017e\u017f\5 \21\2\u017f\u0180\7\n\2\2\u0180\u018a\3\2"+
"\2\2\u0181\u018a\7H\2\2\u0182\u018a\7I\2\2\u0183\u018a\7N\2\2\u0184\u0185"+
"\7N\2\2\u0185\u018a\5,\27\2\u0186\u0187\7\26\2\2\u0187\u0188\7M\2\2\u0188"+
"\u018a\5,\27\2\u0189\u0176\3\2\2\2\u0189\u017c\3\2\2\2\u0189\u0181\3\2"+
"\2\2\u0189\u0182\3\2\2\2\u0189\u0183\3\2\2\2\u0189\u0184\3\2\2\2\u0189"+
"\u0186\3\2\2\2\u018a%\3\2\2\2\u018b\u018c\6\24\30\3\u018c\u0190\5(\25"+
"\2\u018d\u018e\6\24\31\3\u018e\u0190\5*\26\2\u018f\u018b\3\2\2\2\u018f"+
"\u018d\3\2\2\2\u0190\'\3\2\2\2\u0191\u0192\7\13\2\2\u0192\u0193\7P\2\2"+
"\u0193\u0197\5,\27\2\u0194\u0195\7\13\2\2\u0195\u0197\t\13\2\2\u0196\u0191"+
"\3\2\2\2\u0196\u0194\3\2\2\2\u0197)\3\2\2\2\u0198\u0199\7\7\2\2\u0199"+
"\u019a\5\36\20\2\u019a\u019b\7\b\2\2\u019b+\3\2\2\2\u019c\u01a5\7\t\2"+
"\2\u019d\u01a2\5.\30\2\u019e\u019f\7\f\2\2\u019f\u01a1\5.\30\2\u01a0\u019e"+
"\3\2\2\2\u01a1\u01a4\3\2\2\2\u01a2\u01a0\3\2\2\2\u01a2\u01a3\3\2\2\2\u01a3"+
"\u01a6\3\2\2\2\u01a4\u01a2\3\2\2\2\u01a5\u019d\3\2\2\2\u01a5\u01a6\3\2"+
"\2\2\u01a6\u01a7\3\2\2\2\u01a7\u01a8\7\n\2\2\u01a8-\3\2\2\2\u01a9\u01ad"+
"\5\36\20\2\u01aa\u01ad\5\60\31\2\u01ab\u01ad\5\64\33\2\u01ac\u01a9\3\2"+
"\2\2\u01ac\u01aa\3\2\2\2\u01ac\u01ab\3\2\2\2\u01ad/\3\2\2\2\u01ae\u01bc"+
"\5\62\32\2\u01af\u01b8\7\t\2\2\u01b0\u01b5\5\62\32\2\u01b1\u01b2\7\f\2"+
"\2\u01b2\u01b4\5\62\32\2\u01b3\u01b1\3\2\2\2\u01b4\u01b7\3\2\2\2\u01b5"+
"\u01b3\3\2\2\2\u01b5\u01b6\3\2\2\2\u01b6\u01b9\3\2\2\2\u01b7\u01b5\3\2"+
"\2\2\u01b8\u01b0\3\2\2\2\u01b8\u01b9\3\2\2\2\u01b9\u01ba\3\2\2\2\u01ba"+
"\u01bc\7\n\2\2\u01bb\u01ae\3\2\2\2\u01bb\u01af\3\2\2\2\u01bc\u01bd\3\2"+
"\2\2\u01bd\u01be\7\65\2\2\u01be\u01bf\5\f\7\2\u01bf\61\3\2\2\2\u01c0\u01c2"+
"\5\26\f\2\u01c1\u01c0\3\2\2\2\u01c1\u01c2\3\2\2\2\u01c2\u01c3\3\2\2\2"+
"\u01c3\u01c4\7N\2\2\u01c4\63\3\2\2\2\u01c5\u01ca\5\66\34\2\u01c6\u01ca"+
"\58\35\2\u01c7\u01ca\5:\36\2\u01c8\u01ca\5<\37\2\u01c9\u01c5\3\2\2\2\u01c9"+
"\u01c6\3\2\2\2\u01c9\u01c7\3\2\2\2\u01c9\u01c8\3\2\2\2\u01ca\65\3\2\2"+
"\2\u01cb\u01cc\7M\2\2\u01cc\u01cd\7\64\2\2\u01cd\u01ce\7N\2\2\u01ce\67"+
"\3\2\2\2\u01cf\u01d0\5\26\f\2\u01d0\u01d1\7\64\2\2\u01d1\u01d2\7\26\2"+
"\2\u01d29\3\2\2\2\u01d3\u01d4\7N\2\2\u01d4\u01d5\7\64\2\2\u01d5\u01d6"+
"\7N\2\2\u01d6;\3\2\2\2\u01d7\u01d8\7\32\2\2\u01d8\u01d9\7\64\2\2\u01d9"+
"\u01da\7N\2\2\u01da=\3\2\2\2*AGZ]iq~\u0082\u0086\u008b\u00a6\u00af\u00b3"+
"\u00b9\u00c2\u00cc\u00d4\u00da\u00e8\u00f3\u012e\u0130\u0150\u0156\u015e"+
"\u0169\u016f\u0172\u0174\u0189\u018f\u0196\u01a2\u01a5\u01ac\u01b5\u01b8"+
"\u01bb\u01c1\u01c9";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {

View File

@ -333,6 +333,13 @@ class PainlessParserBaseVisitor<T> extends AbstractParseTreeVisitor<T> implement
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitString(PainlessParser.StringContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitRegex(PainlessParser.RegexContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*

View File

@ -319,6 +319,13 @@ interface PainlessParserVisitor<T> extends ParseTreeVisitor<T> {
* @return the visitor result
*/
T visitString(PainlessParser.StringContext ctx);
/**
* Visit a parse tree produced by the {@code regex}
* labeled alternative in {@link PainlessParser#primary}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitRegex(PainlessParser.RegexContext ctx);
/**
* Visit a parse tree produced by the {@code variable}
* labeled alternative in {@link PainlessParser#primary}.

View File

@ -0,0 +1,50 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch 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.
*/
package org.elasticsearch.painless.antlr;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenFactory;
/**
* Utility to figure out if a {@code /} is division or the start of a regex literal.
*/
public class SlashStrategy {
public static boolean slashIsRegex(TokenFactory<?> factory) {
StashingTokenFactory<?> stashingFactory = (StashingTokenFactory<?>) factory;
Token lastToken = stashingFactory.getLastToken();
if (lastToken == null) {
return true;
}
switch (lastToken.getType()) {
case PainlessLexer.RBRACE:
case PainlessLexer.RP:
case PainlessLexer.OCTAL:
case PainlessLexer.HEX:
case PainlessLexer.INTEGER:
case PainlessLexer.DECIMAL:
case PainlessLexer.ID:
case PainlessLexer.DOTINTEGER:
case PainlessLexer.DOTID:
return false;
default:
return true;
}
}
}

View File

@ -0,0 +1,62 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch 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.
*/
package org.elasticsearch.painless.antlr;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenFactory;
import org.antlr.v4.runtime.TokenSource;
import org.antlr.v4.runtime.misc.Pair;
/**
* Token factory that preseres that last non-whitespace token so you can do token level lookbehind in the lexer.
*/
public class StashingTokenFactory<T extends Token> implements TokenFactory<T> {
private final TokenFactory<T> delegate;
private T lastToken;
public StashingTokenFactory(TokenFactory<T> delegate) {
this.delegate = delegate;
}
public T getLastToken() {
return lastToken;
}
@Override
public T create(Pair<TokenSource, CharStream> source, int type, String text, int channel, int start, int stop, int line,
int charPositionInLine) {
return maybeStash(delegate.create(source, type, text, channel, start, stop, line, charPositionInLine));
}
@Override
public T create(int type, String text) {
return maybeStash(delegate.create(type, text));
}
private T maybeStash(T token) {
if (token.getChannel() == Lexer.DEFAULT_TOKEN_CHANNEL) {
lastToken = token;
}
return token;
}
}

View File

@ -84,6 +84,7 @@ import org.elasticsearch.painless.antlr.PainlessParser.ParametersContext;
import org.elasticsearch.painless.antlr.PainlessParser.PostContext;
import org.elasticsearch.painless.antlr.PainlessParser.PreContext;
import org.elasticsearch.painless.antlr.PainlessParser.ReadContext;
import org.elasticsearch.painless.antlr.PainlessParser.RegexContext;
import org.elasticsearch.painless.antlr.PainlessParser.ReturnContext;
import org.elasticsearch.painless.antlr.PainlessParser.SecondaryContext;
import org.elasticsearch.painless.antlr.PainlessParser.SingleContext;
@ -124,6 +125,7 @@ import org.elasticsearch.painless.node.LCast;
import org.elasticsearch.painless.node.LField;
import org.elasticsearch.painless.node.LNewArray;
import org.elasticsearch.painless.node.LNewObj;
import org.elasticsearch.painless.node.LRegex;
import org.elasticsearch.painless.node.LStatic;
import org.elasticsearch.painless.node.LString;
import org.elasticsearch.painless.node.LVariable;
@ -826,6 +828,15 @@ public final class Walker extends PainlessParserBaseVisitor<Object> {
return links;
}
@Override
public Object visitRegex(RegexContext ctx) {
String pattern = ctx.REGEX().getText().substring(1, ctx.REGEX().getText().length() - 1);
List<ALink> links = new ArrayList<>();
links.add(new LRegex(location(ctx), pattern));
return links;
}
@Override
public Object visitVariable(VariableContext ctx) {
String name = ctx.ID().getText();

View File

@ -0,0 +1,89 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch 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.
*/
package org.elasticsearch.painless.node;
import org.elasticsearch.painless.Definition;
import org.elasticsearch.painless.Locals;
import org.elasticsearch.painless.Locals.Constant;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import org.elasticsearch.painless.Location;
import org.elasticsearch.painless.MethodWriter;
import org.elasticsearch.painless.WriterConstants;
/**
* Represents a regex constant. All regexes are constants.
*/
public final class LRegex extends ALink {
private static final Definition.Type PATTERN_TYPE = Definition.getType("Pattern");
private final String pattern;
private Constant constant;
public LRegex(Location location, String pattern) {
super(location, 1);
this.pattern = pattern;
try {
// Compile the pattern early after parsing so we can throw an error to the user with the location
Pattern.compile(pattern);
} catch (PatternSyntaxException e) {
throw createError(e);
}
}
@Override
ALink analyze(Locals locals) {
if (before != null) {
throw createError(new IllegalArgumentException("Illegal Regex constant [" + pattern + "]."));
} else if (store) {
throw createError(new IllegalArgumentException("Cannot write to Regex constant [" + pattern + "]."));
} else if (!load) {
throw createError(new IllegalArgumentException("Regex constant may only be read [" + pattern + "]."));
}
constant = locals.addConstant(location, PATTERN_TYPE, "regexAt$" + location.getOffset(), this::initializeConstant);
after = PATTERN_TYPE;
return this;
}
@Override
void write(MethodWriter writer) {
// Do nothing.
}
@Override
void load(MethodWriter writer) {
writer.writeDebugInfo(location);
writer.getStatic(WriterConstants.CLASS_TYPE, constant.name, PATTERN_TYPE.type);
}
@Override
void store(MethodWriter writer) {
throw createError(new IllegalStateException("Illegal tree structure."));
}
private void initializeConstant(MethodWriter writer) {
writer.push(pattern);
writer.invokeStatic(PATTERN_TYPE.type, WriterConstants.PATTERN_COMPILE);
}
}

View File

@ -30,7 +30,9 @@ import org.elasticsearch.painless.Locals.FunctionReserved;
import org.elasticsearch.painless.Locals.Variable;
import org.elasticsearch.painless.Location;
import org.elasticsearch.painless.MethodWriter;
import org.elasticsearch.painless.WriterConstants;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Handle;
import org.objectweb.asm.Opcodes;
import java.lang.invoke.MethodType;
@ -40,6 +42,8 @@ import java.util.BitSet;
import java.util.Collections;
import java.util.List;
import static org.elasticsearch.painless.WriterConstants.CLASS_TYPE;
/**
* Represents a user-defined function.
*/
@ -137,6 +141,9 @@ public class SFunction extends AStatement {
}
locals.decrementScope();
String staticHandleFieldName = Def.getUserFunctionHandleFieldName(name, parameters.size());
locals.addConstant(location, WriterConstants.METHOD_HANDLE_TYPE, staticHandleFieldName, this::initializeConstant);
}
/** Writes the function to given ClassWriter. */
@ -174,8 +181,13 @@ public class SFunction extends AStatement {
}
}
}
String getStaticHandleFieldName() {
return Def.getUserFunctionHandleFieldName(name, parameters.size());
private void initializeConstant(MethodWriter writer) {
final Handle handle = new Handle(Opcodes.H_INVOKESTATIC,
CLASS_TYPE.getInternalName(),
name,
method.method.getDescriptor(),
false);
writer.push(handle);
}
}

View File

@ -23,6 +23,7 @@ import org.elasticsearch.painless.Definition.Method;
import org.elasticsearch.painless.Definition.MethodKey;
import org.elasticsearch.painless.Executable;
import org.elasticsearch.painless.Locals;
import org.elasticsearch.painless.Locals.Constant;
import org.elasticsearch.painless.Locals.ExecuteReserved;
import org.elasticsearch.painless.Locals.Variable;
import org.elasticsearch.painless.WriterConstants;
@ -30,7 +31,6 @@ import org.elasticsearch.painless.Location;
import org.elasticsearch.painless.MethodWriter;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Handle;
import org.objectweb.asm.Opcodes;
import java.util.BitSet;
@ -155,33 +155,31 @@ public final class SSource extends AStatement {
function.write(writer, expressions);
}
// Write a static field with Handle (function reference) for every function:
if (!functions.isEmpty()) {
for (SFunction function : functions) {
writer.visitField(Opcodes.ACC_FINAL | Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC,
function.getStaticHandleFieldName(),
WriterConstants.METHOD_HANDLE_TYPE.getDescriptor(),
null,
// Write the constants
if (false == locals.getConstants().isEmpty()) {
// Fields
for (Constant constant : locals.getConstants()) {
writer.visitField(
Opcodes.ACC_FINAL | Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC,
constant.name,
constant.type.getDescriptor(),
null,
null).visitEnd();
}
// Initialize the constants in a static initializer
final MethodWriter clinit = new MethodWriter(Opcodes.ACC_STATIC,
WriterConstants.CLINIT, writer, expressions);
for (SFunction function : functions) {
final Handle handle = new Handle(Opcodes.H_INVOKESTATIC,
CLASS_TYPE.getInternalName(),
function.name,
function.method.method.getDescriptor(),
false);
clinit.push(handle);
clinit.putStatic(CLASS_TYPE,
function.getStaticHandleFieldName(),
WriterConstants.METHOD_HANDLE_TYPE);
WriterConstants.CLINIT, writer, expressions);
for (Constant constant : locals.getConstants()) {
constant.initializer.accept(clinit);
clinit.putStatic(CLASS_TYPE, constant.name, constant.type);
}
clinit.returnValue();
clinit.endMethod();
}
// End writing the class and store the generated bytes:
// End writing the class and store the generated bytes.
writer.visitEnd();
bytes = writer.toByteArray();
}

View File

@ -0,0 +1,33 @@
#
# Licensed to Elasticsearch under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch 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.
#
#
# Painless definition file. This defines the hierarchy of classes,
# what methods and fields they have, etc.
#
class Pattern -> java.util.regex.Pattern extends Object {
# Pattern compile(String) Intentionally not included. We don't want dynamic patterns because they allow regexes to be generated per time
# the script is run which is super slow. LRegex generates code that calls this method but it skips these checks.
Matcher matcher(CharSequence)
}
class Matcher -> java.util.regex.Matcher extends Object {
boolean matches()
}

View File

@ -79,4 +79,10 @@ public class ArrayTests extends ScriptTestCase {
"int total = 0; for (int x = 0; x < a.length; x++) { total += a[x]; } return total;"));
}
/**
* Make sure we don't try and convert the {@code /} after the {@code ]} into a regex....
*/
public void testDivideArray() {
assertEquals(1, exec("def[] x = new def[1]; x[0] = 2; return x[0] / 2"));
}
}

View File

@ -0,0 +1,71 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch 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.
*/
package org.elasticsearch.painless;
public class RegexTests extends ScriptTestCase {
public void testPatternAfterReturn() {
assertEquals(true, exec("return /foo/.matcher(\"foo\").matches()"));
assertEquals(false, exec("return /foo/.matcher(\"bar\").matches()"));
}
public void testSlashesEscapePattern() {
assertEquals(true, exec("return /\\/\\//.matcher(\"//\").matches()"));
}
public void testPatternAfterAssignment() {
assertEquals(true, exec("def a = /foo/; return a.matcher(\"foo\").matches()"));
}
public void testPatternInIfStement() {
assertEquals(true, exec("if (/foo/.matcher(\"foo\").matches()) { return true } else { return false }"));
}
public void testPatternAfterInfixBoolean() {
assertEquals(true, exec("return false || /foo/.matcher(\"foo\").matches()"));
assertEquals(true, exec("return true && /foo/.matcher(\"foo\").matches()"));
}
public void testPatternAfterUnaryNotBoolean() {
assertEquals(false, exec("return !/foo/.matcher(\"foo\").matches()"));
assertEquals(true, exec("return !/foo/.matcher(\"bar\").matches()"));
}
public void testInTernaryCondition() {
assertEquals(true, exec("return /foo/.matcher(\"foo\").matches() ? true : false"));
assertEquals(1, exec("def i = 0; i += /foo/.matcher(\"foo\").matches() ? 1 : 1; return i"));
}
public void testInTernaryTrueArm() {
assertEquals(true, exec("def i = true; return i ? /foo/.matcher(\"foo\").matches() : false"));
}
public void testInTernaryFalseArm() {
assertEquals(true, exec("def i = false; return i ? false : /foo/.matcher(\"foo\").matches()"));
}
public void testRegexInFunction() {
assertEquals(true, exec("boolean m(String s) {/foo/.matcher(s).matches()} m(\"foo\")"));
}
public void testReturnRegexFromFunction() {
assertEquals(true, exec("Pattern m(boolean a) {a ? /foo/ : /bar/} m(true).matcher(\"foo\").matches()"));
}
}

View File

@ -22,6 +22,7 @@ package org.elasticsearch.painless;
import java.lang.invoke.WrongMethodTypeException;
import java.util.Arrays;
import java.util.Collections;
import java.util.regex.PatternSyntaxException;
import static java.util.Collections.emptyMap;
@ -211,4 +212,19 @@ public class WhenThingsGoWrongTests extends ScriptTestCase {
});
assertEquals("invalid sequence of tokens near ['}'].", e.getMessage());
}
public void testCantUsePatternCompile() {
IllegalArgumentException e = expectScriptThrows(IllegalArgumentException.class, () -> {
exec("Pattern.compile(\"aa\")");
});
assertEquals("Unknown call [compile] with [1] arguments on type [Pattern].", e.getMessage());
}
public void testBadRegexPattern() {
PatternSyntaxException e = expectScriptThrows(PatternSyntaxException.class, () -> {
exec("/\\ujjjj/"); // Invalid unicode
});
assertEquals("Illegal Unicode escape sequence near index 2\n\\ujjjj\n ^", e.getMessage());
}
}