functionalscript 0.0.524 → 0.0.526

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.
@@ -43,38 +43,10 @@ module.exports = {
43
43
  const result = stringify(tokenizeString('ᄑ'))
44
44
  if (result !== '[{"kind":"error","message":"unexpected character"}]') { throw result }
45
45
  },
46
- () => {
47
- const result = stringify(tokenizeString('err'))
48
- if (result !== '[{"kind":"error","message":"invalid token"}]') { throw result }
49
- },
50
- () => {
51
- const result = stringify(tokenizeString('{e}'))
52
- if (result !== '[{"kind":"{"},{"kind":"error","message":"invalid token"},{"kind":"}"}]') { throw result }
53
- },
54
46
  () => {
55
47
  const result = stringify(tokenizeString('{ \t\n\r}'))
56
48
  if (result !== '[{"kind":"{"},{"kind":"}"}]') { throw result }
57
49
  },
58
- () => {
59
- const result = stringify(tokenizeString('true'))
60
- if (result !== '[{"kind":"true"}]') { throw result }
61
- },
62
- () => {
63
- const result = stringify(tokenizeString('tru'))
64
- if (result !== '[{"kind":"error","message":"invalid token"}]') { throw result }
65
- },
66
- () => {
67
- const result = stringify(tokenizeString('false'))
68
- if (result !== '[{"kind":"false"}]') { throw result }
69
- },
70
- () => {
71
- const result = stringify(tokenizeString('null'))
72
- if (result !== '[{"kind":"null"}]') { throw result }
73
- },
74
- () => {
75
- const result = stringify(tokenizeString('[null]'))
76
- if (result !== '[{"kind":"["},{"kind":"null"},{"kind":"]"}]') { throw result }
77
- },
78
50
  () => {
79
51
  const result = stringify(tokenizeString('""'))
80
52
  if (result !== '[{"kind":"string","value":""}]') { throw result }
@@ -165,7 +137,7 @@ module.exports = {
165
137
  },
166
138
  () => {
167
139
  const result = stringify(tokenizeString('10-0'))
168
- if (result !== '[{"kind":"error","message":"invalid number"}]') { throw result }
140
+ if (result !== '[{"bf":[10n,0],"kind":"number","value":"10"},{"bf":[0n,0],"kind":"number","value":"-0"}]') { throw result }
169
141
  },
170
142
  () => {
171
143
  const result = stringify(tokenizeString('9a:'))
@@ -175,17 +147,29 @@ module.exports = {
175
147
  const result = stringify(tokenizeString('-10'))
176
148
  if (result !== '[{"bf":[-10n,0],"kind":"number","value":"-10"}]') { throw result }
177
149
  },
150
+ () => {
151
+ const result = stringify(tokenizeString('-'))
152
+ if (result !== '[{"kind":"error","message":"invalid token"}]') { throw result }
153
+ },
154
+ () => {
155
+ const result = stringify(tokenizeString('--'))
156
+ if (result !== '[{"kind":"error","message":"invalid token"}]') { throw result }
157
+ },
158
+ () => {
159
+ const result = stringify(tokenizeString('---'))
160
+ if (result !== '[{"kind":"error","message":"invalid token"},{"kind":"error","message":"invalid token"}]') { throw result }
161
+ },
178
162
  () => {
179
163
  const result = stringify(tokenizeString('-0'))
180
164
  if (result !== '[{"bf":[0n,0],"kind":"number","value":"-0"}]') { throw result }
181
165
  },
182
166
  () => {
183
167
  const result = stringify(tokenizeString('-00'))
184
- if (result !== '[{"kind":"error","message":"invalid number"}]') { throw result }
168
+ if (result !== '[{"kind":"error","message":"invalid token"},{"kind":"error","message":"invalid number"}]') { throw result }
185
169
  },
186
170
  () => {
187
171
  const result = stringify(tokenizeString('-.123'))
188
- if (result !== '[{"kind":"error","message":"invalid number"}]') { throw result }
172
+ if (result !== '[{"kind":"error","message":"invalid token"},{"kind":"error","message":"invalid token"},{"bf":[123n,0],"kind":"number","value":"123"}]') { throw result }
189
173
  },
190
174
  () => {
191
175
  const result = stringify(tokenizeString('0.01'))
@@ -197,11 +181,11 @@ module.exports = {
197
181
  },
198
182
  () => {
199
183
  const result = stringify(tokenizeString('-0.'))
200
- if (result !== '[{"kind":"error","message":"invalid number"}]') { throw result }
184
+ if (result !== '[{"kind":"error","message":"invalid token"},{"kind":"error","message":"invalid number"}]') { throw result }
201
185
  },
202
186
  () => {
203
187
  const result = stringify(tokenizeString('-0.]'))
204
- if (result !== '[{"kind":"error","message":"invalid number"},{"kind":"]"}]') { throw result }
188
+ if (result !== '[{"kind":"error","message":"invalid token"},{"kind":"error","message":"invalid number"},{"kind":"]"}]') { throw result }
205
189
  },
206
190
  () => {
207
191
  const result = stringify(tokenizeString('12.34'))
@@ -213,7 +197,7 @@ module.exports = {
213
197
  },
214
198
  () => {
215
199
  const result = stringify(tokenizeString('-12.'))
216
- if (result !== '[{"kind":"error","message":"invalid number"}]') { throw result }
200
+ if (result !== '[{"kind":"error","message":"invalid token"},{"kind":"error","message":"invalid number"}]') { throw result }
217
201
  },
218
202
  () => {
219
203
  const result = stringify(tokenizeString('12.]'))
@@ -251,5 +235,53 @@ module.exports = {
251
235
  const result = stringify(tokenizeString('0e-'))
252
236
  if (result !== '[{"kind":"error","message":"invalid number"}]') { throw result }
253
237
  },
238
+ () => {
239
+ const result = stringify(tokenizeString('1234567890n'))
240
+ if (result !== '[{"kind":"error","message":"invalid token"}]') { throw result }
241
+ },
242
+ () => {
243
+ const result = stringify(tokenizeString('0n'))
244
+ if (result !== '[{"kind":"error","message":"invalid token"}]') { throw result }
245
+ },
246
+ () => {
247
+ const result = stringify(tokenizeString('[-1234567890n]'))
248
+ if (result !== '[{"kind":"["},{"kind":"error","message":"invalid token"},{"kind":"error","message":"invalid token"},{"kind":"]"}]') { throw result }
249
+ },
250
+ ],
251
+ id: [
252
+ () => {
253
+ const result = stringify(tokenizeString('err'))
254
+ if (result !== '[{"kind":"error","message":"invalid token"}]') { throw result }
255
+ },
256
+ () => {
257
+ const result = stringify(tokenizeString('{e}'))
258
+ if (result !== '[{"kind":"{"},{"kind":"error","message":"invalid token"},{"kind":"}"}]') { throw result }
259
+ },
260
+ () => {
261
+ const result = stringify(tokenizeString('tru'))
262
+ if (result !== '[{"kind":"error","message":"invalid token"}]') { throw result }
263
+ },
264
+ () => {
265
+ const result = stringify(tokenizeString('break'))
266
+ if (result !== '[{"kind":"error","message":"invalid token"}]') { throw result }
267
+ },
268
+ ],
269
+ keywords: [
270
+ () => {
271
+ const result = stringify(tokenizeString('true'))
272
+ if (result !== '[{"kind":"true"}]') { throw result }
273
+ },
274
+ () => {
275
+ const result = stringify(tokenizeString('false'))
276
+ if (result !== '[{"kind":"false"}]') { throw result }
277
+ },
278
+ () => {
279
+ const result = stringify(tokenizeString('null'))
280
+ if (result !== '[{"kind":"null"}]') { throw result }
281
+ },
282
+ () => {
283
+ const result = stringify(tokenizeString('[null]'))
284
+ if (result !== '[{"kind":"["},{"kind":"null"},{"kind":"]"}]') { throw result }
285
+ },
254
286
  ]
255
287
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "functionalscript",
3
- "version": "0.0.524",
3
+ "version": "0.0.526",
4
4
  "description": "FunctionalScript is a functional subset of JavaScript",
5
5
  "main": "module.f.cjs",
6
6
  "scripts": {
@@ -90,4 +90,6 @@ const decToBin = dec => {
90
90
  module.exports = {
91
91
  /** @readonly */
92
92
  decToBin,
93
+ /** @readonly */
94
+ multiply
93
95
  }