Updated class names

This commit is contained in:
Benoy Bose 2024-11-28 01:42:58 +05:30
parent f687b32cb5
commit ef66ec9ebd
4 changed files with 12 additions and 12 deletions

View File

@ -5,8 +5,8 @@ ADD_LIBRARY(hoocore STATIC
${ANTLR_GENERATED_DIR}/HooParser.cpp ${ANTLR_GENERATED_DIR}/HooParser.cpp
Visitor.hpp Visitor.hpp
Visitor.cpp Visitor.cpp
HooCore.cpp Compiler.cpp
HooCore.hpp Compiler.hpp
Node.hpp) Node.hpp)
ADD_EXECUTABLE(hoo ADD_EXECUTABLE(hoo
Hoo.cpp Visitor.cpp Hoo.cpp Visitor.cpp

View File

@ -1,6 +1,6 @@
#include "HooCore.hpp" #include "Compiler.hpp"
HooCore::HooCore(const std::string &input, const std::string &moduleName) : _input(input), _moduleName(moduleName) Compiler::Compiler(const std::string &input, const std::string &moduleName) : _input(input), _moduleName(moduleName)
{ {
_input_stream = new antlr4::ANTLRInputStream(_input); _input_stream = new antlr4::ANTLRInputStream(_input);
_lexer = new HooLexer(_input_stream); _lexer = new HooLexer(_input_stream);
@ -9,7 +9,7 @@ HooCore::HooCore(const std::string &input, const std::string &moduleName) : _inp
_visitor = new Visitor(_moduleName); _visitor = new Visitor(_moduleName);
} }
HooCore::~HooCore() Compiler::~Compiler()
{ {
delete _visitor; delete _visitor;
delete _parser; delete _parser;
@ -18,7 +18,7 @@ HooCore::~HooCore()
delete _input_stream; delete _input_stream;
} }
std::any HooCore::compile() std::any Compiler::compile()
{ {
try try
{ {
@ -42,7 +42,7 @@ std::any HooCore::compile()
} }
} }
antlr4::tree::ParseTree *HooCore::parse() antlr4::tree::ParseTree *Compiler::parse()
{ {
try try
{ {

View File

@ -7,7 +7,7 @@
#include <string> #include <string>
class HooCore class Compiler
{ {
private: private:
const std::string &_input; const std::string &_input;
@ -19,8 +19,8 @@ private:
Visitor *_visitor; Visitor *_visitor;
public: public:
HooCore(const std::string &input, const std::string &moduleName); Compiler(const std::string &input, const std::string &moduleName);
~HooCore(); ~Compiler();
public: public:
std::any compile(); std::any compile();

View File

@ -1,11 +1,11 @@
#include "HooCore.hpp" #include "Compiler.hpp"
#include "Node.hpp" #include "Node.hpp"
#include <gtest/gtest.h> #include <gtest/gtest.h>
TEST(IntegerTest, Literal) TEST(IntegerTest, Literal)
{ {
auto compiler = new HooCore("1;", "main"); auto compiler = new Compiler("1;", "main");
auto result = compiler->compile(); auto result = compiler->compile();
auto integer = std::any_cast<Node>(result); auto integer = std::any_cast<Node>(result);
ASSERT_EQ(integer.getNodeType(), NODE_LITERAL); ASSERT_EQ(integer.getNodeType(), NODE_LITERAL);