mongo-ejson 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a49c9eb4244ffbc3e86d08db3c5ed6d2d5a01df835beecef11200fa221234cd
4
- data.tar.gz: 84caa949ebdf44a5a13dfcf82453c5be1b7e5367c5d705421b6b4d3bce6dfd5d
3
+ metadata.gz: b1ce960773c83d4949d1e3b445c1e65d233405f42c9af80d5bb47f387c5d9a88
4
+ data.tar.gz: 42b8072fe45e9edf985ff146de9f0d8319b11aed523fe53238b2844c777e66f7
5
5
  SHA512:
6
- metadata.gz: 36895e58e393acff8d26cfa07fa39c995a4db289c121cba1e0fa9066d3dcc3b5fb6957a6d67f9eb0f4ecac1adfa18c1a05a0b0feb70b192c388de0bdc0176f22
7
- data.tar.gz: 6ccba4c55fd658d828eaceca7d482551f3a4278be4054ca27eada96f6c8001f13db9752edd3dfdd24761e602a5c4a3d86943ff89e9dca38a52705eaa9d6dd6f5
6
+ metadata.gz: 56f35b1e82bc511410c8d64880db49923e4ca859f505143b4eb0f3e00ae351914416b7d7573429f0cc46a47bf29dcdfd86c625b558bc51461201063aa7b53f8c
7
+ data.tar.gz: 59f9415a00e6238dc42be12a8f501e0849d7eccb946eca2bd9659e7e49d3eada33f7634027ca0e2039be7398649927a88a2b62738edd33507e15a127c89d8a86
data/.gitignore CHANGED
@@ -6,6 +6,7 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ *.gem
9
10
 
10
11
  # rspec failure tracking
