Format with clang
This commit is contained in:
@@ -2,24 +2,19 @@
|
||||
#include <string>
|
||||
#include <token/token.hpp>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace Compile
|
||||
{
|
||||
class Compiler
|
||||
{
|
||||
private:
|
||||
std::unordered_map<std::string, std::size_t> jumpLabelLocations;
|
||||
std::vector<std::pair<Token::Token, std::size_t>> unresolvedJumpLabels;
|
||||
class Compiler {
|
||||
private:
|
||||
std::unordered_map<std::string, std::size_t> jumpLabelLocations;
|
||||
std::vector<std::pair<Token::Token, std::size_t>> unresolvedJumpLabels;
|
||||
|
||||
void InsertAsBytes(
|
||||
Token::Token const & token,
|
||||
std::vector<std::uint8_t> & bytes);
|
||||
void InsertAsBytes(Token::Token const & token, std::vector<std::uint8_t> & bytes);
|
||||
|
||||
public:
|
||||
bool Compile(
|
||||
std::vector<Token::Token> const & tokens,
|
||||
std::vector<std::uint8_t> & bytes);
|
||||
};
|
||||
public:
|
||||
bool Compile(std::vector<Token::Token> const & tokens, std::vector<std::uint8_t> & bytes);
|
||||
};
|
||||
}
|
||||
@@ -4,25 +4,24 @@
|
||||
|
||||
namespace Compile
|
||||
{
|
||||
class CompilationError
|
||||
{
|
||||
public:
|
||||
Token::Token errorToken;
|
||||
class CompilationError {
|
||||
public:
|
||||
Token::Token errorToken;
|
||||
|
||||
CompilationError(std::string const & message, Token::Token const & token);
|
||||
CompilationError(std::string const & message, Token::Token const & token);
|
||||
|
||||
static CompilationError CreateExpectedArgumentError(Token::Token const & token);
|
||||
static CompilationError CreateExpectedLabelError(Token::Token const & token);
|
||||
static CompilationError CreateExpectedImmediateError(Token::Token const & token);
|
||||
static CompilationError CreateExpectedImmediateOrRegisterOrMemory(Token::Token const & token);
|
||||
static CompilationError CreateExpectedRegisterError(Token::Token const & token);
|
||||
static CompilationError CreateExpectedRegisterOrMemoryError(Token::Token const & token);
|
||||
static CompilationError CreateExpectedArgumentError(Token::Token const & token);
|
||||
static CompilationError CreateExpectedLabelError(Token::Token const & token);
|
||||
static CompilationError CreateExpectedImmediateError(Token::Token const & token);
|
||||
static CompilationError CreateExpectedImmediateOrRegisterOrMemory(Token::Token const & token);
|
||||
static CompilationError CreateExpectedRegisterError(Token::Token const & token);
|
||||
static CompilationError CreateExpectedRegisterOrMemoryError(Token::Token const & token);
|
||||
|
||||
static CompilationError CreateExpectedOperandError(Token::Token const & token);
|
||||
static CompilationError CreateTooManyArgumentsError(Token::Token const & token);
|
||||
static CompilationError CreateTooFewArgumentsError(Token::Token const & token);
|
||||
static CompilationError CreateExpectedEndOfStatementError(Token::Token const & token);
|
||||
static CompilationError CreateDuplicateLabelError(Token::Token const & token);
|
||||
static CompilationError CreateNonExistingLabelError(Token::Token const & token);
|
||||
};
|
||||
static CompilationError CreateExpectedOperandError(Token::Token const & token);
|
||||
static CompilationError CreateTooManyArgumentsError(Token::Token const & token);
|
||||
static CompilationError CreateTooFewArgumentsError(Token::Token const & token);
|
||||
static CompilationError CreateExpectedEndOfStatementError(Token::Token const & token);
|
||||
static CompilationError CreateDuplicateLabelError(Token::Token const & token);
|
||||
static CompilationError CreateNonExistingLabelError(Token::Token const & token);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user