]> luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/makefile.js
Initial commit.
[flow-web.git] / static / highlight / es / languages / makefile.js
1 /*! `makefile` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar = (function () {
3 'use strict';
4
5 /*
6 Language: Makefile
7 Author: Ivan Sagalaev <maniac@softwaremaniacs.org>
8 Contributors: Joël Porquet <joel@porquet.org>
9 Website: https://www.gnu.org/software/make/manual/html_node/Introduction.html
10 Category: common, build-system
11 */
12
13 function makefile(hljs) {
14 /* Variables: simple (eg $(var)) and special (eg $@) */
15 const VARIABLE = {
16 className: 'variable',
17 variants: [
18 {
19 begin: '\\$\\(' + hljs.UNDERSCORE_IDENT_RE + '\\)',
20 contains: [ hljs.BACKSLASH_ESCAPE ]
21 },
22 { begin: /\$[@%<?\^\+\*]/ }
23 ]
24 };
25 /* Quoted string with variables inside */
26 const QUOTE_STRING = {
27 className: 'string',
28 begin: /"/,
29 end: /"/,
30 contains: [
31 hljs.BACKSLASH_ESCAPE,
32 VARIABLE
33 ]
34 };
35 /* Function: $(func arg,...) */
36 const FUNC = {
37 className: 'variable',
38 begin: /\$\([\w-]+\s/,
39 end: /\)/,
40 keywords: { built_in:
41 'subst patsubst strip findstring filter filter-out sort '
42 + 'word wordlist firstword lastword dir notdir suffix basename '
43 + 'addsuffix addprefix join wildcard realpath abspath error warning '
44 + 'shell origin flavor foreach if or and call eval file value' },
45 contains: [
46 VARIABLE,
47 QUOTE_STRING // Added QUOTE_STRING as they can be a part of functions
48 ]
49 };
50 /* Variable assignment */
51 const ASSIGNMENT = { begin: '^' + hljs.UNDERSCORE_IDENT_RE + '\\s*(?=[:+?]?=)' };
52 /* Meta targets (.PHONY) */
53 const META = {
54 className: 'meta',
55 begin: /^\.PHONY:/,
56 end: /$/,
57 keywords: {
58 $pattern: /[\.\w]+/,
59 keyword: '.PHONY'
60 }
61 };
62 /* Targets */
63 const TARGET = {
64 className: 'section',
65 begin: /^[^\s]+:/,
66 end: /$/,
67 contains: [ VARIABLE ]
68 };
69 return {
70 name: 'Makefile',
71 aliases: [
72 'mk',
73 'mak',
74 'make',
75 ],
76 keywords: {
77 $pattern: /[\w-]+/,
78 keyword: 'define endef undefine ifdef ifndef ifeq ifneq else endif '
79 + 'include -include sinclude override export unexport private vpath'
80 },
81 contains: [
82 hljs.HASH_COMMENT_MODE,
83 VARIABLE,
84 QUOTE_STRING,
85 FUNC,
86 ASSIGNMENT,
87 META,
88 TARGET
89 ]
90 };
91 }
92
93 return makefile;
94
95 })();
96 ;
97 export default hljsGrammar;