Skip to content

Commit

Permalink
Docs: Drop inline callouts from painless book (#40805)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nik9000 committed Apr 4, 2019
1 parent 40dd85f commit 7c66769
Show file tree
Hide file tree
Showing 9 changed files with 487 additions and 487 deletions.
96 changes: 48 additions & 48 deletions docs/painless/painless-casting.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
Expand Down Expand Up @@ -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`;
Expand All @@ -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`;
Expand Down Expand Up @@ -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`;
Expand All @@ -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`;
Expand Down Expand Up @@ -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`;
Expand Down Expand Up @@ -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`;
Expand Down Expand Up @@ -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`;
Expand Down Expand Up @@ -314,8 +314,8 @@ Use the cast operator to convert a <<string-type, `String` type>> 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`;
Expand All @@ -328,8 +328,8 @@ Use the cast operator to convert a <<string-type, `String` type>> 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`;
Expand Down Expand Up @@ -368,10 +368,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`;
Expand Down Expand Up @@ -399,10 +399,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`;
Expand Down Expand Up @@ -437,9 +437,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`;
Expand Down
22 changes: 11 additions & 11 deletions docs/painless/painless-literals.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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`
Expand Down
56 changes: 28 additions & 28 deletions docs/painless/painless-operators-array.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
Expand All @@ -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`;
Expand Down Expand Up @@ -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`;
Expand Down Expand Up @@ -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`;
Expand Down Expand Up @@ -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`;
Expand Down Expand Up @@ -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]`
Expand Down Expand Up @@ -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`;
Expand Down
Loading

0 comments on commit 7c66769

Please sign in to comment.