Update makefile colorize tests according to the latest grammar. (#61961)

1. Handling the '!=' variable assignment operator.
2. Handling the "#" (hashtag) in the quotes inside the recipe.
3. Restore the recipe handling.

Issue: #60030, #61475
This commit is contained in:
Alexandr Fadeev 2018-11-06 13:55:25 +02:00 committed by Alex Ross
parent 755c02a3ab
commit e99942ccc3
2 changed files with 743 additions and 0 deletions

View file

@ -25,10 +25,16 @@ hello.o: hello.cpp \
clean:
rm *o hello
.PHONY: all
all:
# "$$" in a shell means to escape makefile's variable substitution.
some_shell_var=$$(sed -nre 's/some regex with (group)/\1/p')
.PHONY: echo
echo:
echo "#" and '#' in quotes are not comments \
and '\' will be continued
define defined
$(info Checking existance of $(1) $(flavor $(1)))
$(if $(filter undefined,$(flavor $(1))),0,1)
@ -54,3 +60,14 @@ ifeq ("${ok}", "skip")
$(ok))}
${ok}})
endif
result != echo "'$(ok)' $(shell echo "from inlined shell")"
$(info $(result))
# Below is a test of variable assignment without any spacing.
var=val
var?=val
var:=123
var!=echo val
var:=val \
notvar=butval

View file

