|
3 | 3 | * here : http://ace.c9.io/tool/mode_creator.html |
4 | 4 | */ |
5 | 5 |
|
6 | | -define(function(require, exports, module) { |
7 | | -"use strict"; |
8 | | -var oop = require("../lib/oop"); |
9 | | -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
10 | | -/* --------------------- START ----------------------------- */ |
11 | | -var HlbHighlightRules = function() { |
12 | | -this.$rules = { |
13 | | -"start" : [ |
14 | | - { |
15 | | - "token" : "comment", |
16 | | - "regex" : "(#.*)" |
17 | | - }, |
18 | | - { |
19 | | - "token" : "constant", |
20 | | - "regex" : "((\\b(0(b|B|o|O|x|X)[a-fA-F0-9]+)\\b)|(\\b(0|[1-9][0-9]*)\\b)|(\\b(true|false)\\b))" |
21 | | - }, |
22 | | - { |
23 | | - "token" : "punctuation", |
24 | | - "regex" : "(\")", |
25 | | - "push" : "common__1" |
26 | | - }, |
27 | | - { |
28 | | - "token" : "entity.name.type", |
29 | | - "regex" : "(\\bstring\\b|\\bint\\b|\\bbool\\b|\\bfs\\b|\\boption\\b)" |
30 | | - }, |
31 | | - { |
32 | | - "token" : ["keyword", "punctuation"], |
33 | | - "regex" : "(\\b[a-zA-Z_][a-zA-Z0-9]*\\b)(\\()", |
34 | | - "push" : "params" |
35 | | - }, |
36 | | - { |
37 | | - "token" : "invalid", |
38 | | - "regex" : "(\\))" |
39 | | - }, |
40 | | - { |
41 | | - "token" : "punctuation", |
42 | | - "regex" : "(\\{)", |
43 | | - "push" : "block" |
44 | | - }, |
45 | | - { |
46 | | - "token" : "invalid", |
47 | | - "regex" : "(\\})" |
48 | | - }, |
49 | | - { |
50 | | - defaultToken : "text", |
51 | | - } |
52 | | -], |
53 | | -"block" : [ |
54 | | - { |
55 | | - "token" : "punctuation", |
56 | | - "regex" : "(\\})", |
57 | | - "next" : "pop" |
58 | | - }, |
59 | | - { |
60 | | - "token" : "comment", |
61 | | - "regex" : "(#.*)" |
62 | | - }, |
63 | | - { |
64 | | - "token" : "constant", |
65 | | - "regex" : "((\\b(0(b|B|o|O|x|X)[a-fA-F0-9]+)\\b)|(\\b(0|[1-9][0-9]*)\\b)|(\\b(true|false)\\b))" |
66 | | - }, |
67 | | - { |
68 | | - "token" : "punctuation", |
69 | | - "regex" : "(\")", |
70 | | - "push" : "common__1" |
71 | | - }, |
72 | | - { |
73 | | - "token" : "variable.language", |
74 | | - "regex" : "(\\b(with|as|variadic)\\b)" |
75 | | - }, |
76 | | - { |
77 | | - "token" : ["entity.name.type", "text", "punctuation"], |
78 | | - "regex" : "(\\bstring\\b|\\bint\\b|\\bbool\\b|\\bfs\\b|\\boption\\b)([\\t ]+)(\\{)", |
79 | | - "push" : "block" |
80 | | - }, |
81 | | - { |
82 | | - "token" : "variable", |
83 | | - "regex" : "(\\b((?!(scratch|image|resolve|http|checksum|chmod|filename|git|keepGitDir|local|includePatterns|excludePatterns|followPaths|generate|frontendInput|shell|run|readonlyRootfs|env|dir|user|network|security|host|ssh|secret|mount|target|localPath|uid|gid|mode|readonly|tmpfs|sourcePath|cache|mkdir|createParents|chown|createdTime|mkfile|rm|allowNotFound|allowWildcards|copy|followSymlinks|contentsOnly|unpack|createDestPath)\\b)[a-zA-Z_][a-zA-Z0-9]*\\b))" |
84 | | - }, |
85 | | - { |
86 | | - defaultToken : "text", |
87 | | - } |
88 | | -], |
89 | | -"common__1" : [ |
90 | | - { |
91 | | - "token" : "punctuation", |
92 | | - "regex" : "(\")", |
93 | | - "next" : "pop" |
94 | | - }, |
95 | | - { |
96 | | - defaultToken : "string", |
97 | | - } |
98 | | -], |
99 | | -"params" : [ |
100 | | - { |
101 | | - "token" : "punctuation", |
102 | | - "regex" : "(\\))", |
103 | | - "next" : "pop" |
104 | | - }, |
105 | | - { |
106 | | - "token" : "entity.name.type", |
107 | | - "regex" : "(\\bstring\\b|\\bint\\b|\\bbool\\b|\\bfs\\b|\\boption\\b)" |
108 | | - }, |
109 | | - { |
110 | | - "token" : "variable", |
111 | | - "regex" : "(\\b[a-zA-Z_][a-zA-Z0-9]*\\b)" |
112 | | - }, |
113 | | - { |
114 | | - defaultToken : "text", |
115 | | - } |
116 | | -] |
117 | | -}; |
118 | | -this.normalizeRules(); |
119 | | -}; |
120 | | -/* ------------------------ END ------------------------------ */ |
121 | | -oop.inherits(HlbHighlightRules, TextHighlightRules); |
122 | | -exports.HlbHighlightRules = HlbHighlightRules; |
| 6 | +define(function (require, exports, module) { |
| 7 | + "use strict"; |
| 8 | + var oop = require("../lib/oop"); |
| 9 | + var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 10 | + /* --------------------- START ----------------------------- */ |
| 11 | + var HlbHighlightRules = function () { |
| 12 | + this.$rules = { |
| 13 | + "start": [ |
| 14 | + { |
| 15 | + "token": "comment", |
| 16 | + "regex": "(#.*)" |
| 17 | + }, |
| 18 | + { |
| 19 | + "token": "constant", |
| 20 | + "regex": "((\\b(0(b|B|o|O|x|X)[a-fA-F0-9]+)\\b)|(\\b(0|[1-9][0-9]*)\\b)|(\\b(true|false)\\b))" |
| 21 | + }, |
| 22 | + { |
| 23 | + "token": "punctuation", |
| 24 | + "regex": "(\")", |
| 25 | + "push": "common__1" |
| 26 | + }, |
| 27 | + { |
| 28 | + "token": ["punctuation", "constant"], |
| 29 | + "regex": "(<<[-~]?)([A-Z]+)", |
| 30 | + "push": "common__2" |
| 31 | + }, |
| 32 | + { |
| 33 | + "token": "entity.name.type", |
| 34 | + "regex": "(\\bstring\\b|\\bint\\b|\\bbool\\b|\\bfs\\b|\\bgroup\\b|\\boption(?!::)\\b|\\boption::(?:copy|frontend|git|http|image|local|mkdir|mkfile|mount|rm|run|secret|ssh)\\b)" |
| 35 | + }, |
| 36 | + { |
| 37 | + "token": ["keyword", "punctuation"], |
| 38 | + "regex": "(\\b[a-zA-Z_][a-zA-Z0-9]*\\b)(\\()", |
| 39 | + "push": "params" |
| 40 | + }, |
| 41 | + { |
| 42 | + "token": "invalid", |
| 43 | + "regex": "(\\))" |
| 44 | + }, |
| 45 | + { |
| 46 | + "token": "punctuation", |
| 47 | + "regex": "(\\{)", |
| 48 | + "push": "block" |
| 49 | + }, |
| 50 | + { |
| 51 | + "token": "invalid", |
| 52 | + "regex": "(\\})" |
| 53 | + }, |
| 54 | + { |
| 55 | + defaultToken: "text", |
| 56 | + } |
| 57 | + ], |
| 58 | + "block": [ |
| 59 | + { |
| 60 | + "token": "punctuation", |
| 61 | + "regex": "(\\})", |
| 62 | + "next": "pop" |
| 63 | + }, |
| 64 | + { |
| 65 | + "token": "comment", |
| 66 | + "regex": "(#.*)" |
| 67 | + }, |
| 68 | + { |
| 69 | + "token": "constant", |
| 70 | + "regex": "((\\b(0(b|B|o|O|x|X)[a-fA-F0-9]+)\\b)|(\\b(0|[1-9][0-9]*)\\b)|(\\b(true|false)\\b))" |
| 71 | + }, |
| 72 | + { |
| 73 | + "token": "punctuation", |
| 74 | + "regex": "(\")", |
| 75 | + "push": "common__1" |
| 76 | + }, |
| 77 | + { |
| 78 | + "token": ["punctuation", "constant"], |
| 79 | + "regex": "(<<[-~]?)([A-Z]+)", |
| 80 | + "push": "common__2" |
| 81 | + }, |
| 82 | + { |
| 83 | + "token": "variable.language", |
| 84 | + "regex": "(\\b(with|as|variadic)\\b)" |
| 85 | + }, |
| 86 | + { |
| 87 | + "token": ["entity.name.type", "punctuation"], |
| 88 | + "regex": "(\\bstring\\b|\\bint\\b|\\bbool\\b|\\bfs\\b|\\bgroup\\b|\\boption(?!::)\\b|\\boption::(?:copy|frontend|git|http|image|local|mkdir|mkfile|mount|rm|run|secret|ssh)\\b)(?:[\\t ]+)(\\{)", |
| 89 | + "push": "block" |
| 90 | + }, |
| 91 | + { |
| 92 | + "token": "variable", |
| 93 | + "regex": "(\\b((?!(allowEmptyWildcard|allowNotFound|allowWildcard|cache|checksum|chmod|chown|contentsOnly|copy|createDestPath|createParents|createdTime|dir|dockerLoad|dockerPush|download|downloadDockerTarball|downloadOCITarball|downloadTarball|env|excludePatterns|filename|followPaths|followSymlinks|format|forward|frontend|gid|git|host|http|id|ignoreCache|image|includePatterns|input|insecure|keepGitDir|local|localEnv|localPaths|locked|mkdir|mkfile|mode|mount|network|node|opt|parallel|private|readonly|readonlyRootfs|resolve|rm|run|sandbox|scratch|secret|security|shared|sourcePath|ssh|target|tmpfs|uid|unix|unpack|unset|user|value)\\b)[a-zA-Z_][a-zA-Z0-9]*\\b))" |
| 94 | + }, |
| 95 | + { |
| 96 | + defaultToken: "text", |
| 97 | + } |
| 98 | + ], |
| 99 | + "common__1": [ |
| 100 | + { |
| 101 | + "token": "punctuation", |
| 102 | + "regex": "(\")", |
| 103 | + "next": "pop" |
| 104 | + }, |
| 105 | + { |
| 106 | + defaultToken: "string", |
| 107 | + } |
| 108 | + ], |
| 109 | + "common__2": [ |
| 110 | + { |
| 111 | + "token": "constant", |
| 112 | + "regex": "(\\2)", |
| 113 | + "next": "pop" |
| 114 | + }, |
| 115 | + { |
| 116 | + defaultToken: "string", |
| 117 | + } |
| 118 | + ], |
| 119 | + "params": [ |
| 120 | + { |
| 121 | + "token": "punctuation", |
| 122 | + "regex": "(\\))", |
| 123 | + "next": "pop" |
| 124 | + }, |
| 125 | + { |
| 126 | + "token": "entity.name.type", |
| 127 | + "regex": "(\\bstring\\b|\\bint\\b|\\bbool\\b|\\bfs\\b|\\bgroup\\b|\\boption(?!::)\\b|\\boption::(?:copy|frontend|git|http|image|local|mkdir|mkfile|mount|rm|run|secret|ssh)\\b)" |
| 128 | + }, |
| 129 | + { |
| 130 | + "token": "variable", |
| 131 | + "regex": "(\\b[a-zA-Z_][a-zA-Z0-9]*\\b)" |
| 132 | + }, |
| 133 | + { |
| 134 | + defaultToken: "text", |
| 135 | + } |
| 136 | + ] |
| 137 | + }; |
| 138 | + this.normalizeRules(); |
| 139 | + }; |
| 140 | + /* ------------------------ END ------------------------------ */ |
| 141 | + oop.inherits(HlbHighlightRules, TextHighlightRules); |
| 142 | + exports.HlbHighlightRules = HlbHighlightRules; |
123 | 143 | }); |
0 commit comments