# # Token types "TT"
# SMSL_TT_HEADER                 = 'TT_HEADER'
# SMSL_TT_SBCONTAINER_LEFT       = 'TT_CONTAINER_SB_LEFT'
# SMSL_TT_SBCONTAINER_RIGHT      = 'TT_CONTAINER_SB_RIGHT'
# SMSL_TT_STATECONTAINER_LEFT    = 'TT_CONTAINER_STATE_LEFT'
# SMSL_TT_STATECONTAINER_RIGHT   = 'TT_CONTAINER_STATE_RIGHT'
# SMSL_TT_OPPOINTING             = 'TT_OP_POINTING'
# SMSL_TT_COMMENT                = 'TT_COMMENT'
# SMSL_TT_ASSIGN                 = 'TT_ASSIGN'
# SMSL_TT_IDENTIFIER             = 'TT_IDENTIFIER'

TT_INT				= 'INT'
TT_FLOAT    	= 'FLOAT'
TT_STRING			= 'STRING'
TT_IDENTIFIER	= 'IDENTIFIER'
TT_KEYWORD		= 'KEYWORD'
TT_PLUS     	= 'PLUS'
TT_MINUS    	= 'MINUS'
TT_MUL      	= 'MUL'
TT_DIV      	= 'DIV'
TT_POW				= 'POW'
TT_EQ					= 'EQ'
TT_LPAREN   	= 'LPAREN'
TT_RPAREN   	= 'RPAREN'
TT_LSQUARE    = 'LSQUARE'
TT_RSQUARE    = 'RSQUARE'
TT_EE					= 'EE'
TT_NE					= 'NE'
TT_LT					= 'LT'
TT_GT					= 'GT'
TT_LTE				= 'LTE'
TT_GTE				= 'GTE'
TT_COMMA			= 'COMMA'
TT_ARROW			= 'ARROW'
TT_NEWLINE		= 'NEWLINE'
TT_EOF				= 'EOF'

KEYWORDS = [
    'VAR',
    'AND',
    'OR',
    'NOT',
    'IF',
    'ELIF',
    'ELSE',
    'FOR',
    'TO',
    'STEP',
    'WHILE',
    'FUN',
    'THEN',
    'END',
    'RETURN',
    'CONTINUE',
    'BREAK',
]

class Token:
    def __init__(self, type_, value=None, pos_start=None, pos_end=None):
        self.type = type_
        self.value = value

        if pos_start:
            self.pos_start = pos_start.copy()
            self.pos_end = pos_start.copy()
            self.pos_end.advance()

        if pos_end:
            self.pos_end = pos_end.copy()

    def matches(self, type_, value):
        return self.type == type_ and self.value == value
    
    def __repr__(self):
        if self.value: return f'{self.type}:{self.value}'
        return f'{self.type}'
