//============================================================================// // // // 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 . // // // //============================================================================// #pragma once #include #include #include #include #include #include namespace arti::lang::ast { struct SourceLocation { std::size_t line; std::size_t column; }; enum class Mutability { Uninitialized, Mutable, Constant, }; enum class TypeQualifier { Uninitialized, Pointer, Slice, Mutable, Optional, }; enum class PrefixOperator { Uninitialized, Not, Minus, BitNot, MemPtr, DerefPtr, }; enum class InfixOperator { Uninitialized, Modulo, Addition, Substraction, Division, Multiplication, Equal, NotEqual, LessThan, GreaterThan, LessEqual, GreaterEqual, LeftShift, RightShift, BoolAnd, BoolOr, BitAnd, BitOr, BitXor, Assignment, ModuleAccess, MemberAccess, PointerMemberAccess, AdditionAssignment, SubstractionAssignment, MultiplicationAssignment, DivisionAssignment, ModuloAssignment, BitAndAssignment, BitOrAssignment, LShiftAssignment, RShiftAssignment, BoolAndAssignment, BoolOrAssignment, }; enum class PostfixOperator { Uninitialized, FunctionCall, SliceAccess, SliceSize, PtrToSlice, SliceToPtr, Reflect, ObjectLiteral, }; enum class CompoundAssignOperator { Uninitialized, Addition, Substraction, Multiplication, Division, Modulo, BitAnd, BitOr, LeftShift, RightShift, BoolAnd, BoolOr, }; /* Alising of types for consistency */ using Boolean = bool; using String = std::string; template using Ptr = std::unique_ptr; template using Optional = std::optional; template using Variant = std::variant; template using Vector = std::vector; template concept ASTNodePtr = requires { typename Node::element_type; requires std::is_same_v, Node>; }; } // namespace arti::lang::ast