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
Visitor.hpp
Visitor.cpp
HooCore.cpp
HooCore.hpp
Compiler.cpp
Compiler.hpp
Node.hpp)
ADD_EXECUTABLE(hoo
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);
_lexer = new HooLexer(_input_stream);
@ -9,7 +9,7 @@ HooCore::HooCore(const std::string &input, const std::string &moduleName) : _inp
_visitor = new Visitor(_moduleName);
}
HooCore::~HooCore()
Compiler::~Compiler()
{
delete _visitor;
delete _parser;
@ -18,7 +18,7 @@ HooCore::~HooCore()
delete _input_stream;
}
std::any HooCore::compile()
std::any Compiler::compile()
{
try
{
@ -42,7 +42,7 @@ std::any HooCore::compile()
}
}
antlr4::tree::ParseTree *HooCore::parse()
antlr4::tree::ParseTree *Compiler::parse()
{
try
{

View File

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

View File

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