From d5ccdcfed4a2ed424bd8b854240d2be4667626df Mon Sep 17 00:00:00 2001 From: antab Date: Mon, 21 Sep 2020 13:34:27 +0200 Subject: [PATCH 1/3] fix(ninja filetype): add subninja and include declarations and fix builddir highlights --- rc/filetype/ninja.kak | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rc/filetype/ninja.kak b/rc/filetype/ninja.kak index 7ed47390..2fb93dec 100644 --- a/rc/filetype/ninja.kak +++ b/rc/filetype/ninja.kak @@ -52,8 +52,8 @@ add-highlighter shared/ninja/command/linebreak regex '\$$' 0:operator add-highlighter shared/ninja/command/variables regex '\$\w+|\$\{\w+\}' 0:value # `build` -add-highlighter shared/ninja/build region '^build' '\n' group -add-highlighter shared/ninja/build/build regex '^build\h+' 0:keyword +add-highlighter shared/ninja/build region '^build ' '\n' group +add-highlighter shared/ninja/build/build regex '^build' 0:keyword add-highlighter shared/ninja/build/rule regex ':\h+(\w+)' 0:function add-highlighter shared/ninja/build/colonpipe regex ':|\||\|\|' 0:operator add-highlighter shared/ninja/build/variables regex '\$\w+|\$\{\w+\}' 0:value @@ -61,13 +61,16 @@ add-highlighter shared/ninja/build/variables regex '\$\w+|\$\{\w+\}' 0:value # variables add-highlighter shared/ninja/variable region '^\h*\w+\h*=' '\n' group add-highlighter shared/ninja/variable/name regex '(\w+)\h*=' 0:variable -# TODO: toplevel builddir is conflicting with build add-highlighter shared/ninja/variable/equal regex '=' 0:operator # `default` add-highlighter shared/ninja/default region '^default' '\n' group add-highlighter shared/ninja/default/default regex '^default' 0:keyword +# `subninja` and `include` +add-highlighter shared/ninja/subinc region '^subninja|include' '\n' group +add-highlighter shared/ninja/subinc/default regex '^subninja|include' 0:module + # `pool` add-highlighter shared/ninja/pool region '^pool' '\n' group add-highlighter shared/ninja/pool/pool regex '^pool' 0:keyword From d0ee3dfe94e3883efb3d2a6efd4808560577887a Mon Sep 17 00:00:00 2001 From: antab Date: Mon, 21 Sep 2020 13:41:19 +0200 Subject: [PATCH 2/3] fix: add subninja and include to static_words --- rc/filetype/ninja.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/ninja.kak b/rc/filetype/ninja.kak index 2fb93dec..b34f09b8 100644 --- a/rc/filetype/ninja.kak +++ b/rc/filetype/ninja.kak @@ -77,7 +77,7 @@ add-highlighter shared/ninja/pool/pool regex '^pool' 0:keyword # keywords/builtin variable names evaluate-commands %sh{ - keywords="rule build command default" + keywords="rule build command default subninja include" reserved_names="builddir ninja_required_version pool depfile deps depfile msvc_deps_prefix description dyndep generator restat rspfile rspfile_content" printf %s " From 737134b993fd1963fdeb40e9e7d61a557c440674 Mon Sep 17 00:00:00 2001 From: antab Date: Tue, 22 Sep 2020 13:49:11 +0200 Subject: [PATCH 3/3] fix: improve regex for build region --- rc/filetype/ninja.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/ninja.kak b/rc/filetype/ninja.kak index b34f09b8..a3da18eb 100644 --- a/rc/filetype/ninja.kak +++ b/rc/filetype/ninja.kak @@ -52,7 +52,7 @@ add-highlighter shared/ninja/command/linebreak regex '\$$' 0:operator add-highlighter shared/ninja/command/variables regex '\$\w+|\$\{\w+\}' 0:value # `build` -add-highlighter shared/ninja/build region '^build ' '\n' group +add-highlighter shared/ninja/build region '^build\b' '\n' group add-highlighter shared/ninja/build/build regex '^build' 0:keyword add-highlighter shared/ninja/build/rule regex ':\h+(\w+)' 0:function add-highlighter shared/ninja/build/colonpipe regex ':|\||\|\|' 0:operator