public final class RecipeVisitor extends DirectivesBaseVisitor<RecipeSymbol.Builder>
RecipeVisitor implements the visitor pattern
used during traversal of the AST tree. The ParserTree#Walker
invokes appropriate methods as call backs with information about the node.
In order to understand what's being invoked, please look at the grammar file Directive.g4
.This class exposes a getTokenGroups method for retrieving the
RecipeSymbol after visiting. The RecipeSymbol represents
all the TokenGroup for all directives in a recipe. Each directive
will create a TokenGroup
As the ParseTree is walking through the call graph, it generates
one TokenGroup for each directive in the recipe. Each TokenGroup
contains parsed Tokens for that directive along with more information like
SourceInfo. A collection of TokenGroup consistutes a RecipeSymbol
that is returned by this function.
| Constructor and Description |
|---|
RecipeVisitor() |
| Modifier and Type | Method and Description |
|---|---|
RecipeSymbol |
getCompiledUnit()
Returns a
RecipeSymbol for the recipe being parsed. |
RecipeSymbol.Builder |
visitBool(DirectivesParser.BoolContext ctx)
A Directive can consist of Bool field.
|
RecipeSymbol.Builder |
visitBoolList(DirectivesParser.BoolListContext ctx)
This visitor methods extracts the list of booleans specified.
|
RecipeSymbol.Builder |
visitColList(DirectivesParser.ColListContext ctx)
This visitor methods extracts the list of columns specified.
|
RecipeSymbol.Builder |
visitColumn(DirectivesParser.ColumnContext ctx)
A Directive can consist of column specifiers.
|
RecipeSymbol.Builder |
visitCommand(DirectivesParser.CommandContext ctx)
A Directive has name and in the parsing context it's called a command.
|
RecipeSymbol.Builder |
visitCondition(DirectivesParser.ConditionContext ctx)
A Directive can include a expression or a condition to be evaluated.
|
RecipeSymbol.Builder |
visitDirective(DirectivesParser.DirectiveContext ctx)
A Recipe is made up of Directives and Directives is made up of each individual
Directive.
|
RecipeSymbol.Builder |
visitEcommand(DirectivesParser.EcommandContext ctx)
This visitor method extracts the custom directive name specified.
|
RecipeSymbol.Builder |
visitIdentifier(DirectivesParser.IdentifierContext ctx)
A Directive can include identifiers, this method extracts that token that is being
identified as token of type
Identifier. |
RecipeSymbol.Builder |
visitNumber(DirectivesParser.NumberContext ctx)
A Directive can consist of numeric field.
|
RecipeSymbol.Builder |
visitNumberList(DirectivesParser.NumberListContext ctx)
This visitor methods extracts the list of numeric specified.
|
RecipeSymbol.Builder |
visitNumberRanges(DirectivesParser.NumberRangesContext ctx)
A Directive can include number ranges like start:end=value[,start:end=value]*.
|
RecipeSymbol.Builder |
visitPragmaLoadDirective(DirectivesParser.PragmaLoadDirectiveContext ctx)
A Pragma is an instruction to the compiler to dynamically load the directives being specified
from the
DirectiveRegistry. |
RecipeSymbol.Builder |
visitPragmaVersion(DirectivesParser.PragmaVersionContext ctx)
A Pragma version is a informational directive to notify compiler about the grammar that is should
be using to parse the directives below.
|
RecipeSymbol.Builder |
visitPropertyList(DirectivesParser.PropertyListContext ctx)
A Directive can include properties (which are a collection of key and value pairs),
this method extracts that token that is being identified as token of type
Properties. |
RecipeSymbol.Builder |
visitStringList(DirectivesParser.StringListContext ctx)
This visitor methods extracts the list of strings specified.
|
RecipeSymbol.Builder |
visitText(DirectivesParser.TextContext ctx)
A Directive can consist of text field.
|
visitCodeblock, visitConfig, visitElseIfStat, visitElseStat, visitExpression, visitForStatement, visitIdentifierList, visitIfStat, visitIfStatement, visitMacro, visitNumberRange, visitPragma, visitProperties, visitProperty, visitRecipe, visitStatements, visitValueaggregateResult, defaultResult, shouldVisitNextChild, visit, visitChildren, visitErrorNode, visitTerminalpublic RecipeSymbol getCompiledUnit()
RecipeSymbol for the recipe being parsed. This
object has all the tokens that were successfully parsed along with source
information for each directive in the recipe.public RecipeSymbol.Builder visitDirective(DirectivesParser.DirectiveContext ctx)
visitDirective in interface DirectivesVisitor<RecipeSymbol.Builder>visitDirective in class DirectivesBaseVisitor<RecipeSymbol.Builder>ctx - the parse treepublic RecipeSymbol.Builder visitIdentifier(DirectivesParser.IdentifierContext ctx)
Identifier.visitIdentifier in interface DirectivesVisitor<RecipeSymbol.Builder>visitIdentifier in class DirectivesBaseVisitor<RecipeSymbol.Builder>ctx - the parse treepublic RecipeSymbol.Builder visitPropertyList(DirectivesParser.PropertyListContext ctx)
Properties.visitPropertyList in interface DirectivesVisitor<RecipeSymbol.Builder>visitPropertyList in class DirectivesBaseVisitor<RecipeSymbol.Builder>ctx - the parse treepublic RecipeSymbol.Builder visitPragmaLoadDirective(DirectivesParser.PragmaLoadDirectiveContext ctx)
DirectiveRegistry. These do not affect the data flow.
E.g. #pragma load-directives test1, test2, test3; will collect the tokens
test1, test2 and test3 as dynamically loadable directives.
visitPragmaLoadDirective in interface DirectivesVisitor<RecipeSymbol.Builder>visitPragmaLoadDirective in class DirectivesBaseVisitor<RecipeSymbol.Builder>ctx - the parse treepublic RecipeSymbol.Builder visitPragmaVersion(DirectivesParser.PragmaVersionContext ctx)
visitPragmaVersion in interface DirectivesVisitor<RecipeSymbol.Builder>visitPragmaVersion in class DirectivesBaseVisitor<RecipeSymbol.Builder>ctx - the parse treepublic RecipeSymbol.Builder visitNumberRanges(DirectivesParser.NumberRangesContext ctx)
Ranges.visitNumberRanges in interface DirectivesVisitor<RecipeSymbol.Builder>visitNumberRanges in class DirectivesBaseVisitor<RecipeSymbol.Builder>ctx - the parse treepublic RecipeSymbol.Builder visitEcommand(DirectivesParser.EcommandContext ctx)
visitEcommand in interface DirectivesVisitor<RecipeSymbol.Builder>visitEcommand in class DirectivesBaseVisitor<RecipeSymbol.Builder>ctx - the parse treepublic RecipeSymbol.Builder visitColumn(DirectivesParser.ColumnContext ctx)
ColumnName.visitColumn in interface DirectivesVisitor<RecipeSymbol.Builder>visitColumn in class DirectivesBaseVisitor<RecipeSymbol.Builder>ctx - the parse treepublic RecipeSymbol.Builder visitText(DirectivesParser.TextContext ctx)
Text.visitText in interface DirectivesVisitor<RecipeSymbol.Builder>visitText in class DirectivesBaseVisitor<RecipeSymbol.Builder>ctx - the parse treepublic RecipeSymbol.Builder visitNumber(DirectivesParser.NumberContext ctx)
Numeric.visitNumber in interface DirectivesVisitor<RecipeSymbol.Builder>visitNumber in class DirectivesBaseVisitor<RecipeSymbol.Builder>ctx - the parse treepublic RecipeSymbol.Builder visitBool(DirectivesParser.BoolContext ctx)
Bool.visitBool in interface DirectivesVisitor<RecipeSymbol.Builder>visitBool in class DirectivesBaseVisitor<RecipeSymbol.Builder>ctx - the parse treepublic RecipeSymbol.Builder visitCondition(DirectivesParser.ConditionContext ctx)
Expression to be added to the TokenGroupvisitCondition in interface DirectivesVisitor<RecipeSymbol.Builder>visitCondition in class DirectivesBaseVisitor<RecipeSymbol.Builder>ctx - the parse treepublic RecipeSymbol.Builder visitCommand(DirectivesParser.CommandContext ctx)
DirectiveNamevisitCommand in interface DirectivesVisitor<RecipeSymbol.Builder>visitCommand in class DirectivesBaseVisitor<RecipeSymbol.Builder>ctx - the parse treepublic RecipeSymbol.Builder visitColList(DirectivesParser.ColListContext ctx)
ColumnNameList to be added to TokenGroup.visitColList in interface DirectivesVisitor<RecipeSymbol.Builder>visitColList in class DirectivesBaseVisitor<RecipeSymbol.Builder>ctx - the parse treepublic RecipeSymbol.Builder visitNumberList(DirectivesParser.NumberListContext ctx)
NumericList to be added to TokenGroup.visitNumberList in interface DirectivesVisitor<RecipeSymbol.Builder>visitNumberList in class DirectivesBaseVisitor<RecipeSymbol.Builder>ctx - the parse treepublic RecipeSymbol.Builder visitBoolList(DirectivesParser.BoolListContext ctx)
BoolList to be added to TokenGroup.visitBoolList in interface DirectivesVisitor<RecipeSymbol.Builder>visitBoolList in class DirectivesBaseVisitor<RecipeSymbol.Builder>ctx - the parse treepublic RecipeSymbol.Builder visitStringList(DirectivesParser.StringListContext ctx)
StringList to be added to TokenGroup.visitStringList in interface DirectivesVisitor<RecipeSymbol.Builder>visitStringList in class DirectivesBaseVisitor<RecipeSymbol.Builder>ctx - the parse treeCopyright © 2020 CDAP Licensed under the Apache License, Version 2.0.