@mojir/lits 1.1.0
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/LICENSE +21 -0
- package/README.md +146 -0
- package/dist/cli/cli/src/cli.d.ts +2 -0
- package/dist/cli/cli/src/cliDocumentation/formatCliDescription.d.ts +3 -0
- package/dist/cli/cli/src/cliDocumentation/getCliArgumentInfo.d.ts +3 -0
- package/dist/cli/cli/src/cliDocumentation/getCliDocumentation.d.ts +2 -0
- package/dist/cli/cli/src/cliDocumentation/getCliFunctionExamples.d.ts +3 -0
- package/dist/cli/cli/src/cliDocumentation/getCliFunctionSignature.d.ts +3 -0
- package/dist/cli/cli/src/cliDocumentation/getCliTitle.d.ts +3 -0
- package/dist/cli/cli/src/cliDocumentation/getCliType.d.ts +3 -0
- package/dist/cli/cli/src/cliFormatterRules.d.ts +13 -0
- package/dist/cli/cli/src/colorizer.d.ts +906 -0
- package/dist/cli/cli/src/createReadlineInterface.d.ts +6 -0
- package/dist/cli/cli.js +14963 -0
- package/dist/cli/common/clojureDocs.d.ts +1 -0
- package/dist/cli/common/createFormatter.d.ts +6 -0
- package/dist/cli/common/utils.d.ts +3 -0
- package/dist/cli/reference/api.d.ts +59 -0
- package/dist/cli/reference/categories/array.d.ts +3 -0
- package/dist/cli/reference/categories/assert.d.ts +3 -0
- package/dist/cli/reference/categories/bitwise.d.ts +3 -0
- package/dist/cli/reference/categories/collection.d.ts +3 -0
- package/dist/cli/reference/categories/functional.d.ts +3 -0
- package/dist/cli/reference/categories/math.d.ts +3 -0
- package/dist/cli/reference/categories/misc.d.ts +3 -0
- package/dist/cli/reference/categories/object.d.ts +3 -0
- package/dist/cli/reference/categories/predicate.d.ts +3 -0
- package/dist/cli/reference/categories/regularExpression.d.ts +3 -0
- package/dist/cli/reference/categories/sequence.d.ts +3 -0
- package/dist/cli/reference/categories/specialExpressions.d.ts +3 -0
- package/dist/cli/reference/categories/string.d.ts +3 -0
- package/dist/cli/reference/datatype.d.ts +3 -0
- package/dist/cli/reference/examples.d.ts +16 -0
- package/dist/cli/reference/index.d.ts +50 -0
- package/dist/cli/reference/shorthand.d.ts +3 -0
- package/dist/cli/src/Lits/Cache.d.ts +16 -0
- package/dist/cli/src/Lits/Lits.d.ts +50 -0
- package/dist/cli/src/analyze/index.d.ts +2 -0
- package/dist/cli/src/analyze/interface.d.ts +12 -0
- package/dist/cli/src/analyze/utils.d.ts +3 -0
- package/dist/cli/src/builtin/index.d.ts +5 -0
- package/dist/cli/src/builtin/interface.d.ts +43 -0
- package/dist/cli/src/builtin/normalExpressions/categories/array.d.ts +2 -0
- package/dist/cli/src/builtin/normalExpressions/categories/assert.d.ts +2 -0
- package/dist/cli/src/builtin/normalExpressions/categories/bitwise.d.ts +2 -0
- package/dist/cli/src/builtin/normalExpressions/categories/collection.d.ts +2 -0
- package/dist/cli/src/builtin/normalExpressions/categories/functional.d.ts +2 -0
- package/dist/cli/src/builtin/normalExpressions/categories/math.d.ts +2 -0
- package/dist/cli/src/builtin/normalExpressions/categories/misc.d.ts +2 -0
- package/dist/cli/src/builtin/normalExpressions/categories/object.d.ts +2 -0
- package/dist/cli/src/builtin/normalExpressions/categories/predicates.d.ts +2 -0
- package/dist/cli/src/builtin/normalExpressions/categories/regexp.d.ts +2 -0
- package/dist/cli/src/builtin/normalExpressions/categories/sequence.d.ts +4 -0
- package/dist/cli/src/builtin/normalExpressions/categories/string.d.ts +2 -0
- package/dist/cli/src/builtin/normalExpressions/index.d.ts +2 -0
- package/dist/cli/src/builtin/specialExpressions/and.d.ts +3 -0
- package/dist/cli/src/builtin/specialExpressions/comment.d.ts +2 -0
- package/dist/cli/src/builtin/specialExpressions/cond.d.ts +8 -0
- package/dist/cli/src/builtin/specialExpressions/declared.d.ts +2 -0
- package/dist/cli/src/builtin/specialExpressions/def.d.ts +3 -0
- package/dist/cli/src/builtin/specialExpressions/defs.d.ts +3 -0
- package/dist/cli/src/builtin/specialExpressions/do.d.ts +3 -0
- package/dist/cli/src/builtin/specialExpressions/functions.d.ts +9 -0
- package/dist/cli/src/builtin/specialExpressions/if-let.d.ts +3 -0
- package/dist/cli/src/builtin/specialExpressions/if-not.d.ts +3 -0
- package/dist/cli/src/builtin/specialExpressions/if.d.ts +3 -0
- package/dist/cli/src/builtin/specialExpressions/let.d.ts +3 -0
- package/dist/cli/src/builtin/specialExpressions/loop.d.ts +3 -0
- package/dist/cli/src/builtin/specialExpressions/loops.d.ts +12 -0
- package/dist/cli/src/builtin/specialExpressions/or.d.ts +3 -0
- package/dist/cli/src/builtin/specialExpressions/qq.d.ts +3 -0
- package/dist/cli/src/builtin/specialExpressions/recur.d.ts +2 -0
- package/dist/cli/src/builtin/specialExpressions/throw.d.ts +2 -0
- package/dist/cli/src/builtin/specialExpressions/time.d.ts +3 -0
- package/dist/cli/src/builtin/specialExpressions/try.d.ts +3 -0
- package/dist/cli/src/builtin/specialExpressions/when-first.d.ts +3 -0
- package/dist/cli/src/builtin/specialExpressions/when-let.d.ts +3 -0
- package/dist/cli/src/builtin/specialExpressions/when-not.d.ts +3 -0
- package/dist/cli/src/builtin/specialExpressions/when.d.ts +3 -0
- package/dist/cli/src/builtin/utils.d.ts +18 -0
- package/dist/cli/src/cli.d.ts +2 -0
- package/dist/cli/src/cliDocumentation/formatCliDescription.d.ts +3 -0
- package/dist/cli/src/cliDocumentation/getCliArgumentInfo.d.ts +3 -0
- package/dist/cli/src/cliDocumentation/getCliDocumentation.d.ts +2 -0
- package/dist/cli/src/cliDocumentation/getCliFunctionExamples.d.ts +3 -0
- package/dist/cli/src/cliDocumentation/getCliFunctionSignature.d.ts +3 -0
- package/dist/cli/src/cliDocumentation/getCliTitle.d.ts +3 -0
- package/dist/cli/src/cliDocumentation/getCliType.d.ts +3 -0
- package/dist/cli/src/cliFormatterRules.d.ts +13 -0
- package/dist/cli/src/colorizer.d.ts +906 -0
- package/dist/cli/src/constants/constants.d.ts +42 -0
- package/dist/cli/src/createReadlineInterface.d.ts +6 -0
- package/dist/cli/src/errors.d.ts +26 -0
- package/dist/cli/src/evaluator/ContextStack.d.ts +21 -0
- package/dist/cli/src/evaluator/functionExecutors.d.ts +11 -0
- package/dist/cli/src/evaluator/index.d.ts +5 -0
- package/dist/cli/src/evaluator/interface.d.ts +12 -0
- package/dist/cli/src/index.d.ts +12 -0
- package/dist/cli/src/interface.d.ts +8 -0
- package/dist/cli/src/parser/index.d.ts +3 -0
- package/dist/cli/src/parser/interface.d.ts +160 -0
- package/dist/cli/src/parser/parsers.d.ts +4 -0
- package/dist/cli/src/reservedNames.d.ts +7 -0
- package/dist/cli/src/testFramework/index.d.ts +14 -0
- package/dist/cli/src/tokenizer/index.d.ts +2 -0
- package/dist/cli/src/tokenizer/interface.d.ts +25 -0
- package/dist/cli/src/tokenizer/sugar/applyCollectionAccessor.d.ts +2 -0
- package/dist/cli/src/tokenizer/sugar/index.d.ts +3 -0
- package/dist/cli/src/tokenizer/tokenizers.d.ts +19 -0
- package/dist/cli/src/typeGuards/array.d.ts +9 -0
- package/dist/cli/src/typeGuards/astNode.d.ts +17 -0
- package/dist/cli/src/typeGuards/index.d.ts +15 -0
- package/dist/cli/src/typeGuards/lits.d.ts +21 -0
- package/dist/cli/src/typeGuards/litsFunction.d.ts +12 -0
- package/dist/cli/src/typeGuards/number.d.ts +66 -0
- package/dist/cli/src/typeGuards/string.d.ts +15 -0
- package/dist/cli/src/typeGuards/token.d.ts +13 -0
- package/dist/cli/src/utils/debug/debugTools.d.ts +3 -0
- package/dist/cli/src/utils/debug/getSourceCodeInfo.d.ts +2 -0
- package/dist/cli/src/utils/getAssertionError.d.ts +3 -0
- package/dist/cli/src/utils/index.d.ts +10 -0
- package/dist/cli/src/utils/symbols.d.ts +2 -0
- package/dist/common/clojureDocs.d.ts +1 -0
- package/dist/common/createFormatter.d.ts +6 -0
- package/dist/common/utils.d.ts +3 -0
- package/dist/index.esm.js +7078 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +7095 -0
- package/dist/index.js.map +1 -0
- package/dist/lits.iife.js +7100 -0
- package/dist/lits.iife.js.map +1 -0
- package/dist/reference/api.d.ts +59 -0
- package/dist/reference/categories/array.d.ts +3 -0
- package/dist/reference/categories/assert.d.ts +3 -0
- package/dist/reference/categories/bitwise.d.ts +3 -0
- package/dist/reference/categories/collection.d.ts +3 -0
- package/dist/reference/categories/functional.d.ts +3 -0
- package/dist/reference/categories/math.d.ts +3 -0
- package/dist/reference/categories/misc.d.ts +3 -0
- package/dist/reference/categories/object.d.ts +3 -0
- package/dist/reference/categories/predicate.d.ts +3 -0
- package/dist/reference/categories/regularExpression.d.ts +3 -0
- package/dist/reference/categories/sequence.d.ts +3 -0
- package/dist/reference/categories/specialExpressions.d.ts +3 -0
- package/dist/reference/categories/string.d.ts +3 -0
- package/dist/reference/datatype.d.ts +3 -0
- package/dist/reference/index.d.ts +50 -0
- package/dist/reference/shorthand.d.ts +3 -0
- package/dist/src/Lits/Cache.d.ts +16 -0
- package/dist/src/Lits/Lits.d.ts +50 -0
- package/dist/src/analyze/index.d.ts +2 -0
- package/dist/src/analyze/interface.d.ts +12 -0
- package/dist/src/analyze/utils.d.ts +3 -0
- package/dist/src/builtin/index.d.ts +5 -0
- package/dist/src/builtin/interface.d.ts +43 -0
- package/dist/src/builtin/normalExpressions/categories/array.d.ts +2 -0
- package/dist/src/builtin/normalExpressions/categories/assert.d.ts +2 -0
- package/dist/src/builtin/normalExpressions/categories/bitwise.d.ts +2 -0
- package/dist/src/builtin/normalExpressions/categories/collection.d.ts +2 -0
- package/dist/src/builtin/normalExpressions/categories/functional.d.ts +2 -0
- package/dist/src/builtin/normalExpressions/categories/math.d.ts +2 -0
- package/dist/src/builtin/normalExpressions/categories/misc.d.ts +2 -0
- package/dist/src/builtin/normalExpressions/categories/object.d.ts +2 -0
- package/dist/src/builtin/normalExpressions/categories/predicates.d.ts +2 -0
- package/dist/src/builtin/normalExpressions/categories/regexp.d.ts +2 -0
- package/dist/src/builtin/normalExpressions/categories/sequence.d.ts +4 -0
- package/dist/src/builtin/normalExpressions/categories/string.d.ts +2 -0
- package/dist/src/builtin/normalExpressions/index.d.ts +2 -0
- package/dist/src/builtin/specialExpressions/and.d.ts +3 -0
- package/dist/src/builtin/specialExpressions/comment.d.ts +2 -0
- package/dist/src/builtin/specialExpressions/cond.d.ts +8 -0
- package/dist/src/builtin/specialExpressions/declared.d.ts +2 -0
- package/dist/src/builtin/specialExpressions/def.d.ts +3 -0
- package/dist/src/builtin/specialExpressions/defs.d.ts +3 -0
- package/dist/src/builtin/specialExpressions/do.d.ts +3 -0
- package/dist/src/builtin/specialExpressions/functions.d.ts +9 -0
- package/dist/src/builtin/specialExpressions/if-let.d.ts +3 -0
- package/dist/src/builtin/specialExpressions/if-not.d.ts +3 -0
- package/dist/src/builtin/specialExpressions/if.d.ts +3 -0
- package/dist/src/builtin/specialExpressions/let.d.ts +3 -0
- package/dist/src/builtin/specialExpressions/loop.d.ts +3 -0
- package/dist/src/builtin/specialExpressions/loops.d.ts +12 -0
- package/dist/src/builtin/specialExpressions/or.d.ts +3 -0
- package/dist/src/builtin/specialExpressions/qq.d.ts +3 -0
- package/dist/src/builtin/specialExpressions/recur.d.ts +2 -0
- package/dist/src/builtin/specialExpressions/throw.d.ts +2 -0
- package/dist/src/builtin/specialExpressions/time.d.ts +3 -0
- package/dist/src/builtin/specialExpressions/try.d.ts +3 -0
- package/dist/src/builtin/specialExpressions/when-first.d.ts +3 -0
- package/dist/src/builtin/specialExpressions/when-let.d.ts +3 -0
- package/dist/src/builtin/specialExpressions/when-not.d.ts +3 -0
- package/dist/src/builtin/specialExpressions/when.d.ts +3 -0
- package/dist/src/builtin/utils.d.ts +18 -0
- package/dist/src/constants/constants.d.ts +42 -0
- package/dist/src/errors.d.ts +26 -0
- package/dist/src/evaluator/ContextStack.d.ts +21 -0
- package/dist/src/evaluator/functionExecutors.d.ts +11 -0
- package/dist/src/evaluator/index.d.ts +5 -0
- package/dist/src/evaluator/interface.d.ts +12 -0
- package/dist/src/index.d.ts +12 -0
- package/dist/src/interface.d.ts +8 -0
- package/dist/src/parser/index.d.ts +3 -0
- package/dist/src/parser/interface.d.ts +160 -0
- package/dist/src/parser/parsers.d.ts +4 -0
- package/dist/src/reservedNames.d.ts +7 -0
- package/dist/src/testFramework/index.d.ts +14 -0
- package/dist/src/tokenizer/index.d.ts +2 -0
- package/dist/src/tokenizer/interface.d.ts +25 -0
- package/dist/src/tokenizer/sugar/applyCollectionAccessor.d.ts +2 -0
- package/dist/src/tokenizer/sugar/index.d.ts +3 -0
- package/dist/src/tokenizer/tokenizers.d.ts +19 -0
- package/dist/src/typeGuards/array.d.ts +9 -0
- package/dist/src/typeGuards/astNode.d.ts +17 -0
- package/dist/src/typeGuards/index.d.ts +15 -0
- package/dist/src/typeGuards/lits.d.ts +21 -0
- package/dist/src/typeGuards/litsFunction.d.ts +12 -0
- package/dist/src/typeGuards/number.d.ts +66 -0
- package/dist/src/typeGuards/string.d.ts +15 -0
- package/dist/src/typeGuards/token.d.ts +13 -0
- package/dist/src/utils/debug/debugTools.d.ts +3 -0
- package/dist/src/utils/debug/getSourceCodeInfo.d.ts +2 -0
- package/dist/src/utils/getAssertionError.d.ts +3 -0
- package/dist/src/utils/index.d.ts +10 -0
- package/dist/src/utils/symbols.d.ts +2 -0
- package/dist/testFramework.esm.js +7197 -0
- package/dist/testFramework.esm.js.map +1 -0
- package/dist/testFramework.js +7200 -0
- package/dist/testFramework.js.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export declare const api: {
|
|
2
|
+
readonly collection: readonly ["count", "get", "get-in", "contains?", "has?", "has-some?", "has-every?", "assoc", "assoc-in", "concat", "not-empty", "every?", "not-every?", "any?", "not-any?", "update", "update-in"];
|
|
3
|
+
readonly array: readonly ["array", "range", "repeat", "flatten", "mapcat"];
|
|
4
|
+
readonly sequence: readonly ["nth", "push", "pop", "unshift", "shift", "slice", "reductions", "reduce", "reduce-right", "map", "filter", "position", "index-of", "some", "reverse", "first", "second", "last", "rest", "nthrest", "next", "nthnext", "cons", "take", "take-last", "take-while", "drop", "drop-last", "drop-while", "sort", "sort-by", "random-sample!", "rand-nth!", "shuffle!", "distinct", "remove", "remove-at", "split-at", "split-with", "frequencies", "group-by", "partition", "partition-all", "partition-by"];
|
|
5
|
+
readonly math: readonly ["+", "-", "*", "/", "mod", "rem", "quot", "inc", "dec", "sqrt", "cbrt", "pow", "exp", "round", "trunc", "floor", "ceil", "min", "max", "abs", "sign", "positive-infinity", "negative-infinity", "max-safe-integer", "min-safe-integer", "max-value", "min-value", "epsilon", "nan", "e", "pi", "log", "log2", "log10", "rand!", "rand-int!", "sin", "cos", "tan", "asin", "acos", "atan", "sinh", "cosh", "tanh", "asinh", "acosh", "atanh"];
|
|
6
|
+
readonly functional: readonly ["apply", "identity", "partial", "comp", "constantly", "juxt", "complement", "every-pred", "some-pred", "fnil"];
|
|
7
|
+
readonly misc: readonly ["not=", "=", "<", ">", "<=", ">=", "not", "write!", "inst-ms!", "iso-date-time->inst-ms", "inst-ms->iso-date-time", "boolean", "compare", "lits-version!", "uuid!", "equal?", "json-parse", "json-stringify"];
|
|
8
|
+
readonly object: readonly ["dissoc", "object", "keys", "vals", "entries", "find", "merge", "merge-with", "zipmap", "select-keys"];
|
|
9
|
+
readonly predicate: readonly ["boolean?", "nil?", "number?", "string?", "function?", "integer?", "array?", "object?", "coll?", "seq?", "regexp?", "zero?", "pos?", "neg?", "even?", "odd?", "finite?", "nan?", "negative-infinity?", "positive-infinity?", "false?", "true?", "empty?", "not-empty?"];
|
|
10
|
+
readonly regularExpression: readonly ["regexp", "match", "replace"];
|
|
11
|
+
readonly specialExpressions: readonly ["and", "or", "def", "defs", "let", "if-let", "when-let", "when-first", "fn", "defn", "defns", "try", "throw", "if", "if-not", "cond", "when", "when-not", "comment", "do", "recur", "loop", "time!", "doseq", "for", "declared?", "??"];
|
|
12
|
+
readonly string: readonly ["subs", "string-repeat", "str", "number", "number-to-string", "lower-case", "upper-case", "trim", "trim-left", "trim-right", "pad-left", "pad-right", "split", "template", "to-char-code", "from-char-code", "encode-base64", "decode-base64", "encode-uri-component", "decode-uri-component", "join"];
|
|
13
|
+
readonly bitwise: readonly ["bit-shift-left", "bit-shift-right", "bit-not", "bit-and", "bit-and-not", "bit-or", "bit-xor", "bit-flip", "bit-clear", "bit-set", "bit-test"];
|
|
14
|
+
readonly assert: readonly ["assert", "assert=", "assert-not=", "assert-equal", "assert-not-equal", "assert>", "assert<", "assert>=", "assert<=", "assert-true", "assert-false", "assert-truthy", "assert-falsy", "assert-nil", "assert-throws", "assert-throws-error", "assert-not-throws"];
|
|
15
|
+
readonly shorthand: ["_short_regexp", "_short_fn", "_short_string", "_short_dot", "_short_hash"];
|
|
16
|
+
readonly datatype: ["_type_number", "_type_string", "_type_object", "_type_array", "_type_boolean", "_type_function", "_type_integer", "_type_any", "_type_nil", "_type_collection", "_type_sequence", "_type_regexp", "_type_never"];
|
|
17
|
+
};
|
|
18
|
+
export type CollectionApiName = typeof api.collection[number];
|
|
19
|
+
export type ArrayApiName = typeof api.array[number];
|
|
20
|
+
export type SequenceApiName = typeof api.sequence[number];
|
|
21
|
+
export type MathApiName = typeof api.math[number];
|
|
22
|
+
export type FunctionalApiName = typeof api.functional[number];
|
|
23
|
+
export type MiscApiName = typeof api.misc[number];
|
|
24
|
+
export type ObjectApiName = typeof api.object[number];
|
|
25
|
+
export type PredicateApiName = typeof api.predicate[number];
|
|
26
|
+
export type RegularExpressionApiName = typeof api.regularExpression[number];
|
|
27
|
+
export type SpecialExpressionsApiName = typeof api.specialExpressions[number];
|
|
28
|
+
export type StringApiName = typeof api.string[number];
|
|
29
|
+
export type BitwiseApiName = typeof api.bitwise[number];
|
|
30
|
+
export type AssertApiName = typeof api.assert[number];
|
|
31
|
+
export type FunctionName = CollectionApiName | ArrayApiName | SequenceApiName | MathApiName | FunctionalApiName | MiscApiName | ObjectApiName | PredicateApiName | RegularExpressionApiName | SpecialExpressionsApiName | StringApiName | BitwiseApiName | AssertApiName;
|
|
32
|
+
export type ShorthandName = typeof api.shorthand[number];
|
|
33
|
+
export type DatatypeName = typeof api.datatype[number];
|
|
34
|
+
declare const apiNames: readonly ["count", "get", "get-in", "contains?", "has?", "has-some?", "has-every?", "assoc", "assoc-in", "concat", "not-empty", "every?", "not-every?", "any?", "not-any?", "update", "update-in", "array", "range", "repeat", "flatten", "mapcat", "nth", "push", "pop", "unshift", "shift", "slice", "reductions", "reduce", "reduce-right", "map", "filter", "position", "index-of", "some", "reverse", "first", "second", "last", "rest", "nthrest", "next", "nthnext", "cons", "take", "take-last", "take-while", "drop", "drop-last", "drop-while", "sort", "sort-by", "random-sample!", "rand-nth!", "shuffle!", "distinct", "remove", "remove-at", "split-at", "split-with", "frequencies", "group-by", "partition", "partition-all", "partition-by", "+", "-", "*", "/", "mod", "rem", "quot", "inc", "dec", "sqrt", "cbrt", "pow", "exp", "round", "trunc", "floor", "ceil", "min", "max", "abs", "sign", "positive-infinity", "negative-infinity", "max-safe-integer", "min-safe-integer", "max-value", "min-value", "epsilon", "nan", "e", "pi", "log", "log2", "log10", "rand!", "rand-int!", "sin", "cos", "tan", "asin", "acos", "atan", "sinh", "cosh", "tanh", "asinh", "acosh", "atanh", "apply", "identity", "partial", "comp", "constantly", "juxt", "complement", "every-pred", "some-pred", "fnil", "not=", "=", "<", ">", "<=", ">=", "not", "write!", "inst-ms!", "iso-date-time->inst-ms", "inst-ms->iso-date-time", "boolean", "compare", "lits-version!", "uuid!", "equal?", "json-parse", "json-stringify", "dissoc", "object", "keys", "vals", "entries", "find", "merge", "merge-with", "zipmap", "select-keys", "boolean?", "nil?", "number?", "string?", "function?", "integer?", "array?", "object?", "coll?", "seq?", "regexp?", "zero?", "pos?", "neg?", "even?", "odd?", "finite?", "nan?", "negative-infinity?", "positive-infinity?", "false?", "true?", "empty?", "not-empty?", "regexp", "match", "replace", "and", "or", "def", "defs", "let", "if-let", "when-let", "when-first", "fn", "defn", "defns", "try", "throw", "if", "if-not", "cond", "when", "when-not", "comment", "do", "recur", "loop", "time!", "doseq", "for", "declared?", "??", "subs", "string-repeat", "str", "number", "number-to-string", "lower-case", "upper-case", "trim", "trim-left", "trim-right", "pad-left", "pad-right", "split", "template", "to-char-code", "from-char-code", "encode-base64", "decode-base64", "encode-uri-component", "decode-uri-component", "join", "bit-shift-left", "bit-shift-right", "bit-not", "bit-and", "bit-and-not", "bit-or", "bit-xor", "bit-flip", "bit-clear", "bit-set", "bit-test", "assert", "assert=", "assert-not=", "assert-equal", "assert-not-equal", "assert>", "assert<", "assert>=", "assert<=", "assert-true", "assert-false", "assert-truthy", "assert-falsy", "assert-nil", "assert-throws", "assert-throws-error", "assert-not-throws", "_short_regexp", "_short_fn", "_short_string", "_short_dot", "_short_hash", "_type_number", "_type_string", "_type_object", "_type_array", "_type_boolean", "_type_function", "_type_integer", "_type_any", "_type_nil", "_type_collection", "_type_sequence", "_type_regexp", "_type_never"];
|
|
35
|
+
export type ApiName = typeof apiNames[number];
|
|
36
|
+
export declare function isApiName(arg: string): arg is ApiName;
|
|
37
|
+
export declare const categoryRecord: {
|
|
38
|
+
readonly 'Special expression': true;
|
|
39
|
+
readonly Predicate: true;
|
|
40
|
+
readonly Sequence: true;
|
|
41
|
+
readonly Collection: true;
|
|
42
|
+
readonly Array: true;
|
|
43
|
+
readonly Object: true;
|
|
44
|
+
readonly String: true;
|
|
45
|
+
readonly Math: true;
|
|
46
|
+
readonly Functional: true;
|
|
47
|
+
readonly 'Regular expression': true;
|
|
48
|
+
readonly Bitwise: true;
|
|
49
|
+
readonly Misc: true;
|
|
50
|
+
readonly Assert: true;
|
|
51
|
+
readonly Shorthand: true;
|
|
52
|
+
readonly Datatype: true;
|
|
53
|
+
};
|
|
54
|
+
export type Category = keyof typeof categoryRecord;
|
|
55
|
+
export declare const categories: ("String" | "Functional" | "Special expression" | "Predicate" | "Sequence" | "Collection" | "Array" | "Object" | "Math" | "Regular expression" | "Bitwise" | "Misc" | "Assert" | "Shorthand" | "Datatype")[];
|
|
56
|
+
declare const dataTypes: readonly ["number", "string", "object", "array", "boolean", "function", "integer", "any", "nil", "collection", "sequence", "regexp", "never"];
|
|
57
|
+
export type DataType = typeof dataTypes[number];
|
|
58
|
+
export declare function isDataType(arg: string): arg is DataType;
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ApiName, Category, DataType } from './api';
|
|
2
|
+
export interface TypedValue {
|
|
3
|
+
type: DataType[] | DataType;
|
|
4
|
+
rest?: true;
|
|
5
|
+
array?: true;
|
|
6
|
+
}
|
|
7
|
+
type NormalExpressionArgument = TypedValue & {
|
|
8
|
+
description?: string;
|
|
9
|
+
};
|
|
10
|
+
interface SpecialExpressionArgument {
|
|
11
|
+
type: '*expression' | '*name' | '*binding' | '*arguments' | '*catch-expression' | '*conditions' | '*for-binding';
|
|
12
|
+
rest?: true;
|
|
13
|
+
array?: true;
|
|
14
|
+
description?: string;
|
|
15
|
+
}
|
|
16
|
+
export type Argument = NormalExpressionArgument | SpecialExpressionArgument;
|
|
17
|
+
export declare function isSpecialExpressionArgument(arg?: Argument): arg is SpecialExpressionArgument;
|
|
18
|
+
export declare function isNormalExpressionArgument(arg?: Argument): arg is NormalExpressionArgument;
|
|
19
|
+
export declare function isTypedValue(arg?: Argument): arg is TypedValue;
|
|
20
|
+
interface Variant {
|
|
21
|
+
argumentNames: string[];
|
|
22
|
+
}
|
|
23
|
+
export interface CommonReference<T extends Category> {
|
|
24
|
+
title: string;
|
|
25
|
+
category: T;
|
|
26
|
+
linkName: string;
|
|
27
|
+
examples: string[];
|
|
28
|
+
description: string;
|
|
29
|
+
clojureDocs?: string | null;
|
|
30
|
+
seeAlso?: ApiName[];
|
|
31
|
+
}
|
|
32
|
+
export interface FunctionReference<T extends Category = Category> extends CommonReference<T> {
|
|
33
|
+
returns: TypedValue;
|
|
34
|
+
args: Record<string, Argument>;
|
|
35
|
+
variants: Variant[];
|
|
36
|
+
}
|
|
37
|
+
export interface ShorthandReference extends CommonReference<'Shorthand'> {
|
|
38
|
+
shorthand: true;
|
|
39
|
+
linkName: `_short_${string}`;
|
|
40
|
+
}
|
|
41
|
+
export interface DatatypeReference extends CommonReference<'Datatype'> {
|
|
42
|
+
datatype: true;
|
|
43
|
+
linkName: `_type_${string}`;
|
|
44
|
+
}
|
|
45
|
+
export type Reference<T extends Category = Category> = FunctionReference<T> | ShorthandReference | DatatypeReference;
|
|
46
|
+
export declare function isFunctionReference<T extends Category>(ref: Reference<T>): ref is FunctionReference<T>;
|
|
47
|
+
export declare function isShorthandReference<T extends Category>(ref: Reference<T>): ref is ShorthandReference;
|
|
48
|
+
export declare function isDatatypeReference<T extends Category>(ref: Reference<T>): ref is DatatypeReference;
|
|
49
|
+
export declare const apiReference: Record<ApiName, Reference>;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Ast } from '../parser/interface';
|
|
2
|
+
export declare class Cache {
|
|
3
|
+
private cache;
|
|
4
|
+
private firstEntry;
|
|
5
|
+
private lastEntry;
|
|
6
|
+
private _size;
|
|
7
|
+
private maxSize;
|
|
8
|
+
constructor(maxSize: number | null);
|
|
9
|
+
getContent(): Record<string, Ast>;
|
|
10
|
+
get size(): number;
|
|
11
|
+
get(key: string): Ast | undefined;
|
|
12
|
+
clear(): void;
|
|
13
|
+
has(key: string): boolean;
|
|
14
|
+
set(key: string, value: Ast): void;
|
|
15
|
+
private dropFirstEntry;
|
|
16
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { AnalyzeResult } from '../analyze/interface';
|
|
2
|
+
import { ContextStack } from '../evaluator/ContextStack';
|
|
3
|
+
import type { Context } from '../evaluator/interface';
|
|
4
|
+
import type { Any } from '../interface';
|
|
5
|
+
import type { Ast, LitsFunction } from '../parser/interface';
|
|
6
|
+
import type { TokenStream } from '../tokenizer/interface';
|
|
7
|
+
import { Cache } from './Cache';
|
|
8
|
+
export interface LitsRuntimeInfo {
|
|
9
|
+
astCache: Cache | null;
|
|
10
|
+
astCacheSize: number | null;
|
|
11
|
+
debug: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface LazyValue {
|
|
14
|
+
read: () => unknown;
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
export interface JsFunction {
|
|
18
|
+
fn: (...args: any[]) => unknown;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
export interface LitsParams {
|
|
22
|
+
globalContext?: Context;
|
|
23
|
+
contexts?: Context[];
|
|
24
|
+
values?: Record<string, unknown>;
|
|
25
|
+
lazyValues?: Record<string, LazyValue>;
|
|
26
|
+
jsFunctions?: Record<string, JsFunction>;
|
|
27
|
+
filePath?: string;
|
|
28
|
+
}
|
|
29
|
+
interface LitsConfig {
|
|
30
|
+
initialCache?: Record<string, Ast>;
|
|
31
|
+
astCacheSize?: number | null;
|
|
32
|
+
debug?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare class Lits {
|
|
35
|
+
private astCache;
|
|
36
|
+
private astCacheSize;
|
|
37
|
+
private debug;
|
|
38
|
+
constructor(config?: LitsConfig);
|
|
39
|
+
getRuntimeInfo(): LitsRuntimeInfo;
|
|
40
|
+
run(program: string, params?: LitsParams): unknown;
|
|
41
|
+
context(program: string, params?: LitsParams): Context;
|
|
42
|
+
analyze(program: string): AnalyzeResult;
|
|
43
|
+
tokenize(program: string, filePath?: string): TokenStream;
|
|
44
|
+
parse(tokenStream: TokenStream): Ast;
|
|
45
|
+
private evaluate;
|
|
46
|
+
apply(fn: LitsFunction, fnParams: unknown[], params?: LitsParams): Any;
|
|
47
|
+
private generateAst;
|
|
48
|
+
}
|
|
49
|
+
export declare function createContextStack(params?: LitsParams): ContextStack;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Builtin } from '../builtin/interface';
|
|
2
|
+
import type { ContextStack } from '../evaluator/ContextStack';
|
|
3
|
+
import type { AstNode } from '../parser/interface';
|
|
4
|
+
import type { Token } from '../tokenizer/interface';
|
|
5
|
+
export interface UndefinedSymbolEntry {
|
|
6
|
+
symbol: string;
|
|
7
|
+
token: Token | undefined;
|
|
8
|
+
}
|
|
9
|
+
export interface AnalyzeResult {
|
|
10
|
+
undefinedSymbols: Set<UndefinedSymbolEntry>;
|
|
11
|
+
}
|
|
12
|
+
export type AnalyzeAst = (astNode: AstNode | AstNode[], contextStack: ContextStack, builtin: Builtin) => AnalyzeResult;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Builtin, BuiltinSpecialExpressions } from './interface';
|
|
2
|
+
export declare const specialExpressions: BuiltinSpecialExpressions;
|
|
3
|
+
export declare const builtin: Builtin;
|
|
4
|
+
export declare const normalExpressionKeys: string[];
|
|
5
|
+
export declare const specialExpressionKeys: string[];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { EvaluateAstNode, ExecuteFunction } from '../evaluator/interface';
|
|
2
|
+
import type { NormalExpressionNode, ParseArgument, ParseBinding, ParseBindings, ParseExpression, ParseToken, ParseTokens, SpecialExpressionNode } from '../parser/interface';
|
|
3
|
+
import type { SourceCodeInfo, TokenStream } from '../tokenizer/interface';
|
|
4
|
+
import type { Any, Arr } from '../interface';
|
|
5
|
+
import type { AnalyzeAst, AnalyzeResult } from '../analyze/interface';
|
|
6
|
+
import type { ContextStack } from '../evaluator/ContextStack';
|
|
7
|
+
export type NormalExpressionEvaluator<T> = (params: Arr, sourceCodeInfo: SourceCodeInfo | undefined, contextStack: ContextStack, { executeFunction }: {
|
|
8
|
+
executeFunction: ExecuteFunction;
|
|
9
|
+
}) => T;
|
|
10
|
+
type ValidateNode = (node: NormalExpressionNode) => void;
|
|
11
|
+
interface BuiltinNormalExpression<T> {
|
|
12
|
+
evaluate: NormalExpressionEvaluator<T>;
|
|
13
|
+
validate?: ValidateNode;
|
|
14
|
+
}
|
|
15
|
+
export interface ParserHelpers {
|
|
16
|
+
parseExpression: ParseExpression;
|
|
17
|
+
parseTokens: ParseTokens;
|
|
18
|
+
parseToken: ParseToken;
|
|
19
|
+
parseBinding: ParseBinding;
|
|
20
|
+
parseBindings: ParseBindings;
|
|
21
|
+
parseArgument: ParseArgument;
|
|
22
|
+
}
|
|
23
|
+
export type BuiltinNormalExpressions = Record<string, BuiltinNormalExpression<Any>>;
|
|
24
|
+
export type BuiltinSpecialExpressions = Record<string, BuiltinSpecialExpression<Any>>;
|
|
25
|
+
interface EvaluateHelpers {
|
|
26
|
+
evaluateAstNode: EvaluateAstNode;
|
|
27
|
+
builtin: Builtin;
|
|
28
|
+
}
|
|
29
|
+
export interface BuiltinSpecialExpression<T> {
|
|
30
|
+
parse: (tokenStream: TokenStream, position: number, parsers: ParserHelpers) => [number, SpecialExpressionNode];
|
|
31
|
+
evaluate: (node: SpecialExpressionNode, contextStack: ContextStack, helpers: EvaluateHelpers) => T;
|
|
32
|
+
validate?: (node: SpecialExpressionNode) => void;
|
|
33
|
+
analyze: (node: SpecialExpressionNode, contextStack: ContextStack, params: {
|
|
34
|
+
analyzeAst: AnalyzeAst;
|
|
35
|
+
builtin: Builtin;
|
|
36
|
+
}) => AnalyzeResult;
|
|
37
|
+
}
|
|
38
|
+
export type SpecialExpressionName = 'and' | 'block' | 'comment' | 'cond' | 'def' | 'defn' | 'defns' | 'defs' | 'do' | 'doseq' | 'fn' | 'for' | 'function' | 'if-let' | 'if-not' | 'if' | 'let' | 'loop' | 'or' | 'partial' | 'recur' | 'return-from' | 'return' | 'throw' | 'time!' | 'try' | 'when-first' | 'when-let' | 'when-not' | 'when' | 'declared?' | '??';
|
|
39
|
+
export interface Builtin {
|
|
40
|
+
normalExpressions: BuiltinNormalExpressions;
|
|
41
|
+
specialExpressions: BuiltinSpecialExpressions;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Arr } from '../../../interface';
|
|
2
|
+
import type { BuiltinNormalExpressions, NormalExpressionEvaluator } from '../../interface';
|
|
3
|
+
export declare const evaluateMap: NormalExpressionEvaluator<Arr | string>;
|
|
4
|
+
export declare const sequenceNormalExpression: BuiltinNormalExpressions;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Any } from '../../interface';
|
|
2
|
+
import type { AstNode } from '../../parser/interface';
|
|
3
|
+
import type { BuiltinSpecialExpression } from '../interface';
|
|
4
|
+
export interface Condition {
|
|
5
|
+
t: AstNode;
|
|
6
|
+
f: AstNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const condSpecialExpression: BuiltinSpecialExpression<Any>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LitsFunction, SpecialExpressionNode } from '../../parser/interface';
|
|
2
|
+
import type { BuiltinSpecialExpression } from '../interface';
|
|
3
|
+
import type { FunctionOverload } from '../utils';
|
|
4
|
+
export type FnNode = SpecialExpressionNode & {
|
|
5
|
+
o: FunctionOverload[];
|
|
6
|
+
};
|
|
7
|
+
export declare const defnSpecialExpression: BuiltinSpecialExpression<null>;
|
|
8
|
+
export declare const defnsSpecialExpression: BuiltinSpecialExpression<null>;
|
|
9
|
+
export declare const fnSpecialExpression: BuiltinSpecialExpression<LitsFunction>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Any } from '../../interface';
|
|
2
|
+
import type { AstNode, BindingNode } from '../../parser/interface';
|
|
3
|
+
import type { BuiltinSpecialExpression } from '../interface';
|
|
4
|
+
export interface LoopBindingNode {
|
|
5
|
+
b: BindingNode;
|
|
6
|
+
m: Array<'&let' | '&when' | '&while'>;
|
|
7
|
+
l?: BindingNode[];
|
|
8
|
+
wn?: AstNode;
|
|
9
|
+
we?: AstNode;
|
|
10
|
+
}
|
|
11
|
+
export declare const forSpecialExpression: BuiltinSpecialExpression<Any>;
|
|
12
|
+
export declare const doseqSpecialExpression: BuiltinSpecialExpression<null>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ContextStack } from '../evaluator/ContextStack';
|
|
2
|
+
import type { AstNode, BindingNode } from '../parser/interface';
|
|
3
|
+
import type { SourceCodeInfo } from '../tokenizer/interface';
|
|
4
|
+
import type { Builtin } from './interface';
|
|
5
|
+
export type Arity = number | {
|
|
6
|
+
min: number;
|
|
7
|
+
};
|
|
8
|
+
export interface FunctionOverload {
|
|
9
|
+
as: FunctionArguments;
|
|
10
|
+
a: Arity;
|
|
11
|
+
b: AstNode[];
|
|
12
|
+
}
|
|
13
|
+
export interface FunctionArguments {
|
|
14
|
+
m: string[];
|
|
15
|
+
r?: string;
|
|
16
|
+
b: BindingNode[];
|
|
17
|
+
}
|
|
18
|
+
export declare function assertNameNotDefined<T>(name: T, contextStack: ContextStack, builtin: Builtin, sourceCodeInfo?: SourceCodeInfo): asserts name is T;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare enum AstNodeType {
|
|
2
|
+
Number = 201,
|
|
3
|
+
String = 202,
|
|
4
|
+
NormalExpression = 203,
|
|
5
|
+
SpecialExpression = 204,
|
|
6
|
+
Name = 205,
|
|
7
|
+
Modifier = 206,
|
|
8
|
+
ReservedName = 207,
|
|
9
|
+
Binding = 208,
|
|
10
|
+
Argument = 209,
|
|
11
|
+
Partial = 210
|
|
12
|
+
}
|
|
13
|
+
export declare const astNodeTypeName: Map<AstNodeType, string>;
|
|
14
|
+
export declare function isAstNodeType(type: unknown): type is AstNodeType;
|
|
15
|
+
export declare enum TokenType {
|
|
16
|
+
Bracket = 101,
|
|
17
|
+
Number = 102,
|
|
18
|
+
Name = 103,
|
|
19
|
+
String = 104,
|
|
20
|
+
ReservedName = 105,
|
|
21
|
+
Modifier = 106,
|
|
22
|
+
RegexpShorthand = 107,
|
|
23
|
+
FnShorthand = 108,
|
|
24
|
+
CollectionAccessor = 109
|
|
25
|
+
}
|
|
26
|
+
export declare const tokenTypeName: Map<TokenType, string>;
|
|
27
|
+
export declare function isTokenType(type: unknown): type is TokenType;
|
|
28
|
+
export declare enum FunctionType {
|
|
29
|
+
UserDefined = 301,
|
|
30
|
+
Partial = 302,
|
|
31
|
+
Comp = 303,
|
|
32
|
+
Constantly = 304,
|
|
33
|
+
Juxt = 305,
|
|
34
|
+
Complement = 306,
|
|
35
|
+
EveryPred = 307,
|
|
36
|
+
SomePred = 308,
|
|
37
|
+
Fnil = 309,
|
|
38
|
+
Builtin = 310,
|
|
39
|
+
NativeJsFunction = 399
|
|
40
|
+
}
|
|
41
|
+
export declare const functionTypeName: Map<FunctionType, string>;
|
|
42
|
+
export declare function isFunctionType(type: unknown): type is FunctionType;
|