mongo-ejson 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ad82ad33cec308c20018042c44a50361619d79813bb866e830126794f35daed1
4
+ data.tar.gz: 7d2bec415b3328b6c112e382819f3d6c9b0b97fbdbbbf3d40ec4779a8926b36c
5
+ SHA512:
6
+ metadata.gz: 7fcd47f32cbb62d40ea9d268746f4bd7ebb8611a5c044297c16bb4a9dbd14d7d79933f6a0bf4b58d731c93d7bc7abe2dac3cf281ce1a62ea3d956abec3c8a826
7
+ data.tar.gz: 412d8ed39076c303b704016dfda59d25ad05a7e40a5314a430d59b5fdaf7902fe0a18f019100b9ebbf77a0715f5a455c1a01559d7247f6a758fe130871243199
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6
7
+ - 2.5
8
+ - jruby-9.2
9
+ before_install: gem install bundler -v 2.0.1
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in mongo-ejson.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,39 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ mongo-ejson (0.2.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ bson (4.4.2)
10
+ bson (4.4.2-java)
11
+ diff-lcs (1.3)
12
+ rake (10.5.0)
13
+ rspec (3.8.0)
14
+ rspec-core (~> 3.8.0)
15
+ rspec-expectations (~> 3.8.0)
16
+ rspec-mocks (~> 3.8.0)
17
+ rspec-core (3.8.0)
18
+ rspec-support (~> 3.8.0)
19
+ rspec-expectations (3.8.2)
20
+ diff-lcs (>= 1.2.0, < 2.0)
21
+ rspec-support (~> 3.8.0)
22
+ rspec-mocks (3.8.0)
23
+ diff-lcs (>= 1.2.0, < 2.0)
24
+ rspec-support (~> 3.8.0)
25
+ rspec-support (3.8.0)
26
+
27
+ PLATFORMS
28
+ java
29
+ ruby
30
+
31
+ DEPENDENCIES
32
+ bson
33
+ bundler (~> 2.0)
34
+ mongo-ejson!
35
+ rake (~> 10.0)
36
+ rspec (~> 3.0)
37
+
38
+ BUNDLED WITH
39
+ 2.0.1
data/README.md ADDED
@@ -0,0 +1,57 @@
1
+ # mongo-ejson
2
+
3
+ [![Build Status](https://travis-ci.org/db-ai/mongo-ejson.svg?branch=master)](https://travis-ci.org/db-ai/mongo-ejson)
4
+
5
+ This is a parser for mongo "flavoured" JSON, that supports mongo specific literals like `ISODate` or `ObjectId`, as well as some other nasty non-json things.
6
+
7
+ It can instantiate corresponding BSON objects or produce Extended JSON objects.
8
+
9
+ ## Requirements
10
+
11
+ Runtime:
12
+ * Ruby 2.5+
13
+ * JRuby 9.2+
14
+
15
+ Development:
16
+ * [canopy](https://github.com/jcoglan/canopy) from master branch
17
+
18
+ ## Supported literals
19
+
20
+ * `undefined`
21
+ * `MinKey`
22
+ * `MaxKey`
23
+ * `ObjectId(<object_id_hex_string>)`
24
+ * `BinData(<type_string>, <bindata_base64_string>)`
25
+ * `BinData(<type_integer>, <base64_bindata>)`
26
+ * `Timestamp(<time_interger>, <increment_integer>)`
27
+ * `NumberLong(<value_string>)`
28
+ * `NumberLong(<value_integer>)`
29
+ * `NumberDecimal(<value_string>)`
30
+ * `NumberDecimal(<value_number>)`
31
+ * `ISODate(<time_iso8601_string>)`
32
+ * `ISODate(<time_interger>)`
33
+ * `new Date(<time_iso8601_string>)`
34
+ * `new Date(<time_interger>)`
35
+ * `/<regexp>/<options>`
36
+ * `DBRef(<name_string>, <object_id_hex_string>)`
37
+
38
+ ## Supported JSON extensions:
39
+
40
+ * Single quoted strings
41
+ * Single line comments `//`
42
+
43
+ ## Planned JSON extensions:
44
+
45
+ * Multi-line comments: `/* */`
46
+
47
+ ## Issues
48
+
49
+ * String: following not escaped chars should fail, but pass
50
+
51
+ * Backspace (must be replaced with `\b`). no fixture
52
+ * Form feed (must be replaced with `\f`), no fixture
53
+ * Newline (must be replaced with `\n`)
54
+ * Carriage return (must be replaced with `\r`), no fixture
55
+ * Tab (must be replaced with `\t`)
56
+
57
+
data/Rakefile ADDED
@@ -0,0 +1,26 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+ require 'fileutils'
4
+
5
+ CANOPY_BIN = ENV.fetch('CANOPY_BIN') { 'canopy' }
6
+
7
+ RSpec::Core::RakeTask.new(:spec)
8
+
9
+ task :default => :spec
10
+
11
+ task :compile_js do
12
+ sh %{ #{CANOPY_BIN} src/ejson.peg --lang javascript }
13
+ end
14
+
15
+ task :compile_ruby do
16
+ sh %{ #{CANOPY_BIN} src/ejson.peg --lang ruby }
17
+ end
18
+
19
+ desc "Build and run test suite"
20
+ task :test => [:compile_ruby, :spec] do
21
+ end
22
+
23
+ desc "Prepare assets"
24
+ task :assets => [:test, :compile_js] do
25
+ mv 'src/ejson.js', 'lib/assets/ejson.js'
26
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "ejson"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/ejson.gemspec ADDED
@@ -0,0 +1,46 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "ejson/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "mongo-ejson"
8
+ spec.version = EJSON::VERSION
9
+ spec.authors = ["Alex Bondar"]
10
+ spec.email = ["mongo-ejson-gem@db-ai.co"]
11
+
12
+ spec.summary = %q{MongoDB Extended JS(ON) parser}
13
+ spec.description = %q{Parses MongoDB favoured JS(ON) string into objects}
14
+ spec.homepage = "https://gibhub.com/db-ai/mongo-ejson"
15
+
16
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the
17
+ # 'allowed_push_host' to allow pushing to a single host or delete this
18
+ # section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata["allowed_push_host"] = "https://rubygems.org/"
21
+
22
+ spec.metadata["homepage_uri"] = spec.homepage
23
+ spec.metadata["source_code_uri"] = "https://gibhub.com/db-ai/mongo-ejson"
24
+ spec.metadata["changelog_uri"] = "https://gibhub.com/db-ai/mongo-ejson"
25
+ else
26
+ raise "RubyGems 2.0 or newer is required to protect against " \
27
+ "public gem pushes."
28
+ end
29
+
30
+ # Specify which files should be added to the gem when it is released.
31
+ # The `git ls-files -z` loads the files in the RubyGem that have been
32
+ # added into git.
33
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
34
+ `git ls-files -z`
35
+ .split("\x0")
36
+ .reject { |f| f.match(%r{^(test|spec|features)/}) }
37
+ end
38
+ spec.bindir = "exe"
39
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
40
+ spec.require_paths = ["lib"]
41
+
42
+ spec.add_development_dependency "bundler", "~> 2.0"
43
+ spec.add_development_dependency "rake", "~> 10.0"
44
+ spec.add_development_dependency "rspec", "~> 3.0"
45
+ spec.add_development_dependency "bson"
46
+ end
@@ -0,0 +1,4061 @@
1
+ /**
2
+ * This file was generated from src/ejson.peg
3
+ * See http://canopy.jcoglan.com/ for documentation.
4
+ */
5
+
6
+ (function() {
7
+ 'use strict';
8
+
9
+ var extend = function(destination, source) {
10
+ if (!destination || !source) return destination;
11
+ for (var key in source) {
12
+ if (destination[key] !== source[key])
13
+ destination[key] = source[key];
14
+ }
15
+ return destination;
16
+ };
17
+
18
+ var formatError = function(input, offset, expected) {
19
+ var lines = input.split(/\n/g),
20
+ lineNo = 0,
21
+ position = 0;
22
+
23
+ while (position <= offset) {
24
+ position += lines[lineNo].length + 1;
25
+ lineNo += 1;
26
+ }
27
+ var message = 'Line ' + lineNo + ': expected ' + expected.join(', ') + '\n',
28
+ line = lines[lineNo - 1];
29
+
30
+ message += line + '\n';
31
+ position -= line.length + 1;
32
+
33
+ while (position < offset) {
34
+ message += ' ';
35
+ position += 1;
36
+ }
37
+ return message + '^';
38
+ };
39
+
40
+ var inherit = function(subclass, parent) {
41
+ var chain = function() {};
42
+ chain.prototype = parent.prototype;
43
+ subclass.prototype = new chain();
44
+ subclass.prototype.constructor = subclass;
45
+ };
46
+
47
+ var TreeNode = function(text, offset, elements) {
48
+ this.text = text;
49
+ this.offset = offset;
50
+ this.elements = elements || [];
51
+ };
52
+
53
+ TreeNode.prototype.forEach = function(block, context) {
54
+ for (var el = this.elements, i = 0, n = el.length; i < n; i++) {
55
+ block.call(context, el[i], i, el);
56
+ }
57
+ };
58
+
59
+ var TreeNode1 = function(text, offset, elements) {
60
+ TreeNode.apply(this, arguments);
61
+ this['string'] = elements[0];
62
+ this['value'] = elements[1];
63
+ };
64
+ inherit(TreeNode1, TreeNode);
65
+
66
+ var TreeNode2 = function(text, offset, elements) {
67
+ TreeNode.apply(this, arguments);
68
+ this['pair'] = elements[0];
69
+ };
70
+ inherit(TreeNode2, TreeNode);
71
+
72
+ var TreeNode3 = function(text, offset, elements) {
73
+ TreeNode.apply(this, arguments);
74
+ this['pair'] = elements[0];
75
+ };
76
+ inherit(TreeNode3, TreeNode);
77
+
78
+ var TreeNode4 = function(text, offset, elements) {
79
+ TreeNode.apply(this, arguments);
80
+ this['value'] = elements[0];
81
+ };
82
+ inherit(TreeNode4, TreeNode);
83
+
84
+ var TreeNode5 = function(text, offset, elements) {
85
+ TreeNode.apply(this, arguments);
86
+ this['value'] = elements[0];
87
+ };
88
+ inherit(TreeNode5, TreeNode);
89
+
90
+ var TreeNode6 = function(text, offset, elements) {
91
+ TreeNode.apply(this, arguments);
92
+ this['hex_value'] = elements[0];
93
+ };
94
+ inherit(TreeNode6, TreeNode);
95
+
96
+ var TreeNode7 = function(text, offset, elements) {
97
+ TreeNode.apply(this, arguments);
98
+ this['hex_value'] = elements[0];
99
+ };
100
+ inherit(TreeNode7, TreeNode);
101
+
102
+ var TreeNode8 = function(text, offset, elements) {
103
+ TreeNode.apply(this, arguments);
104
+ this['integer_number'] = elements[0];
105
+ };
106
+ inherit(TreeNode8, TreeNode);
107
+
108
+ var TreeNode9 = function(text, offset, elements) {
109
+ TreeNode.apply(this, arguments);
110
+ this['integer_number'] = elements[0];
111
+ };
112
+ inherit(TreeNode9, TreeNode);
113
+
114
+ var TreeNode10 = function(text, offset, elements) {
115
+ TreeNode.apply(this, arguments);
116
+ this['number'] = elements[0];
117
+ };
118
+ inherit(TreeNode10, TreeNode);
119
+
120
+ var TreeNode11 = function(text, offset, elements) {
121
+ TreeNode.apply(this, arguments);
122
+ this['number'] = elements[0];
123
+ };
124
+ inherit(TreeNode11, TreeNode);
125
+
126
+ var TreeNode12 = function(text, offset, elements) {
127
+ TreeNode.apply(this, arguments);
128
+ this['base64_value'] = elements[0];
129
+ };
130
+ inherit(TreeNode12, TreeNode);
131
+
132
+ var TreeNode13 = function(text, offset, elements) {
133
+ TreeNode.apply(this, arguments);
134
+ this['base64_value'] = elements[0];
135
+ };
136
+ inherit(TreeNode13, TreeNode);
137
+
138
+ var TreeNode14 = function(text, offset, elements) {
139
+ TreeNode.apply(this, arguments);
140
+ this['integer'] = elements[1];
141
+ };
142
+ inherit(TreeNode14, TreeNode);
143
+
144
+ var TreeNode15 = function(text, offset, elements) {
145
+ TreeNode.apply(this, arguments);
146
+ this['integer'] = elements[1];
147
+ };
148
+ inherit(TreeNode15, TreeNode);
149
+
150
+ var TreeNode16 = function(text, offset, elements) {
151
+ TreeNode.apply(this, arguments);
152
+ this['integer'] = elements[0];
153
+ };
154
+ inherit(TreeNode16, TreeNode);
155
+
156
+ var TreeNode17 = function(text, offset, elements) {
157
+ TreeNode.apply(this, arguments);
158
+ this['hex_string'] = elements[0];
159
+ };
160
+ inherit(TreeNode17, TreeNode);
161
+
162
+ var TreeNode18 = function(text, offset, elements) {
163
+ TreeNode.apply(this, arguments);
164
+ this['bin_data_type'] = elements[0];
165
+ this['base64_string'] = elements[1];
166
+ };
167
+ inherit(TreeNode18, TreeNode);
168
+
169
+ var TreeNode19 = function(text, offset, elements) {
170
+ TreeNode.apply(this, arguments);
171
+ this['integer_number'] = elements[1];
172
+ };
173
+ inherit(TreeNode19, TreeNode);
174
+
175
+ var TreeNode20 = function(text, offset, elements) {
176
+ TreeNode.apply(this, arguments);
177
+ this['number_long_value'] = elements[0];
178
+ };
179
+ inherit(TreeNode20, TreeNode);
180
+
181
+ var TreeNode21 = function(text, offset, elements) {
182
+ TreeNode.apply(this, arguments);
183
+ this['number_decimal_value'] = elements[0];
184
+ };
185
+ inherit(TreeNode21, TreeNode);
186
+
187
+ var TreeNode22 = function(text, offset, elements) {
188
+ TreeNode.apply(this, arguments);
189
+ this['date_value'] = elements[0];
190
+ };
191
+ inherit(TreeNode22, TreeNode);
192
+
193
+ var TreeNode23 = function(text, offset, elements) {
194
+ TreeNode.apply(this, arguments);
195
+ this['string'] = elements[1];
196
+ };
197
+ inherit(TreeNode23, TreeNode);
198
+
199
+ var TreeNode24 = function(text, offset, elements) {
200
+ TreeNode.apply(this, arguments);
201
+ this['comma'] = elements[0];
202
+ };
203
+ inherit(TreeNode24, TreeNode);
204
+
205
+ var FAILURE = {};
206
+
207
+ var Grammar = {
208
+ _read_root: function() {
209
+ var address0 = FAILURE, index0 = this._offset;
210
+ this._cache._root = this._cache._root || {};
211
+ var cached = this._cache._root[index0];
212
+ if (cached) {
213
+ this._offset = cached[1];
214
+ return cached[0];
215
+ }
216
+ var index1 = this._offset, elements0 = new Array(1);
217
+ var address1 = FAILURE;
218
+ address1 = this._read___();
219
+ if (address1 !== FAILURE) {
220
+ var address2 = FAILURE;
221
+ var index2 = this._offset;
222
+ address2 = this._read_object();
223
+ if (address2 === FAILURE) {
224
+ this._offset = index2;
225
+ address2 = this._read_array();
226
+ if (address2 === FAILURE) {
227
+ this._offset = index2;
228
+ }
229
+ }
230
+ if (address2 !== FAILURE) {
231
+ elements0[0] = address2;
232
+ var address3 = FAILURE;
233
+ address3 = this._read___();
234
+ if (address3 !== FAILURE) {
235
+ } else {
236
+ elements0 = null;
237
+ this._offset = index1;
238
+ }
239
+ } else {
240
+ elements0 = null;
241
+ this._offset = index1;
242
+ }
243
+ } else {
244
+ elements0 = null;
245
+ this._offset = index1;
246
+ }
247
+ if (elements0 === null) {
248
+ address0 = FAILURE;
249
+ } else {
250
+ address0 = this._actions.make_root(this._input, index1, this._offset, elements0);
251
+ this._offset = this._offset;
252
+ }
253
+ this._cache._root[index0] = [address0, this._offset];
254
+ return address0;
255
+ },
256
+
257
+ _read_object: function() {
258
+ var address0 = FAILURE, index0 = this._offset;
259
+ this._cache._object = this._cache._object || {};
260
+ var cached = this._cache._object[index0];
261
+ if (cached) {
262
+ this._offset = cached[1];
263
+ return cached[0];
264
+ }
265
+ var index1 = this._offset;
266
+ address0 = this._read_non_empty_object();
267
+ if (address0 === FAILURE) {
268
+ this._offset = index1;
269
+ address0 = this._read_empty_object();
270
+ if (address0 === FAILURE) {
271
+ this._offset = index1;
272
+ }
273
+ }
274
+ this._cache._object[index0] = [address0, this._offset];
275
+ return address0;
276
+ },
277
+
278
+ _read_pair: function() {
279
+ var address0 = FAILURE, index0 = this._offset;
280
+ this._cache._pair = this._cache._pair || {};
281
+ var cached = this._cache._pair[index0];
282
+ if (cached) {
283
+ this._offset = cached[1];
284
+ return cached[0];
285
+ }
286
+ var index1 = this._offset, elements0 = new Array(2);
287
+ var address1 = FAILURE;
288
+ address1 = this._read___();
289
+ if (address1 !== FAILURE) {
290
+ var address2 = FAILURE;
291
+ address2 = this._read_string();
292
+ if (address2 !== FAILURE) {
293
+ elements0[0] = address2;
294
+ var address3 = FAILURE;
295
+ address3 = this._read_assignment();
296
+ if (address3 !== FAILURE) {
297
+ var address4 = FAILURE;
298
+ address4 = this._read_value();
299
+ if (address4 !== FAILURE) {
300
+ elements0[1] = address4;
301
+ } else {
302
+ elements0 = null;
303
+ this._offset = index1;
304
+ }
305
+ } else {
306
+ elements0 = null;
307
+ this._offset = index1;
308
+ }
309
+ } else {
310
+ elements0 = null;
311
+ this._offset = index1;
312
+ }
313
+ } else {
314
+ elements0 = null;
315
+ this._offset = index1;
316
+ }
317
+ if (elements0 === null) {
318
+ address0 = FAILURE;
319
+ } else {
320
+ address0 = this._actions.make_pair(this._input, index1, this._offset, elements0);
321
+ this._offset = this._offset;
322
+ }
323
+ this._cache._pair[index0] = [address0, this._offset];
324
+ return address0;
325
+ },
326
+
327
+ _read_non_empty_object: function() {
328
+ var address0 = FAILURE, index0 = this._offset;
329
+ this._cache._non_empty_object = this._cache._non_empty_object || {};
330
+ var cached = this._cache._non_empty_object[index0];
331
+ if (cached) {
332
+ this._offset = cached[1];
333
+ return cached[0];
334
+ }
335
+ var index1 = this._offset, elements0 = new Array(2);
336
+ var address1 = FAILURE;
337
+ address1 = this._read_object_open();
338
+ if (address1 !== FAILURE) {
339
+ var address2 = FAILURE;
340
+ address2 = this._read_pair();
341
+ if (address2 !== FAILURE) {
342
+ elements0[0] = address2;
343
+ var address3 = FAILURE;
344
+ var remaining0 = 0, index2 = this._offset, elements1 = [], address4 = true;
345
+ while (address4 !== FAILURE) {
346
+ var index3 = this._offset, elements2 = new Array(1);
347
+ var address5 = FAILURE;
348
+ address5 = this._read_delimiter();
349
+ if (address5 !== FAILURE) {
350
+ var address6 = FAILURE;
351
+ address6 = this._read_pair();
352
+ if (address6 !== FAILURE) {
353
+ elements2[0] = address6;
354
+ } else {
355
+ elements2 = null;
356
+ this._offset = index3;
357
+ }
358
+ } else {
359
+ elements2 = null;
360
+ this._offset = index3;
361
+ }
362
+ if (elements2 === null) {
363
+ address4 = FAILURE;
364
+ } else {
365
+ address4 = new TreeNode3(this._input.substring(index3, this._offset), index3, elements2);
366
+ this._offset = this._offset;
367
+ }
368
+ if (address4 !== FAILURE) {
369
+ elements1.push(address4);
370
+ --remaining0;
371
+ }
372
+ }
373
+ if (remaining0 <= 0) {
374
+ address3 = new TreeNode(this._input.substring(index2, this._offset), index2, elements1);
375
+ this._offset = this._offset;
376
+ } else {
377
+ address3 = FAILURE;
378
+ }
379
+ if (address3 !== FAILURE) {
380
+ elements0[1] = address3;
381
+ var address7 = FAILURE;
382
+ address7 = this._read_object_close();
383
+ if (address7 !== FAILURE) {
384
+ } else {
385
+ elements0 = null;
386
+ this._offset = index1;
387
+ }
388
+ } else {
389
+ elements0 = null;
390
+ this._offset = index1;
391
+ }
392
+ } else {
393
+ elements0 = null;
394
+ this._offset = index1;
395
+ }
396
+ } else {
397
+ elements0 = null;
398
+ this._offset = index1;
399
+ }
400
+ if (elements0 === null) {
401
+ address0 = FAILURE;
402
+ } else {
403
+ address0 = this._actions.make_object(this._input, index1, this._offset, elements0);
404
+ this._offset = this._offset;
405
+ }
406
+ this._cache._non_empty_object[index0] = [address0, this._offset];
407
+ return address0;
408
+ },
409
+
410
+ _read_empty_object: function() {
411
+ var address0 = FAILURE, index0 = this._offset;
412
+ this._cache._empty_object = this._cache._empty_object || {};
413
+ var cached = this._cache._empty_object[index0];
414
+ if (cached) {
415
+ this._offset = cached[1];
416
+ return cached[0];
417
+ }
418
+ var index1 = this._offset, elements0 = [];
419
+ var address1 = FAILURE;
420
+ address1 = this._read_object_open();
421
+ if (address1 !== FAILURE) {
422
+ var address2 = FAILURE;
423
+ address2 = this._read_object_close();
424
+ if (address2 !== FAILURE) {
425
+ } else {
426
+ elements0 = null;
427
+ this._offset = index1;
428
+ }
429
+ } else {
430
+ elements0 = null;
431
+ this._offset = index1;
432
+ }
433
+ if (elements0 === null) {
434
+ address0 = FAILURE;
435
+ } else {
436
+ address0 = this._actions.make_empty_object(this._input, index1, this._offset, elements0);
437
+ this._offset = this._offset;
438
+ }
439
+ this._cache._empty_object[index0] = [address0, this._offset];
440
+ return address0;
441
+ },
442
+
443
+ _read_array: function() {
444
+ var address0 = FAILURE, index0 = this._offset;
445
+ this._cache._array = this._cache._array || {};
446
+ var cached = this._cache._array[index0];
447
+ if (cached) {
448
+ this._offset = cached[1];
449
+ return cached[0];
450
+ }
451
+ var index1 = this._offset;
452
+ address0 = this._read_non_empty_array();
453
+ if (address0 === FAILURE) {
454
+ this._offset = index1;
455
+ address0 = this._read_empty_array();
456
+ if (address0 === FAILURE) {
457
+ this._offset = index1;
458
+ }
459
+ }
460
+ this._cache._array[index0] = [address0, this._offset];
461
+ return address0;
462
+ },
463
+
464
+ _read_non_empty_array: function() {
465
+ var address0 = FAILURE, index0 = this._offset;
466
+ this._cache._non_empty_array = this._cache._non_empty_array || {};
467
+ var cached = this._cache._non_empty_array[index0];
468
+ if (cached) {
469
+ this._offset = cached[1];
470
+ return cached[0];
471
+ }
472
+ var index1 = this._offset, elements0 = new Array(2);
473
+ var address1 = FAILURE;
474
+ address1 = this._read_array_open();
475
+ if (address1 !== FAILURE) {
476
+ var address2 = FAILURE;
477
+ address2 = this._read_value();
478
+ if (address2 !== FAILURE) {
479
+ elements0[0] = address2;
480
+ var address3 = FAILURE;
481
+ var remaining0 = 0, index2 = this._offset, elements1 = [], address4 = true;
482
+ while (address4 !== FAILURE) {
483
+ var index3 = this._offset, elements2 = new Array(1);
484
+ var address5 = FAILURE;
485
+ address5 = this._read_delimiter();
486
+ if (address5 !== FAILURE) {
487
+ var address6 = FAILURE;
488
+ address6 = this._read_value();
489
+ if (address6 !== FAILURE) {
490
+ elements2[0] = address6;
491
+ } else {
492
+ elements2 = null;
493
+ this._offset = index3;
494
+ }
495
+ } else {
496
+ elements2 = null;
497
+ this._offset = index3;
498
+ }
499
+ if (elements2 === null) {
500
+ address4 = FAILURE;
501
+ } else {
502
+ address4 = new TreeNode5(this._input.substring(index3, this._offset), index3, elements2);
503
+ this._offset = this._offset;
504
+ }
505
+ if (address4 !== FAILURE) {
506
+ elements1.push(address4);
507
+ --remaining0;
508
+ }
509
+ }
510
+ if (remaining0 <= 0) {
511
+ address3 = new TreeNode(this._input.substring(index2, this._offset), index2, elements1);
512
+ this._offset = this._offset;
513
+ } else {
514
+ address3 = FAILURE;
515
+ }
516
+ if (address3 !== FAILURE) {
517
+ elements0[1] = address3;
518
+ var address7 = FAILURE;
519
+ address7 = this._read_array_close();
520
+ if (address7 !== FAILURE) {
521
+ } else {
522
+ elements0 = null;
523
+ this._offset = index1;
524
+ }
525
+ } else {
526
+ elements0 = null;
527
+ this._offset = index1;
528
+ }
529
+ } else {
530
+ elements0 = null;
531
+ this._offset = index1;
532
+ }
533
+ } else {
534
+ elements0 = null;
535
+ this._offset = index1;
536
+ }
537
+ if (elements0 === null) {
538
+ address0 = FAILURE;
539
+ } else {
540
+ address0 = this._actions.make_array(this._input, index1, this._offset, elements0);
541
+ this._offset = this._offset;
542
+ }
543
+ this._cache._non_empty_array[index0] = [address0, this._offset];
544
+ return address0;
545
+ },
546
+
547
+ _read_empty_array: function() {
548
+ var address0 = FAILURE, index0 = this._offset;
549
+ this._cache._empty_array = this._cache._empty_array || {};
550
+ var cached = this._cache._empty_array[index0];
551
+ if (cached) {
552
+ this._offset = cached[1];
553
+ return cached[0];
554
+ }
555
+ var index1 = this._offset, elements0 = [];
556
+ var address1 = FAILURE;
557
+ address1 = this._read_array_open();
558
+ if (address1 !== FAILURE) {
559
+ var address2 = FAILURE;
560
+ address2 = this._read_array_close();
561
+ if (address2 !== FAILURE) {
562
+ } else {
563
+ elements0 = null;
564
+ this._offset = index1;
565
+ }
566
+ } else {
567
+ elements0 = null;
568
+ this._offset = index1;
569
+ }
570
+ if (elements0 === null) {
571
+ address0 = FAILURE;
572
+ } else {
573
+ address0 = this._actions.make_empty_array(this._input, index1, this._offset, elements0);
574
+ this._offset = this._offset;
575
+ }
576
+ this._cache._empty_array[index0] = [address0, this._offset];
577
+ return address0;
578
+ },
579
+
580
+ _read_value: function() {
581
+ var address0 = FAILURE, index0 = this._offset;
582
+ this._cache._value = this._cache._value || {};
583
+ var cached = this._cache._value[index0];
584
+ if (cached) {
585
+ this._offset = cached[1];
586
+ return cached[0];
587
+ }
588
+ var index1 = this._offset;
589
+ address0 = this._read_json_values();
590
+ if (address0 === FAILURE) {
591
+ this._offset = index1;
592
+ address0 = this._read_mongo_literals();
593
+ if (address0 === FAILURE) {
594
+ this._offset = index1;
595
+ address0 = this._read_mongo_types();
596
+ if (address0 === FAILURE) {
597
+ this._offset = index1;
598
+ }
599
+ }
600
+ }
601
+ this._cache._value[index0] = [address0, this._offset];
602
+ return address0;
603
+ },
604
+
605
+ _read_json_values: function() {
606
+ var address0 = FAILURE, index0 = this._offset;
607
+ this._cache._json_values = this._cache._json_values || {};
608
+ var cached = this._cache._json_values[index0];
609
+ if (cached) {
610
+ this._offset = cached[1];
611
+ return cached[0];
612
+ }
613
+ var index1 = this._offset;
614
+ address0 = this._read_object();
615
+ if (address0 === FAILURE) {
616
+ this._offset = index1;
617
+ address0 = this._read_array();
618
+ if (address0 === FAILURE) {
619
+ this._offset = index1;
620
+ address0 = this._read_number();
621
+ if (address0 === FAILURE) {
622
+ this._offset = index1;
623
+ address0 = this._read_string();
624
+ if (address0 === FAILURE) {
625
+ this._offset = index1;
626
+ address0 = this._read_boolean();
627
+ if (address0 === FAILURE) {
628
+ this._offset = index1;
629
+ address0 = this._read_null();
630
+ if (address0 === FAILURE) {
631
+ this._offset = index1;
632
+ }
633
+ }
634
+ }
635
+ }
636
+ }
637
+ }
638
+ this._cache._json_values[index0] = [address0, this._offset];
639
+ return address0;
640
+ },
641
+
642
+ _read_mongo_literals: function() {
643
+ var address0 = FAILURE, index0 = this._offset;
644
+ this._cache._mongo_literals = this._cache._mongo_literals || {};
645
+ var cached = this._cache._mongo_literals[index0];
646
+ if (cached) {
647
+ this._offset = cached[1];
648
+ return cached[0];
649
+ }
650
+ var index1 = this._offset;
651
+ address0 = this._read_min_key();
652
+ if (address0 === FAILURE) {
653
+ this._offset = index1;
654
+ address0 = this._read_max_key();
655
+ if (address0 === FAILURE) {
656
+ this._offset = index1;
657
+ address0 = this._read_undefined();
658
+ if (address0 === FAILURE) {
659
+ this._offset = index1;
660
+ address0 = this._read_regexp_string();
661
+ if (address0 === FAILURE) {
662
+ this._offset = index1;
663
+ }
664
+ }
665
+ }
666
+ }
667
+ this._cache._mongo_literals[index0] = [address0, this._offset];
668
+ return address0;
669
+ },
670
+
671
+ _read_mongo_types: function() {
672
+ var address0 = FAILURE, index0 = this._offset;
673
+ this._cache._mongo_types = this._cache._mongo_types || {};
674
+ var cached = this._cache._mongo_types[index0];
675
+ if (cached) {
676
+ this._offset = cached[1];
677
+ return cached[0];
678
+ }
679
+ var index1 = this._offset;
680
+ address0 = this._read_object_id();
681
+ if (address0 === FAILURE) {
682
+ this._offset = index1;
683
+ address0 = this._read_bin_data();
684
+ if (address0 === FAILURE) {
685
+ this._offset = index1;
686
+ address0 = this._read_timestamp();
687
+ if (address0 === FAILURE) {
688
+ this._offset = index1;
689
+ address0 = this._read_number_long();
690
+ if (address0 === FAILURE) {
691
+ this._offset = index1;
692
+ address0 = this._read_number_decimal();
693
+ if (address0 === FAILURE) {
694
+ this._offset = index1;
695
+ address0 = this._read_date();
696
+ if (address0 === FAILURE) {
697
+ this._offset = index1;
698
+ address0 = this._read_db_ref_type();
699
+ if (address0 === FAILURE) {
700
+ this._offset = index1;
701
+ }
702
+ }
703
+ }
704
+ }
705
+ }
706
+ }
707
+ }
708
+ this._cache._mongo_types[index0] = [address0, this._offset];
709
+ return address0;
710
+ },
711
+
712
+ _read_boolean: function() {
713
+ var address0 = FAILURE, index0 = this._offset;
714
+ this._cache._boolean = this._cache._boolean || {};
715
+ var cached = this._cache._boolean[index0];
716
+ if (cached) {
717
+ this._offset = cached[1];
718
+ return cached[0];
719
+ }
720
+ var index1 = this._offset;
721
+ address0 = this._read_true();
722
+ if (address0 === FAILURE) {
723
+ this._offset = index1;
724
+ address0 = this._read_false();
725
+ if (address0 === FAILURE) {
726
+ this._offset = index1;
727
+ }
728
+ }
729
+ this._cache._boolean[index0] = [address0, this._offset];
730
+ return address0;
731
+ },
732
+
733
+ _read_true: function() {
734
+ var address0 = FAILURE, index0 = this._offset;
735
+ this._cache._true = this._cache._true || {};
736
+ var cached = this._cache._true[index0];
737
+ if (cached) {
738
+ this._offset = cached[1];
739
+ return cached[0];
740
+ }
741
+ var chunk0 = null;
742
+ if (this._offset < this._inputSize) {
743
+ chunk0 = this._input.substring(this._offset, this._offset + 4);
744
+ }
745
+ if (chunk0 === 'true') {
746
+ address0 = this._actions.make_true(this._input, this._offset, this._offset + 4);
747
+ this._offset = this._offset + 4;
748
+ } else {
749
+ address0 = FAILURE;
750
+ if (this._offset > this._failure) {
751
+ this._failure = this._offset;
752
+ this._expected = [];
753
+ }
754
+ if (this._offset === this._failure) {
755
+ this._expected.push('"true"');
756
+ }
757
+ }
758
+ this._cache._true[index0] = [address0, this._offset];
759
+ return address0;
760
+ },
761
+
762
+ _read_false: function() {
763
+ var address0 = FAILURE, index0 = this._offset;
764
+ this._cache._false = this._cache._false || {};
765
+ var cached = this._cache._false[index0];
766
+ if (cached) {
767
+ this._offset = cached[1];
768
+ return cached[0];
769
+ }
770
+ var chunk0 = null;
771
+ if (this._offset < this._inputSize) {
772
+ chunk0 = this._input.substring(this._offset, this._offset + 5);
773
+ }
774
+ if (chunk0 === 'false') {
775
+ address0 = this._actions.make_false(this._input, this._offset, this._offset + 5);
776
+ this._offset = this._offset + 5;
777
+ } else {
778
+ address0 = FAILURE;
779
+ if (this._offset > this._failure) {
780
+ this._failure = this._offset;
781
+ this._expected = [];
782
+ }
783
+ if (this._offset === this._failure) {
784
+ this._expected.push('"false"');
785
+ }
786
+ }
787
+ this._cache._false[index0] = [address0, this._offset];
788
+ return address0;
789
+ },
790
+
791
+ _read_null: function() {
792
+ var address0 = FAILURE, index0 = this._offset;
793
+ this._cache._null = this._cache._null || {};
794
+ var cached = this._cache._null[index0];
795
+ if (cached) {
796
+ this._offset = cached[1];
797
+ return cached[0];
798
+ }
799
+ var chunk0 = null;
800
+ if (this._offset < this._inputSize) {
801
+ chunk0 = this._input.substring(this._offset, this._offset + 4);
802
+ }
803
+ if (chunk0 === 'null') {
804
+ address0 = this._actions.make_null(this._input, this._offset, this._offset + 4);
805
+ this._offset = this._offset + 4;
806
+ } else {
807
+ address0 = FAILURE;
808
+ if (this._offset > this._failure) {
809
+ this._failure = this._offset;
810
+ this._expected = [];
811
+ }
812
+ if (this._offset === this._failure) {
813
+ this._expected.push('"null"');
814
+ }
815
+ }
816
+ this._cache._null[index0] = [address0, this._offset];
817
+ return address0;
818
+ },
819
+
820
+ _read_string: function() {
821
+ var address0 = FAILURE, index0 = this._offset;
822
+ this._cache._string = this._cache._string || {};
823
+ var cached = this._cache._string[index0];
824
+ if (cached) {
825
+ this._offset = cached[1];
826
+ return cached[0];
827
+ }
828
+ var index1 = this._offset;
829
+ address0 = this._read_double_quote_string();
830
+ if (address0 === FAILURE) {
831
+ this._offset = index1;
832
+ address0 = this._read_single_quote_string();
833
+ if (address0 === FAILURE) {
834
+ this._offset = index1;
835
+ }
836
+ }
837
+ this._cache._string[index0] = [address0, this._offset];
838
+ return address0;
839
+ },
840
+
841
+ _read_double_quote_string: function() {
842
+ var address0 = FAILURE, index0 = this._offset;
843
+ this._cache._double_quote_string = this._cache._double_quote_string || {};
844
+ var cached = this._cache._double_quote_string[index0];
845
+ if (cached) {
846
+ this._offset = cached[1];
847
+ return cached[0];
848
+ }
849
+ var index1 = this._offset, elements0 = new Array(1);
850
+ var address1 = FAILURE;
851
+ address1 = this._read_double_quote();
852
+ if (address1 !== FAILURE) {
853
+ var address2 = FAILURE;
854
+ var remaining0 = 0, index2 = this._offset, elements1 = [], address3 = true;
855
+ while (address3 !== FAILURE) {
856
+ var index3 = this._offset;
857
+ var index4 = this._offset, elements2 = new Array(2);
858
+ var address4 = FAILURE;
859
+ var chunk0 = null;
860
+ if (this._offset < this._inputSize) {
861
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
862
+ }
863
+ if (chunk0 === '\\') {
864
+ address4 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
865
+ this._offset = this._offset + 1;
866
+ } else {
867
+ address4 = FAILURE;
868
+ if (this._offset > this._failure) {
869
+ this._failure = this._offset;
870
+ this._expected = [];
871
+ }
872
+ if (this._offset === this._failure) {
873
+ this._expected.push('"\\\\"');
874
+ }
875
+ }
876
+ if (address4 !== FAILURE) {
877
+ elements2[0] = address4;
878
+ var address5 = FAILURE;
879
+ if (this._offset < this._inputSize) {
880
+ address5 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
881
+ this._offset = this._offset + 1;
882
+ } else {
883
+ address5 = FAILURE;
884
+ if (this._offset > this._failure) {
885
+ this._failure = this._offset;
886
+ this._expected = [];
887
+ }
888
+ if (this._offset === this._failure) {
889
+ this._expected.push('<any char>');
890
+ }
891
+ }
892
+ if (address5 !== FAILURE) {
893
+ elements2[1] = address5;
894
+ } else {
895
+ elements2 = null;
896
+ this._offset = index4;
897
+ }
898
+ } else {
899
+ elements2 = null;
900
+ this._offset = index4;
901
+ }
902
+ if (elements2 === null) {
903
+ address3 = FAILURE;
904
+ } else {
905
+ address3 = new TreeNode(this._input.substring(index4, this._offset), index4, elements2);
906
+ this._offset = this._offset;
907
+ }
908
+ if (address3 === FAILURE) {
909
+ this._offset = index3;
910
+ var chunk1 = null;
911
+ if (this._offset < this._inputSize) {
912
+ chunk1 = this._input.substring(this._offset, this._offset + 1);
913
+ }
914
+ if (chunk1 !== null && /^[^"]/.test(chunk1)) {
915
+ address3 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
916
+ this._offset = this._offset + 1;
917
+ } else {
918
+ address3 = FAILURE;
919
+ if (this._offset > this._failure) {
920
+ this._failure = this._offset;
921
+ this._expected = [];
922
+ }
923
+ if (this._offset === this._failure) {
924
+ this._expected.push('[^"]');
925
+ }
926
+ }
927
+ if (address3 === FAILURE) {
928
+ this._offset = index3;
929
+ }
930
+ }
931
+ if (address3 !== FAILURE) {
932
+ elements1.push(address3);
933
+ --remaining0;
934
+ }
935
+ }
936
+ if (remaining0 <= 0) {
937
+ address2 = new TreeNode(this._input.substring(index2, this._offset), index2, elements1);
938
+ this._offset = this._offset;
939
+ } else {
940
+ address2 = FAILURE;
941
+ }
942
+ if (address2 !== FAILURE) {
943
+ elements0[0] = address2;
944
+ var address6 = FAILURE;
945
+ address6 = this._read_double_quote();
946
+ if (address6 !== FAILURE) {
947
+ } else {
948
+ elements0 = null;
949
+ this._offset = index1;
950
+ }
951
+ } else {
952
+ elements0 = null;
953
+ this._offset = index1;
954
+ }
955
+ } else {
956
+ elements0 = null;
957
+ this._offset = index1;
958
+ }
959
+ if (elements0 === null) {
960
+ address0 = FAILURE;
961
+ } else {
962
+ address0 = this._actions.make_string(this._input, index1, this._offset, elements0);
963
+ this._offset = this._offset;
964
+ }
965
+ this._cache._double_quote_string[index0] = [address0, this._offset];
966
+ return address0;
967
+ },
968
+
969
+ _read_single_quote_string: function() {
970
+ var address0 = FAILURE, index0 = this._offset;
971
+ this._cache._single_quote_string = this._cache._single_quote_string || {};
972
+ var cached = this._cache._single_quote_string[index0];
973
+ if (cached) {
974
+ this._offset = cached[1];
975
+ return cached[0];
976
+ }
977
+ var index1 = this._offset, elements0 = new Array(1);
978
+ var address1 = FAILURE;
979
+ address1 = this._read_single_quote();
980
+ if (address1 !== FAILURE) {
981
+ var address2 = FAILURE;
982
+ var remaining0 = 0, index2 = this._offset, elements1 = [], address3 = true;
983
+ while (address3 !== FAILURE) {
984
+ var index3 = this._offset;
985
+ var index4 = this._offset, elements2 = new Array(2);
986
+ var address4 = FAILURE;
987
+ var chunk0 = null;
988
+ if (this._offset < this._inputSize) {
989
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
990
+ }
991
+ if (chunk0 === '\\') {
992
+ address4 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
993
+ this._offset = this._offset + 1;
994
+ } else {
995
+ address4 = FAILURE;
996
+ if (this._offset > this._failure) {
997
+ this._failure = this._offset;
998
+ this._expected = [];
999
+ }
1000
+ if (this._offset === this._failure) {
1001
+ this._expected.push('"\\\\"');
1002
+ }
1003
+ }
1004
+ if (address4 !== FAILURE) {
1005
+ elements2[0] = address4;
1006
+ var address5 = FAILURE;
1007
+ if (this._offset < this._inputSize) {
1008
+ address5 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
1009
+ this._offset = this._offset + 1;
1010
+ } else {
1011
+ address5 = FAILURE;
1012
+ if (this._offset > this._failure) {
1013
+ this._failure = this._offset;
1014
+ this._expected = [];
1015
+ }
1016
+ if (this._offset === this._failure) {
1017
+ this._expected.push('<any char>');
1018
+ }
1019
+ }
1020
+ if (address5 !== FAILURE) {
1021
+ elements2[1] = address5;
1022
+ } else {
1023
+ elements2 = null;
1024
+ this._offset = index4;
1025
+ }
1026
+ } else {
1027
+ elements2 = null;
1028
+ this._offset = index4;
1029
+ }
1030
+ if (elements2 === null) {
1031
+ address3 = FAILURE;
1032
+ } else {
1033
+ address3 = new TreeNode(this._input.substring(index4, this._offset), index4, elements2);
1034
+ this._offset = this._offset;
1035
+ }
1036
+ if (address3 === FAILURE) {
1037
+ this._offset = index3;
1038
+ var chunk1 = null;
1039
+ if (this._offset < this._inputSize) {
1040
+ chunk1 = this._input.substring(this._offset, this._offset + 1);
1041
+ }
1042
+ if (chunk1 !== null && /^[^']/.test(chunk1)) {
1043
+ address3 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
1044
+ this._offset = this._offset + 1;
1045
+ } else {
1046
+ address3 = FAILURE;
1047
+ if (this._offset > this._failure) {
1048
+ this._failure = this._offset;
1049
+ this._expected = [];
1050
+ }
1051
+ if (this._offset === this._failure) {
1052
+ this._expected.push('[^\']');
1053
+ }
1054
+ }
1055
+ if (address3 === FAILURE) {
1056
+ this._offset = index3;
1057
+ }
1058
+ }
1059
+ if (address3 !== FAILURE) {
1060
+ elements1.push(address3);
1061
+ --remaining0;
1062
+ }
1063
+ }
1064
+ if (remaining0 <= 0) {
1065
+ address2 = new TreeNode(this._input.substring(index2, this._offset), index2, elements1);
1066
+ this._offset = this._offset;
1067
+ } else {
1068
+ address2 = FAILURE;
1069
+ }
1070
+ if (address2 !== FAILURE) {
1071
+ elements0[0] = address2;
1072
+ var address6 = FAILURE;
1073
+ address6 = this._read_single_quote();
1074
+ if (address6 !== FAILURE) {
1075
+ } else {
1076
+ elements0 = null;
1077
+ this._offset = index1;
1078
+ }
1079
+ } else {
1080
+ elements0 = null;
1081
+ this._offset = index1;
1082
+ }
1083
+ } else {
1084
+ elements0 = null;
1085
+ this._offset = index1;
1086
+ }
1087
+ if (elements0 === null) {
1088
+ address0 = FAILURE;
1089
+ } else {
1090
+ address0 = this._actions.make_string(this._input, index1, this._offset, elements0);
1091
+ this._offset = this._offset;
1092
+ }
1093
+ this._cache._single_quote_string[index0] = [address0, this._offset];
1094
+ return address0;
1095
+ },
1096
+
1097
+ _read_hex_string: function() {
1098
+ var address0 = FAILURE, index0 = this._offset;
1099
+ this._cache._hex_string = this._cache._hex_string || {};
1100
+ var cached = this._cache._hex_string[index0];
1101
+ if (cached) {
1102
+ this._offset = cached[1];
1103
+ return cached[0];
1104
+ }
1105
+ var index1 = this._offset;
1106
+ address0 = this._read_hex_single_quote();
1107
+ if (address0 === FAILURE) {
1108
+ this._offset = index1;
1109
+ address0 = this._read_hex_double_quote();
1110
+ if (address0 === FAILURE) {
1111
+ this._offset = index1;
1112
+ }
1113
+ }
1114
+ this._cache._hex_string[index0] = [address0, this._offset];
1115
+ return address0;
1116
+ },
1117
+
1118
+ _read_hex_value: function() {
1119
+ var address0 = FAILURE, index0 = this._offset;
1120
+ this._cache._hex_value = this._cache._hex_value || {};
1121
+ var cached = this._cache._hex_value[index0];
1122
+ if (cached) {
1123
+ this._offset = cached[1];
1124
+ return cached[0];
1125
+ }
1126
+ var remaining0 = 1, index1 = this._offset, elements0 = [], address1 = true;
1127
+ while (address1 !== FAILURE) {
1128
+ var chunk0 = null;
1129
+ if (this._offset < this._inputSize) {
1130
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
1131
+ }
1132
+ if (chunk0 !== null && /^[a-fA-F0-9]/.test(chunk0)) {
1133
+ address1 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
1134
+ this._offset = this._offset + 1;
1135
+ } else {
1136
+ address1 = FAILURE;
1137
+ if (this._offset > this._failure) {
1138
+ this._failure = this._offset;
1139
+ this._expected = [];
1140
+ }
1141
+ if (this._offset === this._failure) {
1142
+ this._expected.push('[a-fA-F0-9]');
1143
+ }
1144
+ }
1145
+ if (address1 !== FAILURE) {
1146
+ elements0.push(address1);
1147
+ --remaining0;
1148
+ }
1149
+ }
1150
+ if (remaining0 <= 0) {
1151
+ address0 = new TreeNode(this._input.substring(index1, this._offset), index1, elements0);
1152
+ this._offset = this._offset;
1153
+ } else {
1154
+ address0 = FAILURE;
1155
+ }
1156
+ this._cache._hex_value[index0] = [address0, this._offset];
1157
+ return address0;
1158
+ },
1159
+
1160
+ _read_hex_single_quote: function() {
1161
+ var address0 = FAILURE, index0 = this._offset;
1162
+ this._cache._hex_single_quote = this._cache._hex_single_quote || {};
1163
+ var cached = this._cache._hex_single_quote[index0];
1164
+ if (cached) {
1165
+ this._offset = cached[1];
1166
+ return cached[0];
1167
+ }
1168
+ var index1 = this._offset, elements0 = new Array(1);
1169
+ var address1 = FAILURE;
1170
+ address1 = this._read_single_quote();
1171
+ if (address1 !== FAILURE) {
1172
+ var address2 = FAILURE;
1173
+ address2 = this._read_hex_value();
1174
+ if (address2 !== FAILURE) {
1175
+ elements0[0] = address2;
1176
+ var address3 = FAILURE;
1177
+ address3 = this._read_single_quote();
1178
+ if (address3 !== FAILURE) {
1179
+ } else {
1180
+ elements0 = null;
1181
+ this._offset = index1;
1182
+ }
1183
+ } else {
1184
+ elements0 = null;
1185
+ this._offset = index1;
1186
+ }
1187
+ } else {
1188
+ elements0 = null;
1189
+ this._offset = index1;
1190
+ }
1191
+ if (elements0 === null) {
1192
+ address0 = FAILURE;
1193
+ } else {
1194
+ address0 = this._actions.make_string(this._input, index1, this._offset, elements0);
1195
+ this._offset = this._offset;
1196
+ }
1197
+ this._cache._hex_single_quote[index0] = [address0, this._offset];
1198
+ return address0;
1199
+ },
1200
+
1201
+ _read_hex_double_quote: function() {
1202
+ var address0 = FAILURE, index0 = this._offset;
1203
+ this._cache._hex_double_quote = this._cache._hex_double_quote || {};
1204
+ var cached = this._cache._hex_double_quote[index0];
1205
+ if (cached) {
1206
+ this._offset = cached[1];
1207
+ return cached[0];
1208
+ }
1209
+ var index1 = this._offset, elements0 = new Array(1);
1210
+ var address1 = FAILURE;
1211
+ address1 = this._read_double_quote();
1212
+ if (address1 !== FAILURE) {
1213
+ var address2 = FAILURE;
1214
+ address2 = this._read_hex_value();
1215
+ if (address2 !== FAILURE) {
1216
+ elements0[0] = address2;
1217
+ var address3 = FAILURE;
1218
+ address3 = this._read_double_quote();
1219
+ if (address3 !== FAILURE) {
1220
+ } else {
1221
+ elements0 = null;
1222
+ this._offset = index1;
1223
+ }
1224
+ } else {
1225
+ elements0 = null;
1226
+ this._offset = index1;
1227
+ }
1228
+ } else {
1229
+ elements0 = null;
1230
+ this._offset = index1;
1231
+ }
1232
+ if (elements0 === null) {
1233
+ address0 = FAILURE;
1234
+ } else {
1235
+ address0 = this._actions.make_string(this._input, index1, this._offset, elements0);
1236
+ this._offset = this._offset;
1237
+ }
1238
+ this._cache._hex_double_quote[index0] = [address0, this._offset];
1239
+ return address0;
1240
+ },
1241
+
1242
+ _read_integer_string: function() {
1243
+ var address0 = FAILURE, index0 = this._offset;
1244
+ this._cache._integer_string = this._cache._integer_string || {};
1245
+ var cached = this._cache._integer_string[index0];
1246
+ if (cached) {
1247
+ this._offset = cached[1];
1248
+ return cached[0];
1249
+ }
1250
+ var index1 = this._offset;
1251
+ address0 = this._read_integer_string_single();
1252
+ if (address0 === FAILURE) {
1253
+ this._offset = index1;
1254
+ address0 = this._read_integer_string_double();
1255
+ if (address0 === FAILURE) {
1256
+ this._offset = index1;
1257
+ }
1258
+ }
1259
+ this._cache._integer_string[index0] = [address0, this._offset];
1260
+ return address0;
1261
+ },
1262
+
1263
+ _read_integer_string_single: function() {
1264
+ var address0 = FAILURE, index0 = this._offset;
1265
+ this._cache._integer_string_single = this._cache._integer_string_single || {};
1266
+ var cached = this._cache._integer_string_single[index0];
1267
+ if (cached) {
1268
+ this._offset = cached[1];
1269
+ return cached[0];
1270
+ }
1271
+ var index1 = this._offset, elements0 = new Array(1);
1272
+ var address1 = FAILURE;
1273
+ address1 = this._read_single_quote();
1274
+ if (address1 !== FAILURE) {
1275
+ var address2 = FAILURE;
1276
+ address2 = this._read_integer_number();
1277
+ if (address2 !== FAILURE) {
1278
+ elements0[0] = address2;
1279
+ var address3 = FAILURE;
1280
+ address3 = this._read_single_quote();
1281
+ if (address3 !== FAILURE) {
1282
+ } else {
1283
+ elements0 = null;
1284
+ this._offset = index1;
1285
+ }
1286
+ } else {
1287
+ elements0 = null;
1288
+ this._offset = index1;
1289
+ }
1290
+ } else {
1291
+ elements0 = null;
1292
+ this._offset = index1;
1293
+ }
1294
+ if (elements0 === null) {
1295
+ address0 = FAILURE;
1296
+ } else {
1297
+ address0 = this._actions.make_numeric_string(this._input, index1, this._offset, elements0);
1298
+ this._offset = this._offset;
1299
+ }
1300
+ this._cache._integer_string_single[index0] = [address0, this._offset];
1301
+ return address0;
1302
+ },
1303
+
1304
+ _read_integer_string_double: function() {
1305
+ var address0 = FAILURE, index0 = this._offset;
1306
+ this._cache._integer_string_double = this._cache._integer_string_double || {};
1307
+ var cached = this._cache._integer_string_double[index0];
1308
+ if (cached) {
1309
+ this._offset = cached[1];
1310
+ return cached[0];
1311
+ }
1312
+ var index1 = this._offset, elements0 = new Array(1);
1313
+ var address1 = FAILURE;
1314
+ address1 = this._read_double_quote();
1315
+ if (address1 !== FAILURE) {
1316
+ var address2 = FAILURE;
1317
+ address2 = this._read_integer_number();
1318
+ if (address2 !== FAILURE) {
1319
+ elements0[0] = address2;
1320
+ var address3 = FAILURE;
1321
+ address3 = this._read_double_quote();
1322
+ if (address3 !== FAILURE) {
1323
+ } else {
1324
+ elements0 = null;
1325
+ this._offset = index1;
1326
+ }
1327
+ } else {
1328
+ elements0 = null;
1329
+ this._offset = index1;
1330
+ }
1331
+ } else {
1332
+ elements0 = null;
1333
+ this._offset = index1;
1334
+ }
1335
+ if (elements0 === null) {
1336
+ address0 = FAILURE;
1337
+ } else {
1338
+ address0 = this._actions.make_numeric_string(this._input, index1, this._offset, elements0);
1339
+ this._offset = this._offset;
1340
+ }
1341
+ this._cache._integer_string_double[index0] = [address0, this._offset];
1342
+ return address0;
1343
+ },
1344
+
1345
+ _read_number_string: function() {
1346
+ var address0 = FAILURE, index0 = this._offset;
1347
+ this._cache._number_string = this._cache._number_string || {};
1348
+ var cached = this._cache._number_string[index0];
1349
+ if (cached) {
1350
+ this._offset = cached[1];
1351
+ return cached[0];
1352
+ }
1353
+ var index1 = this._offset;
1354
+ address0 = this._read_number_string_single();
1355
+ if (address0 === FAILURE) {
1356
+ this._offset = index1;
1357
+ address0 = this._read_number_string_double();
1358
+ if (address0 === FAILURE) {
1359
+ this._offset = index1;
1360
+ }
1361
+ }
1362
+ this._cache._number_string[index0] = [address0, this._offset];
1363
+ return address0;
1364
+ },
1365
+
1366
+ _read_number_string_single: function() {
1367
+ var address0 = FAILURE, index0 = this._offset;
1368
+ this._cache._number_string_single = this._cache._number_string_single || {};
1369
+ var cached = this._cache._number_string_single[index0];
1370
+ if (cached) {
1371
+ this._offset = cached[1];
1372
+ return cached[0];
1373
+ }
1374
+ var index1 = this._offset, elements0 = new Array(1);
1375
+ var address1 = FAILURE;
1376
+ address1 = this._read_single_quote();
1377
+ if (address1 !== FAILURE) {
1378
+ var address2 = FAILURE;
1379
+ address2 = this._read_number();
1380
+ if (address2 !== FAILURE) {
1381
+ elements0[0] = address2;
1382
+ var address3 = FAILURE;
1383
+ address3 = this._read_single_quote();
1384
+ if (address3 !== FAILURE) {
1385
+ } else {
1386
+ elements0 = null;
1387
+ this._offset = index1;
1388
+ }
1389
+ } else {
1390
+ elements0 = null;
1391
+ this._offset = index1;
1392
+ }
1393
+ } else {
1394
+ elements0 = null;
1395
+ this._offset = index1;
1396
+ }
1397
+ if (elements0 === null) {
1398
+ address0 = FAILURE;
1399
+ } else {
1400
+ address0 = this._actions.make_numeric_string(this._input, index1, this._offset, elements0);
1401
+ this._offset = this._offset;
1402
+ }
1403
+ this._cache._number_string_single[index0] = [address0, this._offset];
1404
+ return address0;
1405
+ },
1406
+
1407
+ _read_number_string_double: function() {
1408
+ var address0 = FAILURE, index0 = this._offset;
1409
+ this._cache._number_string_double = this._cache._number_string_double || {};
1410
+ var cached = this._cache._number_string_double[index0];
1411
+ if (cached) {
1412
+ this._offset = cached[1];
1413
+ return cached[0];
1414
+ }
1415
+ var index1 = this._offset, elements0 = new Array(1);
1416
+ var address1 = FAILURE;
1417
+ address1 = this._read_double_quote();
1418
+ if (address1 !== FAILURE) {
1419
+ var address2 = FAILURE;
1420
+ address2 = this._read_number();
1421
+ if (address2 !== FAILURE) {
1422
+ elements0[0] = address2;
1423
+ var address3 = FAILURE;
1424
+ address3 = this._read_double_quote();
1425
+ if (address3 !== FAILURE) {
1426
+ } else {
1427
+ elements0 = null;
1428
+ this._offset = index1;
1429
+ }
1430
+ } else {
1431
+ elements0 = null;
1432
+ this._offset = index1;
1433
+ }
1434
+ } else {
1435
+ elements0 = null;
1436
+ this._offset = index1;
1437
+ }
1438
+ if (elements0 === null) {
1439
+ address0 = FAILURE;
1440
+ } else {
1441
+ address0 = this._actions.make_numeric_string(this._input, index1, this._offset, elements0);
1442
+ this._offset = this._offset;
1443
+ }
1444
+ this._cache._number_string_double[index0] = [address0, this._offset];
1445
+ return address0;
1446
+ },
1447
+
1448
+ _read_regexp_string: function() {
1449
+ var address0 = FAILURE, index0 = this._offset;
1450
+ this._cache._regexp_string = this._cache._regexp_string || {};
1451
+ var cached = this._cache._regexp_string[index0];
1452
+ if (cached) {
1453
+ this._offset = cached[1];
1454
+ return cached[0];
1455
+ }
1456
+ var index1 = this._offset, elements0 = new Array(2);
1457
+ var address1 = FAILURE;
1458
+ address1 = this._read_slash();
1459
+ if (address1 !== FAILURE) {
1460
+ var address2 = FAILURE;
1461
+ var remaining0 = 0, index2 = this._offset, elements1 = [], address3 = true;
1462
+ while (address3 !== FAILURE) {
1463
+ var index3 = this._offset;
1464
+ var index4 = this._offset, elements2 = new Array(2);
1465
+ var address4 = FAILURE;
1466
+ var chunk0 = null;
1467
+ if (this._offset < this._inputSize) {
1468
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
1469
+ }
1470
+ if (chunk0 === '\\') {
1471
+ address4 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
1472
+ this._offset = this._offset + 1;
1473
+ } else {
1474
+ address4 = FAILURE;
1475
+ if (this._offset > this._failure) {
1476
+ this._failure = this._offset;
1477
+ this._expected = [];
1478
+ }
1479
+ if (this._offset === this._failure) {
1480
+ this._expected.push('"\\\\"');
1481
+ }
1482
+ }
1483
+ if (address4 !== FAILURE) {
1484
+ elements2[0] = address4;
1485
+ var address5 = FAILURE;
1486
+ if (this._offset < this._inputSize) {
1487
+ address5 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
1488
+ this._offset = this._offset + 1;
1489
+ } else {
1490
+ address5 = FAILURE;
1491
+ if (this._offset > this._failure) {
1492
+ this._failure = this._offset;
1493
+ this._expected = [];
1494
+ }
1495
+ if (this._offset === this._failure) {
1496
+ this._expected.push('<any char>');
1497
+ }
1498
+ }
1499
+ if (address5 !== FAILURE) {
1500
+ elements2[1] = address5;
1501
+ } else {
1502
+ elements2 = null;
1503
+ this._offset = index4;
1504
+ }
1505
+ } else {
1506
+ elements2 = null;
1507
+ this._offset = index4;
1508
+ }
1509
+ if (elements2 === null) {
1510
+ address3 = FAILURE;
1511
+ } else {
1512
+ address3 = new TreeNode(this._input.substring(index4, this._offset), index4, elements2);
1513
+ this._offset = this._offset;
1514
+ }
1515
+ if (address3 === FAILURE) {
1516
+ this._offset = index3;
1517
+ var chunk1 = null;
1518
+ if (this._offset < this._inputSize) {
1519
+ chunk1 = this._input.substring(this._offset, this._offset + 1);
1520
+ }
1521
+ if (chunk1 !== null && /^[^\/]/.test(chunk1)) {
1522
+ address3 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
1523
+ this._offset = this._offset + 1;
1524
+ } else {
1525
+ address3 = FAILURE;
1526
+ if (this._offset > this._failure) {
1527
+ this._failure = this._offset;
1528
+ this._expected = [];
1529
+ }
1530
+ if (this._offset === this._failure) {
1531
+ this._expected.push('[^\\/]');
1532
+ }
1533
+ }
1534
+ if (address3 === FAILURE) {
1535
+ this._offset = index3;
1536
+ }
1537
+ }
1538
+ if (address3 !== FAILURE) {
1539
+ elements1.push(address3);
1540
+ --remaining0;
1541
+ }
1542
+ }
1543
+ if (remaining0 <= 0) {
1544
+ address2 = new TreeNode(this._input.substring(index2, this._offset), index2, elements1);
1545
+ this._offset = this._offset;
1546
+ } else {
1547
+ address2 = FAILURE;
1548
+ }
1549
+ if (address2 !== FAILURE) {
1550
+ elements0[0] = address2;
1551
+ var address6 = FAILURE;
1552
+ address6 = this._read_slash();
1553
+ if (address6 !== FAILURE) {
1554
+ var address7 = FAILURE;
1555
+ var index5 = this._offset;
1556
+ address7 = this._read_regexp_options();
1557
+ if (address7 === FAILURE) {
1558
+ address7 = new TreeNode(this._input.substring(index5, index5), index5);
1559
+ this._offset = index5;
1560
+ }
1561
+ if (address7 !== FAILURE) {
1562
+ elements0[1] = address7;
1563
+ } else {
1564
+ elements0 = null;
1565
+ this._offset = index1;
1566
+ }
1567
+ } else {
1568
+ elements0 = null;
1569
+ this._offset = index1;
1570
+ }
1571
+ } else {
1572
+ elements0 = null;
1573
+ this._offset = index1;
1574
+ }
1575
+ } else {
1576
+ elements0 = null;
1577
+ this._offset = index1;
1578
+ }
1579
+ if (elements0 === null) {
1580
+ address0 = FAILURE;
1581
+ } else {
1582
+ address0 = this._actions.make_regexp(this._input, index1, this._offset, elements0);
1583
+ this._offset = this._offset;
1584
+ }
1585
+ this._cache._regexp_string[index0] = [address0, this._offset];
1586
+ return address0;
1587
+ },
1588
+
1589
+ _read_regexp_options: function() {
1590
+ var address0 = FAILURE, index0 = this._offset;
1591
+ this._cache._regexp_options = this._cache._regexp_options || {};
1592
+ var cached = this._cache._regexp_options[index0];
1593
+ if (cached) {
1594
+ this._offset = cached[1];
1595
+ return cached[0];
1596
+ }
1597
+ var remaining0 = 1, index1 = this._offset, elements0 = [], address1 = true;
1598
+ while (address1 !== FAILURE) {
1599
+ var chunk0 = null;
1600
+ if (this._offset < this._inputSize) {
1601
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
1602
+ }
1603
+ if (chunk0 !== null && /^[gims]/.test(chunk0)) {
1604
+ address1 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
1605
+ this._offset = this._offset + 1;
1606
+ } else {
1607
+ address1 = FAILURE;
1608
+ if (this._offset > this._failure) {
1609
+ this._failure = this._offset;
1610
+ this._expected = [];
1611
+ }
1612
+ if (this._offset === this._failure) {
1613
+ this._expected.push('[gims]');
1614
+ }
1615
+ }
1616
+ if (address1 !== FAILURE) {
1617
+ elements0.push(address1);
1618
+ --remaining0;
1619
+ }
1620
+ }
1621
+ if (remaining0 <= 0) {
1622
+ address0 = new TreeNode(this._input.substring(index1, this._offset), index1, elements0);
1623
+ this._offset = this._offset;
1624
+ } else {
1625
+ address0 = FAILURE;
1626
+ }
1627
+ this._cache._regexp_options[index0] = [address0, this._offset];
1628
+ return address0;
1629
+ },
1630
+
1631
+ _read_base64_string: function() {
1632
+ var address0 = FAILURE, index0 = this._offset;
1633
+ this._cache._base64_string = this._cache._base64_string || {};
1634
+ var cached = this._cache._base64_string[index0];
1635
+ if (cached) {
1636
+ this._offset = cached[1];
1637
+ return cached[0];
1638
+ }
1639
+ var index1 = this._offset;
1640
+ address0 = this._read_base64_single_quote();
1641
+ if (address0 === FAILURE) {
1642
+ this._offset = index1;
1643
+ address0 = this._read_base64_dobule_quote();
1644
+ if (address0 === FAILURE) {
1645
+ this._offset = index1;
1646
+ }
1647
+ }
1648
+ this._cache._base64_string[index0] = [address0, this._offset];
1649
+ return address0;
1650
+ },
1651
+
1652
+ _read_base64_value: function() {
1653
+ var address0 = FAILURE, index0 = this._offset;
1654
+ this._cache._base64_value = this._cache._base64_value || {};
1655
+ var cached = this._cache._base64_value[index0];
1656
+ if (cached) {
1657
+ this._offset = cached[1];
1658
+ return cached[0];
1659
+ }
1660
+ var index1 = this._offset, elements0 = new Array(2);
1661
+ var address1 = FAILURE;
1662
+ var remaining0 = 1, index2 = this._offset, elements1 = [], address2 = true;
1663
+ while (address2 !== FAILURE) {
1664
+ var chunk0 = null;
1665
+ if (this._offset < this._inputSize) {
1666
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
1667
+ }
1668
+ if (chunk0 !== null && /^[a-zA-Z0-9+\/]/.test(chunk0)) {
1669
+ address2 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
1670
+ this._offset = this._offset + 1;
1671
+ } else {
1672
+ address2 = FAILURE;
1673
+ if (this._offset > this._failure) {
1674
+ this._failure = this._offset;
1675
+ this._expected = [];
1676
+ }
1677
+ if (this._offset === this._failure) {
1678
+ this._expected.push('[a-zA-Z0-9+\\/]');
1679
+ }
1680
+ }
1681
+ if (address2 !== FAILURE) {
1682
+ elements1.push(address2);
1683
+ --remaining0;
1684
+ }
1685
+ }
1686
+ if (remaining0 <= 0) {
1687
+ address1 = new TreeNode(this._input.substring(index2, this._offset), index2, elements1);
1688
+ this._offset = this._offset;
1689
+ } else {
1690
+ address1 = FAILURE;
1691
+ }
1692
+ if (address1 !== FAILURE) {
1693
+ elements0[0] = address1;
1694
+ var address3 = FAILURE;
1695
+ var index3 = this._offset;
1696
+ var index4 = this._offset;
1697
+ var chunk1 = null;
1698
+ if (this._offset < this._inputSize) {
1699
+ chunk1 = this._input.substring(this._offset, this._offset + 1);
1700
+ }
1701
+ if (chunk1 === '=') {
1702
+ address3 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
1703
+ this._offset = this._offset + 1;
1704
+ } else {
1705
+ address3 = FAILURE;
1706
+ if (this._offset > this._failure) {
1707
+ this._failure = this._offset;
1708
+ this._expected = [];
1709
+ }
1710
+ if (this._offset === this._failure) {
1711
+ this._expected.push('"="');
1712
+ }
1713
+ }
1714
+ if (address3 === FAILURE) {
1715
+ this._offset = index4;
1716
+ var chunk2 = null;
1717
+ if (this._offset < this._inputSize) {
1718
+ chunk2 = this._input.substring(this._offset, this._offset + 2);
1719
+ }
1720
+ if (chunk2 === '==') {
1721
+ address3 = new TreeNode(this._input.substring(this._offset, this._offset + 2), this._offset);
1722
+ this._offset = this._offset + 2;
1723
+ } else {
1724
+ address3 = FAILURE;
1725
+ if (this._offset > this._failure) {
1726
+ this._failure = this._offset;
1727
+ this._expected = [];
1728
+ }
1729
+ if (this._offset === this._failure) {
1730
+ this._expected.push('"=="');
1731
+ }
1732
+ }
1733
+ if (address3 === FAILURE) {
1734
+ this._offset = index4;
1735
+ }
1736
+ }
1737
+ if (address3 === FAILURE) {
1738
+ address3 = new TreeNode(this._input.substring(index3, index3), index3);
1739
+ this._offset = index3;
1740
+ }
1741
+ if (address3 !== FAILURE) {
1742
+ elements0[1] = address3;
1743
+ } else {
1744
+ elements0 = null;
1745
+ this._offset = index1;
1746
+ }
1747
+ } else {
1748
+ elements0 = null;
1749
+ this._offset = index1;
1750
+ }
1751
+ if (elements0 === null) {
1752
+ address0 = FAILURE;
1753
+ } else {
1754
+ address0 = new TreeNode(this._input.substring(index1, this._offset), index1, elements0);
1755
+ this._offset = this._offset;
1756
+ }
1757
+ this._cache._base64_value[index0] = [address0, this._offset];
1758
+ return address0;
1759
+ },
1760
+
1761
+ _read_base64_single_quote: function() {
1762
+ var address0 = FAILURE, index0 = this._offset;
1763
+ this._cache._base64_single_quote = this._cache._base64_single_quote || {};
1764
+ var cached = this._cache._base64_single_quote[index0];
1765
+ if (cached) {
1766
+ this._offset = cached[1];
1767
+ return cached[0];
1768
+ }
1769
+ var index1 = this._offset, elements0 = new Array(1);
1770
+ var address1 = FAILURE;
1771
+ address1 = this._read_single_quote();
1772
+ if (address1 !== FAILURE) {
1773
+ var address2 = FAILURE;
1774
+ address2 = this._read_base64_value();
1775
+ if (address2 !== FAILURE) {
1776
+ elements0[0] = address2;
1777
+ var address3 = FAILURE;
1778
+ address3 = this._read_single_quote();
1779
+ if (address3 !== FAILURE) {
1780
+ } else {
1781
+ elements0 = null;
1782
+ this._offset = index1;
1783
+ }
1784
+ } else {
1785
+ elements0 = null;
1786
+ this._offset = index1;
1787
+ }
1788
+ } else {
1789
+ elements0 = null;
1790
+ this._offset = index1;
1791
+ }
1792
+ if (elements0 === null) {
1793
+ address0 = FAILURE;
1794
+ } else {
1795
+ address0 = this._actions.make_string(this._input, index1, this._offset, elements0);
1796
+ this._offset = this._offset;
1797
+ }
1798
+ this._cache._base64_single_quote[index0] = [address0, this._offset];
1799
+ return address0;
1800
+ },
1801
+
1802
+ _read_base64_dobule_quote: function() {
1803
+ var address0 = FAILURE, index0 = this._offset;
1804
+ this._cache._base64_dobule_quote = this._cache._base64_dobule_quote || {};
1805
+ var cached = this._cache._base64_dobule_quote[index0];
1806
+ if (cached) {
1807
+ this._offset = cached[1];
1808
+ return cached[0];
1809
+ }
1810
+ var index1 = this._offset, elements0 = new Array(1);
1811
+ var address1 = FAILURE;
1812
+ address1 = this._read_double_quote();
1813
+ if (address1 !== FAILURE) {
1814
+ var address2 = FAILURE;
1815
+ address2 = this._read_base64_value();
1816
+ if (address2 !== FAILURE) {
1817
+ elements0[0] = address2;
1818
+ var address3 = FAILURE;
1819
+ address3 = this._read_double_quote();
1820
+ if (address3 !== FAILURE) {
1821
+ } else {
1822
+ elements0 = null;
1823
+ this._offset = index1;
1824
+ }
1825
+ } else {
1826
+ elements0 = null;
1827
+ this._offset = index1;
1828
+ }
1829
+ } else {
1830
+ elements0 = null;
1831
+ this._offset = index1;
1832
+ }
1833
+ if (elements0 === null) {
1834
+ address0 = FAILURE;
1835
+ } else {
1836
+ address0 = this._actions.make_string(this._input, index1, this._offset, elements0);
1837
+ this._offset = this._offset;
1838
+ }
1839
+ this._cache._base64_dobule_quote[index0] = [address0, this._offset];
1840
+ return address0;
1841
+ },
1842
+
1843
+ _read_number: function() {
1844
+ var address0 = FAILURE, index0 = this._offset;
1845
+ this._cache._number = this._cache._number || {};
1846
+ var cached = this._cache._number[index0];
1847
+ if (cached) {
1848
+ this._offset = cached[1];
1849
+ return cached[0];
1850
+ }
1851
+ var index1 = this._offset, elements0 = new Array(4);
1852
+ var address1 = FAILURE;
1853
+ var index2 = this._offset;
1854
+ var chunk0 = null;
1855
+ if (this._offset < this._inputSize) {
1856
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
1857
+ }
1858
+ if (chunk0 === '-') {
1859
+ address1 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
1860
+ this._offset = this._offset + 1;
1861
+ } else {
1862
+ address1 = FAILURE;
1863
+ if (this._offset > this._failure) {
1864
+ this._failure = this._offset;
1865
+ this._expected = [];
1866
+ }
1867
+ if (this._offset === this._failure) {
1868
+ this._expected.push('"-"');
1869
+ }
1870
+ }
1871
+ if (address1 === FAILURE) {
1872
+ address1 = new TreeNode(this._input.substring(index2, index2), index2);
1873
+ this._offset = index2;
1874
+ }
1875
+ if (address1 !== FAILURE) {
1876
+ elements0[0] = address1;
1877
+ var address2 = FAILURE;
1878
+ address2 = this._read_integer();
1879
+ if (address2 !== FAILURE) {
1880
+ elements0[1] = address2;
1881
+ var address3 = FAILURE;
1882
+ var index3 = this._offset;
1883
+ address3 = this._read_fraction();
1884
+ if (address3 === FAILURE) {
1885
+ address3 = new TreeNode(this._input.substring(index3, index3), index3);
1886
+ this._offset = index3;
1887
+ }
1888
+ if (address3 !== FAILURE) {
1889
+ elements0[2] = address3;
1890
+ var address4 = FAILURE;
1891
+ var index4 = this._offset;
1892
+ address4 = this._read_exponent();
1893
+ if (address4 === FAILURE) {
1894
+ address4 = new TreeNode(this._input.substring(index4, index4), index4);
1895
+ this._offset = index4;
1896
+ }
1897
+ if (address4 !== FAILURE) {
1898
+ elements0[3] = address4;
1899
+ } else {
1900
+ elements0 = null;
1901
+ this._offset = index1;
1902
+ }
1903
+ } else {
1904
+ elements0 = null;
1905
+ this._offset = index1;
1906
+ }
1907
+ } else {
1908
+ elements0 = null;
1909
+ this._offset = index1;
1910
+ }
1911
+ } else {
1912
+ elements0 = null;
1913
+ this._offset = index1;
1914
+ }
1915
+ if (elements0 === null) {
1916
+ address0 = FAILURE;
1917
+ } else {
1918
+ address0 = this._actions.make_number(this._input, index1, this._offset, elements0);
1919
+ this._offset = this._offset;
1920
+ }
1921
+ this._cache._number[index0] = [address0, this._offset];
1922
+ return address0;
1923
+ },
1924
+
1925
+ _read_number_as_string: function() {
1926
+ var address0 = FAILURE, index0 = this._offset;
1927
+ this._cache._number_as_string = this._cache._number_as_string || {};
1928
+ var cached = this._cache._number_as_string[index0];
1929
+ if (cached) {
1930
+ this._offset = cached[1];
1931
+ return cached[0];
1932
+ }
1933
+ var index1 = this._offset, elements0 = new Array(4);
1934
+ var address1 = FAILURE;
1935
+ var index2 = this._offset;
1936
+ var chunk0 = null;
1937
+ if (this._offset < this._inputSize) {
1938
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
1939
+ }
1940
+ if (chunk0 === '-') {
1941
+ address1 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
1942
+ this._offset = this._offset + 1;
1943
+ } else {
1944
+ address1 = FAILURE;
1945
+ if (this._offset > this._failure) {
1946
+ this._failure = this._offset;
1947
+ this._expected = [];
1948
+ }
1949
+ if (this._offset === this._failure) {
1950
+ this._expected.push('"-"');
1951
+ }
1952
+ }
1953
+ if (address1 === FAILURE) {
1954
+ address1 = new TreeNode(this._input.substring(index2, index2), index2);
1955
+ this._offset = index2;
1956
+ }
1957
+ if (address1 !== FAILURE) {
1958
+ elements0[0] = address1;
1959
+ var address2 = FAILURE;
1960
+ address2 = this._read_integer();
1961
+ if (address2 !== FAILURE) {
1962
+ elements0[1] = address2;
1963
+ var address3 = FAILURE;
1964
+ var index3 = this._offset;
1965
+ address3 = this._read_fraction();
1966
+ if (address3 === FAILURE) {
1967
+ address3 = new TreeNode(this._input.substring(index3, index3), index3);
1968
+ this._offset = index3;
1969
+ }
1970
+ if (address3 !== FAILURE) {
1971
+ elements0[2] = address3;
1972
+ var address4 = FAILURE;
1973
+ var index4 = this._offset;
1974
+ address4 = this._read_exponent();
1975
+ if (address4 === FAILURE) {
1976
+ address4 = new TreeNode(this._input.substring(index4, index4), index4);
1977
+ this._offset = index4;
1978
+ }
1979
+ if (address4 !== FAILURE) {
1980
+ elements0[3] = address4;
1981
+ } else {
1982
+ elements0 = null;
1983
+ this._offset = index1;
1984
+ }
1985
+ } else {
1986
+ elements0 = null;
1987
+ this._offset = index1;
1988
+ }
1989
+ } else {
1990
+ elements0 = null;
1991
+ this._offset = index1;
1992
+ }
1993
+ } else {
1994
+ elements0 = null;
1995
+ this._offset = index1;
1996
+ }
1997
+ if (elements0 === null) {
1998
+ address0 = FAILURE;
1999
+ } else {
2000
+ address0 = this._actions.make_number_as_string(this._input, index1, this._offset, elements0);
2001
+ this._offset = this._offset;
2002
+ }
2003
+ this._cache._number_as_string[index0] = [address0, this._offset];
2004
+ return address0;
2005
+ },
2006
+
2007
+ _read_integer: function() {
2008
+ var address0 = FAILURE, index0 = this._offset;
2009
+ this._cache._integer = this._cache._integer || {};
2010
+ var cached = this._cache._integer[index0];
2011
+ if (cached) {
2012
+ this._offset = cached[1];
2013
+ return cached[0];
2014
+ }
2015
+ var index1 = this._offset;
2016
+ var chunk0 = null;
2017
+ if (this._offset < this._inputSize) {
2018
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
2019
+ }
2020
+ if (chunk0 === '0') {
2021
+ address0 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
2022
+ this._offset = this._offset + 1;
2023
+ } else {
2024
+ address0 = FAILURE;
2025
+ if (this._offset > this._failure) {
2026
+ this._failure = this._offset;
2027
+ this._expected = [];
2028
+ }
2029
+ if (this._offset === this._failure) {
2030
+ this._expected.push('"0"');
2031
+ }
2032
+ }
2033
+ if (address0 === FAILURE) {
2034
+ this._offset = index1;
2035
+ var index2 = this._offset, elements0 = new Array(2);
2036
+ var address1 = FAILURE;
2037
+ var chunk1 = null;
2038
+ if (this._offset < this._inputSize) {
2039
+ chunk1 = this._input.substring(this._offset, this._offset + 1);
2040
+ }
2041
+ if (chunk1 !== null && /^[1-9]/.test(chunk1)) {
2042
+ address1 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
2043
+ this._offset = this._offset + 1;
2044
+ } else {
2045
+ address1 = FAILURE;
2046
+ if (this._offset > this._failure) {
2047
+ this._failure = this._offset;
2048
+ this._expected = [];
2049
+ }
2050
+ if (this._offset === this._failure) {
2051
+ this._expected.push('[1-9]');
2052
+ }
2053
+ }
2054
+ if (address1 !== FAILURE) {
2055
+ elements0[0] = address1;
2056
+ var address2 = FAILURE;
2057
+ var remaining0 = 0, index3 = this._offset, elements1 = [], address3 = true;
2058
+ while (address3 !== FAILURE) {
2059
+ var chunk2 = null;
2060
+ if (this._offset < this._inputSize) {
2061
+ chunk2 = this._input.substring(this._offset, this._offset + 1);
2062
+ }
2063
+ if (chunk2 !== null && /^[0-9]/.test(chunk2)) {
2064
+ address3 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
2065
+ this._offset = this._offset + 1;
2066
+ } else {
2067
+ address3 = FAILURE;
2068
+ if (this._offset > this._failure) {
2069
+ this._failure = this._offset;
2070
+ this._expected = [];
2071
+ }
2072
+ if (this._offset === this._failure) {
2073
+ this._expected.push('[0-9]');
2074
+ }
2075
+ }
2076
+ if (address3 !== FAILURE) {
2077
+ elements1.push(address3);
2078
+ --remaining0;
2079
+ }
2080
+ }
2081
+ if (remaining0 <= 0) {
2082
+ address2 = new TreeNode(this._input.substring(index3, this._offset), index3, elements1);
2083
+ this._offset = this._offset;
2084
+ } else {
2085
+ address2 = FAILURE;
2086
+ }
2087
+ if (address2 !== FAILURE) {
2088
+ elements0[1] = address2;
2089
+ } else {
2090
+ elements0 = null;
2091
+ this._offset = index2;
2092
+ }
2093
+ } else {
2094
+ elements0 = null;
2095
+ this._offset = index2;
2096
+ }
2097
+ if (elements0 === null) {
2098
+ address0 = FAILURE;
2099
+ } else {
2100
+ address0 = new TreeNode(this._input.substring(index2, this._offset), index2, elements0);
2101
+ this._offset = this._offset;
2102
+ }
2103
+ if (address0 === FAILURE) {
2104
+ this._offset = index1;
2105
+ }
2106
+ }
2107
+ this._cache._integer[index0] = [address0, this._offset];
2108
+ return address0;
2109
+ },
2110
+
2111
+ _read_fraction: function() {
2112
+ var address0 = FAILURE, index0 = this._offset;
2113
+ this._cache._fraction = this._cache._fraction || {};
2114
+ var cached = this._cache._fraction[index0];
2115
+ if (cached) {
2116
+ this._offset = cached[1];
2117
+ return cached[0];
2118
+ }
2119
+ var index1 = this._offset, elements0 = new Array(2);
2120
+ var address1 = FAILURE;
2121
+ var chunk0 = null;
2122
+ if (this._offset < this._inputSize) {
2123
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
2124
+ }
2125
+ if (chunk0 === '.') {
2126
+ address1 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
2127
+ this._offset = this._offset + 1;
2128
+ } else {
2129
+ address1 = FAILURE;
2130
+ if (this._offset > this._failure) {
2131
+ this._failure = this._offset;
2132
+ this._expected = [];
2133
+ }
2134
+ if (this._offset === this._failure) {
2135
+ this._expected.push('"."');
2136
+ }
2137
+ }
2138
+ if (address1 !== FAILURE) {
2139
+ elements0[0] = address1;
2140
+ var address2 = FAILURE;
2141
+ var remaining0 = 1, index2 = this._offset, elements1 = [], address3 = true;
2142
+ while (address3 !== FAILURE) {
2143
+ var chunk1 = null;
2144
+ if (this._offset < this._inputSize) {
2145
+ chunk1 = this._input.substring(this._offset, this._offset + 1);
2146
+ }
2147
+ if (chunk1 !== null && /^[0-9]/.test(chunk1)) {
2148
+ address3 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
2149
+ this._offset = this._offset + 1;
2150
+ } else {
2151
+ address3 = FAILURE;
2152
+ if (this._offset > this._failure) {
2153
+ this._failure = this._offset;
2154
+ this._expected = [];
2155
+ }
2156
+ if (this._offset === this._failure) {
2157
+ this._expected.push('[0-9]');
2158
+ }
2159
+ }
2160
+ if (address3 !== FAILURE) {
2161
+ elements1.push(address3);
2162
+ --remaining0;
2163
+ }
2164
+ }
2165
+ if (remaining0 <= 0) {
2166
+ address2 = new TreeNode(this._input.substring(index2, this._offset), index2, elements1);
2167
+ this._offset = this._offset;
2168
+ } else {
2169
+ address2 = FAILURE;
2170
+ }
2171
+ if (address2 !== FAILURE) {
2172
+ elements0[1] = address2;
2173
+ } else {
2174
+ elements0 = null;
2175
+ this._offset = index1;
2176
+ }
2177
+ } else {
2178
+ elements0 = null;
2179
+ this._offset = index1;
2180
+ }
2181
+ if (elements0 === null) {
2182
+ address0 = FAILURE;
2183
+ } else {
2184
+ address0 = new TreeNode(this._input.substring(index1, this._offset), index1, elements0);
2185
+ this._offset = this._offset;
2186
+ }
2187
+ this._cache._fraction[index0] = [address0, this._offset];
2188
+ return address0;
2189
+ },
2190
+
2191
+ _read_exponent: function() {
2192
+ var address0 = FAILURE, index0 = this._offset;
2193
+ this._cache._exponent = this._cache._exponent || {};
2194
+ var cached = this._cache._exponent[index0];
2195
+ if (cached) {
2196
+ this._offset = cached[1];
2197
+ return cached[0];
2198
+ }
2199
+ var index1 = this._offset, elements0 = new Array(3);
2200
+ var address1 = FAILURE;
2201
+ var index2 = this._offset;
2202
+ var chunk0 = null;
2203
+ if (this._offset < this._inputSize) {
2204
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
2205
+ }
2206
+ if (chunk0 === 'e') {
2207
+ address1 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
2208
+ this._offset = this._offset + 1;
2209
+ } else {
2210
+ address1 = FAILURE;
2211
+ if (this._offset > this._failure) {
2212
+ this._failure = this._offset;
2213
+ this._expected = [];
2214
+ }
2215
+ if (this._offset === this._failure) {
2216
+ this._expected.push('"e"');
2217
+ }
2218
+ }
2219
+ if (address1 === FAILURE) {
2220
+ this._offset = index2;
2221
+ var chunk1 = null;
2222
+ if (this._offset < this._inputSize) {
2223
+ chunk1 = this._input.substring(this._offset, this._offset + 1);
2224
+ }
2225
+ if (chunk1 === 'E') {
2226
+ address1 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
2227
+ this._offset = this._offset + 1;
2228
+ } else {
2229
+ address1 = FAILURE;
2230
+ if (this._offset > this._failure) {
2231
+ this._failure = this._offset;
2232
+ this._expected = [];
2233
+ }
2234
+ if (this._offset === this._failure) {
2235
+ this._expected.push('"E"');
2236
+ }
2237
+ }
2238
+ if (address1 === FAILURE) {
2239
+ this._offset = index2;
2240
+ }
2241
+ }
2242
+ if (address1 !== FAILURE) {
2243
+ elements0[0] = address1;
2244
+ var address2 = FAILURE;
2245
+ var index3 = this._offset;
2246
+ var chunk2 = null;
2247
+ if (this._offset < this._inputSize) {
2248
+ chunk2 = this._input.substring(this._offset, this._offset + 1);
2249
+ }
2250
+ if (chunk2 === '+') {
2251
+ address2 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
2252
+ this._offset = this._offset + 1;
2253
+ } else {
2254
+ address2 = FAILURE;
2255
+ if (this._offset > this._failure) {
2256
+ this._failure = this._offset;
2257
+ this._expected = [];
2258
+ }
2259
+ if (this._offset === this._failure) {
2260
+ this._expected.push('"+"');
2261
+ }
2262
+ }
2263
+ if (address2 === FAILURE) {
2264
+ this._offset = index3;
2265
+ var chunk3 = null;
2266
+ if (this._offset < this._inputSize) {
2267
+ chunk3 = this._input.substring(this._offset, this._offset + 1);
2268
+ }
2269
+ if (chunk3 === '-') {
2270
+ address2 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
2271
+ this._offset = this._offset + 1;
2272
+ } else {
2273
+ address2 = FAILURE;
2274
+ if (this._offset > this._failure) {
2275
+ this._failure = this._offset;
2276
+ this._expected = [];
2277
+ }
2278
+ if (this._offset === this._failure) {
2279
+ this._expected.push('"-"');
2280
+ }
2281
+ }
2282
+ if (address2 === FAILURE) {
2283
+ this._offset = index3;
2284
+ var chunk4 = null;
2285
+ if (this._offset < this._inputSize) {
2286
+ chunk4 = this._input.substring(this._offset, this._offset + 0);
2287
+ }
2288
+ if (chunk4 === '') {
2289
+ address2 = new TreeNode(this._input.substring(this._offset, this._offset + 0), this._offset);
2290
+ this._offset = this._offset + 0;
2291
+ } else {
2292
+ address2 = FAILURE;
2293
+ if (this._offset > this._failure) {
2294
+ this._failure = this._offset;
2295
+ this._expected = [];
2296
+ }
2297
+ if (this._offset === this._failure) {
2298
+ this._expected.push('""');
2299
+ }
2300
+ }
2301
+ if (address2 === FAILURE) {
2302
+ this._offset = index3;
2303
+ }
2304
+ }
2305
+ }
2306
+ if (address2 !== FAILURE) {
2307
+ elements0[1] = address2;
2308
+ var address3 = FAILURE;
2309
+ var remaining0 = 1, index4 = this._offset, elements1 = [], address4 = true;
2310
+ while (address4 !== FAILURE) {
2311
+ var chunk5 = null;
2312
+ if (this._offset < this._inputSize) {
2313
+ chunk5 = this._input.substring(this._offset, this._offset + 1);
2314
+ }
2315
+ if (chunk5 !== null && /^[0-9]/.test(chunk5)) {
2316
+ address4 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
2317
+ this._offset = this._offset + 1;
2318
+ } else {
2319
+ address4 = FAILURE;
2320
+ if (this._offset > this._failure) {
2321
+ this._failure = this._offset;
2322
+ this._expected = [];
2323
+ }
2324
+ if (this._offset === this._failure) {
2325
+ this._expected.push('[0-9]');
2326
+ }
2327
+ }
2328
+ if (address4 !== FAILURE) {
2329
+ elements1.push(address4);
2330
+ --remaining0;
2331
+ }
2332
+ }
2333
+ if (remaining0 <= 0) {
2334
+ address3 = new TreeNode(this._input.substring(index4, this._offset), index4, elements1);
2335
+ this._offset = this._offset;
2336
+ } else {
2337
+ address3 = FAILURE;
2338
+ }
2339
+ if (address3 !== FAILURE) {
2340
+ elements0[2] = address3;
2341
+ } else {
2342
+ elements0 = null;
2343
+ this._offset = index1;
2344
+ }
2345
+ } else {
2346
+ elements0 = null;
2347
+ this._offset = index1;
2348
+ }
2349
+ } else {
2350
+ elements0 = null;
2351
+ this._offset = index1;
2352
+ }
2353
+ if (elements0 === null) {
2354
+ address0 = FAILURE;
2355
+ } else {
2356
+ address0 = new TreeNode(this._input.substring(index1, this._offset), index1, elements0);
2357
+ this._offset = this._offset;
2358
+ }
2359
+ this._cache._exponent[index0] = [address0, this._offset];
2360
+ return address0;
2361
+ },
2362
+
2363
+ _read_integer_number: function() {
2364
+ var address0 = FAILURE, index0 = this._offset;
2365
+ this._cache._integer_number = this._cache._integer_number || {};
2366
+ var cached = this._cache._integer_number[index0];
2367
+ if (cached) {
2368
+ this._offset = cached[1];
2369
+ return cached[0];
2370
+ }
2371
+ var index1 = this._offset, elements0 = new Array(1);
2372
+ var address1 = FAILURE;
2373
+ address1 = this._read_integer();
2374
+ if (address1 !== FAILURE) {
2375
+ elements0[0] = address1;
2376
+ var address2 = FAILURE;
2377
+ var chunk0 = null;
2378
+ if (this._offset < this._inputSize) {
2379
+ chunk0 = this._input.substring(this._offset, this._offset + 0);
2380
+ }
2381
+ if (chunk0 === '') {
2382
+ address2 = new TreeNode(this._input.substring(this._offset, this._offset + 0), this._offset);
2383
+ this._offset = this._offset + 0;
2384
+ } else {
2385
+ address2 = FAILURE;
2386
+ if (this._offset > this._failure) {
2387
+ this._failure = this._offset;
2388
+ this._expected = [];
2389
+ }
2390
+ if (this._offset === this._failure) {
2391
+ this._expected.push('""');
2392
+ }
2393
+ }
2394
+ if (address2 !== FAILURE) {
2395
+ } else {
2396
+ elements0 = null;
2397
+ this._offset = index1;
2398
+ }
2399
+ } else {
2400
+ elements0 = null;
2401
+ this._offset = index1;
2402
+ }
2403
+ if (elements0 === null) {
2404
+ address0 = FAILURE;
2405
+ } else {
2406
+ address0 = this._actions.make_number(this._input, index1, this._offset, elements0);
2407
+ this._offset = this._offset;
2408
+ }
2409
+ this._cache._integer_number[index0] = [address0, this._offset];
2410
+ return address0;
2411
+ },
2412
+
2413
+ _read_min_key: function() {
2414
+ var address0 = FAILURE, index0 = this._offset;
2415
+ this._cache._min_key = this._cache._min_key || {};
2416
+ var cached = this._cache._min_key[index0];
2417
+ if (cached) {
2418
+ this._offset = cached[1];
2419
+ return cached[0];
2420
+ }
2421
+ var chunk0 = null;
2422
+ if (this._offset < this._inputSize) {
2423
+ chunk0 = this._input.substring(this._offset, this._offset + 6);
2424
+ }
2425
+ if (chunk0 === 'MinKey') {
2426
+ address0 = this._actions.make_min_key(this._input, this._offset, this._offset + 6);
2427
+ this._offset = this._offset + 6;
2428
+ } else {
2429
+ address0 = FAILURE;
2430
+ if (this._offset > this._failure) {
2431
+ this._failure = this._offset;
2432
+ this._expected = [];
2433
+ }
2434
+ if (this._offset === this._failure) {
2435
+ this._expected.push('"MinKey"');
2436
+ }
2437
+ }
2438
+ this._cache._min_key[index0] = [address0, this._offset];
2439
+ return address0;
2440
+ },
2441
+
2442
+ _read_max_key: function() {
2443
+ var address0 = FAILURE, index0 = this._offset;
2444
+ this._cache._max_key = this._cache._max_key || {};
2445
+ var cached = this._cache._max_key[index0];
2446
+ if (cached) {
2447
+ this._offset = cached[1];
2448
+ return cached[0];
2449
+ }
2450
+ var chunk0 = null;
2451
+ if (this._offset < this._inputSize) {
2452
+ chunk0 = this._input.substring(this._offset, this._offset + 6);
2453
+ }
2454
+ if (chunk0 === 'MaxKey') {
2455
+ address0 = this._actions.make_max_key(this._input, this._offset, this._offset + 6);
2456
+ this._offset = this._offset + 6;
2457
+ } else {
2458
+ address0 = FAILURE;
2459
+ if (this._offset > this._failure) {
2460
+ this._failure = this._offset;
2461
+ this._expected = [];
2462
+ }
2463
+ if (this._offset === this._failure) {
2464
+ this._expected.push('"MaxKey"');
2465
+ }
2466
+ }
2467
+ this._cache._max_key[index0] = [address0, this._offset];
2468
+ return address0;
2469
+ },
2470
+
2471
+ _read_undefined: function() {
2472
+ var address0 = FAILURE, index0 = this._offset;
2473
+ this._cache._undefined = this._cache._undefined || {};
2474
+ var cached = this._cache._undefined[index0];
2475
+ if (cached) {
2476
+ this._offset = cached[1];
2477
+ return cached[0];
2478
+ }
2479
+ var chunk0 = null;
2480
+ if (this._offset < this._inputSize) {
2481
+ chunk0 = this._input.substring(this._offset, this._offset + 9);
2482
+ }
2483
+ if (chunk0 === 'undefined') {
2484
+ address0 = this._actions.make_undefined(this._input, this._offset, this._offset + 9);
2485
+ this._offset = this._offset + 9;
2486
+ } else {
2487
+ address0 = FAILURE;
2488
+ if (this._offset > this._failure) {
2489
+ this._failure = this._offset;
2490
+ this._expected = [];
2491
+ }
2492
+ if (this._offset === this._failure) {
2493
+ this._expected.push('"undefined"');
2494
+ }
2495
+ }
2496
+ this._cache._undefined[index0] = [address0, this._offset];
2497
+ return address0;
2498
+ },
2499
+
2500
+ _read_object_id: function() {
2501
+ var address0 = FAILURE, index0 = this._offset;
2502
+ this._cache._object_id = this._cache._object_id || {};
2503
+ var cached = this._cache._object_id[index0];
2504
+ if (cached) {
2505
+ this._offset = cached[1];
2506
+ return cached[0];
2507
+ }
2508
+ var index1 = this._offset, elements0 = new Array(1);
2509
+ var address1 = FAILURE;
2510
+ var chunk0 = null;
2511
+ if (this._offset < this._inputSize) {
2512
+ chunk0 = this._input.substring(this._offset, this._offset + 8);
2513
+ }
2514
+ if (chunk0 === 'ObjectId') {
2515
+ address1 = new TreeNode(this._input.substring(this._offset, this._offset + 8), this._offset);
2516
+ this._offset = this._offset + 8;
2517
+ } else {
2518
+ address1 = FAILURE;
2519
+ if (this._offset > this._failure) {
2520
+ this._failure = this._offset;
2521
+ this._expected = [];
2522
+ }
2523
+ if (this._offset === this._failure) {
2524
+ this._expected.push('"ObjectId"');
2525
+ }
2526
+ }
2527
+ if (address1 !== FAILURE) {
2528
+ var address2 = FAILURE;
2529
+ address2 = this._read_type_open();
2530
+ if (address2 !== FAILURE) {
2531
+ var address3 = FAILURE;
2532
+ address3 = this._read_hex_string();
2533
+ if (address3 !== FAILURE) {
2534
+ elements0[0] = address3;
2535
+ var address4 = FAILURE;
2536
+ address4 = this._read_type_close();
2537
+ if (address4 !== FAILURE) {
2538
+ } else {
2539
+ elements0 = null;
2540
+ this._offset = index1;
2541
+ }
2542
+ } else {
2543
+ elements0 = null;
2544
+ this._offset = index1;
2545
+ }
2546
+ } else {
2547
+ elements0 = null;
2548
+ this._offset = index1;
2549
+ }
2550
+ } else {
2551
+ elements0 = null;
2552
+ this._offset = index1;
2553
+ }
2554
+ if (elements0 === null) {
2555
+ address0 = FAILURE;
2556
+ } else {
2557
+ address0 = this._actions.make_object_id(this._input, index1, this._offset, elements0);
2558
+ this._offset = this._offset;
2559
+ }
2560
+ this._cache._object_id[index0] = [address0, this._offset];
2561
+ return address0;
2562
+ },
2563
+
2564
+ _read_bin_data_type: function() {
2565
+ var address0 = FAILURE, index0 = this._offset;
2566
+ this._cache._bin_data_type = this._cache._bin_data_type || {};
2567
+ var cached = this._cache._bin_data_type[index0];
2568
+ if (cached) {
2569
+ this._offset = cached[1];
2570
+ return cached[0];
2571
+ }
2572
+ var index1 = this._offset;
2573
+ address0 = this._read_string();
2574
+ if (address0 === FAILURE) {
2575
+ this._offset = index1;
2576
+ address0 = this._read_integer_number();
2577
+ if (address0 === FAILURE) {
2578
+ this._offset = index1;
2579
+ }
2580
+ }
2581
+ this._cache._bin_data_type[index0] = [address0, this._offset];
2582
+ return address0;
2583
+ },
2584
+
2585
+ _read_bin_data: function() {
2586
+ var address0 = FAILURE, index0 = this._offset;
2587
+ this._cache._bin_data = this._cache._bin_data || {};
2588
+ var cached = this._cache._bin_data[index0];
2589
+ if (cached) {
2590
+ this._offset = cached[1];
2591
+ return cached[0];
2592
+ }
2593
+ var index1 = this._offset, elements0 = new Array(2);
2594
+ var address1 = FAILURE;
2595
+ var chunk0 = null;
2596
+ if (this._offset < this._inputSize) {
2597
+ chunk0 = this._input.substring(this._offset, this._offset + 7);
2598
+ }
2599
+ if (chunk0 === 'BinData') {
2600
+ address1 = new TreeNode(this._input.substring(this._offset, this._offset + 7), this._offset);
2601
+ this._offset = this._offset + 7;
2602
+ } else {
2603
+ address1 = FAILURE;
2604
+ if (this._offset > this._failure) {
2605
+ this._failure = this._offset;
2606
+ this._expected = [];
2607
+ }
2608
+ if (this._offset === this._failure) {
2609
+ this._expected.push('"BinData"');
2610
+ }
2611
+ }
2612
+ if (address1 !== FAILURE) {
2613
+ var address2 = FAILURE;
2614
+ address2 = this._read_type_open();
2615
+ if (address2 !== FAILURE) {
2616
+ var address3 = FAILURE;
2617
+ address3 = this._read_bin_data_type();
2618
+ if (address3 !== FAILURE) {
2619
+ elements0[0] = address3;
2620
+ var address4 = FAILURE;
2621
+ address4 = this._read_delimiter();
2622
+ if (address4 !== FAILURE) {
2623
+ var address5 = FAILURE;
2624
+ address5 = this._read_base64_string();
2625
+ if (address5 !== FAILURE) {
2626
+ elements0[1] = address5;
2627
+ var address6 = FAILURE;
2628
+ address6 = this._read_type_close();
2629
+ if (address6 !== FAILURE) {
2630
+ } else {
2631
+ elements0 = null;
2632
+ this._offset = index1;
2633
+ }
2634
+ } else {
2635
+ elements0 = null;
2636
+ this._offset = index1;
2637
+ }
2638
+ } else {
2639
+ elements0 = null;
2640
+ this._offset = index1;
2641
+ }
2642
+ } else {
2643
+ elements0 = null;
2644
+ this._offset = index1;
2645
+ }
2646
+ } else {
2647
+ elements0 = null;
2648
+ this._offset = index1;
2649
+ }
2650
+ } else {
2651
+ elements0 = null;
2652
+ this._offset = index1;
2653
+ }
2654
+ if (elements0 === null) {
2655
+ address0 = FAILURE;
2656
+ } else {
2657
+ address0 = this._actions.make_bin_data(this._input, index1, this._offset, elements0);
2658
+ this._offset = this._offset;
2659
+ }
2660
+ this._cache._bin_data[index0] = [address0, this._offset];
2661
+ return address0;
2662
+ },
2663
+
2664
+ _read_timestamp: function() {
2665
+ var address0 = FAILURE, index0 = this._offset;
2666
+ this._cache._timestamp = this._cache._timestamp || {};
2667
+ var cached = this._cache._timestamp[index0];
2668
+ if (cached) {
2669
+ this._offset = cached[1];
2670
+ return cached[0];
2671
+ }
2672
+ var index1 = this._offset, elements0 = new Array(2);
2673
+ var address1 = FAILURE;
2674
+ var chunk0 = null;
2675
+ if (this._offset < this._inputSize) {
2676
+ chunk0 = this._input.substring(this._offset, this._offset + 9);
2677
+ }
2678
+ if (chunk0 === 'Timestamp') {
2679
+ address1 = new TreeNode(this._input.substring(this._offset, this._offset + 9), this._offset);
2680
+ this._offset = this._offset + 9;
2681
+ } else {
2682
+ address1 = FAILURE;
2683
+ if (this._offset > this._failure) {
2684
+ this._failure = this._offset;
2685
+ this._expected = [];
2686
+ }
2687
+ if (this._offset === this._failure) {
2688
+ this._expected.push('"Timestamp"');
2689
+ }
2690
+ }
2691
+ if (address1 !== FAILURE) {
2692
+ var address2 = FAILURE;
2693
+ address2 = this._read_type_open();
2694
+ if (address2 !== FAILURE) {
2695
+ var address3 = FAILURE;
2696
+ address3 = this._read_integer_number();
2697
+ if (address3 !== FAILURE) {
2698
+ elements0[0] = address3;
2699
+ var address4 = FAILURE;
2700
+ address4 = this._read_delimiter();
2701
+ if (address4 !== FAILURE) {
2702
+ var address5 = FAILURE;
2703
+ address5 = this._read_integer_number();
2704
+ if (address5 !== FAILURE) {
2705
+ elements0[1] = address5;
2706
+ var address6 = FAILURE;
2707
+ address6 = this._read_type_close();
2708
+ if (address6 !== FAILURE) {
2709
+ } else {
2710
+ elements0 = null;
2711
+ this._offset = index1;
2712
+ }
2713
+ } else {
2714
+ elements0 = null;
2715
+ this._offset = index1;
2716
+ }
2717
+ } else {
2718
+ elements0 = null;
2719
+ this._offset = index1;
2720
+ }
2721
+ } else {
2722
+ elements0 = null;
2723
+ this._offset = index1;
2724
+ }
2725
+ } else {
2726
+ elements0 = null;
2727
+ this._offset = index1;
2728
+ }
2729
+ } else {
2730
+ elements0 = null;
2731
+ this._offset = index1;
2732
+ }
2733
+ if (elements0 === null) {
2734
+ address0 = FAILURE;
2735
+ } else {
2736
+ address0 = this._actions.make_timestamp(this._input, index1, this._offset, elements0);
2737
+ this._offset = this._offset;
2738
+ }
2739
+ this._cache._timestamp[index0] = [address0, this._offset];
2740
+ return address0;
2741
+ },
2742
+
2743
+ _read_number_long_value: function() {
2744
+ var address0 = FAILURE, index0 = this._offset;
2745
+ this._cache._number_long_value = this._cache._number_long_value || {};
2746
+ var cached = this._cache._number_long_value[index0];
2747
+ if (cached) {
2748
+ this._offset = cached[1];
2749
+ return cached[0];
2750
+ }
2751
+ var index1 = this._offset;
2752
+ address0 = this._read_integer_number();
2753
+ if (address0 === FAILURE) {
2754
+ this._offset = index1;
2755
+ address0 = this._read_integer_string();
2756
+ if (address0 === FAILURE) {
2757
+ this._offset = index1;
2758
+ }
2759
+ }
2760
+ this._cache._number_long_value[index0] = [address0, this._offset];
2761
+ return address0;
2762
+ },
2763
+
2764
+ _read_number_long: function() {
2765
+ var address0 = FAILURE, index0 = this._offset;
2766
+ this._cache._number_long = this._cache._number_long || {};
2767
+ var cached = this._cache._number_long[index0];
2768
+ if (cached) {
2769
+ this._offset = cached[1];
2770
+ return cached[0];
2771
+ }
2772
+ var index1 = this._offset, elements0 = new Array(1);
2773
+ var address1 = FAILURE;
2774
+ var chunk0 = null;
2775
+ if (this._offset < this._inputSize) {
2776
+ chunk0 = this._input.substring(this._offset, this._offset + 10);
2777
+ }
2778
+ if (chunk0 === 'NumberLong') {
2779
+ address1 = new TreeNode(this._input.substring(this._offset, this._offset + 10), this._offset);
2780
+ this._offset = this._offset + 10;
2781
+ } else {
2782
+ address1 = FAILURE;
2783
+ if (this._offset > this._failure) {
2784
+ this._failure = this._offset;
2785
+ this._expected = [];
2786
+ }
2787
+ if (this._offset === this._failure) {
2788
+ this._expected.push('"NumberLong"');
2789
+ }
2790
+ }
2791
+ if (address1 !== FAILURE) {
2792
+ var address2 = FAILURE;
2793
+ address2 = this._read_type_open();
2794
+ if (address2 !== FAILURE) {
2795
+ var address3 = FAILURE;
2796
+ address3 = this._read_number_long_value();
2797
+ if (address3 !== FAILURE) {
2798
+ elements0[0] = address3;
2799
+ var address4 = FAILURE;
2800
+ address4 = this._read_type_close();
2801
+ if (address4 !== FAILURE) {
2802
+ } else {
2803
+ elements0 = null;
2804
+ this._offset = index1;
2805
+ }
2806
+ } else {
2807
+ elements0 = null;
2808
+ this._offset = index1;
2809
+ }
2810
+ } else {
2811
+ elements0 = null;
2812
+ this._offset = index1;
2813
+ }
2814
+ } else {
2815
+ elements0 = null;
2816
+ this._offset = index1;
2817
+ }
2818
+ if (elements0 === null) {
2819
+ address0 = FAILURE;
2820
+ } else {
2821
+ address0 = this._actions.make_number_long(this._input, index1, this._offset, elements0);
2822
+ this._offset = this._offset;
2823
+ }
2824
+ this._cache._number_long[index0] = [address0, this._offset];
2825
+ return address0;
2826
+ },
2827
+
2828
+ _read_number_decimal_value: function() {
2829
+ var address0 = FAILURE, index0 = this._offset;
2830
+ this._cache._number_decimal_value = this._cache._number_decimal_value || {};
2831
+ var cached = this._cache._number_decimal_value[index0];
2832
+ if (cached) {
2833
+ this._offset = cached[1];
2834
+ return cached[0];
2835
+ }
2836
+ var index1 = this._offset;
2837
+ address0 = this._read_number_as_string();
2838
+ if (address0 === FAILURE) {
2839
+ this._offset = index1;
2840
+ address0 = this._read_number_string();
2841
+ if (address0 === FAILURE) {
2842
+ this._offset = index1;
2843
+ }
2844
+ }
2845
+ this._cache._number_decimal_value[index0] = [address0, this._offset];
2846
+ return address0;
2847
+ },
2848
+
2849
+ _read_number_decimal: function() {
2850
+ var address0 = FAILURE, index0 = this._offset;
2851
+ this._cache._number_decimal = this._cache._number_decimal || {};
2852
+ var cached = this._cache._number_decimal[index0];
2853
+ if (cached) {
2854
+ this._offset = cached[1];
2855
+ return cached[0];
2856
+ }
2857
+ var index1 = this._offset, elements0 = new Array(1);
2858
+ var address1 = FAILURE;
2859
+ var chunk0 = null;
2860
+ if (this._offset < this._inputSize) {
2861
+ chunk0 = this._input.substring(this._offset, this._offset + 13);
2862
+ }
2863
+ if (chunk0 === 'NumberDecimal') {
2864
+ address1 = new TreeNode(this._input.substring(this._offset, this._offset + 13), this._offset);
2865
+ this._offset = this._offset + 13;
2866
+ } else {
2867
+ address1 = FAILURE;
2868
+ if (this._offset > this._failure) {
2869
+ this._failure = this._offset;
2870
+ this._expected = [];
2871
+ }
2872
+ if (this._offset === this._failure) {
2873
+ this._expected.push('"NumberDecimal"');
2874
+ }
2875
+ }
2876
+ if (address1 !== FAILURE) {
2877
+ var address2 = FAILURE;
2878
+ address2 = this._read_type_open();
2879
+ if (address2 !== FAILURE) {
2880
+ var address3 = FAILURE;
2881
+ address3 = this._read_number_decimal_value();
2882
+ if (address3 !== FAILURE) {
2883
+ elements0[0] = address3;
2884
+ var address4 = FAILURE;
2885
+ address4 = this._read_type_close();
2886
+ if (address4 !== FAILURE) {
2887
+ } else {
2888
+ elements0 = null;
2889
+ this._offset = index1;
2890
+ }
2891
+ } else {
2892
+ elements0 = null;
2893
+ this._offset = index1;
2894
+ }
2895
+ } else {
2896
+ elements0 = null;
2897
+ this._offset = index1;
2898
+ }
2899
+ } else {
2900
+ elements0 = null;
2901
+ this._offset = index1;
2902
+ }
2903
+ if (elements0 === null) {
2904
+ address0 = FAILURE;
2905
+ } else {
2906
+ address0 = this._actions.make_number_decimal(this._input, index1, this._offset, elements0);
2907
+ this._offset = this._offset;
2908
+ }
2909
+ this._cache._number_decimal[index0] = [address0, this._offset];
2910
+ return address0;
2911
+ },
2912
+
2913
+ _read_date_type: function() {
2914
+ var address0 = FAILURE, index0 = this._offset;
2915
+ this._cache._date_type = this._cache._date_type || {};
2916
+ var cached = this._cache._date_type[index0];
2917
+ if (cached) {
2918
+ this._offset = cached[1];
2919
+ return cached[0];
2920
+ }
2921
+ var index1 = this._offset;
2922
+ var index2 = this._offset, elements0 = new Array(3);
2923
+ var address1 = FAILURE;
2924
+ var chunk0 = null;
2925
+ if (this._offset < this._inputSize) {
2926
+ chunk0 = this._input.substring(this._offset, this._offset + 3);
2927
+ }
2928
+ if (chunk0 === 'new') {
2929
+ address1 = new TreeNode(this._input.substring(this._offset, this._offset + 3), this._offset);
2930
+ this._offset = this._offset + 3;
2931
+ } else {
2932
+ address1 = FAILURE;
2933
+ if (this._offset > this._failure) {
2934
+ this._failure = this._offset;
2935
+ this._expected = [];
2936
+ }
2937
+ if (this._offset === this._failure) {
2938
+ this._expected.push('"new"');
2939
+ }
2940
+ }
2941
+ if (address1 !== FAILURE) {
2942
+ elements0[0] = address1;
2943
+ var address2 = FAILURE;
2944
+ var remaining0 = 1, index3 = this._offset, elements1 = [], address3 = true;
2945
+ while (address3 !== FAILURE) {
2946
+ address3 = this._read_space();
2947
+ if (address3 !== FAILURE) {
2948
+ elements1.push(address3);
2949
+ --remaining0;
2950
+ }
2951
+ }
2952
+ if (remaining0 <= 0) {
2953
+ address2 = new TreeNode(this._input.substring(index3, this._offset), index3, elements1);
2954
+ this._offset = this._offset;
2955
+ } else {
2956
+ address2 = FAILURE;
2957
+ }
2958
+ if (address2 !== FAILURE) {
2959
+ elements0[1] = address2;
2960
+ var address4 = FAILURE;
2961
+ var chunk1 = null;
2962
+ if (this._offset < this._inputSize) {
2963
+ chunk1 = this._input.substring(this._offset, this._offset + 4);
2964
+ }
2965
+ if (chunk1 === 'Date') {
2966
+ address4 = new TreeNode(this._input.substring(this._offset, this._offset + 4), this._offset);
2967
+ this._offset = this._offset + 4;
2968
+ } else {
2969
+ address4 = FAILURE;
2970
+ if (this._offset > this._failure) {
2971
+ this._failure = this._offset;
2972
+ this._expected = [];
2973
+ }
2974
+ if (this._offset === this._failure) {
2975
+ this._expected.push('"Date"');
2976
+ }
2977
+ }
2978
+ if (address4 !== FAILURE) {
2979
+ elements0[2] = address4;
2980
+ } else {
2981
+ elements0 = null;
2982
+ this._offset = index2;
2983
+ }
2984
+ } else {
2985
+ elements0 = null;
2986
+ this._offset = index2;
2987
+ }
2988
+ } else {
2989
+ elements0 = null;
2990
+ this._offset = index2;
2991
+ }
2992
+ if (elements0 === null) {
2993
+ address0 = FAILURE;
2994
+ } else {
2995
+ address0 = new TreeNode(this._input.substring(index2, this._offset), index2, elements0);
2996
+ this._offset = this._offset;
2997
+ }
2998
+ if (address0 === FAILURE) {
2999
+ this._offset = index1;
3000
+ var chunk2 = null;
3001
+ if (this._offset < this._inputSize) {
3002
+ chunk2 = this._input.substring(this._offset, this._offset + 7);
3003
+ }
3004
+ if (chunk2 === 'ISODate') {
3005
+ address0 = new TreeNode(this._input.substring(this._offset, this._offset + 7), this._offset);
3006
+ this._offset = this._offset + 7;
3007
+ } else {
3008
+ address0 = FAILURE;
3009
+ if (this._offset > this._failure) {
3010
+ this._failure = this._offset;
3011
+ this._expected = [];
3012
+ }
3013
+ if (this._offset === this._failure) {
3014
+ this._expected.push('"ISODate"');
3015
+ }
3016
+ }
3017
+ if (address0 === FAILURE) {
3018
+ this._offset = index1;
3019
+ }
3020
+ }
3021
+ this._cache._date_type[index0] = [address0, this._offset];
3022
+ return address0;
3023
+ },
3024
+
3025
+ _read_date_value: function() {
3026
+ var address0 = FAILURE, index0 = this._offset;
3027
+ this._cache._date_value = this._cache._date_value || {};
3028
+ var cached = this._cache._date_value[index0];
3029
+ if (cached) {
3030
+ this._offset = cached[1];
3031
+ return cached[0];
3032
+ }
3033
+ var index1 = this._offset;
3034
+ address0 = this._read_integer_number();
3035
+ if (address0 === FAILURE) {
3036
+ this._offset = index1;
3037
+ address0 = this._read_string();
3038
+ if (address0 === FAILURE) {
3039
+ this._offset = index1;
3040
+ }
3041
+ }
3042
+ this._cache._date_value[index0] = [address0, this._offset];
3043
+ return address0;
3044
+ },
3045
+
3046
+ _read_date: function() {
3047
+ var address0 = FAILURE, index0 = this._offset;
3048
+ this._cache._date = this._cache._date || {};
3049
+ var cached = this._cache._date[index0];
3050
+ if (cached) {
3051
+ this._offset = cached[1];
3052
+ return cached[0];
3053
+ }
3054
+ var index1 = this._offset, elements0 = new Array(1);
3055
+ var address1 = FAILURE;
3056
+ address1 = this._read_date_type();
3057
+ if (address1 !== FAILURE) {
3058
+ var address2 = FAILURE;
3059
+ address2 = this._read_type_open();
3060
+ if (address2 !== FAILURE) {
3061
+ var address3 = FAILURE;
3062
+ address3 = this._read_date_value();
3063
+ if (address3 !== FAILURE) {
3064
+ elements0[0] = address3;
3065
+ var address4 = FAILURE;
3066
+ address4 = this._read_type_close();
3067
+ if (address4 !== FAILURE) {
3068
+ } else {
3069
+ elements0 = null;
3070
+ this._offset = index1;
3071
+ }
3072
+ } else {
3073
+ elements0 = null;
3074
+ this._offset = index1;
3075
+ }
3076
+ } else {
3077
+ elements0 = null;
3078
+ this._offset = index1;
3079
+ }
3080
+ } else {
3081
+ elements0 = null;
3082
+ this._offset = index1;
3083
+ }
3084
+ if (elements0 === null) {
3085
+ address0 = FAILURE;
3086
+ } else {
3087
+ address0 = this._actions.make_date(this._input, index1, this._offset, elements0);
3088
+ this._offset = this._offset;
3089
+ }
3090
+ this._cache._date[index0] = [address0, this._offset];
3091
+ return address0;
3092
+ },
3093
+
3094
+ _read_db_ref_type: function() {
3095
+ var address0 = FAILURE, index0 = this._offset;
3096
+ this._cache._db_ref_type = this._cache._db_ref_type || {};
3097
+ var cached = this._cache._db_ref_type[index0];
3098
+ if (cached) {
3099
+ this._offset = cached[1];
3100
+ return cached[0];
3101
+ }
3102
+ var index1 = this._offset, elements0 = new Array(2);
3103
+ var address1 = FAILURE;
3104
+ var chunk0 = null;
3105
+ if (this._offset < this._inputSize) {
3106
+ chunk0 = this._input.substring(this._offset, this._offset + 5);
3107
+ }
3108
+ if (chunk0 === 'DBRef') {
3109
+ address1 = new TreeNode(this._input.substring(this._offset, this._offset + 5), this._offset);
3110
+ this._offset = this._offset + 5;
3111
+ } else {
3112
+ address1 = FAILURE;
3113
+ if (this._offset > this._failure) {
3114
+ this._failure = this._offset;
3115
+ this._expected = [];
3116
+ }
3117
+ if (this._offset === this._failure) {
3118
+ this._expected.push('"DBRef"');
3119
+ }
3120
+ }
3121
+ if (address1 !== FAILURE) {
3122
+ var address2 = FAILURE;
3123
+ address2 = this._read_type_open();
3124
+ if (address2 !== FAILURE) {
3125
+ var address3 = FAILURE;
3126
+ address3 = this._read_string();
3127
+ if (address3 !== FAILURE) {
3128
+ elements0[0] = address3;
3129
+ var address4 = FAILURE;
3130
+ address4 = this._read_delimiter();
3131
+ if (address4 !== FAILURE) {
3132
+ var address5 = FAILURE;
3133
+ address5 = this._read_string();
3134
+ if (address5 !== FAILURE) {
3135
+ elements0[1] = address5;
3136
+ var address6 = FAILURE;
3137
+ address6 = this._read_type_close();
3138
+ if (address6 !== FAILURE) {
3139
+ } else {
3140
+ elements0 = null;
3141
+ this._offset = index1;
3142
+ }
3143
+ } else {
3144
+ elements0 = null;
3145
+ this._offset = index1;
3146
+ }
3147
+ } else {
3148
+ elements0 = null;
3149
+ this._offset = index1;
3150
+ }
3151
+ } else {
3152
+ elements0 = null;
3153
+ this._offset = index1;
3154
+ }
3155
+ } else {
3156
+ elements0 = null;
3157
+ this._offset = index1;
3158
+ }
3159
+ } else {
3160
+ elements0 = null;
3161
+ this._offset = index1;
3162
+ }
3163
+ if (elements0 === null) {
3164
+ address0 = FAILURE;
3165
+ } else {
3166
+ address0 = this._actions.make_db_ref(this._input, index1, this._offset, elements0);
3167
+ this._offset = this._offset;
3168
+ }
3169
+ this._cache._db_ref_type[index0] = [address0, this._offset];
3170
+ return address0;
3171
+ },
3172
+
3173
+ _read_single_quote: function() {
3174
+ var address0 = FAILURE, index0 = this._offset;
3175
+ this._cache._single_quote = this._cache._single_quote || {};
3176
+ var cached = this._cache._single_quote[index0];
3177
+ if (cached) {
3178
+ this._offset = cached[1];
3179
+ return cached[0];
3180
+ }
3181
+ var chunk0 = null;
3182
+ if (this._offset < this._inputSize) {
3183
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
3184
+ }
3185
+ if (chunk0 === '\'') {
3186
+ address0 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
3187
+ this._offset = this._offset + 1;
3188
+ } else {
3189
+ address0 = FAILURE;
3190
+ if (this._offset > this._failure) {
3191
+ this._failure = this._offset;
3192
+ this._expected = [];
3193
+ }
3194
+ if (this._offset === this._failure) {
3195
+ this._expected.push('"\'"');
3196
+ }
3197
+ }
3198
+ this._cache._single_quote[index0] = [address0, this._offset];
3199
+ return address0;
3200
+ },
3201
+
3202
+ _read_double_quote: function() {
3203
+ var address0 = FAILURE, index0 = this._offset;
3204
+ this._cache._double_quote = this._cache._double_quote || {};
3205
+ var cached = this._cache._double_quote[index0];
3206
+ if (cached) {
3207
+ this._offset = cached[1];
3208
+ return cached[0];
3209
+ }
3210
+ var chunk0 = null;
3211
+ if (this._offset < this._inputSize) {
3212
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
3213
+ }
3214
+ if (chunk0 === '"') {
3215
+ address0 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
3216
+ this._offset = this._offset + 1;
3217
+ } else {
3218
+ address0 = FAILURE;
3219
+ if (this._offset > this._failure) {
3220
+ this._failure = this._offset;
3221
+ this._expected = [];
3222
+ }
3223
+ if (this._offset === this._failure) {
3224
+ this._expected.push('\'"\'');
3225
+ }
3226
+ }
3227
+ this._cache._double_quote[index0] = [address0, this._offset];
3228
+ return address0;
3229
+ },
3230
+
3231
+ _read_left_paren: function() {
3232
+ var address0 = FAILURE, index0 = this._offset;
3233
+ this._cache._left_paren = this._cache._left_paren || {};
3234
+ var cached = this._cache._left_paren[index0];
3235
+ if (cached) {
3236
+ this._offset = cached[1];
3237
+ return cached[0];
3238
+ }
3239
+ var chunk0 = null;
3240
+ if (this._offset < this._inputSize) {
3241
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
3242
+ }
3243
+ if (chunk0 === '(') {
3244
+ address0 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
3245
+ this._offset = this._offset + 1;
3246
+ } else {
3247
+ address0 = FAILURE;
3248
+ if (this._offset > this._failure) {
3249
+ this._failure = this._offset;
3250
+ this._expected = [];
3251
+ }
3252
+ if (this._offset === this._failure) {
3253
+ this._expected.push('\'(\'');
3254
+ }
3255
+ }
3256
+ this._cache._left_paren[index0] = [address0, this._offset];
3257
+ return address0;
3258
+ },
3259
+
3260
+ _read_right_paren: function() {
3261
+ var address0 = FAILURE, index0 = this._offset;
3262
+ this._cache._right_paren = this._cache._right_paren || {};
3263
+ var cached = this._cache._right_paren[index0];
3264
+ if (cached) {
3265
+ this._offset = cached[1];
3266
+ return cached[0];
3267
+ }
3268
+ var chunk0 = null;
3269
+ if (this._offset < this._inputSize) {
3270
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
3271
+ }
3272
+ if (chunk0 === ')') {
3273
+ address0 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
3274
+ this._offset = this._offset + 1;
3275
+ } else {
3276
+ address0 = FAILURE;
3277
+ if (this._offset > this._failure) {
3278
+ this._failure = this._offset;
3279
+ this._expected = [];
3280
+ }
3281
+ if (this._offset === this._failure) {
3282
+ this._expected.push('\')\'');
3283
+ }
3284
+ }
3285
+ this._cache._right_paren[index0] = [address0, this._offset];
3286
+ return address0;
3287
+ },
3288
+
3289
+ _read_left_brace: function() {
3290
+ var address0 = FAILURE, index0 = this._offset;
3291
+ this._cache._left_brace = this._cache._left_brace || {};
3292
+ var cached = this._cache._left_brace[index0];
3293
+ if (cached) {
3294
+ this._offset = cached[1];
3295
+ return cached[0];
3296
+ }
3297
+ var chunk0 = null;
3298
+ if (this._offset < this._inputSize) {
3299
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
3300
+ }
3301
+ if (chunk0 === '{') {
3302
+ address0 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
3303
+ this._offset = this._offset + 1;
3304
+ } else {
3305
+ address0 = FAILURE;
3306
+ if (this._offset > this._failure) {
3307
+ this._failure = this._offset;
3308
+ this._expected = [];
3309
+ }
3310
+ if (this._offset === this._failure) {
3311
+ this._expected.push('\'{\'');
3312
+ }
3313
+ }
3314
+ this._cache._left_brace[index0] = [address0, this._offset];
3315
+ return address0;
3316
+ },
3317
+
3318
+ _read_right_brace: function() {
3319
+ var address0 = FAILURE, index0 = this._offset;
3320
+ this._cache._right_brace = this._cache._right_brace || {};
3321
+ var cached = this._cache._right_brace[index0];
3322
+ if (cached) {
3323
+ this._offset = cached[1];
3324
+ return cached[0];
3325
+ }
3326
+ var chunk0 = null;
3327
+ if (this._offset < this._inputSize) {
3328
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
3329
+ }
3330
+ if (chunk0 === '}') {
3331
+ address0 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
3332
+ this._offset = this._offset + 1;
3333
+ } else {
3334
+ address0 = FAILURE;
3335
+ if (this._offset > this._failure) {
3336
+ this._failure = this._offset;
3337
+ this._expected = [];
3338
+ }
3339
+ if (this._offset === this._failure) {
3340
+ this._expected.push('\'}\'');
3341
+ }
3342
+ }
3343
+ this._cache._right_brace[index0] = [address0, this._offset];
3344
+ return address0;
3345
+ },
3346
+
3347
+ _read_left_bracket: function() {
3348
+ var address0 = FAILURE, index0 = this._offset;
3349
+ this._cache._left_bracket = this._cache._left_bracket || {};
3350
+ var cached = this._cache._left_bracket[index0];
3351
+ if (cached) {
3352
+ this._offset = cached[1];
3353
+ return cached[0];
3354
+ }
3355
+ var chunk0 = null;
3356
+ if (this._offset < this._inputSize) {
3357
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
3358
+ }
3359
+ if (chunk0 === '[') {
3360
+ address0 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
3361
+ this._offset = this._offset + 1;
3362
+ } else {
3363
+ address0 = FAILURE;
3364
+ if (this._offset > this._failure) {
3365
+ this._failure = this._offset;
3366
+ this._expected = [];
3367
+ }
3368
+ if (this._offset === this._failure) {
3369
+ this._expected.push('\'[\'');
3370
+ }
3371
+ }
3372
+ this._cache._left_bracket[index0] = [address0, this._offset];
3373
+ return address0;
3374
+ },
3375
+
3376
+ _read_right_bracket: function() {
3377
+ var address0 = FAILURE, index0 = this._offset;
3378
+ this._cache._right_bracket = this._cache._right_bracket || {};
3379
+ var cached = this._cache._right_bracket[index0];
3380
+ if (cached) {
3381
+ this._offset = cached[1];
3382
+ return cached[0];
3383
+ }
3384
+ var chunk0 = null;
3385
+ if (this._offset < this._inputSize) {
3386
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
3387
+ }
3388
+ if (chunk0 === ']') {
3389
+ address0 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
3390
+ this._offset = this._offset + 1;
3391
+ } else {
3392
+ address0 = FAILURE;
3393
+ if (this._offset > this._failure) {
3394
+ this._failure = this._offset;
3395
+ this._expected = [];
3396
+ }
3397
+ if (this._offset === this._failure) {
3398
+ this._expected.push('\']\'');
3399
+ }
3400
+ }
3401
+ this._cache._right_bracket[index0] = [address0, this._offset];
3402
+ return address0;
3403
+ },
3404
+
3405
+ _read_comma: function() {
3406
+ var address0 = FAILURE, index0 = this._offset;
3407
+ this._cache._comma = this._cache._comma || {};
3408
+ var cached = this._cache._comma[index0];
3409
+ if (cached) {
3410
+ this._offset = cached[1];
3411
+ return cached[0];
3412
+ }
3413
+ var chunk0 = null;
3414
+ if (this._offset < this._inputSize) {
3415
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
3416
+ }
3417
+ if (chunk0 === ',') {
3418
+ address0 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
3419
+ this._offset = this._offset + 1;
3420
+ } else {
3421
+ address0 = FAILURE;
3422
+ if (this._offset > this._failure) {
3423
+ this._failure = this._offset;
3424
+ this._expected = [];
3425
+ }
3426
+ if (this._offset === this._failure) {
3427
+ this._expected.push('\',\'');
3428
+ }
3429
+ }
3430
+ this._cache._comma[index0] = [address0, this._offset];
3431
+ return address0;
3432
+ },
3433
+
3434
+ _read_colon: function() {
3435
+ var address0 = FAILURE, index0 = this._offset;
3436
+ this._cache._colon = this._cache._colon || {};
3437
+ var cached = this._cache._colon[index0];
3438
+ if (cached) {
3439
+ this._offset = cached[1];
3440
+ return cached[0];
3441
+ }
3442
+ var chunk0 = null;
3443
+ if (this._offset < this._inputSize) {
3444
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
3445
+ }
3446
+ if (chunk0 === ':') {
3447
+ address0 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
3448
+ this._offset = this._offset + 1;
3449
+ } else {
3450
+ address0 = FAILURE;
3451
+ if (this._offset > this._failure) {
3452
+ this._failure = this._offset;
3453
+ this._expected = [];
3454
+ }
3455
+ if (this._offset === this._failure) {
3456
+ this._expected.push('\':\'');
3457
+ }
3458
+ }
3459
+ this._cache._colon[index0] = [address0, this._offset];
3460
+ return address0;
3461
+ },
3462
+
3463
+ _read_slash: function() {
3464
+ var address0 = FAILURE, index0 = this._offset;
3465
+ this._cache._slash = this._cache._slash || {};
3466
+ var cached = this._cache._slash[index0];
3467
+ if (cached) {
3468
+ this._offset = cached[1];
3469
+ return cached[0];
3470
+ }
3471
+ var chunk0 = null;
3472
+ if (this._offset < this._inputSize) {
3473
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
3474
+ }
3475
+ if (chunk0 === '/') {
3476
+ address0 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
3477
+ this._offset = this._offset + 1;
3478
+ } else {
3479
+ address0 = FAILURE;
3480
+ if (this._offset > this._failure) {
3481
+ this._failure = this._offset;
3482
+ this._expected = [];
3483
+ }
3484
+ if (this._offset === this._failure) {
3485
+ this._expected.push('\'/\'');
3486
+ }
3487
+ }
3488
+ this._cache._slash[index0] = [address0, this._offset];
3489
+ return address0;
3490
+ },
3491
+
3492
+ _read_space: function() {
3493
+ var address0 = FAILURE, index0 = this._offset;
3494
+ this._cache._space = this._cache._space || {};
3495
+ var cached = this._cache._space[index0];
3496
+ if (cached) {
3497
+ this._offset = cached[1];
3498
+ return cached[0];
3499
+ }
3500
+ var chunk0 = null;
3501
+ if (this._offset < this._inputSize) {
3502
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
3503
+ }
3504
+ if (chunk0 !== null && /^[\s]/.test(chunk0)) {
3505
+ address0 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
3506
+ this._offset = this._offset + 1;
3507
+ } else {
3508
+ address0 = FAILURE;
3509
+ if (this._offset > this._failure) {
3510
+ this._failure = this._offset;
3511
+ this._expected = [];
3512
+ }
3513
+ if (this._offset === this._failure) {
3514
+ this._expected.push('[\\s]');
3515
+ }
3516
+ }
3517
+ this._cache._space[index0] = [address0, this._offset];
3518
+ return address0;
3519
+ },
3520
+
3521
+ _read_new_line: function() {
3522
+ var address0 = FAILURE, index0 = this._offset;
3523
+ this._cache._new_line = this._cache._new_line || {};
3524
+ var cached = this._cache._new_line[index0];
3525
+ if (cached) {
3526
+ this._offset = cached[1];
3527
+ return cached[0];
3528
+ }
3529
+ var chunk0 = null;
3530
+ if (this._offset < this._inputSize) {
3531
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
3532
+ }
3533
+ if (chunk0 !== null && /^[\n]/.test(chunk0)) {
3534
+ address0 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
3535
+ this._offset = this._offset + 1;
3536
+ } else {
3537
+ address0 = FAILURE;
3538
+ if (this._offset > this._failure) {
3539
+ this._failure = this._offset;
3540
+ this._expected = [];
3541
+ }
3542
+ if (this._offset === this._failure) {
3543
+ this._expected.push('[\\n]');
3544
+ }
3545
+ }
3546
+ this._cache._new_line[index0] = [address0, this._offset];
3547
+ return address0;
3548
+ },
3549
+
3550
+ _read_comment: function() {
3551
+ var address0 = FAILURE, index0 = this._offset;
3552
+ this._cache._comment = this._cache._comment || {};
3553
+ var cached = this._cache._comment[index0];
3554
+ if (cached) {
3555
+ this._offset = cached[1];
3556
+ return cached[0];
3557
+ }
3558
+ var index1 = this._offset, elements0 = new Array(2);
3559
+ var address1 = FAILURE;
3560
+ var chunk0 = null;
3561
+ if (this._offset < this._inputSize) {
3562
+ chunk0 = this._input.substring(this._offset, this._offset + 2);
3563
+ }
3564
+ if (chunk0 === '//') {
3565
+ address1 = new TreeNode(this._input.substring(this._offset, this._offset + 2), this._offset);
3566
+ this._offset = this._offset + 2;
3567
+ } else {
3568
+ address1 = FAILURE;
3569
+ if (this._offset > this._failure) {
3570
+ this._failure = this._offset;
3571
+ this._expected = [];
3572
+ }
3573
+ if (this._offset === this._failure) {
3574
+ this._expected.push('"//"');
3575
+ }
3576
+ }
3577
+ if (address1 !== FAILURE) {
3578
+ elements0[0] = address1;
3579
+ var address2 = FAILURE;
3580
+ var remaining0 = 0, index2 = this._offset, elements1 = [], address3 = true;
3581
+ while (address3 !== FAILURE) {
3582
+ var chunk1 = null;
3583
+ if (this._offset < this._inputSize) {
3584
+ chunk1 = this._input.substring(this._offset, this._offset + 1);
3585
+ }
3586
+ if (chunk1 !== null && /^[^\n]/.test(chunk1)) {
3587
+ address3 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
3588
+ this._offset = this._offset + 1;
3589
+ } else {
3590
+ address3 = FAILURE;
3591
+ if (this._offset > this._failure) {
3592
+ this._failure = this._offset;
3593
+ this._expected = [];
3594
+ }
3595
+ if (this._offset === this._failure) {
3596
+ this._expected.push('[^\\n]');
3597
+ }
3598
+ }
3599
+ if (address3 !== FAILURE) {
3600
+ elements1.push(address3);
3601
+ --remaining0;
3602
+ }
3603
+ }
3604
+ if (remaining0 <= 0) {
3605
+ address2 = new TreeNode(this._input.substring(index2, this._offset), index2, elements1);
3606
+ this._offset = this._offset;
3607
+ } else {
3608
+ address2 = FAILURE;
3609
+ }
3610
+ if (address2 !== FAILURE) {
3611
+ elements0[1] = address2;
3612
+ } else {
3613
+ elements0 = null;
3614
+ this._offset = index1;
3615
+ }
3616
+ } else {
3617
+ elements0 = null;
3618
+ this._offset = index1;
3619
+ }
3620
+ if (elements0 === null) {
3621
+ address0 = FAILURE;
3622
+ } else {
3623
+ address0 = new TreeNode(this._input.substring(index1, this._offset), index1, elements0);
3624
+ this._offset = this._offset;
3625
+ }
3626
+ this._cache._comment[index0] = [address0, this._offset];
3627
+ return address0;
3628
+ },
3629
+
3630
+ _read___: function() {
3631
+ var address0 = FAILURE, index0 = this._offset;
3632
+ this._cache.___ = this._cache.___ || {};
3633
+ var cached = this._cache.___[index0];
3634
+ if (cached) {
3635
+ this._offset = cached[1];
3636
+ return cached[0];
3637
+ }
3638
+ var remaining0 = 0, index1 = this._offset, elements0 = [], address1 = true;
3639
+ while (address1 !== FAILURE) {
3640
+ var index2 = this._offset;
3641
+ address1 = this._read_space();
3642
+ if (address1 === FAILURE) {
3643
+ this._offset = index2;
3644
+ address1 = this._read_new_line();
3645
+ if (address1 === FAILURE) {
3646
+ this._offset = index2;
3647
+ address1 = this._read_comment();
3648
+ if (address1 === FAILURE) {
3649
+ this._offset = index2;
3650
+ }
3651
+ }
3652
+ }
3653
+ if (address1 !== FAILURE) {
3654
+ elements0.push(address1);
3655
+ --remaining0;
3656
+ }
3657
+ }
3658
+ if (remaining0 <= 0) {
3659
+ address0 = new TreeNode(this._input.substring(index1, this._offset), index1, elements0);
3660
+ this._offset = this._offset;
3661
+ } else {
3662
+ address0 = FAILURE;
3663
+ }
3664
+ this._cache.___[index0] = [address0, this._offset];
3665
+ return address0;
3666
+ },
3667
+
3668
+ _read_delimiter: function() {
3669
+ var address0 = FAILURE, index0 = this._offset;
3670
+ this._cache._delimiter = this._cache._delimiter || {};
3671
+ var cached = this._cache._delimiter[index0];
3672
+ if (cached) {
3673
+ this._offset = cached[1];
3674
+ return cached[0];
3675
+ }
3676
+ var index1 = this._offset, elements0 = new Array(1);
3677
+ var address1 = FAILURE;
3678
+ address1 = this._read___();
3679
+ if (address1 !== FAILURE) {
3680
+ var address2 = FAILURE;
3681
+ address2 = this._read_comma();
3682
+ if (address2 !== FAILURE) {
3683
+ elements0[0] = address2;
3684
+ var address3 = FAILURE;
3685
+ address3 = this._read___();
3686
+ if (address3 !== FAILURE) {
3687
+ } else {
3688
+ elements0 = null;
3689
+ this._offset = index1;
3690
+ }
3691
+ } else {
3692
+ elements0 = null;
3693
+ this._offset = index1;
3694
+ }
3695
+ } else {
3696
+ elements0 = null;
3697
+ this._offset = index1;
3698
+ }
3699
+ if (elements0 === null) {
3700
+ address0 = FAILURE;
3701
+ } else {
3702
+ address0 = new TreeNode24(this._input.substring(index1, this._offset), index1, elements0);
3703
+ this._offset = this._offset;
3704
+ }
3705
+ this._cache._delimiter[index0] = [address0, this._offset];
3706
+ return address0;
3707
+ },
3708
+
3709
+ _read_assignment: function() {
3710
+ var address0 = FAILURE, index0 = this._offset;
3711
+ this._cache._assignment = this._cache._assignment || {};
3712
+ var cached = this._cache._assignment[index0];
3713
+ if (cached) {
3714
+ this._offset = cached[1];
3715
+ return cached[0];
3716
+ }
3717
+ var index1 = this._offset, elements0 = [];
3718
+ var address1 = FAILURE;
3719
+ address1 = this._read___();
3720
+ if (address1 !== FAILURE) {
3721
+ var address2 = FAILURE;
3722
+ address2 = this._read_colon();
3723
+ if (address2 !== FAILURE) {
3724
+ var address3 = FAILURE;
3725
+ address3 = this._read___();
3726
+ if (address3 !== FAILURE) {
3727
+ } else {
3728
+ elements0 = null;
3729
+ this._offset = index1;
3730
+ }
3731
+ } else {
3732
+ elements0 = null;
3733
+ this._offset = index1;
3734
+ }
3735
+ } else {
3736
+ elements0 = null;
3737
+ this._offset = index1;
3738
+ }
3739
+ if (elements0 === null) {
3740
+ address0 = FAILURE;
3741
+ } else {
3742
+ address0 = new TreeNode(this._input.substring(index1, this._offset), index1, elements0);
3743
+ this._offset = this._offset;
3744
+ }
3745
+ this._cache._assignment[index0] = [address0, this._offset];
3746
+ return address0;
3747
+ },
3748
+
3749
+ _read_object_open: function() {
3750
+ var address0 = FAILURE, index0 = this._offset;
3751
+ this._cache._object_open = this._cache._object_open || {};
3752
+ var cached = this._cache._object_open[index0];
3753
+ if (cached) {
3754
+ this._offset = cached[1];
3755
+ return cached[0];
3756
+ }
3757
+ var index1 = this._offset, elements0 = [];
3758
+ var address1 = FAILURE;
3759
+ address1 = this._read___();
3760
+ if (address1 !== FAILURE) {
3761
+ var address2 = FAILURE;
3762
+ address2 = this._read_left_brace();
3763
+ if (address2 !== FAILURE) {
3764
+ var address3 = FAILURE;
3765
+ address3 = this._read___();
3766
+ if (address3 !== FAILURE) {
3767
+ } else {
3768
+ elements0 = null;
3769
+ this._offset = index1;
3770
+ }
3771
+ } else {
3772
+ elements0 = null;
3773
+ this._offset = index1;
3774
+ }
3775
+ } else {
3776
+ elements0 = null;
3777
+ this._offset = index1;
3778
+ }
3779
+ if (elements0 === null) {
3780
+ address0 = FAILURE;
3781
+ } else {
3782
+ address0 = new TreeNode(this._input.substring(index1, this._offset), index1, elements0);
3783
+ this._offset = this._offset;
3784
+ }
3785
+ this._cache._object_open[index0] = [address0, this._offset];
3786
+ return address0;
3787
+ },
3788
+
3789
+ _read_object_close: function() {
3790
+ var address0 = FAILURE, index0 = this._offset;
3791
+ this._cache._object_close = this._cache._object_close || {};
3792
+ var cached = this._cache._object_close[index0];
3793
+ if (cached) {
3794
+ this._offset = cached[1];
3795
+ return cached[0];
3796
+ }
3797
+ var index1 = this._offset, elements0 = [];
3798
+ var address1 = FAILURE;
3799
+ address1 = this._read___();
3800
+ if (address1 !== FAILURE) {
3801
+ var address2 = FAILURE;
3802
+ address2 = this._read_right_brace();
3803
+ if (address2 !== FAILURE) {
3804
+ var address3 = FAILURE;
3805
+ address3 = this._read___();
3806
+ if (address3 !== FAILURE) {
3807
+ } else {
3808
+ elements0 = null;
3809
+ this._offset = index1;
3810
+ }
3811
+ } else {
3812
+ elements0 = null;
3813
+ this._offset = index1;
3814
+ }
3815
+ } else {
3816
+ elements0 = null;
3817
+ this._offset = index1;
3818
+ }
3819
+ if (elements0 === null) {
3820
+ address0 = FAILURE;
3821
+ } else {
3822
+ address0 = new TreeNode(this._input.substring(index1, this._offset), index1, elements0);
3823
+ this._offset = this._offset;
3824
+ }
3825
+ this._cache._object_close[index0] = [address0, this._offset];
3826
+ return address0;
3827
+ },
3828
+
3829
+ _read_array_open: function() {
3830
+ var address0 = FAILURE, index0 = this._offset;
3831
+ this._cache._array_open = this._cache._array_open || {};
3832
+ var cached = this._cache._array_open[index0];
3833
+ if (cached) {
3834
+ this._offset = cached[1];
3835
+ return cached[0];
3836
+ }
3837
+ var index1 = this._offset, elements0 = [];
3838
+ var address1 = FAILURE;
3839
+ address1 = this._read___();
3840
+ if (address1 !== FAILURE) {
3841
+ var address2 = FAILURE;
3842
+ address2 = this._read_left_bracket();
3843
+ if (address2 !== FAILURE) {
3844
+ var address3 = FAILURE;
3845
+ address3 = this._read___();
3846
+ if (address3 !== FAILURE) {
3847
+ } else {
3848
+ elements0 = null;
3849
+ this._offset = index1;
3850
+ }
3851
+ } else {
3852
+ elements0 = null;
3853
+ this._offset = index1;
3854
+ }
3855
+ } else {
3856
+ elements0 = null;
3857
+ this._offset = index1;
3858
+ }
3859
+ if (elements0 === null) {
3860
+ address0 = FAILURE;
3861
+ } else {
3862
+ address0 = new TreeNode(this._input.substring(index1, this._offset), index1, elements0);
3863
+ this._offset = this._offset;
3864
+ }
3865
+ this._cache._array_open[index0] = [address0, this._offset];
3866
+ return address0;
3867
+ },
3868
+
3869
+ _read_array_close: function() {
3870
+ var address0 = FAILURE, index0 = this._offset;
3871
+ this._cache._array_close = this._cache._array_close || {};
3872
+ var cached = this._cache._array_close[index0];
3873
+ if (cached) {
3874
+ this._offset = cached[1];
3875
+ return cached[0];
3876
+ }
3877
+ var index1 = this._offset, elements0 = [];
3878
+ var address1 = FAILURE;
3879
+ address1 = this._read___();
3880
+ if (address1 !== FAILURE) {
3881
+ var address2 = FAILURE;
3882
+ address2 = this._read_right_bracket();
3883
+ if (address2 !== FAILURE) {
3884
+ var address3 = FAILURE;
3885
+ address3 = this._read___();
3886
+ if (address3 !== FAILURE) {
3887
+ } else {
3888
+ elements0 = null;
3889
+ this._offset = index1;
3890
+ }
3891
+ } else {
3892
+ elements0 = null;
3893
+ this._offset = index1;
3894
+ }
3895
+ } else {
3896
+ elements0 = null;
3897
+ this._offset = index1;
3898
+ }
3899
+ if (elements0 === null) {
3900
+ address0 = FAILURE;
3901
+ } else {
3902
+ address0 = new TreeNode(this._input.substring(index1, this._offset), index1, elements0);
3903
+ this._offset = this._offset;
3904
+ }
3905
+ this._cache._array_close[index0] = [address0, this._offset];
3906
+ return address0;
3907
+ },
3908
+
3909
+ _read_type_open: function() {
3910
+ var address0 = FAILURE, index0 = this._offset;
3911
+ this._cache._type_open = this._cache._type_open || {};
3912
+ var cached = this._cache._type_open[index0];
3913
+ if (cached) {
3914
+ this._offset = cached[1];
3915
+ return cached[0];
3916
+ }
3917
+ var index1 = this._offset, elements0 = [];
3918
+ var address1 = FAILURE;
3919
+ var remaining0 = 0, index2 = this._offset, elements1 = [], address2 = true;
3920
+ while (address2 !== FAILURE) {
3921
+ address2 = this._read_space();
3922
+ if (address2 !== FAILURE) {
3923
+ elements1.push(address2);
3924
+ --remaining0;
3925
+ }
3926
+ }
3927
+ if (remaining0 <= 0) {
3928
+ address1 = new TreeNode(this._input.substring(index2, this._offset), index2, elements1);
3929
+ this._offset = this._offset;
3930
+ } else {
3931
+ address1 = FAILURE;
3932
+ }
3933
+ if (address1 !== FAILURE) {
3934
+ var address3 = FAILURE;
3935
+ address3 = this._read_left_paren();
3936
+ if (address3 !== FAILURE) {
3937
+ var address4 = FAILURE;
3938
+ var remaining1 = 0, index3 = this._offset, elements2 = [], address5 = true;
3939
+ while (address5 !== FAILURE) {
3940
+ address5 = this._read_space();
3941
+ if (address5 !== FAILURE) {
3942
+ elements2.push(address5);
3943
+ --remaining1;
3944
+ }
3945
+ }
3946
+ if (remaining1 <= 0) {
3947
+ address4 = new TreeNode(this._input.substring(index3, this._offset), index3, elements2);
3948
+ this._offset = this._offset;
3949
+ } else {
3950
+ address4 = FAILURE;
3951
+ }
3952
+ if (address4 !== FAILURE) {
3953
+ } else {
3954
+ elements0 = null;
3955
+ this._offset = index1;
3956
+ }
3957
+ } else {
3958
+ elements0 = null;
3959
+ this._offset = index1;
3960
+ }
3961
+ } else {
3962
+ elements0 = null;
3963
+ this._offset = index1;
3964
+ }
3965
+ if (elements0 === null) {
3966
+ address0 = FAILURE;
3967
+ } else {
3968
+ address0 = new TreeNode(this._input.substring(index1, this._offset), index1, elements0);
3969
+ this._offset = this._offset;
3970
+ }
3971
+ this._cache._type_open[index0] = [address0, this._offset];
3972
+ return address0;
3973
+ },
3974
+
3975
+ _read_type_close: function() {
3976
+ var address0 = FAILURE, index0 = this._offset;
3977
+ this._cache._type_close = this._cache._type_close || {};
3978
+ var cached = this._cache._type_close[index0];
3979
+ if (cached) {
3980
+ this._offset = cached[1];
3981
+ return cached[0];
3982
+ }
3983
+ var index1 = this._offset, elements0 = [];
3984
+ var address1 = FAILURE;
3985
+ var remaining0 = 0, index2 = this._offset, elements1 = [], address2 = true;
3986
+ while (address2 !== FAILURE) {
3987
+ address2 = this._read_space();
3988
+ if (address2 !== FAILURE) {
3989
+ elements1.push(address2);
3990
+ --remaining0;
3991
+ }
3992
+ }
3993
+ if (remaining0 <= 0) {
3994
+ address1 = new TreeNode(this._input.substring(index2, this._offset), index2, elements1);
3995
+ this._offset = this._offset;
3996
+ } else {
3997
+ address1 = FAILURE;
3998
+ }
3999
+ if (address1 !== FAILURE) {
4000
+ var address3 = FAILURE;
4001
+ address3 = this._read_right_paren();
4002
+ if (address3 !== FAILURE) {
4003
+ } else {
4004
+ elements0 = null;
4005
+ this._offset = index1;
4006
+ }
4007
+ } else {
4008
+ elements0 = null;
4009
+ this._offset = index1;
4010
+ }
4011
+ if (elements0 === null) {
4012
+ address0 = FAILURE;
4013
+ } else {
4014
+ address0 = new TreeNode(this._input.substring(index1, this._offset), index1, elements0);
4015
+ this._offset = this._offset;
4016
+ }
4017
+ this._cache._type_close[index0] = [address0, this._offset];
4018
+ return address0;
4019
+ }
4020
+ };
4021
+
4022
+ var Parser = function(input, actions, types) {
4023
+ this._input = input;
4024
+ this._inputSize = input.length;
4025
+ this._actions = actions;
4026
+ this._types = types;
4027
+ this._offset = 0;
4028
+ this._cache = {};
4029
+ this._failure = 0;
4030
+ this._expected = [];
4031
+ };
4032
+
4033
+ Parser.prototype.parse = function() {
4034
+ var tree = this._read_root();
4035
+ if (tree !== FAILURE && this._offset === this._inputSize) {
4036
+ return tree;
4037
+ }
4038
+ if (this._expected.length === 0) {
4039
+ this._failure = this._offset;
4040
+ this._expected.push('<EOF>');
4041
+ }
4042
+ this.constructor.lastError = {offset: this._offset, expected: this._expected};
4043
+ throw new SyntaxError(formatError(this._input, this._failure, this._expected));
4044
+ };
4045
+
4046
+ var parse = function(input, options) {
4047
+ options = options || {};
4048
+ var parser = new Parser(input, options.actions, options.types);
4049
+ return parser.parse();
4050
+ };
4051
+ extend(Parser.prototype, Grammar);
4052
+
4053
+ var exported = {Grammar: Grammar, Parser: Parser, parse: parse};
4054
+
4055
+ if (typeof require === 'function' && typeof exports === 'object') {
4056
+ extend(exports, exported);
4057
+ } else {
4058
+ var namespace = typeof this !== 'undefined' ? this : window;
4059
+ namespace.ExtendedJSON = exported;
4060
+ }
4061
+ })();