/*!
    @file src/Token/Token.cpp
    @brief Token实现
    @author PuqiAR (im@puqiar.top)
    @date 2026-02-14
*/
#include <Token/Token.hpp>

namespace Fig
{
    const HashMap<String, TokenType> Token::punctMap = {
        // 三字符
        {String("..."), TokenType::TripleDot},
        // 双字符
        {String("=="), TokenType::Equal},
        {String("!="), TokenType::NotEqual},
        {String("<="), TokenType::LessEqual},
        {String(">="), TokenType::GreaterEqual},
        {String("<<"), TokenType::ShiftLeft},
        {String(">>"), TokenType::ShiftRight},
        {String("+="), TokenType::PlusEqual},
        {String("-="), TokenType::MinusEqual},
        {String("*="), TokenType::AsteriskEqual},
        {String("/="), TokenType::SlashEqual},
        {String("%="), TokenType::PercentEqual},
        {String("^="), TokenType::CaretEqual},
        {String("++"), TokenType::DoublePlus},
        {String("--"), TokenType::DoubleMinus},
        {String("&&"), TokenType::DoubleAmpersand},
        {String("||"), TokenType::DoublePipe},
        {String(":="), TokenType::Walrus},
        {String("**"), TokenType::Power},
        {String("->"), TokenType::RightArrow},
        {String("=>"), TokenType::DoubleArrow},

        // 单字符
        {String("+"), TokenType::Plus},
        {String("-"), TokenType::Minus},
        {String("*"), TokenType::Asterisk},
        {String("/"), TokenType::Slash},
        {String("%"), TokenType::Percent},
        {String("^"), TokenType::Caret},
        {String("&"), TokenType::Ampersand},
        {String("|"), TokenType::Pipe},
        {String("~"), TokenType::Tilde},
        {String("="), TokenType::Assign},
        {String("<"), TokenType::Less},
        {String(">"), TokenType::Greater},
        {String("."), TokenType::Dot},
        {String(","), TokenType::Comma},
        {String(":"), TokenType::Colon},
        {String(";"), TokenType::Semicolon},
        {String("'"), TokenType::SingleQuote},
        {String("\""), TokenType::DoubleQuote},
        {String("("), TokenType::LeftParen},
        {String(")"), TokenType::RightParen},
        {String("["), TokenType::LeftBracket},
        {String("]"), TokenType::RightBracket},
        {String("{"), TokenType::LeftBrace},
        {String("}"), TokenType::RightBrace},
        {String("?"), TokenType::Question},
        {String("!"), TokenType::Not},
    };

    const HashMap<String, TokenType> Token::keywordMap{
        {String("and"), TokenType::And},
        {String("or"), TokenType::Or},
        {String("not"), TokenType::Not},
        {String("import"), TokenType::Import},
        {String("func"), TokenType::Function},
        {String("var"), TokenType::Variable},
        {String("const"), TokenType::Const},
        // {String("final"), TokenType::Final},
        {String("while"), TokenType::While},
        {String("for"), TokenType::For},
        {String("if"), TokenType::If},
        {String("else"), TokenType::Else},
        {String("new"), TokenType::New},
        {String("struct"), TokenType::Struct},
        {String("interface"), TokenType::Interface},
        {String("impl"), TokenType::Implement},
        {String("is"), TokenType::Is},
        {String("public"), TokenType::Public},
        {String("return"), TokenType::Return},
        {String("break"), TokenType::Break},
        {String("continue"), TokenType::Continue},
        {String("try"), TokenType::Try},
        {String("catch"), TokenType::Catch},
        {String("throw"), TokenType::Throw},
        {String("Finally"), TokenType::Finally},
        {String("as"), TokenType::As},
        {String("true"), TokenType::LiteralTrue},
        {String("false"), TokenType::LiteralFalse},
        {String("null"), TokenType::LiteralNull},
    };
}; // namespace Fig