fez-lisp 1.4.1 → 1.4.3
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 +1 -1
- package/lib/baked/std.js +1 -1
- package/package.json +1 -1
- package/src/compiler.js +5 -0
- package/src/interpreter.js +240 -154
- package/src/keywords.js +3 -3
- package/src/utils.js +9 -27
package/package.json
CHANGED
package/src/compiler.js
CHANGED
@@ -117,6 +117,7 @@ const Helpers = {
|
|
117
117
|
__tco: `__tco=fn=>(...args)=>{let result=fn(...args);while(typeof result==='function')result=result();return result}`,
|
118
118
|
atom_predicate: `atom_predicate=(number)=>+(typeof number==='number')`,
|
119
119
|
lambda_predicate: `lambda_predicate=(fn)=>+(typeof fn==='function')`,
|
120
|
+
__error: `__error=(error)=>{throw new Error(error.map((x)=>String.fromCharCode(x)).join(''))}`,
|
120
121
|
set_effect: `set_effect=function(array,index,value){if(arguments.length===1){array.pop()}else{array[index] = value};return array}`
|
121
122
|
}
|
122
123
|
const semiColumnEdgeCases = new Set([
|
@@ -305,6 +306,10 @@ const comp = (tree, Drill) => {
|
|
305
306
|
Arguments.length === 3 ? comp(Arguments[2], Drill) : 0
|
306
307
|
});`
|
307
308
|
}
|
309
|
+
case KEYWORDS.ERROR: {
|
310
|
+
Drill.Helpers.add('__error')
|
311
|
+
return `__error(${compile(Arguments[0], Drill)})`
|
312
|
+
}
|
308
313
|
default: {
|
309
314
|
const camelCased = lispToJavaScriptVariableName(token)
|
310
315
|
if (camelCased in Helpers) Drill.Helpers.add(camelCased)
|