OSDN Git Service

TextureRegion caches region width/height. No longer returns negative width/height...
authornathan.sweet <nathan.sweet@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Thu, 19 Jul 2012 17:18:20 +0000 (17:18 +0000)
committernathan.sweet <nathan.sweet@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Thu, 19 Jul 2012 17:18:20 +0000 (17:18 +0000)
14 files changed:
extensions/gdx-image/src/com/badlogic/gdx/graphics/g2d/Jpeg.java
gdx/src/com/badlogic/gdx/graphics/g2d/Animation.java
gdx/src/com/badlogic/gdx/graphics/g2d/TextureRegion.java
gdx/src/com/badlogic/gdx/graphics/glutils/ShapeRenderer.java
gdx/src/com/badlogic/gdx/utils/Array.java
gdx/src/com/badlogic/gdx/utils/BooleanArray.java
gdx/src/com/badlogic/gdx/utils/CharArray.java
gdx/src/com/badlogic/gdx/utils/FloatArray.java
gdx/src/com/badlogic/gdx/utils/IntArray.java
gdx/src/com/badlogic/gdx/utils/JsonReader.java
gdx/src/com/badlogic/gdx/utils/JsonReader.rl
gdx/src/com/badlogic/gdx/utils/JsonWriter.java
gdx/src/com/badlogic/gdx/utils/LongArray.java
tests/gdx-tests/src/com/badlogic/gdx/tests/TableLayoutTest.java

