.
This commit is contained in:
1
.idea/editor.xml
generated
1
.idea/editor.xml
generated
@@ -27,7 +27,6 @@
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SIMPLE_EMBEDDED_STATEMENT_STYLE/@EntryValue" value="LINE_BREAK" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_LINES/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/Generate/=CppEqualityOperators/Options/=GenerateSecondaryOperators/@EntryIndexedValue" value="False" type="string" />
|
||||
<option name="/Default/CodeStyle/Naming/CppNaming/Rules/=Classes_0020and_0020structs/@EntryIndexedValue" value="<NamingElement Priority="1"><Descriptor Static="Indeterminate" Constexpr="Indeterminate" Const="Indeterminate" Volatile="Indeterminate" Accessibility="NOT_APPLICABLE"><type Name="__interface" /><type Name="class" /><type Name="struct" /></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></NamingElement>" type="string" />
|
||||
<option name="/Default/CodeStyle/Naming/CppNaming/Rules/=Concepts/@EntryIndexedValue" value="<NamingElement Priority="2"><Descriptor Static="Indeterminate" Constexpr="Indeterminate" Const="Indeterminate" Volatile="Indeterminate" Accessibility="NOT_APPLICABLE"><type Name="concept" /></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></NamingElement>" type="string" />
|
||||
<option name="/Default/CodeStyle/Naming/CppNaming/Rules/=Enum_0020members/@EntryIndexedValue" value="<NamingElement Priority="14"><Descriptor Static="Indeterminate" Constexpr="Indeterminate" Const="Indeterminate" Volatile="Indeterminate" Accessibility="NOT_APPLICABLE"><type Name="scoped enumerator" /><type Name="unscoped enumerator" /></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></NamingElement>" type="string" />
|
||||
|
||||
@@ -2,13 +2,10 @@
|
||||
|
||||
namespace tyche::as {
|
||||
|
||||
Assembler::Assembler(std::string const& source)
|
||||
ByteArray Assembler::assemble()
|
||||
{
|
||||
lexer_.reset();
|
||||
|
||||
}
|
||||
|
||||
ByteArray Assembler::assemble() const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
@@ -3,15 +3,19 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "lexer.hh"
|
||||
#include "../common/bytearray.hh"
|
||||
|
||||
namespace tyche::as {
|
||||
|
||||
class Assembler {
|
||||
public:
|
||||
explicit Assembler(std::string const& source);
|
||||
explicit Assembler(std::string source) : lexer_(std::move(source)) {}
|
||||
|
||||
[[nodiscard]] ByteArray assemble() const;
|
||||
[[nodiscard]] ByteArray assemble();
|
||||
|
||||
private:
|
||||
Lexer lexer_;
|
||||
};
|
||||
|
||||
} // tyche
|
||||
|
||||
@@ -1,4 +1,20 @@
|
||||
#include "lexer.hh"
|
||||
|
||||
namespace tyche::as {
|
||||
|
||||
void Lexer::reset()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Token Lexer::peek() const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
Token Lexer::ingest()
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
} // tyche
|
||||
|
||||
@@ -1,10 +1,28 @@
|
||||
#ifndef TYCHE_LEXER_HH
|
||||
#define TYCHE_LEXER_HH
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
namespace tyche::as {
|
||||
|
||||
class Lexer {
|
||||
enum class TokenType { Directive, Instruction, Number, Float, String, Enter, EOF_ };
|
||||
|
||||
struct Token {
|
||||
TokenType type;
|
||||
std::string token;
|
||||
};
|
||||
|
||||
class Lexer {
|
||||
public:
|
||||
explicit Lexer(std::string source) : source_(std::move(source)) {}
|
||||
|
||||
void reset();
|
||||
[[nodiscard]] Token peek() const;
|
||||
[[nodiscard]] Token ingest();
|
||||
|
||||
private:
|
||||
std::string source_;
|
||||
};
|
||||
|
||||
} // tyche
|
||||
|
||||
Reference in New Issue
Block a user