GdScriptEdit.gd 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. class_name GdScriptEdit
  2. extends CodeEdit
  3. const keywords: Array[String] = [
  4. # Comparison
  5. "<", # LESS,
  6. "<=", # LESS_EQUAL,
  7. ">", # GREATER,
  8. ">=", # GREATER_EQUAL,
  9. "==", # EQUAL_EQUAL,
  10. "!=", # BANG_EQUAL,
  11. # Logical
  12. "and", # AND,
  13. "or", # OR,
  14. "not", # NOT,
  15. "&&", # AMPERSAND_AMPERSAND,
  16. "||", # PIPE_PIPE,
  17. "!", # BANG,
  18. # Bitwise
  19. "&", # AMPERSAND,
  20. "|", # PIPE,
  21. "~", # TILDE,
  22. "^", # CARET,
  23. "<<", # LESS_LESS,
  24. ">>", # GREATER_GREATER,
  25. # Math
  26. "+", # PLUS,
  27. "-", # MINUS,
  28. "*", # STAR,
  29. "**", # STAR_STAR,
  30. "/", # SLASH,
  31. "%", # PERCENT,
  32. # Assignment
  33. "=", # EQUAL,
  34. "+=", # PLUS_EQUAL,
  35. "-=", # MINUS_EQUAL,
  36. "*=", # STAR_EQUAL,
  37. "**=", # STAR_STAR_EQUAL,
  38. "/=", # SLASH_EQUAL,
  39. "%=", # PERCENT_EQUAL,
  40. "<<=", # LESS_LESS_EQUAL,
  41. ">>=", # GREATER_GREATER_EQUAL,
  42. "&=", # AMPERSAND_EQUAL,
  43. "|=", # PIPE_EQUAL,
  44. "^=", # CARET_EQUAL,
  45. # Control flow
  46. "if", # IF,
  47. "elif", # ELIF,
  48. "else", # ELSE,
  49. "for", # FOR,
  50. "while", # WHILE,
  51. "break", # BREAK,
  52. "continue", # CONTINUE,
  53. "pass", # PASS,
  54. "return", # RETURN,
  55. "match", # MATCH,
  56. # Keywords
  57. "as", # AS,
  58. "assert", # ASSERT,
  59. "await", # AWAIT,
  60. "breakpoint", # BREAKPOINT,
  61. "class", # CLASS,
  62. "class_name", # CLASS_NAME,
  63. "const", # CONST,
  64. "enum", # ENUM,
  65. "extends", # EXTENDS,
  66. "func", # FUNC,
  67. "in", # IN,
  68. "is", # IS,
  69. "namespace", # NAMESPACE
  70. "preload", # PRELOAD,
  71. "self", # SELF,
  72. "signal", # SIGNAL,
  73. "static", # STATIC,
  74. "super", # SUPER,
  75. "trait", # TRAIT,
  76. "var", # VAR,
  77. "void", # VOID,
  78. "yield", # YIELD,
  79. # Punctuation
  80. "[", # BRACKET_OPEN,
  81. "]", # BRACKET_CLOSE,
  82. "{", # BRACE_OPEN,
  83. "}", # BRACE_CLOSE,
  84. "(", # PARENTHESIS_OPEN,
  85. ")", # PARENTHESIS_CLOSE,
  86. ",", # COMMA,
  87. ";", # SEMICOLON,
  88. ".", # PERIOD,
  89. "..", # PERIOD_PERIOD,
  90. ":", # COLON,
  91. "$", # DOLLAR,
  92. "->", # FORWARD_ARROW,
  93. ]
  94. func _ready() -> void:
  95. const keywords_color = Color(1.0, 0, 0)
  96. var gd_syntax_highlight = SyntaxHighlighter.new()
  97. var dict_keyword = {};
  98. for keyword in keywords:
  99. #dict_keyword.put(keyword, keywords_color)
  100. #set_syntax_highlighter(gd_syntax_highlight)