rune-langium / core/src / RuneStoreHydrator
Class: RuneStoreHydrator
Defined in: packages/core/src/services/rune-store-hydrator.ts:32
Hydrator variant for the Rune store substrate.
Differences from DefaultHydrator:
- CST nodes are dropped entirely — the store has no use for parse-tree data. (
$cstNode,$containerIndex, and$containerPropertyare deleted from the output so the runtime object matches theDehydrated<T>type, which excludes all Langium runtime fields.) $cstText(a custom field stamped bypreserveCstTextBEFORE dehydration) is preserved — the visual editor's expression cells read it after the round-trip, and DefaultHydrator would otherwise drop it as a$-field.- References are stored as
{ $refText: string }only — the editableDehydrated<T>wire format. - Re-hydration rebuilds a proper
Referenceviathis.linker.buildReference, passingundefinedfor the CST node (consistent with the drop above). - $namespace is stamped from the enclosing RosettaModel before $container is stripped.
Extends
DefaultHydrator
Constructors
Constructor
new RuneStoreHydrator(services): RuneStoreHydrator;Defined in: node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:48
Parameters
| Parameter | Type |
|---|---|
services | LangiumCoreServices |
Returns
RuneStoreHydrator
Inherited from
DefaultHydrator.constructor
Properties
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
cstNodeBuilder | protected readonly | CstNodeBuilder | Used to assemble the CST during hydration; CstNodeBuilder is not a service, so we keep a local instance. | DefaultHydrator.cstNodeBuilder | node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:47 |
grammar | protected readonly | Grammar | - | DefaultHydrator.grammar | node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:41 |
grammarElementIdMap | protected readonly | BiMap<AbstractElement, number> | - | DefaultHydrator.grammarElementIdMap | node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:44 |
lexer | protected readonly | Lexer | - | DefaultHydrator.lexer | node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:42 |
linker | protected readonly | Linker | - | DefaultHydrator.linker | node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:43 |
tokenTypeIdMap | protected readonly | BiMap<number, TokenType> | - | DefaultHydrator.tokenTypeIdMap | node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:45 |
Methods
createDehyrationContext()
protected createDehyrationContext(node): DehydrateContext;Defined in: packages/core/src/services/rune-store-hydrator.ts:44
CST nodes never survive dehydration here (see class doc), so skip the base class's full CST-tree walk when building the context — on large corpora that walk dominates dehydration cost for zero benefit.
Parameters
| Parameter | Type |
|---|---|
node | AstNode |
Returns
DehydrateContext
Overrides
DefaultHydrator.createDehyrationContext
createGrammarElementIdMap()
protected createGrammarElementIdMap(): void;Defined in: node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:65
Returns
void
Inherited from
DefaultHydrator.createGrammarElementIdMap
createHydrationContext()
protected createHydrationContext(node): HydrateContext;Defined in: node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:56
Parameters
| Parameter | Type |
|---|---|
node | any |
Returns
HydrateContext
Inherited from
DefaultHydrator.createHydrationContext
dehydrate()
dehydrate(result): ParseResult<object>;Defined in: node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:49
Converts a parse result to a plain object. The resulting object can be sent across worker threads.
Parameters
| Parameter | Type |
|---|---|
result | ParseResult<AstNode> |
Returns
ParseResult<object>
Inherited from
DefaultHydrator.dehydrate
dehydrateAstNode()
protected dehydrateAstNode(node, context): object;Defined in: packages/core/src/services/rune-store-hydrator.ts:52
Parameters
| Parameter | Type |
|---|---|
node | AstNode |
context | DehydrateContext |
Returns
object
Overrides
DefaultHydrator.dehydrateAstNode
dehydrateCstNode()
protected dehydrateCstNode(_node, _context): Record<string, never>;Defined in: packages/core/src/services/rune-store-hydrator.ts:89
Parameters
| Parameter | Type |
|---|---|
_node | CstNode |
_context | DehydrateContext |
Returns
Record<string, never>
Overrides
DefaultHydrator.dehydrateCstNode
dehydrateLexerReport()
protected dehydrateLexerReport(lexerReport): LexingReport;Defined in: node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:50
Parameters
| Parameter | Type |
|---|---|
lexerReport | LexingReport |
Returns
LexingReport
Inherited from
DefaultHydrator.dehydrateLexerReport
dehydrateNode()
dehydrateNode<T>(node): Dehydrated<T>;Defined in: packages/core/src/services/rune-store-hydrator.ts:34
Dehydrate a single AST node to its Dehydrated<T> wire form.
Type Parameters
| Type Parameter |
|---|
T extends AstNode |
Parameters
| Parameter | Type |
|---|---|
node | T |
Returns
Dehydrated<T>
dehydrateReference()
protected dehydrateReference(reference, _context): {
$refText: string;
};Defined in: packages/core/src/services/rune-store-hydrator.ts:93
Parameters
| Parameter | Type |
|---|---|
reference | Reference |
_context | DehydrateContext |
Returns
{
$refText: string;
}| Name | Type | Defined in |
|---|---|---|
$refText | string | packages/core/src/services/rune-store-hydrator.ts:93 |
Overrides
DefaultHydrator.dehydrateReference
getGrammarElement()
protected getGrammarElement(id): AbstractElement | undefined;Defined in: node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:64
Parameters
| Parameter | Type |
|---|---|
id | number |
Returns
AbstractElement | undefined
Inherited from
DefaultHydrator.getGrammarElement
getGrammarElementId()
protected getGrammarElementId(node): number | undefined;Defined in: node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:63
Parameters
| Parameter | Type |
|---|---|
node | AbstractElement | undefined |
Returns
number | undefined
Inherited from
DefaultHydrator.getGrammarElementId
getTokenType()
protected getTokenType(name): TokenType;Defined in: node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:62
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
TokenType
Inherited from
DefaultHydrator.getTokenType
hydrate()
hydrate<T>(result): ParseResult<T>;Defined in: node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:55
Converts a plain object to a parse result. The included AST node can then be used in the main thread. Calling this method on objects that have not been dehydrated first will result in undefined behavior.
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends AstNode | AstNode |
Parameters
| Parameter | Type |
|---|---|
result | ParseResult<object> |
Returns
ParseResult<T>
Inherited from
DefaultHydrator.hydrate
hydrateAstNode()
protected hydrateAstNode(node, context): AstNode;Defined in: node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:57
Parameters
| Parameter | Type |
|---|---|
node | any |
context | HydrateContext |
Returns
AstNode
Inherited from
DefaultHydrator.hydrateAstNode
hydrateCstLeafNode()
protected hydrateCstLeafNode(cstNode): LeafCstNode;Defined in: node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:61
Parameters
| Parameter | Type |
|---|---|
cstNode | any |
Returns
LeafCstNode
Inherited from
DefaultHydrator.hydrateCstLeafNode
hydrateCstNode()
protected hydrateCstNode(
cstNode,
context,
num?
): CstNode;Defined in: node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:60
Parameters
| Parameter | Type |
|---|---|
cstNode | any |
context | HydrateContext |
num? | number |
Returns
CstNode
Inherited from
DefaultHydrator.hydrateCstNode
hydrateReference()
protected hydrateReference(
reference,
node,
name,
_context
): Reference;Defined in: packages/core/src/services/rune-store-hydrator.ts:97
Parameters
| Parameter | Type |
|---|---|
reference | { $refText: string; } |
reference.$refText | string |
node | AstNode |
name | string |
_context | HydrateContext |
Returns
Reference
Overrides
DefaultHydrator.hydrateReference
setParent()
protected setParent(node, parent): any;Defined in: node_modules/.pnpm/[email protected]/node_modules/langium/lib/serializer/hydrator.d.ts:58
Parameters
| Parameter | Type |
|---|---|
node | any |
parent | any |
Returns
any
Inherited from
DefaultHydrator.setParent