//============================================================================// // // // 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 namespace arti::lang { constexpr size_t CE_TAB_SIZE = 2; static inline constexpr bool isLetter(char c) { return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')); } static inline constexpr char toLower(char c) { if (isLetter(c)) { return (c | 0b00100000); } return c; } static inline constexpr bool isDigit(char c) { return (c >= '0' && c <= '9'); } static inline constexpr bool isFirstIdentChar(char c) { return isLetter(c) || c == '_'; } static inline constexpr bool isIdentChar(char c) { return isLetter(c) || c == '_' || isDigit(c); } static inline constexpr bool isHexChar(char c) { return isDigit(c) || ((toLower(c) >= 'a' && toLower(c) <= 'f')); } static inline constexpr bool isBinaryChar(char c) { return c == '0' || c == '1'; } static inline constexpr bool isOctalChar(char c) { return (c >= '0' && c <= '7'); } static inline constexpr bool isWhiteSpace(char c) { return (c == ' ' || c == '\t' || c == '\n'); } } // namespace arti::lang