fez-lisp 1.4.16 → 1.4.18

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.16",
5
+ "version": "1.4.18",
6
6
  "type": "module",
7
7
  "main": "index.js",
8
8
  "keywords": [
@@ -16,7 +16,7 @@ export const keywords = {
16
16
  [KEYWORDS.LOOP]: (args, env) => {
17
17
  if (args.length != 2)
18
18
  throw new RangeError(`Wrong number of args to ${KEYWORDS.LOOP}`)
19
- while (evaluate(args[0], env) !== FALSE) evaluate(args[1], env)
19
+ while (evaluate(args[0], env) === TRUE) evaluate(args[1], env)
20
20
  return FALSE
21
21
  },
22
22
  [KEYWORDS.ADDITION]: (args, env) => {
package/src/macros.js CHANGED
@@ -403,15 +403,11 @@ export const deSuggarAst = (ast, scope) => {
403
403
  if (exp[1][0][VALUE] === SUGGAR.CREATE_LIST) {
404
404
  const lastLeft = left.pop()
405
405
  const vars = left
406
- if (
407
- !isLeaf(right) &&
408
- right[0][TYPE] === APPLY &&
409
- right[0][VALUE] === SUGGAR.CREATE_LIST
410
- ) {
406
+ if (!isLeaf(right) && right[0][TYPE] !== WORD) {
411
407
  throw new SyntaxError(
412
- `Destructuring requires right hand side to be a word but got an apply ${stringifyArgs(
408
+ `Destructuring requires right hand side to be a word but got an apply\n(${stringifyArgs(
413
409
  exp
414
- )}`
410
+ )})`
415
411
  )
416
412
  } else {
417
413
  newScope = vars
@@ -451,24 +447,21 @@ export const deSuggarAst = (ast, scope) => {
451
447
  vars[0][TYPE] = WORD
452
448
  exp.length = 0
453
449
  } else if (exp[1][0][VALUE] === KEYWORDS.CREATE_ARRAY) {
454
- const lastLeft = left.pop()
455
- // const isList = exp[i][exp[i].length - 2][VALUE] === KEYWORDS.BITWISE_NOT
456
- const isSlicing = lastLeft[VALUE] !== PLACEHOLDER
457
- const vars = left
458
- const indexes = vars.map((x, i) => [i, x])
459
- vars[0][TYPE] = WORD
460
- exp.length = 0
461
- if (
462
- !isLeaf(right) &&
463
- right[0][TYPE] === APPLY &&
464
- right[0][VALUE] === KEYWORDS.CREATE_ARRAY
465
- ) {
450
+ if (!isLeaf(right) && right[0][TYPE] !== WORD) {
466
451
  throw new SyntaxError(
467
- `Destructuring requires right hand side to be a word but got an apply ${stringifyArgs(
452
+ `Destructuring requires right hand side to be a word but got an apply\n(${stringifyArgs(
468
453
  exp
469
- )}`
454
+ )})`
470
455
  )
471
456
  } else {
457
+ const lastLeft = left.pop()
458
+ // const isList = exp[i][exp[i].length - 2][VALUE] === KEYWORDS.BITWISE_NOT
459
+ const isSlicing = lastLeft[VALUE] !== PLACEHOLDER
460
+ const vars = left
461
+ const indexes = vars.map((x, i) => [i, x])
462
+
463
+ vars[0][TYPE] = WORD
464
+ exp.length = 0
472
465
  newScope = indexes
473
466
  .filter((x) => x[1][VALUE] !== PLACEHOLDER)
474
467
  .map(([i]) => [