index 1267e53..8a44bb5 100644 (file)
@@ -28,7 +28,7 @@ import com.badlogic.gdx.utils.SharedLibraryLoader;
  * Very thin wrapper around libjpeg. Returns Pixmaps given a file or raw jpeg data in a byte array.\r
  * The returned Pixmap will always have the {@link Format#RGB888} format.\r
  * @author mzechner\r
- *\r
+ * @author Nathan Sweet\r
  */\r
 public class Jpeg {\r
        static {\r
index 9084b53..3ede42e 100644 (file)
@@ -45,12 +45,12 @@ public class Animation {
         * \r
         * @param frameDuration the time between frames in seconds.\r
         * @param keyFrames the {@link TextureRegion}s representing the frames. */\r
-       public Animation (float frameDuration, Array keyFrames) {\r
+       public Animation (float frameDuration, Array<? extends TextureRegion> keyFrames) {\r
                this.frameDuration = frameDuration;\r
                this.animationDuration = keyFrames.size * frameDuration;\r
                this.keyFrames = new TextureRegion[keyFrames.size];\r
                for (int i = 0, n = keyFrames.size; i < n; i++) {\r
-                       this.keyFrames[i] = (TextureRegion)keyFrames.get(i);\r
+                       this.keyFrames[i] = keyFrames.get(i);\r
                }\r
 \r
                this.playMode = NORMAL;\r
@@ -61,13 +61,13 @@ public class Animation {
         * @param frameDuration the time between frames in seconds.\r
         * @param keyFrames the {@link TextureRegion}s representing the frames.\r
         * @param playType the type of animation play (NORMAL, REVERSED, LOOP, LOOP_REVERSED, LOOP_PINGPONG, LOOP_RANDOM) */\r
-       public Animation (float frameDuration, Array keyFrames, int playType) {\r
+       public Animation (float frameDuration, Array<? extends TextureRegion> keyFrames, int playType) {\r
 \r
                this.frameDuration = frameDuration;\r
                this.animationDuration = keyFrames.size * frameDuration;\r
                this.keyFrames = new TextureRegion[keyFrames.size];\r
                for (int i = 0, n = keyFrames.size; i < n; i++) {\r
-                       this.keyFrames[i] = (TextureRegion)keyFrames.get(i);\r
+                       this.keyFrames[i] = keyFrames.get(i);\r
                }\r
 \r
                this.playMode = playType;\r
index fe8754d..f35e7b5 100644 (file)
@@ -26,6 +26,7 @@ public class TextureRegion {
        Texture texture;\r
        float u, v;\r
        float u2, v2;\r
+       int regionWidth, regionHeight;\r
 \r
        /** Constructs a region with no texture and no coordinates defined. */\r
        public TextureRegion () {\r
@@ -80,7 +81,12 @@ public class TextureRegion {
        public void setRegion (int x, int y, int width, int height) {\r
                float invTexWidth = 1f / texture.getWidth();\r
                float invTexHeight = 1f / texture.getHeight();\r
-               setRegion(x * invTexWidth, y * invTexHeight, (x + width) * invTexWidth, (y + height) * invTexHeight);\r
+               this.u = x * invTexWidth;\r
+               this.v = y * invTexHeight;\r
+               this.u2 = (x + width) * invTexWidth;\r
+               this.v2 = (y + height) * invTexHeight;\r
+               regionWidth = Math.abs(width);\r
+               regionHeight = Math.abs(height);\r
        }\r
 \r
        public void setRegion (float u, float v, float u2, float v2) {\r
@@ -88,6 +94,8 @@ public class TextureRegion {
                this.v = v;\r
                this.u2 = u2;\r
                this.v2 = v2;\r
+               regionWidth = Math.round(Math.abs(u2 - u) * texture.getWidth());\r
+               regionHeight = Math.round(Math.abs(v2 - v) * texture.getHeight());\r
        }\r
 \r
        /** Sets the texture and coordinates to the specified region. */\r
@@ -116,6 +124,7 @@ public class TextureRegion {
 \r
        public void setU (float u) {\r
                this.u = u;\r
+               regionWidth = Math.round(Math.abs(u2 - u) * texture.getWidth());\r
        }\r
 \r
        public float getV () {\r
@@ -124,6 +133,7 @@ public class TextureRegion {
 \r
        public void setV (float v) {\r
                this.v = v;\r
+               regionHeight = Math.round(Math.abs(v2 - v) * texture.getHeight());\r
        }\r
 \r
        public float getU2 () {\r
@@ -132,6 +142,7 @@ public class TextureRegion {
 \r
        public void setU2 (float u2) {\r
                this.u2 = u2;\r
+               regionWidth = Math.round(Math.abs(u2 - u) * texture.getWidth());\r
        }\r
 \r
        public float getV2 () {\r
@@ -140,6 +151,7 @@ public class TextureRegion {
 \r
        public void setV2 (float v2) {\r
                this.v2 = v2;\r
+               regionHeight = Math.round(Math.abs(v2 - v) * texture.getHeight());\r
        }\r
 \r
        public int getRegionX () {\r
@@ -158,18 +170,18 @@ public class TextureRegion {
                setV(y / (float)texture.getHeight());\r
        }\r
 \r
-       /** Returns the region's width. May be negative if the texture region is flipped horizontally. */\r
+       /** Returns the region's width. */\r
        public int getRegionWidth () {\r
-               return Math.round((u2 - u) * texture.getWidth());\r
+               return regionWidth;\r
        }\r
 \r
        public void setRegionWidth (int width) {\r
                setU2(u + width / (float)texture.getWidth());\r
        }\r
 \r
-       /** Returns the region's height. May be negative if the texture region is flipped horizontally. */\r
+       /** Returns the region's height. */\r
        public int getRegionHeight () {\r
-               return Math.round((v2 - v) * texture.getHeight());\r
+               return regionHeight;\r
        }\r
 \r
        public void setRegionHeight (int height) {\r
@@ -189,6 +201,14 @@ public class TextureRegion {
                }\r
        }\r
 \r
+       public boolean isFlipX () {\r
+               return u > u2;\r
+       }\r
+\r
+       public boolean isFlipY () {\r
+               return v > v2;\r
+       }\r
+\r
        /** Offsets the region relative to the current region. Generally the region's size should be the entire size of the texture in\r
         * the direction(s) it is scrolled.\r
         * @param xAmount The percentage to offset horizontally.\r
@@ -216,8 +236,8 @@ public class TextureRegion {
        public TextureRegion[][] split (int tileWidth, int tileHeight) {\r
                int x = getRegionX();\r
                int y = getRegionY();\r
-               int width = getRegionWidth();\r
-               int height = getRegionHeight();\r
+               int width = regionWidth;\r
+               int height = regionHeight;\r
 \r
                if (width < 0) {\r
                        x = x - width;\r
index 1371e4e..de6d9e6 100644 (file)
@@ -302,11 +302,10 @@ public class ShapeRenderer {
                renderer.color(color.r, color.g, color.b, color.a);\r
                renderer.vertex(x, y, 0);\r
        }\r
-       \r
+\r
        /** Draws a filled rectangle in the x/y plane. The x and y coordinate specify the bottom left corner of the rectangle. The\r
-        * {@link ShapeType} passed to begin has to be {@link ShapeType#FilledRectangle}. The 4 color parameters\r
-        * specify the color for the bottom left, bottom right, top right and top left corner of the rectangle, allowing\r
-        * you to create gradients.\r
+        * {@link ShapeType} passed to begin has to be {@link ShapeType#FilledRectangle}. The 4 color parameters specify the color for\r
+        * the bottom left, bottom right, top right and top left corner of the rectangle, allowing you to create gradients.\r
         * @param x\r
         * @param y\r
         * @param width\r
index 0885a80..35d4178 100644 (file)
@@ -236,6 +236,11 @@ public class Array<T> implements Iterable<T> {
                return items[size - 1];\r
        }\r
 \r
+       /** Returns the first item. */\r
+       public T first () {\r
+               return items[0];\r
+       }\r
+\r
        public void clear () {\r
                T[] items = this.items;\r
                for (int i = 0, n = size; i < n; i++)\r
index 1997bc6..ab32820 100644 (file)
@@ -155,6 +155,11 @@ public class BooleanArray {
                return items[size - 1];\r
        }\r
 \r
+       /** Returns the first item. */\r
+       public boolean first () {\r
+               return items[0];\r
+       }\r
+\r
        public void clear () {\r
                size = 0;\r
        }\r
index c7ab12d..c566884 100644 (file)
@@ -186,6 +186,11 @@ public class CharArray {
                return items[size - 1];\r
        }\r
 \r
+       /** Returns the first item. */\r
+       public char first () {\r
+               return items[0];\r
+       }\r
+\r
        public void clear () {\r
                size = 0;\r
        }\r
index 123258e..b6bc343 100644 (file)
@@ -186,6 +186,11 @@ public class FloatArray {
                return items[size - 1];\r
        }\r
 \r
+       /** Returns the first item. */\r
+       public float first () {\r
+               return items[0];\r
+       }\r
+\r
        public void clear () {\r
                size = 0;\r
        }\r
index 1c3cd95..f8733ee 100644 (file)
@@ -186,6 +186,11 @@ public class IntArray {
                return items[size - 1];\r
        }\r
 \r
+       /** Returns the first item. */\r
+       public int first () {\r
+               return items[0];\r
+       }\r
+\r
        public void clear () {\r
                size = 0;\r
        }\r
index 5610fdb..bb35d5c 100644 (file)
@@ -86,6 +86,7 @@ public class JsonReader {
                int s = 0;\r
                Array<String> names = new Array(8);\r
                boolean needsUnescape = false;\r
+               boolean discardBuffer = false; // When unquotedString and true/false/null both match, this discards unquotedString.\r
                RuntimeException parseRuntimeEx = null;\r
 \r
                boolean debug = false;\r
@@ -177,20 +178,21 @@ public class JsonReader {
                                                        while (_nacts-- > 0) {\r
                                                                switch (_json_actions[_acts++]) {\r
                                                                case 0:\r
-                                                               // line 99 "JsonReader.rl"\r
+                                                               // line 105 "JsonReader.rl"\r
                                                                {\r
                                                                        s = p;\r
                                                                        needsUnescape = false;\r
+                                                                       discardBuffer = false;\r
                                                                }\r
                                                                        break;\r
                                                                case 1:\r
-                                                               // line 103 "JsonReader.rl"\r
+                                                               // line 110 "JsonReader.rl"\r
                                                                {\r
                                                                        needsUnescape = true;\r
                                                                }\r
                                                                        break;\r
                                                                case 2:\r
-                                                               // line 106 "JsonReader.rl"\r
+                                                               // line 113 "JsonReader.rl"\r
                                                                {\r
                                                                        String name = new String(data, s, p - s);\r
                                                                        s = p;\r
@@ -200,18 +202,20 @@ public class JsonReader {
                                                                }\r
                                                                        break;\r
                                                                case 3:\r
-                                                               // line 113 "JsonReader.rl"\r
+                                                               // line 120 "JsonReader.rl"\r
                                                                {\r
-                                                                       String value = new String(data, s, p - s);\r
-                                                                       s = p;\r
-                                                                       if (needsUnescape) value = unescape(value);\r
-                                                                       String name = names.size > 0 ? names.pop() : null;\r
-                                                                       if (debug) System.out.println("string: " + name + "=" + value);\r
-                                                                       string(name, value);\r
+                                                                       if (!discardBuffer) {\r
+                                                                               String value = new String(data, s, p - s);\r
+                                                                               s = p;\r
+                                                                               if (needsUnescape) value = unescape(value);\r
+                                                                               String name = names.size > 0 ? names.pop() : null;\r
+                                                                               if (debug) System.out.println("string: " + name + "=" + value);\r
+                                                                               string(name, value);\r
+                                                                       }\r
                                                                }\r
                                                                        break;\r
                                                                case 4:\r
-                                                               // line 121 "JsonReader.rl"\r
+                                                               // line 130 "JsonReader.rl"\r
                                                                {\r
                                                                        String value = new String(data, s, p - s);\r
                                                                        s = p;\r
@@ -221,31 +225,34 @@ public class JsonReader {
                                                                }\r
                                                                        break;\r
                                                                case 5:\r
-                                                               // line 128 "JsonReader.rl"\r
+                                                               // line 137 "JsonReader.rl"\r
                                                                {\r
                                                                        String name = names.size > 0 ? names.pop() : null;\r
                                                                        if (debug) System.out.println("boolean: " + name + "=true");\r
                                                                        bool(name, true);\r
+                                                                       discardBuffer = true;\r
                                                                }\r
                                                                        break;\r
                                                                case 6:\r
-                                                               // line 133 "JsonReader.rl"\r
+                                                               // line 143 "JsonReader.rl"\r
                                                                {\r
                                                                        String name = names.size > 0 ? names.pop() : null;\r
                                                                        if (debug) System.out.println("boolean: " + name + "=false");\r
                                                                        bool(name, false);\r
+                                                                       discardBuffer = true;\r
                                                                }\r
                                                                        break;\r
                                                                case 7:\r
-                                                               // line 138 "JsonReader.rl"\r
+                                                               // line 149 "JsonReader.rl"\r
                                                                {\r
                                                                        String name = names.size > 0 ? names.pop() : null;\r
                                                                        if (debug) System.out.println("null: " + name);\r
                                                                        string(name, null);\r
+                                                                       discardBuffer = true;\r
                                                                }\r
                                                                        break;\r
                                                                case 8:\r
-                                                               // line 143 "JsonReader.rl"\r
+                                                               // line 155 "JsonReader.rl"\r
                                                                {\r
                                                                        String name = names.size > 0 ? names.pop() : null;\r
                                                                        if (debug) System.out.println("startObject: " + name);\r
@@ -266,7 +273,7 @@ public class JsonReader {
                                                                }\r
                                                                        break;\r
                                                                case 9:\r
-                                                               // line 149 "JsonReader.rl"\r
+                                                               // line 161 "JsonReader.rl"\r
                                                                {\r
                                                                        if (debug) System.out.println("endObject");\r
                                                                        pop();\r
@@ -278,7 +285,7 @@ public class JsonReader {
                                                                }\r
                                                                        break;\r
                                                                case 10:\r
-                                                               // line 154 "JsonReader.rl"\r
+                                                               // line 166 "JsonReader.rl"\r
                                                                {\r
                                                                        String name = names.size > 0 ? names.pop() : null;\r
                                                                        if (debug) System.out.println("startArray: " + name);\r
@@ -291,7 +298,7 @@ public class JsonReader {
                                                                                }\r
                                                                                {\r
                                                                                        stack[top++] = cs;\r
-                                                                                       cs = 42;\r
+                                                                                       cs = 49;\r
                                                                                        _goto_targ = 2;\r
                                                                                        if (true) continue _goto;\r
                                                                                }\r
@@ -299,7 +306,7 @@ public class JsonReader {
                                                                }\r
                                                                        break;\r
                                                                case 11:\r
-                                                               // line 160 "JsonReader.rl"\r
+                                                               // line 172 "JsonReader.rl"\r
                                                                {\r
                                                                        if (debug) System.out.println("endArray");\r
                                                                        pop();\r
@@ -310,7 +317,7 @@ public class JsonReader {
                                                                        }\r
                                                                }\r
                                                                        break;\r
-                                                               // line 201 "JsonReader.java"\r
+                                                               // line 207 "JsonReader.java"\r
                                                                }\r
                                                        }\r
                                                }\r
@@ -331,18 +338,20 @@ public class JsonReader {
                                                        while (__nacts-- > 0) {\r
                                                                switch (_json_actions[__acts++]) {\r
                                                                case 3:\r
-                                                               // line 113 "JsonReader.rl"\r
+                                                               // line 120 "JsonReader.rl"\r
                                                                {\r
-                                                                       String value = new String(data, s, p - s);\r
-                                                                       s = p;\r
-                                                                       if (needsUnescape) value = unescape(value);\r
-                                                                       String name = names.size > 0 ? names.pop() : null;\r
-                                                                       if (debug) System.out.println("string: " + name + "=" + value);\r
-                                                                       string(name, value);\r
+                                                                       if (!discardBuffer) {\r
+                                                                               String value = new String(data, s, p - s);\r
+                                                                               s = p;\r
+                                                                               if (needsUnescape) value = unescape(value);\r
+                                                                               String name = names.size > 0 ? names.pop() : null;\r
+                                                                               if (debug) System.out.println("string: " + name + "=" + value);\r
+                                                                               string(name, value);\r
+                                                                       }\r
                                                                }\r
                                                                        break;\r
                                                                case 4:\r
-                                                               // line 121 "JsonReader.rl"\r
+                                                               // line 130 "JsonReader.rl"\r
                                                                {\r
                                                                        String value = new String(data, s, p - s);\r
                                                                        s = p;\r
@@ -352,30 +361,33 @@ public class JsonReader {
                                                                }\r
                                                                        break;\r
                                                                case 5:\r
-                                                               // line 128 "JsonReader.rl"\r
+                                                               // line 137 "JsonReader.rl"\r
                                                                {\r
                                                                        String name = names.size > 0 ? names.pop() : null;\r
                                                                        if (debug) System.out.println("boolean: " + name + "=true");\r
                                                                        bool(name, true);\r
+                                                                       discardBuffer = true;\r
                                                                }\r
                                                                        break;\r
                                                                case 6:\r
-                                                               // line 133 "JsonReader.rl"\r
+                                                               // line 143 "JsonReader.rl"\r
                                                                {\r
                                                                        String name = names.size > 0 ? names.pop() : null;\r
                                                                        if (debug) System.out.println("boolean: " + name + "=false");\r
                                                                        bool(name, false);\r
+                                                                       discardBuffer = true;\r
                                                                }\r
                                                                        break;\r
                                                                case 7:\r
-                                                               // line 138 "JsonReader.rl"\r
+                                                               // line 149 "JsonReader.rl"\r
                                                                {\r
                                                                        String name = names.size > 0 ? names.pop() : null;\r
                                                                        if (debug) System.out.println("null: " + name);\r
                                                                        string(name, null);\r
+                                                                       discardBuffer = true;\r
                                                                }\r
                                                                        break;\r
-                                                               // line 267 "JsonReader.java"\r
+                                                               // line 278 "JsonReader.java"\r
                                                                }\r
                                                        }\r
                                                }\r
@@ -386,7 +398,7 @@ public class JsonReader {
                                }\r
                        }\r
 \r
-                       // line 190 "JsonReader.rl"\r
+                       // line 202 "JsonReader.rl"\r
 \r
                } catch (RuntimeException ex) {\r
                        parseRuntimeEx = ex;\r
@@ -411,133 +423,140 @@ public class JsonReader {
                return root;\r
        }\r
 \r
-       // line 277 "JsonReader.java"\r
+       // line 288 "JsonReader.java"\r
        private static byte[] init__json_actions_0 () {\r
-               return new byte[] {0, 1, 0, 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1, 10, 1, 11, 2, 0, 2, 2, 0, 3, 2, 3, 9,\r
-                       2, 3, 11, 2, 4, 9, 2, 4, 11, 2, 5, 9, 2, 5, 11, 2, 6, 9, 2, 6, 11, 2, 7, 9, 2, 7, 11};\r
+               return new byte[] {0, 1, 0, 1, 1, 1, 2, 1, 3, 1, 4, 1, 8, 1, 9, 1, 10, 1, 11, 2, 0, 2, 2, 0, 3, 2, 3, 9, 2, 3, 11, 2, 4, 9,\r
+                       2, 4, 11, 2, 5, 3, 2, 6, 3, 2, 7, 3, 3, 5, 3, 9, 3, 5, 3, 11, 3, 6, 3, 9, 3, 6, 3, 11, 3, 7, 3, 9, 3, 7, 3, 11};\r
        }\r
 \r
        private static final byte _json_actions[] = init__json_actions_0();\r
 \r
        private static short[] init__json_key_offsets_0 () {\r
-               return new short[] {0, 0, 18, 20, 22, 31, 33, 35, 39, 41, 53, 55, 57, 61, 79, 81, 83, 88, 99, 106, 115, 122, 124, 134, 136,\r
-                       145, 149, 151, 158, 166, 174, 182, 190, 195, 203, 211, 219, 224, 232, 240, 248, 253, 262, 282, 284, 286, 291, 310, 317,\r
-                       319, 329, 331, 340, 344, 346, 353, 361, 369, 377, 385, 390, 398, 406, 414, 419, 427, 435, 443, 448, 457, 460, 467, 475,\r
-                       482, 487, 495, 503, 511, 519, 522, 530, 538, 546, 549, 557, 565, 573, 576, 576};\r
+               return new short[] {0, 0, 18, 20, 22, 31, 33, 35, 39, 41, 56, 58, 60, 64, 82, 84, 86, 91, 105, 112, 114, 123, 125, 133,\r
+                       137, 139, 145, 154, 161, 163, 173, 175, 184, 188, 190, 197, 205, 213, 221, 229, 236, 244, 252, 260, 267, 275, 283, 291,\r
+                       298, 307, 327, 329, 331, 336, 355, 362, 364, 374, 376, 385, 389, 391, 398, 406, 414, 422, 430, 437, 445, 453, 461, 468,\r
+                       476, 484, 492, 499, 508, 511, 518, 526, 533, 538, 546, 554, 562, 570, 577, 585, 593, 601, 608, 616, 624, 632, 639, 639};\r
        }\r
 \r
        private static final short _json_key_offsets[] = init__json_key_offsets_0();\r
 \r
        private static char[] init__json_trans_keys_0 () {\r
                return new char[] {32, 34, 36, 45, 91, 95, 102, 110, 116, 123, 9, 13, 48, 57, 65, 90, 97, 122, 34, 92, 34, 92, 34, 47, 92,\r
-                       98, 102, 110, 114, 116, 117, 48, 57, 48, 57, 43, 45, 48, 57, 48, 57, 32, 34, 36, 44, 95, 125, 9, 13, 65, 90, 97, 122,\r
-                       34, 92, 34, 92, 32, 58, 9, 13, 32, 34, 36, 45, 91, 95, 102, 110, 116, 123, 9, 13, 48, 57, 65, 90, 97, 122, 34, 92, 34,\r
-                       92, 32, 44, 125, 9, 13, 32, 34, 36, 95, 125, 9, 13, 65, 90, 97, 122, 32, 44, 58, 93, 125, 9, 13, 34, 47, 92, 98, 102,\r
-                       110, 114, 116, 117, 32, 44, 58, 93, 125, 9, 13, 48, 57, 32, 44, 46, 69, 101, 125, 9, 13, 48, 57, 48, 57, 32, 44, 69,\r
-                       101, 125, 9, 13, 48, 57, 43, 45, 48, 57, 48, 57, 32, 44, 125, 9, 13, 48, 57, 32, 44, 58, 93, 97, 125, 9, 13, 32, 44, 58,\r
-                       93, 108, 125, 9, 13, 32, 44, 58, 93, 115, 125, 9, 13, 32, 44, 58, 93, 101, 125, 9, 13, 32, 44, 125, 9, 13, 32, 44, 58,\r
-                       93, 117, 125, 9, 13, 32, 44, 58, 93, 108, 125, 9, 13, 32, 44, 58, 93, 108, 125, 9, 13, 32, 44, 125, 9, 13, 32, 44, 58,\r
-                       93, 114, 125, 9, 13, 32, 44, 58, 93, 117, 125, 9, 13, 32, 44, 58, 93, 101, 125, 9, 13, 32, 44, 125, 9, 13, 34, 47, 92,\r
-                       98, 102, 110, 114, 116, 117, 32, 34, 36, 44, 45, 91, 93, 95, 102, 110, 116, 123, 9, 13, 48, 57, 65, 90, 97, 122, 34, 92,\r
-                       34, 92, 32, 44, 93, 9, 13, 32, 34, 36, 45, 91, 93, 95, 102, 110, 116, 123, 9, 13, 48, 57, 65, 90, 97, 122, 32, 44, 58,\r
-                       93, 125, 9, 13, 48, 57, 32, 44, 46, 69, 93, 101, 9, 13, 48, 57, 48, 57, 32, 44, 69, 93, 101, 9, 13, 48, 57, 43, 45, 48,\r
-                       57, 48, 57, 32, 44, 93, 9, 13, 48, 57, 32, 44, 58, 93, 97, 125, 9, 13, 32, 44, 58, 93, 108, 125, 9, 13, 32, 44, 58, 93,\r
-                       115, 125, 9, 13, 32, 44, 58, 93, 101, 125, 9, 13, 32, 44, 93, 9, 13, 32, 44, 58, 93, 117, 125, 9, 13, 32, 44, 58, 93,\r
-                       108, 125, 9, 13, 32, 44, 58, 93, 108, 125, 9, 13, 32, 44, 93, 9, 13, 32, 44, 58, 93, 114, 125, 9, 13, 32, 44, 58, 93,\r
-                       117, 125, 9, 13, 32, 44, 58, 93, 101, 125, 9, 13, 32, 44, 93, 9, 13, 34, 47, 92, 98, 102, 110, 114, 116, 117, 32, 9, 13,\r
-                       32, 44, 58, 93, 125, 9, 13, 32, 46, 69, 101, 9, 13, 48, 57, 32, 69, 101, 9, 13, 48, 57, 32, 9, 13, 48, 57, 32, 44, 58,\r
-                       93, 97, 125, 9, 13, 32, 44, 58, 93, 108, 125, 9, 13, 32, 44, 58, 93, 115, 125, 9, 13, 32, 44, 58, 93, 101, 125, 9, 13,\r
-                       32, 9, 13, 32, 44, 58, 93, 117, 125, 9, 13, 32, 44, 58, 93, 108, 125, 9, 13, 32, 44, 58, 93, 108, 125, 9, 13, 32, 9, 13,\r
-                       32, 44, 58, 93, 114, 125, 9, 13, 32, 44, 58, 93, 117, 125, 9, 13, 32, 44, 58, 93, 101, 125, 9, 13, 32, 9, 13, 0};\r
+                       98, 102, 110, 114, 116, 117, 48, 57, 48, 57, 43, 45, 48, 57, 48, 57, 32, 34, 36, 44, 45, 95, 125, 9, 13, 48, 57, 65, 90,\r
+                       97, 122, 34, 92, 34, 92, 32, 58, 9, 13, 32, 34, 36, 45, 91, 95, 102, 110, 116, 123, 9, 13, 48, 57, 65, 90, 97, 122, 34,\r
+                       92, 34, 92, 32, 44, 125, 9, 13, 32, 34, 36, 45, 95, 125, 9, 13, 48, 57, 65, 90, 97, 122, 32, 44, 58, 93, 125, 9, 13, 48,\r
+                       57, 32, 46, 58, 69, 101, 9, 13, 48, 57, 48, 57, 32, 58, 69, 101, 9, 13, 48, 57, 43, 45, 48, 57, 48, 57, 32, 58, 9, 13,\r
+                       48, 57, 34, 47, 92, 98, 102, 110, 114, 116, 117, 32, 44, 58, 93, 125, 9, 13, 48, 57, 32, 44, 46, 69, 101, 125, 9, 13,\r
+                       48, 57, 48, 57, 32, 44, 69, 101, 125, 9, 13, 48, 57, 43, 45, 48, 57, 48, 57, 32, 44, 125, 9, 13, 48, 57, 32, 44, 58, 93,\r
+                       97, 125, 9, 13, 32, 44, 58, 93, 108, 125, 9, 13, 32, 44, 58, 93, 115, 125, 9, 13, 32, 44, 58, 93, 101, 125, 9, 13, 32,\r
+                       44, 58, 93, 125, 9, 13, 32, 44, 58, 93, 117, 125, 9, 13, 32, 44, 58, 93, 108, 125, 9, 13, 32, 44, 58, 93, 108, 125, 9,\r
+                       13, 32, 44, 58, 93, 125, 9, 13, 32, 44, 58, 93, 114, 125, 9, 13, 32, 44, 58, 93, 117, 125, 9, 13, 32, 44, 58, 93, 101,\r
+                       125, 9, 13, 32, 44, 58, 93, 125, 9, 13, 34, 47, 92, 98, 102, 110, 114, 116, 117, 32, 34, 36, 44, 45, 91, 93, 95, 102,\r
+                       110, 116, 123, 9, 13, 48, 57, 65, 90, 97, 122, 34, 92, 34, 92, 32, 44, 93, 9, 13, 32, 34, 36, 45, 91, 93, 95, 102, 110,\r
+                       116, 123, 9, 13, 48, 57, 65, 90, 97, 122, 32, 44, 58, 93, 125, 9, 13, 48, 57, 32, 44, 46, 69, 93, 101, 9, 13, 48, 57,\r
+                       48, 57, 32, 44, 69, 93, 101, 9, 13, 48, 57, 43, 45, 48, 57, 48, 57, 32, 44, 93, 9, 13, 48, 57, 32, 44, 58, 93, 97, 125,\r
+                       9, 13, 32, 44, 58, 93, 108, 125, 9, 13, 32, 44, 58, 93, 115, 125, 9, 13, 32, 44, 58, 93, 101, 125, 9, 13, 32, 44, 58,\r
+                       93, 125, 9, 13, 32, 44, 58, 93, 117, 125, 9, 13, 32, 44, 58, 93, 108, 125, 9, 13, 32, 44, 58, 93, 108, 125, 9, 13, 32,\r
+                       44, 58, 93, 125, 9, 13, 32, 44, 58, 93, 114, 125, 9, 13, 32, 44, 58, 93, 117, 125, 9, 13, 32, 44, 58, 93, 101, 125, 9,\r
+                       13, 32, 44, 58, 93, 125, 9, 13, 34, 47, 92, 98, 102, 110, 114, 116, 117, 32, 9, 13, 32, 44, 58, 93, 125, 9, 13, 32, 46,\r
+                       69, 101, 9, 13, 48, 57, 32, 69, 101, 9, 13, 48, 57, 32, 9, 13, 48, 57, 32, 44, 58, 93, 97, 125, 9, 13, 32, 44, 58, 93,\r
+                       108, 125, 9, 13, 32, 44, 58, 93, 115, 125, 9, 13, 32, 44, 58, 93, 101, 125, 9, 13, 32, 44, 58, 93, 125, 9, 13, 32, 44,\r
+                       58, 93, 117, 125, 9, 13, 32, 44, 58, 93, 108, 125, 9, 13, 32, 44, 58, 93, 108, 125, 9, 13, 32, 44, 58, 93, 125, 9, 13,\r
+                       32, 44, 58, 93, 114, 125, 9, 13, 32, 44, 58, 93, 117, 125, 9, 13, 32, 44, 58, 93, 101, 125, 9, 13, 32, 44, 58, 93, 125,\r
+                       9, 13, 0};\r
        }\r
 \r
        private static final char _json_trans_keys[] = init__json_trans_keys_0();\r
 \r
        private static byte[] init__json_single_lengths_0 () {\r
-               return new byte[] {0, 10, 2, 2, 7, 0, 0, 2, 0, 6, 2, 2, 2, 10, 2, 2, 3, 5, 5, 7, 5, 0, 6, 0, 5, 2, 0, 3, 6, 6, 6, 6, 3, 6,\r
-                       6, 6, 3, 6, 6, 6, 3, 7, 12, 2, 2, 3, 11, 5, 0, 6, 0, 5, 2, 0, 3, 6, 6, 6, 6, 3, 6, 6, 6, 3, 6, 6, 6, 3, 7, 1, 5, 4, 3,\r
-                       1, 6, 6, 6, 6, 1, 6, 6, 6, 1, 6, 6, 6, 1, 0, 0};\r
+               return new byte[] {0, 10, 2, 2, 7, 0, 0, 2, 0, 7, 2, 2, 2, 10, 2, 2, 3, 6, 5, 0, 5, 0, 4, 2, 0, 2, 7, 5, 0, 6, 0, 5, 2, 0,\r
+                       3, 6, 6, 6, 6, 5, 6, 6, 6, 5, 6, 6, 6, 5, 7, 12, 2, 2, 3, 11, 5, 0, 6, 0, 5, 2, 0, 3, 6, 6, 6, 6, 5, 6, 6, 6, 5, 6, 6,\r
+                       6, 5, 7, 1, 5, 4, 3, 1, 6, 6, 6, 6, 5, 6, 6, 6, 5, 6, 6, 6, 5, 0, 0};\r
        }\r
 \r
        private static final byte _json_single_lengths[] = init__json_single_lengths_0();\r
 \r
        private static byte[] init__json_range_lengths_0 () {\r
-               return new byte[] {0, 4, 0, 0, 1, 1, 1, 1, 1, 3, 0, 0, 1, 4, 0, 0, 1, 3, 1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,\r
-                       1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 1, 4, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1,\r
-                       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0};\r
+               return new byte[] {0, 4, 0, 0, 1, 1, 1, 1, 1, 4, 0, 0, 1, 4, 0, 0, 1, 4, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 2,\r
+                       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 1, 4, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
+                       1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0};\r
        }\r
 \r
        private static final byte _json_range_lengths[] = init__json_range_lengths_0();\r
 \r
        private static short[] init__json_index_offsets_0 () {\r
-               return new short[] {0, 0, 15, 18, 21, 30, 32, 34, 38, 40, 50, 53, 56, 60, 75, 78, 81, 86, 95, 102, 111, 118, 120, 129, 131,\r
-                       139, 143, 145, 151, 159, 167, 175, 183, 188, 196, 204, 212, 217, 225, 233, 241, 246, 255, 272, 275, 278, 283, 299, 306,\r
-                       308, 317, 319, 327, 331, 333, 339, 347, 355, 363, 371, 376, 384, 392, 400, 405, 413, 421, 429, 434, 443, 446, 453, 460,\r
-                       466, 470, 478, 486, 494, 502, 505, 513, 521, 529, 532, 540, 548, 556, 559, 560};\r
+               return new short[] {0, 0, 15, 18, 21, 30, 32, 34, 38, 40, 52, 55, 58, 62, 77, 80, 83, 88, 99, 106, 108, 116, 118, 125, 129,\r
+                       131, 136, 145, 152, 154, 163, 165, 173, 177, 179, 185, 193, 201, 209, 217, 224, 232, 240, 248, 255, 263, 271, 279, 286,\r
+                       295, 312, 315, 318, 323, 339, 346, 348, 357, 359, 367, 371, 373, 379, 387, 395, 403, 411, 418, 426, 434, 442, 449, 457,\r
+                       465, 473, 480, 489, 492, 499, 506, 512, 516, 524, 532, 540, 548, 555, 563, 571, 579, 586, 594, 602, 610, 617, 618};\r
        }\r
 \r
        private static final short _json_index_offsets[] = init__json_index_offsets_0();\r
 \r
        private static byte[] init__json_trans_targs_0 () {\r
-               return new byte[] {1, 2, 70, 5, 69, 70, 74, 79, 83, 69, 1, 71, 70, 70, 0, 69, 4, 3, 69, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0,\r
-                       71, 0, 72, 0, 8, 8, 73, 0, 73, 0, 9, 10, 18, 17, 18, 87, 9, 18, 18, 0, 12, 41, 11, 12, 41, 11, 12, 13, 12, 0, 13, 14,\r
-                       20, 21, 16, 20, 28, 33, 37, 16, 13, 22, 20, 20, 0, 16, 19, 15, 16, 19, 15, 16, 17, 87, 16, 0, 17, 10, 18, 18, 87, 17,\r
-                       18, 18, 0, 12, 0, 13, 0, 0, 12, 18, 15, 15, 15, 15, 15, 15, 15, 15, 0, 16, 17, 0, 0, 87, 16, 20, 22, 0, 16, 17, 23, 25,\r
-                       25, 87, 16, 22, 0, 24, 0, 16, 17, 25, 25, 87, 16, 24, 0, 26, 26, 27, 0, 27, 0, 16, 17, 87, 16, 27, 0, 16, 17, 0, 0, 29,\r
-                       87, 16, 20, 16, 17, 0, 0, 30, 87, 16, 20, 16, 17, 0, 0, 31, 87, 16, 20, 16, 17, 0, 0, 32, 87, 16, 20, 16, 17, 87, 16, 0,\r
-                       16, 17, 0, 0, 34, 87, 16, 20, 16, 17, 0, 0, 35, 87, 16, 20, 16, 17, 0, 0, 36, 87, 16, 20, 16, 17, 87, 16, 0, 16, 17, 0,\r
-                       0, 38, 87, 16, 20, 16, 17, 0, 0, 39, 87, 16, 20, 16, 17, 0, 0, 40, 87, 16, 20, 16, 17, 87, 16, 0, 11, 11, 11, 11, 11,\r
-                       11, 11, 11, 0, 42, 43, 47, 46, 48, 45, 88, 47, 55, 60, 64, 45, 42, 49, 47, 47, 0, 45, 68, 44, 45, 68, 44, 45, 46, 88,\r
-                       45, 0, 46, 43, 47, 48, 45, 88, 47, 55, 60, 64, 45, 46, 49, 47, 47, 0, 45, 46, 0, 88, 0, 45, 47, 49, 0, 45, 46, 50, 52,\r
-                       88, 52, 45, 49, 0, 51, 0, 45, 46, 52, 88, 52, 45, 51, 0, 53, 53, 54, 0, 54, 0, 45, 46, 88, 45, 54, 0, 45, 46, 0, 88, 56,\r
-                       0, 45, 47, 45, 46, 0, 88, 57, 0, 45, 47, 45, 46, 0, 88, 58, 0, 45, 47, 45, 46, 0, 88, 59, 0, 45, 47, 45, 46, 88, 45, 0,\r
-                       45, 46, 0, 88, 61, 0, 45, 47, 45, 46, 0, 88, 62, 0, 45, 47, 45, 46, 0, 88, 63, 0, 45, 47, 45, 46, 88, 45, 0, 45, 46, 0,\r
-                       88, 65, 0, 45, 47, 45, 46, 0, 88, 66, 0, 45, 47, 45, 46, 0, 88, 67, 0, 45, 47, 45, 46, 88, 45, 0, 44, 44, 44, 44, 44,\r
-                       44, 44, 44, 0, 69, 69, 0, 69, 0, 0, 0, 0, 69, 70, 69, 6, 7, 7, 69, 71, 0, 69, 7, 7, 69, 72, 0, 69, 69, 73, 0, 69, 0, 0,\r
-                       0, 75, 0, 69, 70, 69, 0, 0, 0, 76, 0, 69, 70, 69, 0, 0, 0, 77, 0, 69, 70, 69, 0, 0, 0, 78, 0, 69, 70, 69, 69, 0, 69, 0,\r
-                       0, 0, 80, 0, 69, 70, 69, 0, 0, 0, 81, 0, 69, 70, 69, 0, 0, 0, 82, 0, 69, 70, 69, 69, 0, 69, 0, 0, 0, 84, 0, 69, 70, 69,\r
-                       0, 0, 0, 85, 0, 69, 70, 69, 0, 0, 0, 86, 0, 69, 70, 69, 69, 0, 0, 0, 0};\r
+               return new byte[] {1, 2, 77, 5, 76, 77, 81, 86, 90, 76, 1, 78, 77, 77, 0, 76, 4, 3, 76, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0,\r
+                       78, 0, 79, 0, 8, 8, 80, 0, 80, 0, 9, 10, 18, 17, 19, 18, 94, 9, 20, 18, 18, 0, 12, 48, 11, 12, 48, 11, 12, 13, 12, 0,\r
+                       13, 14, 27, 28, 16, 27, 35, 40, 44, 16, 13, 29, 27, 27, 0, 16, 26, 15, 16, 26, 15, 16, 17, 94, 16, 0, 17, 10, 18, 19,\r
+                       18, 94, 17, 20, 18, 18, 0, 12, 0, 13, 0, 0, 12, 18, 20, 0, 12, 21, 13, 23, 23, 12, 20, 0, 22, 0, 12, 13, 23, 23, 12, 22,\r
+                       0, 24, 24, 25, 0, 25, 0, 12, 13, 12, 25, 0, 15, 15, 15, 15, 15, 15, 15, 15, 0, 16, 17, 0, 0, 94, 16, 27, 29, 0, 16, 17,\r
+                       30, 32, 32, 94, 16, 29, 0, 31, 0, 16, 17, 32, 32, 94, 16, 31, 0, 33, 33, 34, 0, 34, 0, 16, 17, 94, 16, 34, 0, 16, 17, 0,\r
+                       0, 36, 94, 16, 27, 16, 17, 0, 0, 37, 94, 16, 27, 16, 17, 0, 0, 38, 94, 16, 27, 16, 17, 0, 0, 39, 94, 16, 27, 16, 17, 0,\r
+                       0, 94, 16, 27, 16, 17, 0, 0, 41, 94, 16, 27, 16, 17, 0, 0, 42, 94, 16, 27, 16, 17, 0, 0, 43, 94, 16, 27, 16, 17, 0, 0,\r
+                       94, 16, 27, 16, 17, 0, 0, 45, 94, 16, 27, 16, 17, 0, 0, 46, 94, 16, 27, 16, 17, 0, 0, 47, 94, 16, 27, 16, 17, 0, 0, 94,\r
+                       16, 27, 11, 11, 11, 11, 11, 11, 11, 11, 0, 49, 50, 54, 53, 55, 52, 95, 54, 62, 67, 71, 52, 49, 56, 54, 54, 0, 52, 75,\r
+                       51, 52, 75, 51, 52, 53, 95, 52, 0, 53, 50, 54, 55, 52, 95, 54, 62, 67, 71, 52, 53, 56, 54, 54, 0, 52, 53, 0, 95, 0, 52,\r
+                       54, 56, 0, 52, 53, 57, 59, 95, 59, 52, 56, 0, 58, 0, 52, 53, 59, 95, 59, 52, 58, 0, 60, 60, 61, 0, 61, 0, 52, 53, 95,\r
+                       52, 61, 0, 52, 53, 0, 95, 63, 0, 52, 54, 52, 53, 0, 95, 64, 0, 52, 54, 52, 53, 0, 95, 65, 0, 52, 54, 52, 53, 0, 95, 66,\r
+                       0, 52, 54, 52, 53, 0, 95, 0, 52, 54, 52, 53, 0, 95, 68, 0, 52, 54, 52, 53, 0, 95, 69, 0, 52, 54, 52, 53, 0, 95, 70, 0,\r
+                       52, 54, 52, 53, 0, 95, 0, 52, 54, 52, 53, 0, 95, 72, 0, 52, 54, 52, 53, 0, 95, 73, 0, 52, 54, 52, 53, 0, 95, 74, 0, 52,\r
+                       54, 52, 53, 0, 95, 0, 52, 54, 51, 51, 51, 51, 51, 51, 51, 51, 0, 76, 76, 0, 76, 0, 0, 0, 0, 76, 77, 76, 6, 7, 7, 76, 78,\r
+                       0, 76, 7, 7, 76, 79, 0, 76, 76, 80, 0, 76, 0, 0, 0, 82, 0, 76, 77, 76, 0, 0, 0, 83, 0, 76, 77, 76, 0, 0, 0, 84, 0, 76,\r
+                       77, 76, 0, 0, 0, 85, 0, 76, 77, 76, 0, 0, 0, 0, 76, 77, 76, 0, 0, 0, 87, 0, 76, 77, 76, 0, 0, 0, 88, 0, 76, 77, 76, 0,\r
+                       0, 0, 89, 0, 76, 77, 76, 0, 0, 0, 0, 76, 77, 76, 0, 0, 0, 91, 0, 76, 77, 76, 0, 0, 0, 92, 0, 76, 77, 76, 0, 0, 0, 93, 0,\r
+                       76, 77, 76, 0, 0, 0, 0, 76, 77, 0, 0, 0};\r
        }\r
 \r
        private static final byte _json_trans_targs[] = init__json_trans_targs_0();\r
 \r
        private static byte[] init__json_trans_actions_0 () {\r
-               return new byte[] {0, 0, 1, 1, 21, 1, 1, 1, 1, 17, 0, 1, 1, 1, 0, 28, 1, 1, 7, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0,\r
-                       0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 19, 0, 1, 1, 0, 25, 1, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 21, 1, 1, 1, 1, 17, 0, 1, 1,\r
-                       1, 0, 28, 1, 1, 7, 0, 0, 0, 0, 19, 0, 0, 0, 0, 1, 1, 19, 0, 1, 1, 0, 5, 0, 5, 0, 0, 5, 0, 3, 3, 3, 3, 3, 3, 3, 3, 0, 7,\r
-                       7, 0, 0, 31, 7, 0, 0, 0, 9, 9, 0, 0, 0, 37, 9, 0, 0, 0, 0, 9, 9, 0, 0, 37, 9, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 37, 9, 0, 0,\r
-                       7, 7, 0, 0, 0, 31, 7, 0, 7, 7, 0, 0, 0, 31, 7, 0, 7, 7, 0, 0, 0, 31, 7, 0, 7, 7, 0, 0, 0, 31, 7, 0, 13, 13, 49, 13, 0,\r
-                       7, 7, 0, 0, 0, 31, 7, 0, 7, 7, 0, 0, 0, 31, 7, 0, 7, 7, 0, 0, 0, 31, 7, 0, 15, 15, 55, 15, 0, 7, 7, 0, 0, 0, 31, 7, 0,\r
-                       7, 7, 0, 0, 0, 31, 7, 0, 7, 7, 0, 0, 0, 31, 7, 0, 11, 11, 43, 11, 0, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 1, 0, 1, 21, 23,\r
-                       1, 1, 1, 1, 17, 0, 1, 1, 1, 0, 28, 1, 1, 7, 0, 0, 0, 0, 23, 0, 0, 0, 0, 1, 1, 21, 23, 1, 1, 1, 1, 17, 0, 1, 1, 1, 0, 7,\r
-                       7, 0, 34, 0, 7, 0, 0, 0, 9, 9, 0, 0, 40, 0, 9, 0, 0, 0, 0, 9, 9, 0, 40, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 40, 9, 0, 0,\r
-                       7, 7, 0, 34, 0, 0, 7, 0, 7, 7, 0, 34, 0, 0, 7, 0, 7, 7, 0, 34, 0, 0, 7, 0, 7, 7, 0, 34, 0, 0, 7, 0, 13, 13, 52, 13, 0,\r
-                       7, 7, 0, 34, 0, 0, 7, 0, 7, 7, 0, 34, 0, 0, 7, 0, 7, 7, 0, 34, 0, 0, 7, 0, 15, 15, 58, 15, 0, 7, 7, 0, 34, 0, 0, 7, 0,\r
-                       7, 7, 0, 34, 0, 0, 7, 0, 7, 7, 0, 34, 0, 0, 7, 0, 11, 11, 46, 11, 0, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 7, 0, 0, 0, 0,\r
-                       7, 0, 9, 0, 0, 0, 9, 0, 0, 9, 0, 0, 9, 0, 0, 9, 9, 0, 0, 7, 0, 0, 0, 0, 0, 7, 0, 7, 0, 0, 0, 0, 0, 7, 0, 7, 0, 0, 0, 0,\r
-                       0, 7, 0, 7, 0, 0, 0, 0, 0, 7, 0, 13, 13, 0, 7, 0, 0, 0, 0, 0, 7, 0, 7, 0, 0, 0, 0, 0, 7, 0, 7, 0, 0, 0, 0, 0, 7, 0, 15,\r
-                       15, 0, 7, 0, 0, 0, 0, 0, 7, 0, 7, 0, 0, 0, 0, 0, 7, 0, 7, 0, 0, 0, 0, 0, 7, 0, 11, 11, 0, 0, 0, 0};\r
+               return new byte[] {0, 0, 1, 1, 15, 1, 1, 1, 1, 11, 0, 1, 1, 1, 0, 22, 1, 1, 7, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0,\r
+                       0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 13, 0, 1, 1, 1, 0, 19, 1, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 15, 1, 1, 1, 1, 11, 0,\r
+                       1, 1, 1, 0, 22, 1, 1, 7, 0, 0, 0, 0, 13, 0, 0, 0, 0, 1, 1, 1, 13, 0, 1, 1, 1, 0, 5, 0, 5, 0, 0, 5, 0, 0, 0, 5, 0, 5, 0,\r
+                       0, 5, 0, 0, 0, 0, 5, 5, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 0, 7, 7, 0, 0, 25, 7, 0,\r
+                       0, 0, 9, 9, 0, 0, 0, 31, 9, 0, 0, 0, 0, 9, 9, 0, 0, 31, 9, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 31, 9, 0, 0, 7, 7, 0, 0, 0, 25,\r
+                       7, 0, 7, 7, 0, 0, 0, 25, 7, 0, 7, 7, 0, 0, 0, 25, 7, 0, 7, 7, 0, 0, 0, 25, 7, 0, 40, 40, 0, 0, 54, 40, 0, 7, 7, 0, 0, 0,\r
+                       25, 7, 0, 7, 7, 0, 0, 0, 25, 7, 0, 7, 7, 0, 0, 0, 25, 7, 0, 43, 43, 0, 0, 62, 43, 0, 7, 7, 0, 0, 0, 25, 7, 0, 7, 7, 0,\r
+                       0, 0, 25, 7, 0, 7, 7, 0, 0, 0, 25, 7, 0, 37, 37, 0, 0, 46, 37, 0, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 1, 0, 1, 15, 17, 1,\r
+                       1, 1, 1, 11, 0, 1, 1, 1, 0, 22, 1, 1, 7, 0, 0, 0, 0, 17, 0, 0, 0, 0, 1, 1, 15, 17, 1, 1, 1, 1, 11, 0, 1, 1, 1, 0, 7, 7,\r
+                       0, 28, 0, 7, 0, 0, 0, 9, 9, 0, 0, 34, 0, 9, 0, 0, 0, 0, 9, 9, 0, 34, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 34, 9, 0, 0, 7,\r
+                       7, 0, 28, 0, 0, 7, 0, 7, 7, 0, 28, 0, 0, 7, 0, 7, 7, 0, 28, 0, 0, 7, 0, 7, 7, 0, 28, 0, 0, 7, 0, 40, 40, 0, 58, 0, 40,\r
+                       0, 7, 7, 0, 28, 0, 0, 7, 0, 7, 7, 0, 28, 0, 0, 7, 0, 7, 7, 0, 28, 0, 0, 7, 0, 43, 43, 0, 66, 0, 43, 0, 7, 7, 0, 28, 0,\r
+                       0, 7, 0, 7, 7, 0, 28, 0, 0, 7, 0, 7, 7, 0, 28, 0, 0, 7, 0, 37, 37, 0, 50, 0, 37, 0, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0,\r
+                       7, 0, 0, 0, 0, 7, 0, 9, 0, 0, 0, 9, 0, 0, 9, 0, 0, 9, 0, 0, 9, 9, 0, 0, 7, 0, 0, 0, 0, 0, 7, 0, 7, 0, 0, 0, 0, 0, 7, 0,\r
+                       7, 0, 0, 0, 0, 0, 7, 0, 7, 0, 0, 0, 0, 0, 7, 0, 40, 0, 0, 0, 0, 40, 0, 7, 0, 0, 0, 0, 0, 7, 0, 7, 0, 0, 0, 0, 0, 7, 0,\r
+                       7, 0, 0, 0, 0, 0, 7, 0, 43, 0, 0, 0, 0, 43, 0, 7, 0, 0, 0, 0, 0, 7, 0, 7, 0, 0, 0, 0, 0, 7, 0, 7, 0, 0, 0, 0, 0, 7, 0,\r
+                       37, 0, 0, 0, 0, 37, 0, 0, 0, 0};\r
        }\r
 \r
        private static final byte _json_trans_actions[] = init__json_trans_actions_0();\r
 \r
        private static byte[] init__json_eof_actions_0 () {\r
                return new byte[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r
-                       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 9, 9, 7,\r
-                       7, 7, 7, 13, 7, 7, 7, 15, 7, 7, 7, 11, 0, 0};\r
+                       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r
+                       0, 0, 7, 9, 9, 9, 7, 7, 7, 7, 40, 7, 7, 7, 43, 7, 7, 7, 37, 0, 0};\r
        }\r
 \r
        private static final byte _json_eof_actions[] = init__json_eof_actions_0();\r
 \r
        static final int json_start = 1;\r
-       static final int json_first_final = 69;\r
+       static final int json_first_final = 76;\r
        static final int json_error = 0;\r
 \r
        static final int json_en_object = 9;\r
-       static final int json_en_array = 42;\r
+       static final int json_en_array = 49;\r
        static final int json_en_main = 1;\r
 \r
-       // line 214 "JsonReader.rl"\r
+       // line 226 "JsonReader.rl"\r
 \r
        private final Array elements = new Array(8);\r
        private Object root, current;\r
index ad5a327..cd27981 100644 (file)
@@ -84,6 +84,7 @@ public class JsonReader {
                int s = 0;\r
                Array<String> names = new Array(8);\r
                boolean needsUnescape = false;\r
+               boolean discardBuffer = false; // When unquotedString and true/false/null both match, this discards unquotedString.\r
                RuntimeException parseRuntimeEx = null;\r
 \r
                boolean debug = false;\r
@@ -104,6 +105,7 @@ public class JsonReader {
                        action buffer {\r
                                s = p;\r
                                needsUnescape = false;\r
+                               discardBuffer = false;\r
                        }\r
                        action needsUnescape {\r
                                needsUnescape = true;\r
@@ -116,12 +118,14 @@ public class JsonReader {
                                names.add(name);\r
                        }\r
                        action string {\r
-                               String value = new String(data, s, p - s);\r
-                               s = p;\r
-                               if (needsUnescape) value = unescape(value);\r
-                               String name = names.size > 0 ? names.pop() : null;\r
-                               if (debug) System.out.println("string: " + name + "=" + value);\r
-                               string(name, value);\r
+                               if (!discardBuffer) {\r
+                                       String value = new String(data, s, p - s);\r
+                                       s = p;\r
+                                       if (needsUnescape) value = unescape(value);\r
+                                       String name = names.size > 0 ? names.pop() : null;\r
+                                       if (debug) System.out.println("string: " + name + "=" + value);\r
+                                       string(name, value);\r
+                               }\r
                        }\r
                        action number {\r
                                String value = new String(data, s, p - s);\r
@@ -134,16 +138,19 @@ public class JsonReader {
                                String name = names.size > 0 ? names.pop() : null;\r
                                if (debug) System.out.println("boolean: " + name + "=true");\r
                                bool(name, true);\r
+                               discardBuffer = true;\r
                        }\r
                        action falseValue {\r
                                String name = names.size > 0 ? names.pop() : null;\r
                                if (debug) System.out.println("boolean: " + name + "=false");\r
                                bool(name, false);\r
+                               discardBuffer = true;\r
                        }\r
                        action null {\r
                                String name = names.size > 0 ? names.pop() : null;\r
                                if (debug) System.out.println("null: " + name);\r
                                string(name, null);\r
+                               discardBuffer = true;\r
                        }\r
                        action startObject {\r
                                String name = names.size > 0 ? names.pop() : null;\r
@@ -168,19 +175,19 @@ public class JsonReader {
                                fret;\r
                        }\r
 \r
-                       # parse single quote\r
+                       numberChars = '-'? [0-9]+ ('.' [0-9]+)? ([eE] [+\-]? [0-9]+)?;\r
                        quotedChars = (^["\\] | ('\\' ["\\/bfnrtu] >needsUnescape))*;\r
                        unquotedChars = [a-zA-Z_$] ^([:}\],] | space)*;\r
-                       name = ('"' quotedChars >buffer %name '"') | unquotedChars >buffer %name;\r
+                       name = ('"' quotedChars >buffer %name '"') | unquotedChars >buffer %name | numberChars >buffer %name;\r
 \r
                        startObject = '{' @startObject;\r
                        startArray = '[' @startArray;\r
                        string = '"' quotedChars >buffer %string '"';\r
                        unquotedString = unquotedChars >buffer %string;\r
-                       number = ('-'? [0-9]+ ('.' [0-9]+)? ([eE] [+\-]? [0-9]+)?) >buffer %number;\r
+                       number = numberChars >buffer %number;\r
                        nullValue = 'null' %null;\r
                        booleanValue = 'true' %trueValue | 'false' %falseValue;\r
-                       value = startObject | startArray | number | string | nullValue | booleanValue | unquotedString @-1;\r
+                       value = startObject | startArray | number | string | nullValue | booleanValue | unquotedString $-1;\r
 \r
                        nameValue = name space* ':' space* value;\r
 \r
index c5a6db0..1f9b338 100644 (file)
@@ -17,6 +17,7 @@
 package com.badlogic.gdx.utils;\r
 \r
 import java.io.IOException;\r
+import java.io.StringWriter;\r
 import java.io.Writer;\r
 import java.util.regex.Pattern;\r
 \r
@@ -161,8 +162,7 @@ public class JsonWriter extends Writer {
 \r
                public String quoteValue (String value) {\r
                        value = value.replace("\\", "\\\\");\r
-                       if (this == OutputType.minimal && !value.equals("true") && !value.equals("false") && !value.equals("null")\r
-                               && minimalPattern.matcher(value).matches()) return value;\r
+                       if (this == OutputType.minimal && minimalPattern.matcher(value).matches()) return value;\r
                        return '"' + value.replace("\"", "\\\"") + '"';\r
                }\r
 \r
@@ -180,4 +180,15 @@ public class JsonWriter extends Writer {
                        }\r
                }\r
        }\r
+\r
+       public static void main (String[] args) throws Exception {\r
+               StringWriter writer = new StringWriter();\r
+               JsonWriter s = new JsonWriter(writer);\r
+               s.setOutputType(OutputType.minimal);\r
+               s.object();\r
+               s.name("meow");\r
+               s.value(true);\r
+               s.close();\r
+               System.out.println(writer);\r
+       }\r
 }\r
index 7178df9..19b7fec 100644 (file)
@@ -186,6 +186,11 @@ public class LongArray {
                return items[size - 1];\r
        }\r
 \r
+       /** Returns the first item. */\r
+       public long first () {\r
+               return items[0];\r
+       }\r
+\r
        public void clear () {\r
                size = 0;\r
        }\r
index 7646661..345a14c 100644 (file)
@@ -70,7 +70,7 @@ public class TableLayoutTest extends GdxTest {
                        }\r
                });\r
                table.add(button);\r
-               table.setTouchable(Touchable.disabled);\r
+               // table.setTouchable(Touchable.disabled);\r
 \r
                Table table2 = new Table();\r
                stage.addActor(table2);\r