Extract preprocessing from tokenizer
This commit is contained in:
21
include/preprocessor/preprocessor.hpp
Normal file
21
include/preprocessor/preprocessor.hpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class Preprocessor
|
||||
{
|
||||
private:
|
||||
std::vector<std::string> substitutionIdentifiers;
|
||||
std::vector<std::string> substitutionValues;
|
||||
|
||||
void extractComment(std::string & line,
|
||||
std::size_t const lineNumber,
|
||||
std::size_t const lineColumn);
|
||||
|
||||
void processLine(std::string & line, std::size_t const lineNumber);
|
||||
|
||||
public:
|
||||
void process(std::vector<std::string> & lines);
|
||||
|
||||
void printSubstitutions() const;
|
||||
};
|
||||
@@ -15,11 +15,6 @@ namespace Token
|
||||
int const lineNumber,
|
||||
int const lineColumn) const;
|
||||
|
||||
void ParseComment(
|
||||
std::string const & string,
|
||||
int const lineNumber,
|
||||
int const lineColumn);
|
||||
|
||||
void ParseCharacterLiteral(
|
||||
std::string const & line,
|
||||
int const lineNumber,
|
||||
|
||||
6
include/utils.hpp
Normal file
6
include/utils.hpp
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
namespace Utils
|
||||
{
|
||||
bool isWhitespaceCharacter(char const c);
|
||||
}
|
||||
@@ -9,12 +9,15 @@ class Wassembler
|
||||
private:
|
||||
Configuration config;
|
||||
Execute::VirtualMachine vm;
|
||||
bool printSubstitutions;
|
||||
|
||||
bool LoadLinesFromFile(std::string const & filePath, std::vector<std::string> & lines) const;
|
||||
bool LoadTokens(std::vector<std::string> const & lines, std::vector<Token::Token> & tokens) const;
|
||||
|
||||
public:
|
||||
void SetMemorySize(unsigned const size);
|
||||
void EnableSubstitutionsLogging();
|
||||
|
||||
bool LoadFromFile(std::string const & filePath);
|
||||
|
||||
void Run();
|
||||
|
||||
Reference in New Issue
Block a user