@ -714,6 +714,39 @@
"hc_black": "default: #FFFFFF"
}
},
{
"c": ".PHONY",
"t": "source.makefile meta.scope.target.makefile support.function.target.PHONY.makefile",
"r": {
"dark_plus": "support.function: #DCDCAA",
"light_plus": "support.function: #795E26",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "support.function: #DCDCAA"
}
},
{
"c": ":",
"t": "source.makefile meta.scope.target.makefile punctuation.separator.key-value.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": " all",
"t": "source.makefile meta.scope.target.makefile meta.scope.prerequisites.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "all",
"t": "source.makefile meta.scope.target.makefile entity.name.function.target.makefile",
@ -857,6 +890,270 @@
"hc_black": "default: #FFFFFF"
}
},
{
"c": ".PHONY",
"t": "source.makefile meta.scope.target.makefile support.function.target.PHONY.makefile",
"r": {
"dark_plus": "support.function: #DCDCAA",
"light_plus": "support.function: #795E26",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "support.function: #DCDCAA"
}
},
{
"c": ":",
"t": "source.makefile meta.scope.target.makefile punctuation.separator.key-value.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": " echo",
"t": "source.makefile meta.scope.target.makefile meta.scope.prerequisites.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "echo",
"t": "source.makefile meta.scope.target.makefile entity.name.function.target.makefile",
"r": {
"dark_plus": "entity.name.function: #DCDCAA",
"light_plus": "entity.name.function: #795E26",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "entity.name.function: #DCDCAA"
}
},
{
"c": ":",
"t": "source.makefile meta.scope.target.makefile punctuation.separator.key-value.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "\t",
"t": "source.makefile meta.scope.recipe.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "echo",
"t": "source.makefile meta.scope.recipe.makefile support.function.builtin.shell",
"r": {
"dark_plus": "support.function: #DCDCAA",
"light_plus": "support.function: #795E26",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "support.function: #DCDCAA"
}
},
{
"c": " ",
"t": "source.makefile meta.scope.recipe.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "\"",
"t": "source.makefile meta.scope.recipe.makefile string.quoted.double.shell punctuation.definition.string.begin.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "#",
"t": "source.makefile meta.scope.recipe.makefile string.quoted.double.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "\"",
"t": "source.makefile meta.scope.recipe.makefile string.quoted.double.shell punctuation.definition.string.end.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": " and ",
"t": "source.makefile meta.scope.recipe.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "'",
"t": "source.makefile meta.scope.recipe.makefile string.quoted.single.shell punctuation.definition.string.begin.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "#",
"t": "source.makefile meta.scope.recipe.makefile string.quoted.single.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "'",
"t": "source.makefile meta.scope.recipe.makefile string.quoted.single.shell punctuation.definition.string.end.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": " ",
"t": "source.makefile meta.scope.recipe.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "in",
"t": "source.makefile meta.scope.recipe.makefile keyword.control.shell",
"r": {
"dark_plus": "keyword.control: #C586C0",
"light_plus": "keyword.control: #AF00DB",
"dark_vs": "keyword.control: #569CD6",
"light_vs": "keyword.control: #0000FF",
"hc_black": "keyword.control: #C586C0"
}
},
{
"c": " quotes are not comments ",
"t": "source.makefile meta.scope.recipe.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "\\",
"t": "source.makefile meta.scope.recipe.makefile constant.character.escape.continuation.makefile",
"r": {
"dark_plus": "constant.character.escape: #D7BA7D",
"light_plus": "constant.character.escape: #FF0000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "constant.character: #569CD6"
}
},
{
"c": "\t\tand ",
"t": "source.makefile meta.scope.recipe.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "'",
"t": "source.makefile meta.scope.recipe.makefile string.quoted.single.shell punctuation.definition.string.begin.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "\\",
"t": "source.makefile meta.scope.recipe.makefile string.quoted.single.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "'",
"t": "source.makefile meta.scope.recipe.makefile string.quoted.single.shell punctuation.definition.string.end.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": " will be continued",
"t": "source.makefile meta.scope.recipe.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "define",
"t": "source.makefile meta.scope.conditional.makefile keyword.control.define.makefile",
@ -2286,5 +2583,434 @@
"light_vs": "keyword.control: #0000FF",
"hc_black": "keyword.control: #C586C0"
}
},
{
"c": "result",
"t": "source.makefile variable.other.makefile",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE"
}
},
{
"c": " ",
"t": "source.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "!=",
"t": "source.makefile punctuation.separator.key-value.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": " echo \"'",
"t": "source.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "$(",
"t": "source.makefile string.interpolated.makefile punctuation.definition.variable.makefile",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "ok",
"t": "source.makefile string.interpolated.makefile variable.other.makefile",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "variable: #9CDCFE"
}
},
{
"c": ")",
"t": "source.makefile string.interpolated.makefile punctuation.definition.variable.makefile",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "' ",
"t": "source.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "$(",
"t": "source.makefile string.interpolated.makefile punctuation.definition.variable.makefile",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "shell",
"t": "source.makefile string.interpolated.makefile meta.scope.function-call.makefile support.function.shell.makefile",
"r": {
"dark_plus": "support.function: #DCDCAA",
"light_plus": "support.function: #795E26",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "support.function: #DCDCAA"
}
},
{
"c": " echo \"from inlined shell\"",
"t": "source.makefile string.interpolated.makefile meta.scope.function-call.makefile",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": ")",
"t": "source.makefile string.interpolated.makefile punctuation.definition.variable.makefile",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "\"",
"t": "source.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "$(",
"t": "source.makefile string.interpolated.makefile punctuation.definition.variable.makefile",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "info",
"t": "source.makefile string.interpolated.makefile meta.scope.function-call.makefile support.function.info.makefile",
"r": {
"dark_plus": "support.function: #DCDCAA",
"light_plus": "support.function: #795E26",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "support.function: #DCDCAA"
}
},
{
"c": " ",
"t": "source.makefile string.interpolated.makefile meta.scope.function-call.makefile",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "$(",
"t": "source.makefile string.interpolated.makefile meta.scope.function-call.makefile string.interpolated.makefile punctuation.definition.variable.makefile",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "result",
"t": "source.makefile string.interpolated.makefile meta.scope.function-call.makefile string.interpolated.makefile variable.other.makefile",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "variable: #9CDCFE"
}
},
{
"c": ")",
"t": "source.makefile string.interpolated.makefile meta.scope.function-call.makefile string.interpolated.makefile punctuation.definition.variable.makefile",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": ")",
"t": "source.makefile string.interpolated.makefile punctuation.definition.variable.makefile",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "#",
"t": "source.makefile comment.line.number-sign.makefile punctuation.definition.comment.makefile",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " Below is a test of variable assignment without any spacing.",
"t": "source.makefile comment.line.number-sign.makefile",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": "var",
"t": "source.makefile variable.other.makefile",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE"
}
},
{
"c": "=",
"t": "source.makefile punctuation.separator.key-value.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "val",
"t": "source.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "var",
"t": "source.makefile variable.other.makefile",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE"
}
},
{
"c": "?=",
"t": "source.makefile punctuation.separator.key-value.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "val",
"t": "source.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "var",
"t": "source.makefile variable.other.makefile",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE"
}
},
{
"c": ":=",
"t": "source.makefile punctuation.separator.key-value.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "123",
"t": "source.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "var",
"t": "source.makefile variable.other.makefile",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE"
}
},
{
"c": "!=",
"t": "source.makefile punctuation.separator.key-value.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "echo val",
"t": "source.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "var",
"t": "source.makefile variable.other.makefile",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE"
}
},
{
"c": ":=",
"t": "source.makefile punctuation.separator.key-value.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "val ",
"t": "source.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "\\",
"t": "source.makefile constant.character.escape.continuation.makefile",
"r": {
"dark_plus": "constant.character.escape: #D7BA7D",
"light_plus": "constant.character.escape: #FF0000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "constant.character: #569CD6"
}
},
{
"c": "notvar=butval",
"t": "source.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
}
]