AutoPas  3.0.0
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | List of all members
autopas::RuleSyntax::TranslationVisitor Class Reference

The antlr visitor that produces the AST. More...

Inheritance diagram for autopas::RuleSyntax::TranslationVisitor:
Inheritance graph
[legend]
Collaboration diagram for autopas::RuleSyntax::TranslationVisitor:
Collaboration graph
[legend]

Public Member Functions

 TranslationVisitor (CodeGenerationContext &context)
 Constructs the visitor with a given CodeGenerationContext.
 
antlrcpp::Any visitProgram (RuleLanguageParser::ProgramContext *ctx) override
 Translates a program tree non-literal.
 
antlrcpp::Any visitLiteral (RuleLanguageParser::LiteralContext *ctx) override
 Translates a literal non-literal.
 
antlrcpp::Any visitDefine_list (RuleLanguageParser::Define_listContext *ctx) override
 Translates a define_list non-literal.
 
antlrcpp::Any visitDefine (RuleLanguageParser::DefineContext *ctx) override
 Translates a define non-literal.
 
antlrcpp::Any visitVariable (RuleLanguageParser::VariableContext *ctx) override
 Translates a variable non-literal.
 
antlrcpp::Any visitExpression (RuleLanguageParser::ExpressionContext *ctx) override
 Translates a expression non-literal.
 
antlrcpp::Any visitProperty_value (RuleLanguageParser::Property_valueContext *ctx) override
 Translates a property_value non-literal.
 
const DefineListresolveList (const std::string &name) const
 Returns the list with the given name in the already parsed program.
 
antlrcpp::Any visitConfiguration_pattern (RuleLanguageParser::Configuration_patternContext *ctx) override
 Translates a configuration_pattern non-literal.
 
antlrcpp::Any visitConfiguration_order (RuleLanguageParser::Configuration_orderContext *ctx) override
 Translates a configuration_order non-literal.
 
antlrcpp::Any visitStatement (RuleLanguageParser::StatementContext *ctx) override
 Translates a statement non-literal.
 
antlrcpp::Any visitIf_statement (RuleLanguageParser::If_statementContext *ctx) override
 Translates a if_statement non-literal.
 

Static Public Member Functions

static std::shared_ptr< ExpressiongetExprType (const antlrcpp::Any &expr)
 Helper function that returns a std::shared_ptr<Expression> from an antlrcpp::Any for multiple different expression types.
 
static std::shared_ptr< StatementgetStatementType (const antlrcpp::Any &statement)
 Helper function that returns a std::shared_ptr<Statement> from an antlrcpp::Any for multiple different statement types.
 

Detailed Description

The antlr visitor that produces the AST.

Constructor & Destructor Documentation

◆ TranslationVisitor()

autopas::RuleSyntax::TranslationVisitor::TranslationVisitor ( CodeGenerationContext context)
inlineexplicit

Constructs the visitor with a given CodeGenerationContext.

Parameters
contextThe CodeGenerationContext.

Member Function Documentation

◆ getExprType()

static std::shared_ptr< Expression > autopas::RuleSyntax::TranslationVisitor::getExprType ( const antlrcpp::Any &  expr)
inlinestatic

Helper function that returns a std::shared_ptr<Expression> from an antlrcpp::Any for multiple different expression types.

Parameters
exprThe antlrcpp::Any.
Returns
The converted std::shared_ptr<Expression>.

◆ getStatementType()

static std::shared_ptr< Statement > autopas::RuleSyntax::TranslationVisitor::getStatementType ( const antlrcpp::Any &  statement)
inlinestatic

Helper function that returns a std::shared_ptr<Statement> from an antlrcpp::Any for multiple different statement types.

Parameters
statementThe antlrcpp::Any.
Returns
The converted std::shared_ptr<Statement>.

◆ resolveList()

const DefineList * autopas::RuleSyntax::TranslationVisitor::resolveList ( const std::string &  name) const
inline

