@lionweb/validation 0.6.1-beta.0 → 0.6.1-beta.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/dist/diff/LionWebJsonDiff.d.ts.map +1 -1
- package/dist/diff/LionWebJsonDiff.js +18 -23
- package/dist/diff/LionWebJsonDiff.js.map +1 -1
- package/dist/diff/changes/ContainmentChange.d.ts +2 -2
- package/dist/diff/changes/ContainmentChange.d.ts.map +1 -1
- package/dist/diff/changes/ContainmentChange.js.map +1 -1
- package/dist/diff/changes/ReferenceChange.d.ts +3 -3
- package/dist/diff/changes/ReferenceChange.d.ts.map +1 -1
- package/dist/diff/changes/ReferenceChange.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/issues/LanguageIssues.d.ts +37 -13
- package/dist/issues/LanguageIssues.d.ts.map +1 -1
- package/dist/issues/LanguageIssues.js +49 -13
- package/dist/issues/LanguageIssues.js.map +1 -1
- package/dist/issues/ReferenceIssues.d.ts +6 -6
- package/dist/issues/ReferenceIssues.d.ts.map +1 -1
- package/dist/issues/ReferenceIssues.js +6 -6
- package/dist/issues/ReferenceIssues.js.map +1 -1
- package/dist/issues/SyntaxIssues.d.ts +9 -9
- package/dist/issues/SyntaxIssues.d.ts.map +1 -1
- package/dist/issues/SyntaxIssues.js +9 -9
- package/dist/issues/SyntaxIssues.js.map +1 -1
- package/dist/issues/ValidationIssue.d.ts +7 -1
- package/dist/issues/ValidationIssue.d.ts.map +1 -1
- package/dist/issues/ValidationIssue.js +9 -1
- package/dist/issues/ValidationIssue.js.map +1 -1
- package/dist/json/LionWebJson.d.ts +1 -14
- package/dist/json/LionWebJson.d.ts.map +1 -1
- package/dist/json/LionWebJson.js +4 -14
- package/dist/json/LionWebJson.js.map +1 -1
- package/dist/json/LionWebJsonChunkWrapper.d.ts +20 -8
- package/dist/json/LionWebJsonChunkWrapper.d.ts.map +1 -1
- package/dist/json/LionWebJsonChunkWrapper.js +50 -22
- package/dist/json/LionWebJsonChunkWrapper.js.map +1 -1
- package/dist/json/M3definitions.d.ts +176 -0
- package/dist/json/M3definitions.d.ts.map +1 -0
- package/dist/json/M3definitions.js +174 -0
- package/dist/json/M3definitions.js.map +1 -0
- package/dist/json/NodeUtils.d.ts +3 -9
- package/dist/json/NodeUtils.d.ts.map +1 -1
- package/dist/json/NodeUtils.js +18 -31
- package/dist/json/NodeUtils.js.map +1 -1
- package/dist/json/index.d.ts +1 -2
- package/dist/json/index.d.ts.map +1 -1
- package/dist/json/index.js +1 -2
- package/dist/json/index.js.map +1 -1
- package/dist/languages/CompositeLionWebLanguageWrapper.d.ts +24 -0
- package/dist/languages/CompositeLionWebLanguageWrapper.d.ts.map +1 -0
- package/dist/languages/CompositeLionWebLanguageWrapper.js +56 -0
- package/dist/languages/CompositeLionWebLanguageWrapper.js.map +1 -0
- package/dist/languages/LanguageRegistry.d.ts +19 -0
- package/dist/languages/LanguageRegistry.d.ts.map +1 -0
- package/dist/languages/LanguageRegistry.js +37 -0
- package/dist/languages/LanguageRegistry.js.map +1 -0
- package/dist/languages/LanguageUtils.d.ts +35 -0
- package/dist/languages/LanguageUtils.d.ts.map +1 -0
- package/dist/languages/LanguageUtils.js +52 -0
- package/dist/languages/LanguageUtils.js.map +1 -0
- package/dist/languages/LionCore-M3.json +2356 -0
- package/{src/json/std-builtins-copy.json → dist/languages/LionCore-builtins.json} +57 -52
- package/dist/languages/LionWebLanguageWrapper.d.ts +31 -0
- package/dist/languages/LionWebLanguageWrapper.d.ts.map +1 -0
- package/dist/languages/LionWebLanguageWrapper.js +69 -0
- package/dist/languages/LionWebLanguageWrapper.js.map +1 -0
- package/dist/languages/MetaPointerMap.d.ts +11 -0
- package/dist/languages/MetaPointerMap.d.ts.map +1 -0
- package/dist/languages/MetaPointerMap.js +39 -0
- package/dist/languages/MetaPointerMap.js.map +1 -0
- package/dist/languages/index.d.ts +3 -0
- package/dist/languages/index.d.ts.map +1 -0
- package/dist/languages/index.js +3 -0
- package/dist/languages/index.js.map +1 -0
- package/dist/runners/FileUtils.d.ts +4 -4
- package/dist/runners/FileUtils.d.ts.map +1 -1
- package/dist/runners/FileUtils.js +8 -32
- package/dist/runners/FileUtils.js.map +1 -1
- package/dist/runners/RunCheckFolder.js +3 -1
- package/dist/runners/RunCheckFolder.js.map +1 -1
- package/dist/runners/RunCheckFolderWithLanguage.js +7 -3
- package/dist/runners/RunCheckFolderWithLanguage.js.map +1 -1
- package/dist/runners/RunCheckOneFile.js +3 -1
- package/dist/runners/RunCheckOneFile.js.map +1 -1
- package/dist/runners/RunCheckOneFileWithLanguage.js +12 -3
- package/dist/runners/RunCheckOneFileWithLanguage.js.map +1 -1
- package/dist/runners/Utils.d.ts.map +1 -1
- package/dist/runners/Utils.js +0 -1
- package/dist/runners/Utils.js.map +1 -1
- package/dist/util/graphs.d.ts +18 -0
- package/dist/util/graphs.d.ts.map +1 -0
- package/dist/util/graphs.js +27 -0
- package/dist/util/graphs.js.map +1 -0
- package/dist/validators/LionWebLanguageReferenceValidator.d.ts +5 -4
- package/dist/validators/LionWebLanguageReferenceValidator.d.ts.map +1 -1
- package/dist/validators/LionWebLanguageReferenceValidator.js +96 -34
- package/dist/validators/LionWebLanguageReferenceValidator.js.map +1 -1
- package/dist/validators/LionWebLanguageValidator.d.ts +15 -3
- package/dist/validators/LionWebLanguageValidator.d.ts.map +1 -1
- package/dist/validators/LionWebLanguageValidator.js +54 -21
- package/dist/validators/LionWebLanguageValidator.js.map +1 -1
- package/dist/validators/LionWebReferenceValidator.d.ts.map +1 -1
- package/dist/validators/LionWebReferenceValidator.js +0 -5
- package/dist/validators/LionWebReferenceValidator.js.map +1 -1
- package/dist/validators/LionWebSyntaxValidator.d.ts +1 -1
- package/dist/validators/LionWebSyntaxValidator.js +1 -1
- package/dist/validators/LionWebValidator.d.ts +3 -3
- package/dist/validators/LionWebValidator.d.ts.map +1 -1
- package/dist/validators/LionWebValidator.js +5 -8
- package/dist/validators/LionWebValidator.js.map +1 -1
- package/package.json +5 -5
- package/src/diff/LionWebJsonDiff.ts +18 -23
- package/src/diff/changes/ContainmentChange.ts +1 -1
- package/src/diff/changes/ReferenceChange.ts +2 -2
- package/src/index.ts +2 -0
- package/src/issues/LanguageIssues.ts +49 -14
- package/src/issues/ReferenceIssues.ts +6 -6
- package/src/issues/SyntaxIssues.ts +9 -9
- package/src/issues/ValidationIssue.ts +12 -2
- package/src/json/LionCore_M3.json +2320 -0
- package/src/json/LionCore_builtins.json +231 -0
- package/src/json/LionWebJson.ts +5 -14
- package/src/json/LionWebJsonChunkWrapper.ts +59 -30
- package/src/json/M3definitions.ts +177 -0
- package/src/json/NodeUtils.ts +21 -39
- package/src/json/index.ts +1 -2
- package/src/languages/CompositeLionWebLanguageWrapper.ts +57 -0
- package/src/languages/LanguageRegistry.ts +44 -0
- package/src/languages/LanguageUtils.ts +61 -0
- package/src/languages/LionCore-M3.json +2356 -0
- package/src/languages/LionCore-builtins.json +372 -0
- package/src/languages/LionWebLanguageWrapper.ts +95 -0
- package/src/languages/MetaPointerMap.ts +40 -0
- package/src/languages/index.ts +2 -0
- package/src/runners/FileUtils.ts +9 -36
- package/src/runners/RunCheckFolder.ts +3 -1
- package/src/runners/RunCheckFolderWithLanguage.ts +7 -7
- package/src/runners/RunCheckOneFile.ts +3 -1
- package/src/runners/RunCheckOneFileWithLanguage.ts +12 -7
- package/src/runners/Utils.ts +0 -1
- package/src/tmp.json +574 -0
- package/src/tryout.js +21 -0
- package/src/util/graphs.ts +36 -0
- package/src/validators/LionWebLanguageReferenceValidator.ts +110 -48
- package/src/validators/LionWebLanguageValidator.ts +62 -21
- package/src/validators/LionWebReferenceValidator.ts +0 -5
- package/src/validators/LionWebSyntaxValidator.ts +2 -2
- package/src/validators/LionWebValidator.ts +5 -9
- package/structure.puml +25 -0
- package/dist/json/LanguageUtils.d.ts +0 -9
- package/dist/json/LanguageUtils.d.ts.map +0 -1
- package/dist/json/LanguageUtils.js +0 -30
- package/dist/json/LanguageUtils.js.map +0 -1
- package/dist/json/LionWebLanguageDefinition.d.ts +0 -48
- package/dist/json/LionWebLanguageDefinition.d.ts.map +0 -1
- package/dist/json/LionWebLanguageDefinition.js +0 -126
- package/dist/json/LionWebLanguageDefinition.js.map +0 -1
- package/src/json/LanguageUtils.ts +0 -52
- package/src/json/LionWebLanguageDefinition.ts +0 -144
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { LionWebId, LionWebJsonMetaPointer, LionWebJsonNode } from "../json/LionWebJson.js"
|
|
2
|
+
import { LionWebLanguageWrapper } from "./LionWebLanguageWrapper.js"
|
|
3
|
+
import { MetaPointerMap } from "./MetaPointerMap.js"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Collection of language definitions
|
|
7
|
+
*/
|
|
8
|
+
export class CompositeLionWebLanguageWrapper extends LionWebLanguageWrapper {
|
|
9
|
+
metaPointerMap: MetaPointerMap = new MetaPointerMap()
|
|
10
|
+
languageMap = new Map<string, Map<string, LionWebLanguageWrapper>>()
|
|
11
|
+
languages: LionWebLanguageWrapper[] = []
|
|
12
|
+
|
|
13
|
+
addLanguage(lionWebLanguage: LionWebLanguageWrapper) {
|
|
14
|
+
let language = this.languageMap.get(lionWebLanguage.key)
|
|
15
|
+
if (language === undefined) {
|
|
16
|
+
language = new Map<string, LionWebLanguageWrapper>()
|
|
17
|
+
this.languageMap.set(lionWebLanguage.key, language)
|
|
18
|
+
}
|
|
19
|
+
const version = language.get(lionWebLanguage.version)
|
|
20
|
+
if (version === undefined) {
|
|
21
|
+
language.set(lionWebLanguage.version, lionWebLanguage)
|
|
22
|
+
} else {
|
|
23
|
+
// console.error("Language already known")
|
|
24
|
+
return
|
|
25
|
+
}
|
|
26
|
+
this.languages.push(lionWebLanguage)
|
|
27
|
+
lionWebLanguage.jsonChunk.nodes.forEach(node => {
|
|
28
|
+
this.metaPointerMap.add(lionWebLanguage.key, lionWebLanguage.version, node)
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
getLanguage(pointer: LionWebJsonMetaPointer): LionWebLanguageWrapper | undefined {
|
|
33
|
+
return this.languageMap.get(pointer.language)?.get(pointer.version)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Gets the node with _metaPointer_ in any of the known languages
|
|
38
|
+
* @param metaPointer
|
|
39
|
+
*/
|
|
40
|
+
getNodeByMetaPointer(metaPointer: LionWebJsonMetaPointer): LionWebJsonNode | undefined {
|
|
41
|
+
return this.metaPointerMap.get(metaPointer)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Get node in any of the languages.
|
|
46
|
+
* @param nodeId
|
|
47
|
+
*/
|
|
48
|
+
getNode(nodeId: LionWebId) {
|
|
49
|
+
for (const chunk of this.languages) {
|
|
50
|
+
const node = chunk.getNode(nodeId)
|
|
51
|
+
if (node !== undefined) {
|
|
52
|
+
return node
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return undefined
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { LionWebId, LionWebJsonMetaPointer, LionWebJsonNode } from "../json/LionWebJson.js"
|
|
2
|
+
import { CompositeLionWebLanguageWrapper } from "./CompositeLionWebLanguageWrapper.js"
|
|
3
|
+
import { LionWebLanguageWrapper } from "./LionWebLanguageWrapper.js"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Collection of language definitions
|
|
7
|
+
*/
|
|
8
|
+
export class LanguageRegistry {
|
|
9
|
+
languages: CompositeLionWebLanguageWrapper = new CompositeLionWebLanguageWrapper({nodes: [], languages: [], serializationFormatVersion: "2023.1"})
|
|
10
|
+
|
|
11
|
+
addLanguage(lionWebLanguage: LionWebLanguageWrapper) {
|
|
12
|
+
// console.log("LanguageRegistry.add: " + lionWebLanguage.name + " " + lionWebLanguage.jsonChunk.nodes.length)
|
|
13
|
+
|
|
14
|
+
this.languages.addLanguage(lionWebLanguage)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
clear(): void {
|
|
18
|
+
this.languages = new CompositeLionWebLanguageWrapper({nodes: [], languages: [], serializationFormatVersion: "2023.1"})
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
getLanguage(pointer: LionWebJsonMetaPointer): LionWebLanguageWrapper | undefined {
|
|
22
|
+
return this.languages.languageMap.get(pointer.language)?.get(pointer.version)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Gets the node with _metaPointer_ in any of the known languages
|
|
27
|
+
* @param metaPointer
|
|
28
|
+
*/
|
|
29
|
+
getNodeByMetaPointer(metaPointer: LionWebJsonMetaPointer): LionWebJsonNode | undefined {
|
|
30
|
+
return this.languages.getNodeByMetaPointer(metaPointer)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
findNode(nodeId: LionWebId) {
|
|
34
|
+
for (const chunk of this.languages.languages) {
|
|
35
|
+
const node = chunk.getNode(nodeId)
|
|
36
|
+
if (node !== undefined) {
|
|
37
|
+
return node
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return undefined
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// export const KnownLanguages = new LanguageRegistry()
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { isEqualMetaPointer, LionWebJsonNode, LionWebJsonChunk } from "../json/LionWebJson.js"
|
|
2
|
+
|
|
3
|
+
import { LION_CORE_M3_KEY, MetaPointers } from "../json/M3definitions.js"
|
|
4
|
+
|
|
5
|
+
import LionCore_M3 from "./LionCore-M3.json" assert { type: "json" }
|
|
6
|
+
import LionCore_builtins from "./LionCore-builtins.json" assert { type: "json" }
|
|
7
|
+
|
|
8
|
+
export const LionCore_M3_Json = LionCore_M3 as LionWebJsonChunk
|
|
9
|
+
export const LionCore_builtins_Json = LionCore_builtins as LionWebJsonChunk
|
|
10
|
+
|
|
11
|
+
export function isLionCoreLanguage(node: LionWebJsonNode) {
|
|
12
|
+
return node.classifier.language === LION_CORE_M3_KEY && node.classifier.version === "2023.1"
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Does _node_ represent a language concept?
|
|
17
|
+
* @param node
|
|
18
|
+
*/
|
|
19
|
+
export const isConcept = (node: LionWebJsonNode): boolean => {
|
|
20
|
+
return isEqualMetaPointer(node.classifier, MetaPointers.Concept)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Does _node_ represent a language annotation?
|
|
25
|
+
* @param node
|
|
26
|
+
*/
|
|
27
|
+
export const isAnnotation = (node: LionWebJsonNode): boolean => {
|
|
28
|
+
return isEqualMetaPointer(node.classifier, MetaPointers.Annotation)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Does _node_ represent a language interface?
|
|
33
|
+
* @param node
|
|
34
|
+
*/
|
|
35
|
+
export const isInterface = (node: LionWebJsonNode): boolean => {
|
|
36
|
+
return isEqualMetaPointer(node.classifier, MetaPointers.Interface)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Does _node_ represent a language property?
|
|
41
|
+
* @param node
|
|
42
|
+
*/
|
|
43
|
+
export const isProperty = (node: LionWebJsonNode): boolean => {
|
|
44
|
+
return isEqualMetaPointer(node.classifier, MetaPointers.Property)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Does _node_ represent a language containment?
|
|
49
|
+
* @param node
|
|
50
|
+
*/
|
|
51
|
+
export const isContainment = (node: LionWebJsonNode): boolean => {
|
|
52
|
+
return isEqualMetaPointer(node.classifier, MetaPointers.Containment)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Does _node_ represent a language reference?
|
|
57
|
+
* @param node
|
|
58
|
+
*/
|
|
59
|
+
export const isReference = (node: LionWebJsonNode): boolean => {
|
|
60
|
+
return isEqualMetaPointer(node.classifier, MetaPointers.Reference)
|
|
61
|
+
}
|