@angular-wave/angular.ts 0.0.50 → 0.0.51
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/README.md +3 -1
- package/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -2
- package/package.json +1 -1
- package/src/animations/shared.js +2 -1
- package/src/core/parser/ast-type.js +21 -20
- package/src/core/parser/ast.js +34 -35
- package/src/core/parser/interpreter.js +405 -136
- package/src/core/parser/lexer.js +14 -13
- package/src/core/parser/parse.js +31 -45
- package/src/core/parser/parse.spec.js +429 -444
- package/src/core/parser/parser.js +17 -9
- package/src/loader.js +5 -1
- package/src/types.js +0 -13
- package/types/animations/shared.d.ts +1 -1
- package/types/core/parser/ast-type.d.ts +24 -20
- package/types/core/parser/ast.d.ts +13 -14
- package/types/core/parser/interpreter.d.ts +24 -19
- package/types/core/parser/lexer.d.ts +6 -2
- package/types/core/parser/parse.d.ts +44 -38
- package/types/core/parser/parser.d.ts +2 -10
- package/types/loader.d.ts +397 -0
- package/types/types.d.ts +0 -1
- package/src/core/parser/shared.js +0 -234
- package/types/core/parser/shared.d.ts +0 -35
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AST } from "./ast";
|
|
2
|
-
import {
|
|
2
|
+
import { ASTType } from "./ast-type";
|
|
3
3
|
import { ASTInterpreter } from "./interpreter";
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -8,11 +8,6 @@ import { ASTInterpreter } from "./interpreter";
|
|
|
8
8
|
* @property {boolean} oneTime - True if expression should be evaluated only once
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
* @typedef {Object} ParserOptions
|
|
13
|
-
* @property {function(string):any} literals
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
11
|
/**
|
|
17
12
|
* @constructor
|
|
18
13
|
*/
|
|
@@ -21,11 +16,10 @@ export class Parser {
|
|
|
21
16
|
*
|
|
22
17
|
* @param {import('./lexer').Lexer} lexer
|
|
23
18
|
* @param {function(any):any} $filter
|
|
24
|
-
* @param {ParserOptions} options
|
|
25
19
|
*/
|
|
26
|
-
constructor(lexer, $filter
|
|
20
|
+
constructor(lexer, $filter) {
|
|
27
21
|
/** @type {AST} */
|
|
28
|
-
this.ast = new AST(lexer
|
|
22
|
+
this.ast = new AST(lexer);
|
|
29
23
|
|
|
30
24
|
/** @type {ASTInterpreter} */
|
|
31
25
|
this.astCompiler = new ASTInterpreter($filter);
|
|
@@ -63,3 +57,17 @@ export class Parser {
|
|
|
63
57
|
};
|
|
64
58
|
}
|
|
65
59
|
}
|
|
60
|
+
|
|
61
|
+
function isLiteral(ast) {
|
|
62
|
+
return (
|
|
63
|
+
ast.body.length === 0 ||
|
|
64
|
+
(ast.body.length === 1 &&
|
|
65
|
+
(ast.body[0].expression.type === ASTType.Literal ||
|
|
66
|
+
ast.body[0].expression.type === ASTType.ArrayExpression ||
|
|
67
|
+
ast.body[0].expression.type === ASTType.ObjectExpression))
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function isConstant(ast) {
|
|
72
|
+
return ast.constant;
|
|
73
|
+
}
|
package/src/loader.js
CHANGED
|
@@ -112,6 +112,9 @@ export class Angular {
|
|
|
112
112
|
|
|
113
113
|
/** @type {errorHandlingConfig} */
|
|
114
114
|
this.errorHandlingConfig = errorHandlingConfig;
|
|
115
|
+
|
|
116
|
+
/** @type {Function} */
|
|
117
|
+
this.doBootstrap;
|
|
115
118
|
}
|
|
116
119
|
|
|
117
120
|
/**
|
|
@@ -171,13 +174,14 @@ export class Angular {
|
|
|
171
174
|
* * `strictDi` - disable automatic function annotation for the application. This is meant to
|
|
172
175
|
* assist in finding bugs which break minified code. Defaults to `false`.
|
|
173
176
|
*
|
|
174
|
-
* @returns {
|
|
177
|
+
* @returns {any} InjectorService - Returns the newly created injector for this app.
|
|
175
178
|
*/
|
|
176
179
|
bootstrap(element, modules, config) {
|
|
177
180
|
config = config || {
|
|
178
181
|
debugInfoEnabled: false,
|
|
179
182
|
strictDi: false,
|
|
180
183
|
};
|
|
184
|
+
|
|
181
185
|
this.doBootstrap = function () {
|
|
182
186
|
// @ts-ignore
|
|
183
187
|
element = JQLite(element);
|
package/src/types.js
CHANGED
|
@@ -11,19 +11,6 @@
|
|
|
11
11
|
* @template T
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
* @typedef {function} CompiledExpression
|
|
16
|
-
* @param {import('./core/scope/scope').Scope} context - An object against which any expressions embedded in the strings are evaluated against (typically a scope object).
|
|
17
|
-
* @param {object} [locals] - local variables context object, useful for overriding values in `context`.
|
|
18
|
-
* @returns {any}
|
|
19
|
-
* @property {boolean} literal - Indicates if the expression is a literal.
|
|
20
|
-
* @property {boolean} constant - Indicates if the expression is constant.
|
|
21
|
-
* @property {function(any, any): any} assign - Assigns a value to a context. If value is not provided,
|
|
22
|
-
* undefined is gonna be used since the implementation
|
|
23
|
-
* does not check the parameter. Let's force a value for consistency. If consumer
|
|
24
|
-
* wants to undefine it, pass the undefined value explicitly.
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
14
|
/**
|
|
28
15
|
* @typedef {Object} ComponentOptions
|
|
29
16
|
* @description Component definition object (a simplified directive definition object)
|
|
@@ -41,7 +41,7 @@ export let TRANSITIONEND_EVENT: any;
|
|
|
41
41
|
export let ANIMATION_PROP: any;
|
|
42
42
|
export let ANIMATIONEND_EVENT: any;
|
|
43
43
|
export const DURATION_KEY: "Duration";
|
|
44
|
-
export const PROPERTY_KEY:
|
|
44
|
+
export const PROPERTY_KEY: 13;
|
|
45
45
|
export const DELAY_KEY: "Delay";
|
|
46
46
|
export const TIMING_KEY: "TimingFunction";
|
|
47
47
|
export const ANIMATION_ITERATION_COUNT_KEY: "IterationCount";
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
export type ASTType =
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
export type ASTType = number;
|
|
2
|
+
/**
|
|
3
|
+
* @readonly
|
|
4
|
+
* @enum {number}
|
|
5
|
+
*/
|
|
6
|
+
export const ASTType: Readonly<{
|
|
7
|
+
Program: 1;
|
|
8
|
+
ExpressionStatement: 2;
|
|
9
|
+
AssignmentExpression: 3;
|
|
10
|
+
ConditionalExpression: 4;
|
|
11
|
+
LogicalExpression: 5;
|
|
12
|
+
BinaryExpression: 6;
|
|
13
|
+
UnaryExpression: 7;
|
|
14
|
+
CallExpression: 8;
|
|
15
|
+
MemberExpression: 9;
|
|
16
|
+
Identifier: 10;
|
|
17
|
+
Literal: 11;
|
|
18
|
+
ArrayExpression: 12;
|
|
19
|
+
Property: 13;
|
|
20
|
+
ObjectExpression: 14;
|
|
21
|
+
ThisExpression: 15;
|
|
22
|
+
LocalsExpression: 16;
|
|
23
|
+
NGValueParameter: 17;
|
|
24
|
+
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @typedef {Object} ASTNode
|
|
3
|
-
* @property {
|
|
3
|
+
* @property {number} type - The type of the AST node.
|
|
4
4
|
* @property {string} [name] - The name of the identifier.
|
|
5
5
|
* @property {string} [kind] - The kind of the property (e.g., 'init').
|
|
6
6
|
* @property {*} [value] - The value of the node if it is a literal.
|
|
@@ -23,23 +23,26 @@
|
|
|
23
23
|
* @property {ASTNode} [property] - The property of a member expression.
|
|
24
24
|
* @property {boolean} [computed] - Indicates if a member expression is computed.
|
|
25
25
|
* @property {string} [operator] - The operator of a binary or logical expression.
|
|
26
|
+
* @property {boolean} [filter]
|
|
26
27
|
*/
|
|
28
|
+
/** @type {Map<string,any>} */
|
|
29
|
+
export const literals: Map<string, any>;
|
|
27
30
|
/**
|
|
28
|
-
* @
|
|
29
|
-
* @param {import("./parser").ParserOptions} options
|
|
31
|
+
* @class
|
|
30
32
|
*/
|
|
31
33
|
export class AST {
|
|
32
|
-
|
|
34
|
+
/**
|
|
35
|
+
* @param {import('./lexer').Lexer} lexer - The lexer instance for tokenizing input
|
|
36
|
+
*/
|
|
37
|
+
constructor(lexer: import("./lexer").Lexer);
|
|
33
38
|
/** @type {import('./lexer').Lexer} */
|
|
34
39
|
lexer: import("./lexer").Lexer;
|
|
35
|
-
/** @type {import("./parser").ParserOptions} */
|
|
36
|
-
options: import("./parser").ParserOptions;
|
|
37
40
|
selfReferential: {
|
|
38
41
|
this: {
|
|
39
|
-
type:
|
|
42
|
+
type: 15;
|
|
40
43
|
};
|
|
41
44
|
$locals: {
|
|
42
|
-
type:
|
|
45
|
+
type: 16;
|
|
43
46
|
};
|
|
44
47
|
};
|
|
45
48
|
/**
|
|
@@ -65,11 +68,6 @@ export class AST {
|
|
|
65
68
|
* @returns {ASTNode} The filter chain node.
|
|
66
69
|
*/
|
|
67
70
|
filterChain(): ASTNode;
|
|
68
|
-
/**
|
|
69
|
-
* Parses an expression.
|
|
70
|
-
* @returns {ASTNode} The expression node.
|
|
71
|
-
*/
|
|
72
|
-
expression(): ASTNode;
|
|
73
71
|
/**
|
|
74
72
|
* Parses an assignment expression.
|
|
75
73
|
* @returns {ASTNode} The assignment expression node.
|
|
@@ -192,7 +190,7 @@ export type ASTNode = {
|
|
|
192
190
|
/**
|
|
193
191
|
* - The type of the AST node.
|
|
194
192
|
*/
|
|
195
|
-
type:
|
|
193
|
+
type: number;
|
|
196
194
|
/**
|
|
197
195
|
* - The name of the identifier.
|
|
198
196
|
*/
|
|
@@ -277,4 +275,5 @@ export type ASTNode = {
|
|
|
277
275
|
* - The operator of a binary or logical expression.
|
|
278
276
|
*/
|
|
279
277
|
operator?: string;
|
|
278
|
+
filter?: boolean;
|
|
280
279
|
};
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {import("./ast").ASTNode} ast
|
|
3
|
+
* @returns {boolean}
|
|
4
|
+
*/
|
|
5
|
+
export function isAssignable(ast: import("./ast").ASTNode): boolean;
|
|
6
|
+
export const PURITY_ABSOLUTE: 1;
|
|
7
|
+
export const PURITY_RELATIVE: 2;
|
|
1
8
|
export class ASTInterpreter {
|
|
2
9
|
/**
|
|
3
10
|
* @param {function(any):any} $filter
|
|
@@ -7,17 +14,17 @@ export class ASTInterpreter {
|
|
|
7
14
|
/**
|
|
8
15
|
* Compiles the AST into a function.
|
|
9
16
|
* @param {import("./ast").ASTNode} ast - The AST to compile.
|
|
10
|
-
* @returns
|
|
17
|
+
* @returns {import("./parse").CompiledExpression}
|
|
11
18
|
*/
|
|
12
|
-
compile(ast: import("./ast").ASTNode):
|
|
19
|
+
compile(ast: import("./ast").ASTNode): import("./parse").CompiledExpression;
|
|
13
20
|
/**
|
|
14
21
|
* Recurses the AST nodes.
|
|
15
22
|
* @param {import("./ast").ASTNode} ast - The AST node.
|
|
16
23
|
* @param {Object} [context] - The context.
|
|
17
|
-
* @param {boolean|
|
|
18
|
-
* @returns {
|
|
24
|
+
* @param {boolean|1} [create] - The create flag.
|
|
25
|
+
* @returns {import("./parse").CompiledExpressionFunction} The recursive function.
|
|
19
26
|
*/
|
|
20
|
-
recurse(ast: import("./ast").ASTNode, context?: any, create?: boolean |
|
|
27
|
+
recurse(ast: import("./ast").ASTNode, context?: any, create?: boolean | 1): import("./parse").CompiledExpressionFunction;
|
|
21
28
|
/**
|
|
22
29
|
* Unary plus operation.
|
|
23
30
|
* @param {function} argument - The argument function.
|
|
@@ -63,7 +70,7 @@ export class ASTInterpreter {
|
|
|
63
70
|
* @returns {function} The binary multiplication function.
|
|
64
71
|
*/
|
|
65
72
|
"binary*"(left: Function, right: Function, context?: any): Function;
|
|
66
|
-
"binary/"(left: any, right: any, context: any): (scope: any, locals: any, assign: any
|
|
73
|
+
"binary/"(left: any, right: any, context: any): (scope: any, locals: any, assign: any) => number | {
|
|
67
74
|
value: number;
|
|
68
75
|
};
|
|
69
76
|
/**
|
|
@@ -174,33 +181,31 @@ export class ASTInterpreter {
|
|
|
174
181
|
* Returns the value of an identifier.
|
|
175
182
|
* @param {string} name - The identifier name.
|
|
176
183
|
* @param {Object} [context] - The context.
|
|
177
|
-
* @param {boolean} [create] - Whether to create the identifier if it does not exist.
|
|
184
|
+
* @param {boolean|1} [create] - Whether to create the identifier if it does not exist.
|
|
178
185
|
* @returns {function} The function returning the identifier value.
|
|
179
186
|
*/
|
|
180
|
-
identifier(name: string, context?: any, create?: boolean): Function;
|
|
187
|
+
identifier(name: string, context?: any, create?: boolean | 1): Function;
|
|
181
188
|
/**
|
|
182
189
|
* Returns the value of a computed member expression.
|
|
183
190
|
* @param {function} left - The left operand function.
|
|
184
191
|
* @param {function} right - The right operand function.
|
|
185
192
|
* @param {Object} [context] - The context.
|
|
186
|
-
* @param {boolean} [create] - Whether to create the member if it does not exist.
|
|
193
|
+
* @param {boolean|1} [create] - Whether to create the member if it does not exist.
|
|
187
194
|
* @returns {function} The function returning the computed member value.
|
|
188
195
|
*/
|
|
189
|
-
computedMember(left: Function, right: Function, context?: any, create?: boolean): Function;
|
|
196
|
+
computedMember(left: Function, right: Function, context?: any, create?: boolean | 1): Function;
|
|
190
197
|
/**
|
|
191
198
|
* Returns the value of a non-computed member expression.
|
|
192
199
|
* @param {function} left - The left operand function.
|
|
193
200
|
* @param {string} right - The right operand function.
|
|
194
201
|
* @param {Object} [context] - The context.
|
|
195
|
-
* @param {boolean} [create] - Whether to create the member if it does not exist.
|
|
202
|
+
* @param {boolean|1} [create] - Whether to create the member if it does not exist.
|
|
196
203
|
* @returns {function} The function returning the non-computed member value.
|
|
197
204
|
*/
|
|
198
|
-
nonComputedMember(left: Function, right: string, context?: any, create?: boolean): Function;
|
|
199
|
-
/**
|
|
200
|
-
* Returns the value of an input expression.
|
|
201
|
-
* @param {function} input - The input function.
|
|
202
|
-
* @param {number} watchId - The watch identifier.
|
|
203
|
-
* @returns {function} The function returning the input value.
|
|
204
|
-
*/
|
|
205
|
-
inputs(input: Function, watchId: number): Function;
|
|
205
|
+
nonComputedMember(left: Function, right: string, context?: any, create?: boolean | 1): Function;
|
|
206
206
|
}
|
|
207
|
+
export type DecoratedASTNode = import("./ast").ASTNode & {
|
|
208
|
+
isPure: boolean | number;
|
|
209
|
+
constant: boolean;
|
|
210
|
+
toWatch: any[];
|
|
211
|
+
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @property {(ch: string, codePoint: number) => boolean} [isIdentifierContinue] - Custom function to determine if a character is a valid identifier continuation.
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
|
-
* Represents a token produced by the lexer.
|
|
7
|
+
* Represents a token produced by the lexer, which will be used by the AST to construct an abstract syntax tree.
|
|
8
8
|
* @typedef {Object} Token
|
|
9
9
|
* @property {number} index - Index of the token.
|
|
10
10
|
* @property {string} text - Text of the token.
|
|
@@ -99,6 +99,7 @@ export class Lexer {
|
|
|
99
99
|
throwError(error: string, start?: number, end?: number): void;
|
|
100
100
|
/**
|
|
101
101
|
* Reads and tokenizes a number from the text.
|
|
102
|
+
* @return {void}
|
|
102
103
|
*/
|
|
103
104
|
readNumber(): void;
|
|
104
105
|
/**
|
|
@@ -110,6 +111,9 @@ export class Lexer {
|
|
|
110
111
|
* @param {string} quote Quote character used for the string.
|
|
111
112
|
*/
|
|
112
113
|
readString(quote: string): void;
|
|
114
|
+
/**
|
|
115
|
+
* @returns {string}
|
|
116
|
+
*/
|
|
113
117
|
handleUnicodeEscape(): string;
|
|
114
118
|
}
|
|
115
119
|
export type LexerOptions = {
|
|
@@ -123,7 +127,7 @@ export type LexerOptions = {
|
|
|
123
127
|
isIdentifierContinue?: (ch: string, codePoint: number) => boolean;
|
|
124
128
|
};
|
|
125
129
|
/**
|
|
126
|
-
* Represents a token produced by the lexer.
|
|
130
|
+
* Represents a token produced by the lexer, which will be used by the AST to construct an abstract syntax tree.
|
|
127
131
|
*/
|
|
128
132
|
export type Token = {
|
|
129
133
|
/**
|
|
@@ -1,17 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} CompiledExpressionProps
|
|
3
|
+
* @property {boolean} literal - Indicates if the expression is a literal.
|
|
4
|
+
* @property {boolean} constant - Indicates if the expression is constant.
|
|
5
|
+
* @property {boolean} isPure
|
|
6
|
+
* @property {boolean} oneTime
|
|
7
|
+
* @property {any[]} inputs
|
|
8
|
+
* @property {function(any, any): any} assign - Assigns a value to a context. If value is not provided,
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* @typedef {function } CompiledExpressionFunction
|
|
12
|
+
* @param {import('../scope/scope').Scope} context - An object against which any expressions embedded in the strings are evaluated against (typically a scope object).
|
|
13
|
+
* @param {object} [locals] - local variables context object, useful for overriding values in `context`.
|
|
14
|
+
* @param {any} [assign]
|
|
15
|
+
* @returns {any}
|
|
16
|
+
* undefined is gonna be used since the implementation
|
|
17
|
+
* does not check the parameter. Let's force a value for consistency. If consumer
|
|
18
|
+
* wants to undefine it, pass the undefined value explicitly.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* @typedef {CompiledExpressionFunction & CompiledExpressionProps} CompiledExpression
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* @typedef {function(string|function(import('../scope/scope').Scope):any, function(any, import('../scope/scope').Scope, any):any=, boolean=): CompiledExpression} ParseService
|
|
25
|
+
*/
|
|
1
26
|
export function $ParseProvider(): void;
|
|
2
27
|
export class $ParseProvider {
|
|
3
|
-
/**
|
|
4
|
-
* @ngdoc method
|
|
5
|
-
* @name $parseProvider#addLiteral
|
|
6
|
-
* @description
|
|
7
|
-
*
|
|
8
|
-
* Configure $parse service to add literal values that will be present as literal at expressions.
|
|
9
|
-
*
|
|
10
|
-
* @param {string} literalName Token for the literal value. The literal name value must be a valid literal name.
|
|
11
|
-
* @param {*} literalValue Value for this literal. All literal values must be primitives or `undefined`.
|
|
12
|
-
*
|
|
13
|
-
**/
|
|
14
|
-
addLiteral: (literalName: string, literalValue: any) => void;
|
|
15
28
|
/**
|
|
16
29
|
* Allows defining the set of characters that are allowed in AngularJS expressions. The function
|
|
17
30
|
* `identifierStart` will get called to know if a given character is a valid character to be the
|
|
@@ -39,30 +52,23 @@ export class $ParseProvider {
|
|
|
39
52
|
}))[];
|
|
40
53
|
}
|
|
41
54
|
export function constantWatchDelegate(scope: any, listener: any, objectEquality: any, parsedExpression: any): any;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
let _false: boolean;
|
|
62
|
-
export { _false as false };
|
|
63
|
-
let _null: any;
|
|
64
|
-
export { _null as null };
|
|
65
|
-
export let undefined: any;
|
|
66
|
-
}
|
|
67
|
-
export type CompiledExpression = Function;
|
|
55
|
+
export type CompiledExpressionProps = {
|
|
56
|
+
/**
|
|
57
|
+
* - Indicates if the expression is a literal.
|
|
58
|
+
*/
|
|
59
|
+
literal: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* - Indicates if the expression is constant.
|
|
62
|
+
*/
|
|
63
|
+
constant: boolean;
|
|
64
|
+
isPure: boolean;
|
|
65
|
+
oneTime: boolean;
|
|
66
|
+
inputs: any[];
|
|
67
|
+
/**
|
|
68
|
+
* - Assigns a value to a context. If value is not provided,
|
|
69
|
+
*/
|
|
70
|
+
assign: (arg0: any, arg1: any) => any;
|
|
71
|
+
};
|
|
72
|
+
export type CompiledExpressionFunction = Function;
|
|
73
|
+
export type CompiledExpression = CompiledExpressionFunction & CompiledExpressionProps;
|
|
68
74
|
export type ParseService = (arg0: string | ((arg0: import("../scope/scope").Scope) => any), arg1: ((arg0: any, arg1: import("../scope/scope").Scope, arg2: any) => any) | undefined, arg2: boolean | undefined) => CompiledExpression;
|
|
@@ -3,10 +3,6 @@
|
|
|
3
3
|
* @property {import("./ast").ASTNode} ast - AST representation of expression
|
|
4
4
|
* @property {boolean} oneTime - True if expression should be evaluated only once
|
|
5
5
|
*/
|
|
6
|
-
/**
|
|
7
|
-
* @typedef {Object} ParserOptions
|
|
8
|
-
* @property {function(string):any} literals
|
|
9
|
-
*/
|
|
10
6
|
/**
|
|
11
7
|
* @constructor
|
|
12
8
|
*/
|
|
@@ -15,9 +11,8 @@ export class Parser {
|
|
|
15
11
|
*
|
|
16
12
|
* @param {import('./lexer').Lexer} lexer
|
|
17
13
|
* @param {function(any):any} $filter
|
|
18
|
-
* @param {ParserOptions} options
|
|
19
14
|
*/
|
|
20
|
-
constructor(lexer: import("./lexer").Lexer, $filter: (arg0: any) => any
|
|
15
|
+
constructor(lexer: import("./lexer").Lexer, $filter: (arg0: any) => any);
|
|
21
16
|
/** @type {AST} */
|
|
22
17
|
ast: AST;
|
|
23
18
|
/** @type {ASTInterpreter} */
|
|
@@ -27,7 +22,7 @@ export class Parser {
|
|
|
27
22
|
* @param {string} exp - Expression to be parsed
|
|
28
23
|
* @returns
|
|
29
24
|
*/
|
|
30
|
-
parse(exp: string):
|
|
25
|
+
parse(exp: string): import("./parse").CompiledExpression;
|
|
31
26
|
/**
|
|
32
27
|
* @param {string} exp - Expression to be parsed
|
|
33
28
|
* @returns {ParsedAST}
|
|
@@ -44,8 +39,5 @@ export type ParsedAST = {
|
|
|
44
39
|
*/
|
|
45
40
|
oneTime: boolean;
|
|
46
41
|
};
|
|
47
|
-
export type ParserOptions = {
|
|
48
|
-
literals: (arg0: string) => any;
|
|
49
|
-
};
|
|
50
42
|
import { AST } from "./ast";
|
|
51
43
|
import { ASTInterpreter } from "./interpreter";
|