@blockml/framework 0.8.1 → 0.9.1
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/blocks/org/blockml/bml/framework/Library.bml +7 -1
- package/blocks/org/blockml/bml/framework/capability/EvaluateExpression.bml +50 -0
- package/blocks/org/blockml/bml/framework/capability/EvaluateInterpolatedText.bml +50 -0
- package/blocks/org/blockml/bml/framework/capability/FindLocalMember.bml +58 -0
- package/blocks/org/blockml/bml/framework/capability/ParseInterpolatedText.bml +54 -0
- package/blocks/org/blockml/bml/framework/capability/ValidateGenerics.bml +66 -0
- package/blocks/org/blockml/bml/framework/config/FrameworkDiagnosticCodes.bml +1 -1
- package/blocks/org/blockml/bml/framework/documentation/Diagnostics.bml +11 -0
- package/blocks/org/blockml/bml/framework/documentation/EffectiveMembers.bml +2 -0
- package/blocks/org/blockml/bml/framework/documentation/ExpressionParsing.bml +6 -3
- package/blocks/org/blockml/bml/framework/documentation/PublicApi.bml +6 -0
- package/blocks/org/blockml/bml/framework/documentation/TypeRegistryBootstrap.bml +1 -1
- package/blocks/org/blockml/bml/framework/expression/ExpressionNode.bml +1 -1
- package/blocks/org/blockml/bml/framework/expression/InterpolatedStringNode.bml +51 -0
- package/dist/expression/evaluate-expression.d.ts +9 -0
- package/dist/expression/evaluate-expression.d.ts.map +1 -0
- package/dist/expression/evaluate-expression.js +124 -0
- package/dist/expression/evaluate-expression.js.map +1 -0
- package/dist/expression/parse-interpolated-text.d.ts +3 -0
- package/dist/expression/parse-interpolated-text.d.ts.map +1 -0
- package/dist/expression/parse-interpolated-text.js +80 -0
- package/dist/expression/parse-interpolated-text.js.map +1 -0
- package/dist/expression/restricted.d.ts +5 -0
- package/dist/expression/restricted.d.ts.map +1 -0
- package/dist/expression/restricted.js +65 -0
- package/dist/expression/restricted.js.map +1 -0
- package/dist/expression/types.d.ts +5 -1
- package/dist/expression/types.d.ts.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/resolve/resolve-generic-application.d.ts +18 -0
- package/dist/resolve/resolve-generic-application.d.ts.map +1 -0
- package/dist/resolve/resolve-generic-application.js +129 -0
- package/dist/resolve/resolve-generic-application.js.map +1 -0
- package/dist/resolve/satisfies-type-bound.d.ts +4 -0
- package/dist/resolve/satisfies-type-bound.d.ts.map +1 -0
- package/dist/resolve/satisfies-type-bound.js +20 -0
- package/dist/resolve/satisfies-type-bound.js.map +1 -0
- package/dist/validate/validate-generics.d.ts +4 -0
- package/dist/validate/validate-generics.d.ts.map +1 -0
- package/dist/validate/validate-generics.js +141 -0
- package/dist/validate/validate-generics.js.map +1 -0
- package/dist/validate/validate-types.d.ts.map +1 -1
- package/dist/validate/validate-types.js +125 -25
- package/dist/validate/validate-types.js.map +1 -1
- package/package.json +4 -4
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
Membership is defined exclusively by this blocks list.
|
|
50
50
|
</documentation>
|
|
51
51
|
|
|
52
|
-
<version>0.
|
|
52
|
+
<version>0.9.1</version>
|
|
53
53
|
|
|
54
54
|
<language>
|
|
55
55
|
<English />
|
|
@@ -87,6 +87,7 @@
|
|
|
87
87
|
<fwexpression:PropertyExpressionNode />
|
|
88
88
|
<fwexpression:CallExpressionNode />
|
|
89
89
|
<fwexpression:BinaryExpressionNode />
|
|
90
|
+
<fwexpression:InterpolatedStringNode />
|
|
90
91
|
<fwexpression:ParseExpressionResult />
|
|
91
92
|
<fwexpression:ParseExpressionError />
|
|
92
93
|
<fwexpression:ParseExpressionOutcome />
|
|
@@ -106,7 +107,11 @@
|
|
|
106
107
|
<fwcap:ResolveEffectiveMembers />
|
|
107
108
|
<fwcap:CollectBaseTypeChain />
|
|
108
109
|
<fwcap:MemberIdentityKey />
|
|
110
|
+
<fwcap:FindLocalMember />
|
|
109
111
|
<fwcap:ParseExpression />
|
|
112
|
+
<fwcap:ParseInterpolatedText />
|
|
113
|
+
<fwcap:EvaluateExpression />
|
|
114
|
+
<fwcap:EvaluateInterpolatedText />
|
|
110
115
|
<fwcap:ValidateTypes />
|
|
111
116
|
<fwcap:ValidateConstraints />
|
|
112
117
|
<fwcap:ValidateVersions />
|
|
@@ -116,6 +121,7 @@
|
|
|
116
121
|
<fwcap:PeekLibraryTypeFqn />
|
|
117
122
|
<fwcap:ValidateEmbeddedBlocks />
|
|
118
123
|
<fwcap:ValidateInstances />
|
|
124
|
+
<fwcap:ValidateGenerics />
|
|
119
125
|
<fwcap:ValidatePresets />
|
|
120
126
|
<fwcap:ValidateVisibility />
|
|
121
127
|
<fwcap:ValidateReadOnly />
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Framework Capability — EvaluateExpression
|
|
3
|
+
FQN: org.blockml.bml.framework.capability.EvaluateExpression
|
|
4
|
+
-->
|
|
5
|
+
<block
|
|
6
|
+
xmlns="http://blockml.org/bml"
|
|
7
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
8
|
+
xsi:schemaLocation="http://blockml.org/bml https://blockml.org/schemas/bml.xsd
|
|
9
|
+
"
|
|
10
|
+
xmlns:blockml="org.blockml.bml"
|
|
11
|
+
xmlns:bom="org.blockml.bml.bom"
|
|
12
|
+
xmlns:bomapi="org.blockml.bml.bom.api"
|
|
13
|
+
xmlns:bomblock="org.blockml.bml.bom.block"
|
|
14
|
+
xmlns:bomcommon="org.blockml.bml.bom.common"
|
|
15
|
+
xmlns:bomcomp="org.blockml.bml.bom.composition"
|
|
16
|
+
xmlns:bomdoc="org.blockml.bml.bom.document"
|
|
17
|
+
xmlns:bommember="org.blockml.bml.bom.member"
|
|
18
|
+
xmlns:bomtype="org.blockml.bml.bom.type"
|
|
19
|
+
xmlns:bomvalue="org.blockml.bml.bom.value"
|
|
20
|
+
xmlns:core="org.blockml.bml.core"
|
|
21
|
+
xmlns:def="org.blockml.bml.definition"
|
|
22
|
+
xmlns:framework="org.blockml.bml.framework"
|
|
23
|
+
xmlns:fwcap="org.blockml.bml.framework.capability"
|
|
24
|
+
xmlns:fwconfig="org.blockml.bml.framework.config"
|
|
25
|
+
xmlns:fwdocumentation="org.blockml.bml.framework.documentation"
|
|
26
|
+
xmlns:fwexpression="org.blockml.bml.framework.expression"
|
|
27
|
+
xmlns:fwregistry="org.blockml.bml.framework.registry"
|
|
28
|
+
xmlns:parser="org.blockml.bml.compiler.parser"
|
|
29
|
+
xmlns:type="org.blockml.bml.type"
|
|
30
|
+
xmlns:bomdocumentation="org.blockml.bml.bom.documentation"
|
|
31
|
+
xmlns:pardocumentation="org.blockml.bml.compiler.parser.documentation"
|
|
32
|
+
xmlns:valdocumentation="org.blockml.bml.compiler.validator.documentation">
|
|
33
|
+
|
|
34
|
+
<name>EvaluateExpression</name>
|
|
35
|
+
<type>fwcap:EvaluateExpression</type>
|
|
36
|
+
<baseType>core:Capability</baseType>
|
|
37
|
+
<is>Evaluate a restricted expression AST against the #this scope</is>
|
|
38
|
+
|
|
39
|
+
<documentation>#this is the outer Block property map. Same lookup as full expressions: size ≡ #this.size, this ≡ #this.this, this.x ≡ #this.this.x. Restricted profile only.</documentation>
|
|
40
|
+
|
|
41
|
+
<properties>
|
|
42
|
+
<node type="fwexpression:ExpressionNode">
|
|
43
|
+
<documentation>node. TS type: fwexpression:ExpressionNode. (required)</documentation>
|
|
44
|
+
</node>
|
|
45
|
+
<value type="type:Text">
|
|
46
|
+
<documentation>BML type gap: TS unknown evaluation result. (required)</documentation>
|
|
47
|
+
</value>
|
|
48
|
+
</properties>
|
|
49
|
+
|
|
50
|
+
</block>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Framework Capability — EvaluateInterpolatedText
|
|
3
|
+
FQN: org.blockml.bml.framework.capability.EvaluateInterpolatedText
|
|
4
|
+
-->
|
|
5
|
+
<block
|
|
6
|
+
xmlns="http://blockml.org/bml"
|
|
7
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
8
|
+
xsi:schemaLocation="http://blockml.org/bml https://blockml.org/schemas/bml.xsd
|
|
9
|
+
"
|
|
10
|
+
xmlns:blockml="org.blockml.bml"
|
|
11
|
+
xmlns:bom="org.blockml.bml.bom"
|
|
12
|
+
xmlns:bomapi="org.blockml.bml.bom.api"
|
|
13
|
+
xmlns:bomblock="org.blockml.bml.bom.block"
|
|
14
|
+
xmlns:bomcommon="org.blockml.bml.bom.common"
|
|
15
|
+
xmlns:bomcomp="org.blockml.bml.bom.composition"
|
|
16
|
+
xmlns:bomdoc="org.blockml.bml.bom.document"
|
|
17
|
+
xmlns:bommember="org.blockml.bml.bom.member"
|
|
18
|
+
xmlns:bomtype="org.blockml.bml.bom.type"
|
|
19
|
+
xmlns:bomvalue="org.blockml.bml.bom.value"
|
|
20
|
+
xmlns:core="org.blockml.bml.core"
|
|
21
|
+
xmlns:def="org.blockml.bml.definition"
|
|
22
|
+
xmlns:framework="org.blockml.bml.framework"
|
|
23
|
+
xmlns:fwcap="org.blockml.bml.framework.capability"
|
|
24
|
+
xmlns:fwconfig="org.blockml.bml.framework.config"
|
|
25
|
+
xmlns:fwdocumentation="org.blockml.bml.framework.documentation"
|
|
26
|
+
xmlns:fwexpression="org.blockml.bml.framework.expression"
|
|
27
|
+
xmlns:fwregistry="org.blockml.bml.framework.registry"
|
|
28
|
+
xmlns:parser="org.blockml.bml.compiler.parser"
|
|
29
|
+
xmlns:type="org.blockml.bml.type"
|
|
30
|
+
xmlns:bomdocumentation="org.blockml.bml.bom.documentation"
|
|
31
|
+
xmlns:pardocumentation="org.blockml.bml.compiler.parser.documentation"
|
|
32
|
+
xmlns:valdocumentation="org.blockml.bml.compiler.validator.documentation">
|
|
33
|
+
|
|
34
|
+
<name>EvaluateInterpolatedText</name>
|
|
35
|
+
<type>fwcap:EvaluateInterpolatedText</type>
|
|
36
|
+
<baseType>core:Capability</baseType>
|
|
37
|
+
<is>Evaluate interpolated text against the #this scope</is>
|
|
38
|
+
|
|
39
|
+
<documentation>Parses holes then evaluates them with the same #this lookup as full expressions. Result is concatenated Text.</documentation>
|
|
40
|
+
|
|
41
|
+
<properties>
|
|
42
|
+
<source type="type:Text">
|
|
43
|
+
<documentation>source. TS type: type:Text. (required)</documentation>
|
|
44
|
+
</source>
|
|
45
|
+
<value type="type:Text">
|
|
46
|
+
<documentation>value. TS type: type:Text. (required)</documentation>
|
|
47
|
+
</value>
|
|
48
|
+
</properties>
|
|
49
|
+
|
|
50
|
+
</block>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Framework Capability — FindLocalMember
|
|
3
|
+
FQN: org.blockml.bml.framework.capability.FindLocalMember
|
|
4
|
+
-->
|
|
5
|
+
<block
|
|
6
|
+
xmlns="http://blockml.org/bml"
|
|
7
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
8
|
+
xsi:schemaLocation="http://blockml.org/bml https://blockml.org/schemas/bml.xsd
|
|
9
|
+
"
|
|
10
|
+
xmlns:blockml="org.blockml.bml"
|
|
11
|
+
xmlns:bom="org.blockml.bml.bom"
|
|
12
|
+
xmlns:bomapi="org.blockml.bml.bom.api"
|
|
13
|
+
xmlns:bomblock="org.blockml.bml.bom.block"
|
|
14
|
+
xmlns:bomcommon="org.blockml.bml.bom.common"
|
|
15
|
+
xmlns:bomcomp="org.blockml.bml.bom.composition"
|
|
16
|
+
xmlns:bomdoc="org.blockml.bml.bom.document"
|
|
17
|
+
xmlns:bommember="org.blockml.bml.bom.member"
|
|
18
|
+
xmlns:bomtype="org.blockml.bml.bom.type"
|
|
19
|
+
xmlns:bomvalue="org.blockml.bml.bom.value"
|
|
20
|
+
xmlns:core="org.blockml.bml.core"
|
|
21
|
+
xmlns:def="org.blockml.bml.definition"
|
|
22
|
+
xmlns:framework="org.blockml.bml.framework"
|
|
23
|
+
xmlns:fwcap="org.blockml.bml.framework.capability"
|
|
24
|
+
xmlns:fwconfig="org.blockml.bml.framework.config"
|
|
25
|
+
xmlns:fwdocumentation="org.blockml.bml.framework.documentation"
|
|
26
|
+
xmlns:fwexpression="org.blockml.bml.framework.expression"
|
|
27
|
+
xmlns:fwregistry="org.blockml.bml.framework.registry"
|
|
28
|
+
xmlns:parser="org.blockml.bml.compiler.parser"
|
|
29
|
+
xmlns:type="org.blockml.bml.type"
|
|
30
|
+
xmlns:bomdocumentation="org.blockml.bml.bom.documentation"
|
|
31
|
+
xmlns:pardocumentation="org.blockml.bml.compiler.parser.documentation"
|
|
32
|
+
xmlns:valdocumentation="org.blockml.bml.compiler.validator.documentation">
|
|
33
|
+
|
|
34
|
+
<name>FindLocalMember</name>
|
|
35
|
+
<type>fwcap:FindLocalMember</type>
|
|
36
|
+
<baseType>core:Capability</baseType>
|
|
37
|
+
<is>Find a member declared on this block, not inherited</is>
|
|
38
|
+
|
|
39
|
+
<documentation>Looks up memberIdentityKey(member) in block.members only. Returns the local declaration, or undefined when the member is inherited or absent.</documentation>
|
|
40
|
+
|
|
41
|
+
<references>
|
|
42
|
+
<see type="fwcap:MemberIdentityKey" relation="SeeAlso" />
|
|
43
|
+
<see type="fwcap:ResolveEffectiveMembers" relation="SeeAlso" />
|
|
44
|
+
</references>
|
|
45
|
+
|
|
46
|
+
<properties>
|
|
47
|
+
<block type="bomblock:BlockDefinition">
|
|
48
|
+
<documentation>block. TS type: bomblock:BlockDefinition. (required)</documentation>
|
|
49
|
+
</block>
|
|
50
|
+
<member type="bommember:MemberDefinition">
|
|
51
|
+
<documentation>member. TS type: bommember:MemberDefinition. (required)</documentation>
|
|
52
|
+
</member>
|
|
53
|
+
<local type="bommember:MemberDefinition">
|
|
54
|
+
<documentation>Declared member on this block, or undefined. (optional)</documentation>
|
|
55
|
+
</local>
|
|
56
|
+
</properties>
|
|
57
|
+
|
|
58
|
+
</block>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Framework Capability — ParseInterpolatedText
|
|
3
|
+
FQN: org.blockml.bml.framework.capability.ParseInterpolatedText
|
|
4
|
+
-->
|
|
5
|
+
<block
|
|
6
|
+
xmlns="http://blockml.org/bml"
|
|
7
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
8
|
+
xsi:schemaLocation="http://blockml.org/bml https://blockml.org/schemas/bml.xsd
|
|
9
|
+
"
|
|
10
|
+
xmlns:blockml="org.blockml.bml"
|
|
11
|
+
xmlns:bom="org.blockml.bml.bom"
|
|
12
|
+
xmlns:bomapi="org.blockml.bml.bom.api"
|
|
13
|
+
xmlns:bomblock="org.blockml.bml.bom.block"
|
|
14
|
+
xmlns:bomcommon="org.blockml.bml.bom.common"
|
|
15
|
+
xmlns:bomcomp="org.blockml.bml.bom.composition"
|
|
16
|
+
xmlns:bomdoc="org.blockml.bml.bom.document"
|
|
17
|
+
xmlns:bommember="org.blockml.bml.bom.member"
|
|
18
|
+
xmlns:bomtype="org.blockml.bml.bom.type"
|
|
19
|
+
xmlns:bomvalue="org.blockml.bml.bom.value"
|
|
20
|
+
xmlns:core="org.blockml.bml.core"
|
|
21
|
+
xmlns:def="org.blockml.bml.definition"
|
|
22
|
+
xmlns:framework="org.blockml.bml.framework"
|
|
23
|
+
xmlns:fwcap="org.blockml.bml.framework.capability"
|
|
24
|
+
xmlns:fwconfig="org.blockml.bml.framework.config"
|
|
25
|
+
xmlns:fwdocumentation="org.blockml.bml.framework.documentation"
|
|
26
|
+
xmlns:fwexpression="org.blockml.bml.framework.expression"
|
|
27
|
+
xmlns:fwregistry="org.blockml.bml.framework.registry"
|
|
28
|
+
xmlns:parser="org.blockml.bml.compiler.parser"
|
|
29
|
+
xmlns:type="org.blockml.bml.type"
|
|
30
|
+
xmlns:bomdocumentation="org.blockml.bml.bom.documentation"
|
|
31
|
+
xmlns:pardocumentation="org.blockml.bml.compiler.parser.documentation"
|
|
32
|
+
xmlns:valdocumentation="org.blockml.bml.compiler.validator.documentation">
|
|
33
|
+
|
|
34
|
+
<name>ParseInterpolatedText</name>
|
|
35
|
+
<type>fwcap:ParseInterpolatedText</type>
|
|
36
|
+
<baseType>core:Capability</baseType>
|
|
37
|
+
<is>Parse interpolated text into an InterpolatedStringNode AST</is>
|
|
38
|
+
|
|
39
|
+
<documentation>Scan authored text for ${} holes. Restricted profile — same #this lookup as full expressions; no @model, @bean, or capability calls.</documentation>
|
|
40
|
+
|
|
41
|
+
<references>
|
|
42
|
+
<see type="fwdocumentation:ExpressionParsing" relation="SeeAlso" />
|
|
43
|
+
</references>
|
|
44
|
+
|
|
45
|
+
<properties>
|
|
46
|
+
<source type="type:Text">
|
|
47
|
+
<documentation>source. TS type: type:Text. (required)</documentation>
|
|
48
|
+
</source>
|
|
49
|
+
<outcome type="fwexpression:ParseExpressionOutcome">
|
|
50
|
+
<documentation>outcome. TS type: fwexpression:ParseExpressionOutcome. (required)</documentation>
|
|
51
|
+
</outcome>
|
|
52
|
+
</properties>
|
|
53
|
+
|
|
54
|
+
</block>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Framework Capability — ValidateGenerics
|
|
3
|
+
FQN: org.blockml.bml.framework.capability.ValidateGenerics
|
|
4
|
+
-->
|
|
5
|
+
<block
|
|
6
|
+
xmlns="http://blockml.org/bml"
|
|
7
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
8
|
+
xsi:schemaLocation="http://blockml.org/bml https://blockml.org/schemas/bml.xsd
|
|
9
|
+
"
|
|
10
|
+
xmlns:blockml="org.blockml.bml"
|
|
11
|
+
xmlns:bom="org.blockml.bml.bom"
|
|
12
|
+
xmlns:bomapi="org.blockml.bml.bom.api"
|
|
13
|
+
xmlns:bomblock="org.blockml.bml.bom.block"
|
|
14
|
+
xmlns:bomcommon="org.blockml.bml.bom.common"
|
|
15
|
+
xmlns:bomcomp="org.blockml.bml.bom.composition"
|
|
16
|
+
xmlns:bomdoc="org.blockml.bml.bom.document"
|
|
17
|
+
xmlns:bommember="org.blockml.bml.bom.member"
|
|
18
|
+
xmlns:bomtype="org.blockml.bml.bom.type"
|
|
19
|
+
xmlns:bomvalue="org.blockml.bml.bom.value"
|
|
20
|
+
xmlns:core="org.blockml.bml.core"
|
|
21
|
+
xmlns:def="org.blockml.bml.definition"
|
|
22
|
+
xmlns:framework="org.blockml.bml.framework"
|
|
23
|
+
xmlns:fwcap="org.blockml.bml.framework.capability"
|
|
24
|
+
xmlns:fwconfig="org.blockml.bml.framework.config"
|
|
25
|
+
xmlns:fwdocumentation="org.blockml.bml.framework.documentation"
|
|
26
|
+
xmlns:fwexpression="org.blockml.bml.framework.expression"
|
|
27
|
+
xmlns:fwregistry="org.blockml.bml.framework.registry"
|
|
28
|
+
xmlns:parser="org.blockml.bml.compiler.parser"
|
|
29
|
+
xmlns:type="org.blockml.bml.type"
|
|
30
|
+
xmlns:bomdocumentation="org.blockml.bml.bom.documentation"
|
|
31
|
+
xmlns:pardocumentation="org.blockml.bml.compiler.parser.documentation"
|
|
32
|
+
xmlns:valdocumentation="org.blockml.bml.compiler.validator.documentation">
|
|
33
|
+
|
|
34
|
+
<name>ValidateGenerics</name>
|
|
35
|
+
<type>fwcap:ValidateGenerics</type>
|
|
36
|
+
<baseType>core:Capability</baseType>
|
|
37
|
+
<is>Open generic instance and bml:generics placement checks</is>
|
|
38
|
+
|
|
39
|
+
<documentation>Open generic instance and bml:generics placement checks against
|
|
40
|
+
TypeRegistry. Emits BML_OPEN_GENERIC_INSTANCE, BML_GENERICS_DIRECTIVE_NOT_ALLOWED,
|
|
41
|
+
BML_GENERICS_ARGUMENT_MISMATCH, and reuses BML_GENERIC_CONSTRAINT_VIOLATION /
|
|
42
|
+
BML_MISSING_GENERIC_TYPE_ARGUMENT.
|
|
43
|
+
|
|
44
|
+
bml:generics is allowed whenever the instance type declares genericTypes.
|
|
45
|
+
Open parameters require a binding. Parameters with defaultType may omit it;
|
|
46
|
+
authored arguments override defaultType.
|
|
47
|
+
|
|
48
|
+
BML_OPEN_GENERIC_INSTANCE applies only to domain Block instances. Children of a
|
|
49
|
+
TypeReferenceEntity aggregation (Library blocks, contracts, …) are type
|
|
50
|
+
references — empty QName sugar or explicit TypeReferenceEntity — not instances
|
|
51
|
+
of the named type. They must not carry bml:generics; if present, emit
|
|
52
|
+
BML_GENERICS_DIRECTIVE_NOT_ALLOWED.</documentation>
|
|
53
|
+
|
|
54
|
+
<properties>
|
|
55
|
+
<document type="bomdoc:BomDocument">
|
|
56
|
+
<documentation>document. TS type: bomdoc:BomDocument. (required)</documentation>
|
|
57
|
+
</document>
|
|
58
|
+
<registry type="fwcap:TypeRegistry">
|
|
59
|
+
<documentation>registry. TS type: fwcap:TypeRegistry. (required)</documentation>
|
|
60
|
+
</registry>
|
|
61
|
+
<diagnostics type="bomcommon:Diagnostic[]">
|
|
62
|
+
<documentation>diagnostics. TS type: bomcommon:Diagnostic[]. (required)</documentation>
|
|
63
|
+
</diagnostics>
|
|
64
|
+
</properties>
|
|
65
|
+
|
|
66
|
+
</block>
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
|
|
41
41
|
<properties>
|
|
42
42
|
<codes type="type:Text[]">
|
|
43
|
-
<documentation>Ordered: BML_BOOTSTRAP_READ_ERROR, BML_CONSTRAINT_INFORMATION, BML_CONSTRAINT_TARGET_MISMATCH, BML_CONSTRAINT_UNKNOWN, BML_CONSTRAINT_VIOLATION, BML_CONSTRAINT_WARNING, BML_DUPLICATE_EMBEDDED_BLOCK, BML_DUPLICATE_MEMBER_VISIBILITY_VARIANT, BML_EMBEDDED_BLOCKS_ON_SUBBLOCK, BML_EXPRESSION_PARSE_ERROR, BML_LIBRARY_NESTING_VIOLATION, BML_LIBRARY_RESOLVE_ERROR, BML_MEMBER_COLLISION, BML_MISSING_ID, BML_MISSING_VERSION, BML_NESTED_EMBEDDED_BLOCKS, BML_OVERRIDE_REQUIRED, BML_OVERRIDE_WITHOUT_PARENT, BML_PRESET_CYCLE, BML_READONLY_MEMBER_WRITE, BML_SUBBLOCK_TYPE_MISMATCH, BML_UNRESOLVABLE_INSTANCE_REF, BML_UNKNOWN_BASE_TYPE, BML_UNKNOWN_CONTRACT, BML_UNKNOWN_TYPE, BML_UNKNOWN_PROPERTY, BML_UNKNOWN_VERSION, BML_VISIBILITY_PRIVATE_OVERRIDE (required)</documentation>
|
|
43
|
+
<documentation>Ordered: BML_BOOTSTRAP_READ_ERROR, BML_CONSTRAINT_INFORMATION, BML_CONSTRAINT_TARGET_MISMATCH, BML_CONSTRAINT_UNKNOWN, BML_CONSTRAINT_VIOLATION, BML_CONSTRAINT_WARNING, BML_DUPLICATE_EMBEDDED_BLOCK, BML_DUPLICATE_MEMBER_VISIBILITY_VARIANT, BML_EMBEDDED_BLOCKS_ON_SUBBLOCK, BML_EXPRESSION_PARSE_ERROR, BML_EXPR_NOT_ALLOWED_IN_INTERPOLATION, BML_EXPR_SYNTAX_ERROR, BML_EXPR_TYPE_MISMATCH, BML_GENERIC_CONSTRAINT_VIOLATION, BML_GENERICS_ARGUMENT_MISMATCH, BML_GENERICS_DIRECTIVE_NOT_ALLOWED, BML_LIBRARY_NESTING_VIOLATION, BML_LIBRARY_RESOLVE_ERROR, BML_MEMBER_COLLISION, BML_MISSING_GENERIC_TYPE_ARGUMENT, BML_MISSING_ID, BML_MISSING_VERSION, BML_NESTED_EMBEDDED_BLOCKS, BML_OPEN_GENERIC_INSTANCE, BML_OVERRIDE_REQUIRED, BML_OVERRIDE_WITHOUT_PARENT, BML_PRESET_CYCLE, BML_READONLY_MEMBER_WRITE, BML_SUBBLOCK_TYPE_MISMATCH, BML_TYPE_BOUND_NOT_SATISFIED, BML_UNRESOLVABLE_INSTANCE_REF, BML_UNKNOWN_BASE_TYPE, BML_UNKNOWN_CONTRACT, BML_UNKNOWN_TYPE, BML_UNKNOWN_PROPERTY, BML_UNKNOWN_VERSION, BML_VISIBILITY_PRIVATE_OVERRIDE (required)</documentation>
|
|
44
44
|
</codes>
|
|
45
45
|
</properties>
|
|
46
46
|
|
|
@@ -43,15 +43,26 @@
|
|
|
43
43
|
• BML_UNKNOWN_BASE_TYPE — baseType FQN not in TypeRegistry (at baseTypeSource)
|
|
44
44
|
• BML_UNKNOWN_CONTRACT — contracts[] FQN not in TypeRegistry
|
|
45
45
|
• BML_UNKNOWN_TYPE — named type FQN not in TypeRegistry and not a well-known primitive (member types at typeSource; instance typeFqn on the instance)
|
|
46
|
+
• BML_TYPE_BOUND_NOT_SATISFIED — capability throws[] type is not core:Exception (baseType chain or direct contracts[])
|
|
46
47
|
• BML_MEMBER_COLLISION — duplicate member identity in effective set
|
|
47
48
|
• BML_OVERRIDE_WITHOUT_PARENT — override without resolvable base member
|
|
48
49
|
• BML_OVERRIDE_REQUIRED — override on non-overridable member
|
|
49
50
|
• BML_EXPRESSION_PARSE_ERROR — parseExpression failed on ExpressionValue.raw
|
|
51
|
+
• BML_EXPR_SYNTAX_ERROR — unclosed ${} in interpolated text
|
|
52
|
+
• BML_EXPR_NOT_ALLOWED_IN_INTERPOLATION — hole uses @model, @bean, or a forbidden call
|
|
53
|
+
• BML_EXPR_TYPE_MISMATCH — interpolated text on a non-Text member
|
|
50
54
|
|
|
51
55
|
validateInstances:
|
|
52
56
|
• BML_UNKNOWN_TYPE — composition instance typeFqn not in TypeRegistry
|
|
53
57
|
• BML_UNKNOWN_PROPERTY — instance memberValues key not in effective members (error)
|
|
54
58
|
|
|
59
|
+
validateGenerics:
|
|
60
|
+
• BML_OPEN_GENERIC_INSTANCE — aggregated domain Block instance still has open genericTypes without bml:generics (not TypeReferenceEntity sugar)
|
|
61
|
+
• BML_GENERICS_DIRECTIVE_NOT_ALLOWED — bml:generics not on a Block instance (including TypeReferenceEntity QName sugar)
|
|
62
|
+
• BML_GENERICS_ARGUMENT_MISMATCH — bml:generics does not match declared genericTypes (including on a non-generic type)
|
|
63
|
+
• BML_MISSING_GENERIC_TYPE_ARGUMENT — directive present but a required argument has no defaultType
|
|
64
|
+
• BML_GENERIC_CONSTRAINT_VIOLATION — argument fails parameter baseType via satisfiesTypeBound
|
|
65
|
+
|
|
55
66
|
validateVersions:
|
|
56
67
|
• BML_MISSING_VERSION — standalone root block missing effective version (non-framework convention)
|
|
57
68
|
• BML_UNKNOWN_VERSION — bml:version pin does not match registered block version
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
resolveContracts resolves each contracts[] FQN via TypeRegistry; unknown contract →
|
|
49
49
|
BML_UNKNOWN_CONTRACT (validateTypes).
|
|
50
50
|
memberIdentityKey(member) = (namespace ?? "") + ":" + name — collision detection key.
|
|
51
|
+
findLocalMember(block, member) looks up that key in block.members only (not inherited).
|
|
51
52
|
|
|
52
53
|
Partial merge: later layer replaces only explicitly authored attributes on the member.
|
|
53
54
|
Used by validateTypes (member collision, override rules) and validateConstraints (effective
|
|
@@ -59,6 +60,7 @@
|
|
|
59
60
|
<see type="fwdocumentation:ExpressionParsing" relation="ReadNext" />
|
|
60
61
|
<see type="fwcap:ResolveEffectiveMembers" relation="Defines" />
|
|
61
62
|
<see type="fwcap:ResolveContracts" relation="SeeAlso" />
|
|
63
|
+
<see type="fwcap:FindLocalMember" relation="SeeAlso" />
|
|
62
64
|
</references>
|
|
63
65
|
|
|
64
66
|
</block>
|
|
@@ -38,12 +38,15 @@
|
|
|
38
38
|
<is>parseExpression AST — no Urmodell writeback (B4)</is>
|
|
39
39
|
|
|
40
40
|
<documentation>parseExpression(source) parses expression text into an ExpressionNode AST.
|
|
41
|
+
parseInterpolatedText(source) scans Text for ${} holes (restricted profile).
|
|
42
|
+
Lookup is the same as full expressions: size ≡ #this.size, this ≡ #this.this.
|
|
41
43
|
Returns ParseExpressionOutcome: { ok: true, result } | { ok: false, error }.
|
|
42
44
|
|
|
43
|
-
Parser stores ExpressionValue.raw only (B4).
|
|
44
|
-
at validation time and emits BML_EXPRESSION_PARSE_ERROR
|
|
45
|
+
Parser stores ExpressionValue.raw / InterpolatedTextValue.raw only (B4).
|
|
46
|
+
validateTypes re-parses at validation time and emits BML_EXPRESSION_PARSE_ERROR
|
|
47
|
+
or BML_EXPR_NOT_ALLOWED_IN_INTERPOLATION on failure.
|
|
45
48
|
|
|
46
|
-
AST node kinds: literal, array, object, property, call, binary.
|
|
49
|
+
AST node kinds: literal, array, object, property, call, binary, interpolated.
|
|
47
50
|
Optional resultTypeFqn on ParseExpressionResult for typed expression metadata.
|
|
48
51
|
|
|
49
52
|
Expression AST is a Stage-2 utility — never written back to Urmodell member values.</documentation>
|
|
@@ -58,9 +58,15 @@
|
|
|
58
58
|
resolveContracts(block, registry) → MemberDefinition[] (contract slice; used by resolveEffectiveMembers)
|
|
59
59
|
collectBaseTypeChain(block, registry) → BlockDefinition[]
|
|
60
60
|
memberIdentityKey(member) → string
|
|
61
|
+
findLocalMember(block, member) → MemberDefinition | undefined
|
|
61
62
|
parseExpression(source) → ParseExpressionOutcome
|
|
63
|
+
parseInterpolatedText(source) → ParseExpressionOutcome
|
|
64
|
+
evaluateExpression(node, scope) → value
|
|
65
|
+
evaluateInterpolatedText(source, scope) → Text
|
|
62
66
|
validateTypes(document, registry) → Diagnostic[]
|
|
63
67
|
validateVersions(document, registry) → Diagnostic[]
|
|
68
|
+
validateInstances(document, registry) → Diagnostic[]
|
|
69
|
+
validateGenerics(document, registry) → Diagnostic[]
|
|
64
70
|
validateConstraints(document, registry) → Diagnostic[]
|
|
65
71
|
getPropertyNumericValue(property) → number | undefined
|
|
66
72
|
isLiteralValue(value) → boolean
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
extras (config.libraries / --libraries), deduped by realpath.
|
|
62
62
|
|
|
63
63
|
bootstrapFullProjectRegistry({ rootDir, srcDir?, libraries? }) is the shared
|
|
64
|
-
entry point for `blockml validate --all
|
|
64
|
+
entry point for `blockml validate --all`, `@blockml/search`, and `@blockml/graph`. It sets
|
|
65
65
|
corpus paths to projectSourceRoots (this package srcDir plus local packages/*
|
|
66
66
|
BlockML modules) and library seeds to resolveLibrarySeeds, then calls
|
|
67
67
|
bootstrapTypeRegistry. The resulting registry is the effective BML corpus:
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
<baseType>framework:FrameworkType</baseType>
|
|
37
37
|
<is>Abstract union of expression AST node variants</is>
|
|
38
38
|
|
|
39
|
-
<documentation>Discriminated by kind: literal | array | object | property | call | binary.</documentation>
|
|
39
|
+
<documentation>Discriminated by kind: literal | array | object | property | call | binary | interpolated.</documentation>
|
|
40
40
|
|
|
41
41
|
<references>
|
|
42
42
|
<see type="fwexpression:LiteralExpressionNode" relation="SeeAlso" />
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Framework — InterpolatedStringNode
|
|
3
|
+
FQN: org.blockml.bml.framework.expression.InterpolatedStringNode
|
|
4
|
+
-->
|
|
5
|
+
<block
|
|
6
|
+
xmlns="http://blockml.org/bml"
|
|
7
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
8
|
+
xsi:schemaLocation="http://blockml.org/bml https://blockml.org/schemas/bml.xsd
|
|
9
|
+
"
|
|
10
|
+
xmlns:blockml="org.blockml.bml"
|
|
11
|
+
xmlns:bom="org.blockml.bml.bom"
|
|
12
|
+
xmlns:bomapi="org.blockml.bml.bom.api"
|
|
13
|
+
xmlns:bomblock="org.blockml.bml.bom.block"
|
|
14
|
+
xmlns:bomcommon="org.blockml.bml.bom.common"
|
|
15
|
+
xmlns:bomcomp="org.blockml.bml.bom.composition"
|
|
16
|
+
xmlns:bomdoc="org.blockml.bml.bom.document"
|
|
17
|
+
xmlns:bommember="org.blockml.bml.bom.member"
|
|
18
|
+
xmlns:bomtype="org.blockml.bml.bom.type"
|
|
19
|
+
xmlns:bomvalue="org.blockml.bml.bom.value"
|
|
20
|
+
xmlns:core="org.blockml.bml.core"
|
|
21
|
+
xmlns:def="org.blockml.bml.definition"
|
|
22
|
+
xmlns:framework="org.blockml.bml.framework"
|
|
23
|
+
xmlns:fwcap="org.blockml.bml.framework.capability"
|
|
24
|
+
xmlns:fwconfig="org.blockml.bml.framework.config"
|
|
25
|
+
xmlns:fwdocumentation="org.blockml.bml.framework.documentation"
|
|
26
|
+
xmlns:fwexpression="org.blockml.bml.framework.expression"
|
|
27
|
+
xmlns:fwregistry="org.blockml.bml.framework.registry"
|
|
28
|
+
xmlns:parser="org.blockml.bml.compiler.parser"
|
|
29
|
+
xmlns:type="org.blockml.bml.type"
|
|
30
|
+
xmlns:bomdocumentation="org.blockml.bml.bom.documentation"
|
|
31
|
+
xmlns:pardocumentation="org.blockml.bml.compiler.parser.documentation"
|
|
32
|
+
xmlns:valdocumentation="org.blockml.bml.compiler.validator.documentation">
|
|
33
|
+
|
|
34
|
+
<name>InterpolatedStringNode</name>
|
|
35
|
+
<type>fwexpression:InterpolatedStringNode</type>
|
|
36
|
+
<baseType>fwexpression:ExpressionNode</baseType>
|
|
37
|
+
<is>Interpolated text AST node</is>
|
|
38
|
+
|
|
39
|
+
<documentation>kind: interpolated. parts: literal and hole ExpressionNode[].</documentation>
|
|
40
|
+
|
|
41
|
+
<properties>
|
|
42
|
+
<kind type="type:Text">
|
|
43
|
+
<documentation>kind. TS type: type:Text. (required)</documentation>
|
|
44
|
+
<value>interpolated</value>
|
|
45
|
+
</kind>
|
|
46
|
+
<parts type="fwexpression:ExpressionNode[]">
|
|
47
|
+
<documentation>parts. TS type: fwexpression:ExpressionNode[]. (required)</documentation>
|
|
48
|
+
</parts>
|
|
49
|
+
</properties>
|
|
50
|
+
|
|
51
|
+
</block>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ExpressionNode } from "./types.js";
|
|
2
|
+
export type ExpressionScope = Record<string, unknown>;
|
|
3
|
+
export declare class ExpressionEvaluationError extends Error {
|
|
4
|
+
readonly code: string;
|
|
5
|
+
constructor(code: string, message: string);
|
|
6
|
+
}
|
|
7
|
+
export declare function evaluateExpression(node: ExpressionNode, scope: ExpressionScope): unknown;
|
|
8
|
+
export declare function evaluateInterpolatedText(raw: string, scope: ExpressionScope): string;
|
|
9
|
+
//# sourceMappingURL=evaluate-expression.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluate-expression.d.ts","sourceRoot":"","sources":["../../src/expression/evaluate-expression.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEtD,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK1C;AA2ED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,eAAe,GACrB,OAAO,CAiDT;AAED,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,eAAe,GACrB,MAAM,CAWR"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { parseInterpolatedText } from "./parse-interpolated-text.js";
|
|
2
|
+
import { INTERPOLATION_NOT_ALLOWED, restrictedExpressionError, } from "./restricted.js";
|
|
3
|
+
export class ExpressionEvaluationError extends Error {
|
|
4
|
+
code;
|
|
5
|
+
constructor(code, message) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = "ExpressionEvaluationError";
|
|
8
|
+
this.code = code;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function asRecord(value) {
|
|
12
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
function lookupPath(scope, path) {
|
|
18
|
+
const segments = path.flatMap((seg) => seg.split(".")).filter(Boolean);
|
|
19
|
+
let i = 0;
|
|
20
|
+
if (segments[0] === "#this") {
|
|
21
|
+
i = 1;
|
|
22
|
+
}
|
|
23
|
+
let current = scope;
|
|
24
|
+
for (; i < segments.length; i++) {
|
|
25
|
+
const key = segments[i];
|
|
26
|
+
const record = asRecord(current);
|
|
27
|
+
if (!record || !(key in record)) {
|
|
28
|
+
throw new ExpressionEvaluationError("BML_EXPR_UNKNOWN_PROPERTY", `Unknown property ${segments.join(".")}`);
|
|
29
|
+
}
|
|
30
|
+
current = record[key];
|
|
31
|
+
}
|
|
32
|
+
return current;
|
|
33
|
+
}
|
|
34
|
+
function stringifyValue(value) {
|
|
35
|
+
if (value === null || value === undefined) {
|
|
36
|
+
return "";
|
|
37
|
+
}
|
|
38
|
+
if (typeof value === "string") {
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
42
|
+
return String(value);
|
|
43
|
+
}
|
|
44
|
+
return JSON.stringify(value);
|
|
45
|
+
}
|
|
46
|
+
function evalBuiltin(callee, args) {
|
|
47
|
+
switch (callee) {
|
|
48
|
+
case "#strings.concat":
|
|
49
|
+
return args.map(stringifyValue).join("");
|
|
50
|
+
case "#strings.trim":
|
|
51
|
+
return stringifyValue(args[0]).trim();
|
|
52
|
+
case "#strings.length":
|
|
53
|
+
return stringifyValue(args[0]).length;
|
|
54
|
+
case "#strings.toUpperCase":
|
|
55
|
+
return stringifyValue(args[0]).toUpperCase();
|
|
56
|
+
case "#strings.toLowerCase":
|
|
57
|
+
return stringifyValue(args[0]).toLowerCase();
|
|
58
|
+
case "#math.min":
|
|
59
|
+
return Math.min(Number(args[0]), Number(args[1]));
|
|
60
|
+
case "#math.max":
|
|
61
|
+
return Math.max(Number(args[0]), Number(args[1]));
|
|
62
|
+
case "#math.abs":
|
|
63
|
+
return Math.abs(Number(args[0]));
|
|
64
|
+
case "#math.floor":
|
|
65
|
+
return Math.floor(Number(args[0]));
|
|
66
|
+
case "#math.ceil":
|
|
67
|
+
return Math.ceil(Number(args[0]));
|
|
68
|
+
case "#math.round":
|
|
69
|
+
return Math.round(Number(args[0]));
|
|
70
|
+
default:
|
|
71
|
+
throw new ExpressionEvaluationError("BML_EXPR_NOT_ALLOWED_IN_INTERPOLATION", INTERPOLATION_NOT_ALLOWED);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export function evaluateExpression(node, scope) {
|
|
75
|
+
const restricted = restrictedExpressionError(node);
|
|
76
|
+
if (restricted) {
|
|
77
|
+
throw new ExpressionEvaluationError("BML_EXPR_NOT_ALLOWED_IN_INTERPOLATION", restricted);
|
|
78
|
+
}
|
|
79
|
+
switch (node.kind) {
|
|
80
|
+
case "literal":
|
|
81
|
+
return node.value;
|
|
82
|
+
case "property":
|
|
83
|
+
return lookupPath(scope, node.path);
|
|
84
|
+
case "binary": {
|
|
85
|
+
const left = evaluateExpression(node.left, scope);
|
|
86
|
+
const right = evaluateExpression(node.right, scope);
|
|
87
|
+
if (node.operator === "+") {
|
|
88
|
+
if (typeof left === "number" && typeof right === "number") {
|
|
89
|
+
return left + right;
|
|
90
|
+
}
|
|
91
|
+
return stringifyValue(left) + stringifyValue(right);
|
|
92
|
+
}
|
|
93
|
+
throw new ExpressionEvaluationError("BML_EXPR_NOT_ALLOWED_IN_INTERPOLATION", INTERPOLATION_NOT_ALLOWED);
|
|
94
|
+
}
|
|
95
|
+
case "call":
|
|
96
|
+
return evalBuiltin(node.callee, node.args.map((arg) => evaluateExpression(arg, scope)));
|
|
97
|
+
case "array":
|
|
98
|
+
return node.elements.map((el) => evaluateExpression(el, scope));
|
|
99
|
+
case "object": {
|
|
100
|
+
const out = {};
|
|
101
|
+
for (const [key, value] of Object.entries(node.entries)) {
|
|
102
|
+
out[key] = evaluateExpression(value, scope);
|
|
103
|
+
}
|
|
104
|
+
return out;
|
|
105
|
+
}
|
|
106
|
+
case "interpolated":
|
|
107
|
+
return node.parts.map((part) => stringifyValue(evaluateExpression(part, scope))).join("");
|
|
108
|
+
default:
|
|
109
|
+
throw new ExpressionEvaluationError("BML_EXPR_NOT_ALLOWED_IN_INTERPOLATION", INTERPOLATION_NOT_ALLOWED);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
export function evaluateInterpolatedText(raw, scope) {
|
|
113
|
+
const parsed = parseInterpolatedText(raw);
|
|
114
|
+
if (!parsed.ok) {
|
|
115
|
+
const code = parsed.error.message === INTERPOLATION_NOT_ALLOWED
|
|
116
|
+
? "BML_EXPR_NOT_ALLOWED_IN_INTERPOLATION"
|
|
117
|
+
: parsed.error.message === "Unclosed interpolation"
|
|
118
|
+
? "BML_EXPR_SYNTAX_ERROR"
|
|
119
|
+
: "BML_EXPRESSION_PARSE_ERROR";
|
|
120
|
+
throw new ExpressionEvaluationError(code, parsed.error.message);
|
|
121
|
+
}
|
|
122
|
+
return stringifyValue(evaluateExpression(parsed.result.ast, scope));
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=evaluate-expression.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluate-expression.js","sourceRoot":"","sources":["../../src/expression/evaluate-expression.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EACL,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC;AAKzB,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IACzC,IAAI,CAAS;IAEtB,YAAY,IAAY,EAAE,OAAe;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;QACxC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzE,OAAO,KAAgC,CAAC;IAC1C,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,UAAU,CAAC,KAAsB,EAAE,IAAc;IACxD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE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