From 731d8cc9bd2e52ee2e2c71ba449f211611448d52 Mon Sep 17 00:00:00 2001 From: Su Xing Date: Mon, 27 Mar 2023 08:21:02 +0800 Subject: [PATCH] Add SysYFormatter to namespace sysy --- src/SysYFormatter.cpp | 28 ---------------------------- src/SysYFormatter.h | 6 +++++- 2 files changed, 5 insertions(+), 29 deletions(-) delete mode 100644 src/SysYFormatter.cpp diff --git a/src/SysYFormatter.cpp b/src/SysYFormatter.cpp deleted file mode 100644 index 145b4e8..0000000 --- a/src/SysYFormatter.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include -#include -using namespace std; -#include "SysYParser.h" -#include "SysYFormatter.h" - -// any ASTPrinter::visitNumber(SysYParser::NumberContext *ctx) { -// cout << ctx->IntConst()->getText(); -// return nullptr; -// } - -// any ASTPrinter::visitString(SysYParser::StringContext *ctx) { -// cout << ctx->String()->getText(); -// return nullptr; -// } - -// any ASTPrinter::visitFuncRParams(SysYParser::FuncRParamsContext *ctx) { -// if (ctx->funcRParam().empty()) -// return nullptr; -// auto numParams = ctx->funcRParam().size(); -// ctx->funcRParam(0)->accept(this); -// for (int i = 1; i < numParams; ++i) { -// cout << ", "; -// ctx->funcRParam(i)->accept(this); -// } -// cout << '\n'; -// return nullptr; -// } diff --git a/src/SysYFormatter.h b/src/SysYFormatter.h index ac6192b..fdaf615 100644 --- a/src/SysYFormatter.h +++ b/src/SysYFormatter.h @@ -4,6 +4,8 @@ #include "SysYParser.h" #include +namespace sysy { + class SysYFormatter : public SysYBaseVisitor { protected: std::ostream &os; @@ -331,4 +333,6 @@ public: interleave(ctx->exp(), ", "); return 0; } -}; \ No newline at end of file +}; + +} // namespace sysy