summaryrefslogtreecommitdiff
path: root/cait/context.hh
diff options
context:
space:
mode:
Diffstat (limited to 'cait/context.hh')
-rw-r--r--cait/context.hh47
1 files changed, 47 insertions, 0 deletions
diff --git a/cait/context.hh b/cait/context.hh
new file mode 100644
index 0000000..f42555d
--- /dev/null
+++ b/cait/context.hh
@@ -0,0 +1,47 @@
+// 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 CONTEXT_HH
+#define CONTEXT_HH
+
+#include <map>
+#include <optional>
+#include <string>
+
+#include "parser.hh"
+#include "token.hh"
+
+namespace cait {
+
+class context {
+private:
+ std::map<std::pair<std::string, token_type>, node::node_set> identifiers;
+ [[maybe_unused]] std::size_t jobs;
+
+public:
+ explicit context(const parser &);
+ [[maybe_unused]] auto variable(const std::string &)
+ -> std::optional<node::variable>;
+ [[maybe_unused]] auto rule(const std::string &) -> std::optional<node::rule>;
+ [[maybe_unused]] auto build(const std::string &)
+ -> std::optional<node::build>;
+};
+
+} // namespace cait
+
+#endif // CONTEXT_HH