main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
2.1 KB
|
Line | |
---|
1 | /*
|
---|
2 | Language: Makefile
|
---|
3 | Author: Ivan Sagalaev <maniac@softwaremaniacs.org>
|
---|
4 | Contributors: Joël Porquet <joel@porquet.org>
|
---|
5 | Website: https://www.gnu.org/software/make/manual/html_node/Introduction.html
|
---|
6 | Category: common
|
---|
7 | */
|
---|
8 |
|
---|
9 | function makefile(hljs) {
|
---|
10 | /* Variables: simple (eg $(var)) and special (eg $@) */
|
---|
11 | const VARIABLE = {
|
---|
12 | className: 'variable',
|
---|
13 | variants: [
|
---|
14 | {
|
---|
15 | begin: '\\$\\(' + hljs.UNDERSCORE_IDENT_RE + '\\)',
|
---|
16 | contains: [ hljs.BACKSLASH_ESCAPE ]
|
---|
17 | },
|
---|
18 | {
|
---|
19 | begin: /\$[@%<?\^\+\*]/
|
---|
20 | }
|
---|
21 | ]
|
---|
22 | };
|
---|
23 | /* Quoted string with variables inside */
|
---|
24 | const QUOTE_STRING = {
|
---|
25 | className: 'string',
|
---|
26 | begin: /"/,
|
---|
27 | end: /"/,
|
---|
28 | contains: [
|
---|
29 | hljs.BACKSLASH_ESCAPE,
|
---|
30 | VARIABLE
|
---|
31 | ]
|
---|
32 | };
|
---|
33 | /* Function: $(func arg,...) */
|
---|
34 | const FUNC = {
|
---|
35 | className: 'variable',
|
---|
36 | begin: /\$\([\w-]+\s/,
|
---|
37 | end: /\)/,
|
---|
38 | keywords: {
|
---|
39 | built_in:
|
---|
40 | 'subst patsubst strip findstring filter filter-out sort ' +
|
---|
41 | 'word wordlist firstword lastword dir notdir suffix basename ' +
|
---|
42 | 'addsuffix addprefix join wildcard realpath abspath error warning ' +
|
---|
43 | 'shell origin flavor foreach if or and call eval file value'
|
---|
44 | },
|
---|
45 | contains: [ VARIABLE ]
|
---|
46 | };
|
---|
47 | /* Variable assignment */
|
---|
48 | const ASSIGNMENT = {
|
---|
49 | begin: '^' + hljs.UNDERSCORE_IDENT_RE + '\\s*(?=[:+?]?=)'
|
---|
50 | };
|
---|
51 | /* Meta targets (.PHONY) */
|
---|
52 | const META = {
|
---|
53 | className: 'meta',
|
---|
54 | begin: /^\.PHONY:/,
|
---|
55 | end: /$/,
|
---|
56 | keywords: {
|
---|
57 | $pattern: /[\.\w]+/,
|
---|
58 | 'meta-keyword': '.PHONY'
|
---|
59 | }
|
---|
60 | };
|
---|
61 | /* Targets */
|
---|
62 | const TARGET = {
|
---|
63 | className: 'section',
|
---|
64 | begin: /^[^\s]+:/,
|
---|
65 | end: /$/,
|
---|
66 | contains: [ VARIABLE ]
|
---|
67 | };
|
---|
68 | return {
|
---|
69 | name: 'Makefile',
|
---|
70 | aliases: [
|
---|
71 | 'mk',
|
---|
72 | 'mak',
|
---|
73 | 'make',
|
---|
74 | ],
|
---|
75 | keywords: {
|
---|
76 | $pattern: /[\w-]+/,
|
---|
77 | keyword: 'define endef undefine ifdef ifndef ifeq ifneq else endif ' +
|
---|
78 | 'include -include sinclude override export unexport private vpath'
|
---|
79 | },
|
---|
80 | contains: [
|
---|
81 | hljs.HASH_COMMENT_MODE,
|
---|
82 | VARIABLE,
|
---|
83 | QUOTE_STRING,
|
---|
84 | FUNC,
|
---|
85 | ASSIGNMENT,
|
---|
86 | META,
|
---|
87 | TARGET
|
---|
88 | ]
|
---|
89 | };
|
---|
90 | }
|
---|
91 |
|
---|
92 | module.exports = makefile;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.