@jbrowse/jexl 5.0.1 → 6.0.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/README.md +8 -3
- package/dist/Expression.d.ts +0 -12
- package/dist/Expression.js +0 -16
- package/dist/Expression.js.map +1 -1
- package/dist/Jexl.js +12 -16
- package/dist/Jexl.js.map +1 -1
- package/dist/Lexer.d.ts +12 -94
- package/dist/Lexer.js +41 -142
- package/dist/Lexer.js.map +1 -1
- package/dist/analyze.d.ts +2 -0
- package/dist/analyze.js +7 -7
- package/dist/analyze.js.map +1 -1
- package/dist/check.d.ts +0 -5
- package/dist/check.js +62 -240
- package/dist/check.js.map +1 -1
- package/dist/collections.d.ts +7 -0
- package/dist/collections.js +9 -2
- package/dist/collections.js.map +1 -1
- package/dist/conditions.d.ts +1 -1
- package/dist/conditions.js +28 -50
- package/dist/conditions.js.map +1 -1
- package/dist/errors.d.ts +5 -0
- package/dist/errors.js +8 -0
- package/dist/errors.js.map +1 -1
- package/dist/evaluator/compile.js +37 -24
- package/dist/evaluator/compile.js.map +1 -1
- package/dist/grammar.d.ts +2 -2
- package/dist/grammar.js +1 -8
- package/dist/grammar.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/operators.d.ts +5 -0
- package/dist/operators.js +9 -5
- package/dist/operators.js.map +1 -1
- package/dist/parser/Parser.d.ts +11 -12
- package/dist/parser/Parser.js +4 -10
- package/dist/parser/Parser.js.map +1 -1
- package/dist/print.d.ts +9 -0
- package/dist/print.js +183 -0
- package/dist/print.js.map +1 -0
- package/dist/types.d.ts +18 -21
- package/esm/Expression.d.ts +0 -12
- package/esm/Expression.js +0 -16
- package/esm/Expression.js.map +1 -1
- package/esm/Jexl.js +12 -16
- package/esm/Jexl.js.map +1 -1
- package/esm/Lexer.d.ts +12 -94
- package/esm/Lexer.js +40 -142
- package/esm/Lexer.js.map +1 -1
- package/esm/analyze.d.ts +2 -0
- package/esm/analyze.js +6 -7
- package/esm/analyze.js.map +1 -1
- package/esm/check.d.ts +0 -5
- package/esm/check.js +29 -206
- package/esm/check.js.map +1 -1
- package/esm/collections.d.ts +7 -0
- package/esm/collections.js +8 -1
- package/esm/collections.js.map +1 -1
- package/esm/conditions.d.ts +1 -1
- package/esm/conditions.js +27 -49
- package/esm/conditions.js.map +1 -1
- package/esm/errors.d.ts +5 -0
- package/esm/errors.js +7 -0
- package/esm/errors.js.map +1 -1
- package/esm/evaluator/compile.js +37 -24
- package/esm/evaluator/compile.js.map +1 -1
- package/esm/grammar.d.ts +2 -2
- package/esm/grammar.js +1 -8
- package/esm/grammar.js.map +1 -1
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -1
- package/esm/index.js.map +1 -1
- package/esm/operators.d.ts +5 -0
- package/esm/operators.js +8 -5
- package/esm/operators.js.map +1 -1
- package/esm/parser/Parser.d.ts +11 -12
- package/esm/parser/Parser.js +4 -8
- package/esm/parser/Parser.js.map +1 -1
- package/esm/print.d.ts +9 -0
- package/esm/print.js +177 -0
- package/esm/print.js.map +1 -0
- package/esm/types.d.ts +18 -21
- package/package.json +2 -1
- package/src/Expression.ts +0 -20
- package/src/Jexl.ts +13 -20
- package/src/Lexer.ts +42 -144
- package/src/analyze.ts +10 -10
- package/src/check.ts +48 -250
- package/src/collections.ts +11 -1
- package/src/conditions.ts +39 -62
- package/src/errors.ts +10 -0
- package/src/evaluator/compile.ts +49 -36
- package/src/grammar.ts +3 -9
- package/src/index.ts +2 -1
- package/src/operators.ts +10 -6
- package/src/parser/Parser.ts +13 -19
- package/src/print.ts +203 -0
- package/src/types.ts +19 -23
package/src/types.ts
CHANGED
|
@@ -27,41 +27,36 @@ export interface Token {
|
|
|
27
27
|
raw: string
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export interface
|
|
31
|
-
type: string
|
|
32
|
-
right?: AstNode
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface Literal extends AstNode {
|
|
30
|
+
export interface Literal {
|
|
36
31
|
type: 'Literal'
|
|
37
32
|
value: string | number | boolean | null
|
|
38
33
|
}
|
|
39
34
|
|
|
40
|
-
export interface Identifier
|
|
35
|
+
export interface Identifier {
|
|
41
36
|
type: 'Identifier'
|
|
42
37
|
value: string
|
|
43
38
|
from?: AstNode
|
|
44
39
|
}
|
|
45
40
|
|
|
46
|
-
export interface BinaryExpression
|
|
41
|
+
export interface BinaryExpression {
|
|
47
42
|
type: 'BinaryExpression'
|
|
48
43
|
operator: string
|
|
49
44
|
left: AstNode
|
|
50
|
-
right
|
|
45
|
+
right: AstNode
|
|
51
46
|
}
|
|
52
47
|
|
|
53
|
-
export interface UnaryExpression
|
|
48
|
+
export interface UnaryExpression {
|
|
54
49
|
type: 'UnaryExpression'
|
|
55
50
|
operator: string
|
|
56
|
-
right
|
|
51
|
+
right: AstNode
|
|
57
52
|
}
|
|
58
53
|
|
|
59
|
-
export interface ArrayLiteral
|
|
54
|
+
export interface ArrayLiteral {
|
|
60
55
|
type: 'ArrayLiteral'
|
|
61
56
|
value: AstNode[]
|
|
62
57
|
}
|
|
63
58
|
|
|
64
|
-
export interface ObjectLiteral
|
|
59
|
+
export interface ObjectLiteral {
|
|
65
60
|
type: 'ObjectLiteral'
|
|
66
61
|
value: Record<string, AstNode>
|
|
67
62
|
}
|
|
@@ -70,48 +65,49 @@ export type TemplateLiteralPart =
|
|
|
70
65
|
| { type: 'static'; value: string }
|
|
71
66
|
| { type: 'expression'; value: AstNode }
|
|
72
67
|
|
|
73
|
-
export interface TemplateLiteral
|
|
68
|
+
export interface TemplateLiteral {
|
|
74
69
|
type: 'TemplateLiteral'
|
|
75
70
|
parts: TemplateLiteralPart[]
|
|
76
71
|
}
|
|
77
72
|
|
|
78
|
-
export interface FunctionCall
|
|
73
|
+
export interface FunctionCall {
|
|
79
74
|
type: 'FunctionCall'
|
|
80
75
|
name: string
|
|
81
76
|
args: AstNode[]
|
|
82
77
|
}
|
|
83
78
|
|
|
84
|
-
export interface FilterExpression
|
|
79
|
+
export interface FilterExpression {
|
|
85
80
|
type: 'FilterExpression'
|
|
86
81
|
expr: AstNode
|
|
87
82
|
subject: AstNode
|
|
88
83
|
}
|
|
89
84
|
|
|
90
|
-
export interface ConditionalExpression
|
|
85
|
+
export interface ConditionalExpression {
|
|
91
86
|
type: 'ConditionalExpression'
|
|
92
87
|
test: AstNode
|
|
93
88
|
consequent?: AstNode
|
|
94
89
|
alternate?: AstNode
|
|
95
90
|
}
|
|
96
91
|
|
|
97
|
-
export interface SequenceExpression
|
|
92
|
+
export interface SequenceExpression {
|
|
98
93
|
type: 'SequenceExpression'
|
|
99
94
|
expressions: AstNode[]
|
|
100
95
|
}
|
|
101
96
|
|
|
102
|
-
export interface AssignmentExpression
|
|
97
|
+
export interface AssignmentExpression {
|
|
103
98
|
type: 'AssignmentExpression'
|
|
104
99
|
operator: '='
|
|
105
100
|
left: Identifier
|
|
101
|
+
right: AstNode
|
|
106
102
|
}
|
|
107
103
|
|
|
108
|
-
export interface Lambda
|
|
104
|
+
export interface Lambda {
|
|
109
105
|
type: 'Lambda'
|
|
110
106
|
params: string[]
|
|
111
107
|
body: AstNode
|
|
112
108
|
}
|
|
113
109
|
|
|
114
|
-
export type
|
|
110
|
+
export type AstNode =
|
|
115
111
|
| Literal
|
|
116
112
|
| Identifier
|
|
117
113
|
| BinaryExpression
|
|
@@ -126,7 +122,7 @@ export type AstNodeUnion =
|
|
|
126
122
|
| AssignmentExpression
|
|
127
123
|
| Lambda
|
|
128
124
|
|
|
129
|
-
export type NodeByType<T extends
|
|
130
|
-
|
|
125
|
+
export type NodeByType<T extends AstNode['type']> = Extract<
|
|
126
|
+
AstNode,
|
|
131
127
|
{ type: T }
|
|
132
128
|
>
|