2024-06-25 18:59:15 +02:00
|
|
|
/// AUTOGENERATED COPYRIGHT HEADER START
|
|
|
|
|
// Copyright (C) 2017-2024 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
|
|
|
|
|
// AUTOGENERATED COPYRIGHT HEADER END
|
2017-11-13 02:16:17 +01:00
|
|
|
#pragma once
|
2024-06-26 00:31:06 +02:00
|
|
|
#include <filesystem>
|
2025-01-25 16:27:50 +01:00
|
|
|
#include <memory>
|
2024-06-06 13:37:13 +02:00
|
|
|
#include "ast/ast.hpp"
|
2024-06-26 00:31:06 +02:00
|
|
|
#include "lexer.hpp"
|
|
|
|
|
|
|
|
|
|
namespace blitz {
|
|
|
|
|
class parser {
|
2025-01-25 16:27:50 +01:00
|
|
|
std::filesystem::path _file;
|
|
|
|
|
std::shared_ptr<blitz::lexer> _lexer;
|
2024-06-26 00:31:06 +02:00
|
|
|
|
2025-01-25 16:27:50 +01:00
|
|
|
std::shared_ptr<blitz::ast::node> _expr;
|
2017-11-13 02:16:17 +01:00
|
|
|
|
|
|
|
|
public:
|
2024-06-06 14:04:34 +02:00
|
|
|
~parser();
|
2025-01-25 16:27:50 +01:00
|
|
|
parser(std::filesystem::path file);
|
2017-11-13 02:16:17 +01:00
|
|
|
|
2025-01-25 16:27:50 +01:00
|
|
|
std::shared_ptr<blitz::ast::node> current();
|
|
|
|
|
std::shared_ptr<blitz::ast::node> next();
|
2017-11-13 02:16:17 +01:00
|
|
|
|
|
|
|
|
private:
|
2025-01-25 16:27:50 +01:00
|
|
|
std::shared_ptr<blitz::ast::node> try_parse(blitz::token token);
|
|
|
|
|
std::shared_ptr<blitz::ast::node> try_parse_variable();
|
2017-11-13 02:16:17 +01:00
|
|
|
};
|
2025-01-25 16:27:50 +01:00
|
|
|
} // namespace blitz
|