From 904af7b8507fc6820192cc726e5453f5eb2c1aca Mon Sep 17 00:00:00 2001 From: Andrew Donkin Date: Mon, 4 Sep 2017 11:58:16 +1200 Subject: [PATCH 1/4] Create mode-sequencebramp.js Adds an editing mode to Ace for sequence diagrams. --- src/mode-sequencebramp.js | 56 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/mode-sequencebramp.js diff --git a/src/mode-sequencebramp.js b/src/mode-sequencebramp.js new file mode 100644 index 0000000..4436b92 --- /dev/null +++ b/src/mode-sequencebramp.js @@ -0,0 +1,56 @@ +define("ace/mode/sequencebramp_highlight_rules", ["require", "exports", "module", "ace/lib/oop"], function(e, t, n) { + "use strict"; + var r = e("../lib/oop") + , i = e("./text_highlight_rules").TextHighlightRules + , s = function() { + function t(e) { + var t = /\w/.test(e) ? "\\b" : "(?:\\B|^)"; + return t + e + "[^" + e + "].*?" + e + "(?![\\w*])" + } + this.$rules = { + start: [{ + token: "comment", + regex: /^\s*#.*/ + }, { + token: ["text", "string"], + regex: /^(\s*title:)(.*)/, + caseInsensitive: true, + }, { + // this doesn't handle commas well + token: ["text", "keyword", "text", "string"], + regex: /^(\s*note\s+(?:left\s+of|right\s+of|over)\s+)(.*)(:)(.*)/, + caseInsensitive: true, + }, { + token: ["text", "string", "text", "keyword"], + regex: /^(\s*participant\s+)(.*)(\bas\b)(.*)/, + caseInsensitive: true, + }, { + token: ["text", "keyword"], + regex: /^(\s*participant\s+)(.*)/, + caseInsensitive: true, + }, { + token: ["keyword", "operator", "keyword", "text", "string"], + regex: /^(\s*.*)(-?->>?)(.*)(\s*:\s*)(.*)?$/, + }, + ]}; + }; + r.inherits(s, i), + t.SequencebrampHighlightRules = s +}), +define("ace/mode/sequencebramp", ["require", "exports", "module", "ace/lib/oop", "ace/mode/text", "ace/mode/sequencebramp_highlight_rules", "ace/mode/folding/sequencebramp"], + function(e, t, n) { + "use strict"; + var r = e("../lib/oop") + , i = e("./text").Mode + , s = e("./sequencebramp_highlight_rules").SequencebrampHighlightRules + , u = function() { + this.HighlightRules = s + }; + r.inherits(u, i), + function() { + this.type = "text", + this.$id = "ace/mode/sequencebramp" + } + .call(u.prototype), + t.Mode = u +}) From a9b718a409b03bffd2d3354b239d10aa66f87818 Mon Sep 17 00:00:00 2001 From: Andrew Donkin Date: Mon, 2 Oct 2017 12:31:25 +1300 Subject: [PATCH 2/4] code style changes for CI checks --- src/mode-sequencebramp.js | 117 ++++++++++++++++++++------------------ 1 file changed, 61 insertions(+), 56 deletions(-) diff --git a/src/mode-sequencebramp.js b/src/mode-sequencebramp.js index 4436b92..1e9b728 100644 --- a/src/mode-sequencebramp.js +++ b/src/mode-sequencebramp.js @@ -1,56 +1,61 @@ -define("ace/mode/sequencebramp_highlight_rules", ["require", "exports", "module", "ace/lib/oop"], function(e, t, n) { - "use strict"; - var r = e("../lib/oop") - , i = e("./text_highlight_rules").TextHighlightRules - , s = function() { - function t(e) { - var t = /\w/.test(e) ? "\\b" : "(?:\\B|^)"; - return t + e + "[^" + e + "].*?" + e + "(?![\\w*])" - } - this.$rules = { - start: [{ - token: "comment", - regex: /^\s*#.*/ - }, { - token: ["text", "string"], - regex: /^(\s*title:)(.*)/, - caseInsensitive: true, - }, { - // this doesn't handle commas well - token: ["text", "keyword", "text", "string"], - regex: /^(\s*note\s+(?:left\s+of|right\s+of|over)\s+)(.*)(:)(.*)/, - caseInsensitive: true, - }, { - token: ["text", "string", "text", "keyword"], - regex: /^(\s*participant\s+)(.*)(\bas\b)(.*)/, - caseInsensitive: true, - }, { - token: ["text", "keyword"], - regex: /^(\s*participant\s+)(.*)/, - caseInsensitive: true, - }, { - token: ["keyword", "operator", "keyword", "text", "string"], - regex: /^(\s*.*)(-?->>?)(.*)(\s*:\s*)(.*)?$/, - }, - ]}; - }; - r.inherits(s, i), - t.SequencebrampHighlightRules = s -}), -define("ace/mode/sequencebramp", ["require", "exports", "module", "ace/lib/oop", "ace/mode/text", "ace/mode/sequencebramp_highlight_rules", "ace/mode/folding/sequencebramp"], - function(e, t, n) { - "use strict"; - var r = e("../lib/oop") - , i = e("./text").Mode - , s = e("./sequencebramp_highlight_rules").SequencebrampHighlightRules - , u = function() { - this.HighlightRules = s - }; - r.inherits(u, i), - function() { - this.type = "text", - this.$id = "ace/mode/sequencebramp" - } - .call(u.prototype), - t.Mode = u -}) +define("ace/mode/sequencebramp_highlight_rules", + ["require", "exports", "module", "ace/lib/oop"], + function(e, t, n) { + "use strict"; + var r = e("../lib/oop"), + i = e("./text_highlight_rules").TextHighlightRules, + s = function() { + function t(e) { + var t = /\w/.test(e) ? "\\b" : "(?:\\B|^)"; + return t + e + "[^" + e + "].*?" + e + "(?![\\w*])"; + } + this.$rules = { + start: [{ + token: "comment", + regex: /^\s*#.*/ + }, { + token: ["text", "string"], + regex: /^(\s*title:)(.*)/, + caseInsensitive: true, + }, { + // this doesn't handle commas well + token: ["text", "keyword", "text", "string"], + regex: /^(\s*note\s+(?:left\s+of|right\s+of|over)\s+)(.*)(:)(.*)/, + caseInsensitive: true, + }, { + token: ["text", "string", "text", "keyword"], + regex: /^(\s*participant\s+)(.*)(\bas\b)(.*)/, + caseInsensitive: true, + }, { + token: ["text", "keyword"], + regex: /^(\s*participant\s+)(.*)/, + caseInsensitive: true, + }, { + token: ["keyword", "operator", "keyword", "text", "string"], + regex: /^(\s*.*)(-?->>?)(.*)(\s*:\s*)(.*)?$/, + }] + }; + }; + r.inherits(s, i), + t.SequencebrampHighlightRules = s; + } + ), +define("ace/mode/sequencebramp", + ["require", "exports", "module", "ace/lib/oop", "ace/mode/text", "ace/mode/sequencebramp_highlight_rules", "ace/mode/folding/sequencebramp"], + function(e, t, n) { + "use strict"; + var r = e("../lib/oop"), + i = e("./text").Mode, + s = e("./sequencebramp_highlight_rules").SequencebrampHighlightRules, + u = function() { + this.HighlightRules = s + }; + r.inherits(u, i), + function() { + this.type = "text", + this.$id = "ace/mode/sequencebramp" + } + .call(u.prototype), + t.Mode = u + } + ) From c716d02528d0a07c7d1eb363cd267e0dac205cd8 Mon Sep 17 00:00:00 2001 From: Andrew Donkin Date: Mon, 2 Oct 2017 12:37:43 +1300 Subject: [PATCH 3/4] sprinkling more semicolons --- src/mode-sequencebramp.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mode-sequencebramp.js b/src/mode-sequencebramp.js index 1e9b728..f52e9a4 100644 --- a/src/mode-sequencebramp.js +++ b/src/mode-sequencebramp.js @@ -48,7 +48,7 @@ define("ace/mode/sequencebramp", i = e("./text").Mode, s = e("./sequencebramp_highlight_rules").SequencebrampHighlightRules, u = function() { - this.HighlightRules = s + this.HighlightRules = s; }; r.inherits(u, i), function() { @@ -56,6 +56,6 @@ define("ace/mode/sequencebramp", this.$id = "ace/mode/sequencebramp" } .call(u.prototype), - t.Mode = u + t.Mode = u; } ) From 74f1d3cce9cc6eb10155d41e829fd0fda89f4368 Mon Sep 17 00:00:00 2001 From: Andrew Donkin Date: Mon, 2 Oct 2017 12:43:40 +1300 Subject: [PATCH 4/4] Fussy. Damned. Bot. (Also fixed arrows) --- src/mode-sequencebramp.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mode-sequencebramp.js b/src/mode-sequencebramp.js index f52e9a4..eb52e66 100644 --- a/src/mode-sequencebramp.js +++ b/src/mode-sequencebramp.js @@ -32,11 +32,11 @@ define("ace/mode/sequencebramp_highlight_rules", caseInsensitive: true, }, { token: ["keyword", "operator", "keyword", "text", "string"], - regex: /^(\s*.*)(-?->>?)(.*)(\s*:\s*)(.*)?$/, + regex: /^(\s*.*)(\s-?->>?)(.*)(\s*:\s*)(.*)?$/, }] }; }; - r.inherits(s, i), + r.inherits(s, i); t.SequencebrampHighlightRules = s; } ),