11
12
  .rspec_status
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mongo-ejson (0.2.2)
4
+ mongo-ejson (0.2.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -55,4 +55,4 @@ DEPENDENCIES
55
55
  rubocop (~> 0.63)
56
56
 
57
57
  BUNDLED WITH
58
- 2.0.1
58
+ 2.1.4
data/Rakefile CHANGED
@@ -21,6 +21,6 @@ task test: [:compile_ruby, :spec] do
21
21
  end
22
22
 
23
23
  desc 'Prepare assets'
24
- task assets: [:test, :compile_js] do
24
+ task assets: [:test, :compile_js, :compile_ruby] do
25
25
  mv 'src/ejson.js', 'vendor/assets/javascripts/ejson.js'
26
26
  end
@@ -1,3 +1,3 @@
1
1
  class EJSON
2
- VERSION = '0.2.3'.freeze
2
+ VERSION = '0.2.4'.freeze
3
3
  end
@@ -58,7 +58,6 @@
58
58
 
59
59
  var TreeNode1 = function(text, offset, elements) {
60
60
  TreeNode.apply(this, arguments);
61
- this['string'] = elements[0];
62
61
  this['value'] = elements[1];
63
62
  };
64
63
  inherit(TreeNode1, TreeNode);
@@ -89,119 +88,137 @@
89
88
 
90
89
  var TreeNode6 = function(text, offset, elements) {
91
90
  TreeNode.apply(this, arguments);
92
- this['hex_value'] = elements[0];
91
+ this['identifier_start'] = elements[0];
93
92
  };
94
93
  inherit(TreeNode6, TreeNode);
95
94
 
96
95
  var TreeNode7 = function(text, offset, elements) {
97
96
  TreeNode.apply(this, arguments);
98
- this['hex_value'] = elements[0];
97
+ this['unicode_escape'] = elements[1];
99
98
  };
100
99
  inherit(TreeNode7, TreeNode);
101
100
 
102
101
  var TreeNode8 = function(text, offset, elements) {
103
102
  TreeNode.apply(this, arguments);
104
- this['integer_number'] = elements[0];
103
+ this['hex_digit'] = elements[4];
105
104
  };
106
105
  inherit(TreeNode8, TreeNode);
107
106
 
108
107
  var TreeNode9 = function(text, offset, elements) {
109
108
  TreeNode.apply(this, arguments);
110
- this['integer_number'] = elements[0];
109
+ this['hex_value'] = elements[0];
111
110
  };
112
111
  inherit(TreeNode9, TreeNode);
113
112
 
114
113
  var TreeNode10 = function(text, offset, elements) {
115
114
  TreeNode.apply(this, arguments);
116
- this['number'] = elements[0];
115
+ this['hex_value'] = elements[0];
117
116
  };
118
117
  inherit(TreeNode10, TreeNode);
119
118
 
120
119
  var TreeNode11 = function(text, offset, elements) {
121
120
  TreeNode.apply(this, arguments);
122
- this['number'] = elements[0];
121
+ this['integer_number'] = elements[0];
123
122
  };
124
123
  inherit(TreeNode11, TreeNode);
125
124
 
126
125
  var TreeNode12 = function(text, offset, elements) {
127
126
  TreeNode.apply(this, arguments);
128
- this['base64_value'] = elements[0];
127
+ this['integer_number'] = elements[0];
129
128
  };
130
129
  inherit(TreeNode12, TreeNode);
131
130
 
132
131
  var TreeNode13 = function(text, offset, elements) {
133
132
  TreeNode.apply(this, arguments);
134
- this['base64_value'] = elements[0];
133
+ this['number'] = elements[0];
135
134
  };
136
135
  inherit(TreeNode13, TreeNode);
137
136
 
138
137
  var TreeNode14 = function(text, offset, elements) {
139
138
  TreeNode.apply(this, arguments);
140
- this['integer'] = elements[1];
139
+ this['number'] = elements[0];
141
140
  };
142
141
  inherit(TreeNode14, TreeNode);
143
142
 
144
143
  var TreeNode15 = function(text, offset, elements) {
145
144
  TreeNode.apply(this, arguments);
146
- this['integer'] = elements[1];
145
+ this['base64_value'] = elements[0];
147
146
  };
148
147
  inherit(TreeNode15, TreeNode);
149
148
 
150
149
  var TreeNode16 = function(text, offset, elements) {
151
150
  TreeNode.apply(this, arguments);
152
- this['integer'] = elements[0];
151
+ this['base64_value'] = elements[0];
153
152
  };
154
153
  inherit(TreeNode16, TreeNode);
155
154
 
156
155
  var TreeNode17 = function(text, offset, elements) {
157
156
  TreeNode.apply(this, arguments);
158
- this['hex_string'] = elements[0];
157
+ this['integer'] = elements[1];
159
158
  };
160
159
  inherit(TreeNode17, TreeNode);
161
160
 
162
161
  var TreeNode18 = function(text, offset, elements) {
163
162
  TreeNode.apply(this, arguments);
164
- this['bin_data_type'] = elements[0];
165
- this['base64_string'] = elements[1];
163
+ this['integer'] = elements[1];
166
164
  };
167
165
  inherit(TreeNode18, TreeNode);
168
166
 
169
167
  var TreeNode19 = function(text, offset, elements) {
170
168
  TreeNode.apply(this, arguments);
171
- this['integer_number'] = elements[1];
169
+ this['integer'] = elements[0];
172
170
  };
173
171
  inherit(TreeNode19, TreeNode);
174
172
 
175
173
  var TreeNode20 = function(text, offset, elements) {
176
174
  TreeNode.apply(this, arguments);
177
- this['number_long_value'] = elements[0];
175
+ this['hex_string'] = elements[0];
178
176
  };
179
177
  inherit(TreeNode20, TreeNode);
180
178
 
181
179
  var TreeNode21 = function(text, offset, elements) {
182
180
  TreeNode.apply(this, arguments);
183
- this['number_decimal_value'] = elements[0];
181
+ this['bin_data_type'] = elements[0];
182
+ this['base64_string'] = elements[1];
184
183
  };
185
184
  inherit(TreeNode21, TreeNode);
186
185
 
187
186
  var TreeNode22 = function(text, offset, elements) {
188
187
  TreeNode.apply(this, arguments);
189
- this['date_value'] = elements[0];
188
+ this['integer_number'] = elements[1];
190
189
  };
191
190
  inherit(TreeNode22, TreeNode);
192
191
 
193
192
  var TreeNode23 = function(text, offset, elements) {
194
193
  TreeNode.apply(this, arguments);
195
- this['string'] = elements[1];
194
+ this['number_long_value'] = elements[0];
196
195
  };
197
196
  inherit(TreeNode23, TreeNode);
198
197
 
199
198
  var TreeNode24 = function(text, offset, elements) {
200
199
  TreeNode.apply(this, arguments);
201
- this['comma'] = elements[0];
200
+ this['number_decimal_value'] = elements[0];
202
201
  };
203
202
  inherit(TreeNode24, TreeNode);
204
203
 
204
+ var TreeNode25 = function(text, offset, elements) {
205
+ TreeNode.apply(this, arguments);
206
+ this['date_value'] = elements[0];
207
+ };
208
+ inherit(TreeNode25, TreeNode);
209
+
210
+ var TreeNode26 = function(text, offset, elements) {
211
+ TreeNode.apply(this, arguments);
212
+ this['string'] = elements[1];
213
+ };
214
+ inherit(TreeNode26, TreeNode);
215
+
216
+ var TreeNode27 = function(text, offset, elements) {
217
+ TreeNode.apply(this, arguments);
218
+ this['comma'] = elements[0];
219
+ };
220
+ inherit(TreeNode27, TreeNode);
221
+
205
222
  var FAILURE = {};
206
223
 
207
224
  var Grammar = {
@@ -288,7 +305,15 @@
288
305
  address1 = this._read___();
289
306
  if (address1 !== FAILURE) {
290
307
  var address2 = FAILURE;
308
+ var index2 = this._offset;
291
309
  address2 = this._read_string();
310
+ if (address2 === FAILURE) {
311
+ this._offset = index2;
312
+ address2 = this._read_identifier();
313
+ if (address2 === FAILURE) {
314
+ this._offset = index2;
315
+ }
316
+ }
292
317
  if (address2 !== FAILURE) {
293
318
  elements0[0] = address2;
294
319
  var address3 = FAILURE;
@@ -838,6 +863,361 @@
838
863
  return address0;
839
864
  },
840
865
 
866
+ _read_identifier: function() {
867
+ var address0 = FAILURE, index0 = this._offset;
868
+ this._cache._identifier = this._cache._identifier || {};
869
+ var cached = this._cache._identifier[index0];
870
+ if (cached) {
871
+ this._offset = cached[1];
872
+ return cached[0];
873
+ }
874
+ var index1 = this._offset, elements0 = new Array(2);
875
+ var address1 = FAILURE;
876
+ address1 = this._read_identifier_start();
877
+ if (address1 !== FAILURE) {
878
+ elements0[0] = address1;
879
+ var address2 = FAILURE;
880
+ var remaining0 = 1, index2 = this._offset, elements1 = [], address3 = true;
881
+ while (address3 !== FAILURE) {
882
+ address3 = this._read_identifier_part();
883
+ if (address3 !== FAILURE) {
884
+ elements1.push(address3);
885
+ --remaining0;
886
+ }
887
+ }
888
+ if (remaining0 <= 0) {
889
+ address2 = new TreeNode(this._input.substring(index2, this._offset), index2, elements1);
890
+ this._offset = this._offset;
891
+ } else {
892
+ address2 = FAILURE;
893
+ }
894
+ if (address2 !== FAILURE) {
895
+ elements0[1] = address2;
896
+ } else {
897
+ elements0 = null;
898
+ this._offset = index1;
899
+ }
900
+ } else {
901
+ elements0 = null;
902
+ this._offset = index1;
903
+ }
904
+ if (elements0 === null) {
905
+ address0 = FAILURE;
906
+ } else {
907
+ address0 = this._actions.make_identifier(this._input, index1, this._offset, elements0);
908
+ this._offset = this._offset;
909
+ }
910
+ this._cache._identifier[index0] = [address0, this._offset];
911
+ return address0;
912
+ },
913
+
914
+ _read_identifier_start: function() {
915
+ var address0 = FAILURE, index0 = this._offset;
916
+ this._cache._identifier_start = this._cache._identifier_start || {};
917
+ var cached = this._cache._identifier_start[index0];
918
+ if (cached) {
919
+ this._offset = cached[1];
920
+ return cached[0];
921
+ }
922
+ var index1 = this._offset;
923
+ address0 = this._read_unicode_letter();
924
+ if (address0 === FAILURE) {
925
+ this._offset = index1;
926
+ var chunk0 = null;
927
+ if (this._offset < this._inputSize) {
928
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
929
+ }
930
+ if (chunk0 === '$') {
931
+ address0 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
932
+ this._offset = this._offset + 1;
933
+ } else {
934
+ address0 = FAILURE;
935
+ if (this._offset > this._failure) {
936
+ this._failure = this._offset;
937
+ this._expected = [];
938
+ }
939
+ if (this._offset === this._failure) {
940
+ this._expected.push('"$"');
941
+ }
942
+ }
943
+ if (address0 === FAILURE) {
944
+ this._offset = index1;
945
+ var chunk1 = null;
946
+ if (this._offset < this._inputSize) {
947
+ chunk1 = this._input.substring(this._offset, this._offset + 1);
948
+ }
949
+ if (chunk1 === '_') {
950
+ address0 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
951
+ this._offset = this._offset + 1;
952
+ } else {
953
+ address0 = FAILURE;
954
+ if (this._offset > this._failure) {
955
+ this._failure = this._offset;
956
+ this._expected = [];
957
+ }
958
+ if (this._offset === this._failure) {
959
+ this._expected.push('"_"');
960
+ }
961
+ }
962
+ if (address0 === FAILURE) {
963
+ this._offset = index1;
964
+ var index2 = this._offset, elements0 = new Array(2);
965
+ var address1 = FAILURE;
966
+ var chunk2 = null;
967
+ if (this._offset < this._inputSize) {
968
+ chunk2 = this._input.substring(this._offset, this._offset + 1);
969
+ }
970
+ if (chunk2 === '\\') {
971
+ address1 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
972
+ this._offset = this._offset + 1;
973
+ } else {
974
+ address1 = FAILURE;
975
+ if (this._offset > this._failure) {
976
+ this._failure = this._offset;
977
+ this._expected = [];
978
+ }
979
+ if (this._offset === this._failure) {
980
+ this._expected.push('"\\\\"');
981
+ }
982
+ }
983
+ if (address1 !== FAILURE) {
984
+ elements0[0] = address1;
985
+ var address2 = FAILURE;
986
+ address2 = this._read_unicode_escape();
987
+ if (address2 !== FAILURE) {
988
+ elements0[1] = address2;
989
+ } else {
990
+ elements0 = null;
991
+ this._offset = index2;
992
+ }
993
+ } else {
994
+ elements0 = null;
995
+ this._offset = index2;
996
+ }
997
+ if (elements0 === null) {
998
+ address0 = FAILURE;
999
+ } else {
1000
+ address0 = new TreeNode7(this._input.substring(index2, this._offset), index2, elements0);
1001
+ this._offset = this._offset;
1002
+ }
1003
+ if (address0 === FAILURE) {
1004
+ this._offset = index1;
1005
+ }
1006
+ }
1007
+ }
1008
+ }
1009
+ this._cache._identifier_start[index0] = [address0, this._offset];
1010
+ return address0;
1011
+ },
1012
+
1013
+ _read_identifier_part: function() {
1014
+ var address0 = FAILURE, index0 = this._offset;
1015
+ this._cache._identifier_part = this._cache._identifier_part || {};
1016
+ var cached = this._cache._identifier_part[index0];
1017
+ if (cached) {
1018
+ this._offset = cached[1];
1019
+ return cached[0];
1020
+ }
1021
+ var index1 = this._offset;
1022
+ address0 = this._read_unicode_letter();
1023
+ if (address0 === FAILURE) {
1024
+ this._offset = index1;
1025
+ address0 = this._read_unicode_digit();
1026
+ if (address0 === FAILURE) {
1027
+ this._offset = index1;
1028
+ address0 = this._read_unicode_conn_punct();
1029
+ if (address0 === FAILURE) {
1030
+ this._offset = index1;
1031
+ }
1032
+ }
1033
+ }
1034
+ this._cache._identifier_part[index0] = [address0, this._offset];
1035
+ return address0;
1036
+ },
1037
+
1038
+ _read_unicode_combining: function() {
1039
+ var address0 = FAILURE, index0 = this._offset;
1040
+ this._cache._unicode_combining = this._cache._unicode_combining || {};
1041
+ var cached = this._cache._unicode_combining[index0];
1042
+ if (cached) {
1043
+ this._offset = cached[1];
1044
+ return cached[0];
1045
+ }
1046
+ var index1 = this._offset;
1047
+ address0 = this._read_unicode_non_spacing();
1048
+ if (address0 === FAILURE) {
1049
+ this._offset = index1;
1050
+ address0 = this._read_unicode_comb_spacing();
1051
+ if (address0 === FAILURE) {
1052
+ this._offset = index1;
1053
+ }
1054
+ }
1055
+ this._cache._unicode_combining[index0] = [address0, this._offset];
1056
+ return address0;
1057
+ },
1058
+
1059
+ _read_unicode_escape: function() {
1060
+ var address0 = FAILURE, index0 = this._offset;
1061
+ this._cache._unicode_escape = this._cache._unicode_escape || {};
1062
+ var cached = this._cache._unicode_escape[index0];
1063
+ if (cached) {
1064
+ this._offset = cached[1];
1065
+ return cached[0];
1066
+ }
1067
+ var index1 = this._offset, elements0 = new Array(5);
1068
+ var address1 = FAILURE;
1069
+ var chunk0 = null;
1070
+ if (this._offset < this._inputSize) {
1071
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
1072
+ }
1073
+ if (chunk0 === 'u') {
1074
+ address1 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
1075
+ this._offset = this._offset + 1;
1076
+ } else {
1077
+ address1 = FAILURE;
1078
+ if (this._offset > this._failure) {
1079
+ this._failure = this._offset;
1080
+ this._expected = [];
1081
+ }
1082
+ if (this._offset === this._failure) {
1083
+ this._expected.push('"u"');
1084
+ }
1085
+ }
1086
+ if (address1 !== FAILURE) {
1087
+ elements0[0] = address1;
1088
+ var address2 = FAILURE;
1089
+ address2 = this._read_hex_digit();
1090
+ if (address2 !== FAILURE) {
1091
+ elements0[1] = address2;
1092
+ var address3 = FAILURE;
1093
+ address3 = this._read_hex_digit();
1094
+ if (address3 !== FAILURE) {
1095
+ elements0[2] = address3;
1096
+ var address4 = FAILURE;
1097
+ address4 = this._read_hex_digit();
1098
+ if (address4 !== FAILURE) {
1099
+ elements0[3] = address4;
1100
+ var address5 = FAILURE;
1101
+ address5 = this._read_hex_digit();
1102
+ if (address5 !== FAILURE) {
1103
+ elements0[4] = address5;
1104
+ } else {
1105
+ elements0 = null;
1106
+ this._offset = index1;
1107
+ }
1108
+ } else {
1109
+ elements0 = null;
1110
+ this._offset = index1;
1111
+ }
1112
+ } else {
1113
+ elements0 = null;
1114
+ this._offset = index1;
1115
+ }
1116
+ } else {
1117
+ elements0 = null;
1118
+ this._offset = index1;
1119
+ }
1120
+ } else {
1121
+ elements0 = null;
1122
+ this._offset = index1;
1123
+ }
1124
+ if (elements0 === null) {
1125
+ address0 = FAILURE;
1126
+ } else {
1127
+ address0 = new TreeNode8(this._input.substring(index1, this._offset), index1, elements0);
1128
+ this._offset = this._offset;
1129
+ }
1130
+ this._cache._unicode_escape[index0] = [address0, this._offset];
1131
+ return address0;
1132
+ },
1133
+
1134
+ _read_unicode_letter: function() {
1135
+ var address0 = FAILURE, index0 = this._offset;
1136
+ this._cache._unicode_letter = this._cache._unicode_letter || {};
1137
+ var cached = this._cache._unicode_letter[index0];
1138
+ if (cached) {
1139
+ this._offset = cached[1];
1140
+ return cached[0];
1141
+ }
1142
+ var chunk0 = null;
1143
+ if (this._offset < this._inputSize) {
1144
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
1145
+ }
1146
+ if (chunk0 !== null && /^[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]/.test(chunk0)) {
1147
+ address0 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
1148
+ this._offset = this._offset + 1;
1149
+ } else {
1150
+ address0 = FAILURE;
1151
+ if (this._offset > this._failure) {
1152
+ this._failure = this._offset;
1153
+ this._expected = [];
1154
+ }
1155
+ if (this._offset === this._failure) {
1156
+ this._expected.push('[a-zA-Z\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]');
1157
+ }
1158
+ }
1159
+ this._cache._unicode_letter[index0] = [address0, this._offset];
1160
+ return address0;
1161
+ },
1162
+
1163
+ _read_unicode_digit: function() {
1164
+ var address0 = FAILURE, index0 = this._offset;
1165
+ this._cache._unicode_digit = this._cache._unicode_digit || {};
1166
+ var cached = this._cache._unicode_digit[index0];
1167
+ if (cached) {
1168
+ this._offset = cached[1];
1169
+ return cached[0];
1170
+ }
1171
+ var chunk0 = null;
1172
+ if (this._offset < this._inputSize) {
1173
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
1174
+ }
1175
+ if (chunk0 !== null && /^[0-9]/.test(chunk0)) {
1176
+ address0 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
1177
+ this._offset = this._offset + 1;
1178
+ } else {
1179
+ address0 = FAILURE;
1180
+ if (this._offset > this._failure) {
1181
+ this._failure = this._offset;
1182
+ this._expected = [];
1183
+ }
1184
+ if (this._offset === this._failure) {
1185
+ this._expected.push('[0-9]');
1186
+ }
1187
+ }
1188
+ this._cache._unicode_digit[index0] = [address0, this._offset];
1189
+ return address0;
1190
+ },
1191
+
1192
+ _read_unicode_conn_punct: function() {
1193
+ var address0 = FAILURE, index0 = this._offset;
1194
+ this._cache._unicode_conn_punct = this._cache._unicode_conn_punct || {};
1195
+ var cached = this._cache._unicode_conn_punct[index0];
1196
+ if (cached) {
1197
+ this._offset = cached[1];
1198
+ return cached[0];
1199
+ }
1200
+ var chunk0 = null;
1201
+ if (this._offset < this._inputSize) {
1202
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
1203
+ }
1204
+ if (chunk0 !== null && /^[_\u203F\u2040\u2054\uFE33\uFE34\uFE4D-\uFE4F\uFF3F]/.test(chunk0)) {
1205
+ address0 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
1206
+ this._offset = this._offset + 1;
1207
+ } else {
1208
+ address0 = FAILURE;
1209
+ if (this._offset > this._failure) {
1210
+ this._failure = this._offset;
1211
+ this._expected = [];
1212
+ }
1213
+ if (this._offset === this._failure) {
1214
+ this._expected.push('[_\\u203F\\u2040\\u2054\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFF3F]');
1215
+ }
1216
+ }
1217
+ this._cache._unicode_conn_punct[index0] = [address0, this._offset];
1218
+ return address0;
1219
+ },
1220
+
841
1221
  _read_double_quote_string: function() {
842
1222
  var address0 = FAILURE, index0 = this._offset;
843
1223
  this._cache._double_quote_string = this._cache._double_quote_string || {};
@@ -876,7 +1256,11 @@
876
1256
  if (address4 !== FAILURE) {
877
1257
  elements2[0] = address4;
878
1258
  var address5 = FAILURE;
1259
+ var chunk1 = null;
879
1260
  if (this._offset < this._inputSize) {
1261
+ chunk1 = this._input.substring(this._offset, this._offset + 1);
1262
+ }
1263
+ if (chunk1 !== null && /^[^\b\t\n\v\f\r]/.test(chunk1)) {
880
1264
  address5 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
881
1265
  this._offset = this._offset + 1;
882
1266
  } else {
@@ -886,7 +1270,7 @@
886
1270
  this._expected = [];
887
1271
  }
888
1272
  if (this._offset === this._failure) {
889
- this._expected.push('<any char>');
1273
+ this._expected.push('[^\\b\\t\\n\\v\\f\\r]');
890
1274
  }
891
1275
  }
892
1276
  if (address5 !== FAILURE) {
@@ -907,11 +1291,11 @@
907
1291
  }
908
1292
  if (address3 === FAILURE) {
909
1293
  this._offset = index3;
910
- var chunk1 = null;
1294
+ var chunk2 = null;
911
1295
  if (this._offset < this._inputSize) {
912
- chunk1 = this._input.substring(this._offset, this._offset + 1);
1296
+ chunk2 = this._input.substring(this._offset, this._offset + 1);
913
1297
  }
914
- if (chunk1 !== null && /^[^"]/.test(chunk1)) {
1298
+ if (chunk2 !== null && /^[^"\b\t\n\v\f\r]/.test(chunk2)) {
915
1299
  address3 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
916
1300
  this._offset = this._offset + 1;
917
1301
  } else {
@@ -921,7 +1305,7 @@
921
1305
  this._expected = [];
922
1306
  }
923
1307
  if (this._offset === this._failure) {
924
- this._expected.push('[^"]');
1308
+ this._expected.push('[^"\\b\\t\\n\\v\\f\\r]');
925
1309
  }
926
1310
  }
927
1311
  if (address3 === FAILURE) {
@@ -1004,7 +1388,11 @@
1004
1388
  if (address4 !== FAILURE) {
1005
1389
  elements2[0] = address4;
1006
1390
  var address5 = FAILURE;
1391
+ var chunk1 = null;
1007
1392
  if (this._offset < this._inputSize) {
1393
+ chunk1 = this._input.substring(this._offset, this._offset + 1);
1394
+ }
1395
+ if (chunk1 !== null && /^[^\b\t\n\v\f\r]/.test(chunk1)) {
1008
1396
  address5 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
1009
1397
  this._offset = this._offset + 1;
1010
1398
  } else {
@@ -1014,7 +1402,7 @@
1014
1402
  this._expected = [];
1015
1403
  }
1016
1404
  if (this._offset === this._failure) {
1017
- this._expected.push('<any char>');
1405
+ this._expected.push('[^\\b\\t\\n\\v\\f\\r]');
1018
1406
  }
1019
1407
  }
1020
1408
  if (address5 !== FAILURE) {
@@ -1035,11 +1423,11 @@
1035
1423
  }
1036
1424
  if (address3 === FAILURE) {
1037
1425
  this._offset = index3;
1038
- var chunk1 = null;
1426
+ var chunk2 = null;
1039
1427
  if (this._offset < this._inputSize) {
1040
- chunk1 = this._input.substring(this._offset, this._offset + 1);
1428
+ chunk2 = this._input.substring(this._offset, this._offset + 1);
1041
1429
  }
1042
- if (chunk1 !== null && /^[^']/.test(chunk1)) {
1430
+ if (chunk2 !== null && /^[^'\b\t\n\v\f\r]/.test(chunk2)) {
1043
1431
  address3 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
1044
1432
  this._offset = this._offset + 1;
1045
1433
  } else {
@@ -1049,7 +1437,7 @@
1049
1437
  this._expected = [];
1050
1438
  }
1051
1439
  if (this._offset === this._failure) {
1052
- this._expected.push('[^\']');
1440
+ this._expected.push('[^\'\\b\\t\\n\\v\\f\\r]');
1053
1441
  }
1054
1442
  }
1055
1443
  if (address3 === FAILURE) {
@@ -1125,23 +1513,7 @@
1125
1513
  }
1126
1514
  var remaining0 = 1, index1 = this._offset, elements0 = [], address1 = true;
1127
1515
  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
- }
1516
+ address1 = this._read_hex_digit();
1145
1517
  if (address1 !== FAILURE) {
1146
1518
  elements0.push(address1);
1147
1519
  --remaining0;
@@ -3547,6 +3919,35 @@
3547
3919
  return address0;
3548
3920
  },
3549
3921
 
3922
+ _read_hex_digit: function() {
3923
+ var address0 = FAILURE, index0 = this._offset;
3924
+ this._cache._hex_digit = this._cache._hex_digit || {};
3925
+ var cached = this._cache._hex_digit[index0];
3926
+ if (cached) {
3927
+ this._offset = cached[1];
3928
+ return cached[0];
3929
+ }
3930
+ var chunk0 = null;
3931
+ if (this._offset < this._inputSize) {
3932
+ chunk0 = this._input.substring(this._offset, this._offset + 1);
3933
+ }
3934
+ if (chunk0 !== null && /^[a-fA-F0-9]/.test(chunk0)) {
3935
+ address0 = new TreeNode(this._input.substring(this._offset, this._offset + 1), this._offset);
3936
+ this._offset = this._offset + 1;
3937
+ } else {
3938
+ address0 = FAILURE;
3939
+ if (this._offset > this._failure) {
3940
+ this._failure = this._offset;
3941
+ this._expected = [];
3942
+ }
3943
+ if (this._offset === this._failure) {
3944
+ this._expected.push('[a-fA-F0-9]');
3945
+ }
3946
+ }
3947
+ this._cache._hex_digit[index0] = [address0, this._offset];
3948
+ return address0;
3949
+ },
3950
+
3550
3951
  _read_comment: function() {
3551
3952
  var address0 = FAILURE, index0 = this._offset;
3552
3953
  this._cache._comment = this._cache._comment || {};
@@ -3699,7 +4100,7 @@
3699
4100
  if (elements0 === null) {
3700
4101
  address0 = FAILURE;
3701
4102
  } else {
3702
- address0 = new TreeNode24(this._input.substring(index1, this._offset), index1, elements0);
4103
+ address0 = new TreeNode27(this._input.substring(index1, this._offset), index1, elements0);
3703
4104
  this._offset = this._offset;
3704
4105
  }
3705
4106
  this._cache._delimiter[index0] = [address0, this._offset];
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo-ejson
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Bondar