# this characters need escaping . ^ $ * + ? { } [ ] \ | ( )
import src.Constants as const

List = [
    (r"\n", const.NEW_LINE, const.NO_INDENTATION),
    (r"\s", None, const.NO_INDENTATION),


    ("\+=", const.OPERATOR, const.NO_INDENTATION),
    ("-=", const.OPERATOR, const.NO_INDENTATION),
    ("\*=", const.OPERATOR, const.NO_INDENTATION),
    ("/=", const.OPERATOR, const.NO_INDENTATION),
    (r"\\=", const.OPERATOR, const.NO_INDENTATION),  # divide integer
    ("<<=", const.OPERATOR, const.NO_INDENTATION),
    (">>=", const.OPERATOR, const.NO_INDENTATION),
    ("<>", const.OPERATOR, const.NO_INDENTATION),
    (">=", const.OPERATOR, const.NO_INDENTATION),
    ("<=", const.OPERATOR, const.NO_INDENTATION),
    (">=", const.OPERATOR, const.NO_INDENTATION),
    ("=>", const.OPERATOR, const.NO_INDENTATION),
    ("=<", const.OPERATOR, const.NO_INDENTATION),

    (">>", const.OPERATOR, const.NO_INDENTATION),
    ("<<", const.OPERATOR, const.NO_INDENTATION),

    (r"\.", const.SPECIAL_OPERATOR, const.NO_INDENTATION),
    (":", const.SPECIAL_OPERATOR, const.NO_INDENTATION),
    (r"\^", const.OPERATOR, const.NO_INDENTATION),
    ("=", const.OPERATOR, const.NO_INDENTATION),
    ("-", const.OPERATOR, const.NO_INDENTATION),
    ("\+", const.OPERATOR, const.NO_INDENTATION),
    ("\*", const.OPERATOR, const.NO_INDENTATION),
    (r"/", const.OPERATOR, const.NO_INDENTATION),
    ("<", const.OPERATOR, const.NO_INDENTATION),
    (">", const.OPERATOR, const.NO_INDENTATION),

    (r"\(", const.BRACKET, const.NO_INDENTATION),
    (r"\)", const.BRACKET, const.NO_INDENTATION),
    (r"\[", const.SQUARE_BRACKET, const.NO_INDENTATION),
    (r"\]", const.SQUARE_BRACKET, const.NO_INDENTATION),

    ("TRUE(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("GETLASTRUNCOMPILEERROR(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("GETLASTRUNRUNTIMEERROR(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("GETGLOBALAA(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("ELSE IF(?:\t*)", const.KEYWORD, const.SPECIAL_INDENTATION),
    ("END IF(?:\t*)", const.KEYWORD, const.DECREMENT_INDENTATION),
    ("EXIT FOR(?:\t*)", const.KEYWORD, const.DECREMENT_INDENTATION),
    ("FOR EACH(?:\t*)", const.KEYWORD, const.INCREMENT_INDENTATION),
    ("END FOR(?:\t*)", const.KEYWORD, const.DECREMENT_INDENTATION),
    ("END WHILE(?:\t*)", const.KEYWORD, const.DECREMENT_INDENTATION),
    ("EXIT WHILE(?:\t*)", const.KEYWORD, const.DECREMENT_INDENTATION),
    ("END FUNCTION(?:\t*)", const.KEYWORD, const.DECREMENT_INDENTATION),
    ("END SUB(?:\t*)", const.KEYWORD, const.DECREMENT_INDENTATION),
    ("LINE_NUM(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("GOTO(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("CREATEOBJECT(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("ELSEIF(?:\t*)", const.KEYWORD, const.SPECIAL_INDENTATION),
    ("ENDIF(?:\t*)", const.KEYWORD, const.DECREMENT_INDENTATION),
    ("ENDWHILE(?:\t*)", const.KEYWORD, const.DECREMENT_INDENTATION),
    ("EXITWHILE(?:\t*)", const.KEYWORD, const.DECREMENT_INDENTATION),
    ("ENDFUNCTION(?:\t*)", const.KEYWORD, const.DECREMENT_INDENTATION),
    ("ENDSUB(?:\t*)", const.KEYWORD, const.DECREMENT_INDENTATION),
    ("OBJFUN(?:\t*)", const.KEYWORD, const.NO_INDENTATION),

    ("IF(?:\t*)", const.KEYWORD, const.INCREMENT_INDENTATION),
    ("THEN(?:\t*)", const.KEYWORD, const.INCREMENT_INDENTATION),
    ("ELSE(?:\t*)", const.KEYWORD, const.SPECIAL_INDENTATION),
    ("FOR(?:\t*)", const.KEYWORD, const.INCREMENT_INDENTATION),
    ("TO(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("STEP(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("INVALID(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("IN(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("WHILE(?:\t*)", const.KEYWORD, const.INCREMENT_INDENTATION),
    ("FUNCTION(?:\t*)", const.KEYWORD, const.INCREMENT_INDENTATION),
    ("AS(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("RETURN(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("PRINT(?:\t*)", const.PRINT_KEYWORD, const.NO_INDENTATION),
    ("DIM(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("END(?:\t*)", const.KEYWORD, const.DECREMENT_INDENTATION),
    ("MOD(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("STOP(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("(AND)(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("BOX(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("EACH(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("EVAL(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("EXIT(?:\t*)", const.KEYWORD, const.DECREMENT_INDENTATION),
    ("FALSE(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("LET(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("NEXT(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("NOT(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("OR(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("POS(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    (r"('|rem)\s*(BSLINT)_(?P<command>[a-z_]+)(:(?P<param>[0-9]+))?.*", const.BSLINT_COMMAND, const.NO_INDENTATION),
    ("('|REM)(.*)", const.COMMENT, const.NO_INDENTATION),
    ("RUN(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("SUB(?:\t*)", const.KEYWORD, const.INCREMENT_INDENTATION),
    ("TAB(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("TYPE(?:\t*)", const.KEYWORD, const.NO_INDENTATION),


    ("MAIN(?:\t*)", const.KEYWORD, const.NO_INDENTATION),
    ("\?", const.PRINT_KEYWORD, const.NO_INDENTATION),

    (r"(?P<value>^[a-z_][a-z0-9_]*)(?P<type>\$|%|!|#|&?)", const.ID, const.NO_INDENTATION),
    ('\"(.*)\"', const.STRING, const.NO_INDENTATION),
    (r"^\d*(\.?\d+){1}", const.NUMERIC, const.NO_INDENTATION)
]
