Line |
Branch |
Exec |
Source |
1 |
|
|
// Copyright (c) 2021-2024 ChilliBits. All rights reserved. |
2 |
|
|
|
3 |
|
|
#pragma once |
4 |
|
|
|
5 |
|
|
#include <ast/AbstractASTVisitor.h> |
6 |
|
|
|
7 |
|
|
namespace spice::compiler { |
8 |
|
|
|
9 |
|
|
class ASTVisitor : public AbstractASTVisitor { |
10 |
|
|
public: |
11 |
|
12216 |
virtual ~ASTVisitor() = default; |
12 |
|
|
|
13 |
|
|
// Visitor methods |
14 |
|
|
std::any visitEntry(EntryNode *node) override; |
15 |
|
|
std::any visitMainFctDef(MainFctDefNode *node) override; |
16 |
|
|
std::any visitFctDef(FctDefNode *node) override; |
17 |
|
|
std::any visitProcDef(ProcDefNode *node) override; |
18 |
|
|
std::any visitFctName(FctNameNode *node) override; |
19 |
|
|
std::any visitStructDef(StructDefNode *node) override; |
20 |
|
|
std::any visitInterfaceDef(InterfaceDefNode *node) override; |
21 |
|
|
std::any visitEnumDef(EnumDefNode *node) override; |
22 |
|
|
std::any visitGenericTypeDef(GenericTypeDefNode *node) override; |
23 |
|
|
std::any visitAliasDef(AliasDefNode *node) override; |
24 |
|
|
std::any visitGlobalVarDef(GlobalVarDefNode *node) override; |
25 |
|
|
std::any visitExtDecl(ExtDeclNode *node) override; |
26 |
|
|
std::any visitImportDef(ImportDefNode *node) override; |
27 |
|
|
std::any visitUnsafeBlock(UnsafeBlockNode *node) override; |
28 |
|
|
std::any visitForLoop(ForLoopNode *node) override; |
29 |
|
|
std::any visitForeachLoop(ForeachLoopNode *node) override; |
30 |
|
|
std::any visitWhileLoop(WhileLoopNode *node) override; |
31 |
|
|
std::any visitDoWhileLoop(DoWhileLoopNode *node) override; |
32 |
|
|
std::any visitIfStmt(IfStmtNode *node) override; |
33 |
|
|
std::any visitElseStmt(ElseStmtNode *node) override; |
34 |
|
|
std::any visitSwitchStmt(SwitchStmtNode *node) override; |
35 |
|
|
std::any visitCaseBranch(CaseBranchNode *node) override; |
36 |
|
|
std::any visitDefaultBranch(DefaultBranchNode *node) override; |
37 |
|
|
std::any visitAnonymousBlockStmt(AnonymousBlockStmtNode *node) override; |
38 |
|
|
std::any visitStmtLst(StmtLstNode *node) override; |
39 |
|
|
std::any visitTypeLst(TypeLstNode *node) override; |
40 |
|
|
std::any visitTypeAltsLst(TypeAltsLstNode *node) override; |
41 |
|
|
std::any visitParamLst(ParamLstNode *node) override; |
42 |
|
|
std::any visitArgLst(ArgLstNode *node) override; |
43 |
|
|
std::any visitEnumItemLst(EnumItemLstNode *node) override; |
44 |
|
|
std::any visitEnumItem(EnumItemNode *node) override; |
45 |
|
|
std::any visitField(FieldNode *node) override; |
46 |
|
|
std::any visitSignature(SignatureNode *node) override; |
47 |
|
|
std::any visitDeclStmt(DeclStmtNode *node) override; |
48 |
|
|
std::any visitSpecifierLst(SpecifierLstNode *node) override; |
49 |
|
|
std::any visitSpecifier(SpecifierNode *node) override; |
50 |
|
|
std::any visitModAttr(ModAttrNode *node) override; |
51 |
|
|
std::any visitTopLevelDefinitionAttr(TopLevelDefinitionAttrNode *node) override; |
52 |
|
|
std::any visitLambdaAttr(LambdaAttrNode *node) override; |
53 |
|
|
std::any visitAttrLst(AttrLstNode *node) override; |
54 |
|
|
std::any visitAttr(AttrNode *node) override; |
55 |
|
|
std::any visitCaseConstant(CaseConstantNode *node) override; |
56 |
|
|
std::any visitReturnStmt(ReturnStmtNode *node) override; |
57 |
|
|
std::any visitBreakStmt(BreakStmtNode *node) override; |
58 |
|
|
std::any visitContinueStmt(ContinueStmtNode *node) override; |
59 |
|
|
std::any visitFallthroughStmt(FallthroughStmtNode *node) override; |
60 |
|
|
std::any visitAssertStmt(AssertStmtNode *node) override; |
61 |
|
|
std::any visitPrintfCall(PrintfCallNode *node) override; |
62 |
|
|
std::any visitSizeofCall(SizeofCallNode *node) override; |
63 |
|
|
std::any visitAlignofCall(AlignofCallNode *node) override; |
64 |
|
|
std::any visitLenCall(LenCallNode *node) override; |
65 |
|
|
std::any visitPanicCall(PanicCallNode *node) override; |
66 |
|
|
std::any visitSysCall(SysCallNode *node) override; |
67 |
|
|
std::any visitAssignExpr(AssignExprNode *node) override; |
68 |
|
|
std::any visitTernaryExpr(TernaryExprNode *node) override; |
69 |
|
|
std::any visitLogicalOrExpr(LogicalOrExprNode *node) override; |
70 |
|
|
std::any visitLogicalAndExpr(LogicalAndExprNode *node) override; |
71 |
|
|
std::any visitBitwiseOrExpr(BitwiseOrExprNode *node) override; |
72 |
|
|
std::any visitBitwiseXorExpr(BitwiseXorExprNode *node) override; |
73 |
|
|
std::any visitBitwiseAndExpr(BitwiseAndExprNode *node) override; |
74 |
|
|
std::any visitEqualityExpr(EqualityExprNode *node) override; |
75 |
|
|
std::any visitRelationalExpr(RelationalExprNode *node) override; |
76 |
|
|
std::any visitShiftExpr(ShiftExprNode *node) override; |
77 |
|
|
std::any visitAdditiveExpr(AdditiveExprNode *node) override; |
78 |
|
|
std::any visitMultiplicativeExpr(MultiplicativeExprNode *node) override; |
79 |
|
|
std::any visitCastExpr(CastExprNode *node) override; |
80 |
|
|
std::any visitPrefixUnaryExpr(PrefixUnaryExprNode *node) override; |
81 |
|
|
std::any visitPostfixUnaryExpr(PostfixUnaryExprNode *node) override; |
82 |
|
|
std::any visitAtomicExpr(AtomicExprNode *node) override; |
83 |
|
|
std::any visitValue(ValueNode *node) override; |
84 |
|
|
std::any visitConstant(ConstantNode *node) override; |
85 |
|
|
std::any visitFctCall(FctCallNode *node) override; |
86 |
|
|
std::any visitArrayInitialization(ArrayInitializationNode *node) override; |
87 |
|
|
std::any visitStructInstantiation(StructInstantiationNode *node) override; |
88 |
|
|
std::any visitLambdaFunc(LambdaFuncNode *node) override; |
89 |
|
|
std::any visitLambdaProc(LambdaProcNode *node) override; |
90 |
|
|
std::any visitLambdaExpr(LambdaExprNode *node) override; |
91 |
|
|
std::any visitDataType(DataTypeNode *node) override; |
92 |
|
|
std::any visitBaseDataType(BaseDataTypeNode *node) override; |
93 |
|
|
std::any visitCustomDataType(CustomDataTypeNode *node) override; |
94 |
|
|
std::any visitFunctionDataType(FunctionDataTypeNode *node) override; |
95 |
|
|
}; |
96 |
|
|
|
97 |
|
|
} // namespace spice::compiler |
98 |
|
|
|