Skip to content

rune-langium / core/src

core/src ​

Parse .rosetta source into typed ASTs, build cross-file workspaces, and serialize models back to source text.

Remarks ​

Use parse() for a single self-contained document, parseWorkspace() when files reference each other, and createRuneDslServices() when you need raw Langium services for custom tooling. The serializer exports are best for AST-driven workflows, tests, and code transformations that do not need to preserve original formatting.

Core ​

NameDescription
RuneDslParserCustom Langium parser for the Rune DSL that normalizes lexer input to insert implicit [ and ] brackets around bare expressions after extract, filter, and reduce operators.
ExpressionParseResultResult of parsing a bare Rune DSL expression snippet.
ParseResultResult of parsing a Rosetta DSL source string.
RuneDslServicesUnion type for all services available in the Rune DSL language.
RuneDslModuleDependency-injection module for the Rune DSL language.
RuneDslSharedModuleShared services module that overrides Langium's default IndexManager with RuneDslIndexManager, enabling external registration of exported symbols without requiring a full document build (ADR 007 Phase 4).
createRuneDslParserFactory function that creates and fully initializes a RuneDslParser.
createRuneDslServicesCreate the full set of services required for the Rune DSL language.
insertImplicitBracketsScans Rune DSL source text and inserts [ and ] around bare expressions that follow extract, filter, or reduce operators.
parseParse a Rosetta DSL source string into a typed AST.
parseExpressionSynchronously parse a bare Rune DSL expression snippet (e.g. a Condition, Operation, or ShortcutDeclaration body) into a typed RosettaExpression.
parseWorkspaceParse multiple Rosetta DSL source strings as a workspace. Cross-references between documents will be resolved after all documents are built.

Other ​

