fez-lisp 1.2.46 → 1.2.48
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.
- package/README.md +5 -3
- package/package.json +1 -1
- package/src/utils.js +4 -4
package/README.md
CHANGED
@@ -206,10 +206,12 @@ and only when compiled to JavaScript.
|
|
206
206
|
|
207
207
|
```js
|
208
208
|
console.log(
|
209
|
-
|
210
|
-
|
209
|
+
eval(
|
210
|
+
fez(
|
211
|
+
`(let recursive:sum-to (lambda n acc (if (= n 0) acc (recursive:sum-to (- n 1) (+ n acc)))))
|
211
212
|
(recursive:sum-to 10000 0)`,
|
212
|
-
|
213
|
+
{ compile: 1 }
|
214
|
+
)
|
213
215
|
)
|
214
216
|
)
|
215
217
|
// 50005000
|
package/package.json
CHANGED
package/src/utils.js
CHANGED
@@ -8,13 +8,13 @@ export const logError = (error) =>
|
|
8
8
|
export const logSuccess = (output) => console.log(output, '\x1b[0m')
|
9
9
|
export const replaceStrings = (source) => {
|
10
10
|
// const quotes = source.match(/"(.*?)"/g)
|
11
|
-
const quotes = source.match(/"(
|
11
|
+
const quotes = source.match(/"(?:.*?(\n|\r))*?.*?"/g)
|
12
12
|
// TODO handle escaping
|
13
13
|
if (quotes)
|
14
14
|
for (const q of quotes)
|
15
15
|
source = source.replaceAll(
|
16
16
|
q,
|
17
|
-
`(array ${[...q]
|
17
|
+
`(array ${[...q.replaceAll('\r', '')]
|
18
18
|
.slice(1, -1)
|
19
19
|
.map((x) => x.charCodeAt(0))
|
20
20
|
.join(' ')})`
|
@@ -247,7 +247,7 @@ export const fez = (source, options = {}) => {
|
|
247
247
|
// if (options.check) typeCheck(ast)
|
248
248
|
if (options.compile) {
|
249
249
|
const js = Object.values(comp(deepClone(ast))).join('')
|
250
|
-
return
|
250
|
+
return js
|
251
251
|
}
|
252
252
|
return run(ast, env)
|
253
253
|
} else if (Array.isArray(source)) {
|
@@ -256,7 +256,7 @@ export const fez = (source, options = {}) => {
|
|
256
256
|
: source
|
257
257
|
if (options.compile) {
|
258
258
|
const js = Object.values(comp(deepClone(ast))).join('')
|
259
|
-
return
|
259
|
+
return js
|
260
260
|
}
|
261
261
|
return run(ast, env)
|
262
262
|
} else {
|