Analyzer class

Analyzer engine. To get the static analyzer results.

Extends

AbstractParseTreeVisitor<AnalyzerResult>

Constructors

Analyzer(Templates, EvaluationOptions, AnalyzerOptions)

Creates a new instance of the Analyzer class.

Properties

templates

Templates.

Methods

analyzeTemplate(string)

Analyze a template to get the static analyzer results.

visitIfElseBody(IfElseBodyContext)

Visit a parse tree produced by the ifElseBody labeled alternative in LGTemplateParser.body.

visitNormalBody(NormalBodyContext)

Visit a parse tree produced by the normalBody labeled alternative in LGTemplateParser.body.

visitNormalTemplateBody(NormalTemplateBodyContext)

Visit a parse tree produced by LGTemplateParser.normalTemplateBody.

visitNormalTemplateString(NormalTemplateStringContext)

Visit a parse tree produced by LGTemplateParser.normalTemplateString.

visitStructuredTemplateBody(StructuredTemplateBodyContext)

Visit a parse tree produced by LGTemplateParser.structuredTemplateBody.

visitStructureValue(KeyValueStructureLineContext)

Visit a parse tree produced by LGTemplateParser.structuredValue.

visitSwitchCaseBody(SwitchCaseBodyContext)

Visit a parse tree produced by the switchCaseBody labeled alternative in LGTemplateParser.body.

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

Analyzer(Templates, EvaluationOptions, AnalyzerOptions)

Creates a new instance of the Analyzer class.

new Analyzer(templates: Templates, opt?: EvaluationOptions, analyzerOptions?: AnalyzerOptions)

Parameters

templates
Templates

Templates.

opt
EvaluationOptions

Options for LG.

analyzerOptions
AnalyzerOptions

Options for the analyzer.

Property Details

templates

Templates.

templates: Templates

Property Value

Method Details

analyzeTemplate(string)

Analyze a template to get the static analyzer results.

function analyzeTemplate(templateName: string): AnalyzerResult

Parameters

templateName

string

Template name.

Returns

Analyze result including variables and template references.

visitIfElseBody(IfElseBodyContext)

Visit a parse tree produced by the ifElseBody labeled alternative in LGTemplateParser.body.

function visitIfElseBody(ctx: IfElseBodyContext): AnalyzerResult

Parameters

ctx
IfElseBodyContext

The parse tree.

Returns

The AnalyzerResult instance.

visitNormalBody(NormalBodyContext)

Visit a parse tree produced by the normalBody labeled alternative in LGTemplateParser.body.

function visitNormalBody(ctx: NormalBodyContext): AnalyzerResult

Parameters

ctx
NormalBodyContext

The parse tree.

Returns

The AnalyzerResult instance.

visitNormalTemplateBody(NormalTemplateBodyContext)

Visit a parse tree produced by LGTemplateParser.normalTemplateBody.

function visitNormalTemplateBody(ctx: NormalTemplateBodyContext): AnalyzerResult

Parameters

ctx
NormalTemplateBodyContext

The parse tree.

Returns

The AnalyzerResult instance.

visitNormalTemplateString(NormalTemplateStringContext)

Visit a parse tree produced by LGTemplateParser.normalTemplateString.

function visitNormalTemplateString(ctx: NormalTemplateStringContext): AnalyzerResult

Parameters

ctx
NormalTemplateStringContext

The parse tree.

Returns

The AnalyzerResult instance.

visitStructuredTemplateBody(StructuredTemplateBodyContext)

Visit a parse tree produced by LGTemplateParser.structuredTemplateBody.

function visitStructuredTemplateBody(ctx: StructuredTemplateBodyContext): AnalyzerResult

Parameters

ctx
StructuredTemplateBodyContext

The parse tree.

Returns

The AnalyzerResult instance.

visitStructureValue(KeyValueStructureLineContext)

Visit a parse tree produced by LGTemplateParser.structuredValue.

function visitStructureValue(ctx: KeyValueStructureLineContext): AnalyzerResult

Parameters

ctx
KeyValueStructureLineContext

The parse tree.

Returns

The AnalyzerResult instance.

visitSwitchCaseBody(SwitchCaseBodyContext)

Visit a parse tree produced by the switchCaseBody labeled alternative in LGTemplateParser.body.

function visitSwitchCaseBody(ctx: SwitchCaseBodyContext): AnalyzerResult

Parameters

ctx
SwitchCaseBodyContext

The parse tree.

Returns

The AnalyzerResult instance.

Inherited Method Details

visit(ParseTree)

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

function visit(tree: ParseTree): AnalyzerResult

Parameters

tree

ParseTree

Returns

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): AnalyzerResult

Parameters

node

RuleNode

Returns

Inherited From AbstractParseTreeVisitor.visitChildren

visitErrorNode(ErrorNode)

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

function visitErrorNode(node: ErrorNode): AnalyzerResult

Parameters

node

ErrorNode

Returns

Inherited From AbstractParseTreeVisitor.visitErrorNode

visitTerminal(TerminalNode)

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

function visitTerminal(node: TerminalNode): AnalyzerResult

Parameters

node

TerminalNode

Returns

Inherited From AbstractParseTreeVisitor.visitTerminal