@blockml/parser 0.4.0 → 0.6.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/blocks/org/blockml/bml/compiler/parser/Library.bml +75 -75
- package/blocks/org/blockml/bml/compiler/parser/capability/CreateMapContext.bml +1 -1
- package/blocks/org/blockml/bml/compiler/parser/config/MapTimeDiagnosticCodes.bml +1 -1
- package/blocks/org/blockml/bml/compiler/parser/documentation/AttributeClassification.bml +4 -4
- package/blocks/org/blockml/bml/compiler/parser/documentation/DesignDecisions.bml +1 -1
- package/blocks/org/blockml/bml/compiler/parser/documentation/Diagnostics.bml +6 -0
- package/blocks/org/blockml/bml/compiler/parser/documentation/MemberMapping.bml +4 -1
- package/blocks/org/blockml/bml/compiler/parser/documentation/StructuralGrammar.bml +63 -0
- package/blocks/org/blockml/bml/compiler/parser/documentation/V1Scope.bml +1 -1
- package/blocks/org/blockml/bml/compiler/parser/map/MapContext.bml +3 -0
- package/dist/map/context.d.ts +3 -0
- package/dist/map/context.d.ts.map +1 -1
- package/dist/map/context.js +1 -0
- package/dist/map/context.js.map +1 -1
- package/dist/map/directives.d.ts +2 -1
- package/dist/map/directives.d.ts.map +1 -1
- package/dist/map/directives.js +5 -1
- package/dist/map/directives.js.map +1 -1
- package/dist/map/map-block.d.ts +2 -2
- package/dist/map/map-block.d.ts.map +1 -1
- package/dist/map/map-block.js +91 -51
- package/dist/map/map-block.js.map +1 -1
- package/dist/map/map-composition.d.ts.map +1 -1
- package/dist/map/map-composition.js +18 -5
- package/dist/map/map-composition.js.map +1 -1
- package/dist/map/structural.d.ts +21 -0
- package/dist/map/structural.d.ts.map +1 -0
- package/dist/map/structural.js +307 -0
- package/dist/map/structural.js.map +1 -0
- package/dist/parse.js +1 -1
- package/dist/parse.js.map +1 -1
- package/package.json +2 -2
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
(@blockml/bom). Membership is defined exclusively by this blocks list.
|
|
39
39
|
</documentation>
|
|
40
40
|
|
|
41
|
-
<version>0.
|
|
41
|
+
<version>0.6.0</version>
|
|
42
42
|
|
|
43
43
|
<language>
|
|
44
44
|
<English />
|
|
@@ -59,84 +59,84 @@
|
|
|
59
59
|
<dependencies>
|
|
60
60
|
<composition>
|
|
61
61
|
<blockml:Library />
|
|
62
|
-
</composition>
|
|
63
|
-
<composition>
|
|
64
62
|
<bom:Library />
|
|
65
63
|
</composition>
|
|
66
64
|
</dependencies>
|
|
67
65
|
<blocks>
|
|
68
|
-
<composition><parser:ParserType
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
66
|
+
<composition><parser:ParserType />
|
|
67
|
+
<parmap:MapContext />
|
|
68
|
+
<parconfig:ParserConstants />
|
|
69
|
+
<parconfig:MapTimeDiagnosticCodes />
|
|
70
|
+
<parcap:Parse />
|
|
71
|
+
<parcap:DetectFormat />
|
|
72
|
+
<parcap:ParseXmlDom />
|
|
73
|
+
<parcap:GetParseErrors />
|
|
74
|
+
<parcap:DocumentElement />
|
|
75
|
+
<parcap:AssertBlockRoot />
|
|
76
|
+
<parcap:ExtractNamespaceBindings />
|
|
77
|
+
<parcap:MergeSourceInfo />
|
|
78
|
+
<parcap:CreateMapContext />
|
|
79
|
+
<parcap:MapDocumentBlock />
|
|
80
|
+
<parcap:MapBlock />
|
|
81
|
+
<parcap:MapCompositionTemplate />
|
|
82
|
+
<parcap:MapBlockInstanceNode />
|
|
83
|
+
<parcap:IsTypeReferenceEntitySugar />
|
|
84
|
+
<parcap:MapTypeReferenceEntityInstance />
|
|
85
|
+
<parcap:BuildSubBlockIndex />
|
|
86
|
+
<parcap:ParseTypeExpression />
|
|
87
|
+
<parcap:InferCardinality />
|
|
88
|
+
<parcap:TypeExpressionToString />
|
|
89
|
+
<parcap:ParseMemberValue />
|
|
90
|
+
<parcap:ExpressionFromRaw />
|
|
91
|
+
<parcap:ParseDirectives />
|
|
92
|
+
<parcap:ParseBmlMeta />
|
|
93
|
+
<parcap:ParseVisibilityFromName />
|
|
94
|
+
<parcap:VisibilityPrefix />
|
|
95
|
+
<parcap:NormalizeBooleanValue />
|
|
96
|
+
<parcap:IsBooleanLiteral />
|
|
97
|
+
<parcap:ParseBooleanAttribute />
|
|
98
|
+
<parcap:SplitQName />
|
|
99
|
+
<parcap:ResolvePrefix />
|
|
100
|
+
<parcap:ResolveBlockReference />
|
|
101
|
+
<parcap:ResolveTypeName />
|
|
102
|
+
<parcap:HasBmlSemanticQNameBindings />
|
|
103
|
+
<parcap:FqnToQName />
|
|
104
|
+
<parcap:SourceLoc />
|
|
105
|
+
<parcap:ElementSourceLoc />
|
|
106
|
+
<parcap:IsElement />
|
|
107
|
+
<parcap:IsComment />
|
|
108
|
+
<parcap:IsTextNode />
|
|
109
|
+
<parcap:IsCData />
|
|
110
|
+
<parcap:ElementChildren />
|
|
111
|
+
<parcap:ElementLocalName />
|
|
112
|
+
<parcap:ElementPrefix />
|
|
113
|
+
<parcap:GetAttribute />
|
|
114
|
+
<parcap:GetCharacterData />
|
|
115
|
+
<parcap:CollectLeadingComments />
|
|
116
|
+
<parcap:CollectTrailingComments />
|
|
117
|
+
<parcap:XmlTriviaFromElement />
|
|
118
|
+
<parcap:TrimText />
|
|
119
|
+
<pardocumentation:Introduction />
|
|
120
|
+
<pardocumentation:LayerSeparation />
|
|
121
|
+
<pardocumentation:ArchitectureOverview />
|
|
122
|
+
<pardocumentation:V1Scope />
|
|
123
|
+
<pardocumentation:PublicApi />
|
|
124
|
+
<pardocumentation:MappingPrinciples />
|
|
125
|
+
<pardocumentation:MemberMappingOrder />
|
|
126
|
+
<pardocumentation:AttributeClassification />
|
|
127
|
+
<pardocumentation:StructuralGrammar />
|
|
128
|
+
<pardocumentation:XmlCommentsParse />
|
|
129
|
+
<pardocumentation:TypeDescriptorParsing />
|
|
130
|
+
<pardocumentation:BlockMetadataMapping />
|
|
131
|
+
<pardocumentation:MemberMapping />
|
|
132
|
+
<pardocumentation:ExpressionCapture />
|
|
133
|
+
<pardocumentation:SingleFileScope />
|
|
134
|
+
<pardocumentation:DesignDecisions />
|
|
135
|
+
<pardocumentation:RoundtripContract />
|
|
136
|
+
<pardocumentation:Diagnostics />
|
|
137
|
+
<pardocumentation:PackageOwnership />
|
|
138
|
+
<pardocumentation:ScopeExclusions />
|
|
139
|
+
</composition>
|
|
140
140
|
</blocks>
|
|
141
141
|
</aggregations>
|
|
142
142
|
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
<documentation>bindings. TS type: type:Text. (required)</documentation>
|
|
47
47
|
</bindings>
|
|
48
48
|
<options type="core:Any">
|
|
49
|
-
<documentation>subBlockIndex, parentBlockType, isRoot, isEmbedded. (optional)</documentation>
|
|
49
|
+
<documentation>subBlockIndex, parentBlockType, isRoot, isEmbedded, diagnostics. (optional)</documentation>
|
|
50
50
|
</options>
|
|
51
51
|
<context type="parmap:MapContext">
|
|
52
52
|
<documentation>context. TS type: parmap:MapContext. (required)</documentation>
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
|
|
34
34
|
<properties>
|
|
35
35
|
<codes type="type:Text[]">
|
|
36
|
-
<documentation>Ordered: BML_UNSUPPORTED_FORMAT, BML_MALFORMED_XML, BML_MISSING_ROOT, BML_INVALID_ROOT, BML_MAP_ERROR, BML_UNKNOWN_NAMESPACE_PREFIX, BML_UNQUALIFIED_BLOCK_REFERENCE, BML_UNKNOWN_TYPE, BML_INVALID_TYPE_REFERENCE (required)</documentation>
|
|
36
|
+
<documentation>Ordered: BML_UNSUPPORTED_FORMAT, BML_MALFORMED_XML, BML_MISSING_ROOT, BML_INVALID_ROOT, BML_MAP_ERROR, BML_UNKNOWN_NAMESPACE_PREFIX, BML_UNQUALIFIED_BLOCK_REFERENCE, BML_UNKNOWN_TYPE, BML_INVALID_TYPE_REFERENCE, BML_UNKNOWN_ELEMENT, BML_UNKNOWN_ATTRIBUTE, BML_UNKNOWN_DIRECTIVE, BML_STANDALONE_COMPOSITION, BML_DUPLICATE_COMPOSITION, BML_UNEXPECTED_TEXT (required)</documentation>
|
|
37
37
|
</codes>
|
|
38
38
|
</properties>
|
|
39
39
|
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
• Directives (bml:each, bml:if, …) → directives[]
|
|
43
43
|
• Unknown bml:* → BML_UNKNOWN_DIRECTIVE (error at map time — B2)
|
|
44
44
|
|
|
45
|
-
Rule 3 —
|
|
46
|
-
•
|
|
47
|
-
• ${ expr } → ExpressionValue { raw } (B4)
|
|
45
|
+
Rule 3 — Grammar vs instance:
|
|
46
|
+
• On definition/grammar nodes, remaining attributes are closed. Unknown → BML_UNKNOWN_ATTRIBUTE (structural error); preserved as unknownAttributes.
|
|
47
|
+
• On block instances, remaining attributes → memberValues[name] (camelCase); ${ expr } → ExpressionValue { raw } (B4). Unknown members are a validator error.
|
|
48
48
|
|
|
49
49
|
Serialize side of Rule 1 (B25 re-emit) → @blockml/serializer.</documentation>
|
|
50
50
|
|
|
51
51
|
<references>
|
|
52
|
-
<see type="pardocumentation:
|
|
52
|
+
<see type="pardocumentation:StructuralGrammar" relation="ReadNext"></see>
|
|
53
53
|
<see type="parcap:ParseDirectives" relation="SeeAlso"></see>
|
|
54
54
|
</references>
|
|
55
55
|
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
<baseType>core:Documentation</baseType>
|
|
31
31
|
<is>Normative parser design decisions</is>
|
|
32
32
|
|
|
33
|
-
<documentation>B2: unknown bml:* → error at map; unknown
|
|
33
|
+
<documentation>B2: unknown bml:* → error at map (BML_UNKNOWN_DIRECTIVE); unknown instance members → validator error (BML_UNKNOWN_PROPERTY).
|
|
34
34
|
B3: inputType/outputType → TypeExpression at map time.
|
|
35
35
|
B4: ExpressionValue.raw only; AST via core utility.
|
|
36
36
|
B5: single-file parser scope.
|
|
@@ -41,6 +41,12 @@
|
|
|
41
41
|
• BML_UNKNOWN_NAMESPACE_PREFIX, BML_UNQUALIFIED_BLOCK_REFERENCE
|
|
42
42
|
• BML_UNKNOWN_TYPE — type expression parse failure
|
|
43
43
|
• BML_INVALID_TYPE_REFERENCE — ill-formed type expression (ungrouped stacked multiplicity)
|
|
44
|
+
• BML_UNKNOWN_ELEMENT — child not in closed Block grammar (structural)
|
|
45
|
+
• BML_UNKNOWN_ATTRIBUTE — attribute not allowed on a grammar node (structural)
|
|
46
|
+
• BML_UNKNOWN_DIRECTIVE — unknown bml:* attribute (B2)
|
|
47
|
+
• BML_STANDALONE_COMPOSITION — <composition> not a direct child of an aggregation member
|
|
48
|
+
• BML_DUPLICATE_COMPOSITION — more than one <composition> on the same aggregation member
|
|
49
|
+
• BML_UNEXPECTED_TEXT — non-whitespace text on an element-only grammar node
|
|
44
50
|
|
|
45
51
|
Map-time diagnostics attach Diagnostic.source to the use-site token when known
|
|
46
52
|
(attribute value or first occurrence in the throwing element), not the document root.
|
|
@@ -33,7 +33,10 @@
|
|
|
33
33
|
<documentation>Property/aggregation/association/capability members:
|
|
34
34
|
• Element QName = member identity (deprecated namespace= attr → error)
|
|
35
35
|
• type attribute → TypeExpression; value/memberValues for properties
|
|
36
|
-
•
|
|
36
|
+
• One <composition> per aggregation member, as a direct child of that member
|
|
37
|
+
(not of <block>, <aggregations>, or nested inside metadata). Extra copies →
|
|
38
|
+
BML_DUPLICATE_COMPOSITION. Misplaced → BML_STANDALONE_COMPOSITION.
|
|
39
|
+
Sugar without a <composition> wrapper (instances as direct children) stays allowed.
|
|
37
40
|
• Constraints/suggestions → BlockInstance[] in document order
|
|
38
41
|
• Sub-Blocks and embedded blocks → nested BlockDefinition trees
|
|
39
42
|
• Redundant aggregation type on override → validator warning B19; parser must not apply
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Parser Documentation — StructuralGrammar
|
|
3
|
+
FQN: org.blockml.bml.compiler.parser.documentation.StructuralGrammar
|
|
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:bomtype="org.blockml.bml.bom.type"
|
|
18
|
+
xmlns:core="org.blockml.bml.core"
|
|
19
|
+
xmlns:def="org.blockml.bml.definition"
|
|
20
|
+
xmlns:parser="org.blockml.bml.compiler.parser"
|
|
21
|
+
xmlns:parcap="org.blockml.bml.compiler.parser.capability"
|
|
22
|
+
xmlns:parconfig="org.blockml.bml.compiler.parser.config"
|
|
23
|
+
xmlns:pardocumentation="org.blockml.bml.compiler.parser.documentation"
|
|
24
|
+
xmlns:parmap="org.blockml.bml.compiler.parser.map"
|
|
25
|
+
xmlns:type="org.blockml.bml.type"
|
|
26
|
+
xmlns:doc="org.blockml.bml.documentation"
|
|
27
|
+
xmlns:valdocumentation="org.blockml.bml.compiler.validator.documentation">
|
|
28
|
+
|
|
29
|
+
<name>StructuralGrammar</name>
|
|
30
|
+
<type>pardocumentation:StructuralGrammar</type>
|
|
31
|
+
<baseType>core:Documentation</baseType>
|
|
32
|
+
<is>Closed root vocabulary and preserve-on-error for structural BML errors</is>
|
|
33
|
+
|
|
34
|
+
<documentation>A document is valid BlockML if it is well-formed XML, structurally conforms
|
|
35
|
+
to the BlockML definitions, and passes semantic validation against a complete registry.
|
|
36
|
+
XSD is not part of this definition.
|
|
37
|
+
|
|
38
|
+
Error classes: XML Syntax Error (malformed XML; document may be null);
|
|
39
|
+
Structural BML Error (unknown Gerüst tag/attribute/directive — this package);
|
|
40
|
+
Semantic BML Error (unknown type/member/library — @blockml/validator).
|
|
41
|
+
|
|
42
|
+
Root children are closed: only identity and container names from the effective
|
|
43
|
+
Block / document grammar (name, type, baseType, properties, aggregations, …).
|
|
44
|
+
Direct aggregations at root are not allowed. User content lives only inside
|
|
45
|
+
predefined containers and members.
|
|
46
|
+
|
|
47
|
+
Preserve-on-error: invalid authored constructs that can be represented are stored
|
|
48
|
+
as unknownElements / unknownAttributes residuals. Diagnostics MUST NOT require
|
|
49
|
+
destructive recovery. An error invalidates validity, not the whole BOM.
|
|
50
|
+
|
|
51
|
+
Definition/grammar nodes: unknown children/attributes → BML_UNKNOWN_ELEMENT /
|
|
52
|
+
BML_UNKNOWN_ATTRIBUTE. Unknown bml:* → BML_UNKNOWN_DIRECTIVE.
|
|
53
|
+
Non-whitespace text on element-only grammar nodes → BML_UNEXPECTED_TEXT.
|
|
54
|
+
Formatting whitespace is ignored (B13). Character-data hosts keep text
|
|
55
|
+
(name, is, documentation, value, property host text, …).
|
|
56
|
+
Block instances: extra attributes stay in memberValues for semantic checking.</documentation>
|
|
57
|
+
|
|
58
|
+
<references>
|
|
59
|
+
<see type="pardocumentation:AttributeClassification" relation="SeeAlso"></see>
|
|
60
|
+
<see type="valdocumentation:ValidityContract" relation="SeeAlso"></see>
|
|
61
|
+
</references>
|
|
62
|
+
|
|
63
|
+
</block>
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
<documentation>V1 (Phase A) parser implements:
|
|
34
34
|
• Hardcoded BML → BOM mapper for <block> root documents
|
|
35
35
|
• Single-file scope (B5) — no TypeRegistry bootstrap in parse()
|
|
36
|
-
• Stage 1
|
|
36
|
+
• Stage 1 structural BML validation (unknown Gerüst tags/attributes/directives); no TypeRegistry semantic checks (B8: XSD not Stage 1)
|
|
37
37
|
• JSON BML authoring not planned (B6)
|
|
38
38
|
• Tolerant parse by default (continueOnError: true)
|
|
39
39
|
|
|
@@ -53,6 +53,9 @@
|
|
|
53
53
|
<isEmbedded type="type:Boolean">
|
|
54
54
|
<documentation>isEmbedded. TS type: type:Boolean. (required)</documentation>
|
|
55
55
|
</isEmbedded>
|
|
56
|
+
<diagnostics type="bomcommon:Diagnostic[]">
|
|
57
|
+
<documentation>Shared map-time diagnostics; structural errors append here without aborting. (required)</documentation>
|
|
58
|
+
</diagnostics>
|
|
56
59
|
</properties>
|
|
57
60
|
|
|
58
61
|
</block>
|
package/dist/map/context.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Diagnostic } from "@blockml/bom";
|
|
1
2
|
export interface MapContext {
|
|
2
3
|
filePath: string;
|
|
3
4
|
source: string;
|
|
@@ -6,11 +7,13 @@ export interface MapContext {
|
|
|
6
7
|
parentBlockType?: string;
|
|
7
8
|
isRoot: boolean;
|
|
8
9
|
isEmbedded: boolean;
|
|
10
|
+
diagnostics: Diagnostic[];
|
|
9
11
|
}
|
|
10
12
|
export declare function createMapContext(filePath: string, source: string, bindings: Record<string, string>, options?: {
|
|
11
13
|
subBlockIndex?: Map<string, string>;
|
|
12
14
|
parentBlockType?: string;
|
|
13
15
|
isRoot?: boolean;
|
|
14
16
|
isEmbedded?: boolean;
|
|
17
|
+
diagnostics?: Diagnostic[];
|
|
15
18
|
}): MapContext;
|
|
16
19
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/map/context.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/map/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAChC,OAAO,GAAE;IACP,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;CACvB,GACL,UAAU,CAcZ"}
|
package/dist/map/context.js
CHANGED
|
@@ -6,6 +6,7 @@ export function createMapContext(filePath, source, bindings, options = {}) {
|
|
|
6
6
|
subBlockIndex: options.subBlockIndex ?? new Map(),
|
|
7
7
|
isRoot: options.isRoot ?? false,
|
|
8
8
|
isEmbedded: options.isEmbedded ?? false,
|
|
9
|
+
diagnostics: options.diagnostics ?? [],
|
|
9
10
|
};
|
|
10
11
|
if (options.parentBlockType !== undefined) {
|
|
11
12
|
ctx.parentBlockType = options.parentBlockType;
|
package/dist/map/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/map/context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/map/context.ts"],"names":[],"mappings":"AAaA,MAAM,UAAU,gBAAgB,CAC9B,QAAgB,EAChB,MAAc,EACd,QAAgC,EAChC,UAMI,EAAE;IAEN,MAAM,GAAG,GAAe;QACtB,QAAQ;QACR,MAAM;QACN,QAAQ;QACR,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,IAAI,GAAG,EAAE;QACjD,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,KAAK;QAC/B,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,KAAK;QACvC,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,EAAE;KACvC,CAAC;IACF,IAAI,OAAO,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;QAC1C,GAAG,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IAChD,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/map/directives.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { DirectiveAttribute, ExpressionValue } from "@blockml/bom";
|
|
2
2
|
import type { Element } from "@xmldom/xmldom";
|
|
3
3
|
import type { SourceLocation } from "@blockml/bom";
|
|
4
|
-
|
|
4
|
+
import type { MapContext } from "./context.js";
|
|
5
|
+
export declare function parseDirectives(element: Element, loc: SourceLocation, ctx?: MapContext): DirectiveAttribute[];
|
|
5
6
|
export declare function parseBmlMeta(element: Element, typeFqn: string, file: string, loc: SourceLocation): {
|
|
6
7
|
id: ExpressionValue | {
|
|
7
8
|
kind: "literal";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directives.d.ts","sourceRoot":"","sources":["../../src/map/directives.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAElB,eAAe,EAKhB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"directives.d.ts","sourceRoot":"","sources":["../../src/map/directives.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAElB,eAAe,EAKhB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAY/C,wBAAgB,eAAe,CAC7B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,cAAc,EACnB,GAAG,CAAC,EAAE,UAAU,GACf,kBAAkB,EAAE,CAgEtB;AAED,wBAAgB,YAAY,CAC1B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,cAAc;;;;;;;;;;;;;;;;;EAiBpB"}
|
package/dist/map/directives.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { expressionFromRaw } from "./member-value.js";
|
|
2
2
|
import { getAttribute } from "../util/xml.js";
|
|
3
|
+
import { collectUnknownBmlAttributes } from "./structural.js";
|
|
3
4
|
const BML_NS = "http://blockml.org/bml";
|
|
4
5
|
function bmlAttr(element, local) {
|
|
5
6
|
return (getAttribute(element, `bml:${local}`) ??
|
|
6
7
|
getAttribute(element, `${BML_NS}:${local}`));
|
|
7
8
|
}
|
|
8
|
-
export function parseDirectives(element, loc) {
|
|
9
|
+
export function parseDirectives(element, loc, ctx) {
|
|
9
10
|
const directives = [];
|
|
11
|
+
if (ctx) {
|
|
12
|
+
collectUnknownBmlAttributes(element, ctx);
|
|
13
|
+
}
|
|
10
14
|
const each = bmlAttr(element, "each");
|
|
11
15
|
if (each !== undefined) {
|
|
12
16
|
const colon = each.indexOf(":");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directives.js","sourceRoot":"","sources":["../../src/map/directives.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,MAAM,MAAM,GAAG,wBAAwB,CAAC;AAExC,SAAS,OAAO,CAAC,OAAgB,EAAE,KAAa;IAC9C,OAAO,CACL,YAAY,CAAC,OAAO,EAAE,OAAO,KAAK,EAAE,CAAC;QACrC,YAAY,CAAC,OAAO,EAAE,GAAG,MAAM,IAAI,KAAK,EAAE,CAAC,CAC5C,CAAC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C,CAAC,SAAS;QACf,IAAI,EACF,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;QAC3E,KAAK;KACN,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CACrB,GAAW,EACX,OAAe,EACf,IAAY,EACZ,GAAmB;IAEnB,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC9C,OAAO,iBAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACrC,CAAC;IACD,OAAO;QACL,IAAI,EAAE,SAAkB;QACxB,KAAK,EAAE,GAAG;QACV,OAAO;KACR,CAAC;AACJ,CAAC"}
|
package/dist/map/map-block.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { BlockDefinition } from "@blockml/bom";
|
|
1
|
+
import type { BlockDefinition, Diagnostic } from "@blockml/bom";
|
|
2
2
|
import type { Element } from "@xmldom/xmldom";
|
|
3
3
|
import { type MapContext } from "./context.js";
|
|
4
4
|
export declare function mapBlock(element: Element, ctx: MapContext): BlockDefinition;
|
|
5
|
-
export declare function mapDocumentBlock(element: Element, filePath: string, source: string, bindings: Record<string, string
|
|
5
|
+
export declare function mapDocumentBlock(element: Element, filePath: string, source: string, bindings: Record<string, string>, diagnostics?: Diagnostic[]): BlockDefinition;
|
|
6
6
|
//# sourceMappingURL=map-block.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-block.d.ts","sourceRoot":"","sources":["../../src/map/map-block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,eAAe,
|
|
1
|
+
{"version":3,"file":"map-block.d.ts","sourceRoot":"","sources":["../../src/map/map-block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,eAAe,EAKf,UAAU,EAiBX,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAgkCjE,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,GAAG,eAAe,CAE3E;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAChC,WAAW,GAAE,UAAU,EAAO,GAC7B,eAAe,CAGjB"}
|