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”. 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”. diff --git a/Syntaxes/Makefile.plist b/Syntaxes/Makefile.plist index 8bf4a1b..cd367ec 100644 --- a/Syntaxes/Makefile.plist +++ b/Syntaxes/Makefile.plist @@ -9,6 +9,8 @@ GNUmakefile OCamlMakefile + firstLineMatch + ^#![ \\t]*/.*\bmake\b.* name Makefile patterns @@ -17,25 +19,40 @@ include #comment + + include + #variables + include #variable-assignment + + include + #directives + include #recipe include - #directives + #target repository + comma + + match + , + name + punctuation.separator.delimeter.comma.makefile + comment begin - (^[ \t]+)?(?=#) + (^[ ]+)?((?<!\\)(\\\\)*)(?=#) beginCaptures 1 @@ -60,7 +77,7 @@ end - \n + (?=[^\\])$ name comment.line.number-sign.makefile patterns @@ -143,7 +160,7 @@ begin - ^(?:(override)\s*)?(define)\s*([^\s]+)\s*(=|\?=|:=|\+=)?(?=\s) + ^\s*(?:(override)\s*)?(define)\s*([^\s]+)\s*(=|\?=|:=|\+=)?(?=\s) captures 1 @@ -168,7 +185,7 @@ end - ^(endef)\b + ^\s*(endef)\b name meta.scope.conditional.makefile patterns @@ -192,7 +209,7 @@ include - #comment + #directives @@ -281,53 +298,7 @@ begin - ^(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 - ^(endif)\b - name - meta.scope.conditional.makefile - patterns - - - begin - \G(?!\n) - end - ^ - patterns - - - include - #comment - - - - - include - $self - - - - - begin - ^(ifeq|ifneq)(?=\s) + ^\s*(ifeq|ifneq|ifdef|ifndef)(?=\s) captures 1 @@ -337,7 +308,7 @@ end - ^(endif)\b + ^\s*(endif)\b name meta.scope.conditional.makefile patterns @@ -351,6 +322,10 @@ meta.scope.condition.makefile patterns + + include + #comma + include #variables @@ -363,7 +338,7 @@ begin - ^else(?=\s) + ^\s*else(?=\s)\s*(ifeq|ifneq|ifdef|ifndef)*(?=\s) beginCaptures 0 @@ -374,6 +349,21 @@ end ^ + patterns + + + include + #comma + + + include + #variables + + + include + #comment + + include @@ -383,57 +373,7 @@ - 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 - - - - - - recipe + target begin ^(?!\t)([^:]*)(:)(?!\=) @@ -485,7 +425,7 @@ end - ^(?!\t) + [^\\]$ name meta.scope.target.makefile patterns @@ -494,7 +434,7 @@ begin \G end - ^ + (?=[^\\])$ name meta.scope.prerequisites.makefile patterns @@ -521,56 +461,55 @@ + + + recipe + + begin + ^\t([+\-@]*) + beginCaptures + + 1 - begin - ^\t 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 + keyword.control.$1.makefile + + + end + [^\\]$ + name + meta.scope.recipe.makefile + patterns + + + match + \\\n + name + constant.character.escape.continuation.makefile + + + include + #variables variable-assignment begin - (^[ ]*|\G\s*)([^\s]+)\s*(=|\?=|:=|\+=) + (^[ ]*|\G\s*)([^\s:#=]+)\s*((?<![?:+!])=|\?=|:=|\+=|!=) beginCaptures 2 name variable.other.makefile + patterns + + + include + #variables + + 3 @@ -596,6 +535,52 @@ include #variables + + + interpolation + + patterns + + + include + #parentheses-interpolation + + + include + #braces-interpolation + + + + parentheses-interpolation + + begin + \( + end + \) + patterns + + + include + #variables + + + include + #interpolation + + + + braces-interpolation + + begin + { + end + } + patterns + + + include + #variables + include #interpolation @@ -607,22 +592,83 @@ patterns + include + #simple-variable + + + include + #variable-parentheses + + + include + #variable-braces + + + + simple-variable + + patterns + + + match + \$[^(){}] + name + variable.language.makefile + + + + variable-parentheses + + patterns + + + begin + \$\( captures - 1 + 0 name punctuation.definition.variable.makefile - match - (\$?\$)[@%<?^+*] + end + \)|((?<!\\)\n) name - variable.language.makefile + string.interpolated.makefile + patterns + + + include + #variables + + + include + #builtin-variable-parentheses + + + include + #function-variable-parentheses + + + include + #flavor-variable-parentheses + + + include + #another-variable-parentheses + + + + + variable-braces + + patterns + begin - \$?\$\( + \${ captures 0 @@ -632,7 +678,7 @@ end - \) + }|((?<!\\)\n) name string.interpolated.makefile patterns @@ -641,72 +687,259 @@ 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 + #comma + + + include + #variables + + + include + #interpolation + match - \G(MAKEFILES|VPATH|SHELL|MAKESHELL|MAKE|MAKELEVEL|MAKEFLAGS|MAKECMDGOALS|CURDIR|SUFFIXES|\.LIBPATTERNS)(?=\s*\)) + %|\* name - variable.language.makefile + constant.other.placeholder.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 - beginCaptures - - 1 - - name - support.function.$1.makefile - - - end - (?=\)) + match + \\\n name - meta.scope.function-call.makefile - patterns - - - include - #variables - - - match - %|\* - name - constant.other.placeholder.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 - \G(origin|flavor)\s(?=[^\s)]+\s*\)) - contentName - variable.other.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 - \G(?!\)) - end - (?=\)) + include + #comma + + + include + #variables + + + include + #interpolation + + + match + %|\* name - variable.other.makefile - patterns - - - include - #variables - - + 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