fez-lisp 1.1.30 → 1.1.31
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 +1 -1
- package/src/compiler.js +2 -5
- package/src/keywords.js +1 -0
- package/src/utils.js +5 -3
package/package.json
CHANGED
package/src/compiler.js
CHANGED
@@ -11,7 +11,6 @@ import { leaf, isLeaf } from './parser.js'
|
|
11
11
|
import { deepRename } from './utils.js'
|
12
12
|
const earMuffsToLodashes = (name) => name.replace(new RegExp(/\*/g), '_')
|
13
13
|
const dotNamesToEmpty = (name) => name.replace(new RegExp(/\./g), '')
|
14
|
-
const commaToLodash = (name) => name.replace(new RegExp(/\,/g), '_')
|
15
14
|
const arrowFromTo = (name) => name.replace(new RegExp(/->/g), '-to-')
|
16
15
|
const moduleNameToLodashes = (name) => name.replace(new RegExp(/:/g), '_')
|
17
16
|
const questionMarkToPredicate = (name) =>
|
@@ -57,9 +56,7 @@ const lispToJavaScriptVariableName = (name) =>
|
|
57
56
|
dotNamesToEmpty(
|
58
57
|
exclamationMarkMarkToEffect(
|
59
58
|
questionMarkToPredicate(
|
60
|
-
|
61
|
-
moduleNameToLodashes(earMuffsToLodashes(keywordToHelper(name)))
|
62
|
-
)
|
59
|
+
moduleNameToLodashes(earMuffsToLodashes(keywordToHelper(name)))
|
63
60
|
)
|
64
61
|
)
|
65
62
|
)
|
@@ -182,7 +179,7 @@ const compile = (tree, Drill) => {
|
|
182
179
|
} else {
|
183
180
|
const name = lispToJavaScriptVariableName(n)
|
184
181
|
Drill.Variables.add(name)
|
185
|
-
return
|
182
|
+
return `${name}=${compile(Arguments[1], Drill)};`
|
186
183
|
}
|
187
184
|
}
|
188
185
|
case KEYWORDS.IS_ATOM:
|
package/src/keywords.js
CHANGED
package/src/utils.js
CHANGED
@@ -34,9 +34,11 @@ export const isBalancedParenthesis = (sourceCode) => {
|
|
34
34
|
let count = 0
|
35
35
|
const stack = []
|
36
36
|
const str = sourceCode.match(/[/\(|\)]/g) ?? []
|
37
|
-
for (let i = 0; i < str.length; ++i)
|
38
|
-
|
39
|
-
|
37
|
+
for (let i = 0; i < str.length; ++i) {
|
38
|
+
const current = str[i]
|
39
|
+
if (current === '(') stack.push(current)
|
40
|
+
else if (current === ')') if (stack.pop() !== '(') ++count
|
41
|
+
}
|
40
42
|
return count - stack.length
|
41
43
|
}
|
42
44
|
export const escape = (Char) => {
|