From 88bb854f36b385e2b2217a25d416de8cf1eb5ef2 Mon Sep 17 00:00:00 2001 From: Caleb Heuer Date: Sat, 17 Dec 2022 00:10:08 -0700 Subject: [PATCH 1/4] Improve Go highlighting --- rc/filetype/go.kak | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/rc/filetype/go.kak b/rc/filetype/go.kak index af5a7a86..194c51d7 100644 --- a/rc/filetype/go.kak +++ b/rc/filetype/go.kak @@ -50,7 +50,9 @@ add-highlighter shared/go/single_string region "'" (?|<|>=|<=|&|&&|\|\||!|<-|:=)" 1:operator evaluate-commands %sh{ # Grammar @@ -69,12 +71,11 @@ evaluate-commands %sh{ # Highlight keywords printf %s " - add-highlighter shared/go/code/ regex \b($(join "${keywords}" '|'))\b 0:keyword - add-highlighter shared/go/code/ regex \b($(join "${attributes}" '|'))\b 0:attribute - add-highlighter shared/go/code/ regex \b($(join "${types}" '|'))\b 0:type - add-highlighter shared/go/code/ regex \b($(join "${values}" '|'))\b 0:value - add-highlighter shared/go/code/ regex \b($(join "${functions}" '|'))\b 0:builtin - add-highlighter shared/go/code/ regex := 0:attribute + add-highlighter shared/go/code/keyword regex \b($(join "${keywords}" '|'))\b 0:keyword + add-highlighter shared/go/code/attribute regex \b($(join "${attributes}" '|'))\b 0:attribute + add-highlighter shared/go/code/type regex \b($(join "${types}" '|'))\b 0:type + add-highlighter shared/go/code/value regex \b($(join "${values}" '|'))\b 0:value + add-highlighter shared/go/code/builtin regex \b($(join "${functions}" '|'))\b 0:builtin " } From 6148a16a0ec5d077362defb89d29abea0440aa84 Mon Sep 17 00:00:00 2001 From: Caleb Heuer Date: Wed, 11 Jan 2023 21:40:51 -0700 Subject: [PATCH 2/4] Add spread operator --- rc/filetype/go.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/go.kak b/rc/filetype/go.kak index 194c51d7..0d7011f1 100644 --- a/rc/filetype/go.kak +++ b/rc/filetype/go.kak @@ -52,7 +52,7 @@ add-highlighter shared/go/comment_line region '//' $ fill comment add-highlighter shared/go/code/identifier regex %{-?([0-9]*\.(?!0[xX]))?\b([0-9]+|0[xX][0-9a-fA-F]+)\.?([eE][+-]?[0-9]+)?i?\b} 0:value add-highlighter shared/go/code/function regex "\b(\w*)\b[ ]*\(" 1:function -add-highlighter shared/go/code/operator regex "(\+|-|\*|/|%|\+\+|--|\+=|-=|\*=|/=|%=|==|!=|>|<|>=|<=|&|&&|\|\||!|<-|:=)" 1:operator +add-highlighter shared/go/code/operator regex "(\+|-|\*|/|%|\+\+|--|\+=|-=|\*=|/=|%=|==|!=|>|<|>=|<=|&|&&|\|\||!|<-|:=|\.\.\.)" 1:operator evaluate-commands %sh{ # Grammar From c338efe078832d4348d8ba56f2a05d1815fa1722 Mon Sep 17 00:00:00 2001 From: Caleb Heuer Date: Sun, 3 Sep 2023 11:10:11 -0600 Subject: [PATCH 3/4] Support generics in function highlighting --- rc/filetype/go.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/go.kak b/rc/filetype/go.kak index 0d7011f1..470d4e9c 100644 --- a/rc/filetype/go.kak +++ b/rc/filetype/go.kak @@ -51,7 +51,7 @@ add-highlighter shared/go/comment region /\* \*/ fill comment add-highlighter shared/go/comment_line region '//' $ fill comment add-highlighter shared/go/code/identifier regex %{-?([0-9]*\.(?!0[xX]))?\b([0-9]+|0[xX][0-9a-fA-F]+)\.?([eE][+-]?[0-9]+)?i?\b} 0:value -add-highlighter shared/go/code/function regex "\b(\w*)\b[ ]*\(" 1:function +add-highlighter shared/go/code/function regex "\b(\w*)\b\h*(?:\[[\w\s\.,]*\])?\h*\(" 1:function add-highlighter shared/go/code/operator regex "(\+|-|\*|/|%|\+\+|--|\+=|-=|\*=|/=|%=|==|!=|>|<|>=|<=|&|&&|\|\||!|<-|:=|\.\.\.)" 1:operator evaluate-commands %sh{ From 142925fc9027dc89ced4868a6aed5ccb9bd0f76e Mon Sep 17 00:00:00 2001 From: Caleb Heuer Date: Wed, 6 Sep 2023 12:24:06 -0600 Subject: [PATCH 4/4] This is numerics, not identifiers --- rc/filetype/go.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/go.kak b/rc/filetype/go.kak index 470d4e9c..ef5fa62e 100644 --- a/rc/filetype/go.kak +++ b/rc/filetype/go.kak @@ -50,7 +50,7 @@ add-highlighter shared/go/single_string region "'" (?|<|>=|<=|&|&&|\|\||!|<-|:=|\.\.\.)" 1:operator