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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "fez-lisp",
3
3
  "description": "Lisp interpreted & compiled to JavaScript",
4
4
  "author": "AT290690",
5
- "version": "1.4.1",
5
+ "version": "1.4.3",
6
6
  "type": "module",
7
7
  "main": "index.js",
8
8
  "keywords": [
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)