Skip to content

Commit

Permalink
feat(modes): add lobster_dc_logs
Browse files Browse the repository at this point in the history
  • Loading branch information
F0rce committed Jul 28, 2022
1 parent 0a9f0b3 commit b902b59
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/java/de/f0rce/ace/enums/AceMode.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public enum AceMode {
liquid,
lisp,
livescript,
lobster_dc_logs,
lobster_expert_search,
lobster_logs,
lobster_records,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
ace.define("ace/mode/lobster_dc_logs", function (require, exports, module) {
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var LobsterDCLogsHighlightRules =
require("ace/mode/lobster_dc_logs_highlight_rules").LobsterDCLogsHighlightRules;

var Mode = function () {
this.HighlightRules = LobsterDCLogsHighlightRules;
};
oop.inherits(Mode, TextMode);

(function () {
// Extra logic goes here. (see below)
}.call(Mode.prototype));

exports.Mode = Mode;
});

ace.define(
"ace/mode/lobster_dc_logs_highlight_rules",
function (require, exports, module) {
var oop = require("ace/lib/oop");
var TextHighlightRules =
require("ace/mode/text_highlight_rules").TextHighlightRules;

var escapedRe =
"\\\\(?:x[0-9a-fA-F]{2}|" + // hex
"u[0-9a-fA-F]{4}|" + // unicode
"u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
"[0-2][0-7]{0,2}|" + // oct
"3[0-7][0-7]?|" + // oct
"[4-7][0-7]?|" + //oct
".)";

var LobsterDCLogsHighlightRules = function () {
this.$rules = {
start: [
{
token: "comment",
regex: "^\\d*\.\\d*\\.\\d*\\s\\d*:\\d*:\\d*\\.\\d*(?!\\d)",
},
{
token: "string",
regex: "'(?=.)",
next: "qstring",
},
{
token: "string",
regex: '"(?=.)',
next: "qqstring",
},
{
token: "keyword",
regex: "(\\[.*?\\])",
},
{
token: "constant.language",
regex: "([nN]ested [eE]xception [iI]s:)",
},
],

qqstring: [
{
token: "constant.language.escape",
regex: escapedRe,
},
{
token: "string",
regex: "\\\\$",
consumeLineEnd: true,
},
{
token: "string",
regex: '"|$',
next: "start",
},
{
defaultToken: "string",
},
],

qstring: [
{
token: "constant.language.escape",
regex: escapedRe,
},
{
token: "string",
regex: "\\\\$",
consumeLineEnd: true,
},
{
token: "string",
regex: "'|$",
next: "start",
},
{
defaultToken: "string",
},
],
};
};

oop.inherits(LobsterDCLogsHighlightRules, TextHighlightRules);

exports.LobsterDCLogsHighlightRules = LobsterDCLogsHighlightRules;
}
);

0 comments on commit b902b59

Please sign in to comment.