Skip to content
Permalink
Browse files
Makefile: Use standard token names correctly (#3227)
  • Loading branch information
RunDevelopment committed Dec 7, 2021
1 parent b58cd72 commit 21a3c2d75555d16a4107722e6aec016ce44a461f
@@ -8,27 +8,27 @@ Prism.languages.makefile = {
greedy: true
},

// Built-in target names
'builtin': /\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,
'builtin-target': {
pattern: /\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,
alias: 'builtin'
},

// Targets
'symbol': {
'target': {
pattern: /^(?:[^:=\s]|[ \t]+(?![\s:]))+(?=\s*:(?!=))/m,
alias: 'symbol',
inside: {
'variable': /\$+(?:(?!\$)[^(){}:#=\s]+|(?=[({]))/
}
},
'variable': /\$+(?:(?!\$)[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,

'keyword': [
// Directives
/-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,
// Functions
{
pattern: /(\()(?:abspath|addsuffix|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:list|s)?)(?=[ \t])/,
lookbehind: true
}
],
// Directives
'keyword': /-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,

'function': {
pattern: /(\()(?:abspath|addsuffix|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:list|s)?)(?=[ \t])/,
lookbehind: true
},
'operator': /(?:::|[?:+!])?=|[|@]/,
'punctuation': /[:;(){}]/
};

Some generated files are not rendered by default. Learn more.

@@ -0,0 +1,15 @@
.PHONY:
.DELETE_ON_ERROR:
.SECONDEXPANSION:

----------------------------------------------------

[
["builtin-target", ".PHONY"], ["punctuation", ":"],
["builtin-target", ".DELETE_ON_ERROR"], ["punctuation", ":"],
["builtin-target", ".SECONDEXPANSION"], ["punctuation", ":"]
]

----------------------------------------------------

Checks for built-in target names.

This file was deleted.

@@ -0,0 +1,226 @@
(abspath foo)
(addsuffix foo)
(and foo)
(basename foo)
(call foo)
(dir foo)
(error foo)
(eval foo)
(file foo)
(filter foo)
(filter-out foo)
(findstring foo)
(firstword foo)
(flavor foo)
(foreach foo)
(guile foo)
(if foo)
(info foo)
(join foo)
(lastword foo)
(load foo)
(notdir foo)
(or foo)
(origin foo)
(patsubst foo)
(realpath foo)
(shell foo)
(sort foo)
(strip foo)
(subst foo)
(suffix foo)
(value foo)
(warning foo)
(wildcard foo)
(word foo)
(wordlist foo)
(words foo)

----------------------------------------------------

[
["punctuation", "("],
["function", "abspath"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "addsuffix"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "and"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "basename"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "call"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "dir"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "error"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "eval"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "file"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "filter"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "filter-out"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "findstring"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "firstword"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "flavor"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "foreach"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "guile"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "if"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "info"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "join"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "lastword"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "load"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "notdir"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "or"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "origin"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "patsubst"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "realpath"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "shell"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "sort"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "strip"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "subst"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "suffix"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "value"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "warning"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "wildcard"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "word"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "wordlist"],
" foo",
["punctuation", ")"],

["punctuation", "("],
["function", "words"],
" foo",
["punctuation", ")"]
]

0 comments on commit 21a3c2d

Please sign in to comment.