+33
@@ -0,0 +1,33 @@
|
||||
/******************************************************************************
|
||||
* Copyright 2022 TypeFox GmbH
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the MIT License, which is available in the project root.
|
||||
******************************************************************************/
|
||||
import type { LangiumDocument } from '../../workspace/documents.js';
|
||||
import type { Action, Grammar, Interface, ParserRule, Type } from '../../languages/generated/ast.js';
|
||||
import type { Property, TypeOption } from '../type-system/type-collector/types.js';
|
||||
/**
|
||||
* A Langium document holds the parse result (AST and CST) and any additional state that is derived
|
||||
* from the AST, e.g. the result of scope precomputation.
|
||||
*/
|
||||
export interface LangiumGrammarDocument extends LangiumDocument<Grammar> {
|
||||
validationResources?: ValidationResources;
|
||||
}
|
||||
export type ValidationResources = {
|
||||
typeToValidationInfo: TypeToValidationInfo;
|
||||
typeToSuperProperties: Map<string, Property[]>;
|
||||
};
|
||||
export type TypeToValidationInfo = Map<string, InferredInfo | DeclaredInfo | InferredInfo & DeclaredInfo>;
|
||||
export type InferredInfo = {
|
||||
inferred: TypeOption;
|
||||
inferredNodes: ReadonlyArray<ParserRule | Action>;
|
||||
};
|
||||
export type DeclaredInfo = {
|
||||
declared: TypeOption;
|
||||
declaredNode: Type | Interface;
|
||||
};
|
||||
export declare function isDeclared(type: InferredInfo | DeclaredInfo | InferredInfo & DeclaredInfo): type is DeclaredInfo;
|
||||
export declare function isInferred(type: InferredInfo | DeclaredInfo | InferredInfo & DeclaredInfo): type is InferredInfo;
|
||||
export declare function isInferredAndDeclared(type: InferredInfo | DeclaredInfo | InferredInfo & DeclaredInfo): type is InferredInfo & DeclaredInfo;
|
||||
export declare function getTypeOption(info: InferredInfo | DeclaredInfo): TypeOption;
|
||||
//# sourceMappingURL=documents.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../../src/grammar/workspace/documents.ts"],"names":[],"mappings":"AAAA;;;;gFAIgF;AAEhF,OAAO,KAAK,EAAE,eAAe,EAAE,MA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AU,CAE3E"}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/******************************************************************************
|
||||
* Copyright 2022 TypeFox GmbH
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the MIT License, which is available in the project root.
|
||||
******************************************************************************/
|
||||
export function isDeclared(type) {
|
||||
return type && 'declared' in type;
|
||||
}
|
||||
export function isInferred(type) {
|
||||
return type && 'inferred' in type;
|
||||
}
|
||||
export function isInferredAndDeclared(type) {
|
||||
return type && 'inferred' in type && 'declared' in type;
|
||||
}
|
||||
export function getTypeOption(info) {
|
||||
return isDeclared(info) ? info.declared : info.inferred;
|
||||
}
|
||||
//# sourceMappingURL=documents.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"documents.js","sourceRoot":"","sources":["../../../src/grammar/workspace/documents.ts"],"names":[],"mappings":"AAAA;;;;gFAIgF;AA+BhF,MAAM,UAAU,UAAU,CAAC,IAA+D;IACtF,OAAO,IAAI,IAAI,UAAU,IAAI,IAAI,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAA+D;IACtF,OAAO,IAAI,IAAI,UAAU,IAAI,IAAI,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,IAA+D;IACjG,OAAO,IAAI,IAAI,UAAU,IAAI,IAAI,IAAI,UAAU,IAAI,IAAI,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAiC;IAC3D,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;AAC5D,CAAC"}
|
||||
Reference in New Issue
Block a user