//============================================================================// // // // 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 { enum class TokenV; struct Token { TokenV value; std::size_t line; std::size_t column; std::string_view strValue; }; enum class TokenV { tkEOF, tkString, tkDecimal, tkInteger, tkCharacter, tkIdentifier, opDot, /* . */ opMod, /* % */ opPlus, /* + */ opHyphen, /* - */ opSlash, /* / */ opBang, /* ! */ opStar, /* * */ opColon, /* : */ opComma, /* , */ opAssign, /* = */ opAccess, /* :: */ opSemicolon, /* ; */ opCaret, /* ^ */ opTilde, /* ~ */ opEq, /* == */ opNeq, /* != */ opLt, /* < */ opGt, /* > */ opLtEq, /* <= */ opGtEq, /* >= */ opLShift, /* << */ opRShift, /* >> */ opBoolAnd, /* && */ opBoolOr, /* || */ opAnd, /* & */ opOr, /* | */ opLParen, /* ( */ opRParen, /* ) */ opLBracket, /* [ */ opRBracket, /* ] */ opLSquirly, /* { */ opRSquirly, /* } */ opArrow, /* -> */ opPlusAssign, /* += */ opHyphenAssign, /* -= */ opStarAssign, /* *= */ opSlashAssign, /* /= */ opModAssign, /* %= */ opAndAssign, /* &= */ opOrAssign, /* |= */ opLShiftAssign, /* <<= */ opRShiftAssign, /* >>= */ opBoolAndAssign, /* &&= */ opBoolOrAssign, /* ||= */ opMut, /* $ */ opOpt, /* ? */ opSliceSize, /* .# */ opPtrSlice, /* .[ */ opSlicePtr, /* .* */ opReflect, /* .@ */ opLabel, /* := */ /* Keywords */ kwUnderscore, /* _ */ kwOr, /* or */ kwNot, /* not */ kwAnd, /* and */ kwIf, /* if */ kwElse, /* else */ kwFn, /* fn */ kwEnum, /* enum */ kwStruct, /* struct */ kwDef, /* def */ kwLet, /* let */ kwFor, /* for */ kwLoop, /* loop */ kwBreak, /* break */ kwContinue, /* continue */ kwDo, /* do */ kwWhile, /* while */ kwMatch, /* match */ kwSwitch, /* switch */ kwReturn, /* return */ kwUnreachable, /* unreachable */ kwTypename, /* typename */ kwDefer, /* defer */ kwErrDefer, /* errdefer */ kwTrue, /* true */ kwFalse, /* false */ kwNull, /* null */ kwThis, /* this */ kwImport, /* import */ kwExport, /* export */ kwModule, /* module */ kwUsing, /* using */ }; std::string toString(const Token &value); std::string_view toString(const TokenV &value); } // namespace arti::lang