fez-lisp 1.4.13 → 1.4.15
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/lib/baked/std.js +1 -1
- package/package.json +1 -1
- package/src/macros.js +5 -2
- package/src/parser.js +2 -14
package/package.json
CHANGED
package/src/macros.js
CHANGED
@@ -628,12 +628,15 @@ export const deSuggarAst = (ast, scope) => {
|
|
628
628
|
[
|
629
629
|
[APPLY, KEYWORDS.DEFINE_VARIABLE],
|
630
630
|
[WORD, keyName],
|
631
|
-
[
|
631
|
+
[
|
632
|
+
[APPLY, 'from:string-or-number->key'],
|
633
|
+
[[APPLY, KEYWORDS.CREATE_ARRAY], ...args]
|
634
|
+
]
|
632
635
|
],
|
633
636
|
[
|
634
637
|
[APPLY, KEYWORDS.IF],
|
635
638
|
[
|
636
|
-
[APPLY, 'map:
|
639
|
+
[APPLY, 'map:exists?'],
|
637
640
|
[WORD, memoName],
|
638
641
|
[WORD, keyName]
|
639
642
|
],
|
package/src/parser.js
CHANGED
@@ -47,13 +47,7 @@ export const LISP = {
|
|
47
47
|
source: (ast) => {
|
48
48
|
const dfs = (exp) => {
|
49
49
|
let out = ''
|
50
|
-
|
51
|
-
if (isLeaf(exp)) head = exp
|
52
|
-
else {
|
53
|
-
head = exp[0]
|
54
|
-
if (head == undefined) return []
|
55
|
-
tail = exp.slice(1)
|
56
|
-
}
|
50
|
+
const [head, ...tail] = isLeaf(exp) ? [exp] : exp
|
57
51
|
if (head == undefined) return (out += '()')
|
58
52
|
switch (head[TYPE]) {
|
59
53
|
case WORD:
|
@@ -115,13 +109,7 @@ export const AST = {
|
|
115
109
|
struct: (ast) => {
|
116
110
|
const dfs = (exp) => {
|
117
111
|
let out = ''
|
118
|
-
|
119
|
-
if (isLeaf(exp)) head = exp
|
120
|
-
else {
|
121
|
-
head = exp[0]
|
122
|
-
if (head == undefined) return []
|
123
|
-
tail = exp.slice(1)
|
124
|
-
}
|
112
|
+
const [head, ...tail] = isLeaf(exp) ? [exp] : exp
|
125
113
|
if (head == undefined)
|
126
114
|
return (out +=
|
127
115
|
'(Expression::Apply(vec![Expression::Word("array".to_string())]))')
|