TorqueScript  0.2
astvisitor.hpp
1 
15 #pragma once
16 
17 #include "antlr4-runtime.h"
18 
19 #include <vector>
20 
21 namespace TorqueScript
22 {
23  namespace AST
24  {
25  class ASTNode;
26  class ProgramNode;
27  class FunctionDeclarationNode;
28  class PackageDeclarationNode;
29  class FunctionCallNode;
30  class SubFunctionCallNode;
31  class SubFieldNode;
32  class AddNode;
33  class SubtractNode;
34  class MultiplyNode;
35  class DivideNode;
36  class ConcatNode;
37  class EqualsNode;
38  class AssignmentNode;
39  class LessThanNode;
40  class NegateNode;
41  class NotNode;
42  class IncrementNode;
43  class DecrementNode;
44  class IntegerNode;
45  class FloatNode;
46  class StringNode;
47  class TaggedStringNode;
48  class LocalVariableNode;
49  class GlobalVariableNode;
50  class ArrayNode;
51  class WhileNode;
52  class ForNode;
53  class ReturnNode;
54  class BreakNode;
55  class TernaryNode;
56  class SwitchCaseNode;
57  class SwitchNode;
58  class ElseIfNode;
59  class IfNode;
60  class DatablockDeclarationNode;
61  class FieldAssignNode;
62  class ObjectDeclarationNode;
63 
64  class ASTVisitor
65  {
66  public:
67  virtual antlrcpp::Any defaultResult();
68  virtual antlrcpp::Any aggregateResult(antlrcpp::Any& aggregate, antlrcpp::Any& nextResult);
69 
70  /*
71  Visitor Routines =========================
72  */
73 
74  virtual antlrcpp::Any visitProgramNode(AST::ProgramNode* program);
75  virtual antlrcpp::Any visitFunctionDeclarationNode(AST::FunctionDeclarationNode* function);
76  virtual antlrcpp::Any visitPackageDeclarationNode(AST::PackageDeclarationNode* package);
77  virtual antlrcpp::Any visitObjectDeclarationNode(AST::ObjectDeclarationNode* object);
78  virtual antlrcpp::Any visitDatablockDeclarationNode(AST::DatablockDeclarationNode* datablock);
79  virtual antlrcpp::Any visitFieldAssignNode(AST::FieldAssignNode* node);
80  virtual antlrcpp::Any visitFunctionCallNode(AST::FunctionCallNode* call);
81  virtual antlrcpp::Any visitSubFunctionCallNode(AST::SubFunctionCallNode* call);
82  virtual antlrcpp::Any visitSubFieldNode(AST::SubFieldNode* subfield);
83  virtual antlrcpp::Any visitAddNode(AST::AddNode* expression);
84  virtual antlrcpp::Any visitSubtractNode(AST::SubtractNode* expression);
85  virtual antlrcpp::Any visitMultiplyNode(AST::MultiplyNode* expression);
86  virtual antlrcpp::Any visitDivideNode(AST::DivideNode* expression);
87  virtual antlrcpp::Any visitConcatNode(AST::ConcatNode* expression);
88  virtual antlrcpp::Any visitEqualsNode(AST::EqualsNode* expression);
89  virtual antlrcpp::Any visitAssignmentNode(AST::AssignmentNode* expression);
90  virtual antlrcpp::Any visitLessThanNode(AST::LessThanNode* expression);
91  virtual antlrcpp::Any visitNegateNode(AST::NegateNode* expression);
92  virtual antlrcpp::Any visitNotNode(AST::NotNode* expression);
93  virtual antlrcpp::Any visitIncrementNode(AST::IncrementNode* expression);
94  virtual antlrcpp::Any visitDecrementNode(AST::DecrementNode* expression);
95  virtual antlrcpp::Any visitIntegerNode(AST::IntegerNode* value);
96  virtual antlrcpp::Any visitFloatNode(AST::FloatNode* value);
97  virtual antlrcpp::Any visitStringNode(AST::StringNode* value);
98  virtual antlrcpp::Any visitTaggedStringNode(AST::TaggedStringNode* value);
99  virtual antlrcpp::Any visitLocalVariableNode(AST::LocalVariableNode* value);
100  virtual antlrcpp::Any visitGlobalVariableNode(AST::GlobalVariableNode* value);
101  virtual antlrcpp::Any visitArrayNode(AST::ArrayNode* array);
102  virtual antlrcpp::Any visitWhileNode(AST::WhileNode* node);
103  virtual antlrcpp::Any visitForNode(AST::ForNode* node);
104  virtual antlrcpp::Any visitReturnNode(AST::ReturnNode* node);
105  virtual antlrcpp::Any visitBreakNode(AST::BreakNode* node);
106  virtual antlrcpp::Any visitTernaryNode(AST::TernaryNode* node);
107  virtual antlrcpp::Any visitSwitchCaseNode(AST::SwitchCaseNode* node);
108  virtual antlrcpp::Any visitSwitchNode(AST::SwitchNode* node);
109  virtual antlrcpp::Any visitElseIfNode(AST::ElseIfNode* node);
110  virtual antlrcpp::Any visitIfNode(AST::IfNode* node);
111  };
112  }
113 }
Definition: astvisitor.hpp:65
Definition: ast.hpp:278
Definition: ast.hpp:599
Definition: ast.hpp:364
Definition: ast.hpp:710
Definition: ast.hpp:334
Definition: ast.hpp:450
Definition: ast.hpp:320
Definition: ast.hpp:801
Definition: ast.hpp:350
Definition: ast.hpp:124
Definition: ast.hpp:485
Definition: ast.hpp:654
Definition: ast.hpp:828
Definition: ast.hpp:436
Definition: ast.hpp:469
Definition: ast.hpp:378
Definition: ast.hpp:306
Definition: ast.hpp:408
Definition: ast.hpp:422
Definition: ast.hpp:47
Definition: ast.hpp:686
Definition: ast.hpp:501
Definition: ast.hpp:236
Definition: ast.hpp:292
Definition: ast.hpp:750
Definition: ast.hpp:767
Definition: ast.hpp:724
Definition: ast.hpp:627
Definition: ast.hpp:28