summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRăzvan C. Rădulescu <razcore.rad@gmail.com>2023-03-20 12:52:23 +0200
committerRăzvan C. Rădulescu <razcore.rad@gmail.com>2023-03-20 12:52:23 +0200
commit0e298ca62ece140e960e78901022a83bb47eade8 (patch)
treeb5a71b11c93a528b4797a510933dc78b44afa5be
parentd6326f609c45f162fbbebe02d9e27ac68b460223 (diff)
Clean up Godot 4.x GDScript highlights & fix const highlight overtaking numbers
-rw-r--r--rc/filetype/gdscript.kak59
1 files changed, 27 insertions, 32 deletions
diff --git a/rc/filetype/gdscript.kak b/rc/filetype/gdscript.kak
index 1dfa2fbc..4047a177 100644
--- a/rc/filetype/gdscript.kak
+++ b/rc/filetype/gdscript.kak
@@ -36,36 +36,42 @@ provide-module gdscript %§
add-highlighter shared/gdscript regions
add-highlighter shared/gdscript/code default-region group
-add-highlighter shared/gdscript/string region -match-capture ("|'|"""|''') (?<!\\)(?:\\\\)*("|'|"""|''') group
+add-highlighter shared/gdscript/string region -match-capture ("|'|"""|''') (?<!\\)(?:\\\\)*("|'|"""|''') group
add-highlighter shared/gdscript/string/ fill string
-add-highlighter shared/gdscript/string/ regex \\[abfnrtv\n\\] 0:meta
-add-highlighter shared/gdscript/string/ regex '%%' 0:meta
-add-highlighter shared/gdscript/string/ regex '%[cs]' 0:value
-add-highlighter shared/gdscript/string/ regex '%0?[+-]?([\d]*|\*?)\.?([\d]*|\*?)[dfoxX]' 0:value
-add-highlighter shared/gdscript/string/ regex '%0?([\d]*|\*?)\.?([\d]*|\*?)[+-]?[dfoxX]' 0:value
+add-highlighter shared/gdscript/string/ regex \\[abfnrtv\n\\] 0:meta
+add-highlighter shared/gdscript/string/ regex '%%' 0:meta
+add-highlighter shared/gdscript/string/ regex '%[cs]' 0:value
+add-highlighter shared/gdscript/string/ regex '%0?[+-]?([\d]*|\*?)\.?([\d]*|\*?)[dfoxX]' 0:value
+add-highlighter shared/gdscript/string/ regex '%0?([\d]*|\*?)\.?([\d]*|\*?)[+-]?[dfoxX]' 0:value
-add-highlighter shared/gdscript/comment region '#' '$' fill comment
+add-highlighter shared/gdscript/comment region '#' $ fill comment
# integers
-add-highlighter shared/gdscript/code/ regex '(?i)\b0b[01]+l?\b' 0:value
-add-highlighter shared/gdscript/code/ regex '(?i)\b0x[\da-f]+l?\b' 0:value
-add-highlighter shared/gdscript/code/ regex '(?i)\b0o?[0-7]+l?\b' 0:value
-add-highlighter shared/gdscript/code/ regex '(?i)\b([1-9]\d*|0)l?\b' 0:value
+add-highlighter shared/gdscript/code/ regex (?i)\b0b[01]+l?\b 0:value
+add-highlighter shared/gdscript/code/ regex (?i)\b0x[\da-f]+l?\b 0:value
+add-highlighter shared/gdscript/code/ regex (?i)\b0o?[0-7]+l?\b 0:value
+add-highlighter shared/gdscript/code/ regex (?i)\b([1-9]\d*|0)l?\b 0:value
# floats
-add-highlighter shared/gdscript/code/ regex '\b\d+[eE][+-]?\d+\b' 0:value
-add-highlighter shared/gdscript/code/ regex '(\b\d+)?\.\d+\b' 0:value
-add-highlighter shared/gdscript/code/ regex '\b\d+\.' 0:value
+add-highlighter shared/gdscript/code/ regex \b\d+[eE][+-]?\d+\b 0:value
+add-highlighter shared/gdscript/code/ regex (\b\d+)?\.\d+\b 0:value
+add-highlighter shared/gdscript/code/ regex \b\d+\. 0:value
# functions
-add-highlighter shared/gdscript/code/ regex _?[a-zA-Z]\w*\s*(?=\() 0:function
-add-highlighter shared/gdscript/code/ regex (?:func\h+)(_?\w+)(?:<[^>]+?>)?\( 1:function
+add-highlighter shared/gdscript/code/ regex _?[a-zA-Z]\w*\s*(?=\() 0:function
+add-highlighter shared/gdscript/code/ regex (?:func\h+)(_?\w+)(?:<[^>]+?>)?\( 1:function
# operators
-add-highlighter shared/gdscript/code/ regex '(?:\+|-|\*|/|%|=|<|>|&|\||\^|~|:=)' 0:operator
+add-highlighter shared/gdscript/code/ regex \+|-|\*|/|%|=|<|>|&|\||\^|~|:= 0:operator
# constants & enums
-add-highlighter shared/gdscript/code/ regex \b[A-Z0-9_]+\b 0:variable
-
-
+add-highlighter shared/gdscript/code/ regex \b[A-Z_][A-Z0-9_]*\b 0:variable
+# annotations
+add-highlighter shared/gdscript/code/ regex @\w+ 0:attribute
+# special case of get =, set =
+add-highlighter shared/gdscript/code/ regex (get)\h*=\h*(\w+) 1:keyword 2:function
+add-highlighter shared/gdscript/code/ regex (set)\h*=\h*(\w+) 1:keyword 2:function
+# nodes
+add-highlighter shared/gdscript/code/ regex \$[\w/]* 0:module
+# keywords and built-ins
evaluate-commands %sh{
- keywords="as await break breakpoint class class const continue elif else enum extends for func if is match name pass return self signal static super var void while"
+ keywords="as await break breakpoint class class_name const continue elif else enum extends for func if is match pass return self signal static super var void while"
values="false true null"
@@ -93,17 +99,6 @@ evaluate-commands %sh{
"
}
-# annotations
-add-highlighter shared/gdscript/code/ regex '@\w+' 0:attribute
-
-# special case of get =, set =
-add-highlighter shared/gdscript/code/ regex (get)\h*=\h*(\w+) 1:keyword 2:function
-add-highlighter shared/gdscript/code/ regex (set)\h*=\h*(\w+) 1:keyword 2:function
-
-# nodes
-add-highlighter shared/gdscript/code/ regex '\$[\w/]*' 0:module
-
-
# Commands
# ‾‾‾‾‾‾‾‾