Latest stuff, rewriting lexer

This commit is contained in:
Michael Fabian 'Xaymar' Dirks
2024-06-25 18:59:15 +02:00
parent 7f669f55e2
commit fa81c2a7fa
23 changed files with 1263 additions and 310 deletions
+11 -8
View File
@@ -1,3 +1,6 @@
/// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2017-2024 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#pragma once
#include "lexer.hpp"
#include "ast/ast.hpp"
@@ -14,22 +17,22 @@ namespace blitz {
parser(std::string file);
~parser();
std::unique_ptr<AST::Expression> Parse();
std::unique_ptr<ast::expression> parse();
protected:
void LogMessage(const char* msg, ...);
void LogError(const char* msg, ...);
void log(const char* msg, ...);
void log_error(const char* msg, ...);
private:
std::pair<blitz::Lexer::Token, std::string> GetNextToken();
std::pair<blitz::lexer::tokentype, std::string> next();
private:
std::unique_ptr<AST::Expression> parse_expression();
std::unique_ptr<AST::NumberExpression> parse_number(blitz::Lexer::Token token, std::string value);
std::unique_ptr<AST::DecimalExpression> parse_decimal(blitz::Lexer::Token token, std::string value);
std::unique_ptr<ast::expression> parse_expression();
std::unique_ptr<ast::NumberExpression> parse_number(blitz::lexer::tokentype token, std::string value);
std::unique_ptr<ast::DecimalExpression> parse_decimal(blitz::lexer::tokentype token, std::string value);
private:
Lexer m_lexer;
lexer m_lexer;
std::stack<std::pair<std::string, std::shared_ptr<std::istream>>> m_files;
};