NameDescription
Annotation-
AnnotationDeepPath-
AnnotationPath-
AnnotationPathAttributeReference-
AnnotationQualifier-
AnnotationRef-
AsOperation-
Attribute-
Choice-
ChoiceOption-
Condition-
ConstructorKeyValuePair-
Data-
FilterOperation-
InlineFunction-
MapOperation-
MaxOperation-
MinOperation-
Operation-
ReduceOperation-
RegulatoryDocumentReference-
RosettaAttributeReference-
RosettaBasicType-
RosettaClassSynonym-
RosettaConstructorExpression-
RosettaCorpus-
RosettaDataReference-
RosettaDeepFeatureCall-
RosettaDocReference-
RosettaEnumeration-
RosettaEnumValue-
RosettaEnumValueReference-
RosettaExternalClass-
RosettaExternalClassSynonym-
RosettaExternalEnum-
RosettaExternalEnumValue-
RosettaExternalFunction-
RosettaExternalRegularAttribute-
RosettaExternalRuleSource-
RosettaExternalSynonym-
RosettaFeatureCall-
RosettaFunction-
RosettaMapPath-
RosettaMapping-
RosettaMappingInstance-
RosettaMapRosettaPath-
RosettaMapTestAbsentExpression-
RosettaMapTestEqualityOperation-
RosettaMapTestExistsExpression-
RosettaMapTestFunc-
RosettaMetaType-
RosettaModel-
RosettaParameter-
RosettaQualifiableConfiguration-
RosettaRecordFeature-
RosettaRecordType-
RosettaReport-
RosettaRule-
RosettaSegmentRef-
RosettaSymbolReference-
RosettaSynonym-
RosettaSynonymBody-
RosettaSynonymSource-
RosettaTypeAlias-
RuleReferenceAnnotation-
Schema-
Segment-
SortOperation-
SwitchCaseGuard-
SwitchCaseOrDefault-
SwitchOperation-
ThenOperation-
ToEnumOperation-
TypeCall-
TypeCallArgument-
TypeParameter-
WithMetaEntry-
WithMetaOperation-
DuplicateKeyError-
RuneDslAstReflection-
RuneDslIndexManagerExtended IndexManager that supports external registration of exported symbols without requiring a full document build. Used for deferred deserialization of curated model artifacts (ADR 007 Phase 4).
RuneDslLinkerLangium linker that lazily materializes corpus documents stored in a DeferredModelProvider the first time a cross-reference to them is resolved.
RuneDslScopeProviderCustom scope provider for the Rune DSL.
RuneDslValidatorCustom validator for the Rune DSL.
RuneStoreHydratorHydrator variant for the Rune store substrate.
AnnotationDefinitionIdentity-
ArithmeticOperation-
AsKeyOperation-
ChoiceOperation-
ClosureParameter-
ComparisonOperation-
DeclarationRedirects-
DefaultOperation-
DeferredModelProviderContract for on-demand corpus document materialization (ADR 007).
DistinctOperation-
DocumentRationale-
DomainRepository-
EqualityOperation-
ExpressionScopeEntry-
FirstOperation-
FlattenOperation-
HydrateOptions-
HydrateServices-
Import-
ImportScope-
JoinOperation-
LabelAnnotation-
LastOperation-
ListLiteral-
LogicalOperation-
LspModelUpdateIncremental semantic documents followed by the complete current URI set.
OneOfOperation-
Repository-
ReverseOperation-
RosettaAbsentExpression-
RosettaBody-
RosettaBooleanLiteral-
RosettaCardinality-
RosettaConditionalExpression-
RosettaContainsExpression-
RosettaCountOperation-
RosettaDisjointExpression-
RosettaEnumSynonym-
RosettaExistsExpression-
RosettaImplicitVariable-
RosettaIntLiteral-
RosettaMapPathValue-
RosettaMappingPathTests-
RosettaMergeSynonymValue-
RosettaNumberLiteral-
RosettaOnlyElement-
RosettaOnlyExistsExpression-
RosettaScope-
RosettaSegment-
RosettaStringLiteral-
RosettaSuperCall-
RosettaSynonymValueBase-
ShortcutDeclaration-
SourceComment-
SumOperation-
ToDateOperation-
ToDateTimeOperation-
ToIntOperation-
ToNumberOperation-
ToStringOperation-
ToTimeOperation-
ToZonedDateTimeOperation-
Annotation-
AnnotationArgument-
AnnotationDeepPath-
AnnotationPath-
AnnotationPathAttributeReference-
AnnotationPathExpression-
AnnotationQualifier-
AnnotationRef-
AnyDomain-
AsOperation-
AssignPathRoot-
Attribute-
AttributeOrChoiceOption-
BigDecimal-
CardinalityModifier-
Choice-
ChoiceOption-
Condition-
ConstructorKeyValuePair-
Data-
DataOrChoice-
DeclarationIdentity-
DehydratedLossless editable wire model for a Langium AST node.
ExistsModifier-
ExpressionRegion-
ExternalValueOperator-
FilterOperation-
InlineFunction-
Integer-
IntrinsicTypeNameOperator-defined types have an identity even without a declaration reference.
MapOperation-
MaxOperation-
MinOperation-
NamespaceImportFile-local namespace imports, without runtime AST linkage.
Necessity-
Operation-
ProjectResolutionContext-
ProjectResolutionReceipt-
QualifiedName-
QualifiedNameWithWildcard-
ReduceOperation-
RegulatoryDocumentReference-
RepositoryExampleSource-
RepositoryFileSource-
RosettaAttributeReference-
RosettaBasicType-
RosettaCallableWithArgs-
RosettaClassSynonym-
RosettaConstructorExpression-
RosettaCorpus-
RosettaDataReference-
RosettaDeepFeatureCall-
RosettaDocReference-
RosettaEnumeration-
RosettaEnumValue-
RosettaEnumValueReference-
RosettaExpression-
RosettaExternalClass-
RosettaExternalClassSynonym-
RosettaExternalEnum-
RosettaExternalEnumValue-
RosettaExternalFunction-
RosettaExternalRegularAttribute-
RosettaExternalRuleSource-
RosettaExternalSynonym-
RosettaFeature-
RosettaFeatureCall-
RosettaFunction-
RosettaLiteral-
RosettaMapPath-
RosettaMapping-
RosettaMappingInstance-
RosettaMapRosettaPath-
RosettaMapTest-
RosettaMapTestAbsentExpression-
RosettaMapTestEqualityOperation-
RosettaMapTestExistsExpression-
RosettaMapTestExpression-
RosettaMapTestFunc-
RosettaMetaType-
RosettaModel-
RosettaParameter-
RosettaQualifiableConfiguration-
RosettaQualifiableType-
RosettaRecordFeature-
RosettaRecordType-
RosettaReport-
RosettaRootElement-
RosettaRule-
RosettaSegmentRef-
RosettaSymbol-
RosettaSymbolReference-
RosettaSynonym-
RosettaSynonymBody-
RosettaSynonymRef-
RosettaSynonymSource-
RosettaType-
RosettaTypeAlias-
RosettaTypedFeature-
RuleReferenceAnnotation-
RuneDslAstType-
RuneDslKeywordNames-
RuneDslTerminalNames-
RuneDslTokenNames-
Schema-
SchemaOrFormat-
Segment-
SortOperation-
SourceRegion-
SwitchCaseGuard-
SwitchCaseOrDefault-
SwitchCaseTarget-
SwitchOperation-
ThenOperation-
ToEnumOperation-
TypeCall-
TypeCallArgument-
TypeParameter-
TypeParameterValidID-
ValidID-
WithMetaEntry-
WithMetaOperation-
AnnotationArgument-
AnnotationPathExpression-
ANNOTATIONS_ROSETTA-
ArithmeticOperation-
AsKeyOperation-
AssignPathRoot-
AttributeOrChoiceOption-
BASE_TYPE_FILESSystem file descriptors for base types.
BASICTYPES_ROSETTABuilt-in Rune DSL base type definitions.
ChoiceOperation-
ClosureParameter-
CODE_LIST_ENUM_NAMESPACEPortable synonym source used by materialized resource enums. Ordinary enum synonyms remain mappings only.
CODE_LIST_ENUM_SOURCE-
ComparisonOperation-
curatedAdapter-
DataOrChoice-
DeclarationIdentitySchema-
DefaultOperation-
DistinctOperation-
DocumentRationale-
EqualityOperation-
FirstOperation-
FlattenOperation-
Import-
JoinOperation-
LabelAnnotation-
LastOperation-
ListLiteral-
LogicalOperation-
LSP_MODEL_SYNC_METHOD-
LSP_REQUEST_TIMEOUT_MSRequest budget includes reconstruction of dependency models after cold wake.
OneOfOperation-
parsedAdapter-
ProjectResolutionContextSchemaSent with a complete retained document set, after its semantic snapshots have arrived.
ProjectResolutionReceiptSchema-
reflection-
RepositoryExampleSourceSchema-
RepositoryFileSourceSchemaVerified upstream file origin; Nightly commits record provenance, never a reference lock.
ReverseOperation-
RosettaAbsentExpression-
RosettaBody-
RosettaBooleanLiteral-
RosettaCallableWithArgs-
RosettaCardinality-
RosettaConditionalExpression-
RosettaContainsExpression-
RosettaCountOperation-
RosettaDisjointExpression-
RosettaEnumSynonym-
RosettaExistsExpression-
RosettaExpression-
RosettaFeature-
RosettaImplicitVariable-
RosettaIntLiteral-
RosettaLiteral-
RosettaMapPathValue-
RosettaMappingPathTests-
RosettaMapTest-
RosettaMapTestExpression-
RosettaMergeSynonymValue-
RosettaNumberLiteral-
RosettaOnlyElement-
RosettaOnlyExistsExpression-
RosettaRootElement-
RosettaScope-
RosettaSegment-
RosettaStringLiteral-
RosettaSuperCall-
RosettaSymbol-
RosettaSynonymValueBase-
RosettaType-
RosettaTypedFeature-
RUNE_SERIALIZE_OPTIONSThe Langium serialize option triple for the canonical Rune wire form.
RuneDslGeneratedModule-
RuneDslGeneratedSharedModule-
RuneDslLanguageMetaData-
RuneDslTerminals-
SchemaOrFormat-
ShortcutDeclaration-
SumOperation-
SwitchCaseTarget-
ToDateOperation-
ToDateTimeOperation-
ToIntOperation-
ToNumberOperation-
ToStringOperation-
ToTimeOperation-
ToZonedDateTimeOperation-
addLegacyAnnotationsAdd missing legacy declarations to the runtime annotation document before linking.
assertValidDocumentsPublication requires syntax-correct documents with every reference linked.
buildImportAliasMapOne alias may intentionally contribute several namespace prefixes.
buildImportScopeFile-local scope facts shared by language lookup and projected references.
callableOverrideSignaturesMatch-
canonicalProjectJsonStable project/export identity without object insertion-order differences.
choiceOptionFieldName-
clearProjectResolution-
closeNamespaceDependenciesCompute the transitive closure of a single source namespace through the dep map produced by collectNamespaceDependencies. Returns the set of namespaces that must be included if source is selected (includes source itself).
collectNamespaceDependenciesWalk every parsed document and return a per-namespace dependency map: Map<sourceNamespace, Set<targetNamespace>>. A key S lists every namespace T ≠ S that some type in S directly references.
compactLspModelJsonKeep semantic AST data and declaration ranges, without dependency token spans.
createDomainRepository-
createRepository-
declarationDispatchSelector text is stable before linking; resolving it here would recursively enter scope construction.
declarationKeyPortable identity key; config and parser hosts share this exact representation.
deserializeRuneModelDeserialize a serialized Rune AST JSON string back to a RosettaModel.
expandNamespaceWildcardExpand an exact name or dotted-prefix wildcard against known namespaces.
findExpressionOwnerResolve declaration identity, using the unique base for a function dispatch group.
fromIndexDerive the value array from an id→item Map (insertion order).
getAnnotationDefinitionsScope facts from the actual linked references, without rebuilding import/name resolution.
getChoiceOptionPathsDeclared option paths, including nested choices; data fields are not choice arms.
getEffectiveConditionsGet conditions that are defined on the Data types within a Choice's options. Since Choice options reference type calls, we return the conditions from the parent Choice's enclosing Data types (if any).
getEffectiveProjectDeclarationAll consumers select through the same generation-local declaration targets as core linking.
getElementNamespaceReturn the dot-separated namespace string for an element whose direct $container is a RosettaModel. Returns undefined when the element isn't a top-level model child — which is what every typeRef target is (Data, Choice, RosettaTypeAlias, RosettaEnumeration, RosettaFunction all live as direct children of RosettaModel via model.elements).
getEnumValueLiteralThe member identifier and the external code are distinct; displayName is presentation only.
getEnumValuesEffective enum members, with child declarations overriding inherited names.
getExpressionOwnersUnique owners across files, grouped by namespace, declaration name and kind.
getExpressionRegionsRoot expressions in grammar order; indexes address their original owner arrays.
getExpressionScopeDescribe the existing language-service scope at an expression, without a second resolver.
getFunctionImplementationRegionImplementation range excludes the signature and retains preceding body comments.
getFunctionInputsGet effective input attributes, including inheritance and dispatch signatures.
getFunctionOutputGet the effective output attribute, including dispatch signatures and inheritance.
getFunctionSignatureResolve a dispatch overload to its namespace's base declaration.
getModelSourceUriOwning document identity shared by parsed and serialized model consumers.
getNamespaceOverrideTargetsThe same native replacement pairs selected by linking, available after indexing.
getNodeSourceRegionOriginal UTF-16 range, shared by parsed and serialized model consumers.
getOperationArgumentResolve an explicit operation input or the input of its enclosing pipeline.
getOptionsGet the list of choice options from a Choice type.
getSourceCommentsHidden comment tokens, in UTF-16 source coordinates; string literals are not comments.
hasGeneratedInputCheck if an expression node has a generated (synthetic) input marker. This is used during code generation to track inputs that were automatically inferred rather than explicitly declared.
hasProjectRedirects-
hydrateModelDocumentDeserialize a serialized Rune AST and build a LangiumDocument, optionally registering it. 'none' builds without registering (a later DocumentBuilder.build will); 'always' registers unconditionally; 'idempotent' returns an existing document for uri if present, else registers the new one. Worker-local concerns (accumulators, deferred-json eviction) stay at the call site. (V9 — single source of truth.)
hydrateModelDocumentsHydrate and link one shared object graph, regardless of reference depth or input order.
importAliasCandidatesShared by language scopes and views; a real qualified name keeps precedence.
importScopeCandidatesOrdered names for a file scope; bare fallback is for the language's outer scope.
indexByIdBuild an id→item Map, insertion order preserved. Defaults the key to item.id.
initializeProjectResolutionBuild and validation share the same effective declaration inventory.
invalidateProjectResolutionA host must invalidate identity indexes whenever it replaces document roots.
isAnnotation-
isAnnotationArgument-
isAnnotationDeepPath-
isAnnotationPath-
isAnnotationPathAttributeReference-
isAnnotationPathExpression-
isAnnotationQualifier-
isAnnotationRef-
isArithmeticOperation-
isAsKeyOperation-
isAsOperation-
isAssignPathRoot-
isAttribute-
isAttributeOrChoiceOption-
isBigDecimal-
isCardinalityModifier-
isChoice-
isChoiceOperation-
isChoiceOption-
isClosureParameter-
isComparisonOperation-
isCondition-
isConstructorKeyValuePair-
isData-
isDataOrChoice-
isDefaultOperation-
isDistinctOperation-
isDocumentRationale-
isEqualityOperation-
isExistsModifier-
isExternalValueOperator-
isFilterOperation-
isFirstOperation-
isFlattenOperation-
isImport-
isInlineFunction-
isInteger-
isJoinOperation-
isLabelAnnotation-
isLastOperation-
isListLiteral-
isLogicalOperation-
isMapOperation-
isMaxOperation-
isMinOperation-
isNecessity-
isOneOfOperation-
isOperation-
isOptionalWhether the cardinality allows zero occurrences (inf == 0).
isPluralWhether the cardinality allows more than one instance (sup > 1 or unbounded).
isQualifiedName-
isQualifiedNameWithWildcard-
isReduceOperation-
isRegulatoryDocumentReference-
isRequiredWhether the cardinality is required (inf >= 1).
isReverseOperation-
isRosettaAbsentExpression-
isRosettaAttributeReference-
isRosettaBasicType-
isRosettaBody-
isRosettaBooleanLiteral-
isRosettaCallableWithArgs-
isRosettaCardinality-
isRosettaClassSynonym-
isRosettaConditionalExpression-
isRosettaConstructorExpression-
isRosettaContainsExpression-
isRosettaCorpus-
isRosettaCountOperation-
isRosettaDataReference-
isRosettaDeepFeatureCall-
isRosettaDisjointExpression-
isRosettaDocReference-
isRosettaEnumeration-
isRosettaEnumSynonym-
isRosettaEnumValue-
isRosettaEnumValueReference-
isRosettaExistsExpression-
isRosettaExpression-
isRosettaExternalClass-
isRosettaExternalClassSynonym-
isRosettaExternalEnum-
isRosettaExternalEnumValue-
isRosettaExternalFunction-
isRosettaExternalRegularAttribute-
isRosettaExternalRuleSource-
isRosettaExternalSynonym-
isRosettaFeature-
isRosettaFeatureCall-
isRosettaFunction-
isRosettaImplicitVariable-
isRosettaIntLiteral-
isRosettaLiteral-
isRosettaMapPath-
isRosettaMapPathValue-
isRosettaMapping-
isRosettaMappingInstance-
isRosettaMappingPathTests-
isRosettaMapRosettaPath-
isRosettaMapTest-
isRosettaMapTestAbsentExpression-
isRosettaMapTestEqualityOperation-
isRosettaMapTestExistsExpression-
isRosettaMapTestExpression-
isRosettaMapTestFunc-
isRosettaMergeSynonymValue-
isRosettaMetaType-
isRosettaModel-
isRosettaNumberLiteral-
isRosettaOnlyElement-
isRosettaOnlyExistsExpression-
isRosettaParameter-
isRosettaQualifiableConfiguration-
isRosettaQualifiableType-
isRosettaRecordFeature-
isRosettaRecordType-
isRosettaReport-
isRosettaRootElement-
isRosettaRule-
isRosettaScope-
isRosettaSegment-
isRosettaSegmentRef-
isRosettaStringLiteral-
isRosettaSuperCall-
isRosettaSymbol-
isRosettaSymbolReference-
isRosettaSynonym-
isRosettaSynonymBody-
isRosettaSynonymRef-
isRosettaSynonymSource-
isRosettaSynonymValueBase-
isRosettaType-
isRosettaTypeAlias-
isRosettaTypedFeature-
isRuleReferenceAnnotation-
isSchema-
isSchemaOrFormat-
isSegment-
isShortcutDeclaration-
isSingularWhether the cardinality forces exactly one (inf == 1 && sup == 1).
isSortOperation-
isSumOperation-
isSwitchCaseGuard-
isSwitchCaseOrDefault-
isSwitchCaseTarget-
isSwitchOperation-
isThenOperation-
isToDateOperation-
isToDateTimeOperation-
isToEnumOperation-
isToIntOperation-
isToNumberOperation-
isToStringOperation-
isToTimeOperation-
isToZonedDateTimeOperation-
isTypeCall-
isTypeCallArgument-
isTypeParameter-
isTypeParameterValidID-
isValidID-
isWithMetaEntry-
isWithMetaOperation-
namespaceFromModelNameNormalize a RosettaModel.name value (which may be a plain string, a quoted STRING-named namespace, or a { segments: string[] } qualified-name object) to its dotted string form. Returns undefined for null/unknown shapes; the caller supplies any ''/'unknown' fallback it needs.
namespaceFromSourceExtract the namespace from raw .rosetta source text. Returns '' when no namespace declaration is present (matching the historical callers).
namespaceOverrideDiagnostics-
namespaceOverrideSignatureDiagnosticsValidate after scopes exist; indexing must never resolve signature references.
preserveCstTextCopy $cstNode.text -> $cstText for condition/expression-bearing AST parts BEFORE JsonSerializer.serialize, because $cstNode is non-serializable (circular) and the serializer drops it — yet the visual-editor's expression cells need the original source text after the JSON round-trip.
projectDeclarationIdentity-
qualifiedExportPathThe canonical Langium scope key for a top-level exported element: ${namespace}.${name}. Namespaces are dot-joined identifiers and element names are dotless (grammar ValidID), so the result is injective and the last dot separates namespace from name. An empty namespace yields the bare name (no leading dot).
readLspModelMetadataRead canonical import and resolved-reference edges, including function bodies.
redirectProjectNodeA missing replacement stays unresolved; it must never fall back to the immutable original.
redirectProjectScopeKeep authored lookup names while navigation and linking descriptions point at the effective declaration.
relinkModelReferencesDependency snapshots must stay relinkable after live edits or a project-context transition.
relinkReferenceRebuild authored references through Langium's authoritative scope/link boundary.
resolveNamespaceOverridesShared source-facing overlay for linked graphs and structurally serialized editor models.
resolveOperationTypeShared operator result-type propagation; symbol lookup belongs to the caller.
resolveTypeAliasesResolve a declared type without looping through recursive aliases.
runeBigIntReplacerCanonical BigInt JSON replacer for Rune wire serialization: bigint → Number. Chosen so EVERY serialization path agrees on one policy (closing the historical Number-vs-String divergence). NOTE: Number(bigint) is lossy above 2^53; this matches the pre-existing AST serialize path and Rosetta models large numerics as BigDecimal/string, not bigint.
selectNamespaceOverrideModelsShallow view: keeps effective declarations while preserving their original source ownership.
serializeRuneModelSerialize a Rune AST model to its canonical wire JSON string.
setGeneratedInputIfAbsentSet the generated input marker on an expression node if not already set. Returns true if the marker was set, false if it was already present.
setProjectDocumentModelHosts explicitly assign document ownership; core does not infer model identity from names or namespaces.
setProjectRedirects-
toConstraintStringProduce a human-readable constraint string like "(1..1)", "(0..*)", etc.

Core packages released under MIT. Studio app released under FSL-1.1-ALv2.