@mojir/lits 2.0.22 → 2.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/dist/cli/cli/src/cliDocumentation/getCliType.d.ts +1 -1
- package/dist/cli/cli.js +7146 -9278
- package/dist/cli/reference/api.d.ts +21 -18
- package/dist/cli/reference/categories/array.d.ts +2 -2
- package/dist/cli/reference/categories/assert.d.ts +2 -2
- package/dist/cli/reference/categories/bitwise.d.ts +2 -2
- package/dist/cli/reference/categories/collection.d.ts +2 -2
- package/dist/cli/reference/categories/functional.d.ts +2 -2
- package/dist/cli/reference/categories/math.d.ts +1 -1
- package/dist/cli/reference/categories/misc.d.ts +1 -1
- package/dist/cli/reference/categories/object.d.ts +1 -1
- package/dist/cli/reference/categories/regularExpression.d.ts +1 -1
- package/dist/cli/reference/categories/sequence.d.ts +1 -1
- package/dist/cli/reference/categories/specialExpressions.d.ts +3 -3
- package/dist/cli/reference/categories/string.d.ts +1 -1
- package/dist/cli/reference/index.d.ts +225 -16
- package/dist/cli/src/Lits/Cache.d.ts +1 -1
- package/dist/cli/src/Lits/Lits.d.ts +15 -15
- package/dist/cli/src/builtin/bindingNode.d.ts +4 -0
- package/dist/cli/src/builtin/index.d.ts +43 -23
- package/dist/cli/src/builtin/interface.d.ts +11 -11
- package/dist/cli/src/builtin/specialExpressions/and.d.ts +1 -1
- package/dist/cli/src/builtin/specialExpressions/array.d.ts +6 -0
- package/dist/cli/src/builtin/specialExpressions/cond.d.ts +1 -1
- package/dist/cli/src/builtin/specialExpressions/declared.d.ts +1 -1
- package/dist/cli/src/builtin/specialExpressions/def.d.ts +5 -2
- package/dist/cli/src/builtin/specialExpressions/do.d.ts +1 -1
- package/dist/cli/src/builtin/specialExpressions/functions.d.ts +11 -6
- package/dist/cli/src/builtin/specialExpressions/if.d.ts +1 -1
- package/dist/cli/src/builtin/specialExpressions/let.d.ts +5 -3
- package/dist/cli/src/builtin/specialExpressions/loop.d.ts +2 -2
- package/dist/cli/src/builtin/specialExpressions/loops.d.ts +1 -1
- package/dist/cli/src/builtin/specialExpressions/object.d.ts +6 -0
- package/dist/cli/src/builtin/specialExpressions/or.d.ts +1 -1
- package/dist/cli/src/builtin/specialExpressions/qq.d.ts +1 -1
- package/dist/cli/src/builtin/specialExpressions/recur.d.ts +1 -1
- package/dist/cli/src/builtin/specialExpressions/switch.d.ts +1 -1
- package/dist/cli/src/builtin/specialExpressions/throw.d.ts +1 -1
- package/dist/cli/src/builtin/specialExpressions/try.d.ts +1 -1
- package/dist/cli/src/builtin/specialExpressions/unless.d.ts +1 -1
- package/dist/cli/src/builtin/utils.d.ts +5 -14
- package/dist/cli/src/cliDocumentation/getCliType.d.ts +1 -1
- package/dist/cli/src/constants/constants.d.ts +5 -28
- package/dist/cli/src/errors.d.ts +1 -1
- package/dist/cli/src/evaluator/ContextStack.d.ts +7 -7
- package/dist/cli/src/evaluator/functionExecutors.d.ts +3 -3
- package/dist/cli/src/evaluator/index.d.ts +1 -1
- package/dist/cli/src/evaluator/interface.d.ts +3 -3
- package/dist/cli/src/getUndefinedSymbols/index.d.ts +7 -0
- package/dist/cli/src/interface.d.ts +1 -2
- package/dist/cli/src/parser/{AlgebraicParser.d.ts → Parser.d.ts} +17 -14
- package/dist/cli/src/parser/{interface.d.ts → types.d.ts} +90 -76
- package/dist/cli/src/symbolPatterns.d.ts +2 -0
- package/dist/cli/src/tokenizer/minifyTokenStream.d.ts +1 -1
- package/dist/cli/src/tokenizer/operators.d.ts +12 -0
- package/dist/cli/src/tokenizer/reservedNames.d.ts +115 -0
- package/dist/cli/src/tokenizer/token.d.ts +85 -0
- package/dist/cli/src/tokenizer/tokenize.d.ts +8 -0
- package/dist/cli/src/tokenizer/tokenizers.d.ts +12 -0
- package/dist/cli/src/transformer/index.d.ts +2 -2
- package/dist/cli/src/typeGuards/array.d.ts +1 -1
- package/dist/cli/src/typeGuards/astNode.d.ts +2 -2
- package/dist/cli/src/typeGuards/index.d.ts +7 -3
- package/dist/cli/src/typeGuards/lits.d.ts +2 -2
- package/dist/cli/src/typeGuards/litsFunction.d.ts +2 -2
- package/dist/cli/src/typeGuards/number.d.ts +1 -1
- package/dist/cli/src/typeGuards/string.d.ts +1 -1
- package/dist/cli/src/untokenizer/index.d.ts +1 -1
- package/dist/cli/src/utils/debug/getCodeMarker.d.ts +1 -1
- package/dist/cli/src/utils/debug/getSourceCodeInfo.d.ts +2 -2
- package/dist/cli/src/utils/getAssertionError.d.ts +1 -1
- package/dist/cli/src/utils/index.d.ts +5 -3
- package/dist/index.esm.js +7293 -9419
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +7292 -9424
- package/dist/index.js.map +1 -1
- package/dist/lits.iife.js +7292 -9424
- package/dist/lits.iife.js.map +1 -1
- package/dist/reference/api.d.ts +21 -18
- package/dist/reference/categories/array.d.ts +2 -2
- package/dist/reference/categories/assert.d.ts +2 -2
- package/dist/reference/categories/bitwise.d.ts +2 -2
- package/dist/reference/categories/collection.d.ts +2 -2
- package/dist/reference/categories/functional.d.ts +2 -2
- package/dist/reference/categories/math.d.ts +1 -1
- package/dist/reference/categories/misc.d.ts +1 -1
- package/dist/reference/categories/object.d.ts +1 -1
- package/dist/reference/categories/regularExpression.d.ts +1 -1
- package/dist/reference/categories/sequence.d.ts +1 -1
- package/dist/reference/categories/specialExpressions.d.ts +3 -3
- package/dist/reference/categories/string.d.ts +1 -1
- package/dist/reference/index.d.ts +225 -16
- package/dist/src/Lits/Cache.d.ts +1 -1
- package/dist/src/Lits/Lits.d.ts +15 -15
- package/dist/src/builtin/bindingNode.d.ts +4 -0
- package/dist/src/builtin/index.d.ts +43 -23
- package/dist/src/builtin/interface.d.ts +11 -11
- package/dist/src/builtin/specialExpressions/and.d.ts +1 -1
- package/dist/src/builtin/specialExpressions/array.d.ts +6 -0
- package/dist/src/builtin/specialExpressions/cond.d.ts +1 -1
- package/dist/src/builtin/specialExpressions/declared.d.ts +1 -1
- package/dist/src/builtin/specialExpressions/def.d.ts +5 -2
- package/dist/src/builtin/specialExpressions/do.d.ts +1 -1
- package/dist/src/builtin/specialExpressions/functions.d.ts +11 -6
- package/dist/src/builtin/specialExpressions/if.d.ts +1 -1
- package/dist/src/builtin/specialExpressions/let.d.ts +5 -3
- package/dist/src/builtin/specialExpressions/loop.d.ts +2 -2
- package/dist/src/builtin/specialExpressions/loops.d.ts +1 -1
- package/dist/src/builtin/specialExpressions/object.d.ts +6 -0
- package/dist/src/builtin/specialExpressions/or.d.ts +1 -1
- package/dist/src/builtin/specialExpressions/qq.d.ts +1 -1
- package/dist/src/builtin/specialExpressions/recur.d.ts +1 -1
- package/dist/src/builtin/specialExpressions/switch.d.ts +1 -1
- package/dist/src/builtin/specialExpressions/throw.d.ts +1 -1
- package/dist/src/builtin/specialExpressions/try.d.ts +1 -1
- package/dist/src/builtin/specialExpressions/unless.d.ts +1 -1
- package/dist/src/builtin/utils.d.ts +5 -14
- package/dist/src/constants/constants.d.ts +5 -28
- package/dist/src/errors.d.ts +1 -1
- package/dist/src/evaluator/ContextStack.d.ts +7 -7
- package/dist/src/evaluator/functionExecutors.d.ts +3 -3
- package/dist/src/evaluator/index.d.ts +1 -1
- package/dist/src/evaluator/interface.d.ts +3 -3
- package/dist/src/getUndefinedSymbols/index.d.ts +7 -0
- package/dist/src/index.d.ts +6 -9
- package/dist/src/interface.d.ts +1 -2
- package/dist/src/parser/{AlgebraicParser.d.ts → Parser.d.ts} +17 -14
- package/dist/src/parser/{interface.d.ts → types.d.ts} +90 -76
- package/dist/src/symbolPatterns.d.ts +2 -0
- package/dist/src/tokenizer/minifyTokenStream.d.ts +1 -1
- package/dist/src/tokenizer/operators.d.ts +12 -0
- package/dist/src/tokenizer/reservedNames.d.ts +115 -0
- package/dist/src/tokenizer/token.d.ts +85 -0
- package/dist/src/tokenizer/tokenize.d.ts +8 -0
- package/dist/src/tokenizer/tokenizers.d.ts +12 -0
- package/dist/src/transformer/index.d.ts +2 -2
- package/dist/src/typeGuards/array.d.ts +1 -1
- package/dist/src/typeGuards/astNode.d.ts +2 -2
- package/dist/src/typeGuards/index.d.ts +7 -3
- package/dist/src/typeGuards/lits.d.ts +2 -2
- package/dist/src/typeGuards/litsFunction.d.ts +2 -2
- package/dist/src/typeGuards/number.d.ts +1 -1
- package/dist/src/typeGuards/string.d.ts +1 -1
- package/dist/src/untokenizer/index.d.ts +1 -1
- package/dist/src/utils/debug/getCodeMarker.d.ts +1 -1
- package/dist/src/utils/debug/getSourceCodeInfo.d.ts +2 -2
- package/dist/src/utils/getAssertionError.d.ts +1 -1
- package/dist/src/utils/index.d.ts +5 -3
- package/dist/testFramework.esm.js +3102 -4317
- package/dist/testFramework.esm.js.map +1 -1
- package/dist/testFramework.js +3102 -4317
- package/dist/testFramework.js.map +1 -1
- package/package.json +2 -2
- package/dist/cli/common/clojureDocs.d.ts +0 -1
- package/dist/cli/src/analyze/findUnresolvedIdentifiers.d.ts +0 -2
- package/dist/cli/src/analyze/index.d.ts +0 -15
- package/dist/cli/src/analyze/utils.d.ts +0 -4
- package/dist/cli/src/builtin/specialExpressions/comment.d.ts +0 -5
- package/dist/cli/src/builtin/specialExpressions/commonParser.d.ts +0 -4
- package/dist/cli/src/identifier.d.ts +0 -4
- package/dist/cli/src/index.d.ts +0 -18
- package/dist/cli/src/parser/PolishTokenParsers.d.ts +0 -3
- package/dist/cli/src/parser/commonTokenParsers.d.ts +0 -7
- package/dist/cli/src/parser/index.d.ts +0 -3
- package/dist/cli/src/removeCommentNodes/index.d.ts +0 -11
- package/dist/cli/src/removeCommentNodes/removeCommentNodesFromSpecialExpression.d.ts +0 -3
- package/dist/cli/src/tokenizer/algebraic/algebraicReservedNames.d.ts +0 -107
- package/dist/cli/src/tokenizer/algebraic/algebraicTokenizers.d.ts +0 -11
- package/dist/cli/src/tokenizer/algebraic/algebraicTokens.d.ts +0 -66
- package/dist/cli/src/tokenizer/common/commonTokenizers.d.ts +0 -9
- package/dist/cli/src/tokenizer/common/commonTokens.d.ts +0 -43
- package/dist/cli/src/tokenizer/index.d.ts +0 -2
- package/dist/cli/src/tokenizer/interface.d.ts +0 -22
- package/dist/cli/src/tokenizer/polish/polishReservedNames.d.ts +0 -7
- package/dist/cli/src/tokenizer/polish/polishTokenizers.d.ts +0 -13
- package/dist/cli/src/tokenizer/polish/polishTokens.d.ts +0 -55
- package/dist/cli/src/tokenizer/sugar/applyCollectionAccessor.d.ts +0 -2
- package/dist/cli/src/tokenizer/sugar/index.d.ts +0 -3
- package/dist/cli/src/tokenizer/tokens.d.ts +0 -20
- package/dist/cli/src/tokenizer/utils.d.ts +0 -9
- package/dist/common/clojureDocs.d.ts +0 -1
- package/dist/src/analyze/findUnresolvedIdentifiers.d.ts +0 -2
- package/dist/src/analyze/index.d.ts +0 -15
- package/dist/src/analyze/utils.d.ts +0 -4
- package/dist/src/builtin/specialExpressions/comment.d.ts +0 -5
- package/dist/src/builtin/specialExpressions/commonParser.d.ts +0 -4
- package/dist/src/identifier.d.ts +0 -4
- package/dist/src/parser/PolishTokenParsers.d.ts +0 -3
- package/dist/src/parser/commonTokenParsers.d.ts +0 -7
- package/dist/src/parser/index.d.ts +0 -3
- package/dist/src/removeCommentNodes/index.d.ts +0 -11
- package/dist/src/removeCommentNodes/removeCommentNodesFromSpecialExpression.d.ts +0 -3
- package/dist/src/tokenizer/algebraic/algebraicReservedNames.d.ts +0 -107
- package/dist/src/tokenizer/algebraic/algebraicTokenizers.d.ts +0 -11
- package/dist/src/tokenizer/algebraic/algebraicTokens.d.ts +0 -66
- package/dist/src/tokenizer/common/commonTokenizers.d.ts +0 -9
- package/dist/src/tokenizer/common/commonTokens.d.ts +0 -43
- package/dist/src/tokenizer/index.d.ts +0 -2
- package/dist/src/tokenizer/interface.d.ts +0 -22
- package/dist/src/tokenizer/polish/polishReservedNames.d.ts +0 -7
- package/dist/src/tokenizer/polish/polishTokenizers.d.ts +0 -13
- package/dist/src/tokenizer/polish/polishTokens.d.ts +0 -55
- package/dist/src/tokenizer/sugar/applyCollectionAccessor.d.ts +0 -2
- package/dist/src/tokenizer/sugar/index.d.ts +0 -3
- package/dist/src/tokenizer/tokens.d.ts +0 -20
- package/dist/src/tokenizer/utils.d.ts +0 -9
|
@@ -1,33 +1,23 @@
|
|
|
1
|
-
import type { JsFunction
|
|
1
|
+
import type { JsFunction } from '../Lits/Lits';
|
|
2
2
|
import type { SpecialExpressionName, SpecialExpressionNode } from '../builtin';
|
|
3
|
-
import type { Arity } from '../builtin/utils';
|
|
4
3
|
import type { AstNodeType, FunctionType } from '../constants/constants';
|
|
5
4
|
import type { Context } from '../evaluator/interface';
|
|
6
5
|
import type { Any, Arr } from '../interface';
|
|
7
|
-
import type {
|
|
8
|
-
import type { SourceCodeInfo,
|
|
6
|
+
import type { TokenStream } from '../tokenizer/tokenize';
|
|
7
|
+
import type { ModifierName, SourceCodeInfo, Token } from '../tokenizer/token';
|
|
9
8
|
import type { FUNCTION_SYMBOL, REGEXP_SYMBOL } from '../utils/symbols';
|
|
10
|
-
import type { Token } from '../tokenizer/tokens';
|
|
11
|
-
import type { ModifierName } from '../tokenizer/polish/polishTokens';
|
|
12
9
|
export interface ParseState {
|
|
13
10
|
position: number;
|
|
14
|
-
parseToken: ParseToken;
|
|
15
11
|
}
|
|
16
|
-
export interface
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
export interface EvaluatedFunction {
|
|
13
|
+
arguments: BindingTarget[];
|
|
14
|
+
body: AstNode[];
|
|
15
|
+
context: Context;
|
|
19
16
|
}
|
|
20
|
-
export interface EvaluatedFunctionOverload {
|
|
21
|
-
as: EvaluatedFunctionArguments;
|
|
22
|
-
b: AstNode[];
|
|
23
|
-
a: Arity;
|
|
24
|
-
f: Context;
|
|
25
|
-
}
|
|
26
|
-
export type ExtraData = Record<string, LazyValue>;
|
|
27
17
|
interface GenericLitsFunction {
|
|
28
18
|
[FUNCTION_SYMBOL]: true;
|
|
29
19
|
sourceCodeInfo?: SourceCodeInfo;
|
|
30
|
-
|
|
20
|
+
functionType: FunctionType;
|
|
31
21
|
}
|
|
32
22
|
export interface RegularExpression {
|
|
33
23
|
[REGEXP_SYMBOL]: true;
|
|
@@ -36,65 +26,62 @@ export interface RegularExpression {
|
|
|
36
26
|
f: string;
|
|
37
27
|
}
|
|
38
28
|
export interface NativeJsFunction extends GenericLitsFunction {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
functionType: 'NativeJsFunction';
|
|
30
|
+
name: string | undefined;
|
|
31
|
+
nativeFn: JsFunction;
|
|
42
32
|
}
|
|
43
33
|
export interface UserDefinedFunction extends GenericLitsFunction {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
x?: ExtraData;
|
|
34
|
+
functionType: 'UserDefined';
|
|
35
|
+
name: string | undefined;
|
|
36
|
+
evaluatedfunction: EvaluatedFunction;
|
|
48
37
|
}
|
|
49
38
|
export interface PartialFunction extends GenericLitsFunction {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
39
|
+
functionType: 'Partial';
|
|
40
|
+
function: Any;
|
|
41
|
+
params: Arr;
|
|
53
42
|
}
|
|
54
43
|
export interface CompFunction extends GenericLitsFunction {
|
|
55
|
-
|
|
56
|
-
|
|
44
|
+
functionType: 'Comp';
|
|
45
|
+
params: Arr;
|
|
57
46
|
}
|
|
58
47
|
export interface ConstantlyFunction extends GenericLitsFunction {
|
|
59
|
-
|
|
60
|
-
|
|
48
|
+
functionType: 'Constantly';
|
|
49
|
+
value: Any;
|
|
61
50
|
}
|
|
62
51
|
export interface JuxtFunction extends GenericLitsFunction {
|
|
63
|
-
|
|
64
|
-
|
|
52
|
+
functionType: 'Juxt';
|
|
53
|
+
params: Arr;
|
|
65
54
|
}
|
|
66
55
|
export interface ComplementFunction extends GenericLitsFunction {
|
|
67
|
-
|
|
68
|
-
|
|
56
|
+
functionType: 'Complement';
|
|
57
|
+
function: Any;
|
|
69
58
|
}
|
|
70
59
|
export interface EveryPredFunction extends GenericLitsFunction {
|
|
71
|
-
|
|
72
|
-
|
|
60
|
+
functionType: 'EveryPred';
|
|
61
|
+
params: Arr;
|
|
73
62
|
}
|
|
74
63
|
export interface SomePredFunction extends GenericLitsFunction {
|
|
75
|
-
|
|
76
|
-
|
|
64
|
+
functionType: 'SomePred';
|
|
65
|
+
params: Arr;
|
|
77
66
|
}
|
|
78
|
-
export interface
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
67
|
+
export interface FNullFunction extends GenericLitsFunction {
|
|
68
|
+
functionType: 'Fnull';
|
|
69
|
+
function: Any;
|
|
70
|
+
params: Arr;
|
|
82
71
|
}
|
|
83
72
|
export interface BuiltinFunction extends GenericLitsFunction {
|
|
84
|
-
|
|
73
|
+
functionType: 'Builtin';
|
|
85
74
|
n: string;
|
|
86
75
|
}
|
|
87
|
-
export type LitsFunction = NativeJsFunction | UserDefinedFunction | BuiltinFunction | PartialFunction | CompFunction | ConstantlyFunction | JuxtFunction | ComplementFunction | EveryPredFunction | SomePredFunction |
|
|
88
|
-
export type LitsFunctionType = LitsFunction['
|
|
76
|
+
export type LitsFunction = NativeJsFunction | UserDefinedFunction | BuiltinFunction | PartialFunction | CompFunction | ConstantlyFunction | JuxtFunction | ComplementFunction | EveryPredFunction | SomePredFunction | FNullFunction;
|
|
77
|
+
export type LitsFunctionType = LitsFunction['functionType'];
|
|
89
78
|
export type DebugData = {
|
|
90
79
|
token: Token;
|
|
91
80
|
nameToken?: Token;
|
|
92
81
|
};
|
|
93
82
|
export interface GenericNode {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
n: string | undefined;
|
|
97
|
-
token: Token | undefined;
|
|
83
|
+
type: AstNodeType;
|
|
84
|
+
sourceCodeInfo?: SourceCodeInfo | undefined;
|
|
98
85
|
}
|
|
99
86
|
export type ExpressionNode = NormalExpressionNode | SpecialExpressionNode | NumberNode | StringNode;
|
|
100
87
|
export type ParseBinding = (tokens: TokenStream, parseState: ParseState) => BindingNode;
|
|
@@ -103,58 +90,85 @@ export type ParseArgument = (tokens: TokenStream, parseState: ParseState) => Arg
|
|
|
103
90
|
export type ParseExpression = (tokens: TokenStream, parseState: ParseState) => ExpressionNode;
|
|
104
91
|
export type ParseTokensUntilClosingBracket = (tokens: TokenStream, parseState: ParseState) => AstNode[];
|
|
105
92
|
export type ParseToken = (tokens: TokenStream, parseState: ParseState) => AstNode;
|
|
93
|
+
export interface SpreadNode extends GenericNode {
|
|
94
|
+
type: 'Spread';
|
|
95
|
+
value: AstNode;
|
|
96
|
+
}
|
|
106
97
|
export interface NumberNode extends GenericNode {
|
|
107
|
-
|
|
108
|
-
|
|
98
|
+
type: 'Number';
|
|
99
|
+
value: number;
|
|
109
100
|
}
|
|
110
101
|
export interface StringNode extends GenericNode {
|
|
111
|
-
|
|
112
|
-
|
|
102
|
+
type: 'String';
|
|
103
|
+
value: string;
|
|
113
104
|
}
|
|
114
105
|
export interface SymbolNode extends GenericNode {
|
|
115
|
-
|
|
116
|
-
|
|
106
|
+
type: 'Symbol';
|
|
107
|
+
value: string;
|
|
117
108
|
}
|
|
118
109
|
export interface ModifierNode extends GenericNode {
|
|
119
|
-
|
|
120
|
-
|
|
110
|
+
type: 'Modifier';
|
|
111
|
+
value: ModifierName;
|
|
121
112
|
}
|
|
122
113
|
export interface ReservedSymbolNode extends GenericNode {
|
|
123
|
-
|
|
124
|
-
|
|
114
|
+
type: 'ReservedSymbol';
|
|
115
|
+
value: string;
|
|
125
116
|
}
|
|
126
117
|
interface CommonNormalExpressionNode extends GenericNode {
|
|
127
|
-
|
|
118
|
+
type: 'NormalExpression';
|
|
119
|
+
params: AstNode[];
|
|
128
120
|
}
|
|
129
121
|
export interface CommonSpecialExpressionNode<T extends SpecialExpressionName> extends GenericNode {
|
|
130
|
-
|
|
131
|
-
|
|
122
|
+
type: 'SpecialExpression';
|
|
123
|
+
name: T;
|
|
124
|
+
params: AstNode[];
|
|
132
125
|
}
|
|
133
126
|
export interface NormalExpressionNodeWithName extends CommonNormalExpressionNode {
|
|
134
|
-
|
|
127
|
+
name: string;
|
|
135
128
|
}
|
|
136
129
|
interface NormalExpressionNodeExpression extends CommonNormalExpressionNode {
|
|
137
|
-
|
|
130
|
+
name: undefined;
|
|
138
131
|
}
|
|
139
132
|
export type NormalExpressionNode = NormalExpressionNodeWithName | NormalExpressionNodeExpression;
|
|
133
|
+
interface CommonBindingTarget {
|
|
134
|
+
sourceCodeInfo: SourceCodeInfo | undefined;
|
|
135
|
+
default?: AstNode;
|
|
136
|
+
}
|
|
137
|
+
export type SymbolBindingTarget = CommonBindingTarget & {
|
|
138
|
+
type: 'symbol';
|
|
139
|
+
name: string;
|
|
140
|
+
};
|
|
141
|
+
export type RestBindingTarget = CommonBindingTarget & {
|
|
142
|
+
type: 'rest';
|
|
143
|
+
name: string;
|
|
144
|
+
};
|
|
145
|
+
export type ObjectBindingTarget = CommonBindingTarget & {
|
|
146
|
+
type: 'object';
|
|
147
|
+
elements: Record<string, BindingTarget>;
|
|
148
|
+
};
|
|
149
|
+
export type ArrayBindingTarget = CommonBindingTarget & {
|
|
150
|
+
type: 'array';
|
|
151
|
+
elements: (BindingTarget | null)[];
|
|
152
|
+
};
|
|
153
|
+
export type BindingTarget = SymbolBindingTarget | RestBindingTarget | ObjectBindingTarget | ArrayBindingTarget;
|
|
140
154
|
export interface BindingNode extends GenericNode {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
155
|
+
type: 'Binding';
|
|
156
|
+
target: BindingTarget;
|
|
157
|
+
value: AstNode;
|
|
144
158
|
}
|
|
145
159
|
export interface ArgumentNode extends GenericNode {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
160
|
+
type: 'Argument';
|
|
161
|
+
name: string;
|
|
162
|
+
default?: AstNode;
|
|
149
163
|
}
|
|
150
164
|
export interface CommentNode extends GenericNode {
|
|
151
|
-
|
|
152
|
-
|
|
165
|
+
type: 'Comment';
|
|
166
|
+
value: string;
|
|
153
167
|
}
|
|
154
|
-
export type AstNode = NumberNode | StringNode | ReservedSymbolNode | SymbolNode | CommentNode | NormalExpressionNode | ModifierNode | SpecialExpressionNode;
|
|
168
|
+
export type AstNode = NumberNode | StringNode | ReservedSymbolNode | SymbolNode | CommentNode | NormalExpressionNode | ModifierNode | SpecialExpressionNode | SpreadNode;
|
|
155
169
|
type AstBody = AstNode[];
|
|
156
170
|
export interface Ast {
|
|
157
|
-
|
|
171
|
+
body: AstBody;
|
|
158
172
|
hasDebugData: boolean;
|
|
159
173
|
}
|
|
160
174
|
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare const binaryOperators: readonly ["**", "*", "/", "%", "+", "-", "<<", ">>", ">>>", "++", "<", "<=", "≤", ">", ">=", "≥", "=", "!=", "≠", "&", "^", "|", "&&", "||", "??"];
|
|
2
|
+
declare const symbolicOperators: readonly ["**", "*", "/", "%", "+", "-", "<<", ">>", ">>>", "++", "<", "<=", "≤", ">", ">=", "≥", "=", "!=", "≠", "&", "^", "|", "&&", "||", "??", "->", "...", ".", ",", ":=", ";"];
|
|
3
|
+
export declare function isFunctionOperator(operator: string): boolean;
|
|
4
|
+
export type SymbolicBinaryOperator = typeof binaryOperators[number];
|
|
5
|
+
export type SymbolicOperator = typeof symbolicOperators[number];
|
|
6
|
+
export declare function isBinaryOperator(operator: string): operator is SymbolicBinaryOperator;
|
|
7
|
+
export declare function assertBinaryOperator(operator: string): asserts operator is SymbolicBinaryOperator;
|
|
8
|
+
export declare function asBinaryOperator(operator: string): SymbolicBinaryOperator;
|
|
9
|
+
export declare function isSymbolicOperator(operator: string): operator is SymbolicOperator;
|
|
10
|
+
export declare function assertSymbolicOperator(operator: string): asserts operator is SymbolicOperator;
|
|
11
|
+
export declare function asSymbolicOperator(operator: string): SymbolicOperator;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
export declare const numberReservedSymbolRecord: {
|
|
2
|
+
readonly E: number;
|
|
3
|
+
readonly '-E': number;
|
|
4
|
+
readonly ε: number;
|
|
5
|
+
readonly '-\u03B5': number;
|
|
6
|
+
readonly PI: number;
|
|
7
|
+
readonly '-PI': number;
|
|
8
|
+
readonly π: number;
|
|
9
|
+
readonly '-\u03C0': number;
|
|
10
|
+
readonly PHI: number;
|
|
11
|
+
readonly '-PHI': number;
|
|
12
|
+
readonly φ: number;
|
|
13
|
+
readonly '-\u03C6': number;
|
|
14
|
+
readonly POSITIVE_INFINITY: number;
|
|
15
|
+
readonly '\u221E': number;
|
|
16
|
+
readonly NEGATIVE_INFINITY: number;
|
|
17
|
+
readonly '-\u221E': number;
|
|
18
|
+
readonly MAX_SAFE_INTEGER: number;
|
|
19
|
+
readonly MIN_SAFE_INTEGER: number;
|
|
20
|
+
readonly MAX_VALUE: number;
|
|
21
|
+
readonly MIN_VALUE: number;
|
|
22
|
+
readonly DELTA: number;
|
|
23
|
+
readonly '-DELTA': number;
|
|
24
|
+
readonly δ: number;
|
|
25
|
+
readonly '-\u03B4': number;
|
|
26
|
+
readonly NaN: number;
|
|
27
|
+
};
|
|
28
|
+
export declare const reservedSymbolRecord: {
|
|
29
|
+
readonly E: number;
|
|
30
|
+
readonly '-E': number;
|
|
31
|
+
readonly ε: number;
|
|
32
|
+
readonly '-\u03B5': number;
|
|
33
|
+
readonly PI: number;
|
|
34
|
+
readonly '-PI': number;
|
|
35
|
+
readonly π: number;
|
|
36
|
+
readonly '-\u03C0': number;
|
|
37
|
+
readonly PHI: number;
|
|
38
|
+
readonly '-PHI': number;
|
|
39
|
+
readonly φ: number;
|
|
40
|
+
readonly '-\u03C6': number;
|
|
41
|
+
readonly POSITIVE_INFINITY: number;
|
|
42
|
+
readonly '\u221E': number;
|
|
43
|
+
readonly NEGATIVE_INFINITY: number;
|
|
44
|
+
readonly '-\u221E': number;
|
|
45
|
+
readonly MAX_SAFE_INTEGER: number;
|
|
46
|
+
readonly MIN_SAFE_INTEGER: number;
|
|
47
|
+
readonly MAX_VALUE: number;
|
|
48
|
+
readonly MIN_VALUE: number;
|
|
49
|
+
readonly DELTA: number;
|
|
50
|
+
readonly '-DELTA': number;
|
|
51
|
+
readonly δ: number;
|
|
52
|
+
readonly '-\u03B4': number;
|
|
53
|
+
readonly NaN: number;
|
|
54
|
+
readonly true: true;
|
|
55
|
+
readonly false: false;
|
|
56
|
+
readonly null: null;
|
|
57
|
+
readonly then: null;
|
|
58
|
+
readonly else: null;
|
|
59
|
+
readonly end: null;
|
|
60
|
+
readonly case: null;
|
|
61
|
+
readonly each: null;
|
|
62
|
+
readonly in: null;
|
|
63
|
+
readonly when: null;
|
|
64
|
+
readonly while: null;
|
|
65
|
+
readonly catch: null;
|
|
66
|
+
readonly function: null;
|
|
67
|
+
readonly export: null;
|
|
68
|
+
readonly as: null;
|
|
69
|
+
};
|
|
70
|
+
export declare const validReservedSymbolRecord: {
|
|
71
|
+
readonly E: number;
|
|
72
|
+
readonly '-E': number;
|
|
73
|
+
readonly ε: number;
|
|
74
|
+
readonly '-\u03B5': number;
|
|
75
|
+
readonly PI: number;
|
|
76
|
+
readonly '-PI': number;
|
|
77
|
+
readonly π: number;
|
|
78
|
+
readonly '-\u03C0': number;
|
|
79
|
+
readonly PHI: number;
|
|
80
|
+
readonly '-PHI': number;
|
|
81
|
+
readonly φ: number;
|
|
82
|
+
readonly '-\u03C6': number;
|
|
83
|
+
readonly POSITIVE_INFINITY: number;
|
|
84
|
+
readonly '\u221E': number;
|
|
85
|
+
readonly NEGATIVE_INFINITY: number;
|
|
86
|
+
readonly '-\u221E': number;
|
|
87
|
+
readonly MAX_SAFE_INTEGER: number;
|
|
88
|
+
readonly MIN_SAFE_INTEGER: number;
|
|
89
|
+
readonly MAX_VALUE: number;
|
|
90
|
+
readonly MIN_VALUE: number;
|
|
91
|
+
readonly DELTA: number;
|
|
92
|
+
readonly '-DELTA': number;
|
|
93
|
+
readonly δ: number;
|
|
94
|
+
readonly '-\u03B4': number;
|
|
95
|
+
readonly NaN: number;
|
|
96
|
+
readonly true: true;
|
|
97
|
+
readonly false: false;
|
|
98
|
+
readonly null: null;
|
|
99
|
+
readonly then: null;
|
|
100
|
+
readonly else: null;
|
|
101
|
+
readonly end: null;
|
|
102
|
+
readonly case: null;
|
|
103
|
+
readonly each: null;
|
|
104
|
+
readonly in: null;
|
|
105
|
+
readonly when: null;
|
|
106
|
+
readonly while: null;
|
|
107
|
+
readonly catch: null;
|
|
108
|
+
readonly function: null;
|
|
109
|
+
readonly export: null;
|
|
110
|
+
readonly as: null;
|
|
111
|
+
};
|
|
112
|
+
export type ValidReservedSymbol = keyof typeof validReservedSymbolRecord;
|
|
113
|
+
export type ReservedSymbol = keyof typeof reservedSymbolRecord;
|
|
114
|
+
export declare function isReservedSymbol(symbol: string): symbol is keyof typeof validReservedSymbolRecord;
|
|
115
|
+
export declare function isNumberReservedSymbol(symbol: string): symbol is keyof typeof numberReservedSymbolRecord;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { ValidReservedSymbol } from './reservedNames';
|
|
2
|
+
import { type SymbolicBinaryOperator, type SymbolicOperator } from './operators';
|
|
3
|
+
export declare const tokenTypes: readonly ["LBrace", "LBracket", "RBrace", "RBracket", "LParen", "RParen", "BasePrefixedNumber", "MultiLineComment", "Number", "Operator", "RegexpShorthand", "ReservedSymbol", "SingleLineComment", "String", "Symbol", "Whitespace"];
|
|
4
|
+
export type TokenType = typeof tokenTypes[number];
|
|
5
|
+
declare const modifierNames: readonly ["&rest", "&let", "&when", "&while"];
|
|
6
|
+
export type ModifierName = typeof modifierNames[number];
|
|
7
|
+
type GenericToken<T extends TokenType, V extends string = string> = [T, V] | [T, V, SourceCodeInfo];
|
|
8
|
+
export type LBraceToken = GenericToken<'LBrace', '{'>;
|
|
9
|
+
export type LBracketToken = GenericToken<'LBracket', '['>;
|
|
10
|
+
export type LParenToken = GenericToken<'LParen', '('>;
|
|
11
|
+
export type RBraceToken = GenericToken<'RBrace', '}'>;
|
|
12
|
+
export type RBracketToken = GenericToken<'RBracket', ']'>;
|
|
13
|
+
export type RParenToken = GenericToken<'RParen', ')'>;
|
|
14
|
+
export type BasePrefixedNumberToken = GenericToken<'BasePrefixedNumber'>;
|
|
15
|
+
export type MultiLineCommentToken = GenericToken<'MultiLineComment'>;
|
|
16
|
+
export type NumberToken = GenericToken<'Number'>;
|
|
17
|
+
export type OperatorToken<T extends SymbolicOperator = SymbolicOperator> = GenericToken<'Operator', T>;
|
|
18
|
+
export type RegexpShorthandToken = GenericToken<'RegexpShorthand'>;
|
|
19
|
+
export type ReservedSymbolToken<T extends ValidReservedSymbol = ValidReservedSymbol> = GenericToken<'ReservedSymbol', T>;
|
|
20
|
+
export type SingleLineCommentToken = GenericToken<'SingleLineComment'>;
|
|
21
|
+
export type StringToken = GenericToken<'String'>;
|
|
22
|
+
export type SymbolToken<T extends string = string> = GenericToken<'Symbol', T>;
|
|
23
|
+
export type WhitespaceToken = GenericToken<'Whitespace'>;
|
|
24
|
+
export type Token = LBraceToken | LBracketToken | LParenToken | RBraceToken | RBracketToken | RParenToken | BasePrefixedNumberToken | MultiLineCommentToken | NumberToken | OperatorToken | RegexpShorthandToken | ReservedSymbolToken | SingleLineCommentToken | StringToken | SymbolToken | WhitespaceToken;
|
|
25
|
+
export type TokenDescriptor<T extends Token> = [length: number, token?: T];
|
|
26
|
+
export interface SourceCodeInfo {
|
|
27
|
+
position?: {
|
|
28
|
+
line: number;
|
|
29
|
+
column: number;
|
|
30
|
+
};
|
|
31
|
+
code?: string;
|
|
32
|
+
filePath?: string;
|
|
33
|
+
}
|
|
34
|
+
export declare function isSymbolToken<T extends string>(token: Token, symbolName?: T): token is SymbolToken<T>;
|
|
35
|
+
export declare function assertSymbolToken<T extends string>(token: Token, symbolName?: T): asserts token is SymbolToken<T>;
|
|
36
|
+
export declare function asSymbolToken<T extends string>(token: Token, symbolName?: T): SymbolToken<T>;
|
|
37
|
+
export declare function isReservedSymbolToken<T extends ValidReservedSymbol>(token: Token, symbolName?: T): token is ReservedSymbolToken<T>;
|
|
38
|
+
export declare function assertReservedSymbolToken<T extends ValidReservedSymbol>(token: Token, symbolName?: T): asserts token is ReservedSymbolToken<T>;
|
|
39
|
+
export declare function asReservedSymbolToken<T extends ValidReservedSymbol>(token: Token, symbolName?: T): ReservedSymbolToken<T>;
|
|
40
|
+
export declare function isSingleLineCommentToken(token: Token): token is SingleLineCommentToken;
|
|
41
|
+
export declare function assertSingleLineCommentToken(token: Token): asserts token is SingleLineCommentToken;
|
|
42
|
+
export declare function asSingleLineCommentToken(token: Token): SingleLineCommentToken;
|
|
43
|
+
export declare function isMultiLineCommentToken(token: Token): token is MultiLineCommentToken;
|
|
44
|
+
export declare function assertMultiLineCommentToken(token: Token): asserts token is MultiLineCommentToken;
|
|
45
|
+
export declare function asMultiLineCommentToken(token: Token): MultiLineCommentToken;
|
|
46
|
+
export declare function isOperatorToken<T extends SymbolicOperator>(token: Token, operatorName?: T): token is OperatorToken<T>;
|
|
47
|
+
export declare function assertOperatorToken<T extends SymbolicOperator>(token: Token, operatorName?: T): asserts token is OperatorToken<T>;
|
|
48
|
+
export declare function asOperatorToken<T extends SymbolicOperator>(token: Token, operatorName?: T): OperatorToken<T>;
|
|
49
|
+
export declare function isWhitespaceToken(token: Token): token is WhitespaceToken;
|
|
50
|
+
export declare function assertWhitespaceToken(token: Token): asserts token is WhitespaceToken;
|
|
51
|
+
export declare function asWhitespaceToken(token: Token): WhitespaceToken;
|
|
52
|
+
export declare function isNumberToken(token: Token): token is NumberToken;
|
|
53
|
+
export declare function assertNumberToken(token: Token): asserts token is NumberToken;
|
|
54
|
+
export declare function asNumberToken(token: Token): NumberToken;
|
|
55
|
+
export declare function isBasePrefixedNumberToken(token: Token): token is BasePrefixedNumberToken;
|
|
56
|
+
export declare function assertBasePrefixedNumberToken(token: Token): asserts token is BasePrefixedNumberToken;
|
|
57
|
+
export declare function asBasePrefixedNumberToken(token: Token): BasePrefixedNumberToken;
|
|
58
|
+
export declare function isLParenToken(token: Token): token is LParenToken;
|
|
59
|
+
export declare function assertLParenToken(token: Token): asserts token is LParenToken;
|
|
60
|
+
export declare function asLParenToken(token: Token): LParenToken;
|
|
61
|
+
export declare function isRParenToken(token: Token): token is RParenToken;
|
|
62
|
+
export declare function assertRParenToken(token: Token): asserts token is RParenToken;
|
|
63
|
+
export declare function asRParenToken(token: Token): RParenToken;
|
|
64
|
+
export declare function isLBracketToken(token: Token): token is LBracketToken;
|
|
65
|
+
export declare function assertLBracketToken(token: Token): asserts token is LBracketToken;
|
|
66
|
+
export declare function asLBracketToken(token: Token): LBracketToken;
|
|
67
|
+
export declare function isRBracketToken(token: Token): token is RBracketToken;
|
|
68
|
+
export declare function assertRBracketToken(token: Token): asserts token is RBracketToken;
|
|
69
|
+
export declare function asRBracketToken(token: Token): RBracketToken;
|
|
70
|
+
export declare function isLBraceToken(token: Token): token is LBraceToken;
|
|
71
|
+
export declare function assertLBraceToken(token: Token): asserts token is LBraceToken;
|
|
72
|
+
export declare function asLBraceToken(token: Token): LBraceToken;
|
|
73
|
+
export declare function isRBraceToken(token: Token): token is RBraceToken;
|
|
74
|
+
export declare function assertRBraceToken(token: Token): asserts token is RBraceToken;
|
|
75
|
+
export declare function asRBraceToken(token: Token): RBraceToken;
|
|
76
|
+
export declare function isStringToken(token: Token): token is StringToken;
|
|
77
|
+
export declare function assertStringToken(token: Token): asserts token is StringToken;
|
|
78
|
+
export declare function asStringToken(token: Token): StringToken;
|
|
79
|
+
export declare function isRegexpShorthandToken(token: Token): token is RegexpShorthandToken;
|
|
80
|
+
export declare function assertRegexpShorthandToken(token: Token): asserts token is RegexpShorthandToken;
|
|
81
|
+
export declare function asRegexpShorthandToken(token: Token): RegexpShorthandToken;
|
|
82
|
+
export declare function isA_BinaryOperatorToken(token: Token): token is OperatorToken<SymbolicBinaryOperator>;
|
|
83
|
+
export declare function assertA_BinaryOperatorToken(token: Token): asserts token is OperatorToken<SymbolicBinaryOperator>;
|
|
84
|
+
export declare function asA_BinaryOperatorToken(token: Token): OperatorToken<SymbolicBinaryOperator>;
|
|
85
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FilePathParams } from '../Lits/Lits';
|
|
2
|
+
import type { Token } from './token';
|
|
3
|
+
export interface TokenStream {
|
|
4
|
+
tokens: Token[];
|
|
5
|
+
hasDebugData: boolean;
|
|
6
|
+
filePath?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function tokenize(input: string, debug: boolean, filePath: FilePathParams['filePath']): TokenStream;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BasePrefixedNumberToken, LBraceToken, LBracketToken, LParenToken, MultiLineCommentToken, NumberToken, OperatorToken, RBraceToken, RBracketToken, RParenToken, RegexpShorthandToken, ReservedSymbolToken, SingleLineCommentToken, StringToken, SymbolToken, Token, TokenDescriptor, WhitespaceToken } from './token';
|
|
2
|
+
export type Tokenizer<T extends Token> = (input: string, position: number) => TokenDescriptor<T>;
|
|
3
|
+
export declare const NO_MATCH: TokenDescriptor<never>;
|
|
4
|
+
export declare const tokenizeWhitespace: Tokenizer<WhitespaceToken>;
|
|
5
|
+
export declare const tokenizeNumber: Tokenizer<NumberToken>;
|
|
6
|
+
export declare const tokenizeBasePrefixedNumber: Tokenizer<BasePrefixedNumberToken>;
|
|
7
|
+
export declare const tokenizeSymbol: Tokenizer<SymbolToken>;
|
|
8
|
+
export declare const tokenizeReservedSymbolToken: Tokenizer<ReservedSymbolToken>;
|
|
9
|
+
export declare const tokenizeOperator: Tokenizer<OperatorToken>;
|
|
10
|
+
export declare const tokenizeMultiLineComment: Tokenizer<MultiLineCommentToken>;
|
|
11
|
+
export declare const tokenizeSingleLineComment: Tokenizer<SingleLineCommentToken>;
|
|
12
|
+
export declare const tokenizers: [Tokenizer<WhitespaceToken>, Tokenizer<MultiLineCommentToken>, Tokenizer<SingleLineCommentToken>, Tokenizer<ReservedSymbolToken>, Tokenizer<LParenToken>, Tokenizer<RParenToken>, Tokenizer<LBracketToken>, Tokenizer<RBracketToken>, Tokenizer<LBraceToken>, Tokenizer<RBraceToken>, Tokenizer<StringToken>, Tokenizer<RegexpShorthandToken>, Tokenizer<BasePrefixedNumberToken>, Tokenizer<NumberToken>, Tokenizer<OperatorToken>, Tokenizer<SymbolToken>];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { TokenStream } from '../tokenizer/
|
|
2
|
-
export declare function
|
|
1
|
+
import type { TokenStream } from '../tokenizer/tokenize';
|
|
2
|
+
export declare function transformSymbolTokens(tokenStram: TokenStream, transformer: (symbol: string) => string): TokenStream;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SourceCodeInfo } from '../tokenizer/
|
|
1
|
+
import type { SourceCodeInfo } from '../tokenizer/token';
|
|
2
2
|
export declare function asArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): unknown[];
|
|
3
3
|
export declare function assertArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is unknown[];
|
|
4
4
|
export declare function isStringArray(value: unknown): value is string[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AstNode, ExpressionNode, NormalExpressionNode, NormalExpressionNodeWithName, SymbolNode } from '../parser/
|
|
2
|
-
import type { SourceCodeInfo } from '../tokenizer/
|
|
1
|
+
import type { AstNode, ExpressionNode, NormalExpressionNode, NormalExpressionNodeWithName, SymbolNode } from '../parser/types';
|
|
2
|
+
import type { SourceCodeInfo } from '../tokenizer/token';
|
|
3
3
|
export declare function isAstNode(value: unknown): value is AstNode;
|
|
4
4
|
export declare function asAstNode(value: unknown, sourceCodeInfo?: SourceCodeInfo): AstNode;
|
|
5
5
|
export declare function assertAstNode(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is AstNode;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { Count } from '../builtin/interface';
|
|
2
2
|
import type { UnknownRecord } from '../interface';
|
|
3
|
-
import type { GenericNode } from '../parser/
|
|
4
|
-
import type { SourceCodeInfo } from '../tokenizer/
|
|
5
|
-
export declare function assertNumberOfParams(count: Count, node: GenericNode
|
|
3
|
+
import type { AstNode, GenericNode } from '../parser/types';
|
|
4
|
+
import type { SourceCodeInfo } from '../tokenizer/token';
|
|
5
|
+
export declare function assertNumberOfParams(count: Count, node: GenericNode & {
|
|
6
|
+
params: AstNode[];
|
|
7
|
+
name: string;
|
|
8
|
+
}): void;
|
|
6
9
|
export declare function isNonUndefined<T>(value: T | undefined): value is T;
|
|
7
10
|
export declare function asNonUndefined<T>(value: T | undefined, sourceCodeInfo?: SourceCodeInfo): T;
|
|
8
11
|
export declare function assertNonUndefined<T>(value: T | undefined, sourceCodeInfo?: SourceCodeInfo): asserts value is T;
|
|
9
12
|
export declare function isUnknownRecord(value: unknown): value is Record<string, unknown>;
|
|
10
13
|
export declare function assertUnknownRecord(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is UnknownRecord;
|
|
11
14
|
export declare function asUnknownRecord(value: unknown, sourceCodeInfo?: SourceCodeInfo): UnknownRecord;
|
|
15
|
+
export declare function canBeOperator(count: Count): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Any, Coll, Obj, Seq } from '../interface';
|
|
2
|
-
import type { RegularExpression } from '../parser/
|
|
3
|
-
import type { SourceCodeInfo } from '../tokenizer/
|
|
2
|
+
import type { RegularExpression } from '../parser/types';
|
|
3
|
+
import type { SourceCodeInfo } from '../tokenizer/token';
|
|
4
4
|
export declare function isAny(value: unknown): value is Any;
|
|
5
5
|
export declare function asAny(value: unknown, sourceCodeInfo?: SourceCodeInfo): Any;
|
|
6
6
|
export declare function assertAny(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BuiltinFunction, LitsFunction, NativeJsFunction, UserDefinedFunction } from '../parser/
|
|
2
|
-
import type { SourceCodeInfo } from '../tokenizer/
|
|
1
|
+
import type { BuiltinFunction, LitsFunction, NativeJsFunction, UserDefinedFunction } from '../parser/types';
|
|
2
|
+
import type { SourceCodeInfo } from '../tokenizer/token';
|
|
3
3
|
export declare function isLitsFunction(value: unknown): value is LitsFunction;
|
|
4
4
|
export declare function asLitsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): LitsFunction;
|
|
5
5
|
export declare function assertLitsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is LitsFunction;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { TokenStream } from '../tokenizer/
|
|
1
|
+
import type { TokenStream } from '../tokenizer/tokenize';
|
|
2
2
|
export declare function untokenize(tokenStream: TokenStream): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { SourceCodeInfo } from '../../tokenizer/
|
|
1
|
+
import type { SourceCodeInfo } from '../../tokenizer/token';
|
|
2
2
|
export declare function getCodeMarker(sourceCodeInfo: SourceCodeInfo): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { SourceCodeInfo } from '../../tokenizer/
|
|
2
|
-
export declare function getSourceCodeInfo(anyValue: any, sourceCodeInfo
|
|
1
|
+
import type { SourceCodeInfo } from '../../tokenizer/token';
|
|
2
|
+
export declare function getSourceCodeInfo(anyValue: any, sourceCodeInfo: SourceCodeInfo | undefined): SourceCodeInfo | undefined;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { LitsError } from '../errors';
|
|
2
|
-
import type { SourceCodeInfo } from '../tokenizer/
|
|
2
|
+
import type { SourceCodeInfo } from '../tokenizer/token';
|
|
3
3
|
export declare function getAssertionError(typeName: string, value: unknown, sourceCodeInfo?: SourceCodeInfo): LitsError;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { Any, Coll } from '../interface';
|
|
2
|
-
import type { NativeJsFunction } from '../parser/
|
|
3
|
-
import type { SourceCodeInfo } from '../tokenizer/
|
|
2
|
+
import type { NativeJsFunction } from '../parser/types';
|
|
3
|
+
import type { SourceCodeInfo } from '../tokenizer/token';
|
|
4
4
|
export declare function collHasKey(coll: unknown, key: string | number): boolean;
|
|
5
|
-
export declare function compare(a:
|
|
5
|
+
export declare function compare<T extends string | number>(a: T, b: T, sourceCodeInfo: SourceCodeInfo | undefined): number;
|
|
6
6
|
export declare function deepEqual(a: Any, b: Any, sourceCodeInfo?: SourceCodeInfo): boolean;
|
|
7
7
|
export declare function toNonNegativeInteger(num: number): number;
|
|
8
8
|
export declare function toAny(value: unknown): Any;
|
|
9
9
|
export declare function cloneColl<T extends Coll>(value: T): T;
|
|
10
10
|
export declare function createNativeJsFunction(fn: (...args: any[]) => unknown, name?: string): NativeJsFunction;
|
|
11
11
|
export declare function arrayToPairs<T>(arr: T[]): T[][];
|
|
12
|
+
export declare function joinSets<T>(...results: Set<T>[]): Set<T>;
|
|
13
|
+
export declare function addToSet<T>(target: Set<T>, source: Set<T>): void;
|