From fce1bbc20e9bc9ba5197ff90f5377a2293c64db1 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Thu, 4 Apr 2019 08:41:30 -0400 Subject: [PATCH] Docs: Drop inline callouts from painless book (#40805) Drops the inline callouts from the painless reference book. These callouts are incompatible with Asciidoctor and we'd very much like to switch to Asciidoctor for building this book, partially because Asciidoctor is actively developed and AsciiDoc is not, and partially because it builds the book three times faster. --- docs/painless/painless-casting.asciidoc | 100 +++--- docs/painless/painless-literals.asciidoc | 22 +- .../painless-operators-array.asciidoc | 56 ++-- .../painless-operators-boolean.asciidoc | 288 +++++++++--------- .../painless-operators-general.asciidoc | 74 ++--- .../painless-operators-numeric.asciidoc | 170 +++++------ .../painless-operators-reference.asciidoc | 150 ++++----- docs/painless/painless-types.asciidoc | 66 ++-- docs/painless/painless-variables.asciidoc | 52 ++-- 9 files changed, 489 insertions(+), 489 deletions(-) diff --git a/docs/painless/painless-casting.asciidoc b/docs/painless/painless-casting.asciidoc index b742fbd115591..25e7e345ba0f1 100644 --- a/docs/painless/painless-casting.asciidoc +++ b/docs/painless/painless-casting.asciidoc @@ -28,9 +28,9 @@ cast: '(' TYPE ')' expression + [source,Painless] ---- -<1> int i = (int)5L; -<2> Map m = new HashMap(); -<3> HashMap hm = (HashMap)m; +int i = (int)5L; <1> +Map m = new HashMap(); <2> +HashMap hm = (HashMap)m; <3> ---- + <1> declare `int i`; @@ -75,10 +75,10 @@ following table: + [source,Painless] ---- -<1> int a = 1; -<2> long b = a; -<3> short c = (short)b; -<4> double e = (double)a; +int a = 1; <1> +long b = a; <2> +short c = (short)b; <3> +double e = (double)a; <4> ---- + <1> declare `int a`; @@ -101,9 +101,9 @@ following table: + [source,Painless] ---- -<1> int a = 1.0; // error -<2> int b = 2; -<3> byte c = b; // error +int a = 1.0; // error <1> +int b = 2; <2> +byte c = b; // error <3> ---- + <1> declare `int i`; @@ -132,11 +132,11 @@ or the target type is a descendant of the original type. + [source,Painless] ---- -<1> List x; -<2> ArrayList y = new ArrayList(); -<3> x = y; -<4> y = (ArrayList)x; -<5> x = (List)y; +List x; <1> +ArrayList y = new ArrayList(); <2> +x = y; <3> +y = (ArrayList)x; <4> +x = (List)y; <5> ---- + <1> declare `List x`; @@ -161,9 +161,9 @@ or the target type is a descendant of the original type. + [source,Painless] ---- -<1> List x = new ArrayList(); -<2> ArrayList y = x; // error -<3> Map m = (Map)x; // error +List x = new ArrayList(); <1> +ArrayList y = x; // error <2> +Map m = (Map)x; // error <3> ---- + <1> declare `List x`; @@ -201,11 +201,11 @@ based on the current type value the `def` type value represents. + [source,Painless] ---- -<1> def d0 = 3; -<2> d0 = new ArrayList(); -<3> Object o = new HashMap(); -<4> def d1 = o; -<5> int i = d1.size(); +def d0 = 3; <1> +d0 = new ArrayList(); <2> +Object o = new HashMap(); <3> +def d1 = o; <4> +int i = d1.size(); <5> ---- + <1> declare `def d0`; @@ -236,12 +236,12 @@ based on the current type value the `def` type value represents. + [source,Painless] ---- -<1> def d = 1.0; -<2> int i = (int)d; -<3> d = 1; -<4> float f = d; -<5> d = new ArrayList(); -<6> List l = d; +def d = 1.0; <1> +int i = (int)d; <2> +d = 1; <3> +float f = d; <4> +d = new ArrayList(); <5> +List l = d; <6> ---- + <1> declare `def d`; @@ -274,10 +274,10 @@ based on the current type value the `def` type value represents. + [source,Painless] ---- -<1> def d = 1; -<2> short s = d; // error -<3> d = new HashMap(); -<4> List l = d; // error +def d = 1; <1> +short s = d; // error <2> +d = new HashMap(); <3> +List l = d; // error <4> ---- <1> declare `def d`; implicit cast `int 1` to `def` -> `def`; @@ -314,8 +314,8 @@ Use the cast operator to convert a <> value into a + [source,Painless] ---- -<1> char c = (char)"C"; -<2> c = (char)'c'; +char c = (char)"C"; <1> +c = (char)'c'; <2> ---- + <1> declare `char c`; @@ -328,8 +328,8 @@ Use the cast operator to convert a <> value into a + [source,Painless] ---- -<1> String s = "s"; -<2> char c = (char)s; +String s = "s"; <1> +char c = (char)s; <2> ---- <1> declare `String s`; store `String "s"` to `s`; @@ -350,8 +350,8 @@ Use the cast operator to convert a <> value into a + [source,Painless] ---- -<1> char c = 65; -<2> String s = (String)c; +char c = 65; <1> +String s = (String)c; <2> ---- <1> declare `char c`; store `char 65` to `c`; @@ -390,10 +390,10 @@ value and vice versa. + [source,Painless] ---- -<1> List l = new ArrayList(); -<2> l.add(1); -<3> Integer I = Integer.valueOf(0); -<4> int i = l.get(i); +List l = new ArrayList(); <1> +l.add(1); <2> +Integer I = Integer.valueOf(0); <3> +int i = l.get(i); <4> ---- + <1> declare `List l`; @@ -421,10 +421,10 @@ value and vice versa. + [source,Painless] ---- -<1> Integer x = 1; // error -<2> Integer y = (Integer)1; // error -<3> int a = Integer.valueOf(1); // error -<4> int b = (int)Integer.valueOf(1); // error +Integer x = 1; // error <1> +Integer y = (Integer)1; // error <2> +int a = Integer.valueOf(1); // error <3> +int b = (int)Integer.valueOf(1); // error <4> ---- + <1> declare `Integer x`; @@ -459,9 +459,9 @@ based on the type the `def` value represents. + [source,Painless] ---- -<1> double d = 2 + 2.0; -<2> def x = 1; -<3> float f = x + 2.0F; +double d = 2 + 2.0; <1> +def x = 1; <2> +float f = x + 2.0F; <3> ---- <1> declare `double d`; promote `int 2` and `double 2.0 @0`: result `double`; diff --git a/docs/painless/painless-literals.asciidoc b/docs/painless/painless-literals.asciidoc index 621fc152be956..f2e5849638048 100644 --- a/docs/painless/painless-literals.asciidoc +++ b/docs/painless/painless-literals.asciidoc @@ -30,12 +30,12 @@ HEX: '-'? '0' [xX] [0-9a-fA-F]+ [lL]?; + [source,Painless] ---- -<1> 0 -<2> 0D -<3> 1234L -<4> -90f -<5> -022 -<6> 0xF2A +0 <1> +0D <2> +1234L <3> +-90f <4> +-022 <5> +0xF2A <6> ---- + <1> `int 0` @@ -67,11 +67,11 @@ EXPONENT: ( [eE] [+\-]? [0-9]+ ); + [source,Painless] ---- -<1> 0.0 -<2> 1E6 -<3> 0.977777 -<4> -126.34 -<5> 89.9F +0.0 <1> +1E6 <2> +0.977777 <3> +-126.34 <4> +89.9F <5> ---- + <1> `double 0.0` diff --git a/docs/painless/painless-operators-array.asciidoc b/docs/painless/painless-operators-array.asciidoc index e80a863df2747..ad23a980cb4b8 100644 --- a/docs/painless/painless-operators-array.asciidoc +++ b/docs/painless/painless-operators-array.asciidoc @@ -29,7 +29,7 @@ expression_list: expression (',' expression); + [source,Painless] ---- -<1> int[] x = new int[] {1, 2, 3}; +int[] x = new int[] {1, 2, 3}; <1> ---- + <1> declare `int[] x`; @@ -44,12 +44,12 @@ expression_list: expression (',' expression); + [source,Painless] ---- -<1> int i = 1; -<2> long l = 2L; -<3> float f = 3.0F; -<4> double d = 4.0; -<5> String s = "5"; -<6> def array = new def[] {i, l, f*d, s}; +int i = 1; <1> +long l = 2L; <2> +float f = 3.0F; <3> +double d = 4.0; <4> +String s = "5"; <5> +def array = new def[] {i, l, f*d, s}; <6> ---- + <1> declare `int i`; @@ -114,12 +114,12 @@ brace_access: '[' expression ']' + [source,Painless] ---- -<1> int[] x = new int[2]; -<2> x[0] = 2; -<3> x[1] = 5; -<4> int y = x[0] + x[1]; -<5> int z = 1; -<6> int i = x[z]; +int[] x = new int[2]; <1> +x[0] = 2; <2> +x[1] = 5; <3> +int y = x[0] + x[1]; <4> +int z = 1; <5> +int i = x[z]; <6> ---- + <1> declare `int[] x`; @@ -149,12 +149,12 @@ brace_access: '[' expression ']' + [source,Painless] ---- -<1> def d = new int[2]; -<2> d[0] = 2; -<3> d[1] = 5; -<4> def x = d[0] + d[1]; -<5> def y = 1; -<6> def z = d[y]; +def d = new int[2]; <1> +d[0] = 2; <2> +d[1] = 5; <3> +def x = d[0] + d[1]; <4> +def y = 1; <5> +def z = d[y]; <6> ---- + <1> declare `def d`; @@ -199,9 +199,9 @@ brace_access: '[' expression ']' + [source,Painless] ---- -<1> int[][][] ia3 = new int[2][3][4]; -<2> ia3[1][2][3] = 99; -<3> int i = ia3[1][2][3]; +int[][][] ia3 = new int[2][3][4]; <1> +ia3[1][2][3] = 99; <2> +int i = ia3[1][2][3]; <3> ---- + <1> declare `int[][][] ia`; @@ -230,8 +230,8 @@ from an array type value. + [source,Painless] ---- -<1> int[] x = new int[10]; -<2> int l = x.length; +int[] x = new int[10]; <1> +int l = x.length; <2> ---- <1> declare `int[] x`; allocate `1-d int array` instance with `length [2]` @@ -269,10 +269,10 @@ new_array: 'new' TYPE ('[' expression ']')+; + [source,Painless] ---- -<1> int[] x = new int[5]; -<2> x = new int[10]; -<3> int y = 2; -<4> def z = new def[y][y*2]; +int[] x = new int[5]; <1> +x = new int[10]; <2> +int y = 2; <3> +def z = new def[y][y*2]; <4> ---- + <1> declare `int[] x`; diff --git a/docs/painless/painless-operators-boolean.asciidoc b/docs/painless/painless-operators-boolean.asciidoc index 1223a8d56e78d..6f9481aa4ecd3 100644 --- a/docs/painless/painless-operators-boolean.asciidoc +++ b/docs/painless/painless-operators-boolean.asciidoc @@ -34,8 +34,8 @@ boolean_not: '!' expression; + [source,Painless] ---- -<1> boolean x = !false; -<2> boolean y = !x; +boolean x = !false; <1> +boolean y = !x; <2> ---- <1> declare `boolean x`; boolean not `boolean false` -> `boolean true`; @@ -49,8 +49,8 @@ boolean_not: '!' expression; + [source,Painless] ---- -<1> def y = true; -<2> def z = !y; +def y = true; <1> +def z = !y; <2> ---- + <1> declare `def y`; @@ -103,9 +103,9 @@ greater_than: expression '>' expression; + [source,Painless] ---- -<1> boolean x = 5 > 4; -<2> double y = 6.0; -<3> x = 6 > y; +boolean x = 5 > 4; <1> +double y = 6.0; <2> +x = 6 > y; <3> ---- + <1> declare `boolean x`; @@ -123,10 +123,10 @@ greater_than: expression '>' expression; + [source,Painless] ---- -<1> int x = 5; -<2> def y = 7.0; -<3> def z = y > 6.5; -<4> def a = x > y; +int x = 5; <1> +def y = 7.0; <2> +def z = y > 6.5; <3> +def a = x > y; <4> ---- + <1> declare `int x`; @@ -190,9 +190,9 @@ greater_than_or_equal: expression '>=' expression; + [source,Painless] ---- -<1> boolean x = 5 >= 4; -<2> double y = 6.0; -<3> x = 6 >= y; +boolean x = 5 >= 4; <1> +double y = 6.0; <2> +x = 6 >= y; <3> ---- + <1> declare `boolean x`; @@ -210,10 +210,10 @@ greater_than_or_equal: expression '>=' expression; + [source,Painless] ---- -<1> int x = 5; -<2> def y = 7.0; -<3> def z = y >= 7.0; -<4> def a = x >= y; +int x = 5; <1> +def y = 7.0; <2> +def z = y >= 7.0; <3> +def a = x >= y; <4> ---- + <1> declare `int x`; @@ -277,9 +277,9 @@ less_than: expression '<' expression; + [source,Painless] ---- -<1> boolean x = 5 < 4; -<2> double y = 6.0; -<3> x = 6 < y; +boolean x = 5 < 4; <1> +double y = 6.0; <2> +x = 6 < y; <3> ---- + <1> declare `boolean x`; @@ -297,10 +297,10 @@ less_than: expression '<' expression; + [source,Painless] ---- -<1> int x = 5; -<2> def y = 7.0; -<3> def z = y < 6.5; -<4> def a = x < y; +int x = 5; <1> +def y = 7.0; <2> +def z = y < 6.5; <3> +def a = x < y; <4> ---- + <1> declare `int x`; @@ -364,9 +364,9 @@ greater_than_or_equal: expression '<=' expression; + [source,Painless] ---- -<1> boolean x = 5 <= 4; -<2> double y = 6.0; -<3> x = 6 <= y; +boolean x = 5 <= 4; <1> +double y = 6.0; <2> +x = 6 <= y; <3> ---- + <1> declare `boolean x`; @@ -384,10 +384,10 @@ greater_than_or_equal: expression '<=' expression; + [source,Painless] ---- -<1> int x = 5; -<2> def y = 7.0; -<3> def z = y <= 7.0; -<4> def a = x <= y; +int x = 5; <1> +def y = 7.0; <2> +def z = y <= 7.0; <3> +def a = x <= y; <4> ---- + <1> declare `int x`; @@ -436,9 +436,9 @@ instance_of: ID 'instanceof' TYPE; + [source,Painless] ---- -<1> Map m = new HashMap(); -<2> boolean a = m instanceof HashMap; -<3> boolean b = m instanceof Map; +Map m = new HashMap(); <1> +boolean a = m instanceof HashMap; <2> +boolean b = m instanceof Map; <3> ---- + <1> declare `Map m`; @@ -461,9 +461,9 @@ instance_of: ID 'instanceof' TYPE; + [source,Painless] ---- -<1> def d = new ArrayList(); -<2> boolean a = d instanceof List; -<3> boolean b = d instanceof Map; +def d = new ArrayList(); <1> +boolean a = d instanceof List; <2> +boolean b = d instanceof Map; <3> ---- + <1> declare `def d`; @@ -531,10 +531,10 @@ equality_equals: expression '==' expression; + [source,Painless] ---- -<1> boolean a = true; -<2> boolean b = false; -<3> a = a == false; -<4> b = a == b; +boolean a = true; <1> +boolean b = false; <2> +a = a == false; <3> +b = a == b; <4> ---- + <1> declare `boolean a`; @@ -554,10 +554,10 @@ equality_equals: expression '==' expression; + [source,Painless] ---- -<1> int a = 1; -<2> double b = 2.0; -<3> boolean c = a == b; -<4> c = 1 == a; +int a = 1; <1> +double b = 2.0; <2> +boolean c = a == b; <3> +c = 1 == a; <4> ---- + <1> declare `int a`; @@ -579,12 +579,12 @@ equality_equals: expression '==' expression; + [source,Painless] ---- -<1> List a = new ArrayList(); -<2> List b = new ArrayList(); -<3> a.add(1); -<4> boolean c = a == b; -<5> b.add(1); -<6> c = a == b; +List a = new ArrayList(); <1> +List b = new ArrayList(); <2> +a.add(1); <3> +boolean c = a == b; <4> +b.add(1); <5> +c = a == b; <6> ---- + <1> declare `List a`; @@ -615,12 +615,12 @@ equality_equals: expression '==' expression; + [source,Painless] ---- -<1> Object a = null; -<2> Object b = null; -<3> boolean c = a == null; -<4> c = a == b; -<5> b = new Object(); -<6> c = a == b; +Object a = null; <1> +Object b = null; <2> +boolean c = a == null; <3> +c = a == b; <4> +b = new Object(); <5> +c = a == b; <6> ---- + <1> declare `Object a`; @@ -647,12 +647,12 @@ equality_equals: expression '==' expression; + [source, Painless] ---- -<1> def a = 0; -<2> def b = 1; -<3> boolean c = a == b; -<4> def d = new HashMap(); -<5> def e = new ArrayList(); -<6> c = d == e; +def a = 0; <1> +def b = 1; <2> +boolean c = a == b; <3> +def d = new HashMap(); <4> +def e = new ArrayList(); <5> +c = d == e; <6> ---- + <1> declare `def a`; @@ -733,10 +733,10 @@ equality_not_equals: expression '!=' expression; + [source,Painless] ---- -<1> boolean a = true; -<2> boolean b = false; -<3> a = a != false; -<4> b = a != b; +boolean a = true; <1> +boolean b = false; <2> +a = a != false; <3> +b = a != b; <4> ---- + <1> declare `boolean a`; @@ -755,10 +755,10 @@ equality_not_equals: expression '!=' expression; + [source,Painless] ---- -<1> int a = 1; -<2> double b = 2.0; -<3> boolean c = a != b; -<4> c = 1 != a; +int a = 1; <1> +double b = 2.0; <2> +boolean c = a != b; <3> +c = 1 != a; <4> ---- + <1> declare `int a`; @@ -780,12 +780,12 @@ equality_not_equals: expression '!=' expression; + [source,Painless] ---- -<1> List a = new ArrayList(); -<2> List b = new ArrayList(); -<3> a.add(1); -<4> boolean c = a == b; -<5> b.add(1); -<6> c = a == b; +List a = new ArrayList(); <1> +List b = new ArrayList(); <2> +a.add(1); <3> +boolean c = a == b; <4> +b.add(1); <5> +c = a == b; <6> ---- + <1> declare `List a`; @@ -818,12 +818,12 @@ equality_not_equals: expression '!=' expression; + [source,Painless] ---- -<1> Object a = null; -<2> Object b = null; -<3> boolean c = a == null; -<4> c = a == b; -<5> b = new Object(); -<6> c = a == b; +Object a = null; <1> +Object b = null; <2> +boolean c = a == null; <3> +c = a == b; <4> +b = new Object(); <5> +c = a == b; <6> ---- + <1> declare `Object a`; @@ -851,12 +851,12 @@ equality_not_equals: expression '!=' expression; + [source, Painless] ---- -<1> def a = 0; -<2> def b = 1; -<3> boolean c = a == b; -<4> def d = new HashMap(); -<5> def e = new ArrayList(); -<6> c = d == e; +def a = 0; <1> +def b = 1; <2> +boolean c = a == b; <3> +def d = new HashMap(); <4> +def e = new ArrayList(); <5> +c = d == e; <6> ---- + <1> declare `def a`; @@ -934,11 +934,11 @@ identity_equals: expression '===' expression; + [source,Painless] ---- -<1> List a = new ArrayList(); -<2> List b = new ArrayList(); -<3> List c = a; -<4> boolean c = a === b; -<5> c = a === c; +List a = new ArrayList(); <1> +List b = new ArrayList(); <2> +List c = a; <3> +boolean c = a === b; <4> +c = a === c; <5> ---- + <1> declare `List a`; @@ -969,12 +969,12 @@ identity_equals: expression '===' expression; + [source,Painless] ---- -<1> Object a = null; -<2> Object b = null; -<3> boolean c = a === null; -<4> c = a === b; -<5> b = new Object(); -<6> c = a === b; +Object a = null; <1> +Object b = null; <2> +boolean c = a === null; <3> +c = a === b; <4> +b = new Object(); <5> +c = a === b; <6> ---- + <1> declare `Object a`; @@ -1000,11 +1000,11 @@ identity_equals: expression '===' expression; + [source, Painless] ---- -<1> def a = new HashMap(); -<2> def b = new ArrayList(); -<3> boolean c = a === b; -<4> b = a; -<5> c = a === b; +def a = new HashMap(); <1> +def b = new ArrayList(); <2> +boolean c = a === b; <3> +b = a; <4> +c = a === b; <5> ---- + <1> declare `def d`; @@ -1081,11 +1081,11 @@ identity_not_equals: expression '!==' expression; + [source,Painless] ---- -<1> List a = new ArrayList(); -<2> List b = new ArrayList(); -<3> List c = a; -<4> boolean c = a !== b; -<5> c = a !== c; +List a = new ArrayList(); <1> +List b = new ArrayList(); <2> +List c = a; <3> +boolean c = a !== b; <4> +c = a !== c; <5> ---- + <1> declare `List a`; @@ -1116,12 +1116,12 @@ identity_not_equals: expression '!==' expression; + [source,Painless] ---- -<1> Object a = null; -<2> Object b = null; -<3> boolean c = a !== null; -<4> c = a !== b; -<5> b = new Object(); -<6> c = a !== b; +Object a = null; <1> +Object b = null; <2> +boolean c = a !== null; <3> +c = a !== b; <4> +b = new Object(); <5> +c = a !== b; <6> ---- + <1> declare `Object a`; @@ -1147,11 +1147,11 @@ identity_not_equals: expression '!==' expression; + [source, Painless] ---- -<1> def a = new HashMap(); -<2> def b = new ArrayList(); -<3> boolean c = a !== b; -<4> b = a; -<5> c = a !== b; +def a = new HashMap(); <1> +def b = new ArrayList(); <2> +boolean c = a !== b; <3> +b = a; <4> +c = a !== b; <5> ---- + <1> declare `def d`; @@ -1216,9 +1216,9 @@ boolean_xor: expression '^' expression; + [source,Painless] ---- -<1> boolean x = false; -<2> boolean y = x ^ true; -<3> y = y ^ x; +boolean x = false; <1> +boolean y = x ^ true; <2> +y = y ^ x; <3> ---- + <1> declare `boolean x`; @@ -1236,9 +1236,9 @@ boolean_xor: expression '^' expression; + [source,Painless] ---- -<1> def x = false; -<2> def y = x ^ true; -<3> y = y ^ x; +def x = false; <1> +def y = x ^ true; <2> +y = y ^ x; <3> ---- + <1> declare `def x`; @@ -1292,10 +1292,10 @@ boolean_and: expression '&&' expression; + [source,Painless] ---- -<1> boolean x = true; -<2> boolean y = x && true; -<3> x = false; -<4> y = y && x; +boolean x = true; <1> +boolean y = x && true; <2> +x = false; <3> +y = y && x; <4> ---- + <1> declare `boolean x`; @@ -1314,10 +1314,10 @@ boolean_and: expression '&&' expression; + [source,Painless] ---- -<1> def x = true; -<2> def y = x && true; -<3> x = false; -<4> y = y && x; +def x = true; <1> +def y = x && true; <2> +x = false; <3> +y = y && x; <4> ---- + <1> declare `def x`; @@ -1372,10 +1372,10 @@ boolean_and: expression '||' expression; + [source,Painless] ---- -<1> boolean x = false; -<2> boolean y = x || true; -<3> y = false; -<4> y = y || x; +boolean x = false; <1> +boolean y = x || true; <2> +y = false; <3> +y = y || x; <4> ---- + <1> declare `boolean x`; @@ -1394,10 +1394,10 @@ boolean_and: expression '||' expression; + [source,Painless] ---- -<1> def x = false; -<2> def y = x || true; -<3> y = false; -<4> y = y || x; +def x = false; <1> +def y = x || true; <2> +y = false; <3> +y = y || x; <4> ---- + <1> declare `def x`; diff --git a/docs/painless/painless-operators-general.asciidoc b/docs/painless/painless-operators-general.asciidoc index 9bd057432fb51..6db9b3d5d1eae 100644 --- a/docs/painless/painless-operators-general.asciidoc +++ b/docs/painless/painless-operators-general.asciidoc @@ -22,8 +22,8 @@ precedence: '(' expression ')'; + [source,Painless] ---- -<1> int x = (5+4)*6; -<2> int y = 12/(x-50); +int x = (5+4)*6; <1> +int y = 12/(x-50); <2> ---- + <1> declare `int x`; @@ -59,11 +59,11 @@ function_call: ID '(' ( expression (',' expression)* )? ')''; + [source,Painless] ---- -<1> int add(int x, int y) { +int add(int x, int y) { <1> return x + y; } -<2> int z = add(1, 2); +int z = add(1, 2); <2> ---- + <1> define function `add` that returns `int` and has parameters (`int x`, @@ -128,10 +128,10 @@ occur. + [source,Painless] ---- -<1> boolean b = true; -<2> int x = b ? 1 : 2; -<3> List y = x > 1 ? new ArrayList() : null; -<4> def z = x < 2 ? x : 2.0; +boolean b = true; <1> +int x = b ? 1 : 2; <2> +List y = x > 1 ? new ArrayList() : null; <3> +def z = x < 2 ? x : 2.0; <4> ---- + <1> declare `boolean b`; @@ -195,10 +195,10 @@ non-static member fields: + [source,Painless] ---- -<1> Example example = new Example(); -<2> example.x = 1; -<3> example.y = 2.0; -<4> example.z = new ArrayList(); +Example example = new Example(); <1> +example.x = 1; <2> +example.y = 2.0; <3> +example.z = new ArrayList(); <4> ---- + <1> declare `Example example`; @@ -218,9 +218,9 @@ non-static member fields: + [source,Painless] ---- -<1> Example example = new Example(); -<2> example.x = 1; -<3> example.y = example.x; +Example example = new Example(); <1> +example.x = 1; <2> +example.y = example.x; <3> ---- + <1> declare `Example example`; @@ -297,18 +297,18 @@ operators. + [source,Painless] ---- -<1> int i = 10; -<2> i *= 2; -<3> i /= 5; -<4> i %= 3; -<5> i += 5; -<6> i -= 5; -<7> i <<= 2; -<8> i >>= 1; -<9> i >>>= 1; -<10> i &= 15; -<11> i ^= 12; -<12> i |= 2; +int i = 10; <1> +i *= 2; <2> +i /= 5; <3> +i %= 3; <4> +i += 5; <5> +i -= 5; <6> +i <<= 2; <7> +i >>= 1; <8> +i >>>= 1; <9> +i &= 15; <10> +i ^= 12; <11> +i |= 2; <12> ---- + <1> declare `int i`; @@ -362,10 +362,10 @@ operators. + [source,Painless] ---- -<1> boolean b = true; -<2> b &= false; -<3> b ^= false; -<4> b |= true; +boolean b = true; <1> +b &= false; <2> +b ^= false; <3> +b |= true; <4> ---- + <1> declare `boolean b`; @@ -387,8 +387,8 @@ operators. + [source,Painless] ---- -<1> String s = 'compound'; -<2> s += ' assignment'; +String s = 'compound'; <1> +s += ' assignment'; <2> ---- <1> declare `String s`; store `String 'compound'` to `s`; @@ -402,8 +402,8 @@ operators. + [source,Painless] ---- -<1> def x = 1; -<2> x += 2; +def x = 1; <1> +x += 2; <2> ---- <1> declare `def x`; implicit cast `int 1` to `def`; @@ -419,8 +419,8 @@ operators. + [source,Painless] ---- -<1> byte b = 1; -<2> b += 2; +byte b = 1; <1> +b += 2; <2> ---- <1> declare `byte b`; store `byte 1` to `x`; diff --git a/docs/painless/painless-operators-numeric.asciidoc b/docs/painless/painless-operators-numeric.asciidoc index d39b895908f44..22c2f04d50677 100644 --- a/docs/painless/painless-operators-numeric.asciidoc +++ b/docs/painless/painless-operators-numeric.asciidoc @@ -43,11 +43,11 @@ post_increment: ( variable | field ) '++'; + [source,Painless] ---- -<1> short i = 0; -<2> i++; -<3> long j = 1; -<4> long k; -<5> k = j++; +short i = 0; <1> +i++; <2> +long j = 1; <3> +long k; <4> +k = j++; <5> ---- + <1> declare `short i`; @@ -71,8 +71,8 @@ post_increment: ( variable | field ) '++'; + [source,Painless] ---- -<1> def x = 1; -<2> x++; +def x = 1; <1> +x++; <2> ---- + <1> declare `def x`; @@ -126,11 +126,11 @@ post_decrement: ( variable | field ) '--'; + [source,Painless] ---- -<1> short i = 0; -<2> i--; -<3> long j = 1; -<4> long k; -<5> k = j--; +short i = 0; <1> +i--; <2> +long j = 1; <3> +long k; <4> +k = j--; <5> ---- + <1> declare `short i`; @@ -154,8 +154,8 @@ post_decrement: ( variable | field ) '--'; + [source,Painless] ---- -<1> def x = 1; -<2> x--; +def x = 1; <1> +x--; <2> ---- + <1> declare `def x`; @@ -209,11 +209,11 @@ pre_increment: '++' ( variable | field ); + [source,Painless] ---- -<1> short i = 0; -<2> ++i; -<3> long j = 1; -<4> long k; -<5> k = ++j; +short i = 0; <1> +++i; <2> +long j = 1; <3> +long k; <4> +k = ++j; <5> ---- + <1> declare `short i`; @@ -237,8 +237,8 @@ pre_increment: '++' ( variable | field ); + [source,Painless] ---- -<1> def x = 1; -<2> ++x; +def x = 1; <1> +++x; <2> ---- + <1> declare `def x`; @@ -292,11 +292,11 @@ pre_increment: '--' ( variable | field ); + [source,Painless] ---- -<1> short i = 0; -<2> --i; -<3> long j = 1; -<4> long k; -<5> k = --j; +short i = 0; <1> +--i; <2> +long j = 1; <3> +long k; <4> +k = --j; <5> ---- + <1> declare `short i`; @@ -320,8 +320,8 @@ pre_increment: '--' ( variable | field ); + [source,Painless] ---- -<1> def x = 1; -<2> --x; +def x = 1; <1> +--x; <2> ---- + <1> declare `def x`; @@ -356,8 +356,8 @@ unary_positive: '+' expression; + [source,Painless] ---- -<1> int x = +1; -<2> long y = +x; +int x = +1; <1> +long y = +x; <2> ---- + <1> declare `int x`; @@ -373,8 +373,8 @@ unary_positive: '+' expression; + [source,Painless] ---- -<1> def z = +1; -<2> int i = +z; +def z = +1; <1> +int i = +z; <2> ---- <1> declare `def z`; identity `int 1` -> `int 1`; @@ -408,8 +408,8 @@ unary_negative: '-' expression; + [source,Painless] ---- -<1> int x = -1; -<2> long y = -x; +int x = -1; <1> +long y = -x; <2> ---- + <1> declare `int x`; @@ -425,8 +425,8 @@ unary_negative: '-' expression; + [source,Painless] ---- -<1> def z = -1; -<2> int i = -z; +def z = -1; <1> +int i = -z; <2> ---- <1> declare `def z`; negate `int 1` -> `int -1`; @@ -484,9 +484,9 @@ bitwise_not: '~' expression; + [source,Painless] ---- -<1> byte b = 1; -<2> int i = ~b; -<3> long l = ~i; +byte b = 1; <1> +int i = ~b; <2> +long l = ~i; <3> ---- + <1> declare `byte x`; @@ -506,8 +506,8 @@ bitwise_not: '~' expression; + [source,Painless] ---- -<1> def d = 1; -<2> def e = ~d; +def d = 1; <1> +def e = ~d; <2> ---- + <1> declare `def d`; @@ -559,8 +559,8 @@ multiplication: expression '*' expression; + [source,Painless] ---- -<1> int i = 5*4; -<2> double d = i*7.0; +int i = 5*4; <1> +double d = i*7.0; <2> ---- + <1> declare `int i`; @@ -577,8 +577,8 @@ multiplication: expression '*' expression; + [source,Painless] ---- -<1> def x = 5*4; -<2> def y = x*2; +def x = 5*4; <1> +def y = x*2; <2> ---- <1> declare `def x`; multiply `int 5` by `int 4` -> `int 20`; @@ -632,8 +632,8 @@ division: expression '/' expression; + [source,Painless] ---- -<1> int i = 29/4; -<2> double d = i/7.0; +int i = 29/4; <1> +double d = i/7.0; <2> ---- + <1> declare `int i`; @@ -650,8 +650,8 @@ division: expression '/' expression; + [source,Painless] ---- -<1> def x = 5/4; -<2> def y = x/2; +def x = 5/4; <1> +def y = x/2; <2> ---- <1> declare `def x`; divide `int 5` by `int 4` -> `int 1`; @@ -703,8 +703,8 @@ remainder: expression '%' expression; + [source,Painless] ---- -<1> int i = 29%4; -<2> double d = i%7.0; +int i = 29%4; <1> +double d = i%7.0; <2> ---- + <1> declare `int i`; @@ -721,8 +721,8 @@ remainder: expression '%' expression; + [source,Painless] ---- -<1> def x = 5%4; -<2> def y = x%2; +def x = 5%4; <1> +def y = x%2; <2> ---- <1> declare `def x`; remainder `int 5` by `int 4` -> `int 1`; @@ -773,8 +773,8 @@ addition: expression '+' expression; + [source,Painless] ---- -<1> int i = 29+4; -<2> double d = i+7.0; +int i = 29+4; <1> +double d = i+7.0; <2> ---- + <1> declare `int i`; @@ -791,8 +791,8 @@ addition: expression '+' expression; + [source,Painless] ---- -<1> def x = 5+4; -<2> def y = x+2; +def x = 5+4; <1> +def y = x+2; <2> ---- <1> declare `def x`; add `int 5` and `int 4` -> `int 9`; @@ -844,8 +844,8 @@ subtraction: expression '-' expression; + [source,Painless] ---- -<1> int i = 29-4; -<2> double d = i-7.5; +int i = 29-4; <1> +double d = i-7.5; <2> ---- + <1> declare `int i`; @@ -862,8 +862,8 @@ subtraction: expression '-' expression; + [source,Painless] ---- -<1> def x = 5-4; -<2> def y = x-2; +def x = 5-4; <1> +def y = x-2; <2> ---- <1> declare `def x`; subtract `int 4` and `int 5` -> `int 1`; @@ -918,8 +918,8 @@ below. The right-hand side integer type value is always implicitly cast to an + [source,Painless] ---- -<1> int i = 4 << 1; -<2> long l = i << 2L; +int i = 4 << 1; <1> +long l = i << 2L; <2> ---- + <1> declare `int i`; @@ -936,8 +936,8 @@ below. The right-hand side integer type value is always implicitly cast to an + [source,Painless] ---- -<1> def x = 4 << 2; -<2> def y = x << 1; +def x = 4 << 2; <1> +def y = x << 1; <2> ---- <1> declare `def x`; left shift `int 4` by `int 2` -> `int 16`; @@ -993,8 +993,8 @@ below. The right-hand side integer type value is always implicitly cast to an + [source,Painless] ---- -<1> int i = 32 >> 1; -<2> long l = i >> 2L; +int i = 32 >> 1; <1> +long l = i >> 2L; <2> ---- + <1> declare `int i`; @@ -1011,8 +1011,8 @@ below. The right-hand side integer type value is always implicitly cast to an + [source,Painless] ---- -<1> def x = 16 >> 2; -<2> def y = x >> 1; +def x = 16 >> 2; <1> +def y = x >> 1; <2> ---- <1> declare `def x`; right shift `int 16` by `int 2` -> `int 4`; @@ -1068,8 +1068,8 @@ below. The right-hand side integer type value is always implicitly cast to an + [source,Painless] ---- -<1> int i = -1 >>> 29; -<2> long l = i >>> 2L; +int i = -1 >>> 29; <1> +long l = i >>> 2L; <2> ---- + <1> declare `int i`; @@ -1086,8 +1086,8 @@ below. The right-hand side integer type value is always implicitly cast to an + [source,Painless] ---- -<1> def x = 16 >>> 2; -<2> def y = x >>> 1; +def x = 16 >>> 2; <1> +def y = x >>> 1; <2> ---- <1> declare `def x`; unsigned right shift `int 16` by `int 2` -> `int 4`; @@ -1146,8 +1146,8 @@ bitwise_and: expression '&' expression; + [source,Painless] ---- -<1> int i = 5 & 6; -<2> long l = i & 5L; +int i = 5 & 6; <1> +long l = i & 5L; <2> ---- + <1> declare `int i`; @@ -1164,8 +1164,8 @@ bitwise_and: expression '&' expression; + [source,Painless] ---- -<1> def x = 15 & 6; -<2> def y = x & 5; +def x = 15 & 6; <1> +def y = x & 5; <2> ---- <1> declare `def x`; bitwise and `int 15` and `int 6` -> `int 6`; @@ -1226,8 +1226,8 @@ bitwise_and: expression '^' expression; + [source,Painless] ---- -<1> int i = 5 ^ 6; -<2> long l = i ^ 5L; +int i = 5 ^ 6; <1> +long l = i ^ 5L; <2> ---- + <1> declare `int i`; @@ -1244,8 +1244,8 @@ bitwise_and: expression '^' expression; + [source,Painless] ---- -<1> def x = 15 ^ 6; -<2> def y = x ^ 5; +def x = 15 ^ 6; <1> +def y = x ^ 5; <2> ---- <1> declare `def x`; bitwise xor `int 15` and `int 6` -> `int 9`; @@ -1306,8 +1306,8 @@ bitwise_and: expression '|' expression; + [source,Painless] ---- -<1> int i = 5 | 6; -<2> long l = i | 8L; +int i = 5 | 6; <1> +long l = i | 8L; <2> ---- + <1> declare `int i`; @@ -1324,8 +1324,8 @@ bitwise_and: expression '|' expression; + [source,Painless] ---- -<1> def x = 5 ^ 6; -<2> def y = x ^ 8; +def x = 5 ^ 6; <1> +def y = x ^ 8; <2> ---- <1> declare `def x`; bitwise or `int 5` and `int 6` -> `int 7`; diff --git a/docs/painless/painless-operators-reference.asciidoc b/docs/painless/painless-operators-reference.asciidoc index 487fcce15f31b..dbdae92b270ad 100644 --- a/docs/painless/painless-operators-reference.asciidoc +++ b/docs/painless/painless-operators-reference.asciidoc @@ -38,12 +38,12 @@ arguments: '(' (expression (',' expression)*)? ')'; + [source,Painless] ---- -<1> Map m = new HashMap(); -<2> m.put(1, 2); -<3> int z = m.get(1); -<4> def d = new ArrayList(); -<5> d.add(1); -<6> int i = Integer.parseInt(d.get(0).toString()); +Map m = new HashMap(); <1> +m.put(1, 2); <2> +int z = m.get(1); <3> +def d = new ArrayList(); <4> +d.add(1); <5> +int i = Integer.parseInt(d.get(0).toString()); <6> ---- + <1> declare `Map m`; @@ -111,12 +111,12 @@ non-static member fields: + [source,Painless] ---- -<1> Example example = new Example(); -<2> example.x = 1; -<3> example.y = example.x; -<4> example.z = new ArrayList(); -<5> example.z.add(1); -<6> example.x = example.z.get(0); +Example example = new Example(); <1> +example.x = 1; <2> +example.y = example.x; <3> +example.z = new ArrayList(); <4> +example.z.add(1); <5> +example.x = example.z.get(0); <6> ---- + <1> declare `Example example`; @@ -192,8 +192,8 @@ non-static member fields: + [source,Painless] ---- -<1> Example example = new Example(); -<2> List x = example?.factory(); +Example example = new Example(); <1> +List x = example?.factory(); <2> ---- + <1> declare `Example example`; @@ -208,8 +208,8 @@ non-static member fields: + [source,Painless] ---- -<1> Example example = null; -<2> List x = example?.x; +Example example = null; <1> +List x = example?.x; <2> ---- <1> declare `Example example`; store `null` to `example` @@ -242,7 +242,7 @@ list_initialization: '[' expression (',' expression)* ']' + [source,Painless] ---- -<1> List empty = []; +List empty = []; <1> ---- + <1> declare `List empty`; @@ -254,7 +254,7 @@ list_initialization: '[' expression (',' expression)* ']' + [source,Painless] ---- -<1> List list = [1, 2, 3]; +List list = [1, 2, 3]; <1> ---- + <1> declare `List list`; @@ -269,12 +269,12 @@ list_initialization: '[' expression (',' expression)* ']' + [source,Painless] ---- -<1> int i = 1; -<2> long l = 2L; -<3> float f = 3.0F; -<4> double d = 4.0; -<5> String s = "5"; -<6> List list = [i, l, f*d, s]; +int i = 1; <1> +long l = 2L; <2> +float f = 3.0F; <3> +double d = 4.0; <4> +String s = "5"; <5> +List list = [i, l, f*d, s]; <6> ---- + <1> declare `int i`; @@ -329,15 +329,15 @@ list_access: '[' expression ']' + [source,Painless] ---- -<1> List list = new ArrayList(); -<2> list.add(1); -<3> list.add(2); -<4> list.add(3); -<5> list[0] = 2; -<6> list[1] = 5; -<7> int x = list[0] + list[1]; -<8> int y = 1; -<9> int z = list[y]; +List list = new ArrayList(); <1> +list.add(1); <2> +list.add(2); <3> +list.add(3); <4> +list[0] = 2; <5> +list[1] = 5; <6> +int x = list[0] + list[1]; <7> +int y = 1; <8> +int z = list[y]; <9> ---- + <1> declare `List list`; @@ -376,15 +376,15 @@ list_access: '[' expression ']' + [source,Painless] ---- -<1> def d = new ArrayList(); -<2> d.add(1); -<3> d.add(2); -<4> d.add(3); -<5> d[0] = 2; -<6> d[1] = 5; -<7> def x = d[0] + d[1]; -<8> def y = 1; -<9> def z = d[y]; +def d = new ArrayList(); <1> +d.add(1); <2> +d.add(2); <3> +d.add(3); <4> +d[0] = 2; <5> +d[1] = 5; <6> +def x = d[0] + d[1]; <7> +def y = 1; <8> +def z = d[y]; <9> ---- + <1> declare `List d`; @@ -449,7 +449,7 @@ key_pair: expression ':' expression + [source,Painless] ---- -<1> Map empty = [:]; +Map empty = [:]; <1> ---- + <1> declare `Map empty`; @@ -461,7 +461,7 @@ key_pair: expression ':' expression + [source,Painless] ---- -<1> Map map = [1:2, 3:4, 5:6]; +Map map = [1:2, 3:4, 5:6]; <1> ---- + <1> declare `Map map`; @@ -476,13 +476,13 @@ key_pair: expression ':' expression + [source,Painless] ---- -<1> byte b = 0; -<2> int i = 1; -<3> long l = 2L; -<4> float f = 3.0F; -<5> double d = 4.0; -<6> String s = "5"; -<7> Map map = [b:i, l:f*d, d:s]; +byte b = 0; <1> +int i = 1; <2> +long l = 2L; <3> +float f = 3.0F; <4> +double d = 4.0; <5> +String s = "5"; <6> +Map map = [b:i, l:f*d, d:s]; <7> ---- + <1> declare `byte b`; @@ -538,12 +538,12 @@ map_access: '[' expression ']' + [source,Painless] ---- -<1> Map map = new HashMap(); -<2> map['value2'] = 2; -<3> map['value5'] = 5; -<4> int x = map['value2'] + map['value5']; -<5> String y = 'value5'; -<6> int z = x[z]; +Map map = new HashMap(); <1> +map['value2'] = 2; <2> +map['value5'] = 5; <3> +int x = map['value2'] + map['value5']; <4> +String y = 'value5'; <5> +int z = x[z]; <6> ---- + <1> declare `Map map`; @@ -576,12 +576,12 @@ map_access: '[' expression ']' + [source,Painless] ---- -<1> def d = new HashMap(); -<2> d['value2'] = 2; -<3> d['value5'] = 5; -<4> int x = d['value2'] + d['value5']; -<5> String y = 'value5'; -<6> def z = d[y]; +def d = new HashMap(); <1> +d['value2'] = 2; <2> +d['value5'] = 5; <3> +int x = d['value2'] + d['value5']; <4> +String y = 'value5'; <5> +def z = d[y]; <6> ---- + <1> declare `def d`; @@ -649,9 +649,9 @@ new_instance: 'new' TYPE '(' (expression (',' expression)*)? ')'; [source,Painless] ---- -<1> Map m = new HashMap(); -<2> def d = new ArrayList(); -<3> def e = new HashMap(m); +Map m = new HashMap(); <1> +def d = new ArrayList(); <2> +def e = new HashMap(m); <3> ---- <1> declare `Map m`; allocate `HashMap` instance -> `HashMap reference`; @@ -687,9 +687,9 @@ concatenate: expression '+' expression; + [source,Painless] ---- -<1> String x = "con"; -<2> String y = x + "cat"; -<3> String z = 4 + 5 + x; +String x = "con"; <1> +String y = x + "cat"; <2> +String z = 4 + 5 + x; <3> ---- + <1> declare `String x`; @@ -709,8 +709,8 @@ concatenate: expression '+' expression; + [source,Painless] ---- -<1> def d = 2; -<2> d = "con" + d + "cat"; +def d = 2; <1> +d = "con" + d + "cat"; <2> ---- + <1> declare `def`; @@ -749,10 +749,10 @@ elvis: expression '?:' expression; + [source,Painless] ---- -<1> List x = new ArrayList(); -<2> List y = x ?: new ArrayList(); -<3> y = null; -<4> List z = y ?: new ArrayList(); +List x = new ArrayList(); <1> +List y = x ?: new ArrayList(); <2> +y = null; <3> +List z = y ?: new ArrayList(); <4> ---- + <1> declare `List x`; diff --git a/docs/painless/painless-types.asciidoc b/docs/painless/painless-types.asciidoc index 65ae9b3f70360..7588d6a273a90 100644 --- a/docs/painless/painless-types.asciidoc +++ b/docs/painless/painless-types.asciidoc @@ -77,9 +77,9 @@ logical quantity with two possible values of `true` and `false` + [source,Painless] ---- -<1> int i = 1; -<2> double d; -<3> boolean b = true; +int i = 1; <1> +double d; <2> +boolean b = true; <3> ---- + <1> declare `int i`; @@ -93,8 +93,8 @@ logical quantity with two possible values of `true` and `false` + [source,Painless] ---- -<1> int i = 1; -<2> i.toString(); +int i = 1; <1> +i.toString(); <2> ---- + <1> declare `int i`; @@ -193,9 +193,9 @@ relationships. + [source,Painless] ---- -<1> List l = new ArrayList(); -<2> l.add(1); -<3> int i = l.get(0) + 2; +List l = new ArrayList(); <1> +l.add(1); <2> +int i = l.get(0) + 2; <3> ---- + <1> declare `List l`; @@ -216,11 +216,11 @@ relationships. + [source,Painless] ---- -<1> List l0 = new ArrayList(); -<2> List l1 = l0; -<3> l0.add(1); -<4> l1.add(2); -<5> int i = l1.get(0) + l0.get(1); +List l0 = new ArrayList(); <1> +List l1 = l0; <2> +l0.add(1); <3> +l1.add(2); <4> +int i = l1.get(0) + l0.get(1); <5> ---- + <1> declare `List l0`; @@ -251,8 +251,8 @@ relationships. + [source,Painless] ---- -<1> int i = Integer.MAX_VALUE; -<2> long l = Long.parseLong("123L"); +int i = Integer.MAX_VALUE; <1> +long l = Long.parseLong("123L"); <2> ---- + <1> declare `int i`; @@ -292,9 +292,9 @@ types and reference types directly when performance is critical. + [source,Painless] ---- -<1> def dp = 1; -<2> def dr = new ArrayList(); -<3> dr = dp; +def dp = 1; <1> +def dr = new ArrayList(); <2> +dr = dp; <3> ---- + <1> declare `def dp`; @@ -312,9 +312,9 @@ types and reference types directly when performance is critical. + [source,Painless] ---- -<1> Object l = new ArrayList(); -<2> def d = l; -<3> d.ensureCapacity(10); +Object l = new ArrayList(); <1> +def d = l; <2> +d.ensureCapacity(10); <3> ---- + <1> declare `Object l`; @@ -348,10 +348,10 @@ instances. + [source,Painless] ---- -<1> String r = "some text"; -<2> String s = 'some text'; -<3> String t = new String("some text"); -<4> String u; +String r = "some text"; <1> +String s = 'some text'; <2> +String t = new String("some text"); <3> +String u; <4> ---- + <1> declare `String r`; @@ -425,11 +425,11 @@ type `int[]`. And each element in the 1st dimension, `d-1` is the array type + [source,Painless] ---- -<1> int[] x; -<2> float[] y = new float[10]; -<3> def z = new float[5]; -<4> y[9] = 1.0F; -<5> z[0] = y[9]; +int[] x; <1> +float[] y = new float[10]; <2> +def z = new float[5]; <3> +y[9] = 1.0F; <4> +z[0] = y[9]; <5> ---- + <1> declare `int[] x`; @@ -456,9 +456,9 @@ type `int[]`. And each element in the 1st dimension, `d-1` is the array type + [source,Painless] ---- -<1> int[][][] ia3 = new int[2][3][4]; -<2> ia3[1][2][3] = 99; -<3> int i = ia3[1][2][3]; +int[][][] ia3 = new int[2][3][4]; <1> +ia3[1][2][3] = 99; <2> +int i = ia3[1][2][3]; <3> ---- + <1> declare `int[][][] ia`; diff --git a/docs/painless/painless-variables.asciidoc b/docs/painless/painless-variables.asciidoc index 8f83b9e2b573b..d86b8ba17214a 100644 --- a/docs/painless/painless-variables.asciidoc +++ b/docs/painless/painless-variables.asciidoc @@ -36,13 +36,13 @@ assignment: '=' expression; + [source,Painless] ---- -<1> int x; -<2> List y; -<3> int x, y = 5, z; -<4> def d; -<5> int i = 10; -<6> float[] f; -<7> Map[][] m; +int x; <1> +List y; <2> +int x, y = 5, z; <3> +def d; <4> +int i = 10; <5> +float[] f; <6> +Map[][] m; <7> ---- + <1> declare `int x`; @@ -90,8 +90,8 @@ assignment: ID '=' expression + [source,Painless] ---- -<1> int i; -<2> i = 10; +int i; <1> +i = 10; <2> ---- + <1> declare `int i`; @@ -102,8 +102,8 @@ assignment: ID '=' expression + [source,Painless] ---- -<1> int i = 10; -<2> double j = 2.0; +int i = 10; <1> +double j = 2.0; <2> ---- + <1> declare `int i`; @@ -115,8 +115,8 @@ assignment: ID '=' expression + [source,Painless] ---- -<1> int i = 10; -<2> int j = i; +int i = 10; <1> +int j = i; <2> ---- + <1> declare `int i`; @@ -130,8 +130,8 @@ assignment: ID '=' expression + [source,Painless] ---- -<1> ArrayList l = new ArrayList(); -<2> Map m = new HashMap(); +ArrayList l = new ArrayList(); <1> +Map m = new HashMap(); <2> ---- + <1> declare `ArrayList l`; @@ -146,10 +146,10 @@ assignment: ID '=' expression + [source,Painless] ---- -<1> List l = new ArrayList(); -<2> List k = l; -<3> List m; -<4> m = k; +List l = new ArrayList(); <1> +List k = l; <2> +List m; <3> +m = k; <4> ---- + <1> declare `List l`; @@ -171,13 +171,13 @@ assignment: ID '=' expression + [source,Painless] ---- -<1> int[] ia1; -<2> ia1 = new int[2]; -<3> ia1[0] = 1; -<4> int[] ib1 = ia1; -<5> int[][] ic2 = new int[2][5]; -<6> ic2[1][3] = 2; -<7> ic2[0] = ia1; +int[] ia1; <1> +ia1 = new int[2]; <2> +ia1[0] = 1; <3> +int[] ib1 = ia1; <4> +int[][] ic2 = new int[2][5]; <5> +ic2[1][3] = 2; <6> +ic2[0] = ia1; <7> ---- + <1> declare `int[] ia1`;