55 lines
1.2 KiB
C++
55 lines
1.2 KiB
C++
/// AUTOGENERATED COPYRIGHT HEADER START
|
|
// Copyright (C) 2017-2024 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
|
|
// AUTOGENERATED COPYRIGHT HEADER END
|
|
#pragma once
|
|
#include <filesystem>
|
|
#include "ast/ast.hpp"
|
|
#include "lexer.hpp"
|
|
|
|
namespace blitz {
|
|
class parser {
|
|
std::filesystem::path _file;
|
|
|
|
public:
|
|
~parser();
|
|
parser(std::filesystem::path file);
|
|
};
|
|
} // namespace blitz
|
|
|
|
/*
|
|
#include <fstream>
|
|
#include <map>
|
|
#include <memory>
|
|
#include <stack>
|
|
#include <string>
|
|
#include "ast/value.hpp"
|
|
#include "lexer.hpp"
|
|
|
|
namespace blitz {
|
|
class parser {
|
|
public:
|
|
parser(std::string file);
|
|
~parser();
|
|
|
|
std::unique_ptr<ast::expression> parse();
|
|
|
|
protected:
|
|
void log(const char* msg, ...);
|
|
void log_error(const char* msg, ...);
|
|
|
|
private:
|
|
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::tokentype token, std::string value);
|
|
std::unique_ptr<ast::DecimalExpression> parse_decimal(blitz::lexer::tokentype token, std::string value);
|
|
|
|
private:
|
|
lexer m_lexer;
|
|
std::stack<std::pair<std::string, std::shared_ptr<std::istream>>> m_files;
|
|
|
|
};
|
|
}
|
|
*/
|