mirror of
https://github.com/PashaBibko/LX.git
synced 2026-04-03 17:39:02 +00:00
Fixed Unexpected Token crashing the process
This commit is contained in:
@@ -71,11 +71,10 @@ namespace LX
|
||||
{
|
||||
GENERATE_LX_ERROR_REQUIRED_FUNCTION_DECLARATIONS;
|
||||
|
||||
UnexpectedToken(Token::TokenType _expected, std::string _override, Token _got);
|
||||
UnexpectedToken(Token::TokenType _expected, std::string _override, Token _got, const std::filesystem::path& _file);
|
||||
|
||||
//
|
||||
static std::string* s_Source;
|
||||
static std::filesystem::path* s_SourceFile;
|
||||
const std::filesystem::path file;
|
||||
|
||||
// The token type that should be there //
|
||||
Token::TokenType expected;
|
||||
@@ -143,7 +142,7 @@ namespace LX
|
||||
};
|
||||
|
||||
// Turns the tokens of a file into it's abstract syntax tree equivalent //
|
||||
FileAST TurnTokensIntoAbstractSyntaxTree(std::vector<Token>& tokens);
|
||||
FileAST TurnTokensIntoAbstractSyntaxTree(std::vector<Token>& tokens, const std::filesystem::path& path);
|
||||
|
||||
// Turns an abstract binary tree into LLVM intermediate representation //
|
||||
void GenerateIR(FileAST& ast, const std::string& name, const std::filesystem::path& IRPath);
|
||||
|
||||
@@ -29,7 +29,7 @@ extern "C" int __declspec(dllexport) GenIR(const char* a_inpPath, const char* a_
|
||||
std::vector<LX::Token>tokens = LX::LexicalAnalyze(inpPath);
|
||||
|
||||
// Turns the tokens into an AST //
|
||||
LX::FileAST AST = LX::TurnTokensIntoAbstractSyntaxTree(tokens);
|
||||
LX::FileAST AST = LX::TurnTokensIntoAbstractSyntaxTree(tokens, inpPath);
|
||||
|
||||
// Turns the AST into LLVM IR //
|
||||
LX::GenerateIR(AST, inpPath.filename().string(), outPath);
|
||||
@@ -72,7 +72,7 @@ extern "C" int __declspec(dllexport) GenIR(const char* a_inpPath, const char* a_
|
||||
std::cout << "An error occured. Please report this on the github page.\n" << std::endl;
|
||||
std::cout << e.what() << std::endl;
|
||||
|
||||
// Exit code -1 means an undefined error //
|
||||
// Exit code -1 means an undefined error // But this isn't undefined and neither is LX::RuntimeError?
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user