2018-04-17 15:16:08 -04:00
|
|
|
[[painless-lang-spec]]
|
2017-05-12 19:17:06 -04:00
|
|
|
== Painless Language Specification
|
|
|
|
|
2018-04-17 15:16:08 -04:00
|
|
|
Painless is a scripting language designed for security and performance.
|
|
|
|
Painless syntax is similar to Java syntax along with some additional
|
|
|
|
features such as dynamic typing, Map and List accessor shortcuts, and array
|
|
|
|
initializers. As a direct comparison to Java, there are some important
|
|
|
|
differences, especially related to the casting model. For more detailed
|
2018-05-23 16:36:58 -04:00
|
|
|
conceptual information about the basic constructs that Painless and Java share,
|
2017-05-12 19:17:06 -04:00
|
|
|
refer to the corresponding topics in the
|
|
|
|
https://docs.oracle.com/javase/specs/jls/se8/html/index.html[Java Language
|
|
|
|
Specification].
|
|
|
|
|
|
|
|
Painless scripts are parsed and compiled using the http://www.antlr.org/[ANTLR4]
|
2018-04-17 15:16:08 -04:00
|
|
|
and http://asm.ow2.org/[ASM] libraries. Scripts are compiled directly
|
|
|
|
into Java Virtual Machine (JVM) byte code and executed against a standard JVM.
|
|
|
|
This specification uses ANTLR4 grammar notation to describe the allowed syntax.
|
2017-05-12 19:17:06 -04:00
|
|
|
However, the actual Painless grammar is more compact than what is shown here.
|
|
|
|
|
2018-04-17 15:16:08 -04:00
|
|
|
include::painless-comments.asciidoc[]
|
2017-05-12 19:17:06 -04:00
|
|
|
|
2018-04-17 15:16:08 -04:00
|
|
|
include::painless-keywords.asciidoc[]
|
2017-05-12 19:17:06 -04:00
|
|
|
|
2018-04-17 15:16:08 -04:00
|
|
|
include::painless-literals.asciidoc[]
|
2017-05-12 19:17:06 -04:00
|
|
|
|
2018-04-25 12:38:41 -04:00
|
|
|
include::painless-identifiers.asciidoc[]
|
|
|
|
|
2018-04-17 15:16:08 -04:00
|
|
|
include::painless-variables.asciidoc[]
|
2017-05-12 19:17:06 -04:00
|
|
|
|
2018-04-17 15:16:08 -04:00
|
|
|
include::painless-types.asciidoc[]
|
2017-05-12 19:17:06 -04:00
|
|
|
|
2018-04-17 15:16:08 -04:00
|
|
|
include::painless-casting.asciidoc[]
|
2017-05-12 19:17:06 -04:00
|
|
|
|
|
|
|
include::painless-operators.asciidoc[]
|
2018-04-17 15:16:08 -04:00
|
|
|
|
Painless: Restructure/Clean Up of Spec Documentation (#31013)
Full restructure of the spec into new sections for operators, statements, scripts, functions, lambdas, and regexes. Split of operators into 6 sections, a table, reference, array, numeric, boolean, and general. Clean up of all operators sections. Sporadic clean up else where.
2018-06-07 20:11:56 -04:00
|
|
|
include::painless-operators-general.asciidoc[]
|
|
|
|
|
|
|
|
include::painless-operators-numeric.asciidoc[]
|
|
|
|
|
|
|
|
include::painless-operators-boolean.asciidoc[]
|
|
|
|
|
|
|
|
include::painless-operators-reference.asciidoc[]
|
|
|
|
|
|
|
|
include::painless-operators-array.asciidoc[]
|
|
|
|
|
|
|
|
include::painless-statements.asciidoc[]
|
|
|
|
|
|
|
|
include::painless-scripts.asciidoc[]
|
|
|
|
|
|
|
|
include::painless-functions.asciidoc[]
|
|
|
|
|
|
|
|
include::painless-lambdas.asciidoc[]
|
|
|
|
|
|
|
|
include::painless-regexes.asciidoc[]
|