#pragma once
#include "node.h"
#include "snake.h"
#include <stdint.h>

// Unhighlighted

#define SYM_AMP 23
#define SYM_DOUBLE_AMP 78
#define SYM_AMP_DOT 59
#define SYM_GT 82
#define SYM_LT 26
#define SYM_DOUBLE_LT 79
#define SYM_STAR 20
#define SYM_DOUBLE_STAR 21
#define SYM_ADD 84
#define SYM_ADD_EQU 60
#define SYM_COMMA 16
#define SYM_MINUS 97
#define SYM_MINUS_GT 127
#define SYM_MINUS_EQU 61
#define SYM_MINUS_AT 99
#define SYM_DOT 11
#define SYM_DOUBLE_DOT 48
#define SYM_TRIPLE_DOT 19
#define SYM_SLASH 85
#define SYM_SEMICOLON 18
#define SYM_EQU 15
#define SYM_identifier 1
#define SYM_LSQUARE_BRACE 44
#define SYM_SQUARE_BRACES 101
#define SYM_SQUARE_BRACES_EQU 102
#define SYM_RSQUARE_BRACE 45
#define SYM_POWER 52
#define SYM_PIPE 17
#define SYM_DOUBLE_PIPE 77
#define SYM_DOUBLE_PIPE_EQU 65

// RED

#define SYM_INTERPOLATION_START 124
#define SYM_NOT 95
#define SYM_QUESTION 73
#define SYM_COLON 24
#define SYM_STR_SYMBOL_START 132
#define SYM_BEGIN 4
#define SYM_class_variable 121
#define SYM_END 7
#define SYM_false 116
#define SYM_global_variable 122
#define SYM_hash_key_symbol 150
#define SYM_heredoc_beginning 142
#define SYM_heredoc_end 141
#define SYM_RCURLY 6
#define SYM_LCURLY 5
#define SYM_instance_variable 120
#define SYM_simple_symbol 130

#define SYM_IS_RED(sym)                                                        \
  (sym == 124 || sym == 95 || sym == 73 || sym == 24 || sym == 132 ||          \
   sym == 4 || sym == 121 || sym == 7 || sym == 116 || sym == 122 ||           \
   sym == 150 || sym == 142 || sym == 141 || sym == 6 || sym == 5 ||           \
   sym == 120 || sym == 130)

// GREEN

#define SYM_STR_START 131
#define SYM_P_I_BRACE_START 136
#define SYM_P_W_BRACE_START 135
#define SYM_BRACE_START 9
#define SYM_BRACE_END 10
#define SYM_string_content 138
#define SYM_heredoc_content 139
#define SYM_yield 29
#define SYM_true 115

#define SYM_IS_GREEN(sym)                                                      \
  (sym == 131 || sym == 136 || sym == 135 || sym == 9 || sym == 10 ||          \
   sym == 138 || sym == 139 || sym == 29 || sym == 115)

// YELLOW

#define SYM_begin 56
#define SYM_case 41
#define SYM_def 8
#define SYM_do 40
#define SYM_else 54
#define SYM_elsif 53
#define SYM_end 13
#define SYM_for 38
#define SYM_redo 32
#define SYM_unless 35
#define SYM_until 37
#define SYM_when 42
#define SYM_while 36
#define SYM_if 34
#define SYM_then 55
#define SYM_module 27
#define SYM_class 25

#define SYM_IS_YELLOW(sym)                                                     \
  (sym == 56 || sym == 41 || sym == 8 || sym == 40 || sym == 54 ||             \
   sym == 53 || sym == 13 || sym == 38 || sym == 32 || sym == 35 ||            \
   sym == 37 || sym == 42 || sym == 36 || sym == 34 || sym == 55 ||            \
   sym == 27 || sym == 25)

// BLUE

#define SYM_ensure 57
#define SYM_rescue 14
#define SYM_nil 22
#define SYM_return 28
#define SYM_float 109

#define SYM_IS_BLUE(sym)                                                       \
  (sym == 57 || sym == 14 || sym == 22 || sym == 28 || sym == 109)

// CYAN

#define SYM_alias 106
#define SYM_break 30
#define SYM_retry 33
#define SYM_escape_sequence 126

#define SYM_IS_CYAN(sym) (sym == 106 || sym == 30 || sym == 33 || sym == 126)

// ORANGE

#define SYM_constant 117
#define SYM_integer 108

#define SYM_IS_ORANGE(sym) (sym == 117 || sym == 108)

// PURPLE

#define SYM_self 114
#define SYM_super 113

#define SYM_IS_PURPLE(sym) (sym == 114 || sym == 113)

// ITALIC

#define SYM_LT_EQU 81
#define SYM_GT_EQU 83
#define SYM_EQU_GT 43
#define SYM_DOUBLE_EQU 87
#define SYM_TRIPLE_EQU 89

#define SYM_IS_ITALIC(sym)                                                     \
  (sym == 81 || sym == 83 || sym == 43 || sym == 87 || sym == 89)

// DARK & ITALIC

#define SYM_comment 107

#define SYM_IS_DARK_ITALIC(sym) (sym == 107)

void symbol_colorify(int symbol, const Color **fg, uint8_t *flags);
