diff options
| author | Fuwn <[email protected]> | 2022-07-03 19:44:59 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-07-03 19:44:59 -0700 |
| commit | 9ab0f74aa643dc5d27508e9b2043f0c476f8f928 (patch) | |
| tree | 28865c9003efc06615258a965b1d766386fb8805 /src/node.hh | |
| parent | fix(cli): initialise padding (diff) | |
| download | cait-9ab0f74aa643dc5d27508e9b2043f0c476f8f928.tar.xz cait-9ab0f74aa643dc5d27508e9b2043f0c476f8f928.zip | |
chore(ninja): rename src_dir
Diffstat (limited to 'src/node.hh')
| -rw-r--r-- | src/node.hh | 147 |
1 files changed, 0 insertions, 147 deletions
diff --git a/src/node.hh b/src/node.hh deleted file mode 100644 index cc2362c..0000000 --- a/src/node.hh +++ /dev/null @@ -1,147 +0,0 @@ -// This file is part of Cait <https://github.com/Fuwn/cait>. -// Copyright (C) 2022-2022 Fuwn <[email protected]> -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 3. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see <http://www.gnu.org/licenses/>. -// -// Copyright (C) 2022-2022 Fuwn <[email protected]> -// SPDX-License-Identifier: GPL-3.0-only - -#ifndef NODE_HH -#define NODE_HH - -#include <map> -#include <sstream> -#include <string> -#include <utility> -#include <variant> -#include <vector> - -#include "token.hh" - -namespace cait { - -namespace { - -class stringable { -public: - [[maybe_unused]] stringable() = default; - stringable(const stringable &) = default; - virtual ~stringable() = default; - [[nodiscard]] virtual auto string() const -> std::string = 0; -}; - -} // namespace - -namespace node { - -class variable; -class rule; -class build; -class default_; -class pool; -class include; -class subninja; - -using item_map_type = std::map<std::string, std::vector<token>>; -using node_set = - std::variant<rule, build, default_, variable, pool, include, subninja>; - -class variable : stringable { -private: - const token &_name; - std::vector<token> _value_list; - -public: - variable(const token &, std::vector<token>); - [[nodiscard]] auto string() const -> std::string override; - [[nodiscard]] auto name() const noexcept -> const token &; - [[maybe_unused]] [[nodiscard]] auto value_list() const noexcept - -> const std::vector<token> &; -}; - -class rule : stringable { -private: - const token &_name; - item_map_type _item_map; - -public: - rule(const token &, item_map_type); - [[nodiscard]] auto string() const -> std::string override; - [[nodiscard]] auto name() const noexcept -> const token &; - [[maybe_unused]] [[nodiscard]] auto item_map() const noexcept - -> const item_map_type &; -}; - -class pool : stringable { -private: - const token &_name; - const token &_depth; - -public: - pool(const token &, const token &); - [[nodiscard]] auto string() const -> std::string override; - [[nodiscard]] auto name() const noexcept -> const token &; - [[maybe_unused]] [[nodiscard]] auto depth() const noexcept -> const token &; -}; - -class build : stringable { -private: - const token &_output; - const token &_rule; - std::vector<token> _inputs; - -public: - build(const token &, const token &, std::vector<token>); - [[nodiscard]] auto string() const -> std::string override; - [[maybe_unused]] [[nodiscard]] auto output() const noexcept -> const token &; - [[maybe_unused]] [[nodiscard]] auto rule() const noexcept -> const token &; - [[maybe_unused]] [[nodiscard]] auto inputs() const noexcept - -> const std::vector<token> &; -}; - -class default_ : stringable { -private: - std::vector<token> _targets; - -public: - explicit default_(std::vector<token>); - [[nodiscard]] auto string() const -> std::string override; - [[maybe_unused]] [[nodiscard]] auto targets() const noexcept - -> const std::vector<token> &; -}; - -class include : stringable { -private: - const token &_path; - -public: - explicit include(const token &); - [[nodiscard]] auto string() const -> std::string override; - [[maybe_unused]] [[nodiscard]] auto path() const noexcept -> const token &; -}; - -class subninja : stringable { -private: - const token &_path; - -public: - explicit subninja(const token &); - [[nodiscard]] auto string() const -> std::string override; - [[maybe_unused]] [[nodiscard]] auto path() const noexcept -> const token &; -}; - -} // namespace node - -} // namespace cait - -#endif // NODE_HH |