fez-lisp 1.3.23 → 1.3.24

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/macros.js +13 -0
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.3.23",
5
+ "version": "1.3.24",
6
6
  "type": "module",
7
7
  "main": "index.js",
8
8
  "keywords": [
package/src/macros.js CHANGED
@@ -674,6 +674,19 @@ export const replaceQuotes = (source) =>
674
674
  .replaceAll(/\'\(/g, `(${KEYWORDS.CREATE_ARRAY} `)
675
675
  .replaceAll(/\`\(/g, `(${SUGGAR.CREATE_LIST} `)
676
676
  .replaceAll(/\(\)/g, `(${KEYWORDS.CREATE_ARRAY})`)
677
+ .replaceAll(/\[\]/g, `(${KEYWORDS.CREATE_ARRAY})`)
678
+ .replaceAll(/\{\}/g, `(${KEYWORDS.CREATE_LIST})`)
679
+ .replaceAll(/\[/g, `(${KEYWORDS.CREATE_ARRAY} `)
680
+ .replaceAll(/\]/g, ')')
681
+ .replaceAll(/\{/g, `(${KEYWORDS.CREATE_LIST} `)
682
+ .replaceAll(/\}/g, ')')
683
+
684
+ export const replaceParens = (source) =>
685
+ source
686
+ .replaceAll(/\[/g, '(')
687
+ .replaceAll(/\]/g, ')')
688
+ .replaceAll(/\{/g, '(')
689
+ .replaceAll(/\}/g, ')')
677
690
  export const deSuggarSource = (source) => replaceQuotes(replaceStrings(source))
678
691
  export const handleUnbalancedQuotes = (source) => {
679
692
  const diff = (source.match(/\"/g) ?? []).length % 2