fez-lisp 1.5.47 → 1.5.49

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/src/utils.js CHANGED
@@ -1,5 +1,13 @@
1
1
  import std from '../lib/baked/std.js'
2
- import { APPLY, ATOM, KEYWORDS, TYPE, VALUE, WORD } from './keywords.js'
2
+ import {
3
+ APPLY,
4
+ ATOM,
5
+ KEYWORDS,
6
+ STATIC_TYPES,
7
+ TYPE,
8
+ VALUE,
9
+ WORD
10
+ } from './keywords.js'
3
11
  import { evaluate } from './evaluator.js'
4
12
  import { isLeaf, LISP } from './parser.js'
5
13
  import {
@@ -16,9 +24,8 @@ export const formatCallstack = (callstack) =>
16
24
  .reverse()
17
25
  .map((x, i) => `${Array(i + 2).join(' ')}(${x} ...)`)
18
26
  .join('\n')
19
- export const formatErrorWithCallstack = (error, callstack) => {
20
- return `${error.message}\n${formatCallstack(callstack)}`
21
- }
27
+ export const formatErrorWithCallstack = (error, callstack) =>
28
+ `${error.message}\n${formatCallstack(callstack)}`
22
29
  export const getSuffix = (str) => str[str.length - 1]
23
30
  export const removeNoCode = (source) =>
24
31
  source
@@ -309,6 +316,19 @@ export const parse = (source) =>
309
316
  )
310
317
  )
311
318
 
319
+ export const addTypeIdentities = (ast) => {
320
+ const block = ast[1][1]
321
+ const temp = block.shift()
322
+ block.unshift(
323
+ temp,
324
+ identity(STATIC_TYPES.APPLICATION),
325
+ identity(STATIC_TYPES.ATOM),
326
+ identity(STATIC_TYPES.COLLECTION),
327
+ identity(STATIC_TYPES.PREDICATE),
328
+ identity(STATIC_TYPES.UNKNOWN)
329
+ )
330
+ }
331
+
312
332
  export const UTILS = {
313
333
  handleUnbalancedQuotes,
314
334
  handleUnbalancedParens,