fez-lisp 1.6.33 → 1.6.34
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/package.json +1 -1
- package/src/debugger.js +25 -17
package/package.json
CHANGED
package/src/debugger.js
CHANGED
@@ -17,7 +17,11 @@ import {
|
|
17
17
|
} from './keywords.js'
|
18
18
|
import { isLeaf, LISP } from './parser.js'
|
19
19
|
import { definedTypes, filteredDefinedTypes, withCtxTypes } from './types.js'
|
20
|
-
import {
|
20
|
+
import {
|
21
|
+
isForbiddenVariableName,
|
22
|
+
removeNoCode,
|
23
|
+
stringifyArgs
|
24
|
+
} from './utils.js'
|
21
25
|
const keywords = {
|
22
26
|
[KEYWORDS.LOOP]: (args, env) => {
|
23
27
|
if (args.length != 2)
|
@@ -886,24 +890,28 @@ export const debugStackToString = (stack) =>
|
|
886
890
|
stack.map(({ source, result }) => `${source}\n${result}`).join('\n')
|
887
891
|
export const startDebug = (ast, speed = 250, start, end) => {
|
888
892
|
debugStack.length = 0
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
893
|
+
try {
|
894
|
+
evaluate(enhance(ast))
|
895
|
+
start = start ? debugStack.findIndex(start) : 0
|
896
|
+
end = end ? debugStack.findIndex(end) + 1 : debugStack.length
|
897
|
+
const stack = debugStack.slice(start, end)
|
898
|
+
if (speed !== 0) {
|
899
|
+
stack.reverse()
|
900
|
+
const rec = () => {
|
901
|
+
setTimeout(() => {
|
902
|
+
if (stack.length) {
|
903
|
+
const { source, result } = stack.pop()
|
904
|
+
console.log(`\x1b[31m${source}\x1b[32m\n${result}\x1b[0m`)
|
905
|
+
rec()
|
906
|
+
}
|
907
|
+
}, speed)
|
908
|
+
}
|
909
|
+
rec()
|
903
910
|
}
|
904
|
-
|
911
|
+
return [stack, null]
|
912
|
+
} catch (error) {
|
913
|
+
return [null, error]
|
905
914
|
}
|
906
|
-
return stack
|
907
915
|
}
|
908
916
|
|
909
917
|
// const types = typeCheck(std[0], withCtxTypes(definedTypes(stdT)))[1]
|