Analyzer class
Analyzer engine. To get the static analyzer results.
- Extends
-
AbstractParseTreeVisitor<AnalyzerResult>
Constructors
Analyzer(Templates, Evaluation |
Creates a new instance of the Analyzer class. |
Properties
templates | Templates. |
Methods
analyze |
Analyze a template to get the static analyzer results. |
visit |
Visit a parse tree produced by the ifElseBody labeled alternative in LGTemplateParser.body. |
visit |
Visit a parse tree produced by the normalBody labeled alternative in LGTemplateParser.body. |
visit |
Visit a parse tree produced by LGTemplateParser.normalTemplateBody. |
visit |
Visit a parse tree produced by LGTemplateParser.normalTemplateString. |
visit |
Visit a parse tree produced by LGTemplateParser.structuredTemplateBody. |
visit |
Visit a parse tree produced by LGTemplateParser.structuredValue. |
visit |
Visit a parse tree produced by the switchCaseBody labeled alternative in LGTemplateParser.body. |
Inherited Methods
visit(Parse |
{@inheritDoc} The default implementation calls <xref:ParseTree%23accept> on the specified tree. |
visit |
{@inheritDoc}
The default implementation initializes the aggregate result to
defaultResult(). Before visiting each child, it
calls shouldVisitNextChild; if the result
is 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. |
visit |
{@inheritDoc} The default implementation returns the result of defaultResult. |
visit |
{@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.
Options for LG.
- analyzerOptions
- AnalyzerOptions
Options for the analyzer.
Property Details
templates
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
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
The parse tree.
Returns
The AnalyzerResult instance.
visitNormalTemplateBody(NormalTemplateBodyContext)
Visit a parse tree produced by LGTemplateParser.normalTemplateBody.
function visitNormalTemplateBody(ctx: NormalTemplateBodyContext): AnalyzerResult
Parameters
The parse tree.
Returns
The AnalyzerResult instance.
visitNormalTemplateString(NormalTemplateStringContext)
Visit a parse tree produced by LGTemplateParser.normalTemplateString.
function visitNormalTemplateString(ctx: NormalTemplateStringContext): AnalyzerResult
Parameters
The parse tree.
Returns
The AnalyzerResult instance.
visitStructuredTemplateBody(StructuredTemplateBodyContext)
Visit a parse tree produced by LGTemplateParser.structuredTemplateBody.
function visitStructuredTemplateBody(ctx: StructuredTemplateBodyContext): AnalyzerResult
Parameters
The parse tree.
Returns
The AnalyzerResult instance.
visitStructureValue(KeyValueStructureLineContext)
Visit a parse tree produced by LGTemplateParser.structuredValue.
function visitStructureValue(ctx: KeyValueStructureLineContext): AnalyzerResult
Parameters
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
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