Compiles on UNIX based systems

This commit is contained in:
2025-07-21 19:57:05 +01:00
parent d6568a8d2f
commit cde435ba55
9 changed files with 65 additions and 28 deletions

View File

@@ -11,10 +11,10 @@ namespace LXC::Lexer
// Trackers for the Lexer itself //
const std::string& source;
__int32 index;
uint32_t index;
LexerOutput out;
const __int32 len;
const uint32_t len;
// Trackers for where the Lexer is within the user version of source //
unsigned short column;
@@ -32,7 +32,7 @@ namespace LXC::Lexer
};
// Constructor to pass arguments through to the struct //
LexerError(Reason _reason, __int32 errorIndex, std::string _info = "")
LexerError(Reason _reason, uint32_t errorIndex, std::string _info = "")
: reason(_reason), index(errorIndex), info(_info)
{}
@@ -51,7 +51,7 @@ namespace LXC::Lexer
// Error information //
const Reason reason;
const __int32 index;
const uint32_t index;
const std::string info;
};

View File

@@ -83,11 +83,20 @@ namespace LXC::Lexer
};
// Util function calculating wether a token is of a given class //
template<TokenClass::ClassMask mask> static constexpr bool IsTypeClass(TokenType type) { return type & mask; }
template<TokenClass::ClassMask mask> static constexpr bool IsTypeClass(Token token) { return token.type & mask; }
template<TokenClass::ClassMask mask> static constexpr bool IsTypeClass(TokenType type)
{
using T = std::underlying_type_t<TokenType>;
return static_cast<T>(type) & static_cast<T>(mask);
}
template<TokenClass::ClassMask mask> static constexpr bool IsTypeClass(Token token)
{
using T = std::underlying_type_t<TokenType>;
return static_cast<T>(token.type) & static_cast<T>(mask);
}
// Constructor to set the data of the token for more complex token types //
Token(const LexerContext& ctx, unsigned __int32 start, unsigned short len, TokenType _type);
Token(const LexerContext& ctx, uint32_t start, unsigned short len, TokenType _type);
// Deconstructor to clean up the allocated memory //
~Token();
@@ -105,7 +114,7 @@ namespace LXC::Lexer
const unsigned short length;
// Start index of the token //
const unsigned __int32 index;
const uint32_t index;
private:
// The data of the token //