TemplatesTransformer class

Templates transformer. Add more details and body context into the templates object.

Extends

AbstractParseTreeVisitor<void>

Constructors

TemplatesTransformer(Templates)

Creates a new instance of the TemplatesTransformer class.

Methods

transform(ParseTree)

Transform the parse tree into templates.

visitErrorDefinition(ErrorDefinitionContext)

Visit a parse tree produced by LGFileParser.errorDefinition.

visitImportDefinition(ImportDefinitionContext)

Visit a parse tree produced by LGFileParser.importDefinition.

visitOptionDefinition(OptionDefinitionContext)

Visit a parse tree produced by LGFileParser.optionDefinition.

visitTemplateDefinition(TemplateDefinitionContext)

Visit a parse tree produced by LGFileParser.templateDefinition.

Inherited Methods

visit(ParseTree)

{@inheritDoc} The default implementation calls <xref:ParseTree%23accept> on the specified tree.

visitChildren(RuleNode)

{@inheritDoc} The default implementation initializes the aggregate result to defaultResult(). Before visiting each child, it calls shouldVisitNextChild; if the result is false no more children are visited and the current aggregate result is returned. After visiting a child, the aggregate result is updated by calling aggregateResult with the previous aggregate result and the result of visiting the child.

The default implementation is not safe for use in visitors that modify the tree structure. Visitors that modify the tree should override this method to behave properly in respect to the specific algorithm in use.

visitErrorNode(ErrorNode)

{@inheritDoc} The default implementation returns the result of defaultResult.

visitTerminal(TerminalNode)

{@inheritDoc} The default implementation returns the result of defaultResult.

Constructor Details

TemplatesTransformer(Templates)

Creates a new instance of the TemplatesTransformer class.

new TemplatesTransformer(templates: Templates)

Parameters

templates
Templates

Templates.

Method Details

transform(ParseTree)

Transform the parse tree into templates.

function transform(parseTree: ParseTree): Templates

Parameters

parseTree

ParseTree

Input abstract syntax tree.

Returns

Parse tree templates.

visitErrorDefinition(ErrorDefinitionContext)

Visit a parse tree produced by LGFileParser.errorDefinition.

function visitErrorDefinition(context: ErrorDefinitionContext)

Parameters

context
ErrorDefinitionContext

The parse tree.

visitImportDefinition(ImportDefinitionContext)

Visit a parse tree produced by LGFileParser.importDefinition.

function visitImportDefinition(context: ImportDefinitionContext)

Parameters

context
ImportDefinitionContext

The parse tree.

visitOptionDefinition(OptionDefinitionContext)

Visit a parse tree produced by LGFileParser.optionDefinition.

function visitOptionDefinition(context: OptionDefinitionContext)

Parameters

context
OptionDefinitionContext

The parse tree.

visitTemplateDefinition(TemplateDefinitionContext)

Visit a parse tree produced by LGFileParser.templateDefinition.

function visitTemplateDefinition(context: TemplateDefinitionContext)

Parameters

context
TemplateDefinitionContext

The parse tree.

Inherited Method Details

visit(ParseTree)

{@inheritDoc} The default implementation calls <xref:ParseTree%23accept> on the specified tree.

function visit(tree: ParseTree)

Parameters

tree

ParseTree

Inherited From AbstractParseTreeVisitor.visit

visitChildren(RuleNode)

{@inheritDoc} The default implementation initializes the aggregate result to defaultResult(). Before visiting each child, it calls shouldVisitNextChild; if the result is false no more children are visited and the current aggregate result is returned. After visiting a child, the aggregate result is updated by calling aggregateResult with the previous aggregate result and the result of visiting the child.

The default implementation is not safe for use in visitors that modify the tree structure. Visitors that modify the tree should override this method to behave properly in respect to the specific algorithm in use.

function visitChildren(node: RuleNode)

Parameters

node

RuleNode

Inherited From AbstractParseTreeVisitor.visitChildren

visitErrorNode(ErrorNode)

{@inheritDoc} The default implementation returns the result of defaultResult.

function visitErrorNode(node: ErrorNode)

Parameters

node

ErrorNode

Inherited From AbstractParseTreeVisitor.visitErrorNode

visitTerminal(TerminalNode)

{@inheritDoc} The default implementation returns the result of defaultResult.

function visitTerminal(node: TerminalNode)

Parameters

node

TerminalNode

Inherited From AbstractParseTreeVisitor.visitTerminal