Signed-off-by: erick-alcachofa <erick@artichoke.dev> - Create lib/include/artichoke/Util/Common.hpp for shared types. - Migrate SourceLocation, Mutability, and TypeQualifier from AST. - Update Parser and AST files to use unified aliases (Ptr, Vector, etc.). - Clean up includes across the Parser module.
80 lines
2.6 KiB
C++
80 lines
2.6 KiB
C++
//============================================================================//
|
|
// //
|
|
// artichoke programming language //
|
|
// //
|
|
// Copyright (C) 2025 Erick Saul Guzman Ramos, whoami.artichoke.dev //
|
|
// //
|
|
// //
|
|
// This program is free software: you can redistribute it and/or modify //
|
|
// it under the terms of the GNU Affero General Public License as published //
|
|
// by the Free Software Foundation, either version 3 of the License, or //
|
|
// (at your option) any later version. //
|
|
// //
|
|
// 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 Affero General Public License for more details. //
|
|
// //
|
|
// You should have received a copy of the GNU Affero General Public License //
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>. //
|
|
// //
|
|
//============================================================================//
|
|
|
|
#pragma once
|
|
|
|
#include <vector>
|
|
#include <string>
|
|
#include <memory>
|
|
#include <variant>
|
|
#include <optional>
|
|
#include <unordered_map>
|
|
|
|
namespace arti::lang {
|
|
|
|
/* Alising of types for consistency */
|
|
|
|
struct SourceLocation {
|
|
std::size_t line;
|
|
std::size_t column;
|
|
};
|
|
|
|
using Boolean = bool;
|
|
using String = std::string;
|
|
|
|
template <typename T>
|
|
using Ptr = std::shared_ptr<T>;
|
|
|
|
template <typename T>
|
|
using SharedPtr = std::shared_ptr<T>;
|
|
|
|
template <typename T>
|
|
using WeakPtr = std::weak_ptr<T>;
|
|
|
|
template <typename T>
|
|
using Optional = std::optional<T>;
|
|
|
|
template <typename... T>
|
|
using Variant = std::variant<T...>;
|
|
|
|
template <typename T>
|
|
using Vector = std::vector<T>;
|
|
|
|
template <typename K, typename V>
|
|
using HashMap = std::unordered_map<K, V>;
|
|
|
|
enum class Mutability {
|
|
Uninitialized,
|
|
Mutable,
|
|
Constant,
|
|
};
|
|
|
|
enum class TypeQualifier {
|
|
Uninitialized,
|
|
Pointer,
|
|
Slice,
|
|
Mutable,
|
|
Optional,
|
|
};
|
|
|
|
}
|