Nigel Tao | 9263c80 | 2020-02-22 07:24:22 +1100 | [diff] [blame] | 1 | // Copyright 2020 The Wuffs Authors. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
Nigel Tao | 3b17d5b | 2020-02-26 12:53:10 +1100 | [diff] [blame] | 15 | pub status "#bad C0 control code" |
| 16 | pub status "#bad UTF-8" |
| 17 | pub status "#bad backslash-escape" |
Nigel Tao | 9263c80 | 2020-02-22 07:24:22 +1100 | [diff] [blame] | 18 | pub status "#bad input" |
Nigel Tao | 6bc3f57 | 2020-08-29 23:23:15 +1000 | [diff] [blame] | 19 | pub status "#bad new-line in a string" |
Nigel Tao | 1adbc95 | 2020-08-06 23:28:07 +1000 | [diff] [blame] | 20 | pub status "#bad quirk combination" |
Nigel Tao | 9263c80 | 2020-02-22 07:24:22 +1100 | [diff] [blame] | 21 | pub status "#unsupported number length" |
| 22 | pub status "#unsupported recursion depth" |
| 23 | |
| 24 | pri status "#internal error: inconsistent I/O" |
| 25 | |
Nigel Tao | 28ef6a7 | 2020-08-10 22:29:08 +1000 | [diff] [blame] | 26 | // -------- |
| 27 | |
| 28 | // DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE is the largest workbuf length that a |
| 29 | // decoder will request. |
Nigel Tao | 532e18c | 2020-04-14 14:38:07 +1000 | [diff] [blame] | 30 | pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 0 |
Nigel Tao | f3146c2 | 2020-03-26 08:47:42 +1100 | [diff] [blame] | 31 | |
Nigel Tao | 7487134 | 2020-04-13 15:52:36 +1000 | [diff] [blame] | 32 | // DECODER_DEPTH_MAX_INCL is the maximum supported recursion depth: how deeply |
Nigel Tao | 21682f4 | 2020-02-29 23:11:33 +1100 | [diff] [blame] | 33 | // nested [] arrays and {} objects can be. |
| 34 | // |
| 35 | // The JSON spec itself does not define a limit, but allows implementations to |
| 36 | // set their own limits. |
Nigel Tao | 532e18c | 2020-04-14 14:38:07 +1000 | [diff] [blame] | 37 | pub const DECODER_DEPTH_MAX_INCL : base.u64 = 1024 |
Nigel Tao | 21682f4 | 2020-02-29 23:11:33 +1100 | [diff] [blame] | 38 | |
Nigel Tao | 7487134 | 2020-04-13 15:52:36 +1000 | [diff] [blame] | 39 | // DECODER_DST_TOKEN_BUFFER_LENGTH_MIN_INCL is the minimum length of the dst |
Nigel Tao | 21682f4 | 2020-02-29 23:11:33 +1100 | [diff] [blame] | 40 | // wuffs_base__token_buffer passed to the decoder. |
Nigel Tao | 532e18c | 2020-04-14 14:38:07 +1000 | [diff] [blame] | 41 | pub const DECODER_DST_TOKEN_BUFFER_LENGTH_MIN_INCL : base.u64 = 1 |
Nigel Tao | 21682f4 | 2020-02-29 23:11:33 +1100 | [diff] [blame] | 42 | |
Nigel Tao | 7487134 | 2020-04-13 15:52:36 +1000 | [diff] [blame] | 43 | // DECODER_SRC_IO_BUFFER_LENGTH_MIN_INCL is the minimum length of the src |
Nigel Tao | 21682f4 | 2020-02-29 23:11:33 +1100 | [diff] [blame] | 44 | // wuffs_base__io_buffer passed to the decoder. |
| 45 | // |
| 46 | // This constrains the src.data.len field and it is the io_buffer capacity (the |
| 47 | // maximum possible src.meta.ri and src.meta.wi values). It is a property of |
| 48 | // the backing array's length, not the length of the JSON-formatted input per |
| 49 | // se. It is perfectly valid to decode "[1,2]" (of length 5) as JSON, as long |
Nigel Tao | 84bb3af | 2020-07-07 23:29:30 +1000 | [diff] [blame] | 50 | // as that content is placed in an io_buffer whose data.len is at least 100. |
| 51 | pub const DECODER_SRC_IO_BUFFER_LENGTH_MIN_INCL : base.u64 = 100 |
Nigel Tao | 21682f4 | 2020-02-29 23:11:33 +1100 | [diff] [blame] | 52 | |
Nigel Tao | 7487134 | 2020-04-13 15:52:36 +1000 | [diff] [blame] | 53 | // DECODER_NUMBER_LENGTH_MAX_INCL is the longest supported byte length for a |
Nigel Tao | a5184ed | 2020-03-06 21:05:44 +1100 | [diff] [blame] | 54 | // JSON number. Unlike JSON strings, this package's tokenizer never splits a |
| 55 | // single JSON number into multiple tokens, as this simplifies the callers. |
| 56 | // They can then call e.g. wuffs_base__parse_number_i64 without having to |
| 57 | // reconstitute a contiguous string representation. |
| 58 | // |
| 59 | // The JSON spec itself does not define a limit, but allows implementations to |
| 60 | // set their own limits. |
Nigel Tao | 84bb3af | 2020-07-07 23:29:30 +1000 | [diff] [blame] | 61 | pri const DECODER_NUMBER_LENGTH_MAX_INCL : base.u64 = 99 |
Nigel Tao | a5184ed | 2020-03-06 21:05:44 +1100 | [diff] [blame] | 62 | |
| 63 | // -------- |
| 64 | |
Nigel Tao | 9f0eb26 | 2020-02-26 11:43:50 +1100 | [diff] [blame] | 65 | // Look-Up Tables (LUTs). |
| 66 | |
Nigel Tao | 7487134 | 2020-04-13 15:52:36 +1000 | [diff] [blame] | 67 | // LUT_BACKSLASHES[i] helps decode "\i", for various 'i's. |
Nigel Tao | 97f7f28 | 2020-03-19 14:27:09 +1100 | [diff] [blame] | 68 | // |
| 69 | // If the element's 0x80 bit is set then "\i" is unconditionally a valid |
| 70 | // single-output-byte backslash-escape. The low 7 bits are the unescaped value. |
Nigel Tao | 7487134 | 2020-04-13 15:52:36 +1000 | [diff] [blame] | 71 | // For example, LUT_BACKSLASHES['n'] is (0x80 | 0x0A), because "\n" is U+000A. |
Nigel Tao | 97f7f28 | 2020-03-19 14:27:09 +1100 | [diff] [blame] | 72 | // |
| 73 | // If the element is non-zero (but the 0x80 bit is not set) then "\i"'s |
| 74 | // validity depends on the relevant quirk. The element's value is an enum: |
Nigel Tao | e39f3cb | 2020-04-14 23:03:18 +1000 | [diff] [blame] | 75 | // - 1: "\a", U+0007, QUIRK_ALLOW_BACKSLASH_A. |
| 76 | // - 2: "\e", U+001B, QUIRK_ALLOW_BACKSLASH_E. |
| 77 | // - 3: "backslash new_line(not_n)", U+000A, QUIRK_ALLOW_BACKSLASH_NEW_LINE. |
| 78 | // - 4: "\?", U+003F, QUIRK_ALLOW_BACKSLASH_QUESTION_MARK. |
| 79 | // - 5: "\'", U+0027, QUIRK_ALLOW_BACKSLASH_SINGLE_QUOTE. |
| 80 | // - 6: "\v", U+000B, QUIRK_ALLOW_BACKSLASH_V. |
| 81 | // - 7: "\0", U+0000, QUIRK_ALLOW_BACKSLASH_ZERO. |
| 82 | // The quirk and U+1234 values are held in LUT_QUIRKY_BACKSLASHES_QUIRKS and |
| 83 | // LUT_QUIRKY_BACKSLASHES_CHARS, below. |
Nigel Tao | 97f7f28 | 2020-03-19 14:27:09 +1100 | [diff] [blame] | 84 | // |
| 85 | // If the element is zero then "\i" is invalid, or it is a special case, the |
| 86 | // start of "\x12", "\u1234" or "\U12345678". |
Nigel Tao | 532e18c | 2020-04-14 14:38:07 +1000 | [diff] [blame] | 87 | pri const LUT_BACKSLASHES : array[256] base.u8 = [ |
Nigel Tao | 48e7004 | 2020-02-22 08:07:26 +1100 | [diff] [blame] | 88 | // 0 1 2 3 4 5 6 7 |
| 89 | // 8 9 A B C D E F |
Nigel Tao | 9263c80 | 2020-02-22 07:24:22 +1100 | [diff] [blame] | 90 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x00 ..= 0x07. |
Nigel Tao | 2db72da | 2020-04-07 17:10:16 +1000 | [diff] [blame] | 91 | 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x08 ..= 0x0F. '\n'. |
Nigel Tao | 9263c80 | 2020-02-22 07:24:22 +1100 | [diff] [blame] | 92 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x10 ..= 0x17. |
| 93 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x18 ..= 0x1F. |
Nigel Tao | 2db72da | 2020-04-07 17:10:16 +1000 | [diff] [blame] | 94 | 0x00, 0x00, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x05, // 0x20 ..= 0x27. '"', '\''. |
Nigel Tao | 9263c80 | 2020-02-22 07:24:22 +1100 | [diff] [blame] | 95 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAF, // 0x28 ..= 0x2F. '/'. |
Nigel Tao | 2db72da | 2020-04-07 17:10:16 +1000 | [diff] [blame] | 96 | 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x30 ..= 0x37. '0'. |
| 97 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, // 0x38 ..= 0x3F. '?' |
Nigel Tao | 9263c80 | 2020-02-22 07:24:22 +1100 | [diff] [blame] | 98 | |
| 99 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x40 ..= 0x47. |
| 100 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x48 ..= 0x4F. |
| 101 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x50 ..= 0x57. |
| 102 | 0x00, 0x00, 0x00, 0x00, 0xDC, 0x00, 0x00, 0x00, // 0x58 ..= 0x5F. '\\'. |
Nigel Tao | 97f7f28 | 2020-03-19 14:27:09 +1100 | [diff] [blame] | 103 | 0x00, 0x01, 0x88, 0x00, 0x00, 0x02, 0x8C, 0x00, // 0x60 ..= 0x67. 'a', 'b', 'e', 'f'. |
Nigel Tao | 9263c80 | 2020-02-22 07:24:22 +1100 | [diff] [blame] | 104 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8A, 0x00, // 0x68 ..= 0x6F. 'n'. |
Nigel Tao | 2db72da | 2020-04-07 17:10:16 +1000 | [diff] [blame] | 105 | 0x00, 0x00, 0x8D, 0x00, 0x89, 0x00, 0x06, 0x00, // 0x70 ..= 0x77. 'r', 't', 'v'. |
Nigel Tao | 9263c80 | 2020-02-22 07:24:22 +1100 | [diff] [blame] | 106 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x78 ..= 0x7F. |
| 107 | |
| 108 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x80 ..= 0x87. |
| 109 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x88 ..= 0x8F. |
| 110 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x90 ..= 0x97. |
| 111 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x98 ..= 0x9F. |
| 112 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xA0 ..= 0xA7. |
| 113 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xA8 ..= 0xAF. |
| 114 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xB0 ..= 0xB7. |
| 115 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xB8 ..= 0xBF. |
| 116 | |
| 117 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xC0 ..= 0xC7. |
| 118 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xC8 ..= 0xCF. |
| 119 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xD0 ..= 0xD7. |
| 120 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xD8 ..= 0xDF. |
| 121 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE0 ..= 0xE7. |
| 122 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE8 ..= 0xEF. |
| 123 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF0 ..= 0xF7. |
| 124 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF8 ..= 0xFF. |
Nigel Tao | 48e7004 | 2020-02-22 08:07:26 +1100 | [diff] [blame] | 125 | // 0 1 2 3 4 5 6 7 |
| 126 | // 8 9 A B C D E F |
| 127 | ] |
| 128 | |
Nigel Tao | e39f3cb | 2020-04-14 23:03:18 +1000 | [diff] [blame] | 129 | // LUT_QUIRKY_BACKSLASHES_QUIRKS is discussed in the LUT_BACKSLASHES comment. |
| 130 | // The first element (index 0) is not used, but 8 is a round power of 2, so |
Nigel Tao | 2db72da | 2020-04-07 17:10:16 +1000 | [diff] [blame] | 131 | // enforcing index-in-bounds is a simple "&7" operation. |
Nigel Tao | 1adbc95 | 2020-08-06 23:28:07 +1000 | [diff] [blame] | 132 | pri const LUT_QUIRKY_BACKSLASHES_QUIRKS : array[8] base.u8[..= 0x0A] = [ |
Nigel Tao | e39f3cb | 2020-04-14 23:03:18 +1000 | [diff] [blame] | 133 | 0, |
Nigel Tao | 1f424b2 | 2020-04-16 09:37:05 +1000 | [diff] [blame] | 134 | // Uncommenting the following lines requires being able to define consts in |
| 135 | // terms of other consts, which could be non-trivial to specify and |
| 136 | // implement (to avoid infinite loops). |
Nigel Tao | e39f3cb | 2020-04-14 23:03:18 +1000 | [diff] [blame] | 137 | 0x01, // (QUIRK_ALLOW_BACKSLASH_A - QUIRKS_BASE) as base.u8, |
| 138 | 0x03, // (QUIRK_ALLOW_BACKSLASH_E - QUIRKS_BASE) as base.u8, |
| 139 | 0x04, // (QUIRK_ALLOW_BACKSLASH_NEW_LINE - QUIRKS_BASE) as base.u8, |
| 140 | 0x05, // (QUIRK_ALLOW_BACKSLASH_QUESTION_MARK - QUIRKS_BASE) as base.u8, |
| 141 | 0x06, // (QUIRK_ALLOW_BACKSLASH_SINGLE_QUOTE - QUIRKS_BASE) as base.u8, |
| 142 | 0x07, // (QUIRK_ALLOW_BACKSLASH_V - QUIRKS_BASE) as base.u8, |
Nigel Tao | 1adbc95 | 2020-08-06 23:28:07 +1000 | [diff] [blame] | 143 | 0x0A, // (QUIRK_ALLOW_BACKSLASH_ZERO - QUIRKS_BASE) as base.u8, |
Nigel Tao | e39f3cb | 2020-04-14 23:03:18 +1000 | [diff] [blame] | 144 | ] |
| 145 | |
| 146 | // LUT_QUIRKY_BACKSLASHES_CHARS is discussed in the LUT_BACKSLASHES comment. |
| 147 | // The first element (index 0) is not used, but 8 is a round power of 2, so |
| 148 | // enforcing index-in-bounds is a simple "&7" operation. |
| 149 | pri const LUT_QUIRKY_BACKSLASHES_CHARS : array[8] base.u8 = [ |
Nigel Tao | 2db72da | 2020-04-07 17:10:16 +1000 | [diff] [blame] | 150 | 0x00, 0x07, 0x1B, 0x0A, 0x3F, 0x27, 0x0B, 0x00, |
Nigel Tao | 97f7f28 | 2020-03-19 14:27:09 +1100 | [diff] [blame] | 151 | ] |
| 152 | |
Nigel Tao | 7487134 | 2020-04-13 15:52:36 +1000 | [diff] [blame] | 153 | // LUT_CHARS helps decode bytes within a string: |
Nigel Tao | 3b17d5b | 2020-02-26 12:53:10 +1100 | [diff] [blame] | 154 | // - 0x00 is 1-byte UTF-8 (ASCII) but not '"', '\\' or a C0 control code. |
| 155 | // - 0x01 is '"'. |
| 156 | // - 0x02 is '\\'. |
| 157 | // - 0x03 is the start of 2-byte UTF-8. |
| 158 | // - 0x04 is the start of 3-byte UTF-8. |
| 159 | // - 0x05 is the start of 4-byte UTF-8. |
| 160 | // - 0x10 is a UTF-8 tail byte. |
Nigel Tao | d83bd8d | 2020-04-07 17:50:47 +1000 | [diff] [blame] | 161 | // - 0x20 is invalid UTF-8. |
| 162 | // - 0x80 and above is invalid JSON (C0 control codes). |
Nigel Tao | 3b17d5b | 2020-02-26 12:53:10 +1100 | [diff] [blame] | 163 | // |
| 164 | // RFC 3629 (UTF-8) gives this grammar for valid UTF-8: |
| 165 | // UTF8-1 = %x00-7F |
| 166 | // UTF8-2 = %xC2-DF UTF8-tail |
| 167 | // UTF8-3 = %xE0 %xA0-BF UTF8-tail / %xE1-EC 2( UTF8-tail ) / |
| 168 | // %xED %x80-9F UTF8-tail / %xEE-EF 2( UTF8-tail ) |
| 169 | // UTF8-4 = %xF0 %x90-BF 2( UTF8-tail ) / %xF1-F3 3( UTF8-tail ) / |
| 170 | // %xF4 %x80-8F 2( UTF8-tail ) |
| 171 | // UTF8-tail = %x80-BF |
Nigel Tao | 532e18c | 2020-04-14 14:38:07 +1000 | [diff] [blame] | 172 | pri const LUT_CHARS : array[256] base.u8 = [ |
Nigel Tao | 3b17d5b | 2020-02-26 12:53:10 +1100 | [diff] [blame] | 173 | // 0 1 2 3 4 5 6 7 |
| 174 | // 8 9 A B C D E F |
Nigel Tao | d83bd8d | 2020-04-07 17:50:47 +1000 | [diff] [blame] | 175 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, // 0x00 ..= 0x07. C0 control codes. |
| 176 | 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, // 0x08 ..= 0x0F. C0 control codes. |
| 177 | 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, // 0x10 ..= 0x17. C0 control codes. |
| 178 | 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, // 0x18 ..= 0x1F. C0 control codes. |
Nigel Tao | 3b17d5b | 2020-02-26 12:53:10 +1100 | [diff] [blame] | 179 | 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x20 ..= 0x27. UTF-8-1; '"'. |
| 180 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x28 ..= 0x2F. UTF-8-1. |
| 181 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x30 ..= 0x37. UTF-8-1. |
| 182 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x38 ..= 0x3F. UTF-8-1. |
| 183 | |
| 184 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x40 ..= 0x47. UTF-8-1. |
| 185 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x48 ..= 0x4F. UTF-8-1. |
| 186 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x50 ..= 0x57. UTF-8-1. |
| 187 | 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // 0x58 ..= 0x5F. UTF-8-1; '\\'. |
| 188 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x60 ..= 0x67. UTF-8-1. |
| 189 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x68 ..= 0x6F. UTF-8-1. |
| 190 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x70 ..= 0x77. UTF-8-1. |
| 191 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x78 ..= 0x7F. UTF-8-1. |
| 192 | |
| 193 | 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, // 0x80 ..= 0x87. UTF-8 tail. |
| 194 | 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, // 0x88 ..= 0x8F. UTF-8 tail. |
| 195 | 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, // 0x90 ..= 0x97. UTF-8 tail. |
| 196 | 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, // 0x98 ..= 0x9F. UTF-8 tail. |
| 197 | 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, // 0xA0 ..= 0xA7. UTF-8 tail. |
| 198 | 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, // 0xA8 ..= 0xAF. UTF-8 tail. |
| 199 | 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, // 0xB0 ..= 0xB7. UTF-8 tail. |
| 200 | 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, // 0xB8 ..= 0xBF. UTF-8 tail. |
| 201 | |
Nigel Tao | d83bd8d | 2020-04-07 17:50:47 +1000 | [diff] [blame] | 202 | 0x20, 0x20, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, // 0xC0 ..= 0xC7. Invalid UTF-8; UTF-8-2. |
Nigel Tao | 3b17d5b | 2020-02-26 12:53:10 +1100 | [diff] [blame] | 203 | 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, // 0xC8 ..= 0xCF. UTF-8-2. |
| 204 | 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, // 0xD0 ..= 0xD7. UTF-8-2. |
| 205 | 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, // 0xD8 ..= 0xDF. UTF-8-2. |
| 206 | 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, // 0xE0 ..= 0xE7. UTF-8-3. |
| 207 | 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, // 0xE8 ..= 0xEF. UTF-8-3. |
Nigel Tao | d83bd8d | 2020-04-07 17:50:47 +1000 | [diff] [blame] | 208 | 0x05, 0x05, 0x05, 0x05, 0x05, 0x20, 0x20, 0x20, // 0xF0 ..= 0xF7. UTF-8-4; Invalid UTF-8. |
| 209 | 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // 0xF8 ..= 0xFF. Invalid UTF-8. |
Nigel Tao | 3b17d5b | 2020-02-26 12:53:10 +1100 | [diff] [blame] | 210 | // 0 1 2 3 4 5 6 7 |
| 211 | // 8 9 A B C D E F |
| 212 | ] |
| 213 | |
Nigel Tao | 532e18c | 2020-04-14 14:38:07 +1000 | [diff] [blame] | 214 | pri const CLASS_WHITESPACE : base.u8 = 0x00 |
| 215 | pri const CLASS_STRING : base.u8 = 0x01 |
| 216 | pri const CLASS_COMMA : base.u8 = 0x02 |
| 217 | pri const CLASS_COLON : base.u8 = 0x03 |
| 218 | pri const CLASS_NUMBER : base.u8 = 0x04 |
| 219 | pri const CLASS_OPEN_CURLY_BRACE : base.u8 = 0x05 |
| 220 | pri const CLASS_CLOSE_CURLY_BRACE : base.u8 = 0x06 |
| 221 | pri const CLASS_OPEN_SQUARE_BRACKET : base.u8 = 0x07 |
| 222 | pri const CLASS_CLOSE_SQUARE_BRACKET : base.u8 = 0x08 |
| 223 | pri const CLASS_FALSE : base.u8 = 0x09 |
| 224 | pri const CLASS_TRUE : base.u8 = 0x0A |
| 225 | pri const CLASS_NULL_NAN_INF : base.u8 = 0x0B |
| 226 | pri const CLASS_COMMENT : base.u8 = 0x0C |
Nigel Tao | 8007173 | 2020-04-13 16:06:16 +1000 | [diff] [blame] | 227 | |
Nigel Tao | 66b0a12 | 2020-06-09 23:48:54 +1000 | [diff] [blame] | 228 | // EXPECT_ETC are unions of LUT_CLASSES bitmasks. See LUT_CLASSES below. |
| 229 | // |
| 230 | // Bitwise or'ing these together gives 0x1FFE. Whitespace is never expected, as |
| 231 | // it is handled separately. |
| 232 | // |
| 233 | // EXPECT_VALUE is also defined to be 0x1EB2, equivalent to (EXPECT_STRING | |
| 234 | // EXPECT_NON_STRING_VALUE). |
| 235 | // |
| 236 | // "Non-string value" includes literals (false, true, null), numbers, arrays |
| 237 | // and objects. |
| 238 | // |
| 239 | // "String value" includes "this" and "th\u0061t". |
| 240 | // |
| 241 | // Comments are always expected. Whether the relevant quirks are enabled are |
| 242 | // checked elsewhere. |
| 243 | pri const EXPECT_VALUE : base.u32 = 0x1EB2 |
| 244 | pri const EXPECT_NON_STRING_VALUE : base.u32 = 0x1EB0 |
| 245 | pri const EXPECT_STRING : base.u32 = 0x1002 |
| 246 | pri const EXPECT_COMMA : base.u32 = 0x1004 |
| 247 | pri const EXPECT_COLON : base.u32 = 0x1008 |
| 248 | pri const EXPECT_NUMBER : base.u32 = 0x1010 |
| 249 | pri const EXPECT_CLOSE_CURLY_BRACE : base.u32 = 0x1040 |
| 250 | pri const EXPECT_CLOSE_SQUARE_BRACKET : base.u32 = 0x1100 |
| 251 | |
Nigel Tao | 7487134 | 2020-04-13 15:52:36 +1000 | [diff] [blame] | 252 | // LUT_CLASSES is: |
Nigel Tao | d1a4abe | 2020-02-22 09:03:07 +1100 | [diff] [blame] | 253 | // - 0x00 (bitmask 0x0001) is CLASS_WHITESPACE. |
| 254 | // - 0x01 (bitmask 0x0002) is CLASS_STRING. |
| 255 | // - 0x02 (bitmask 0x0004) is CLASS_COMMA. |
| 256 | // - 0x03 (bitmask 0x0008) is CLASS_COLON. |
| 257 | // - 0x04 (bitmask 0x0010) is CLASS_NUMBER. |
| 258 | // - 0x05 (bitmask 0x0020) is CLASS_OPEN_CURLY_BRACE. |
| 259 | // - 0x06 (bitmask 0x0040) is CLASS_CLOSE_CURLY_BRACE. |
| 260 | // - 0x07 (bitmask 0x0080) is CLASS_OPEN_SQUARE_BRACKET. |
| 261 | // - 0x08 (bitmask 0x0100) is CLASS_CLOSE_SQUARE_BRACKET. |
| 262 | // - 0x09 (bitmask 0x0200) is CLASS_FALSE. |
| 263 | // - 0x0A (bitmask 0x0400) is CLASS_TRUE. |
Nigel Tao | d7c7237 | 2020-03-24 13:58:38 +1100 | [diff] [blame] | 264 | // - 0x0B (bitmask 0x0800) is CLASS_NULL_NAN_INF. |
Nigel Tao | 21f6a5d | 2020-03-21 22:26:27 +1100 | [diff] [blame] | 265 | // - 0x0C (bitmask 0x1000) is CLASS_COMMENT. |
Nigel Tao | d1a4abe | 2020-02-22 09:03:07 +1100 | [diff] [blame] | 266 | // - 0x0D (bitmask 0x2000) is reserved. |
| 267 | // - 0x0E (bitmask 0x4000) is reserved. |
| 268 | // - 0x0F (bitmask 0x8000) is CLASS_BAD_INPUT. |
| 269 | // |
| 270 | // The bitmasks are used by the "expect" variable: what the next character |
Nigel Tao | 66b0a12 | 2020-06-09 23:48:54 +1000 | [diff] [blame] | 271 | // class can be. See EXPECT_ETC above. |
Nigel Tao | 532e18c | 2020-04-14 14:38:07 +1000 | [diff] [blame] | 272 | pri const LUT_CLASSES : array[256] base.u8[..= 0x0F] = [ |
Nigel Tao | 48e7004 | 2020-02-22 08:07:26 +1100 | [diff] [blame] | 273 | // 0 1 2 3 4 5 6 7 |
| 274 | // 8 9 A B C D E F |
| 275 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0x00 ..= 0x07. |
| 276 | 0x0F, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x0F, 0x0F, // 0x08 ..= 0x0F. '\t', '\n', '\r'. |
| 277 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0x10 ..= 0x17. |
| 278 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0x18 ..= 0x1F. |
| 279 | 0x00, 0x0F, 0x01, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0x20 ..= 0x27. ' ', '"'. |
Nigel Tao | d7c7237 | 2020-03-24 13:58:38 +1100 | [diff] [blame] | 280 | 0x0F, 0x0F, 0x0F, 0x0B, 0x02, 0x04, 0x0F, 0x0C, // 0x28 ..= 0x2F. '+', ',', '-', '/'. |
Nigel Tao | 48e7004 | 2020-02-22 08:07:26 +1100 | [diff] [blame] | 281 | 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, // 0x30 ..= 0x37. '0'-'7'. |
| 282 | 0x04, 0x04, 0x03, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0x38 ..= 0x3F. '8'-'9', ':'. |
| 283 | |
| 284 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0x40 ..= 0x47. |
Nigel Tao | d7c7237 | 2020-03-24 13:58:38 +1100 | [diff] [blame] | 285 | 0x0F, 0x0B, 0x0F, 0x0F, 0x0F, 0x0F, 0x0B, 0x0F, // 0x48 ..= 0x4F. 'I', 'N'. |
Nigel Tao | 48e7004 | 2020-02-22 08:07:26 +1100 | [diff] [blame] | 286 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0x50 ..= 0x57. |
| 287 | 0x0F, 0x0F, 0x0F, 0x07, 0x0F, 0x08, 0x0F, 0x0F, // 0x58 ..= 0x5F. '[', ']'. |
| 288 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x09, 0x0F, // 0x60 ..= 0x67. 'f'. |
Nigel Tao | d7c7237 | 2020-03-24 13:58:38 +1100 | [diff] [blame] | 289 | 0x0F, 0x0B, 0x0F, 0x0F, 0x0F, 0x0F, 0x0B, 0x0F, // 0x68 ..= 0x6F. 'i', 'n'. |
Nigel Tao | 48e7004 | 2020-02-22 08:07:26 +1100 | [diff] [blame] | 290 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0A, 0x0F, 0x0F, 0x0F, // 0x70 ..= 0x77. 't'. |
| 291 | 0x0F, 0x0F, 0x0F, 0x05, 0x0F, 0x06, 0x0F, 0x0F, // 0x78 ..= 0x7F. '{', '}'. |
| 292 | |
| 293 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0x80 ..= 0x87. |
| 294 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0x88 ..= 0x8F. |
| 295 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0x90 ..= 0x97. |
| 296 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0x98 ..= 0x9F. |
| 297 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0xA0 ..= 0xA7. |
| 298 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0xA8 ..= 0xAF. |
| 299 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0xB0 ..= 0xB7. |
| 300 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0xB8 ..= 0xBF. |
| 301 | |
| 302 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0xC0 ..= 0xC7. |
| 303 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0xC8 ..= 0xCF. |
| 304 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0xD0 ..= 0xD7. |
| 305 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0xD8 ..= 0xDF. |
| 306 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0xE0 ..= 0xE7. |
| 307 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0xE8 ..= 0xEF. |
| 308 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0xF0 ..= 0xF7. |
| 309 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0xF8 ..= 0xFF. |
| 310 | // 0 1 2 3 4 5 6 7 |
| 311 | // 8 9 A B C D E F |
Nigel Tao | 9263c80 | 2020-02-22 07:24:22 +1100 | [diff] [blame] | 312 | ] |
| 313 | |
Nigel Tao | 532e18c | 2020-04-14 14:38:07 +1000 | [diff] [blame] | 314 | pri const LUT_DECIMAL_DIGITS : array[256] base.u8 = [ |
Nigel Tao | 771d4f9 | 2020-03-05 11:17:57 +1100 | [diff] [blame] | 315 | // 0 1 2 3 4 5 6 7 |
| 316 | // 8 9 A B C D E F |
| 317 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x00 ..= 0x07. |
| 318 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x08 ..= 0x0F. |
| 319 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x10 ..= 0x17. |
| 320 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x18 ..= 0x1F. |
| 321 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x20 ..= 0x27. |
| 322 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x28 ..= 0x2F. |
| 323 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, // 0x30 ..= 0x37. '0'-'7'. |
| 324 | 0x88, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x38 ..= 0x3F. '8'-'9'. |
| 325 | |
| 326 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x40 ..= 0x47. |
| 327 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x48 ..= 0x4F. |
| 328 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x50 ..= 0x57. |
| 329 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x58 ..= 0x5F. |
| 330 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x60 ..= 0x67. |
| 331 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x68 ..= 0x6F. |
| 332 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x70 ..= 0x77. |
| 333 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x78 ..= 0x7F. |
| 334 | |
| 335 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x80 ..= 0x87. |
| 336 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x88 ..= 0x8F. |
| 337 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x90 ..= 0x97. |
| 338 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x98 ..= 0x9F. |
| 339 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xA0 ..= 0xA7. |
| 340 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xA8 ..= 0xAF. |
| 341 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xB0 ..= 0xB7. |
| 342 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xB8 ..= 0xBF. |
| 343 | |
| 344 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xC0 ..= 0xC7. |
| 345 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xC8 ..= 0xCF. |
| 346 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xD0 ..= 0xD7. |
| 347 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xD8 ..= 0xDF. |
| 348 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE0 ..= 0xE7. |
| 349 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE8 ..= 0xEF. |
| 350 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF0 ..= 0xF7. |
| 351 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF8 ..= 0xFF. |
| 352 | // 0 1 2 3 4 5 6 7 |
| 353 | // 8 9 A B C D E F |
| 354 | ] |
| 355 | |
Nigel Tao | 532e18c | 2020-04-14 14:38:07 +1000 | [diff] [blame] | 356 | pri const LUT_HEXADECIMAL_DIGITS : array[256] base.u8 = [ |
Nigel Tao | 48e7004 | 2020-02-22 08:07:26 +1100 | [diff] [blame] | 357 | // 0 1 2 3 4 5 6 7 |
| 358 | // 8 9 A B C D E F |
Nigel Tao | 9263c80 | 2020-02-22 07:24:22 +1100 | [diff] [blame] | 359 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x00 ..= 0x07. |
| 360 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x08 ..= 0x0F. |
| 361 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x10 ..= 0x17. |
| 362 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x18 ..= 0x1F. |
| 363 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x20 ..= 0x27. |
| 364 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x28 ..= 0x2F. |
| 365 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, // 0x30 ..= 0x37. '0'-'7'. |
| 366 | 0x88, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x38 ..= 0x3F. '8'-'9'. |
| 367 | |
| 368 | 0x00, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x00, // 0x40 ..= 0x47. 'A'-'F'. |
| 369 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x48 ..= 0x4F. |
| 370 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x50 ..= 0x57. |
| 371 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x58 ..= 0x5F. |
| 372 | 0x00, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x00, // 0x60 ..= 0x67. 'a'-'f'. |
| 373 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x68 ..= 0x6F. |
| 374 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x70 ..= 0x77. |
| 375 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x78 ..= 0x7F. |
| 376 | |
| 377 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x80 ..= 0x87. |
| 378 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x88 ..= 0x8F. |
| 379 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x90 ..= 0x97. |
| 380 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x98 ..= 0x9F. |
| 381 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xA0 ..= 0xA7. |
| 382 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xA8 ..= 0xAF. |
| 383 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xB0 ..= 0xB7. |
| 384 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xB8 ..= 0xBF. |
| 385 | |
| 386 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xC0 ..= 0xC7. |
| 387 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xC8 ..= 0xCF. |
| 388 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xD0 ..= 0xD7. |
| 389 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xD8 ..= 0xDF. |
| 390 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE0 ..= 0xE7. |
| 391 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE8 ..= 0xEF. |
| 392 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF0 ..= 0xF7. |
| 393 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF8 ..= 0xFF. |
Nigel Tao | 48e7004 | 2020-02-22 08:07:26 +1100 | [diff] [blame] | 394 | // 0 1 2 3 4 5 6 7 |
| 395 | // 8 9 A B C D E F |
Nigel Tao | 9263c80 | 2020-02-22 07:24:22 +1100 | [diff] [blame] | 396 | ] |