functionalscript 0.6.8 → 0.6.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -59,16 +59,20 @@ const isValueToken = token => {
59
59
  }
60
60
  };
61
61
  const parseValueOp = token => state => {
62
- if (isValueToken(token)) {
63
- return pushValue(state)(tokenToValue(token));
64
- }
65
- if (token.kind === '[') {
66
- return startArray(state);
67
- }
68
- if (token.kind === '{') {
69
- return startObject(state);
62
+ switch (token.kind) {
63
+ case ']':
64
+ if (state.status === '[,') {
65
+ return endArray(state);
66
+ }
67
+ return { status: 'error', message: 'unexpected token' };
68
+ case '[': return startArray(state);
69
+ case '{': return startObject(state);
70
+ default:
71
+ if (isValueToken(token)) {
72
+ return pushValue(state)(tokenToValue(token));
73
+ }
74
+ return { status: 'error', message: 'unexpected token' };
70
75
  }
71
- return { status: 'error', message: 'unexpected token' };
72
76
  };
73
77
  const parseArrayStartOp = token => state => {
74
78
  if (isValueToken(token)) {
@@ -119,12 +123,17 @@ const parseObjectNextOp = token => state => {
119
123
  return { status: 'error', message: 'unexpected token' };
120
124
  };
121
125
  const parseObjectCommaOp = token => state => {
126
+ if (token.kind === '}') {
127
+ return endObject(state);
128
+ }
122
129
  if (token.kind === 'string') {
123
130
  return pushKey(state)(token.value);
124
131
  }
125
132
  return { status: 'error', message: 'unexpected token' };
126
133
  };
127
134
  const foldOp = token => state => {
135
+ if (token.kind === 'eof')
136
+ return state;
128
137
  switch (state.status) {
129
138
  case 'result': return { status: 'error', message: 'unexpected token' };
130
139
  case 'error': return { status: 'error', message: state.message };
@@ -121,6 +121,22 @@ export default {
121
121
  if (result !== '["ok",{"a":{"b":{"c":["d"]}}}]') {
122
122
  throw result;
123
123
  }
124
+ },
125
+ () => {
126
+ const tokenList = tokenizeString('[1,]');
127
+ const obj = parser.parse(tokenList);
128
+ const result = stringify(obj);
129
+ if (result !== '["ok",[1]]') {
130
+ throw result;
131
+ }
132
+ },
133
+ () => {
134
+ const tokenList = tokenizeString('{"a":1,}');
135
+ const obj = parser.parse(tokenList);
136
+ const result = stringify(obj);
137
+ if (result !== '["ok",{"a":1}]') {
138
+ throw result;
139
+ }
124
140
  }
125
141
  ],
126
142
  invalid: [
@@ -180,14 +196,6 @@ export default {
180
196
  throw result;
181
197
  }
182
198
  },
183
- () => {
184
- const tokenList = tokenizeString('[1,]');
185
- const obj = parser.parse(tokenList);
186
- const result = stringify(obj);
187
- if (result !== '["error","unexpected token"]') {
188
- throw result;
189
- }
190
- },
191
199
  () => {
192
200
  const tokenList = tokenizeString('[,1]');
193
201
  const obj = parser.parse(tokenList);
@@ -268,14 +276,6 @@ export default {
268
276
  throw result;
269
277
  }
270
278
  },
271
- () => {
272
- const tokenList = tokenizeString('{"1":2,}');
273
- const obj = parser.parse(tokenList);
274
- const result = stringify(obj);
275
- if (result !== '["error","unexpected token"]') {
276
- throw result;
277
- }
278
- },
279
279
  () => {
280
280
  const tokenList = tokenizeString('{,"1":2}');
281
281
  const obj = parser.parse(tokenList);
@@ -4,5 +4,5 @@ export type JsonToken = {
4
4
  readonly kind: 'true' | 'false' | 'null';
5
5
  } | {
6
6
  readonly kind: '{' | '}' | ':' | ',' | '[' | ']';
7
- } | jsTokenizer.StringToken | jsTokenizer.NumberToken | jsTokenizer.ErrorToken;
7
+ } | jsTokenizer.StringToken | jsTokenizer.NumberToken | jsTokenizer.ErrorToken | jsTokenizer.EofToken;
8
8
  export declare const tokenize: (input: list.List<number>) => list.List<JsonToken>;
@@ -16,6 +16,7 @@ const mapToken = input => {
16
16
  case 'null':
17
17
  case 'string':
18
18
  case 'number':
19
+ case 'eof':
19
20
  case 'error': return [input];
20
21
  case 'ws':
21
22
  case 'nl': return empty;
@@ -25,18 +26,18 @@ const mapToken = input => {
25
26
  const parseDefaultState = input => {
26
27
  if (input === null)
27
28
  return [empty, { kind: 'def' }];
28
- switch (input.kind) {
29
+ switch (input.token.kind) {
29
30
  case '-': return [empty, { kind: '-' }];
30
- default: return [mapToken(input), { kind: 'def' }];
31
+ default: return [mapToken(input.token), { kind: 'def' }];
31
32
  }
32
33
  };
33
34
  const parseMinusState = input => {
34
35
  if (input === null)
35
36
  return [[{ kind: 'error', message: 'invalid token' }], { kind: 'def' }];
36
- switch (input.kind) {
37
+ switch (input.token.kind) {
37
38
  case '-': return [[{ kind: 'error', message: 'invalid token' }], { kind: '-' }];
38
- case 'number': return [[{ kind: 'number', bf: multiply(input.bf)(-1n), value: `-${input.value}` }], { kind: 'def' }];
39
- default: return [{ first: { kind: 'error', message: 'invalid token' }, tail: mapToken(input) }, { kind: 'def' }];
39
+ case 'number': return [[{ kind: 'number', bf: multiply(input.token.bf)(-1n), value: `-${input.token.value}` }], { kind: 'def' }];
40
+ default: return [{ first: { kind: 'error', message: 'invalid token' }, tail: mapToken(input.token) }, { kind: 'def' }];
40
41
  }
41
42
  };
42
43
  const scanToken = state => input => {
@@ -46,6 +47,6 @@ const scanToken = state => input => {
46
47
  }
47
48
  };
48
49
  export const tokenize = (input) => {
49
- const jsTokens = jsTokenizer.tokenize(input);
50
+ const jsTokens = jsTokenizer.tokenize(input)('');
50
51
  return flat(stateScan(scanToken)({ kind: 'def' })(list.concat(jsTokens)([null])));
51
52
  };
@@ -10,356 +10,356 @@ const stringify = serializer.stringifyAsTree(sort);
10
10
  export default {
11
11
  json: [
12
12
  () => {
13
- const result = tokenizeString('');
14
- if (result.length !== 0) {
13
+ const result = stringify(tokenizeString(''));
14
+ if (result !== '[{"kind":"eof"}]') {
15
15
  throw result;
16
16
  }
17
17
  },
18
18
  () => {
19
19
  const result = stringify(tokenizeString('{'));
20
- if (result !== '[{"kind":"{"}]') {
20
+ if (result !== '[{"kind":"{"},{"kind":"eof"}]') {
21
21
  throw result;
22
22
  }
23
23
  },
24
24
  () => {
25
25
  const result = stringify(tokenizeString('}'));
26
- if (result !== '[{"kind":"}"}]') {
26
+ if (result !== '[{"kind":"}"},{"kind":"eof"}]') {
27
27
  throw result;
28
28
  }
29
29
  },
30
30
  () => {
31
31
  const result = stringify(tokenizeString(':'));
32
- if (result !== '[{"kind":":"}]') {
32
+ if (result !== '[{"kind":":"},{"kind":"eof"}]') {
33
33
  throw result;
34
34
  }
35
35
  },
36
36
  () => {
37
37
  const result = stringify(tokenizeString(','));
38
- if (result !== '[{"kind":","}]') {
38
+ if (result !== '[{"kind":","},{"kind":"eof"}]') {
39
39
  throw result;
40
40
  }
41
41
  },
42
42
  () => {
43
43
  const result = stringify(tokenizeString('['));
44
- if (result !== '[{"kind":"["}]') {
44
+ if (result !== '[{"kind":"["},{"kind":"eof"}]') {
45
45
  throw result;
46
46
  }
47
47
  },
48
48
  () => {
49
49
  const result = stringify(tokenizeString(']'));
50
- if (result !== '[{"kind":"]"}]') {
50
+ if (result !== '[{"kind":"]"},{"kind":"eof"}]') {
51
51
  throw result;
52
52
  }
53
53
  },
54
54
  () => {
55
55
  const result = stringify(tokenizeString('ᄑ'));
56
- if (result !== '[{"kind":"error","message":"unexpected character"}]') {
56
+ if (result !== '[{"kind":"error","message":"unexpected character"},{"kind":"eof"}]') {
57
57
  throw result;
58
58
  }
59
59
  },
60
60
  () => {
61
61
  const result = stringify(tokenizeString('{ \t\n\r}'));
62
- if (result !== '[{"kind":"{"},{"kind":"}"}]') {
62
+ if (result !== '[{"kind":"{"},{"kind":"}"},{"kind":"eof"}]') {
63
63
  throw result;
64
64
  }
65
65
  },
66
66
  () => {
67
67
  const result = stringify(tokenizeString('""'));
68
- if (result !== '[{"kind":"string","value":""}]') {
68
+ if (result !== '[{"kind":"string","value":""},{"kind":"eof"}]') {
69
69
  throw result;
70
70
  }
71
71
  },
72
72
  () => {
73
73
  const result = stringify(tokenizeString('"value"'));
74
- if (result !== '[{"kind":"string","value":"value"}]') {
74
+ if (result !== '[{"kind":"string","value":"value"},{"kind":"eof"}]') {
75
75
  throw result;
76
76
  }
77
77
  },
78
78
  () => {
79
79
  const result = stringify(tokenizeString('"value'));
80
- if (result !== '[{"kind":"error","message":"\\" are missing"}]') {
80
+ if (result !== '[{"kind":"error","message":"\\" are missing"},{"kind":"eof"}]') {
81
81
  throw result;
82
82
  }
83
83
  },
84
84
  () => {
85
85
  const result = stringify(tokenizeString('"value1" "value2"'));
86
- if (result !== '[{"kind":"string","value":"value1"},{"kind":"string","value":"value2"}]') {
86
+ if (result !== '[{"kind":"string","value":"value1"},{"kind":"string","value":"value2"},{"kind":"eof"}]') {
87
87
  throw result;
88
88
  }
89
89
  },
90
90
  () => {
91
91
  const result = stringify(tokenizeString('"'));
92
- if (result !== '[{"kind":"error","message":"\\" are missing"}]') {
92
+ if (result !== '[{"kind":"error","message":"\\" are missing"},{"kind":"eof"}]') {
93
93
  throw result;
94
94
  }
95
95
  },
96
96
  () => {
97
97
  const result = stringify(tokenizeString('"\\\\"'));
98
- if (result !== '[{"kind":"string","value":"\\\\"}]') {
98
+ if (result !== '[{"kind":"string","value":"\\\\"},{"kind":"eof"}]') {
99
99
  throw result;
100
100
  }
101
101
  },
102
102
  () => {
103
103
  const result = stringify(tokenizeString('"\\""'));
104
- if (result !== '[{"kind":"string","value":"\\""}]') {
104
+ if (result !== '[{"kind":"string","value":"\\""},{"kind":"eof"}]') {
105
105
  throw result;
106
106
  }
107
107
  },
108
108
  () => {
109
109
  const result = stringify(tokenizeString('"\\/"'));
110
- if (result !== '[{"kind":"string","value":"/"}]') {
110
+ if (result !== '[{"kind":"string","value":"/"},{"kind":"eof"}]') {
111
111
  throw result;
112
112
  }
113
113
  },
114
114
  () => {
115
115
  const result = stringify(tokenizeString('"\\x"'));
116
- if (result !== '[{"kind":"error","message":"unescaped character"},{"kind":"string","value":"x"}]') {
116
+ if (result !== '[{"kind":"error","message":"unescaped character"},{"kind":"string","value":"x"},{"kind":"eof"}]') {
117
117
  throw result;
118
118
  }
119
119
  },
120
120
  () => {
121
121
  const result = stringify(tokenizeString('"\\'));
122
- if (result !== '[{"kind":"error","message":"\\" are missing"}]') {
122
+ if (result !== '[{"kind":"error","message":"\\" are missing"},{"kind":"eof"}]') {
123
123
  throw result;
124
124
  }
125
125
  },
126
126
  () => {
127
127
  const result = stringify(tokenizeString('"\\b\\f\\n\\r\\t"'));
128
- if (result !== '[{"kind":"string","value":"\\b\\f\\n\\r\\t"}]') {
128
+ if (result !== '[{"kind":"string","value":"\\b\\f\\n\\r\\t"},{"kind":"eof"}]') {
129
129
  throw result;
130
130
  }
131
131
  },
132
132
  () => {
133
133
  const result = stringify(tokenizeString('"\\u1234"'));
134
- if (result !== '[{"kind":"string","value":"ሴ"}]') {
134
+ if (result !== '[{"kind":"string","value":"ሴ"},{"kind":"eof"}]') {
135
135
  throw result;
136
136
  }
137
137
  },
138
138
  () => {
139
139
  const result = stringify(tokenizeString('"\\uaBcDEeFf"'));
140
- if (result !== '[{"kind":"string","value":"ꯍEeFf"}]') {
140
+ if (result !== '[{"kind":"string","value":"ꯍEeFf"},{"kind":"eof"}]') {
141
141
  throw result;
142
142
  }
143
143
  },
144
144
  () => {
145
145
  const result = stringify(tokenizeString('"\\uEeFg"'));
146
- if (result !== '[{"kind":"error","message":"invalid hex value"},{"kind":"string","value":"g"}]') {
146
+ if (result !== '[{"kind":"error","message":"invalid hex value"},{"kind":"string","value":"g"},{"kind":"eof"}]') {
147
147
  throw result;
148
148
  }
149
149
  },
150
150
  () => {
151
151
  const result = stringify(tokenizeString('0'));
152
- if (result !== '[{"bf":[0n,0],"kind":"number","value":"0"}]') {
152
+ if (result !== '[{"bf":[0n,0],"kind":"number","value":"0"},{"kind":"eof"}]') {
153
153
  throw result;
154
154
  }
155
155
  },
156
156
  () => {
157
157
  const result = stringify(tokenizeString('[0]'));
158
- if (result !== '[{"kind":"["},{"bf":[0n,0],"kind":"number","value":"0"},{"kind":"]"}]') {
158
+ if (result !== '[{"kind":"["},{"bf":[0n,0],"kind":"number","value":"0"},{"kind":"]"},{"kind":"eof"}]') {
159
159
  throw result;
160
160
  }
161
161
  },
162
162
  () => {
163
163
  const result = stringify(tokenizeString('00'));
164
- if (result !== '[{"kind":"error","message":"invalid number"}]') {
164
+ if (result !== '[{"kind":"error","message":"invalid number"},{"kind":"eof"}]') {
165
165
  throw result;
166
166
  }
167
167
  },
168
168
  () => {
169
169
  const result = stringify(tokenizeString('0abc,'));
170
- if (result !== '[{"kind":"error","message":"invalid number"},{"kind":"error","message":"invalid token"},{"kind":","}]') {
170
+ if (result !== '[{"kind":"error","message":"invalid number"},{"kind":"error","message":"invalid token"},{"kind":","},{"kind":"eof"}]') {
171
171
  throw result;
172
172
  }
173
173
  },
174
174
  () => {
175
175
  const result = stringify(tokenizeString('123456789012345678901234567890'));
176
- if (result !== '[{"bf":[123456789012345678901234567890n,0],"kind":"number","value":"123456789012345678901234567890"}]') {
176
+ if (result !== '[{"bf":[123456789012345678901234567890n,0],"kind":"number","value":"123456789012345678901234567890"},{"kind":"eof"}]') {
177
177
  throw result;
178
178
  }
179
179
  },
180
180
  () => {
181
181
  const result = stringify(tokenizeString('{90}'));
182
- if (result !== '[{"kind":"{"},{"bf":[90n,0],"kind":"number","value":"90"},{"kind":"}"}]') {
182
+ if (result !== '[{"kind":"{"},{"bf":[90n,0],"kind":"number","value":"90"},{"kind":"}"},{"kind":"eof"}]') {
183
183
  throw result;
184
184
  }
185
185
  },
186
186
  () => {
187
187
  const result = stringify(tokenizeString('1 2'));
188
- if (result !== '[{"bf":[1n,0],"kind":"number","value":"1"},{"bf":[2n,0],"kind":"number","value":"2"}]') {
188
+ if (result !== '[{"bf":[1n,0],"kind":"number","value":"1"},{"bf":[2n,0],"kind":"number","value":"2"},{"kind":"eof"}]') {
189
189
  throw result;
190
190
  }
191
191
  },
192
192
  () => {
193
193
  const result = stringify(tokenizeString('0. 2'));
194
- if (result !== '[{"kind":"error","message":"invalid number"},{"bf":[2n,0],"kind":"number","value":"2"}]') {
194
+ if (result !== '[{"kind":"error","message":"invalid number"},{"bf":[2n,0],"kind":"number","value":"2"},{"kind":"eof"}]') {
195
195
  throw result;
196
196
  }
197
197
  },
198
198
  () => {
199
199
  const result = stringify(tokenizeString('10-0'));
200
- if (result !== '[{"bf":[10n,0],"kind":"number","value":"10"},{"bf":[0n,0],"kind":"number","value":"-0"}]') {
200
+ if (result !== '[{"bf":[10n,0],"kind":"number","value":"10"},{"bf":[0n,0],"kind":"number","value":"-0"},{"kind":"eof"}]') {
201
201
  throw result;
202
202
  }
203
203
  },
204
204
  () => {
205
205
  const result = stringify(tokenizeString('9a:'));
206
- if (result !== '[{"kind":"error","message":"invalid number"},{"kind":"error","message":"invalid token"},{"kind":":"}]') {
206
+ if (result !== '[{"kind":"error","message":"invalid number"},{"kind":"error","message":"invalid token"},{"kind":":"},{"kind":"eof"}]') {
207
207
  throw result;
208
208
  }
209
209
  },
210
210
  () => {
211
211
  const result = stringify(tokenizeString('-10'));
212
- if (result !== '[{"bf":[-10n,0],"kind":"number","value":"-10"}]') {
212
+ if (result !== '[{"bf":[-10n,0],"kind":"number","value":"-10"},{"kind":"eof"}]') {
213
213
  throw result;
214
214
  }
215
215
  },
216
216
  () => {
217
217
  const result = stringify(tokenizeString('-'));
218
- if (result !== '[{"kind":"error","message":"invalid token"}]') {
218
+ if (result !== '[{"kind":"error","message":"invalid token"},{"kind":"eof"}]') {
219
219
  throw result;
220
220
  }
221
221
  },
222
222
  () => {
223
223
  const result = stringify(tokenizeString('--'));
224
- if (result !== '[{"kind":"error","message":"invalid token"}]') {
224
+ if (result !== '[{"kind":"error","message":"invalid token"},{"kind":"eof"}]') {
225
225
  throw result;
226
226
  }
227
227
  },
228
228
  () => {
229
229
  const result = stringify(tokenizeString('---'));
230
- if (result !== '[{"kind":"error","message":"invalid token"},{"kind":"error","message":"invalid token"}]') {
230
+ if (result !== '[{"kind":"error","message":"invalid token"},{"kind":"error","message":"invalid token"},{"kind":"eof"}]') {
231
231
  throw result;
232
232
  }
233
233
  },
234
234
  () => {
235
235
  const result = stringify(tokenizeString('-0'));
236
- if (result !== '[{"bf":[0n,0],"kind":"number","value":"-0"}]') {
236
+ if (result !== '[{"bf":[0n,0],"kind":"number","value":"-0"},{"kind":"eof"}]') {
237
237
  throw result;
238
238
  }
239
239
  },
240
240
  () => {
241
241
  const result = stringify(tokenizeString('-00'));
242
- if (result !== '[{"kind":"error","message":"invalid token"},{"kind":"error","message":"invalid number"}]') {
242
+ if (result !== '[{"kind":"error","message":"invalid token"},{"kind":"error","message":"invalid number"},{"kind":"eof"}]') {
243
243
  throw result;
244
244
  }
245
245
  },
246
246
  () => {
247
247
  const result = stringify(tokenizeString('-.123'));
248
- if (result !== '[{"kind":"error","message":"invalid token"},{"kind":"error","message":"invalid token"},{"bf":[123n,0],"kind":"number","value":"123"}]') {
248
+ if (result !== '[{"kind":"error","message":"invalid token"},{"kind":"error","message":"invalid token"},{"bf":[123n,0],"kind":"number","value":"123"},{"kind":"eof"}]') {
249
249
  throw result;
250
250
  }
251
251
  },
252
252
  () => {
253
253
  const result = stringify(tokenizeString('0.01'));
254
- if (result !== '[{"bf":[1n,-2],"kind":"number","value":"0.01"}]') {
254
+ if (result !== '[{"bf":[1n,-2],"kind":"number","value":"0.01"},{"kind":"eof"}]') {
255
255
  throw result;
256
256
  }
257
257
  },
258
258
  () => {
259
259
  const result = stringify(tokenizeString('-0.9'));
260
- if (result !== '[{"bf":[-9n,-1],"kind":"number","value":"-0.9"}]') {
260
+ if (result !== '[{"bf":[-9n,-1],"kind":"number","value":"-0.9"},{"kind":"eof"}]') {
261
261
  throw result;
262
262
  }
263
263
  },
264
264
  () => {
265
265
  const result = stringify(tokenizeString('-0.'));
266
- if (result !== '[{"kind":"error","message":"invalid token"},{"kind":"error","message":"invalid number"}]') {
266
+ if (result !== '[{"kind":"error","message":"invalid token"},{"kind":"error","message":"invalid number"},{"kind":"eof"}]') {
267
267
  throw result;
268
268
  }
269
269
  },
270
270
  () => {
271
271
  const result = stringify(tokenizeString('-0.]'));
272
- if (result !== '[{"kind":"error","message":"invalid token"},{"kind":"error","message":"invalid number"},{"kind":"]"}]') {
272
+ if (result !== '[{"kind":"error","message":"invalid token"},{"kind":"error","message":"invalid number"},{"kind":"]"},{"kind":"eof"}]') {
273
273
  throw result;
274
274
  }
275
275
  },
276
276
  () => {
277
277
  const result = stringify(tokenizeString('12.34'));
278
- if (result !== '[{"bf":[1234n,-2],"kind":"number","value":"12.34"}]') {
278
+ if (result !== '[{"bf":[1234n,-2],"kind":"number","value":"12.34"},{"kind":"eof"}]') {
279
279
  throw result;
280
280
  }
281
281
  },
282
282
  () => {
283
283
  const result = stringify(tokenizeString('-12.00'));
284
- if (result !== '[{"bf":[-1200n,-2],"kind":"number","value":"-12.00"}]') {
284
+ if (result !== '[{"bf":[-1200n,-2],"kind":"number","value":"-12.00"},{"kind":"eof"}]') {
285
285
  throw result;
286
286
  }
287
287
  },
288
288
  () => {
289
289
  const result = stringify(tokenizeString('-12.'));
290
- if (result !== '[{"kind":"error","message":"invalid token"},{"kind":"error","message":"invalid number"}]') {
290
+ if (result !== '[{"kind":"error","message":"invalid token"},{"kind":"error","message":"invalid number"},{"kind":"eof"}]') {
291
291
  throw result;
292
292
  }
293
293
  },
294
294
  () => {
295
295
  const result = stringify(tokenizeString('12.]'));
296
- if (result !== '[{"kind":"error","message":"invalid number"},{"kind":"]"}]') {
296
+ if (result !== '[{"kind":"error","message":"invalid number"},{"kind":"]"},{"kind":"eof"}]') {
297
297
  throw result;
298
298
  }
299
299
  },
300
300
  () => {
301
301
  const result = stringify(tokenizeString('0e1'));
302
- if (result !== '[{"bf":[0n,1],"kind":"number","value":"0e1"}]') {
302
+ if (result !== '[{"bf":[0n,1],"kind":"number","value":"0e1"},{"kind":"eof"}]') {
303
303
  throw result;
304
304
  }
305
305
  },
306
306
  () => {
307
307
  const result = stringify(tokenizeString('0e+2'));
308
- if (result !== '[{"bf":[0n,2],"kind":"number","value":"0e+2"}]') {
308
+ if (result !== '[{"bf":[0n,2],"kind":"number","value":"0e+2"},{"kind":"eof"}]') {
309
309
  throw result;
310
310
  }
311
311
  },
312
312
  () => {
313
313
  const result = stringify(tokenizeString('0e-0'));
314
- if (result !== '[{"bf":[0n,0],"kind":"number","value":"0e-0"}]') {
314
+ if (result !== '[{"bf":[0n,0],"kind":"number","value":"0e-0"},{"kind":"eof"}]') {
315
315
  throw result;
316
316
  }
317
317
  },
318
318
  () => {
319
319
  const result = stringify(tokenizeString('12e0000'));
320
- if (result !== '[{"bf":[12n,0],"kind":"number","value":"12e0000"}]') {
320
+ if (result !== '[{"bf":[12n,0],"kind":"number","value":"12e0000"},{"kind":"eof"}]') {
321
321
  throw result;
322
322
  }
323
323
  },
324
324
  () => {
325
325
  const result = stringify(tokenizeString('-12e-0001'));
326
- if (result !== '[{"bf":[-12n,-1],"kind":"number","value":"-12e-0001"}]') {
326
+ if (result !== '[{"bf":[-12n,-1],"kind":"number","value":"-12e-0001"},{"kind":"eof"}]') {
327
327
  throw result;
328
328
  }
329
329
  },
330
330
  () => {
331
331
  const result = stringify(tokenizeString('-12.34e1234'));
332
- if (result !== '[{"bf":[-1234n,1232],"kind":"number","value":"-12.34e1234"}]') {
332
+ if (result !== '[{"bf":[-1234n,1232],"kind":"number","value":"-12.34e1234"},{"kind":"eof"}]') {
333
333
  throw result;
334
334
  }
335
335
  },
336
336
  () => {
337
337
  const result = stringify(tokenizeString('0e'));
338
- if (result !== '[{"kind":"error","message":"invalid number"}]') {
338
+ if (result !== '[{"kind":"error","message":"invalid number"},{"kind":"eof"}]') {
339
339
  throw result;
340
340
  }
341
341
  },
342
342
  () => {
343
343
  const result = stringify(tokenizeString('0e-'));
344
- if (result !== '[{"kind":"error","message":"invalid number"}]') {
344
+ if (result !== '[{"kind":"error","message":"invalid number"},{"kind":"eof"}]') {
345
345
  throw result;
346
346
  }
347
347
  },
348
348
  () => {
349
349
  const result = stringify(tokenizeString('1234567890n'));
350
- if (result !== '[{"kind":"error","message":"invalid token"}]') {
350
+ if (result !== '[{"kind":"error","message":"invalid token"},{"kind":"eof"}]') {
351
351
  throw result;
352
352
  }
353
353
  },
354
354
  () => {
355
355
  const result = stringify(tokenizeString('0n'));
356
- if (result !== '[{"kind":"error","message":"invalid token"}]') {
356
+ if (result !== '[{"kind":"error","message":"invalid token"},{"kind":"eof"}]') {
357
357
  throw result;
358
358
  }
359
359
  },
360
360
  () => {
361
361
  const result = stringify(tokenizeString('[-1234567890n]'));
362
- if (result !== '[{"kind":"["},{"kind":"error","message":"invalid token"},{"kind":"error","message":"invalid token"},{"kind":"]"}]') {
362
+ if (result !== '[{"kind":"["},{"kind":"error","message":"invalid token"},{"kind":"error","message":"invalid token"},{"kind":"]"},{"kind":"eof"}]') {
363
363
  throw result;
364
364
  }
365
365
  },
@@ -367,25 +367,25 @@ export default {
367
367
  id: [
368
368
  () => {
369
369
  const result = stringify(tokenizeString('err'));
370
- if (result !== '[{"kind":"error","message":"invalid token"}]') {
370
+ if (result !== '[{"kind":"error","message":"invalid token"},{"kind":"eof"}]') {
371
371
  throw result;
372
372
  }
373
373
  },
374
374
  () => {
375
375
  const result = stringify(tokenizeString('{e}'));
376
- if (result !== '[{"kind":"{"},{"kind":"error","message":"invalid token"},{"kind":"}"}]') {
376
+ if (result !== '[{"kind":"{"},{"kind":"error","message":"invalid token"},{"kind":"}"},{"kind":"eof"}]') {
377
377
  throw result;
378
378
  }
379
379
  },
380
380
  () => {
381
381
  const result = stringify(tokenizeString('tru'));
382
- if (result !== '[{"kind":"error","message":"invalid token"}]') {
382
+ if (result !== '[{"kind":"error","message":"invalid token"},{"kind":"eof"}]') {
383
383
  throw result;
384
384
  }
385
385
  },
386
386
  () => {
387
387
  const result = stringify(tokenizeString('break'));
388
- if (result !== '[{"kind":"error","message":"invalid token"}]') {
388
+ if (result !== '[{"kind":"error","message":"invalid token"},{"kind":"eof"}]') {
389
389
  throw result;
390
390
  }
391
391
  },
@@ -393,25 +393,25 @@ export default {
393
393
  keywords: [
394
394
  () => {
395
395
  const result = stringify(tokenizeString('true'));
396
- if (result !== '[{"kind":"true"}]') {
396
+ if (result !== '[{"kind":"true"},{"kind":"eof"}]') {
397
397
  throw result;
398
398
  }
399
399
  },
400
400
  () => {
401
401
  const result = stringify(tokenizeString('false'));
402
- if (result !== '[{"kind":"false"}]') {
402
+ if (result !== '[{"kind":"false"},{"kind":"eof"}]') {
403
403
  throw result;
404
404
  }
405
405
  },
406
406
  () => {
407
407
  const result = stringify(tokenizeString('null'));
408
- if (result !== '[{"kind":"null"}]') {
408
+ if (result !== '[{"kind":"null"},{"kind":"eof"}]') {
409
409
  throw result;
410
410
  }
411
411
  },
412
412
  () => {
413
413
  const result = stringify(tokenizeString('[null]'));
414
- if (result !== '[{"kind":"["},{"kind":"null"},{"kind":"]"}]') {
414
+ if (result !== '[{"kind":"["},{"kind":"null"},{"kind":"]"},{"kind":"eof"}]') {
415
415
  throw result;
416
416
  }
417
417
  },