| 1 |
ace.define("ace/mode/zeek_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict"; |
| 2 |
var oop = require("../lib/oop"); |
| 3 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 4 |
var ZeekHighlightRules = function () { |
| 5 |
this.$rules = { |
| 6 |
"start": [ |
| 7 |
{ |
| 8 |
token: "comment.line", |
| 9 |
regex: "#.*$" |
| 10 |
}, |
| 11 |
{ |
| 12 |
token: "string.double", |
| 13 |
regex: /"/, |
| 14 |
next: "string-state" |
| 15 |
}, |
| 16 |
{ |
| 17 |
token: "string.regexp", |
| 18 |
regex: "(/)(?=.*/)", |
| 19 |
next: "pattern-state" |
| 20 |
}, |
| 21 |
{ |
| 22 |
token: ["keyword.other", "meta.preprocessor"], |
| 23 |
regex: /(@(?:load-plugin|load-sigs|load|unload))(.*$)/ |
| 24 |
}, |
| 25 |
{ |
| 26 |
token: "keyword.other", |
| 27 |
regex: /@(?:DEBUG|DIR|FILENAME|deprecated|if|ifdef|ifndef|else|endif)/ |
| 28 |
}, |
| 29 |
{ |
| 30 |
token: [ |
| 31 |
"keyword.other", |
| 32 |
"meta.preprocessor", |
| 33 |
"keyword.operator", |
| 34 |
"meta.preprocessor" |
| 35 |
], |
| 36 |
regex: /(@prefixes)(\s*)(\+?=)(.*$)/ |
| 37 |
}, |
| 38 |
{ |
| 39 |
token: "storage.modifier.attribute", |
| 40 |
regex: /\&\b(?:redef|priority|log|optional|default|add_func|delete_func|expire_func|read_expire|write_expire|create_expire|synchronized|persistent|rotate_interval|rotate_size|encrypt|raw_output|mergeable|error_handler|type_column|deprecated)\b/ |
| 41 |
}, |
| 42 |
{ |
| 43 |
token: "constant.language", |
| 44 |
regex: /\b(?:T|F)\b/ |
| 45 |
}, |
| 46 |
{ |
| 47 |
token: "constant.numeric.port", |
| 48 |
regex: /\b\d{1,5}\/(?:udp|tcp|icmp|unknown)\b/ |
| 49 |
}, |
| 50 |
{ |
| 51 |
token: "constant.numeric.addr", |
| 52 |
regex: /\b(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{1,2})\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{1,2})\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{1,2})\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{1,2})\b/, |
| 53 |
comment: "IPv4 address" |
| 54 |
}, |
| 55 |
{ |
| 56 |
token: "constant.numeric.addr", |
| 57 |
regex: /\[(?:[0-9a-fA-F]{0,4}:){2,7}(?:[0-9a-fA-F]{0,4})?(?:(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{1,2})\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{1,2})\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{1,2})\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{1,2}))?\]/, |
| 58 |
comment: "IPv6 address" |
| 59 |
}, |
| 60 |
{ |
| 61 |
token: "constant.numeric.float.decimal.interval", |
| 62 |
regex: /(?:(?:\d*\.\d*(?:[eE][+-]?\d+)?|\d*[eE][+-]?\d+|\d*\.\d*)|\d+)\s*(?:day|hr|min|msec|usec|sec)s?/ |
| 63 |
}, |
| 64 |
{ |
| 65 |
token: "constant.numeric.float.decimal", |
| 66 |
regex: /\d*\.\d*(?:[eE][+-]?\d+)?|\d*[eE][+-]?\d+|\d*\.\d*/ |
| 67 |
}, |
| 68 |
{ |
| 69 |
token: "constant.numeric.hostname", |
| 70 |
regex: /\b[A-Za-z0-9][A-Za-z0-9\-]*(?:\.[A-Za-z0-9][A-Za-z0-9\-]*)+\b/ |
| 71 |
}, |
| 72 |
{ |
| 73 |
token: "constant.numeric.integer.hexadecimal", |
| 74 |
regex: /\b0x[0-9a-fA-F]+\b/ |
| 75 |
}, |
| 76 |
{ |
| 77 |
token: "constant.numeric.integer.decimal", |
| 78 |
regex: /\b\d+\b/ |
| 79 |
}, |
| 80 |
{ |
| 81 |
token: "keyword.operator", |
| 82 |
regex: /==|!=|<=|<|>=|>/ |
| 83 |
}, |
| 84 |
{ |
| 85 |
token: "keyword.operator", |
| 86 |
regex: /(&&)|(\|\|)|(!)/ |
| 87 |
}, |
| 88 |
{ |
| 89 |
token: "keyword.operator", |
| 90 |
regex: /=|\+=|-=/ |
| 91 |
}, |
| 92 |
{ |
| 93 |
token: "keyword.operator", |
| 94 |
regex: /\+\+|\+|--|-|\*|\/|%/ |
| 95 |
}, |
| 96 |
{ |
| 97 |
token: "keyword.operator", |
| 98 |
regex: /&|\||\^|~/ |
| 99 |
}, |
| 100 |
{ |
| 101 |
token: "keyword.operator", |
| 102 |
regex: /\b(?:in|as|is)\b/ |
| 103 |
}, |
| 104 |
{ |
| 105 |
token: "punctuation.terminator", |
| 106 |
regex: /;/ |
| 107 |
}, |
| 108 |
{ |
| 109 |
token: "punctuation.accessor", |
| 110 |
regex: /\??\$/ |
| 111 |
}, |
| 112 |
{ |
| 113 |
token: "punctuation.accessor", |
| 114 |
regex: /::/ |
| 115 |
}, |
| 116 |
{ |
| 117 |
token: "keyword.operator", |
| 118 |
regex: /\?/ |
| 119 |
}, |
| 120 |
{ |
| 121 |
token: "punctuation.separator", |
| 122 |
regex: /:/ |
| 123 |
}, |
| 124 |
{ |
| 125 |
token: "punctuation.separator", |
| 126 |
regex: /,/ |
| 127 |
}, |
| 128 |
{ |
| 129 |
token: [ |
| 130 |
"keyword.other", |
| 131 |
"meta.namespace", |
| 132 |
"entity.name.namespace" |
| 133 |
], |
| 134 |
regex: /(module)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)/ |
| 135 |
}, |
| 136 |
{ |
| 137 |
token: "keyword.other", |
| 138 |
regex: /\bexport\b/ |
| 139 |
}, |
| 140 |
{ |
| 141 |
token: "keyword.control.conditional", |
| 142 |
regex: /\b(?:if|else)\b/ |
| 143 |
}, |
| 144 |
{ |
| 145 |
token: "keyword.control", |
| 146 |
regex: /\b(?:for|while)\b/ |
| 147 |
}, |
| 148 |
{ |
| 149 |
token: "keyword.control", |
| 150 |
regex: /\b(?:return|break|next|continue|fallthrough)\b/ |
| 151 |
}, |
| 152 |
{ |
| 153 |
token: "keyword.control", |
| 154 |
regex: /\b(?:switch|default|case)\b/ |
| 155 |
}, |
| 156 |
{ |
| 157 |
token: "keyword.other", |
| 158 |
regex: /\b(?:add|delete)\b/ |
| 159 |
}, |
| 160 |
{ |
| 161 |
token: "keyword.other", |
| 162 |
regex: /\bprint\b/ |
| 163 |
}, |
| 164 |
{ |
| 165 |
token: "keyword.control", |
| 166 |
regex: /\b(?:when|timeout|schedule)\b/ |
| 167 |
}, |
| 168 |
{ |
| 169 |
token: [ |
| 170 |
"keyword.other", |
| 171 |
"meta.struct.record", |
| 172 |
"entity.name.struct.record", |
| 173 |
"meta.struct.record", |
| 174 |
"punctuation.separator", |
| 175 |
"meta.struct.record", |
| 176 |
"storage.type.struct.record" |
| 177 |
], |
| 178 |
regex: /\b(type)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)(\s*)(:)(\s*\b)(record)\b/ |
| 179 |
}, |
| 180 |
{ |
| 181 |
token: [ |
| 182 |
"keyword.other", |
| 183 |
"meta.enum", |
| 184 |
"entity.name.enum", |
| 185 |
"meta.enum", |
| 186 |
"punctuation.separator", |
| 187 |
"meta.enum", |
| 188 |
"storage.type.enum" |
| 189 |
], |
| 190 |
regex: /\b(type)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)(\s*)(:)(\s*\b)(enum)\b/ |
| 191 |
}, |
| 192 |
{ |
| 193 |
token: [ |
| 194 |
"keyword.other", |
| 195 |
"meta.type", |
| 196 |
"entity.name.type", |
| 197 |
"meta.type", |
| 198 |
"punctuation.separator" |
| 199 |
], |
| 200 |
regex: /\b(type)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)(\s*)(:)/ |
| 201 |
}, |
| 202 |
{ |
| 203 |
token: [ |
| 204 |
"keyword.other", |
| 205 |
"meta.struct.record", |
| 206 |
"storage.type.struct.record", |
| 207 |
"meta.struct.record", |
| 208 |
"entity.name.struct.record" |
| 209 |
], |
| 210 |
regex: /\b(redef)(\s+)(record)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)\b/ |
| 211 |
}, |
| 212 |
{ |
| 213 |
token: [ |
| 214 |
"keyword.other", |
| 215 |
"meta.enum", |
| 216 |
"storage.type.enum", |
| 217 |
"meta.enum", |
| 218 |
"entity.name.enum" |
| 219 |
], |
| 220 |
regex: /\b(redef)(\s+)(enum)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)\b/ |
| 221 |
}, |
| 222 |
{ |
| 223 |
token: [ |
| 224 |
"storage.type", |
| 225 |
"text", |
| 226 |
"entity.name.function.event" |
| 227 |
], |
| 228 |
regex: /\b(event)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)(?=s*\()/ |
| 229 |
}, |
| 230 |
{ |
| 231 |
token: [ |
| 232 |
"storage.type", |
| 233 |
"text", |
| 234 |
"entity.name.function.hook" |
| 235 |
], |
| 236 |
regex: /\b(hook)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)(?=s*\()/ |
| 237 |
}, |
| 238 |
{ |
| 239 |
token: [ |
| 240 |
"storage.type", |
| 241 |
"text", |
| 242 |
"entity.name.function" |
| 243 |
], |
| 244 |
regex: /\b(function)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)(?=s*\()/ |
| 245 |
}, |
| 246 |
{ |
| 247 |
token: "keyword.other", |
| 248 |
regex: /\bredef\b/ |
| 249 |
}, |
| 250 |
{ |
| 251 |
token: "storage.type", |
| 252 |
regex: /\bany\b/ |
| 253 |
}, |
| 254 |
{ |
| 255 |
token: "storage.type", |
| 256 |
regex: /\b(?:enum|record|set|table|vector)\b/ |
| 257 |
}, |
| 258 |
{ |
| 259 |
token: [ |
| 260 |
"storage.type", |
| 261 |
"text", |
| 262 |
"keyword.operator", |
| 263 |
"text", |
| 264 |
"storage.type" |
| 265 |
], |
| 266 |
regex: /\b(opaque)(\s+)(of)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)\b/ |
| 267 |
}, |
| 268 |
{ |
| 269 |
token: "keyword.operator", |
| 270 |
regex: /\bof\b/ |
| 271 |
}, |
| 272 |
{ |
| 273 |
token: "storage.type", |
| 274 |
regex: /\b(?:addr|bool|count|double|file|int|interval|pattern|port|string|subnet|time)\b/ |
| 275 |
}, |
| 276 |
{ |
| 277 |
token: "storage.type", |
| 278 |
regex: /\b(?:function|hook|event)\b/ |
| 279 |
}, |
| 280 |
{ |
| 281 |
token: "storage.modifier", |
| 282 |
regex: /\b(?:global|local|const|option)\b/ |
| 283 |
}, |
| 284 |
{ |
| 285 |
token: "entity.name.function.call", |
| 286 |
regex: /\b[A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*(?=s*\()/ |
| 287 |
}, |
| 288 |
{ |
| 289 |
token: "punctuation.section.block.begin", |
| 290 |
regex: /\{/ |
| 291 |
}, |
| 292 |
{ |
| 293 |
token: "punctuation.section.block.end", |
| 294 |
regex: /\}/ |
| 295 |
}, |
| 296 |
{ |
| 297 |
token: "punctuation.section.brackets.begin", |
| 298 |
regex: /\[/ |
| 299 |
}, |
| 300 |
{ |
| 301 |
token: "punctuation.section.brackets.end", |
| 302 |
regex: /\]/ |
| 303 |
}, |
| 304 |
{ |
| 305 |
token: "punctuation.section.parens.begin", |
| 306 |
regex: /\(/ |
| 307 |
}, |
| 308 |
{ |
| 309 |
token: "punctuation.section.parens.end", |
| 310 |
regex: /\)/ |
| 311 |
} |
| 312 |
], |
| 313 |
"string-state": [ |
| 314 |
{ |
| 315 |
token: "constant.character.escape", |
| 316 |
regex: /\\./ |
| 317 |
}, |
| 318 |
{ |
| 319 |
token: "string.double", |
| 320 |
regex: /"/, |
| 321 |
next: "start" |
| 322 |
}, |
| 323 |
{ |
| 324 |
token: "constant.other.placeholder", |
| 325 |
regex: /%-?[0-9]*(\.[0-9]+)?[DTdxsefg]/ |
| 326 |
}, |
| 327 |
{ |
| 328 |
token: "string.double", |
| 329 |
regex: "." |
| 330 |
} |
| 331 |
], |
| 332 |
"pattern-state": [ |
| 333 |
{ |
| 334 |
token: "constant.character.escape", |
| 335 |
regex: /\\./ |
| 336 |
}, |
| 337 |
{ |
| 338 |
token: "string.regexp", |
| 339 |
regex: "/", |
| 340 |
next: "start" |
| 341 |
}, |
| 342 |
{ |
| 343 |
token: "string.regexp", |
| 344 |
regex: "." |
| 345 |
} |
| 346 |
] |
| 347 |
}; |
| 348 |
this.normalizeRules(); |
| 349 |
}; |
| 350 |
ZeekHighlightRules.metaData = { |
| 351 |
fileTypes: ["bro", "zeek"], |
| 352 |
name: "Zeek", |
| 353 |
scopeName: "source.zeek" |
| 354 |
}; |
| 355 |
oop.inherits(ZeekHighlightRules, TextHighlightRules); |
| 356 |
exports.ZeekHighlightRules = ZeekHighlightRules; |
| 357 |
|
| 358 |
}); |
| 359 |
|
| 360 |
ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict"; |
| 361 |
var oop = require("../../lib/oop"); |
| 362 |
var Range = require("../../range").Range; |
| 363 |
var BaseFoldMode = require("./fold_mode").FoldMode; |
| 364 |
var FoldMode = exports.FoldMode = function (commentRegex) { |
| 365 |
if (commentRegex) { |
| 366 |
this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)); |
| 367 |
this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)); |
| 368 |
} |
| 369 |
}; |
| 370 |
oop.inherits(FoldMode, BaseFoldMode); |
| 371 |
(function () { |
| 372 |
this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; |
| 373 |
this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; |
| 374 |
this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/; |
| 375 |
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; |
| 376 |
this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; |
| 377 |
this._getFoldWidgetBase = this.getFoldWidget; |
| 378 |
this.getFoldWidget = function (session, foldStyle, row) { |
| 379 |
var line = session.getLine(row); |
| 380 |
if (this.singleLineBlockCommentRe.test(line)) { |
| 381 |
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) |
| 382 |
return ""; |
| 383 |
} |
| 384 |
var fw = this._getFoldWidgetBase(session, foldStyle, row); |
| 385 |
if (!fw && this.startRegionRe.test(line)) |
| 386 |
return "start"; |
| 387 |
return fw; |
| 388 |
}; |
| 389 |
this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) { |
| 390 |
var line = session.getLine(row); |
| 391 |
if (this.startRegionRe.test(line)) |
| 392 |
return this.getCommentRegionBlock(session, line, row); |
| 393 |
var match = line.match(this.foldingStartMarker); |
| 394 |
if (match) { |
| 395 |
var i = match.index; |
| 396 |
if (match[1]) |
| 397 |
return this.openingBracketBlock(session, match[1], row, i); |
| 398 |
var range = session.getCommentFoldRange(row, i + match[0].length, 1); |
| 399 |
if (range && !range.isMultiLine()) { |
| 400 |
if (forceMultiline) { |
| 401 |
range = this.getSectionRange(session, row); |
| 402 |
} |
| 403 |
else if (foldStyle != "all") |
| 404 |
range = null; |
| 405 |
} |
| 406 |
return range; |
| 407 |
} |
| 408 |
if (foldStyle === "markbegin") |
| 409 |
return; |
| 410 |
var match = line.match(this.foldingStopMarker); |
| 411 |
if (match) { |
| 412 |
var i = match.index + match[0].length; |
| 413 |
if (match[1]) |
| 414 |
return this.closingBracketBlock(session, match[1], row, i); |
| 415 |
return session.getCommentFoldRange(row, i, -1); |
| 416 |
} |
| 417 |
}; |
| 418 |
this.getSectionRange = function (session, row) { |
| 419 |
var line = session.getLine(row); |
| 420 |
var startIndent = line.search(/\S/); |
| 421 |
var startRow = row; |
| 422 |
var startColumn = line.length; |
| 423 |
row = row + 1; |
| 424 |
var endRow = row; |
| 425 |
var maxRow = session.getLength(); |
| 426 |
while (++row < maxRow) { |
| 427 |
line = session.getLine(row); |
| 428 |
var indent = line.search(/\S/); |
| 429 |
if (indent === -1) |
| 430 |
continue; |
| 431 |
if (startIndent > indent) |
| 432 |
break; |
| 433 |
var subRange = this.getFoldWidgetRange(session, "all", row); |
| 434 |
if (subRange) { |
| 435 |
if (subRange.start.row <= startRow) { |
| 436 |
break; |
| 437 |
} |
| 438 |
else if (subRange.isMultiLine()) { |
| 439 |
row = subRange.end.row; |
| 440 |
} |
| 441 |
else if (startIndent == indent) { |
| 442 |
break; |
| 443 |
} |
| 444 |
} |
| 445 |
endRow = row; |
| 446 |
} |
| 447 |
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); |
| 448 |
}; |
| 449 |
this.getCommentRegionBlock = function (session, line, row) { |
| 450 |
var startColumn = line.search(/\s*$/); |
| 451 |
var maxRow = session.getLength(); |
| 452 |
var startRow = row; |
| 453 |
var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; |
| 454 |
var depth = 1; |
| 455 |
while (++row < maxRow) { |
| 456 |
line = session.getLine(row); |
| 457 |
var m = re.exec(line); |
| 458 |
if (!m) |
| 459 |
continue; |
| 460 |
if (m[1]) |
| 461 |
depth--; |
| 462 |
else |
| 463 |
depth++; |
| 464 |
if (!depth) |
| 465 |
break; |
| 466 |
} |
| 467 |
var endRow = row; |
| 468 |
if (endRow > startRow) { |
| 469 |
return new Range(startRow, startColumn, endRow, line.length); |
| 470 |
} |
| 471 |
}; |
| 472 |
}).call(FoldMode.prototype); |
| 473 |
|
| 474 |
}); |
| 475 |
|
| 476 |
ace.define("ace/mode/zeek",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/zeek_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module){ |
| 477 |
|
| 478 |
|
| 479 |
"use strict"; |
| 480 |
var oop = require("../lib/oop"); |
| 481 |
var TextMode = require("./text").Mode; |
| 482 |
var ZeekHighlightRules = require("./zeek_highlight_rules").ZeekHighlightRules; |
| 483 |
var FoldMode = require("./folding/cstyle").FoldMode; |
| 484 |
var Mode = function () { |
| 485 |
this.HighlightRules = ZeekHighlightRules; |
| 486 |
this.foldingRules = new FoldMode(); |
| 487 |
}; |
| 488 |
oop.inherits(Mode, TextMode); |
| 489 |
(function () { |
| 490 |
this.lineCommentStart = "#"; |
| 491 |
this.$id = "ace/mode/zeek"; |
| 492 |
}).call(Mode.prototype); |
| 493 |
exports.Mode = Mode; |
| 494 |
|
| 495 |
}); (function() { |
| 496 |
ace.require(["ace/mode/zeek"], function(m) { |
| 497 |
if (typeof module == "object" && typeof exports == "object" && module) { |
| 498 |
module.exports = m; |
| 499 |
} |
| 500 |
}); |
| 501 |
})(); |
| 502 |
|