Returns the list with the given name in the already parsed program.

Parameters
nameThe name of the list.
Returns
The list with the name if defined.

◆ visitConfiguration_order()

antlrcpp::Any autopas::RuleSyntax::TranslationVisitor::visitConfiguration_order ( RuleLanguageParser::Configuration_orderContext *  ctx)
inlineoverride

Translates a configuration_order non-literal.

Parameters
ctxThe parser context.
Returns
The antlrcpp::Any containing the parsed AST result.

◆ visitConfiguration_pattern()

antlrcpp::Any autopas::RuleSyntax::TranslationVisitor::visitConfiguration_pattern ( RuleLanguageParser::Configuration_patternContext *  ctx)
inlineoverride

Translates a configuration_pattern non-literal.

Parameters
ctxThe parser context.
Returns
The antlrcpp::Any containing the parsed AST result.

◆ visitDefine()

antlrcpp::Any autopas::RuleSyntax::TranslationVisitor::visitDefine ( RuleLanguageParser::DefineContext *  ctx)
inlineoverride

Translates a define non-literal.

Parameters
ctxThe parser context.
Returns
The antlrcpp::Any containing the parsed AST result.

◆ visitDefine_list()

antlrcpp::Any autopas::RuleSyntax::TranslationVisitor::visitDefine_list ( RuleLanguageParser::Define_listContext *  ctx)
inlineoverride

Translates a define_list non-literal.

Parameters
ctxThe parser context.
Returns
The antlrcpp::Any containing the parsed AST result.

◆ visitExpression()

antlrcpp::Any autopas::RuleSyntax::TranslationVisitor::visitExpression ( RuleLanguageParser::ExpressionContext *  ctx)
inlineoverride

Translates a expression non-literal.

Parameters
ctxThe parser context.
Returns
The antlrcpp::Any containing the parsed AST result.

◆ visitIf_statement()

antlrcpp::Any autopas::RuleSyntax::TranslationVisitor::visitIf_statement ( RuleLanguageParser::If_statementContext *  ctx)
inlineoverride

Translates a if_statement non-literal.

Parameters
ctxThe parser context.
Returns
The antlrcpp::Any containing the parsed AST result.

◆ visitLiteral()

antlrcpp::Any autopas::RuleSyntax::TranslationVisitor::visitLiteral ( RuleLanguageParser::LiteralContext *  ctx)
inlineoverride

Translates a literal non-literal.

Parameters
ctxThe parser context.
Returns
The antlrcpp::Any containing the parsed AST result.

◆ visitProgram()

antlrcpp::Any autopas::RuleSyntax::TranslationVisitor::visitProgram ( RuleLanguageParser::ProgramContext *  ctx)
inlineoverride

Translates a program tree non-literal.

Parameters
ctxThe parser context.
Returns
The antlrcpp::Any containing the parsed AST result.

◆ visitProperty_value()

antlrcpp::Any autopas::RuleSyntax::TranslationVisitor::visitProperty_value ( RuleLanguageParser::Property_valueContext *  ctx)
inlineoverride

Translates a property_value non-literal.

Parameters
ctxThe parser context.
Returns
The antlrcpp::Any containing the parsed AST result.

◆ visitStatement()

antlrcpp::Any autopas::RuleSyntax::TranslationVisitor::visitStatement ( RuleLanguageParser::StatementContext *  ctx)
inlineoverride

Translates a statement non-literal.

Parameters
ctxThe parser context.
Returns
The antlrcpp::Any containing the parsed AST result.

◆ visitVariable()

antlrcpp::Any autopas::RuleSyntax::TranslationVisitor::visitVariable ( RuleLanguageParser::VariableContext *  ctx)
inlineoverride

Translates a variable non-literal.

Parameters
ctxThe parser context.
Returns
The antlrcpp::Any containing the parsed AST result.

The documentation for this class was generated from the following file: