from enum import Enum, auto


class TokenType(Enum):
    # basic values
    IDENTIFIER = auto()
    NUMBER = auto()
    STRING = auto()

    # language elements
    KEYWORD = auto()
    OPERATOR = auto()

    # punctuation
    LPAREN = auto()  # (
    RPAREN = auto()  # )
    LBRACE = auto()  # {
    RBRACE = auto()  # }
    LBRACKET = auto()  # [
    RBRACKET = auto()  # ]
    COMMA = auto()  # ,
    SEMICOLON = auto()  # ;
    COLON = auto()  # :
    DOT = auto()  # .

    # end of file
    EOF = auto()


class Token:
    """
    Represents a single token produced by the lexer.
    """

    def __init__(self, type_, value=None, line=1, column=1):
        self.type = type_
        self.value = value
        self.line = line
        self.column = column

    def __repr__(self):
        if self.value is not None:
            return f"{self.type.name}({self.value})"
        return f"{self.type.name}"


# Marathi keywords used in Prasad language
KEYWORDS = {
    "jar",  # if
    "nahitar",  # else
    "nahi_tar_jar",  # else-if (alias)
    "nahitar_jar",  # else-if (alias)
    "kam",  # function
    "karya",  # function (alias)
    "parat",  # return
    "dakhav",  # print
    "sathi",  # for
    "joparyant",  # while
    "vichar",  # input
    "lih",  # write
    "wacha",  # read
    "ho",  # true
    "nahi",  # false
    "khara",  # true (alias)
    "khota",  # false (alias)
    "kahi",  # null
    "naste",  # undefined
    "kiwa",  # or
    "aani",  # and
    "navhe",  # not
    "todu",  # break
    "pudhe",  # continue
    "add",  # push
    "kadha",  # pop
    "taka",  # append
    "lamba",  # length
    "lambi",  # length
    "vastu",  # object
    "chaabi",  # key
    "mool",  # value
    "prayatna",  # try
    "pakad",  # catch
    "shevati",  # finally
    "feka",  # throw
    "ghya",  # import
    "dya",  # export
    "varg",  # class
    "navin",  # new
    "swataha",  # this
    "waras",  # extends
    "suru",  # constructor
    "mukhya",  # main
    "sod",  # delete
    "thamba",  # pause
    "war",  # wait
    "jod",  # join
    "tulna",  # compare
    "bagha",  # evaluate
    "paratav",  # repeat
    "aaram",  # sleep
    "prakash",  # debug
    "dhara",  # const
    "ghatak",  # module
    "suchi",  # list
    "ganit",  # math
}
