fez-lisp 1.4.18 → 1.4.20
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/lib/baked/std.js +1 -1
- package/package.json +1 -1
- package/src/interpreter.js +1 -1
- package/src/keywords.js +1 -0
- package/src/utils.js +16 -0
package/package.json
CHANGED
package/src/interpreter.js
CHANGED
package/src/keywords.js
CHANGED
package/src/utils.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import std from '../lib/baked/std.js'
|
2
|
+
import debugStd from '../lib/debug/std.js'
|
2
3
|
import { compile } from './compiler.js'
|
3
4
|
import {
|
4
5
|
APPLY,
|
@@ -290,6 +291,21 @@ export const debug = (ast, onSuccess = compile) => {
|
|
290
291
|
const debugEnv = {
|
291
292
|
...keywords,
|
292
293
|
[DEBUG.CALLSTACK]: [KEYWORDS.BLOCK],
|
294
|
+
[DEBUG.SIGNATURE]: (args, env) => {
|
295
|
+
const signatures =
|
296
|
+
args.length === 0
|
297
|
+
? debugStd[0][1][1].slice(1)
|
298
|
+
: debugStd[0][1][1].filter(
|
299
|
+
(x) =>
|
300
|
+
x[0][TYPE] === APPLY &&
|
301
|
+
x[0][VALUE] === KEYWORDS.DEFINE_VARIABLE &&
|
302
|
+
x[1][TYPE] === WORD &&
|
303
|
+
x[1][VALUE].toString().includes(args[0][VALUE])
|
304
|
+
)
|
305
|
+
return signatures.length === 0
|
306
|
+
? 'Not defined in library'
|
307
|
+
: signatures.map(LISP.source).join('\n\n')
|
308
|
+
},
|
293
309
|
[DEBUG.LOG]: (args, env) => {
|
294
310
|
if (args.length !== 1 && args.length !== 2)
|
295
311
|
throw new RangeError(
|