fez-lisp 1.5.5 → 1.5.7
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/index.js +2 -2
- package/lib/baked/std.js +1 -1
- package/package.json +1 -1
- package/src/compiler.js +2 -0
- package/src/keywords.js +3 -0
- package/src/utils.js +18 -0
package/package.json
CHANGED
package/src/compiler.js
CHANGED
@@ -7,6 +7,7 @@ import {
|
|
7
7
|
VALUE,
|
8
8
|
WORD
|
9
9
|
} from './keywords.js'
|
10
|
+
import { OPTIMIZATIONS } from './macros.js'
|
10
11
|
import { leaf, isLeaf, AST } from './parser.js'
|
11
12
|
const deepRename = (name, newName, tree) => {
|
12
13
|
if (!isLeaf(tree))
|
@@ -241,6 +242,7 @@ const comp = (tree, Drill) => {
|
|
241
242
|
case KEYWORDS.BITWISE_XOR:
|
242
243
|
case KEYWORDS.BITWISE_LEFT_SHIFT:
|
243
244
|
case KEYWORDS.BITWISE_RIGHT_SHIFT:
|
245
|
+
return `(${parseArgs(tail, Drill, token)});`
|
244
246
|
case KEYWORDS.REMAINDER_OF_DIVISION:
|
245
247
|
return `(${comp(tail[0], Drill)}%${comp(tail[1], Drill)});`
|
246
248
|
case KEYWORDS.BITWISE_NOT:
|
package/src/keywords.js
CHANGED
@@ -53,9 +53,12 @@ export const RUNTIME_TYPES = {
|
|
53
53
|
ARRAY: 'array'
|
54
54
|
}
|
55
55
|
export const DEBUG = {
|
56
|
+
STRING: 'string',
|
56
57
|
LOG: 'log',
|
57
58
|
ASSERT: 'assert',
|
58
59
|
SIGNATURE: '?',
|
60
|
+
LIST_THEMES: 'theme?',
|
61
|
+
SET_THEME: 'theme!',
|
59
62
|
CALLSTACK: '(CALLSTACK)' // so that you can't use it in the code
|
60
63
|
}
|
61
64
|
|
package/src/utils.js
CHANGED
@@ -11,6 +11,12 @@ import {
|
|
11
11
|
export const logError = (error) =>
|
12
12
|
console.log('\x1b[31m', `\n${error}\n`, '\x1b[0m')
|
13
13
|
export const logSuccess = (output) => console.log('\x1b[32m', output, '\x1b[0m')
|
14
|
+
export const formatErrorWithCallstack = (error, callstack) => {
|
15
|
+
return `${error.message}\n${callstack
|
16
|
+
.reverse()
|
17
|
+
.map((x, i) => `${Array(i + 2).join(' ')}(${x} ...)`)
|
18
|
+
.join('\n')}`
|
19
|
+
}
|
14
20
|
export const removeNoCode = (source) =>
|
15
21
|
source
|
16
22
|
.replace(/;.+/g, '')
|
@@ -263,3 +269,15 @@ export const parse = (source) =>
|
|
263
269
|
std
|
264
270
|
)
|
265
271
|
)
|
272
|
+
|
273
|
+
export const UTILS = {
|
274
|
+
handleUnbalancedQuotes,
|
275
|
+
handleUnbalancedParens,
|
276
|
+
logError,
|
277
|
+
logSuccess,
|
278
|
+
formatErrorWithCallstack,
|
279
|
+
wrapInBlock,
|
280
|
+
isEqual,
|
281
|
+
stringifyArgs,
|
282
|
+
shake
|
283
|
+
}
|