From 6c44b1719f25cda3e6b3e73035a2f7c06a741357 Mon Sep 17 00:00:00 2001 From: Oleksandr Fadieiev Date: Thu, 20 Jul 2017 17:36:56 +0300 Subject: [PATCH 01/35] Colorize when the expression stays at the beginning of line. --- Syntaxes/Makefile.plist | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index 8bf4a1b..3b3d40c 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -17,6 +17,10 @@ include #comment + + include + #variables + include #variable-assignment From 54daa2d151157050e02a4c666cd46c8418a3ff00 Mon Sep 17 00:00:00 2001 From: Oleksandr Fadieiev Date: Thu, 20 Jul 2017 18:04:09 +0300 Subject: [PATCH 02/35] Fix colorizing of built-in which stands after a common variable, for example, in the expression "var := $(var) $(info Hello!)" the "info" must be colorized. "variable" pattern is $$(....). Replace \G with (?<=\(), which means "get something right after the open brace which is found in the parent pattern". It makes the deal. --- Syntaxes/Makefile.plist | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index 3b3d40c..942cca5 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -647,13 +647,13 @@ match - \G(MAKEFILES|VPATH|SHELL|MAKESHELL|MAKE|MAKELEVEL|MAKEFLAGS|MAKECMDGOALS|CURDIR|SUFFIXES|\.LIBPATTERNS)(?=\s*\)) + (?<=\()(MAKEFILES|VPATH|SHELL|MAKESHELL|MAKE|MAKELEVEL|MAKEFLAGS|MAKECMDGOALS|CURDIR|SUFFIXES|\.LIBPATTERNS)(?=\s*\)) name variable.language.makefile begin - \G(subst|patsubst|strip|findstring|filter(-out)?|sort|word(list)?|firstword|lastword|dir|notdir|suffix|basename|addsuffix|addprefix|join|wildcard|realpath|abspath|info|error|warning|shell|foreach|if|or|and|call|eval|value|file|guile)\s + (?<=\()(subst|patsubst|strip|findstring|filter(-out)?|sort|word(list)?|firstword|lastword|dir|notdir|suffix|basename|addsuffix|addprefix|join|wildcard|realpath|abspath|info|error|warning|shell|foreach|if|or|and|call|eval|value|file|guile)\s beginCaptures 1 @@ -682,7 +682,7 @@ begin - \G(origin|flavor)\s(?=[^\s)]+\s*\)) + (?<=\()(origin|flavor)\s(?=[^\s)]+\s*\)) contentName variable.other.makefile end @@ -699,7 +699,7 @@ begin - \G(?!\)) + (?<=\()(?!\)) end (?=\)) name From 4c354e19cf109735ad1bae1bf134364cd4356120 Mon Sep 17 00:00:00 2001 From: Oleksandr Fadieiev Date: Thu, 20 Jul 2017 18:05:37 +0300 Subject: [PATCH 03/35] Colorize (origin|flavor) at the same way as built-ins. --- Syntaxes/Makefile.plist | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index 942cca5..152eaf1 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -685,6 +685,14 @@ (?<=\()(origin|flavor)\s(?=[^\s)]+\s*\)) contentName variable.other.makefile + beginCaptures + + 1 + + name + support.function.$1.makefile + + end (?=\)) name From 3c1e978bb465ffbf53a36639a69bae99ed047f08 Mon Sep 17 00:00:00 2001 From: Oleksandr Fadieiev Date: Thu, 20 Jul 2017 18:17:56 +0300 Subject: [PATCH 04/35] Handle "\" at the end of prerequisites (the next line should be colorized as a continuation of previous). Previous pattern: search until TAB at the beginning of line. New pattern: search until the line without backslash "\" at the end. The "comment" pattern is fixed as well to continue colorizing until the end without a backslash. The patch is combined because comment could be placed in the recipe pattern with some circumstances. --- Syntaxes/Makefile.plist | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index 152eaf1..5c17162 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -64,7 +64,7 @@ end - \n + (?=[^\\])$ name comment.line.number-sign.makefile patterns @@ -489,7 +489,7 @@ end - ^(?!\t) + [^\\]$ name meta.scope.target.makefile patterns @@ -498,7 +498,7 @@ begin \G end - ^ + (?=[^\\])$ name meta.scope.prerequisites.makefile patterns From a4cae6b2c10224a9244e751288c00496b7c3f5d2 Mon Sep 17 00:00:00 2001 From: Oleksandr Fadieiev Date: Mon, 21 Aug 2017 18:19:11 +0300 Subject: [PATCH 05/35] MIT license is added together with original TextMate license to support contribution to VS Code --- LICENSE.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..6aedd96 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,39 @@ +The MIT License (MIT) + +Copyright (c) Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--- + +The Original TextMate License + +If not otherwise specified (see below), files in this repository +fall under the following license: + +Permission to copy, use, modify, sell and distribute this +software is granted. This software is provided "as is" without +express or implied warranty, and with no claim as to its +suitability for any purpose. + +An exception is made for files in readable text which contain their own license +information, or files where an accompanying file exists (in the same directory) +with a “-license” suffix added to the base-name name of the original file, and an +extension of txt, html, or similar. For example “tidy” is accompanied +by “tidy-license.txt”. From ed4a98e4794099a1dd2c97e45e5b376c0cf69346 Mon Sep 17 00:00:00 2001 From: Oleksandr Fadieiev Date: Mon, 28 Aug 2017 19:53:53 +0300 Subject: [PATCH 06/35] Allow spaces before ifeq, define, endif, endef, else. --- Syntaxes/Makefile.plist | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index 5c17162..39f73b2 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -147,7 +147,7 @@ begin - ^(?:(override)\s*)?(define)\s*([^\s]+)\s*(=|\?=|:=|\+=)?(?=\s) + ^\s*(?:(override)\s*)?(define)\s*([^\s]+)\s*(=|\?=|:=|\+=)?(?=\s) captures 1 @@ -172,7 +172,7 @@ end - ^(endef)\b + ^\s*(endef)\b name meta.scope.conditional.makefile patterns @@ -285,7 +285,7 @@ begin - ^(ifdef|ifndef)\s*([^\s]+)(?=\s) + ^\s*(ifdef|ifndef)\s*([^\s]+)(?=\s) captures 1 @@ -305,7 +305,7 @@ end - ^(endif)\b + ^\s*(endif)\b name meta.scope.conditional.makefile patterns @@ -331,7 +331,7 @@ begin - ^(ifeq|ifneq)(?=\s) + ^\s*(ifeq|ifneq)(?=\s) captures 1 @@ -341,7 +341,7 @@ end - ^(endif)\b + ^\s*(endif)\b name meta.scope.conditional.makefile patterns @@ -367,7 +367,7 @@ begin - ^else(?=\s) + ^\s*else(?=\s) beginCaptures 0 From 6478c6582a94a884f51927c93e02b56a03b68c53 Mon Sep 17 00:00:00 2001 From: Oleksandr Fadieiev Date: Tue, 29 Aug 2017 10:35:33 +0300 Subject: [PATCH 07/35] Handle braces properly inside the variable, e.g. $(shell ()()(())) --- Syntaxes/Makefile.plist | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index 39f73b2..68fcb82 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -437,6 +437,24 @@ + braces-interpolation + + begin + \( + end + \) + patterns + + + include + #variables + + + include + #braces-interpolation + + + recipe begin @@ -672,6 +690,10 @@ include #variables + + include + #braces-interpolation + match %|\* From 5d7cc300988b54a652121f36f7a37ca4f42ebd2a Mon Sep 17 00:00:00 2001 From: north_wind Date: Thu, 31 Aug 2017 23:48:40 +0300 Subject: [PATCH 08/35] Handle back-slash before end-of-line inside the $(variable). --- Syntaxes/Makefile.plist | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index 68fcb82..6190e54 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -654,7 +654,7 @@ end - \) + \)|((?<!\\)\n) name string.interpolated.makefile patterns @@ -681,7 +681,7 @@ end - (?=\)) + (?=\)|((?<!\\)\n)) name meta.scope.function-call.makefile patterns @@ -700,6 +700,12 @@ name constant.other.placeholder.makefile + + match + \\\n + name + constant.character.escape.continuation.makefile + @@ -731,7 +737,7 @@ begin (?<=\()(?!\)) end - (?=\)) + (?=\)|((?<!\\)\n)) name variable.other.makefile patterns @@ -740,6 +746,12 @@ include #variables + + match + \\\n + name + constant.character.escape.continuation.makefile + From 0c8a9d41c12d2872b40d5a58074a059c96968fa7 Mon Sep 17 00:00:00 2001 From: north_wind Date: Thu, 31 Aug 2017 23:52:48 +0300 Subject: [PATCH 09/35] Handle "$$" and special variables. Makefile use the following rule to parse variables: * A dollar sign followed by a character other than a dollar sign, open-parenthesis or open-brace treats that single character as the variable name. $$, $@, $v, $*: highlight as a single variable. $(): highlight as interpolation and parse content inside the braces. $$(): "$$" is highlighted to show it's escaped, but parse content inside braces for convenient representation. --- Syntaxes/Makefile.plist | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index 6190e54..6b23b8c 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -629,22 +629,14 @@ patterns - captures - - 1 - - name - punctuation.definition.variable.makefile - - match - (\$?\$)[@%<?^+*] + \$[^\(\)] name variable.language.makefile begin - \$?\$\( + (\$|(?<=\$))\( captures 0 From 43e1a67476dea3ddefbb4f0ee7901834b31b8bee Mon Sep 17 00:00:00 2001 From: north_wind Date: Fri, 1 Sep 2017 00:30:36 +0300 Subject: [PATCH 10/35] Bugfix: "<" -> "<" --- Syntaxes/Makefile.plist | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index 6b23b8c..18d34ac 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -636,7 +636,7 @@ begin - (\$|(?<=\$))\( + (\$|(?<=\$))\( captures 0 @@ -646,7 +646,7 @@ end - \)|((?<!\\)\n) + \)|((?<!\\)\n) name string.interpolated.makefile patterns @@ -673,7 +673,7 @@ end - (?=\)|((?<!\\)\n)) + (?=\)|((?<!\\)\n)) name meta.scope.function-call.makefile patterns @@ -729,7 +729,7 @@ begin (?<=\()(?!\)) end - (?=\)|((?<!\\)\n)) + (?=\)|((?<!\\)\n)) name variable.other.makefile patterns From 87fa431a4c4662dce5b66f7903ca0d7aaff84f6b Mon Sep 17 00:00:00 2001 From: Alexandr Fadeev Date: Wed, 1 Aug 2018 19:56:35 +0300 Subject: [PATCH 11/35] Support of ${} variables. I've had to add 2 duplicates of variables definition to properly catch $() and ${}. The issue is to be in a catched context: $() or ${}. Common regex aka [)}] doesn't work: it incorrectly catches the cases $(}, or ${), or $(var}xxx), and other complex examples. So, code duplication is the worst thing ever, but seems like there are no better ways currently in TextMate + makefile situation. --- Syntaxes/Makefile.plist | 452 +++++++++++++++++++++++++++++++--------- 1 file changed, 354 insertions(+), 98 deletions(-) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index 18d34ac..c5c3b8b 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -387,7 +387,7 @@ - interpolation + shell-interpolation begin (?=`) @@ -437,24 +437,6 @@ - braces-interpolation - - begin - \( - end - \) - patterns - - - include - #variables - - - include - #braces-interpolation - - - recipe begin @@ -614,6 +596,56 @@ include #comment + + include + #variables + + + include + #shell-interpolation + + + + interpolation + + patterns + + + include + #parentheses-interpolation + + + include + #braces-interpolation + + + + parentheses-interpolation + + begin + \( + end + \) + patterns + + + include + #variables + + + include + #interpolation + + + + braces-interpolation + + begin + { + end + } + patterns + include #variables @@ -625,15 +657,39 @@ variables + + patterns + + + include + #simple-variable + + + include + #variable-parentheses + + + include + #variable-braces + + + + simple-variable patterns match - \$[^\(\)] + \$[^(){}] name variable.language.makefile + + + variable-parentheses + + patterns + begin (\$|(?<=\$))\( @@ -655,96 +711,296 @@ include #variables + + include + #builtin-variable-parentheses + + + include + #function-variable-parentheses + + + include + #flavor-variable-parentheses + + + include + #another-variable-parentheses + + + + + + variable-braces + + patterns + + + begin + (\$|(?<=\$)){ + captures + + 0 + + name + punctuation.definition.variable.makefile + + + end + }|((?<!\\)\n) + name + string.interpolated.makefile + patterns + + + include + #variables + + + include + #builtin-variable-braces + + + include + #function-variable-braces + + + include + #flavor-variable-braces + + + include + #another-variable-braces + + + + + + builtin-variable-parentheses + + patterns + + + match + (?<=\()(MAKEFILES|VPATH|SHELL|MAKESHELL|MAKE|MAKELEVEL|MAKEFLAGS|MAKECMDGOALS|CURDIR|SUFFIXES|\.LIBPATTERNS)(?=\s*\)) + name + variable.language.makefile + + + + builtin-variable-braces + + patterns + + + match + (?<={)(MAKEFILES|VPATH|SHELL|MAKESHELL|MAKE|MAKELEVEL|MAKEFLAGS|MAKECMDGOALS|CURDIR|SUFFIXES|\.LIBPATTERNS)(?=\s*}) + name + variable.language.makefile + + + + function-variable-parentheses + + patterns + + + begin + (?<=\()(subst|patsubst|strip|findstring|filter(-out)?|sort|word(list)?|firstword|lastword|dir|notdir|suffix|basename|addsuffix|addprefix|join|wildcard|realpath|abspath|info|error|warning|shell|foreach|if|or|and|call|eval|value|file|guile)\s + beginCaptures + + 1 + + name + support.function.$1.makefile + + + end + (?=\)|((?<!\\)\n)) + name + meta.scope.function-call.makefile + patterns + + + include + #variables + + + include + #interpolation + match - (?<=\()(MAKEFILES|VPATH|SHELL|MAKESHELL|MAKE|MAKELEVEL|MAKEFLAGS|MAKECMDGOALS|CURDIR|SUFFIXES|\.LIBPATTERNS)(?=\s*\)) + %|\* name - variable.language.makefile + constant.other.placeholder.makefile - begin - (?<=\()(subst|patsubst|strip|findstring|filter(-out)?|sort|word(list)?|firstword|lastword|dir|notdir|suffix|basename|addsuffix|addprefix|join|wildcard|realpath|abspath|info|error|warning|shell|foreach|if|or|and|call|eval|value|file|guile)\s - beginCaptures - - 1 - - name - support.function.$1.makefile - - - end - (?=\)|((?<!\\)\n)) + match + \\\n name - meta.scope.function-call.makefile - patterns - - - include - #variables - - - include - #braces-interpolation - - - match - %|\* - name - constant.other.placeholder.makefile - - - match - \\\n - name - constant.character.escape.continuation.makefile - - + constant.character.escape.continuation.makefile + + + + + function-variable-braces + + patterns + + + begin + (?<={)(subst|patsubst|strip|findstring|filter(-out)?|sort|word(list)?|firstword|lastword|dir|notdir|suffix|basename|addsuffix|addprefix|join|wildcard|realpath|abspath|info|error|warning|shell|foreach|if|or|and|call|eval|value|file|guile)\s + beginCaptures + + 1 - begin - (?<=\()(origin|flavor)\s(?=[^\s)]+\s*\)) - contentName - variable.other.makefile - beginCaptures - - 1 - - name - support.function.$1.makefile - - - end - (?=\)) name - meta.scope.function-call.makefile - patterns - - - include - #variables - - + support.function.$1.makefile + + end + (?=}|((?<!\\)\n)) + name + meta.scope.function-call.makefile + patterns + - begin - (?<=\()(?!\)) - end - (?=\)|((?<!\\)\n)) + include + #variables + + + include + #interpolation + + + match + %|\* name - variable.other.makefile - patterns - - - include - #variables - - - match - \\\n - name - constant.character.escape.continuation.makefile - - + constant.other.placeholder.makefile + + + match + \\\n + name + constant.character.escape.continuation.makefile + + + + + + flavor-variable-parentheses + + patterns + + + begin + (?<=\()(origin|flavor)\s(?=[^\s)]+\s*\)) + contentName + variable.other.makefile + beginCaptures + + 1 + + name + support.function.$1.makefile + + + end + (?=\)) + name + meta.scope.function-call.makefile + patterns + + + include + #variables + + + + + + flavor-variable-braces + + patterns + + + begin + (?<={)(origin|flavor)\s(?=[^\s}]+\s*}) + contentName + variable.other.makefile + beginCaptures + + 1 + + name + support.function.$1.makefile + + + end + (?=}) + name + meta.scope.function-call.makefile + patterns + + + include + #variables + + + + + + another-variable-parentheses + + patterns + + + begin + (?<=\()(?!\)) + end + (?=\)|((?<!\\)\n)) + name + variable.other.makefile + patterns + + + include + #variables + + + match + \\\n + name + constant.character.escape.continuation.makefile + + + + + + another-variable-braces + + patterns + + + begin + (?<={)(?!}) + end + (?=}|((?<!\\)\n)) + name + variable.other.makefile + patterns + + + include + #variables + + + match + \\\n + name + constant.character.escape.continuation.makefile From d94d403d6d31623763a4ff86b656886fa699ef60 Mon Sep 17 00:00:00 2001 From: Alexandr Fadeev Date: Wed, 1 Aug 2018 20:04:59 +0300 Subject: [PATCH 12/35] Remove colorization after $$ at all. --- Syntaxes/Makefile.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index c5c3b8b..46e55e4 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -692,7 +692,7 @@ begin - (\$|(?<=\$))\( + \$\( captures 0 @@ -737,7 +737,7 @@ begin - (\$|(?<=\$)){ + \${ captures 0 From 3d6aeedeca6b532e49354b9ca0ff9dc7b8bea192 Mon Sep 17 00:00:00 2001 From: Alexandr Fadeev Date: Sat, 27 Oct 2018 21:22:19 +0300 Subject: [PATCH 13/35] Recognize '!=' as a variable-assignment operator (issue #2) --- Syntaxes/Makefile.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index 46e55e4..3040efb 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -568,7 +568,7 @@ variable-assignment begin - (^[ ]*|\G\s*)([^\s]+)\s*(=|\?=|:=|\+=) + (^[ ]*|\G\s*)([^\s]+)\s*(=|\?=|:=|\+=|!=) beginCaptures 2 From 6f9294fe261579592ee3753544f6bc9e4b8086bb Mon Sep 17 00:00:00 2001 From: Alexandr Fadeev Date: Sat, 27 Oct 2018 22:02:06 +0300 Subject: [PATCH 14/35] Fix of the variable assignment in a case of no spaces between a variable and value ("var:=value"). Problem: In the sentense kind of "variable:=value" the symbol ':' is highlited as a part of "variable:". Cause: [^\s]+ is catched down to '=', dropping the ':=', '?=' and other cases. Measure: restrict '=' to be a finisher of [^\s]+ in a case of [?:+!] behind one, allowing to select other assign operators. --- Syntaxes/Makefile.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index 3040efb..a523549 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -568,7 +568,7 @@ variable-assignment begin - (^[ ]*|\G\s*)([^\s]+)\s*(=|\?=|:=|\+=|!=) + (^[ ]*|\G\s*)([^\s]+)\s*((?<![?:+!])=|\?=|:=|\+=|!=) beginCaptures 2 From dc361b8c38ee15e3b29618a0afd339564a7b90ca Mon Sep 17 00:00:00 2001 From: Alexandr Fadeev Date: Sat, 27 Oct 2018 22:28:58 +0300 Subject: [PATCH 15/35] The pattern "recipe" is renamed to "target". Cause: Preparing to add the real "recipe" pattern which starts from the TAB symbol. Issue: #1. --- Syntaxes/Makefile.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index a523549..2ff7cc9 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -27,7 +27,7 @@ include - #recipe + #target include @@ -437,7 +437,7 @@ - recipe + target begin ^(?!\t)([^:]*)(:)(?!\=) From c6b3ae6e4f22e01fc483be5bb34a9682c28f3219 Mon Sep 17 00:00:00 2001 From: Alexandr Fadeev Date: Sat, 27 Oct 2018 22:53:50 +0300 Subject: [PATCH 16/35] Correct syntax handling of a hashtag (#) symbols in the recipe. Problem: In the recipe "echo '#'message" hastag and message behind is highlighted as a start of a comment. Cause: 'recipe' patterns are not enabled. Measure: Create a 'recipe' pattern starting with a [\t] symbol. Remove inactive matching. Issue: #1. --- Syntaxes/Makefile.plist | 62 ++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 35 deletions(-) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index 2ff7cc9..5136251 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -29,6 +29,10 @@ include #target + + include + #recipe + include #directives @@ -525,43 +529,31 @@ + + + recipe + + begin + ^\t + end + [^\\]$ + name + meta.scope.recipe.makefile + patterns + - begin - ^\t + match + \\\n name - meta.scope.recipe.makefile - patterns - - - captures - - 0 - - patterns - - - match - \\\n - name - constant.character.escape.continuation.makefile - - - include - #variables - - - include - source.shell - - - - - match - .+\n? - - - while - ^\t + constant.character.escape.continuation.makefile + + + include + #variables + + + include + source.shell From 9e5286ab6851a09bf4199907367553fe98656245 Mon Sep 17 00:00:00 2001 From: Alexandr Fadeev Date: Sun, 23 Dec 2018 22:09:57 +0200 Subject: [PATCH 17/35] Removed shell interpolation inside backquotes ``. Makefile syntax doesn't imply shell inside backquotes ``. --- Syntaxes/Makefile.plist | 54 ----------------------------------------- 1 file changed, 54 deletions(-) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index 5136251..873352d 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -391,56 +391,6 @@ - shell-interpolation - - begin - (?=`) - end - (?!\G) - name - meta.embedded.line.shell - patterns - - - begin - ` - beginCaptures - - 0 - - name - punctuation.definition.string.makefile - - - contentName - source.shell - end - (`) - endCaptures - - 0 - - name - punctuation.definition.string.makefile - - 1 - - name - source.shell - - - name - string.interpolated.backtick.makefile - patterns - - - include - source.shell - - - - - target begin @@ -592,10 +542,6 @@ include #variables - - include - #shell-interpolation - interpolation From db01a60ac016345564219d3fc9f9ef76f4471b2a Mon Sep 17 00:00:00 2001 From: Alexandr Fadeev Date: Sun, 23 Dec 2018 22:46:12 +0200 Subject: [PATCH 18/35] Remove shell interpolation (coloring) in the recipe. Problem: 1. 'source.shell' hides coloring of Makefile variables, which must have a higher priority; 2. incorrect coloring when there is no space before a shell: (a) @echo Test, (b) var!=echo 134 Cause: source.shell catches the context, it doesn't know about Makefile syntax. Measure: Remove source.shell. --- Syntaxes/Makefile.plist | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index 873352d..d8a1d20 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -501,10 +501,6 @@ include #variables - - include - source.shell - variable-assignment From d01ce3404f9e2eed0fd4d07b5e24094c03599241 Mon Sep 17 00:00:00 2001 From: Alexandr Fadeev Date: Sun, 23 Dec 2018 23:43:30 +0200 Subject: [PATCH 19/35] @, - and + handling as prefixes to recipe lines. @ suppresses the normal 'echo' of the command that is executed. - ignores the exit status of the command that is execured. + means to execute command always, even under `make -n`. --- Syntaxes/Makefile.plist | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index d8a1d20..0cf9daa 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -484,7 +484,15 @@ recipe begin - ^\t + ^\t([+-@]*) + beginCaptures + + 1 + + name + keyword.control.$1.makefile + + end [^\\]$ name From 21e9108e9dce13b798667806bb105d852ac0a58c Mon Sep 17 00:00:00 2001 From: Alexandr Fadeev Date: Tue, 5 Feb 2019 11:07:43 +0200 Subject: [PATCH 20/35] Handling a variable expansion in a variable name of assignment: var-$(nested-var) := value --- Syntaxes/Makefile.plist | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index 0cf9daa..6e3a172 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -521,6 +521,13 @@ name variable.other.makefile + patterns + + + include + #variables + + 3 From bd71f44ea55d61be711bd7676e600a7333cc79ea Mon Sep 17 00:00:00 2001 From: Alexandr Fadeev Date: Sat, 13 Apr 2019 19:51:40 +0300 Subject: [PATCH 21/35] Bugfix of " @, - and + handling". Problem: In a recipe "@./some-program" the "." (point) and "/" (slash) are colorized. Cause: regex [@-+] means to colorize "from @ to +". Measure: regex is fixed to [@\-+] to colorize only @,- and +. Test case would be added to Microsoft/vscode. --- Syntaxes/Makefile.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index 6e3a172..8710509 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -484,7 +484,7 @@ recipe begin - ^\t([+-@]*) + ^\t([+\-@]*) beginCaptures 1 From 1b05209b483f81f42270bdda5514590e013e4896 Mon Sep 17 00:00:00 2001 From: tendrils Date: Fri, 24 May 2019 19:08:04 +1200 Subject: [PATCH 22/35] Fix syntax highlighting for nested directives inside define blocks --- Syntaxes/Makefile.plist | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index 8710509..c34ecca 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -202,6 +202,10 @@ include #comment + + include + #directives + From 8b350e4522f97f5fe371dee38d9d9baba2d48e8f Mon Sep 17 00:00:00 2001 From: Tim Hartman Date: Fri, 12 Jul 2019 10:05:35 -0400 Subject: [PATCH 23/35] Fix syntax highlighting of comments with prefixes When a recipe contains a line with only a comment, and a prefix precedes the comment, the highlighting is invalid (the comment is not highlighted as such). This allows comments to appear in recipes. Fixes #4 --- Syntaxes/Makefile.plist | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index c34ecca..53db7b0 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -509,6 +509,10 @@ name constant.character.escape.continuation.makefile + + include + #comment + include #variables From fa280d2f20b0b63dc7c11b6001e9257e2c67f826 Mon Sep 17 00:00:00 2001 From: Alexandr Fadeev Date: Thu, 22 Aug 2019 19:25:26 +0300 Subject: [PATCH 24/35] Revert "Fix syntax highlighting of comments with prefixes" This reverts commit 8b350e4522f97f5fe371dee38d9d9baba2d48e8f. --- Syntaxes/Makefile.plist | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index 53db7b0..c34ecca 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -509,10 +509,6 @@ name constant.character.escape.continuation.makefile - - include - #comment - include #variables From fd57c0552dbe5e4d0c1e6765daea4b296d9bfc59 Mon Sep 17 00:00:00 2001 From: Alexandr Fadeev Date: Tue, 22 Oct 2019 19:44:01 -0700 Subject: [PATCH 25/35] ':', '#', '=' and '\s' are excluded from variable definition according to GNU Make documentation. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It improves highlighting of statements with double '=' like the following: var:=$(val:.c=.o) "A variable name may be any sequence of characters not containing ‘:’, ‘#’, ‘=’, or whitespace." See https://www.gnu.org/software/make/manual/html_node/Using-Variables.html. --- Syntaxes/Makefile.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index c34ecca..8a49f04 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -518,7 +518,7 @@ variable-assignment begin - (^[ ]*|\G\s*)([^\s]+)\s*((?<![?:+!])=|\?=|:=|\+=|!=) + (^[ ]*|\G\s*)([^\s:#=]+)\s*((?<![?:+!])=|\?=|:=|\+=|!=) beginCaptures 2 From e36e02becd20730259b0115d9ca5c419f65023a9 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 4 Jul 2020 10:55:56 +0200 Subject: [PATCH 26/35] Prioritize directives over targets Below line used to be interpreted as Make target with the name "export a ?= b". Treat it as directive since this is what Make does. export a ?= b:c --- Syntaxes/Makefile.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index 8a49f04..b6391f8 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -27,7 +27,7 @@ include - #target + #directives include @@ -35,7 +35,7 @@ include - #directives + #target repository From bb245469e3f4edf81f88d7851047834e2758b351 Mon Sep 17 00:00:00 2001 From: Alexandr Fadeev Date: Sat, 6 Feb 2021 15:06:58 +0200 Subject: [PATCH 27/35] Fix definition of ifdef|ifndef removing a copy-paste. It fixes "Wrong tokenization of 'else' statement for ifdef in Makefile #10". --- Syntaxes/Makefile.plist | 48 +---------------------------------------- 1 file changed, 1 insertion(+), 47 deletions(-) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index b6391f8..d38049a 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -293,53 +293,7 @@ begin - ^\s*(ifdef|ifndef)\s*([^\s]+)(?=\s) - captures - - 1 - - name - keyword.control.$1.makefile - - 2 - - name - variable.other.makefile - - 3 - - name - punctuation.separator.key-value.makefile - - - end - ^\s*(endif)\b - name - meta.scope.conditional.makefile - patterns - - - begin - \G(?!\n) - end - ^ - patterns - - - include - #comment - - - - - include - $self - - - - - begin - ^\s*(ifeq|ifneq)(?=\s) + ^\s*(ifeq|ifneq|ifdef|ifndef)(?=\s) captures 1 From d139ab728f83cc5651e274c5653b2dff11153098 Mon Sep 17 00:00:00 2001 From: fadeevab Date: Sat, 6 Feb 2021 15:19:54 +0200 Subject: [PATCH 28/35] Remove highlighting of comments inside of `define` directive. It fixes "Makefile syntax highlighting partially breaks when a # is in a string #9". --- Syntaxes/Makefile.plist | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index d38049a..5d763a7 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -198,10 +198,6 @@ include #variables - - include - #comment - include #directives From 4d962cab746cc151669e9feb1d635c456d3aa62d Mon Sep 17 00:00:00 2001 From: fadeevab Date: Sat, 6 Feb 2021 15:38:55 +0200 Subject: [PATCH 29/35] Stop highlighting comments in the recipes. It is becuase the comment in the recipe is a part of Shell syntax, not the part of Makefile syntax. It fixes "Makefile: incorrect syntax handling of comments with prefix #4". --- Syntaxes/Makefile.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index 5d763a7..e04318a 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -43,7 +43,7 @@ comment begin - (^[ \t]+)?(?=#) + (^[ ]+)?(?=#) beginCaptures 1 From 91b724d1ad86fa65e4b240a960311a280b92f971 Mon Sep 17 00:00:00 2001 From: fadeevab Date: Sat, 6 Feb 2021 15:42:58 +0200 Subject: [PATCH 30/35] Improve ifdef-else-endif highlighting for the `else` directive. Now the following test case should work: ```make ifdef $(var-in-ifdef) # Comment $(info Good, as expected) # Comment else $(var-can-be-here) # "else" is going to be colozired $(error 'Else' is not expected here) # Comment endif # Comment ``` --- Syntaxes/Makefile.plist | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index e04318a..c0c3caa 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -336,6 +336,17 @@ end ^ + patterns + + + include + #variables + + + include + #comment + + include From fcc4e92f866d568bd53ca0ab17d774479c20fe7e Mon Sep 17 00:00:00 2001 From: Alexander Fadeev Date: Sat, 9 Jul 2022 01:58:16 +0300 Subject: [PATCH 31/35] Add comma separator for function calls and conditions --- Syntaxes/Makefile.plist | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index c0c3caa..b512a7b 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -40,6 +40,13 @@ repository + comma + + match + , + name + punctuation.separator.delimeter.comma.makefile + comment begin @@ -313,6 +320,10 @@ meta.scope.condition.makefile patterns + + include + #comma + include #variables @@ -338,6 +349,10 @@ ^ patterns + + include + #comma + include #variables @@ -735,6 +750,10 @@ meta.scope.function-call.makefile patterns + + include + #comma + include #variables @@ -780,6 +799,10 @@ meta.scope.function-call.makefile patterns + + include + #comma + include #variables From d22ab907c0c8b8e4c5d0af18723d99838cd31490 Mon Sep 17 00:00:00 2001 From: Alexander Fadeev Date: Sat, 9 Jul 2022 03:00:35 +0300 Subject: [PATCH 32/35] Escaping a comment with an odd count of backslashes (\#, \\\#) Problem: "#" means a beginning of a comment in ANY place unless it's escaped How it works: var:=blah#actual_comment var:=blah\#not_a_comment var:=blah\\#actual_comment var:=blah\\\#not_a_comment --- Syntaxes/Makefile.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index b512a7b..6c9cae2 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -50,7 +50,7 @@ comment begin - (^[ ]+)?(?=#) + (^[ ]+)?((?<!\\)(\\\\)*)(?=#) beginCaptures 1 From ef0c485afc66445a6cf184dc34f7744306304f1f Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Fri, 8 Jul 2022 20:22:39 -0400 Subject: [PATCH 33/35] Match `debian/rules` files based on shebang (#13) `debian/rules` files typically start with `#!/usr/bin/make -f` but have a nonstandard filename so they don't match `Makefile`, etc. Co-authored-by: Alexander Fadeev --- Syntaxes/Makefile.plist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index 6c9cae2..54f110f 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -9,6 +9,8 @@ GNUmakefile OCamlMakefile + firstLineMatch + ^#![ \\t]*/.*\bmake\b.* name Makefile patterns From 64fd118c2a9b8ba4f25a7cc01ad61e1b0092721d Mon Sep 17 00:00:00 2001 From: Alexander Fadeev Date: Thu, 18 Aug 2022 21:25:16 +0300 Subject: [PATCH 34/35] A little remark --- README.mdown | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/README.mdown b/README.mdown index 32d8f85..b7258f2 100644 --- a/README.mdown +++ b/README.mdown @@ -1,12 +1,6 @@ -# Installation +# About -You can install this bundle in TextMate by opening the preferences and going to the bundles tab. After installation it will be automatically updated for you. - -# General - -* [Bundle Styleguide](http://kb.textmate.org/bundle_styleguide) — _before you make changes_ -* [Commit Styleguide](http://kb.textmate.org/commit_styleguide) — _before you send a pull request_ -* [Writing Bug Reports](http://kb.textmate.org/writing_bug_reports) — _before you report an issue_ +[fadeevab/make.tmbundle](https://github.com/fadeevab/make.tmbundle) is an _**official upstream**_ of the [Visual Studio Code](https://github.com/microsoft/vscode/) **Makefile** grammar. # License @@ -17,4 +11,4 @@ If not otherwise specified (see below), files in this repository fall under the express or implied warranty, and with no claim as to its suitability for any purpose. -An exception is made for files in readable text which contain their own license information, or files where an accompanying file exists (in the same directory) with a “-license” suffix added to the base-name name of the original file, and an extension of txt, html, or similar. For example “tidy” is accompanied by “tidy-license.txt”. \ No newline at end of file +An exception is made for files in readable text which contain their own license information, or files where an accompanying file exists (in the same directory) with a “-license” suffix added to the base-name name of the original file, and an extension of txt, html, or similar. For example “tidy” is accompanied by “tidy-license.txt”. From 1d4c0b541959995db098df751ffc129da39a294b Mon Sep 17 00:00:00 2001 From: Alexander Fadeev Date: Mon, 9 Jan 2023 20:03:36 +0200 Subject: [PATCH 35/35] Add support of `else ifeq|ifneq|...` conditions --- Syntaxes/Makefile.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index 54f110f..cd367ec 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -338,7 +338,7 @@ begin - ^\s*else(?=\s) + ^\s*else(?=\s)\s*(ifeq|ifneq|ifdef|ifndef)*(?=\s) beginCaptures 0