Class: ASTNodeFactory<T, U>
compiler.ASTNodeFactory
A simple blueprint for a factory for creating AST nodes from a parser context.
Since
0.10.0
Type parameters
| Name | Type |
|---|---|
T |
extends CompilableASTNode = CompilableASTNode |
U |
extends KipperParserRuleContext = KipperParserRuleContext |
Hierarchy
ASTNodeFactory
Table of contents
Constructors
Methods
Constructors
constructor
• new ASTNodeFactory<T, U>()
Type parameters
| Name | Type |
|---|---|
T |
extends CompilableASTNode<SemanticData, TypeData, T> = CompilableASTNode<SemanticData, TypeData> |
U |
extends KipperParserRuleContext<U> = KipperParserRuleContext |
Methods
create
▸ Abstract create(antlrRuleCtx, parent): T
Fetches the AST node class and creates a new instance based on the antlrRuleCtx.
Since
0.9.0
Parameters
| Name | Type | Description |
|---|---|---|
antlrRuleCtx |
U |
The context instance that the handler class should be fetched for. |
parent |
CompilableASTNode<SemanticData, TypeData> |
The parent of the AST node that is being created. |
Returns
T
Defined in
kipper/core/src/compiler/ast/factories/ast-node-factory.ts:32
getRuleIds
▸ Static Protected getRuleIds(ruleMapping): ConstructableASTKind[]
Returns an array of all AST node kind ids that this factory can process.
Since
0.10.0
Parameters
| Name | Type |
|---|---|
ruleMapping |
Record<number, ConstructableASTNodeClass> |
Returns
Defined in
kipper/core/src/compiler/ast/factories/ast-node-factory.ts:22