From cde392b565fb50980f2f585b8db78ab7c4b7b515 Mon Sep 17 00:00:00 2001
From: Adam Jimenez
Date: Sun, 4 Mar 2018 19:50:04 +0000
Subject: [PATCH 0001/1293] unused var
---
lib/ace/ext/beautify.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/ace/ext/beautify.js b/lib/ace/ext/beautify.js
index ba2b511f55e..83da2a59926 100644
--- a/lib/ace/ext/beautify.js
+++ b/lib/ace/ext/beautify.js
@@ -63,7 +63,6 @@ exports.beautify = function(session) {
var indent = 0;
var unindent = 0;
var roundDepth = 0;
- var onCaseLine = false;
var row;
var curRow = 0;
var rowsToAdd = 0;
From d4d6ef3b28a1c88bac514a83ddddc86b671bd1e9 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Thu, 26 Apr 2018 02:02:30 +0400
Subject: [PATCH 0002/1293] Squashed commit of the following:
commit 0caba832dec65f7917b4d7f512a54849656173ec
Author: Alex Shensis
Date: Wed Oct 25 15:51:50 2017 +0300
fix test error
commit 968d7e9397728a21e08d559bcc29b5e7bf0669b4
Author: Alex Shensis
Date: Sun Oct 22 20:54:19 2017 +0300
fix syntax checks
commit 942b4ebce6b3b114661c13552f4c949b8a303e68
Merge: 40ccc5c6f 485cd3568
Author: Alex Shensis
Date: Sun Oct 22 20:11:14 2017 +0300
merge with upstream changes
commit 40ccc5c6f00602eb89993f458c9e5403d6e114f0
Author: Alex Shensis
Date: Fri Oct 20 17:28:21 2017 +0300
attend reviewer comments 2
commit 268da25ff3b601c2362163661f8b14fa6bc02ebe
Author: Alex Shensis
Date: Thu Sep 7 21:10:29 2017 +0300
right-to-left text direction support
---
lib/ace/bidihandler.js | 210 ++++++++++++++++++++-------
lib/ace/commands/default_commands.js | 16 ++
lib/ace/edit_session.js | 4 -
lib/ace/editor.js | 5 +-
lib/ace/lib/bidiutil.js | 9 +-
lib/ace/virtual_renderer.js | 1 +
6 files changed, 186 insertions(+), 59 deletions(-)
diff --git a/lib/ace/bidihandler.js b/lib/ace/bidihandler.js
index 374e0bfe884..0524a899d67 100644
--- a/lib/ace/bidihandler.js
+++ b/lib/ace/bidihandler.js
@@ -33,8 +33,7 @@ define(function(require, exports, module) {
var bidiUtil = require("./lib/bidiutil");
var lang = require("./lib/lang");
-var useragent = require("./lib/useragent");
-var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
+var config = require("./config");
/**
* This object is used to ensure Bi-Directional support (for languages with text flowing from right to left, like Arabic or Hebrew)
@@ -48,8 +47,8 @@ var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
*
* @constructor
**/
-var BidiHandler = function(session) {
- this.session = session;
+var BidiHandler = function(editor) {
+ this.session = editor.session;
this.bidiMap = {};
/* current screen row */
this.currentRow = null;
@@ -61,9 +60,39 @@ var BidiHandler = function(session) {
this.isRtlDir = false;
this.line = "";
this.wrapIndent = 0;
- this.isLastRow = false;
this.EOF = "\xB6";
- this.seenBidi = false;
+ this.RLE = '\u202B';
+ this.contentWidth = 0;
+ this.fontMetrics = null;
+ this.rtlLineOffset = 0;
+ this.wrapOffset = 0;
+ this.isRtlSupported = /text$/i.test(this.session.getMode().$id);
+ this.isMoveLeftOperation = false;
+
+ if (this.isRtlSupported) {
+ editor.on("changeSelection", this.onChangeSelection);
+ editor.commands.on("exec", this.onCommandEmitted);
+ }
+
+ editor.session.on("change", this.onChange);
+
+ editor.session.on("changeWrapMode", function(e, session) {
+ session.$bidiHandler.currentRow = null;
+ });
+
+ editor.on("changeMode", function(e, editor) {
+ var isRtlSupported = /text$/i.test(editor.session.getMode().$id);
+ if (isRtlSupported ^ editor.session.$bidiHandler.isRtlSupported) {
+ editor.session.$bidiHandler.isRtlSupported = isRtlSupported;
+ if (isRtlSupported) {
+ editor.on("changeSelection", editor.session.$bidiHandler.onChangeSelection);
+ editor.commands.on("exec", editor.session.$bidiHandler.onCommandEmitted);
+ } else {
+ editor.off("changeSelection", editor.session.$bidiHandler.onChangeSelection);
+ editor.commands.off("exec", editor.session.$bidiHandler.onCommandEmitted);
+ }
+ }
+ });
};
(function() {
@@ -76,8 +105,6 @@ var BidiHandler = function(session) {
* @param {Number} the wrapped screen line index [ optional]
**/
this.isBidiRow = function(screenRow, docRow, splitIndex) {
- if (!this.seenBidi)
- return false;
if (screenRow !== this.currentRow) {
this.currentRow = screenRow;
this.updateRowLine(docRow, splitIndex);
@@ -86,18 +113,6 @@ var BidiHandler = function(session) {
return this.bidiMap.bidiLevels;
};
- this.onChange = function(delta) {
- if (!this.seenBidi) {
- if (delta.action == "insert" && bidiRE.test(delta.lines.join("\n"))) {
- this.seenBidi = true;
- this.currentRow = null;
- }
- }
- else {
- this.currentRow = null;
- }
- };
-
this.getDocumentRow = function() {
var docRow = 0;
var rowCache = this.session.$screenRowCache;
@@ -123,6 +138,8 @@ var BidiHandler = function(session) {
prevIndex = currentIndex;
splitIndex++;
}
+ } else {
+ splitIndex = this.currentRow;
}
return splitIndex;
@@ -132,9 +149,12 @@ var BidiHandler = function(session) {
if (docRow === undefined)
docRow = this.getDocumentRow();
+ var isLastRow = (docRow === this.session.getLength() - 1),
+ endOfLine = isLastRow ? this.EOF : this.EOL;
+
this.wrapIndent = 0;
- this.isLastRow = (docRow === this.session.getLength() - 1);
this.line = this.session.getLine(docRow);
+ this.isRtlDir = this.isRtlSupported && (this.line.charAt(0) === this.RLE);
if (this.session.$useWrapMode) {
var splits = this.session.$wrapData[docRow];
if (splits) {
@@ -143,13 +163,18 @@ var BidiHandler = function(session) {
if(splitIndex > 0 && splits.length) {
this.wrapIndent = splits.indent;
+ this.wrapOffset = this.wrapIndent * this.charWidths[bidiUtil.L];
this.line = (splitIndex < splits.length) ?
- this.line.substring(splits[splitIndex - 1], splits[splits.length - 1]) :
+ this.line.substring(splits[splitIndex - 1], splits[splitIndex]) :
this.line.substring(splits[splits.length - 1]);
} else {
this.line = this.line.substring(0, splits[splitIndex]);
}
}
+ if (splitIndex == splits.length)
+ this.line += (this.showInvisibles) ? endOfLine : bidiUtil.DOT;
+ } else {
+ this.line += this.showInvisibles ? endOfLine : bidiUtil.DOT;
}
/* replace tab and wide characters by commensurate spaces */
@@ -162,24 +187,22 @@ var BidiHandler = function(session) {
}
return ch;
});
+
+ if(this.isRtlDir) {
+ this.fontMetrics.$main.innerHTML = (this.line.charAt(this.line.length - 1) == bidiUtil.DOT) ? this.line.substr(0, this.line.length - 1) : this.line;
+ this.rtlLineOffset = this.contentWidth - this.fontMetrics.$main.getBoundingClientRect().width;
+ }
};
this.updateBidiMap = function() {
- var textCharTypes = [], endOfLine = this.isLastRow ? this.EOF : this.EOL;
- var line = this.line + (this.showInvisibles ? endOfLine : bidiUtil.DOT);
- if (bidiUtil.hasBidiCharacters(line, textCharTypes)) {
- this.bidiMap = bidiUtil.doBidiReorder(line, textCharTypes, this.isRtlDir);
+ var textCharTypes = [];
+ if (bidiUtil.hasBidiCharacters(this.line, textCharTypes) || this.isRtlDir) {
+ this.bidiMap = bidiUtil.doBidiReorder(this.line, textCharTypes, this.isRtlDir);
} else {
this.bidiMap = {};
}
};
- /**
- * Resets stored info related to current screen row
- **/
- this.markAsDirty = function() {
- this.currentRow = null;
- };
/**
* Updates array of character widths
@@ -187,26 +210,21 @@ var BidiHandler = function(session) {
*
**/
this.updateCharacterWidths = function(fontMetrics) {
- if (!this.seenBidi)
- return;
if (this.characterWidth === fontMetrics.$characterSize.width)
return;
+ this.fontMetrics = fontMetrics;
var characterWidth = this.characterWidth = fontMetrics.$characterSize.width;
var bidiCharWidth = fontMetrics.$measureCharWidth("\u05d4");
this.charWidths[bidiUtil.L] = this.charWidths[bidiUtil.EN] = this.charWidths[bidiUtil.ON_R] = characterWidth;
this.charWidths[bidiUtil.R] = this.charWidths[bidiUtil.AN] = bidiCharWidth;
- this.charWidths[bidiUtil.R_H] = useragent.isChrome ? bidiCharWidth : bidiCharWidth * 0.45;
- this.charWidths[bidiUtil.B] = 0;
+ this.charWidths[bidiUtil.R_H] = bidiCharWidth * 0.45;
+ this.charWidths[bidiUtil.B] = this.charWidths[bidiUtil.RLE] = 0;
this.currentRow = null;
};
- this.getShowInvisibles = function() {
- return this.showInvisibles;
- };
-
this.setShowInvisibles = function(showInvisibles) {
this.showInvisibles = showInvisibles;
this.currentRow = null;
@@ -216,8 +234,78 @@ var BidiHandler = function(session) {
this.EOL = eolChar;
};
- this.setTextDir = function(isRtlDir) {
- this.isRtlDir = isRtlDir;
+ this.hasRtlSupport = function() {
+ return this.isRtlSupported;
+ };
+
+ this.setContentWidth = function(width) {
+ this.contentWidth = width;
+ };
+
+ this.isRtlLine = function(row) {
+ if (row != undefined)
+ return (this.session.getLine(row).charAt(0) == this.RLE);
+ else
+ return this.isRtlDir;
+ };
+
+ this.toggleRtlDirection = function(editor, isRtlDir) {
+ var cursor = editor.getCursorPosition();
+ for (var row = editor.selection.getSelectionAnchor().row; row <= cursor.row; row++) {
+ if (!isRtlDir && editor.session.getLine(row).charAt(0) === editor.session.$bidiHandler.RLE)
+ editor.session.doc.removeInLine(row, 0, 1);
+ else if (isRtlDir && editor.session.getLine(row).charAt(0) !== editor.session.$bidiHandler.RLE)
+ editor.session.doc.insert({column: 0, row: row}, editor.session.$bidiHandler.RLE);
+ }
+ };
+
+ /**
+ * Whenever the selection is changed, prevent cursor (lead) to be positioned at
+ * position 0 of right-to-left line in order to maintain the RLE marker at this position.
+ * When cursor reaches position 0, either advance it to position 1 of current line (default)
+ * or to last position of previous line (if it comes from position 1 as the result of commands
+ * mentioned in 'onCommandEmitted' event handler).
+ * This serves few purposes:
+ * - ensures cursor visual movement as if RLE mark doesn't exist.
+ * - prevents character insertion before RLE mark.
+ * - prevents RLE mark removal when 'delete' is pressed when cursot stays at position 0.
+ * - ensures RLE mark removal on line merge, when 'delete' is pressed and cursor stays
+ * at last position of previous line and when 'backspace' is pressed and cursor stays at
+ * first position of current line. This is achived by hacking range boundaries on 'remove' operation.
+ **/
+ this.onChangeSelection = function(e, editor) {
+ var lead = editor.getSelection().lead;
+ if (editor.session.$bidiHandler.isRtlLine(lead.row)) {
+ if (lead.column === 0) {
+ if (editor.session.$bidiHandler.isMoveLeftOperation && lead.row > 0) {
+ editor.getSelection().moveCursorTo(lead.row - 1, editor.session.getLine(lead.row - 1).length);
+ } else {
+ if (editor.getSelection().isEmpty())
+ lead.column += 1;
+ else
+ lead.setPosition(lead.row, lead.column + 1);
+ }
+ }
+ }
+ };
+
+ this.onCommandEmitted = function(commadEvent) {
+ commadEvent.editor.session.$bidiHandler.isMoveLeftOperation = /gotoleft|selectleft|backspace|removewordleft/.test(commadEvent.command.name);
+ };
+
+ /**
+ * Whenever the document is changed make sure that line break operatin
+ * on right-to-left line (like pressing Enter or pasting multi-line text)
+ * produces new right-to-left lines
+ **/
+ this.onChange = function(delta, session) {
+ session.$bidiHandler.currentRow = null;
+ if (session.$bidiHandler.isRtlLine(delta.start.row) && delta.action === 'insert' && delta.lines.length > 1) {
+ for (var row = delta.start.row; row < delta.end.row; row++) {
+ if (session.getLine(row + 1).charAt(0) !== session.$bidiHandler.RLE)
+ session.getDocument().$lines[row + 1] = session.$bidiHandler.RLE + session.getLine(row + 1);
+ }
+ }
};
/**
@@ -228,21 +316,26 @@ var BidiHandler = function(session) {
**/
this.getPosLeft = function(col) {
col -= this.wrapIndent;
- var visualIdx = bidiUtil.getVisualFromLogicalIdx(col > 0 ? col - 1 : 0, this.bidiMap),
+ var leftBoundary = (this.line.charAt(0) === this.RLE) ? 1 : 0;
+ var logicalIdx = (col > leftBoundary) ? (this.session.getOverwrite() ? col : col - 1) : leftBoundary;
+ var visualIdx = bidiUtil.getVisualFromLogicalIdx(logicalIdx, this.bidiMap),
levels = this.bidiMap.bidiLevels, left = 0;
- if (col === 0 && levels[visualIdx] % 2 !== 0)
- visualIdx++;
-
+ if (!this.session.getOverwrite() && col <= leftBoundary && levels[visualIdx] % 2 !== 0)
+ visualIdx++;
+
for (var i = 0; i < visualIdx; i++) {
left += this.charWidths[levels[i]];
}
- if (col !== 0 && levels[visualIdx] % 2 === 0)
+ if (!this.session.getOverwrite() && (col > leftBoundary) && (levels[visualIdx] % 2 === 0))
left += this.charWidths[levels[visualIdx]];
if (this.wrapIndent)
- left += this.wrapIndent * this.charWidths[bidiUtil.L];
+ left += this.isRtlDir ? (-1 * this.wrapOffset) : this.wrapOffset;
+
+ if (this.isRtlDir)
+ left += this.rtlLineOffset;
return left;
};
@@ -255,9 +348,12 @@ var BidiHandler = function(session) {
* @return {Array of Objects} Each object contains 'left' and 'width' values defining selection rectangle.
**/
this.getSelections = function(startCol, endCol) {
- var map = this.bidiMap, levels = map.bidiLevels, level, offset = this.wrapIndent * this.charWidths[bidiUtil.L], selections = [],
+ var map = this.bidiMap, levels = map.bidiLevels, level, selections = [], offset = 0,
selColMin = Math.min(startCol, endCol) - this.wrapIndent, selColMax = Math.max(startCol, endCol) - this.wrapIndent,
isSelected = false, isSelectedPrev = false, selectionStart = 0;
+
+ if (this.wrapIndent)
+ offset += this.isRtlDir ? (-1 * this.wrapOffset) : this.wrapOffset;
for (var logIdx, visIdx = 0; visIdx < levels.length; visIdx++) {
logIdx = map.logicalFromVisual[visIdx];
@@ -276,6 +372,11 @@ var BidiHandler = function(session) {
selections.push({left: selectionStart, width: offset - selectionStart});
}
+ if(this.isRtlDir) {
+ for (var i = 0; i < selections.length; i++) {
+ selections[i].left += this.rtlLineOffset;
+ }
+ }
return selections;
};
@@ -286,13 +387,15 @@ var BidiHandler = function(session) {
* @return {Number} screen column number corresponding to given pixel offset
**/
this.offsetToCol = function(posX) {
+ if(this.isRtlDir)
+ posX -= this.rtlLineOffset;
+
var logicalIdx = 0, posX = Math.max(posX, 0),
offset = 0, visualIdx = 0, levels = this.bidiMap.bidiLevels,
charWidth = this.charWidths[levels[visualIdx]];
- if (this.wrapIndent) {
- posX -= this.wrapIndent * this.charWidths[bidiUtil.L];
- }
+ if (this.wrapIndent)
+ posX -= this.isRtlDir ? (-1 * this.wrapOffset) : this.wrapOffset;
while(posX > offset + charWidth/2) {
offset += charWidth;
@@ -329,6 +432,9 @@ var BidiHandler = function(session) {
logicalIdx = this.bidiMap.logicalFromVisual[visualIdx];
}
+ if (logicalIdx === 0 && this.isRtlDir)
+ logicalIdx++;
+
return (logicalIdx + this.wrapIndent);
};
diff --git a/lib/ace/commands/default_commands.js b/lib/ace/commands/default_commands.js
index 527bebe874a..b813c9c1c0f 100644
--- a/lib/ace/commands/default_commands.js
+++ b/lib/ace/commands/default_commands.js
@@ -712,6 +712,22 @@ exports.commands = [{
},
multiSelectAction: "forEach",
readOnly: true
+}, {
+ name: "leftToRight",
+ bindKey: bindKey("Ctrl-Alt-Shift-L", "Command-Alt-Shift-L"),
+ exec: function(editor) {
+ if (editor.session.$bidiHandler.hasRtlSupport())
+ editor.session.$bidiHandler.toggleRtlDirection(editor, false);
+ },
+ readOnly: true
+}, {
+ name: "rightToLeft",
+ bindKey: bindKey("Ctrl-Alt-Shift-R", "Command-Alt-Shift-R"),
+ exec: function(editor) {
+ if (editor.session.$bidiHandler.hasRtlSupport())
+ editor.session.$bidiHandler.toggleRtlDirection(editor, true);
+ },
+ readOnly: true
}, {
name: "invertSelection",
bindKey: bindKey(null, null),
diff --git a/lib/ace/edit_session.js b/lib/ace/edit_session.js
index 3d20309e425..12276abadc8 100644
--- a/lib/ace/edit_session.js
+++ b/lib/ace/edit_session.js
@@ -33,7 +33,6 @@ define(function(require, exports, module) {
var oop = require("./lib/oop");
var lang = require("./lib/lang");
-var BidiHandler = require("./bidihandler").BidiHandler;
var config = require("./config");
var EventEmitter = require("./lib/event_emitter").EventEmitter;
var Selection = require("./selection").Selection;
@@ -159,7 +158,6 @@ var EditSession = function(text, mode) {
if (typeof text != "object" || !text.getLine)
text = new Document(text);
- this.$bidiHandler = new BidiHandler(this);
this.setDocument(text);
this.selection = new Selection(this);
@@ -255,7 +253,6 @@ EditSession.$uid = 0;
this.onChange = function(delta) {
this.$modified = true;
- this.$bidiHandler.onChange(delta);
this.$resetRowCache(delta.start.row);
var removedFolds = this.$updateInternalDataOnChange(delta);
@@ -1536,7 +1533,6 @@ EditSession.$uid = 0;
if (this.$wrapLimitRange.min !== min || this.$wrapLimitRange.max !== max) {
this.$wrapLimitRange = { min: min, max: max };
this.$modified = true;
- this.$bidiHandler.markAsDirty();
// This will force a recalculation of the wrap limit
if (this.$useWrapMode)
diff --git a/lib/ace/editor.js b/lib/ace/editor.js
index e7fec475eb8..992f0285a94 100644
--- a/lib/ace/editor.js
+++ b/lib/ace/editor.js
@@ -49,6 +49,7 @@ var CommandManager = require("./commands/command_manager").CommandManager;
var defaultCommands = require("./commands/default_commands").commands;
var config = require("./config");
var TokenIterator = require("./token_iterator").TokenIterator;
+var BidiHandler = require("./bidihandler").BidiHandler;
var clipboard = require("./clipboard");
@@ -321,6 +322,8 @@ Editor.$uid = 0;
this.session = session;
if (session) {
+ session.$bidiHandler = new BidiHandler(this);
+
this.$onDocumentChange = this.onDocumentChange.bind(this);
session.on("change", this.$onDocumentChange);
this.renderer.setSession(session);
@@ -1005,7 +1008,7 @@ Editor.$uid = 0;
}
}
-
+
if (text == "\t")
text = this.session.getTabString();
diff --git a/lib/ace/lib/bidiutil.js b/lib/ace/lib/bidiutil.js
index 522a8df5a9f..ec6fbcd192a 100644
--- a/lib/ace/lib/bidiutil.js
+++ b/lib/ace/lib/bidiutil.js
@@ -320,6 +320,8 @@ exports.AN = 4;
exports.R_H = 5;
/* invisible EOL (6 - even), zero width */
exports.B = 6;
+/* invisible RLE (7 - odd), zero width */
+exports.RLE = 7;
exports.DOT = "\xB7";
@@ -363,6 +365,9 @@ exports.doBidiReorder = function(text, textCharTypes, isRtl) {
if (chars[chars.length - 1] === exports.DOT)
levels[chars.length - 1] = exports.B;
+ if (chars[0] === '\u202B')
+ levels[0] = exports.RLE;
+
for (var i = 0; i < logicalFromVisual.length; i++) {
bidiLevels[i] = levels[logicalFromVisual[i]];
}
@@ -375,13 +380,13 @@ exports.doBidiReorder = function(text, textCharTypes, isRtl) {
* @param {String} text string to be reordered
* @param {Array} unicode character types (to be filled by this method)
*
- * @return {Boolean} 'true' if text contains Bidi characters, otherwise 'false'
+ * @return {Boolean} 'true' if text contains Bidi characters, otherwise 'false'
**/
exports.hasBidiCharacters = function(text, textCharTypes){
var ret = false;
for (var i = 0; i < text.length; i++){
textCharTypes[i] = _getCharacterType(text.charAt(i));
- if (!ret && (textCharTypes[i] == R || textCharTypes[i] == AL))
+ if (!ret && (textCharTypes[i] == R || textCharTypes[i] == AL || textCharTypes[i] == AN))
ret = true;
}
return ret;
diff --git a/lib/ace/virtual_renderer.js b/lib/ace/virtual_renderer.js
index 973a9bc93e3..1cd8bec9491 100644
--- a/lib/ace/virtual_renderer.js
+++ b/lib/ace/virtual_renderer.js
@@ -1040,6 +1040,7 @@ var VirtualRenderer = function(container, theme) {
height : this.$size.scrollerHeight
};
+ this.session.$bidiHandler.setContentWidth(longestLine);
// For debugging.
// console.log(JSON.stringify(this.layerConfig));
From bbc7323a74d3e5da15cf1c7b2023479496a65155 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Sun, 29 Apr 2018 00:53:23 +0400
Subject: [PATCH 0003/1293] move rtl related code into extension
---
demo/kitchen-sink/demo.js | 6 ++
lib/ace/bidihandler.js | 125 ++++++++-------------------
lib/ace/commands/default_commands.js | 16 ----
lib/ace/edit_session.js | 4 +
lib/ace/editor.js | 5 +-
lib/ace/ext/rtl.js | 124 ++++++++++++++++++++++++++
lib/ace/virtual_renderer.js | 3 +-
7 files changed, 171 insertions(+), 112 deletions(-)
create mode 100644 lib/ace/ext/rtl.js
diff --git a/demo/kitchen-sink/demo.js b/demo/kitchen-sink/demo.js
index 9040f642151..829d0941739 100644
--- a/demo/kitchen-sink/demo.js
+++ b/demo/kitchen-sink/demo.js
@@ -34,6 +34,8 @@ define(function(require, exports, module) {
require("ace/lib/fixoldbrowsers");
+require("ace/ext/rtl");
+
require("ace/multi_select");
require("ace/ext/spellcheck");
require("./inline_editor");
@@ -368,6 +370,10 @@ optionsPanel.add({
}
},
More: {
+ "Rtl Text": {
+ path: "rtlText",
+ position: 900
+ },
"Show token info": {
path: "showTokenInfo",
position: 1000
diff --git a/lib/ace/bidihandler.js b/lib/ace/bidihandler.js
index 0524a899d67..b955f5faebf 100644
--- a/lib/ace/bidihandler.js
+++ b/lib/ace/bidihandler.js
@@ -33,7 +33,7 @@ define(function(require, exports, module) {
var bidiUtil = require("./lib/bidiutil");
var lang = require("./lib/lang");
-var config = require("./config");
+var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\u202B]/;
/**
* This object is used to ensure Bi-Directional support (for languages with text flowing from right to left, like Arabic or Hebrew)
@@ -47,8 +47,8 @@ var config = require("./config");
*
* @constructor
**/
-var BidiHandler = function(editor) {
- this.session = editor.session;
+var BidiHandler = function(session) {
+ this.session = session;
this.bidiMap = {};
/* current screen row */
this.currentRow = null;
@@ -61,38 +61,13 @@ var BidiHandler = function(editor) {
this.line = "";
this.wrapIndent = 0;
this.EOF = "\xB6";
- this.RLE = '\u202B';
+ this.RLE = "\u202B";
this.contentWidth = 0;
this.fontMetrics = null;
this.rtlLineOffset = 0;
this.wrapOffset = 0;
- this.isRtlSupported = /text$/i.test(this.session.getMode().$id);
- this.isMoveLeftOperation = false;
-
- if (this.isRtlSupported) {
- editor.on("changeSelection", this.onChangeSelection);
- editor.commands.on("exec", this.onCommandEmitted);
- }
-
- editor.session.on("change", this.onChange);
-
- editor.session.on("changeWrapMode", function(e, session) {
- session.$bidiHandler.currentRow = null;
- });
-
- editor.on("changeMode", function(e, editor) {
- var isRtlSupported = /text$/i.test(editor.session.getMode().$id);
- if (isRtlSupported ^ editor.session.$bidiHandler.isRtlSupported) {
- editor.session.$bidiHandler.isRtlSupported = isRtlSupported;
- if (isRtlSupported) {
- editor.on("changeSelection", editor.session.$bidiHandler.onChangeSelection);
- editor.commands.on("exec", editor.session.$bidiHandler.onCommandEmitted);
- } else {
- editor.off("changeSelection", editor.session.$bidiHandler.onChangeSelection);
- editor.commands.off("exec", editor.session.$bidiHandler.onCommandEmitted);
- }
- }
- });
+ this.isMoveLeftOperation = false;
+ this.seenBidi = null;
};
(function() {
@@ -105,6 +80,8 @@ var BidiHandler = function(editor) {
* @param {Number} the wrapped screen line index [ optional]
**/
this.isBidiRow = function(screenRow, docRow, splitIndex) {
+ if (this.seenBidi == false)
+ return false;
if (screenRow !== this.currentRow) {
this.currentRow = screenRow;
this.updateRowLine(docRow, splitIndex);
@@ -113,6 +90,18 @@ var BidiHandler = function(editor) {
return this.bidiMap.bidiLevels;
};
+ this.onChange = function(delta) {
+ if (!this.seenBidi) {
+ if (delta.action == "insert" && bidiRE.test(delta.lines.join("\n"))) {
+ this.seenBidi = true;
+ this.currentRow = null;
+ }
+ }
+ else {
+ this.currentRow = null;
+ }
+ };
+
this.getDocumentRow = function() {
var docRow = 0;
var rowCache = this.session.$screenRowCache;
@@ -139,7 +128,7 @@ var BidiHandler = function(editor) {
splitIndex++;
}
} else {
- splitIndex = this.currentRow;
+ splitIndex = this.currentRow;
}
return splitIndex;
@@ -154,7 +143,7 @@ var BidiHandler = function(editor) {
this.wrapIndent = 0;
this.line = this.session.getLine(docRow);
- this.isRtlDir = this.isRtlSupported && (this.line.charAt(0) === this.RLE);
+ this.isRtlDir = this.line.charAt(0) === this.RLE;
if (this.session.$useWrapMode) {
var splits = this.session.$wrapData[docRow];
if (splits) {
@@ -188,7 +177,7 @@ var BidiHandler = function(editor) {
return ch;
});
- if(this.isRtlDir) {
+ if (this.isRtlDir) {
this.fontMetrics.$main.innerHTML = (this.line.charAt(this.line.length - 1) == bidiUtil.DOT) ? this.line.substr(0, this.line.length - 1) : this.line;
this.rtlLineOffset = this.contentWidth - this.fontMetrics.$main.getBoundingClientRect().width;
}
@@ -203,6 +192,12 @@ var BidiHandler = function(editor) {
}
};
+ /**
+ * Resets stored info related to current screen row
+ **/
+ this.markAsDirty = function() {
+ this.currentRow = null;
+ };
/**
* Updates array of character widths
@@ -234,10 +229,6 @@ var BidiHandler = function(editor) {
this.EOL = eolChar;
};
- this.hasRtlSupport = function() {
- return this.isRtlSupported;
- };
-
this.setContentWidth = function(width) {
this.contentWidth = width;
};
@@ -249,8 +240,8 @@ var BidiHandler = function(editor) {
return this.isRtlDir;
};
- this.toggleRtlDirection = function(editor, isRtlDir) {
- var cursor = editor.getCursorPosition();
+ this.setRtlDirection = function(editor, isRtlDir) {
+ var cursor = editor.getCursorPosition();
for (var row = editor.selection.getSelectionAnchor().row; row <= cursor.row; row++) {
if (!isRtlDir && editor.session.getLine(row).charAt(0) === editor.session.$bidiHandler.RLE)
editor.session.doc.removeInLine(row, 0, 1);
@@ -259,54 +250,6 @@ var BidiHandler = function(editor) {
}
};
- /**
- * Whenever the selection is changed, prevent cursor (lead) to be positioned at
- * position 0 of right-to-left line in order to maintain the RLE marker at this position.
- * When cursor reaches position 0, either advance it to position 1 of current line (default)
- * or to last position of previous line (if it comes from position 1 as the result of commands
- * mentioned in 'onCommandEmitted' event handler).
- * This serves few purposes:
- * - ensures cursor visual movement as if RLE mark doesn't exist.
- * - prevents character insertion before RLE mark.
- * - prevents RLE mark removal when 'delete' is pressed when cursot stays at position 0.
- * - ensures RLE mark removal on line merge, when 'delete' is pressed and cursor stays
- * at last position of previous line and when 'backspace' is pressed and cursor stays at
- * first position of current line. This is achived by hacking range boundaries on 'remove' operation.
- **/
- this.onChangeSelection = function(e, editor) {
- var lead = editor.getSelection().lead;
- if (editor.session.$bidiHandler.isRtlLine(lead.row)) {
- if (lead.column === 0) {
- if (editor.session.$bidiHandler.isMoveLeftOperation && lead.row > 0) {
- editor.getSelection().moveCursorTo(lead.row - 1, editor.session.getLine(lead.row - 1).length);
- } else {
- if (editor.getSelection().isEmpty())
- lead.column += 1;
- else
- lead.setPosition(lead.row, lead.column + 1);
- }
- }
- }
- };
-
- this.onCommandEmitted = function(commadEvent) {
- commadEvent.editor.session.$bidiHandler.isMoveLeftOperation = /gotoleft|selectleft|backspace|removewordleft/.test(commadEvent.command.name);
- };
-
- /**
- * Whenever the document is changed make sure that line break operatin
- * on right-to-left line (like pressing Enter or pasting multi-line text)
- * produces new right-to-left lines
- **/
- this.onChange = function(delta, session) {
- session.$bidiHandler.currentRow = null;
- if (session.$bidiHandler.isRtlLine(delta.start.row) && delta.action === 'insert' && delta.lines.length > 1) {
- for (var row = delta.start.row; row < delta.end.row; row++) {
- if (session.getLine(row + 1).charAt(0) !== session.$bidiHandler.RLE)
- session.getDocument().$lines[row + 1] = session.$bidiHandler.RLE + session.getLine(row + 1);
- }
- }
- };
/**
* Returns offset of character at position defined by column.
@@ -322,8 +265,8 @@ var BidiHandler = function(editor) {
levels = this.bidiMap.bidiLevels, left = 0;
if (!this.session.getOverwrite() && col <= leftBoundary && levels[visualIdx] % 2 !== 0)
- visualIdx++;
-
+ visualIdx++;
+
for (var i = 0; i < visualIdx; i++) {
left += this.charWidths[levels[i]];
}
@@ -351,7 +294,7 @@ var BidiHandler = function(editor) {
var map = this.bidiMap, levels = map.bidiLevels, level, selections = [], offset = 0,
selColMin = Math.min(startCol, endCol) - this.wrapIndent, selColMax = Math.max(startCol, endCol) - this.wrapIndent,
isSelected = false, isSelectedPrev = false, selectionStart = 0;
-
+
if (this.wrapIndent)
offset += this.isRtlDir ? (-1 * this.wrapOffset) : this.wrapOffset;
diff --git a/lib/ace/commands/default_commands.js b/lib/ace/commands/default_commands.js
index b813c9c1c0f..527bebe874a 100644
--- a/lib/ace/commands/default_commands.js
+++ b/lib/ace/commands/default_commands.js
@@ -712,22 +712,6 @@ exports.commands = [{
},
multiSelectAction: "forEach",
readOnly: true
-}, {
- name: "leftToRight",
- bindKey: bindKey("Ctrl-Alt-Shift-L", "Command-Alt-Shift-L"),
- exec: function(editor) {
- if (editor.session.$bidiHandler.hasRtlSupport())
- editor.session.$bidiHandler.toggleRtlDirection(editor, false);
- },
- readOnly: true
-}, {
- name: "rightToLeft",
- bindKey: bindKey("Ctrl-Alt-Shift-R", "Command-Alt-Shift-R"),
- exec: function(editor) {
- if (editor.session.$bidiHandler.hasRtlSupport())
- editor.session.$bidiHandler.toggleRtlDirection(editor, true);
- },
- readOnly: true
}, {
name: "invertSelection",
bindKey: bindKey(null, null),
diff --git a/lib/ace/edit_session.js b/lib/ace/edit_session.js
index 12276abadc8..3d20309e425 100644
--- a/lib/ace/edit_session.js
+++ b/lib/ace/edit_session.js
@@ -33,6 +33,7 @@ define(function(require, exports, module) {
var oop = require("./lib/oop");
var lang = require("./lib/lang");
+var BidiHandler = require("./bidihandler").BidiHandler;
var config = require("./config");
var EventEmitter = require("./lib/event_emitter").EventEmitter;
var Selection = require("./selection").Selection;
@@ -158,6 +159,7 @@ var EditSession = function(text, mode) {
if (typeof text != "object" || !text.getLine)
text = new Document(text);
+ this.$bidiHandler = new BidiHandler(this);
this.setDocument(text);
this.selection = new Selection(this);
@@ -253,6 +255,7 @@ EditSession.$uid = 0;
this.onChange = function(delta) {
this.$modified = true;
+ this.$bidiHandler.onChange(delta);
this.$resetRowCache(delta.start.row);
var removedFolds = this.$updateInternalDataOnChange(delta);
@@ -1533,6 +1536,7 @@ EditSession.$uid = 0;
if (this.$wrapLimitRange.min !== min || this.$wrapLimitRange.max !== max) {
this.$wrapLimitRange = { min: min, max: max };
this.$modified = true;
+ this.$bidiHandler.markAsDirty();
// This will force a recalculation of the wrap limit
if (this.$useWrapMode)
diff --git a/lib/ace/editor.js b/lib/ace/editor.js
index 992f0285a94..e7fec475eb8 100644
--- a/lib/ace/editor.js
+++ b/lib/ace/editor.js
@@ -49,7 +49,6 @@ var CommandManager = require("./commands/command_manager").CommandManager;
var defaultCommands = require("./commands/default_commands").commands;
var config = require("./config");
var TokenIterator = require("./token_iterator").TokenIterator;
-var BidiHandler = require("./bidihandler").BidiHandler;
var clipboard = require("./clipboard");
@@ -322,8 +321,6 @@ Editor.$uid = 0;
this.session = session;
if (session) {
- session.$bidiHandler = new BidiHandler(this);
-
this.$onDocumentChange = this.onDocumentChange.bind(this);
session.on("change", this.$onDocumentChange);
this.renderer.setSession(session);
@@ -1008,7 +1005,7 @@ Editor.$uid = 0;
}
}
-
+
if (text == "\t")
text = this.session.getTabString();
diff --git a/lib/ace/ext/rtl.js b/lib/ace/ext/rtl.js
new file mode 100644
index 00000000000..0db8c99b6f0
--- /dev/null
+++ b/lib/ace/ext/rtl.js
@@ -0,0 +1,124 @@
+define(function(require, exports, module) {
+"use strict";
+/** simple statusbar **/
+var dom = require("ace/lib/dom");
+var lang = require("ace/lib/lang");
+
+var commands = [{
+ name: "leftToRight",
+ bindKey: { win: "Ctrl-Alt-Shift-L", mac: "Command-Alt-Shift-L" },
+ exec: function(editor) {
+ editor.session.$bidiHandler.setRtlDirection(editor, false);
+ },
+ readOnly: true
+}, {
+ name: "rightToLeft",
+ bindKey: { win: "Ctrl-Alt-Shift-R", mac: "Command-Alt-Shift-R" },
+ exec: function(editor) {
+ editor.session.$bidiHandler.setRtlDirection(editor, true);
+ },
+ readOnly: true
+}];
+
+var Editor = require("../editor").Editor;
+require("../config").defineOptions(Editor.prototype, "editor", {
+ rtlText: {
+ set: function(val) {
+ if (val) {
+ this.on("session", onChange);
+ this.on("changeSelection", onChangeSelection);
+ this.renderer.on("afterRender", updateLineDirection);
+ this.commands.on("exec", onCommandEmitted);
+ this.commands.addCommands(commands);
+ } else {
+ this.off("session", onChange);
+ this.off("changeSelection", onChangeSelection);
+ this.renderer.off("afterRender", updateLineDirection);
+ this.commands.off("exec", onCommandEmitted);
+ this.commands.removeCommands(commands);
+ clearTextLayer(this.renderer);
+ }
+ this.renderer.updateFull();
+ }
+ }
+});
+
+/**
+ * Whenever the selection is changed, prevent cursor (lead) to be positioned at
+ * position 0 of right-to-left line in order to maintain the RLE marker at this position.
+ * When cursor reaches position 0, either advance it to position 1 of current line (default)
+ * or to last position of previous line (if it comes from position 1 as the result of commands
+ * mentioned in 'onCommandEmitted' event handler).
+ * This serves few purposes:
+ * - ensures cursor visual movement as if RLE mark doesn't exist.
+ * - prevents character insertion before RLE mark.
+ * - prevents RLE mark removal when 'delete' is pressed when cursot stays at position 0.
+ * - ensures RLE mark removal on line merge, when 'delete' is pressed and cursor stays
+ * at last position of previous line and when 'backspace' is pressed and cursor stays at
+ * first position of current line. This is achived by hacking range boundaries on 'remove' operation.
+ **/
+function onChangeSelection(e, editor) {
+ var lead = editor.getSelection().lead;
+ if (editor.session.$bidiHandler.isRtlLine(lead.row)) {
+ if (lead.column === 0) {
+ if (editor.session.$bidiHandler.isMoveLeftOperation && lead.row > 0) {
+ editor.getSelection().moveCursorTo(lead.row - 1, editor.session.getLine(lead.row - 1).length);
+ } else {
+ if (editor.getSelection().isEmpty())
+ lead.column += 1;
+ else
+ lead.setPosition(lead.row, lead.column + 1);
+ }
+ }
+ }
+}
+
+function onCommandEmitted(commadEvent) {
+ commadEvent.editor.session.$bidiHandler.isMoveLeftOperation = /gotoleft|selectleft|backspace|removewordleft/.test(commadEvent.command.name);
+}
+
+/**
+ * Whenever the document is changed make sure that line break operatin
+ * on right-to-left line (like pressing Enter or pasting multi-line text)
+ * produces new right-to-left lines
+ **/
+function onChange(delta, session) {
+ session.$bidiHandler.currentRow = null;
+ if (session.$bidiHandler.isRtlLine(delta.start.row) && delta.action === 'insert' && delta.lines.length > 1) {
+ for (var row = delta.start.row; row < delta.end.row; row++) {
+ if (session.getLine(row + 1).charAt(0) !== session.$bidiHandler.RLE)
+ session.getDocument().$lines[row + 1] = session.$bidiHandler.RLE + session.getLine(row + 1);
+ }
+ }
+}
+
+function updateLineDirection(e, renderer) {
+ var session = renderer.session;
+ var $bidiHandler = session.$bidiHandler;
+ var cells = renderer.$textLayer.$lines.cells;
+ var width = renderer.layerConfig.width - renderer.layerConfig.padding + "px";
+ cells.forEach(function(cell) {
+ var style = cell.element.style;
+ if ($bidiHandler && $bidiHandler.isRtlLine(cell.row)) {
+ style.direction = "rtl";
+ style.textAlign = "right";
+ style.width = width;
+ } else {
+ style.direction = "";
+ style.textAlign = "";
+ style.width = "";
+ }
+ });
+}
+
+function clearTextLayer(renderer) {
+ var lines = renderer.$textLayer.$lines;
+ lines.cells.forEach(clear);
+ lines.cellCache.forEach(clear);
+ function clear(cell) {
+ var style = cell.element.style;
+ style.direction = style.textAlign = style.width = "";
+ }
+}
+
+});
diff --git a/lib/ace/virtual_renderer.js b/lib/ace/virtual_renderer.js
index 1cd8bec9491..7231a8d5da3 100644
--- a/lib/ace/virtual_renderer.js
+++ b/lib/ace/virtual_renderer.js
@@ -1040,7 +1040,8 @@ var VirtualRenderer = function(container, theme) {
height : this.$size.scrollerHeight
};
- this.session.$bidiHandler.setContentWidth(longestLine);
+ if (this.session.$bidiHandler)
+ this.session.$bidiHandler.setContentWidth(longestLine - this.$padding);
// For debugging.
// console.log(JSON.stringify(this.layerConfig));
From ecd19f0ceec11628063180da34b41b72d0d40169 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Sun, 29 Apr 2018 00:53:50 +0400
Subject: [PATCH 0004/1293] restore bidi support in marker layer
---
lib/ace/bidihandler.js | 4 +--
lib/ace/edit_session.js | 2 +-
lib/ace/layer/marker.js | 60 ++++++++++++++++++++++++++++++-----------
3 files changed, 48 insertions(+), 18 deletions(-)
diff --git a/lib/ace/bidihandler.js b/lib/ace/bidihandler.js
index b955f5faebf..cb8df42b12a 100644
--- a/lib/ace/bidihandler.js
+++ b/lib/ace/bidihandler.js
@@ -67,7 +67,7 @@ var BidiHandler = function(session) {
this.rtlLineOffset = 0;
this.wrapOffset = 0;
this.isMoveLeftOperation = false;
- this.seenBidi = null;
+ this.seenBidi = bidiRE.test(session.getValue());
};
(function() {
@@ -80,7 +80,7 @@ var BidiHandler = function(session) {
* @param {Number} the wrapped screen line index [ optional]
**/
this.isBidiRow = function(screenRow, docRow, splitIndex) {
- if (this.seenBidi == false)
+ if (!this.seenBidi)
return false;
if (screenRow !== this.currentRow) {
this.currentRow = screenRow;
diff --git a/lib/ace/edit_session.js b/lib/ace/edit_session.js
index 3d20309e425..740d85a31d0 100644
--- a/lib/ace/edit_session.js
+++ b/lib/ace/edit_session.js
@@ -159,9 +159,9 @@ var EditSession = function(text, mode) {
if (typeof text != "object" || !text.getLine)
text = new Document(text);
- this.$bidiHandler = new BidiHandler(this);
this.setDocument(text);
this.selection = new Selection(this);
+ this.$bidiHandler = new BidiHandler(this);
config.resetOptions(this);
this.setMode(mode);
diff --git a/lib/ace/layer/marker.js b/lib/ace/layer/marker.js
index 17ee2f673c1..4a9bf4278e1 100644
--- a/lib/ace/layer/marker.js
+++ b/lib/ace/layer/marker.js
@@ -150,23 +150,35 @@ var Marker = function(parentEl) {
var left = padding + range.start.column * config.characterWidth;
extraStyle = extraStyle || "";
- this.elt(
- clazz + " ace_br1 ace_start",
- "height:"+ height+ "px;"+ "right:0;"+ "top:"+top+ "px;left:"+ left+ "px;" + (extraStyle || "")
- );
-
+ if (this.session.$bidiHandler.isBidiRow(range.start.row)) {
+ var range1 = range.clone();
+ range1.end.row = range1.start.row;
+ range1.end.column = this.session.getLine(range1.start.row).length;
+ this.drawBidiSingleLineMarker(stringBuilder, range1, clazz + " ace_br1 ace_start", config, null, extraStyle);
+ } else {
+ this.elt(
+ clazz + " ace_br1 ace_start",
+ "height:"+ height+ "px;"+ "right:0;"+ "top:"+top+ "px;left:"+ left+ "px;" + (extraStyle || "")
+ );
+ }
// from start of the last line to the selection end
- top = this.$getTop(range.end.row, config);
- var width = range.end.column * config.characterWidth;
-
- this.elt(
- clazz + " ace_br12",
- "height:"+ height+ "px;"+
- "width:"+ width+ "px;"+
- "top:"+ top+ "px;"+
- "left:"+ padding+ "px;"+ (extraStyle || "")
- );
+ if (this.session.$bidiHandler.isBidiRow(range.end.row)) {
+ var range1 = range.clone();
+ range1.start.row = range1.end.row;
+ range1.start.column = 0;
+ this.drawBidiSingleLineMarker(stringBuilder, range1, clazz + " ace_br12", config, null, extraStyle);
+ } else {
+ top = this.$getTop(range.end.row, config);
+ var width = range.end.column * config.characterWidth;
+ this.elt(
+ clazz + " ace_br12",
+ "height:"+ height+ "px;"+
+ "width:"+ width+ "px;"+
+ "top:"+ top+ "px;"+
+ "left:"+ padding+ "px;"+ (extraStyle || "")
+ );
+ }
// all the complete lines
height = (range.end.row - range.start.row - 1) * config.lineHeight;
if (height <= 0)
@@ -186,6 +198,8 @@ var Marker = function(parentEl) {
// Draws a marker which covers part or whole width of a single screen line
this.drawSingleLineMarker = function(stringBuilder, range, clazz, config, extraLength, extraStyle) {
+ if (this.session.$bidiHandler.isBidiRow(range.start.row))
+ return this.drawBidiSingleLineMarker(stringBuilder, range, clazz, config, extraLength, extraStyle);
var height = config.lineHeight;
var width = (range.end.column + (extraLength || 0) - range.start.column) * config.characterWidth;
@@ -201,6 +215,22 @@ var Marker = function(parentEl) {
);
};
+ // Draws Bidi marker which covers part or whole width of a single screen line
+ this.drawBidiSingleLineMarker = function(stringBuilder, range, clazz, config, extraLength, extraStyle) {
+ var height = config.lineHeight, top = this.$getTop(range.start.row, config), padding = this.$padding;
+ var selections = this.session.$bidiHandler.getSelections(range.start.column, range.end.column);
+
+ selections.forEach(function(selection) {
+ this.elt(
+ clazz,
+ "height:" + height + "px;" +
+ "width:" + selection.width + (extraLength || 0) + "px;" +
+ "top:" + top + "px;" +
+ "left:" + (padding + selection.left) + "px;" + (extraStyle || "")
+ );
+ }, this);
+ };
+
this.drawFullLineMarker = function(stringBuilder, range, clazz, config, extraStyle) {
var top = this.$getTop(range.start.row, config);
var height = config.lineHeight;
From ced10ce34e15c6cf0e29a571473a31ea38e3f135 Mon Sep 17 00:00:00 2001
From: 43081j <43081j@users.noreply.github.com>
Date: Sat, 5 May 2018 16:25:56 +0100
Subject: [PATCH 0005/1293] lucene: improve highlight rules
---
lib/ace/mode/_test/text_lucene.txt | 53 +++--
lib/ace/mode/_test/tokens_lucene.json | 257 ++++++++++++++++++++-----
lib/ace/mode/lucene_highlight_rules.js | 87 +++++----
3 files changed, 295 insertions(+), 102 deletions(-)
diff --git a/lib/ace/mode/_test/text_lucene.txt b/lib/ace/mode/_test/text_lucene.txt
index c71f2680d1a..739c3b4d65e 100644
--- a/lib/ace/mode/_test/text_lucene.txt
+++ b/lib/ace/mode/_test/text_lucene.txt
@@ -1,16 +1,39 @@
-test: recognises AND as keyword
-test: recognises OR as keyword
-test: recognises NOT as keyword
-test: recognises "hello this is dog" as string
-test: recognises -"hello this is dog" as negation with string
-test: recognises ~100 as text with proximity
-test: recognises "hello this is dog"~100 as string with proximity
-test: recognises raw:"hello this is dog" as keyword
-test: recognises raw:foo as"keyword'
-test: recognises "(" as opening parenthesis
-test: recognises ")" as closing parenthesis
-test: recognises foo* as text with asterisk
-test: recognises foo? as text with interro
-test: recognises single word as text
foo
-
\ No newline at end of file
+foo: foo AND bar
+foo AND bar
+foo OR bar
+foo NOT bar
+"foo bar"
+bar "foo bar"
+bar -foo
+bar -"foo bar"
+-foo
+-"foo bar"
+bar foo~100
+foo~100
+foo~100 bar
+"foo bar"~10
+foo~
+bar foo~
+foo~ bar
+foo~0.8
+field:foo
+field:foo bar
+field:"foo bar"
+(foo AND bar)
+(field:foo AND field:"bar baz")
+foo*
+f?o
+f*o
++foo
++"foo bar"
+foo?
+?oo
+foo
+field:(-foo +bar +"foo bar")
+field:{foo TO bar}
+field:[foo TO bar]
+field:["a b c" TO def]
+field:{"a b c" TO def}
+field:{foo TO "bar"}
+field:{20180101 TO 20190202}
diff --git a/lib/ace/mode/_test/tokens_lucene.json b/lib/ace/mode/_test/tokens_lucene.json
index 1f6d2985e20..08bb1dc1747 100644
--- a/lib/ace/mode/_test/tokens_lucene.json
+++ b/lib/ace/mode/_test/tokens_lucene.json
@@ -1,92 +1,245 @@
[[
"start",
- ["keyword","test:"],
- ["text"," recognises "],
+ ["text"," "],
+ ["string.unquoted","foo"]
+],[
+ "start",
+ ["keyword","foo:"],
+ ["text"," "],
+ ["string.unquoted","foo"],
+ ["text"," "],
["keyword.operator","AND"],
- ["text"," as keyword"]
+ ["text"," "],
+ ["string.unquoted","bar"]
],[
"start",
- ["keyword","test:"],
- ["text"," recognises "],
+ ["string.unquoted","foo"],
+ ["text"," "],
+ ["keyword.operator","AND"],
+ ["text"," "],
+ ["string.unquoted","bar"]
+],[
+ "start",
+ ["string.unquoted","foo"],
+ ["text"," "],
["keyword.operator","OR"],
- ["text"," as keyword"]
+ ["text"," "],
+ ["string.unquoted","bar"]
],[
"start",
- ["keyword","test:"],
- ["text"," recognises "],
+ ["string.unquoted","foo"],
+ ["text"," "],
["keyword.operator","NOT"],
- ["text"," as keyword"]
+ ["text"," "],
+ ["string.unquoted","bar"]
+],[
+ "start",
+ ["string","\"foo bar\""]
],[
"start",
- ["keyword","test:"],
- ["text"," recognises "],
- ["string","\"hello this is dog\""],
- ["text"," as string"]
+ ["string.unquoted","bar"],
+ ["text"," "],
+ ["string","\"foo bar\""]
],[
"start",
- ["keyword","test:"],
- ["text"," recognises "],
+ ["string.unquoted","bar"],
+ ["text"," "],
["constant.character.negation","-"],
- ["string","\"hello this is dog\""],
- ["text"," as negation with string"]
+ ["string.unquoted","foo"]
],[
"start",
- ["keyword","test:"],
- ["text"," recognises "],
- ["constant.character.proximity","~100"],
- ["text"," as text with proximity"]
+ ["string.unquoted","bar"],
+ ["text"," "],
+ ["constant.character.negation","-"],
+ ["string","\"foo bar\""]
+],[
+ "start",
+ ["constant.character.negation","-"],
+ ["string.unquoted","foo"]
+],[
+ "start",
+ ["constant.character.negation","-"],
+ ["string","\"foo bar\""]
+],[
+ "start",
+ ["string.unquoted","bar"],
+ ["text"," "],
+ ["string.unquoted","foo"],
+ ["constant.character.proximity","~100"]
],[
"start",
- ["keyword","test:"],
- ["text"," recognises "],
- ["string","\"hello this is dog\""],
+ ["string.unquoted","foo"],
+ ["constant.character.proximity","~100"]
+],[
+ "start",
+ ["string.unquoted","foo"],
["constant.character.proximity","~100"],
- ["text"," as string with proximity"]
+ ["text"," "],
+ ["string.unquoted","bar"]
+],[
+ "start",
+ ["string","\"foo bar\""],
+ ["constant.character.proximity","~10"]
+],[
+ "start",
+ ["string.unquoted","foo"],
+ ["constant.character.proximity","~"]
+],[
+ "start",
+ ["string.unquoted","bar"],
+ ["text"," "],
+ ["string.unquoted","foo"],
+ ["constant.character.proximity","~"]
+],[
+ "start",
+ ["string.unquoted","foo"],
+ ["constant.character.proximity","~"],
+ ["text"," "],
+ ["string.unquoted","bar"]
+],[
+ "start",
+ ["string.unquoted","foo"],
+ ["constant.character.proximity","~0.8"]
+],[
+ "start",
+ ["keyword","field:"],
+ ["string.unquoted","foo"]
+],[
+ "start",
+ ["keyword","field:"],
+ ["string.unquoted","foo"],
+ ["text"," "],
+ ["string.unquoted","bar"]
+],[
+ "start",
+ ["keyword","field:"],
+ ["string","\"foo bar\""]
],[
"start",
- ["keyword","test:"],
- ["text"," recognises "],
- ["keyword","raw:"],
- ["string","\"hello this is dog\""],
- ["text"," as keyword"]
+ ["paren.lparen","("],
+ ["string.unquoted","foo"],
+ ["text"," "],
+ ["keyword.operator","AND"],
+ ["text"," "],
+ ["string.unquoted","bar"],
+ ["paren.rparen",")"]
],[
"start",
- ["keyword","test:"],
- ["text"," recognises "],
- ["keyword","raw:"],
- ["text","foo as\"keyword'"]
+ ["paren.lparen","("],
+ ["keyword","field:"],
+ ["string.unquoted","foo"],
+ ["text"," "],
+ ["keyword.operator","AND"],
+ ["text"," "],
+ ["keyword","field:"],
+ ["string","\"bar baz\""],
+ ["paren.rparen",")"]
],[
"start",
- ["keyword","test:"],
- ["text"," recognises "],
- ["string","\"(\""],
- ["text"," as opening parenthesis"]
+ ["string.unquoted","foo"],
+ ["constant.character.asterisk","*"]
],[
"start",
- ["keyword","test:"],
- ["text"," recognises "],
- ["string","\")\""],
- ["text"," as closing parenthesis"]
+ ["string.unquoted","f"],
+ ["constant.character.interro","?"],
+ ["string.unquoted","o"]
],[
"start",
- ["keyword","test:"],
- ["text"," recognises foo"],
+ ["string.unquoted","f"],
["constant.character.asterisk","*"],
- ["text"," as text with asterisk"]
+ ["string.unquoted","o"]
+],[
+ "start",
+ ["constant.character.required","+"],
+ ["string.unquoted","foo"]
+],[
+ "start",
+ ["constant.character.required","+"],
+ ["string","\"foo bar\""]
+],[
+ "start",
+ ["string.unquoted","foo"],
+ ["constant.character.interro","?"]
],[
"start",
- ["keyword","test:"],
- ["text"," recognises foo"],
["constant.character.interro","?"],
- ["text"," as text with interro"]
+ ["string.unquoted","oo"]
+],[
+ "start",
+ ["string.unquoted","foo"]
+],[
+ "start",
+ ["keyword","field:"],
+ ["paren.lparen","("],
+ ["constant.character.negation","-"],
+ ["string.unquoted","foo"],
+ ["text"," "],
+ ["constant.character.required","+"],
+ ["string.unquoted","bar"],
+ ["text"," "],
+ ["constant.character.required","+"],
+ ["string","\"foo bar\""],
+ ["paren.rparen",")"]
],[
"start",
- ["keyword","test:"],
- ["text"," recognises single word as text"]
+ ["keyword","field:"],
+ ["paren.lparen","{"],
+ ["string.unquoted","foo"],
+ ["text"," "],
+ ["keyword.operator","TO"],
+ ["text"," "],
+ ["string.unquoted","bar"],
+ ["paren.rparen","}"]
],[
"start",
- ["text"," foo"]
+ ["keyword","field:"],
+ ["paren.lparen","["],
+ ["string.unquoted","foo"],
+ ["text"," "],
+ ["keyword.operator","TO"],
+ ["text"," "],
+ ["string.unquoted","bar"],
+ ["paren.rparen","]"]
],[
"start",
- ["text"," "]
+ ["keyword","field:"],
+ ["paren.lparen","["],
+ ["string","\"a b c\""],
+ ["text"," "],
+ ["keyword.operator","TO"],
+ ["text"," "],
+ ["string.unquoted","def"],
+ ["paren.rparen","]"]
+],[
+ "start",
+ ["keyword","field:"],
+ ["paren.lparen","{"],
+ ["string","\"a b c\""],
+ ["text"," "],
+ ["keyword.operator","TO"],
+ ["text"," "],
+ ["string.unquoted","def"],
+ ["paren.rparen","}"]
+],[
+ "start",
+ ["keyword","field:"],
+ ["paren.lparen","{"],
+ ["string.unquoted","foo"],
+ ["text"," "],
+ ["keyword.operator","TO"],
+ ["text"," "],
+ ["string","\"bar\""],
+ ["paren.rparen","}"]
+],[
+ "start",
+ ["keyword","field:"],
+ ["paren.lparen","{"],
+ ["string.unquoted","20180101"],
+ ["text"," "],
+ ["keyword.operator","TO"],
+ ["text"," "],
+ ["string.unquoted","20190202"],
+ ["paren.rparen","}"]
+],[
+ "start"
]]
\ No newline at end of file
diff --git a/lib/ace/mode/lucene_highlight_rules.js b/lib/ace/mode/lucene_highlight_rules.js
index 536aa1d30f0..12d1c738e97 100644
--- a/lib/ace/mode/lucene_highlight_rules.js
+++ b/lib/ace/mode/lucene_highlight_rules.js
@@ -6,41 +6,58 @@ var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var LuceneHighlightRules = function() {
- this.$rules = {
- "start" : [
- {
- token : "constant.character.negation",
- regex : "[\\-]"
- }, {
- token : "constant.character.interro",
- regex : "[\\?]"
- }, {
- token : "constant.character.asterisk",
- regex : "[\\*]"
- }, {
- token: 'constant.character.proximity',
- regex: '~[0-9]+\\b'
- }, {
- token : 'keyword.operator',
- regex: '(?:AND|OR|NOT)\\b'
- }, {
- token : "paren.lparen",
- regex : "[\\(]"
- }, {
- token : "paren.rparen",
- regex : "[\\)]"
- }, {
- token : "keyword",
- regex : "[\\S]+:"
- }, {
- token : "string", // " string
- regex : '".*?"'
- }, {
- token : "text",
- regex : "\\s+"
- }
- ]
- };
+ this.$rules = {
+ "start" : [
+ {
+ token: "constant.character.negation",
+ regex: "\\-"
+ },
+ {
+ token: "constant.character.interro",
+ regex: "\\?"
+ },
+ {
+ token: "constant.character.required",
+ regex: "\\+"
+ },
+ {
+ token: "constant.character.asterisk",
+ regex: "\\*"
+ },
+ {
+ token: 'constant.character.proximity',
+ regex: '~(?:0\\.[0-9]+|[0-9]+)?'
+ },
+ {
+ token: 'keyword.operator',
+ regex: '(AND|OR|NOT|TO)\\b'
+ },
+ {
+ token: "paren.lparen",
+ regex: "[\\(\\{\\[]"
+ },
+ {
+ token: "paren.rparen",
+ regex: "[\\)\\}\\]]"
+ },
+ {
+ token: "keyword",
+ regex: "\\S+:"
+ },
+ {
+ token: "string", // " string
+ regex: '"[^"]*"'
+ },
+ {
+ token: "string.unquoted",
+ regex: "\\w+"
+ },
+ {
+ token: "text",
+ regex: "\\s+"
+ }
+ ]
+ };
};
oop.inherits(LuceneHighlightRules, TextHighlightRules);
From d96a63eb57fb4388a9748786f7afa731e7aa648e Mon Sep 17 00:00:00 2001
From: 43081j <43081j@users.noreply.github.com>
Date: Wed, 9 May 2018 21:44:16 +0100
Subject: [PATCH 0006/1293] lucene: whitespace revert
---
lib/ace/mode/lucene_highlight_rules.js | 93 ++++++++++++--------------
1 file changed, 41 insertions(+), 52 deletions(-)
diff --git a/lib/ace/mode/lucene_highlight_rules.js b/lib/ace/mode/lucene_highlight_rules.js
index 12d1c738e97..59b134ddebf 100644
--- a/lib/ace/mode/lucene_highlight_rules.js
+++ b/lib/ace/mode/lucene_highlight_rules.js
@@ -6,58 +6,47 @@ var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var LuceneHighlightRules = function() {
- this.$rules = {
- "start" : [
- {
- token: "constant.character.negation",
- regex: "\\-"
- },
- {
- token: "constant.character.interro",
- regex: "\\?"
- },
- {
- token: "constant.character.required",
- regex: "\\+"
- },
- {
- token: "constant.character.asterisk",
- regex: "\\*"
- },
- {
- token: 'constant.character.proximity',
- regex: '~(?:0\\.[0-9]+|[0-9]+)?'
- },
- {
- token: 'keyword.operator',
- regex: '(AND|OR|NOT|TO)\\b'
- },
- {
- token: "paren.lparen",
- regex: "[\\(\\{\\[]"
- },
- {
- token: "paren.rparen",
- regex: "[\\)\\}\\]]"
- },
- {
- token: "keyword",
- regex: "\\S+:"
- },
- {
- token: "string", // " string
- regex: '"[^"]*"'
- },
- {
- token: "string.unquoted",
- regex: "\\w+"
- },
- {
- token: "text",
- regex: "\\s+"
- }
- ]
- };
+ this.$rules = {
+ "start" : [
+ {
+ token: "constant.character.negation",
+ regex: "\\-"
+ }, {
+ token: "constant.character.interro",
+ regex: "\\?"
+ }, {
+ token: "constant.character.required",
+ regex: "\\+"
+ }, {
+ token: "constant.character.asterisk",
+ regex: "\\*"
+ }, {
+ token: 'constant.character.proximity',
+ regex: '~(?:0\\.[0-9]+|[0-9]+)?'
+ }, {
+ token: 'keyword.operator',
+ regex: '(AND|OR|NOT|TO)\\b'
+ }, {
+ token: "paren.lparen",
+ regex: "[\\(\\{\\[]"
+ }, {
+ token: "paren.rparen",
+ regex: "[\\)\\}\\]]"
+ }, {
+ token: "keyword",
+ regex: "\\S+:"
+ }, {
+ token: "string", // " string
+ regex: '"[^"]*"'
+ }, {
+ token: "string.unquoted",
+ regex: "\\w+"
+ }, {
+ token: "text",
+ regex: "\\s+"
+ }
+ ]
+ };
};
oop.inherits(LuceneHighlightRules, TextHighlightRules);
From 02a0522518088a40bb3799fa224c97517d7422c8 Mon Sep 17 00:00:00 2001
From: Cigery <150526401@qq.com>
Date: Fri, 11 May 2018 12:38:55 +0800
Subject: [PATCH 0007/1293] missed a "." in L677
---
api/resources/csses/ace_api.css | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/api/resources/csses/ace_api.css b/api/resources/csses/ace_api.css
index 7a90b4c3f7a..3ef8b391618 100644
--- a/api/resources/csses/ace_api.css
+++ b/api/resources/csses/ace_api.css
@@ -674,7 +674,7 @@ li.signature {
#documentation .alias a:hover, #documentation .related-to a:hover {
text-decoration: none;
}
-.#documentation alias:hover, #documentation .related-to:hover {
+.#documentation .alias:hover, #documentation .related-to:hover {
opacity: 0.8;
cursor: pointer;
}
From ff449b75b548b4019cf363e571f0a29d8b42dd82 Mon Sep 17 00:00:00 2001
From: Nathan Whetsell
Date: Fri, 11 May 2018 09:59:58 -0400
Subject: [PATCH 0008/1293] Update for Csound 6.11.0
---
.../mode/csound_orchestra_highlight_rules.js | 76 ++++++++++---------
1 file changed, 42 insertions(+), 34 deletions(-)
diff --git a/lib/ace/mode/csound_orchestra_highlight_rules.js b/lib/ace/mode/csound_orchestra_highlight_rules.js
index b775a021165..346bd565440 100644
--- a/lib/ace/mode/csound_orchestra_highlight_rules.js
+++ b/lib/ace/mode/csound_orchestra_highlight_rules.js
@@ -122,9 +122,11 @@ var CsoundOrchestraHighlightRules = function() {
"MixerSetLevel",
"MixerSetLevel_i",
"OSCinit",
+ "OSCinitM",
"OSClisten",
"OSCraw",
"OSCsend",
+ "OSCsend_lo",
"S",
"STKBandedWG",
"STKBeeThree",
@@ -174,6 +176,7 @@ var CsoundOrchestraHighlightRules = function() {
"atonex",
"babo",
"balance",
+ "balance2",
"bamboo",
"barmodel",
"bbcutm",
@@ -734,6 +737,8 @@ var CsoundOrchestraHighlightRules = function() {
"lorenz",
"loscil",
"loscil3",
+ "loscil3phs",
+ "loscilphs",
"loscilx",
"lowpass2",
"lowres",
@@ -1033,7 +1038,6 @@ var CsoundOrchestraHighlightRules = function() {
"pvsftw",
"pvsfwrite",
"pvsgain",
- "pvsgendy",
"pvshift",
"pvsifd",
"pvsin",
@@ -1271,7 +1275,6 @@ var CsoundOrchestraHighlightRules = function() {
"sockrecv",
"sockrecvs",
"socksend",
- "socksend_k",
"socksends",
"sorta",
"sortd",
@@ -1372,38 +1375,6 @@ var CsoundOrchestraHighlightRules = function() {
"tanh",
"taninv",
"taninv2",
- "tb0",
- "tb0_init",
- "tb1",
- "tb10",
- "tb10_init",
- "tb11",
- "tb11_init",
- "tb12",
- "tb12_init",
- "tb13",
- "tb13_init",
- "tb14",
- "tb14_init",
- "tb15",
- "tb15_init",
- "tb1_init",
- "tb2",
- "tb2_init",
- "tb3",
- "tb3_init",
- "tb4",
- "tb4_init",
- "tb5",
- "tb5_init",
- "tb6",
- "tb6_init",
- "tb7",
- "tb7_init",
- "tb8",
- "tb8_init",
- "tb9",
- "tb9_init",
"tbvcf",
"tempest",
"tempo",
@@ -1589,6 +1560,10 @@ var CsoundOrchestraHighlightRules = function() {
"lentab",
"maxtab",
"mintab",
+ "pop",
+ "pop_f",
+ "push",
+ "push_f",
"scalet",
"sndload",
"soundout",
@@ -1602,11 +1577,44 @@ var CsoundOrchestraHighlightRules = function() {
"specscal",
"specsum",
"spectrum",
+ "stack",
"sumtab",
"tabgen",
"tabmap",
"tabmap_i",
"tabslice",
+ "tb0",
+ "tb0_init",
+ "tb1",
+ "tb10",
+ "tb10_init",
+ "tb11",
+ "tb11_init",
+ "tb12",
+ "tb12_init",
+ "tb13",
+ "tb13_init",
+ "tb14",
+ "tb14_init",
+ "tb15",
+ "tb15_init",
+ "tb1_init",
+ "tb2",
+ "tb2_init",
+ "tb3",
+ "tb3_init",
+ "tb4",
+ "tb4_init",
+ "tb5",
+ "tb5_init",
+ "tb6",
+ "tb6_init",
+ "tb7",
+ "tb7_init",
+ "tb8",
+ "tb8_init",
+ "tb9",
+ "tb9_init",
"vbap16",
"vbap4",
"vbap4move",
From a8471e59b1c54cb0a5367286286c4c2414ffd503 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Sun, 13 May 2018 22:44:43 +0400
Subject: [PATCH 0009/1293] add Terraform and Puppet modes
---
demo/kitchen-sink/docs/puppet.epp | 51 ++++++
demo/kitchen-sink/docs/terraform.tf | 94 ++++++++++
lib/ace/ext/modelist.js | 2 +
lib/ace/mode/puppet.js | 57 ++++++
lib/ace/mode/puppet_highlight_rules.js | 184 +++++++++++++++++++
lib/ace/mode/terraform.js | 57 ++++++
lib/ace/mode/terraform_highlight_rules.js | 212 ++++++++++++++++++++++
lib/ace/snippets/puppet.js | 7 +
lib/ace/snippets/puppet.snippets | 0
lib/ace/snippets/terraform.js | 7 +
lib/ace/snippets/terraform.snippets | 0
11 files changed, 671 insertions(+)
create mode 100644 demo/kitchen-sink/docs/puppet.epp
create mode 100644 demo/kitchen-sink/docs/terraform.tf
create mode 100644 lib/ace/mode/puppet.js
create mode 100644 lib/ace/mode/puppet_highlight_rules.js
create mode 100644 lib/ace/mode/terraform.js
create mode 100644 lib/ace/mode/terraform_highlight_rules.js
create mode 100644 lib/ace/snippets/puppet.js
create mode 100644 lib/ace/snippets/puppet.snippets
create mode 100644 lib/ace/snippets/terraform.js
create mode 100644 lib/ace/snippets/terraform.snippets
diff --git a/demo/kitchen-sink/docs/puppet.epp b/demo/kitchen-sink/docs/puppet.epp
new file mode 100644
index 00000000000..bc070681a2a
--- /dev/null
+++ b/demo/kitchen-sink/docs/puppet.epp
@@ -0,0 +1,51 @@
+define apache::vhost ($port, $docroot, $servername = $title, $vhost_name = '*') {
+ include apache
+ include apache::params
+ $vhost_dir = $apache::params::vhost_dir
+ file { "${vhost_dir}/${servername}.conf":
+ content => template('apache/vhost-default.conf.erb'),
+ owner => 'www',
+ group => 'www',
+ mode => '644',
+ require => Package['httpd'],
+ notify => Service['httpd'],
+ }
+}
+
+type MyModule::Tree = Array[Variant[Data, Tree]]
+
+function apache::bool2http(Variant[String, Boolean] $arg) >> String {
+ case $arg {
+ false, undef, /(?i:false)/ : { 'Off' }
+ true, /(?i:true)/ : { 'On' }
+ default : { "$arg" }
+ }
+}
+
+# A class with parameters
+class apache (String $version = 'latest') {
+ package {'httpd':
+ ensure => $version, # Using the class parameter from above
+ before => File['/etc/httpd.conf'],
+ }
+ file {'/etc/httpd.conf':
+ ensure => file,
+ owner => 'httpd',
+ content => template('apache/httpd.conf.erb'), # Template from a module
+ }
+ service {'httpd':
+ ensure => running,
+ enable => true,
+ subscribe => File['/etc/httpd.conf'],
+ }
+}
+
+
+if $is_virtual {
+ warning( 'Tried to include class ntp on virtual machine; this node might be misclassified.' )
+}
+elsif $operatingsystem == 'Darwin' {
+ warning( 'This NTP module does not yet work on our Mac laptops.' )
+else {
+ include ntp
+}
\ No newline at end of file
diff --git a/demo/kitchen-sink/docs/terraform.tf b/demo/kitchen-sink/docs/terraform.tf
new file mode 100644
index 00000000000..f63d7746436
--- /dev/null
+++ b/demo/kitchen-sink/docs/terraform.tf
@@ -0,0 +1,94 @@
+export TF_LOG=TRACE
+
+# An AMI
+variable "ami" {
+ description = "the AMI to use"
+}
+
+/* A multi
+ line comment. */
+resource "aws_instance" "web" {
+ ami = "${var.ami}"
+ count = 2
+ source_dest_check = false
+
+ connection {
+ user = "root"
+ }
+}
+
+resource "aws_instance" "web" {
+ subnet = "${var.env == "production" ? var.prod_subnet : var.dev_subnet}"
+}
+
+variable "count" {
+ default = 2
+}
+
+variable "hostnames" {
+ default = {
+ "0" = "example1.org"
+ "1" = "example2.net"
+ }
+}
+
+data "template_file" "web_init" {
+ # Render the template once for each instance
+ count = "${length(var.hostnames)}"
+ template = "${file("templates/web_init.tpl")}"
+ vars {
+ # count.index tells us the index of the instance we are rendering
+ hostname = "${var.hostnames[count.index]}"
+ }
+}
+
+resource "aws_instance" "web" {
+ # Create one instance for each hostname
+ count = "${length(var.hostnames)}"
+
+ # Pass each instance its corresponding template_file
+ user_data = "${data.template_file.web_init.*.rendered[count.index]}"
+}
+
+variable "count" {
+ default = 2
+}
+
+# Define the common tags for all resources
+locals {
+ common_tags = {
+ Component = "awesome-app"
+ Environment = "production"
+ }
+}
+
+# Create a resource that blends the common tags with instance-specific tags.
+resource "aws_instance" "server" {
+ ami = "ami-123456"
+ instance_type = "t2.micro"
+
+ tags = "${merge(
+ local.common_tags,
+ map(
+ "Name", "awesome-app-server",
+ "Role", "server"
+ )
+ )}"
+}
+
+$ terraform apply -var foo=bar -var foo=baz
+$ terraform apply -var 'foo={quux="bar"}' -var 'foo={bar="baz"}'
+
+$ terraform apply -var-file=foo.tfvars -var-file=bar.tfvars
+$ TF_VAR_somemap='{foo = "bar", baz = "qux"}' terraform plan
+
+resource "aws_instance" "web" {
+ # ...
+
+ count = "${var.count}"
+
+ # Tag the instance with a counter starting at 1, ie. web-001
+ tags {
+ Name = "${format("web-%03d", count.index + 1)}"
+ }
+}
\ No newline at end of file
diff --git a/lib/ace/ext/modelist.js b/lib/ace/ext/modelist.js
index 202ddcdad42..b4558ea38a4 100644
--- a/lib/ace/ext/modelist.js
+++ b/lib/ace/ext/modelist.js
@@ -141,6 +141,7 @@ var supportedModes = {
pgSQL: ["pgsql"],
PHP_Laravel_blade: ["blade.php"],
PHP: ["php|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"],
+ Puppet: ["epp|pp"],
Pig: ["pig"],
Powershell: ["ps1"],
Praat: ["praat|praatscript|psc|proc"],
@@ -174,6 +175,7 @@ var supportedModes = {
SVG: ["svg"],
Swift: ["swift"],
Tcl: ["tcl"],
+ Terraform: ["tf", "tfvars", "terragrunt"],
Tex: ["tex"],
Text: ["txt"],
Textile: ["textile"],
diff --git a/lib/ace/mode/puppet.js b/lib/ace/mode/puppet.js
new file mode 100644
index 00000000000..0f038beca51
--- /dev/null
+++ b/lib/ace/mode/puppet.js
@@ -0,0 +1,57 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Ajax.org B.V. nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function (require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var PuppetHighlightRules = require("./puppet_highlight_rules").PuppetHighlightRules;
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+
+var Mode = function () {
+ TextMode.call(this);
+ this.HighlightRules = PuppetHighlightRules;
+ this.$outdent = new MatchingBraceOutdent();
+ this.$behaviour = new CstyleBehaviour();
+ this.foldingRules = new CStyleFoldMode();
+};
+
+oop.inherits(Mode, TextMode);
+
+
+(function () {
+ this.$id = "ace/mode/puppet";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
diff --git a/lib/ace/mode/puppet_highlight_rules.js b/lib/ace/mode/puppet_highlight_rules.js
new file mode 100644
index 00000000000..7179648ec40
--- /dev/null
+++ b/lib/ace/mode/puppet_highlight_rules.js
@@ -0,0 +1,184 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Ajax.org B.V. nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function (require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+var PuppetHighlightRules = function () {
+ this.$rules = {
+ "start": [
+ {
+ token: ['keyword.type.puppet', 'constant.class.puppet', 'keyword.inherits.puppet', 'constant.class.puppet'],
+ regex: "^\\s*(class)(\\s+(?:[-_A-Za-z0-9\".]+::)*[-_A-Za-z0-9\".]+\\s*)(?:(inherits\\s*)(\\s+(?:[-_A-Za-z0-9\".]+::)*[-_A-Za-z0-9\".]+\\s*))?"
+ },
+ {
+ token: ['storage.function.puppet', 'name.function.puppet', 'punctuation.lpar'],
+ regex: "(^\\s*define)(\\s+[a-zA-Z0-9_:]+\\s*)(\\()",
+ push:
+ [{
+ token: 'punctuation.rpar.puppet',
+ regex: "\\)",
+ next: 'pop'
+ },
+ {include: "constants"},
+ {include: "variable"},
+ {include: "strings"},
+ {include: "operators"},
+ {defaultToken: 'string'}]
+ },
+ {
+ token: ["language.support.class", "keyword.operator"],
+ regex: "\\b([a-zA-Z_]+)(\\s+=>)"
+ },
+ {
+ token: ["exported.resource.puppet", "keyword.name.resource.puppet", "paren.lpar"],
+ regex: "(\\@\\@)?(\\s*[a-zA-Z_]*)(\\s*\\{)"
+ },
+ {
+ token: "qualified.variable.puppet",
+ regex: "(\\$([a-z][a-z0-9_]*)?(::[a-z][a-z0-9_]*)*::[a-z0-9_][a-zA-Z0-9_]*)"
+ },
+
+ {
+ token: "singleline.comment.puppet",
+ regex: '#(.)*$'
+ },
+ {
+ token: "multiline.comment.begin.puppet",
+ regex: '^\\s*\\/\\*\\s*$',
+ push: "blockComment"
+ },
+ {
+ token: "keyword.control.puppet",
+ regex: "\\b(case|if|unless|else|elsif|in|default:|and|or)\\s+(?!::)"
+ },
+ {
+ token: "keyword.control.puppet",
+ regex: "\\b(import|default|inherits|include|require|contain|node|application|consumes|environment|site|function|produces)\\b"
+ },
+ {
+ token: "support.function.puppet",
+ regex: "\\b(lest|str2bool|escape|gsub|Timestamp|Timespan|with|alert|crit|debug|notice|sprintf|split|step|strftime|slice|shellquote|type|sha1|defined|scanf|reverse_each|regsubst|return|emerg|reduce|err|failed|fail|versioncmp|file|generate|then|info|realize|search|tag|tagged|template|epp|warning|hiera_include|each|assert_type|binary_file|create_resources|dig|digest|filter|lookup|find_file|fqdn_rand|hiera_array|hiera_hash|inline_epp|inline_template|map|match|md5|new|next)\\b"
+ },
+ {
+ token: "constant.types.puppet",
+ regex: "\\b(String|File|Package|Service|Class|Integer|Array|Catalogentry|Variant|Boolean|Undef|Number|Hash|Float|Numeric|NotUndef|Callable|Optional|Any|Regexp|Sensitive|Sensitive.new|Type|Resource|Default|Enum|Scalar|Collection|Data|Pattern|Tuple|Struct)\\b"
+ },
+
+ {
+ token: "paren.lpar",
+ regex: "[[({]"
+ },
+ {
+ token: "paren.rpar",
+ regex: "[\\])}]"
+ },
+ {include: "variable"},
+ {include: "constants"},
+ {include: "strings"},
+ {include: "operators"},
+ {
+ token: "regexp.begin.string.puppet",
+ regex: "\\s*(\\/(\\S)+)\\/"
+ }
+ ],
+ blockComment: [{
+ regex: "^\\s*\\/\\*\\s*$",
+ token: "multiline.comment.begin.puppet",
+ push: "blockComment"
+ }, {
+ regex: "^\\s*\\*\\/\\s*$",
+ token: "multiline.comment.end.puppet",
+ next: "pop"
+ }, {
+ defaultToken: "comment"
+ }],
+ "constants": [
+ {
+ token: "constant.language.puppet",
+ regex: "\\b(false|true|running|stopped|installed|purged|latest|file|directory|held|undef|present|absent|link|mounted|unmounted)\\b"
+ }
+ ],
+ "variable": [
+ {
+ token: "variable.puppet",
+ regex: "(\\$[a-z0-9_\{][a-zA-Z0-9_]*)"
+ }
+ ],
+ "strings": [
+ {
+ token: "punctuation.quote.puppet",
+ regex: "'",
+ push:
+ [{
+ token: 'punctuation.quote.puppet',
+ regex: "'",
+ next: 'pop'
+ },
+ {include: "escaped_chars"},
+ {defaultToken: 'string'}]
+ },
+ {
+ token: "punctuation.quote.puppet",
+ regex: '"',
+ push:
+ [{
+ token: 'punctuation.quote.puppet',
+ regex: '"',
+ next: 'pop'
+ },
+ {include: "escaped_chars"},
+ {include: "variable"},
+ {defaultToken: 'string'}]
+ }
+ ],
+ "escaped_chars": [
+ {
+ token: "constant.escaped_char.puppet",
+ regex: "\\\\."
+ }
+ ],
+ "operators": [
+ {
+ token: "keyword.operator",
+ regex: "\\+\\.|\\-\\.|\\*\\.|\\/\\.|#|;;|\\+|\\-|\\*|\\*\\*\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|<-|=|::|,"
+ }
+ ]
+ };
+ this.normalizeRules();
+};
+
+
+oop.inherits(PuppetHighlightRules, TextHighlightRules);
+
+exports.PuppetHighlightRules = PuppetHighlightRules;
+});
diff --git a/lib/ace/mode/terraform.js b/lib/ace/mode/terraform.js
new file mode 100644
index 00000000000..6b495147dba
--- /dev/null
+++ b/lib/ace/mode/terraform.js
@@ -0,0 +1,57 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Ajax.org B.V. nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function (require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var TerraformHighlightRules = require("./terraform_highlight_rules").TerraformHighlightRules;
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+
+var Mode = function () {
+ TextMode.call(this);
+ this.HighlightRules = TerraformHighlightRules;
+ this.$outdent = new MatchingBraceOutdent();
+ this.$behaviour = new CstyleBehaviour();
+ this.foldingRules = new CStyleFoldMode();
+};
+
+oop.inherits(Mode, TextMode);
+
+
+(function () {
+ this.$id = "ace/mode/terraform";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
diff --git a/lib/ace/mode/terraform_highlight_rules.js b/lib/ace/mode/terraform_highlight_rules.js
new file mode 100644
index 00000000000..0d8587acce2
--- /dev/null
+++ b/lib/ace/mode/terraform_highlight_rules.js
@@ -0,0 +1,212 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Ajax.org B.V. nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function (require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+var TerraformHighlightRules = function () {
+
+
+ this.$rules = {
+ "start": [
+ {
+ token: ['storage.function.terraform'],
+ regex: '\\b(output|resource|data|variable|module|export)\\b'
+ },
+ {
+ token: "variable.terraform",
+ regex: "\\$\\s",
+ push: [
+ {
+ token: "keyword.terraform",
+ regex: "(-var-file|-var)"
+ },
+ {
+ token: "variable.terraform",
+ regex: "\\n|$",
+ next: "pop"
+ },
+
+ {include: "strings"},
+ {include: "variables"},
+ {include: "operators"},
+
+ {defaultToken: "text"}
+ ]
+ },
+ {
+ token: "language.support.class",
+ regex: "\\b(timeouts|provider|connection|provisioner|lifecycleprovider|atlas)\\b"
+ },
+
+ {
+ token: "singleline.comment.terraform",
+ regex: '#(.)*$'
+ },
+ {
+ token: "multiline.comment.begin.terraform",
+ regex: '^\\s*\\/\\*',
+ push: "blockComment"
+ },
+ {
+ token: "storage.function.terraform",
+ regex: "^\\s*(locals|terraform)\\s*{"
+ },
+ {
+ token: "paren.lpar",
+ regex: "[[({]"
+ },
+
+ {
+ token: "paren.rpar",
+ regex: "[\\])}]"
+ },
+ {include: "constants"},
+ {include: "strings"},
+ {include: "operators"},
+ {include: "variables"}
+ ],
+ blockComment: [{
+ regex: "^\\s*\\/\\*",
+ token: "multiline.comment.begin.terraform",
+ push: "blockComment"
+ }, {
+ regex: "\\*\\/\\s*$",
+ token: "multiline.comment.end.terraform",
+ next: "pop"
+ }, {
+ defaultToken: "comment"
+ }],
+ "constants": [
+ {
+ token: "constant.language.terraform",
+ regex: "\\b(true|false|yes|no|on|off|EOF)\\b"
+ },
+ {
+ token: "constant.numeric.terraform",
+ regex: "(\\b([0-9]+)([kKmMgG]b?)?\\b)|(\\b(0x[0-9A-Fa-f]+)([kKmMgG]b?)?\\b)"
+ }
+ ],
+ "variables": [
+ {
+ token: ["variable.assignment.terraform", "keyword.operator"],
+ regex: "\\b([a-zA-Z_]+)(\\s*=)"
+ }
+ ],
+ "interpolated_variables": [
+ {
+ token: "variable.terraform",
+ regex: "\\b(var|self|count|path|local)\\b(?:\\.*[a-zA-Z_-]*)?"
+ }
+ ],
+ "strings": [
+ {
+ token: "punctuation.quote.terraform",
+ regex: "'",
+ push:
+ [{
+ token: 'punctuation.quote.terraform',
+ regex: "'",
+ next: 'pop'
+ },
+ {include: "escaped_chars"},
+ {defaultToken: 'string'}]
+ },
+ {
+ token: "punctuation.quote.terraform",
+ regex: '"',
+ push:
+ [{
+ token: 'punctuation.quote.terraform',
+ regex: '"',
+ next: 'pop'
+ },
+ {include: "interpolation"},
+ {include: "escaped_chars"},
+ {defaultToken: 'string'}]
+ }
+ ],
+ "escaped_chars": [
+ {
+ token: "constant.escaped_char.terraform",
+ regex: "\\\\."
+ }
+ ],
+ "operators": [
+ {
+ token: "keyword.operator",
+ regex: "\\?|:|==|!=|>|<|>=|<=|&&|\\|\\\||!|%|&|\\*|\\+|\\-|/|="
+ }
+ ],
+ "interpolation": [
+ {// TODO: double $
+ token: "punctuation.interpolated.begin.terraform",
+ regex: "\\$?\\$\\{",
+ push: [{
+ token: "punctuation.interpolated.end.terraform",
+ regex: "\\}",
+ next: "pop"
+ },
+ {include: "interpolated_variables"},
+ {include: "operators"},
+ {include: "constants"},
+ {include: "strings"},
+ {include: "functions"},
+ {include: "parenthesis"},
+ {defaultToken: "punctuation"}
+ ]
+ }
+ ],
+ "functions": [
+ {
+ token: "keyword.function.terraform",
+ regex: "\\b(abs|basename|base64decode|base64encode|base64gzip|base64sha256|base64sha512|bcrypt|ceil|chomp|chunklist|cidrhost|cidrnetmask|cidrsubnet|coalesce|coalescelist|compact|concat|contains|dirname|distinct|element|file|floor|flatten|format|formatlist|indent|index|join|jsonencode|keys|length|list|log|lookup|lower|map|matchkeys|max|merge|min|md5|pathexpand|pow|replace|rsadecrypt|sha1|sha256|sha512|signum|slice|sort|split|substr|timestamp|timeadd|title|transpose|trimspace|upper|urlencode|uuid|values|zipmap)\\b"
+ }
+ ],
+ "parenthesis": [
+ {
+ token: "paren.lpar",
+ regex: "\\["
+ },
+ {
+ token: "paren.rpar",
+ regex: "\\]"
+ }
+ ]
+ };
+ this.normalizeRules();
+};
+
+oop.inherits(TerraformHighlightRules, TextHighlightRules);
+
+exports.TerraformHighlightRules = TerraformHighlightRules;
+});
diff --git a/lib/ace/snippets/puppet.js b/lib/ace/snippets/puppet.js
new file mode 100644
index 00000000000..61d1a67081f
--- /dev/null
+++ b/lib/ace/snippets/puppet.js
@@ -0,0 +1,7 @@
+define(function(require, exports, module) {
+"use strict";
+
+exports.snippetText = require("../requirejs/text!./puppet.snippets");
+exports.scope = "puppet";
+
+});
diff --git a/lib/ace/snippets/puppet.snippets b/lib/ace/snippets/puppet.snippets
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/lib/ace/snippets/terraform.js b/lib/ace/snippets/terraform.js
new file mode 100644
index 00000000000..d681d4e5278
--- /dev/null
+++ b/lib/ace/snippets/terraform.js
@@ -0,0 +1,7 @@
+define(function(require, exports, module) {
+"use strict";
+
+exports.snippetText = require("../requirejs/text!./terraform.snippets");
+exports.scope = "terraform";
+
+});
diff --git a/lib/ace/snippets/terraform.snippets b/lib/ace/snippets/terraform.snippets
new file mode 100644
index 00000000000..e69de29bb2d
From bb8d406417d29c7254a343027bd1804a238ac90a Mon Sep 17 00:00:00 2001
From: Rick Strahl
Date: Mon, 14 May 2018 11:00:18 -0700
Subject: [PATCH 0010/1293] Add image link parsing to the Markdown link parsing
RegEx.
---
lib/ace/mode/markdown_highlight_rules.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/ace/mode/markdown_highlight_rules.js b/lib/ace/mode/markdown_highlight_rules.js
index 8f4887f13dd..4502a058edf 100644
--- a/lib/ace/mode/markdown_highlight_rules.js
+++ b/lib/ace/mode/markdown_highlight_rules.js
@@ -137,10 +137,10 @@ var MarkdownHighlightRules = function() {
regex : "(\\[)(" + escaped("]") + ")(\\]\\s*\\[)("+ escaped("]") + ")(\\])"
}, { // link by url
token : ["text", "string", "text", "markup.underline", "string", "text"],
- regex : "(\\[)(" + // [
- escaped("]") + // link text
+ regex : "(\\!?\\[)(" + // [
+ escaped("]") + // link text or alt text
")(\\]\\()"+ // ](
- '((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)' + // href
+ '((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)' + // href or image
'(\\s*"' + escaped('"') + '"\\s*)?' + // "title"
"(\\))" // )
}, { // strong ** __
From 6c3a7bf33222f348e6f8e3780a2688dcd7042cc2 Mon Sep 17 00:00:00 2001
From: Fabian Jakobs
Date: Fri, 18 May 2018 16:57:20 -0700
Subject: [PATCH 0011/1293] Delete CNAME
---
CNAME | 1 -
1 file changed, 1 deletion(-)
delete mode 100644 CNAME
diff --git a/CNAME b/CNAME
deleted file mode 100644
index cb9e1ae2c39..00000000000
--- a/CNAME
+++ /dev/null
@@ -1 +0,0 @@
-ace.c9.io
\ No newline at end of file
From 51c0625e138687257d0f943442d17056849086fb Mon Sep 17 00:00:00 2001
From: Fabian Jakobs
Date: Fri, 18 May 2018 16:57:34 -0700
Subject: [PATCH 0012/1293] Create CNAME
---
CNAME | 1 +
1 file changed, 1 insertion(+)
create mode 100644 CNAME
diff --git a/CNAME b/CNAME
new file mode 100644
index 00000000000..cb9e1ae2c39
--- /dev/null
+++ b/CNAME
@@ -0,0 +1 @@
+ace.c9.io
\ No newline at end of file
From f03ae9d3f5a76e12d3fbbdff41cbb1c070530c27 Mon Sep 17 00:00:00 2001
From: Unknown
Date: Thu, 24 May 2018 12:30:41 +0100
Subject: [PATCH 0013/1293] Added two tmthemes gruvbox dark (hard contrast) and
light (hard contrast)
---
lib/ace/theme/gruvbox_dark_hard.css | 159 +++
lib/ace/theme/gruvbox_dark_hard.js | 39 +
lib/ace/theme/gruvbox_light_hard.css | 159 +++
lib/ace/theme/gruvbox_light_hard.js | 39 +
tool/tmtheme.js | 2 +
tool/tmthemes/gruvboxDarkHard.tmTheme | 1509 ++++++++++++++++++++++++
tool/tmthemes/gruvboxLightHard.tmTheme | 1509 ++++++++++++++++++++++++
7 files changed, 3416 insertions(+)
create mode 100644 lib/ace/theme/gruvbox_dark_hard.css
create mode 100644 lib/ace/theme/gruvbox_dark_hard.js
create mode 100644 lib/ace/theme/gruvbox_light_hard.css
create mode 100644 lib/ace/theme/gruvbox_light_hard.js
create mode 100644 tool/tmthemes/gruvboxDarkHard.tmTheme
create mode 100644 tool/tmthemes/gruvboxLightHard.tmTheme
diff --git a/lib/ace/theme/gruvbox_dark_hard.css b/lib/ace/theme/gruvbox_dark_hard.css
new file mode 100644
index 00000000000..a0f30186b1a
--- /dev/null
+++ b/lib/ace/theme/gruvbox_dark_hard.css
@@ -0,0 +1,159 @@
+.ace-gruvbox-dark-hard .ace_gutter {
+ background: #1d2021;
+ color: rgb(132,126,106)
+}
+
+.ace-gruvbox-dark-hard .ace_print-margin {
+ width: 1px;
+ background: #e8e8e8
+}
+
+.ace-gruvbox-dark-hard {
+ background-color: #1d2021;
+ color: rgba(235, 219, 178, 0.50)
+}
+
+.ace-gruvbox-dark-hard .ace_cursor {
+ color: #a89984
+}
+
+.ace-gruvbox-dark-hard .ace_marker-layer .ace_selection {
+ background: #3c3836
+}
+
+.ace-gruvbox-dark-hard.ace_multiselect .ace_selection.ace_start {
+ box-shadow: 0 0 3px 0px #1d2021;
+ border-radius: 2px
+}
+
+.ace-gruvbox-dark-hard .ace_marker-layer .ace_step {
+ background: rgb(198, 219, 174)
+}
+
+.ace-gruvbox-dark-hard .ace_marker-layer .ace_bracket {
+ margin: -1px 0 0 -1px;
+ border: 1px solid rgba(235, 219, 178, 0.15)
+}
+
+.ace-gruvbox-dark-hard .ace_marker-layer .ace_active-line {
+ background: #3c3836
+}
+
+.ace-gruvbox-dark-hard .ace_gutter-active-line {
+ background-color: #3c3836
+}
+
+.ace-gruvbox-dark-hard .ace_marker-layer .ace_selected-word {
+ border: 1px solid #3c3836
+}
+
+.ace-gruvbox-dark-hard .ace_fold {
+ background-color: #b8bb26;
+ border-color: rgba(235, 219, 178, 0.50)
+}
+
+.ace-gruvbox-dark-hard .ace_keyword {
+ color: #fb4934
+}
+
+.ace-gruvbox-dark-hard .ace_keyword.ace_operator {
+ color: #8ec07c
+}
+
+.ace-gruvbox-dark-hard .ace_keyword.ace_other.ace_unit {
+ color: #b16286
+}
+
+.ace-gruvbox-dark-hard .ace_constant {
+ color: #d3869b
+}
+
+.ace-gruvbox-dark-hard .ace_constant.ace_numeric {
+ color: #d3869b
+}
+
+.ace-gruvbox-dark-hard .ace_constant.ace_character.ace_escape {
+ color: #fb4934
+}
+
+.ace-gruvbox-dark-hard .ace_constant.ace_other {
+ color: #d3869b
+}
+
+.ace-gruvbox-dark-hard .ace_support.ace_function {
+ color: #8ec07c
+}
+
+.ace-gruvbox-dark-hard .ace_support.ace_constant {
+ color: #d3869b
+}
+
+.ace-gruvbox-dark-hard .ace_support.ace_constant.ace_property-value {
+ color: #f9f5d7
+}
+
+.ace-gruvbox-dark-hard .ace_support.ace_class {
+ color: #fabd2f
+}
+
+.ace-gruvbox-dark-hard .ace_support.ace_type {
+ color: #fabd2f
+}
+
+.ace-gruvbox-dark-hard .ace_storage {
+ color: #fb4934
+}
+
+.ace-gruvbox-dark-hard .ace_invalid {
+ color: #f9f5d7;
+ background-color: #fb4934
+}
+
+.ace-gruvbox-dark-hard .ace_string {
+ color: #b8bb26
+}
+
+.ace-gruvbox-dark-hard .ace_string.ace_regexp {
+ color: #b8bb26
+}
+
+.ace-gruvbox-dark-hard .ace_comment {
+ font-style: italic;
+ color: #928374
+}
+
+.ace-gruvbox-dark-hard .ace_variable {
+ color: #83a598
+}
+
+.ace-gruvbox-dark-hard .ace_variable.ace_language {
+ color: #d3869b
+}
+
+.ace-gruvbox-dark-hard .ace_variable.ace_parameter {
+ color: #f9f5d7
+}
+
+.ace-gruvbox-dark-hard .ace_meta.ace_tag {
+ color: #f9f5d7
+}
+
+.ace-gruvbox-dark-hard .ace_entity.ace_other.ace_attribute-name {
+ color: #fabd2f
+}
+
+.ace-gruvbox-dark-hard .ace_entity.ace_name.ace_function {
+ color: #b8bb26
+}
+
+.ace-gruvbox-dark-hard .ace_entity.ace_name.ace_tag {
+ color: #83a598
+}
+
+.ace-gruvbox-dark-hard .ace_markup.ace_heading {
+ color: #b8bb26
+}
+
+.ace-gruvbox-dark-hard .ace_markup.ace_list {
+ color: #83a598
+}
\ No newline at end of file
diff --git a/lib/ace/theme/gruvbox_dark_hard.js b/lib/ace/theme/gruvbox_dark_hard.js
new file mode 100644
index 00000000000..2cd402ab9b9
--- /dev/null
+++ b/lib/ace/theme/gruvbox_dark_hard.js
@@ -0,0 +1,39 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Ajax.org B.V. nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+
+exports.isDark = true;
+exports.cssClass = "ace-gruvbox-dark-hard";
+exports.cssText = require("../requirejs/text!./gruvbox_dark_hard.css");
+
+var dom = require("../lib/dom");
+dom.importCssString(exports.cssText, exports.cssClass);
+});
diff --git a/lib/ace/theme/gruvbox_light_hard.css b/lib/ace/theme/gruvbox_light_hard.css
new file mode 100644
index 00000000000..8a106cadd77
--- /dev/null
+++ b/lib/ace/theme/gruvbox_light_hard.css
@@ -0,0 +1,159 @@
+.ace-gruvbox-light-hard .ace_gutter {
+ background: #f9f5d7;
+ color: rgb(155,151,135)
+}
+
+.ace-gruvbox-light-hard .ace_print-margin {
+ width: 1px;
+ background: #e8e8e8
+}
+
+.ace-gruvbox-light-hard {
+ background-color: #f9f5d7;
+ color: rgba(60, 56, 54, 0.50)
+}
+
+.ace-gruvbox-light-hard .ace_cursor {
+ color: #7c6f64
+}
+
+.ace-gruvbox-light-hard .ace_marker-layer .ace_selection {
+ background: #ebdbb2
+}
+
+.ace-gruvbox-light-hard.ace_multiselect .ace_selection.ace_start {
+ box-shadow: 0 0 3px 0px #f9f5d7;
+ border-radius: 2px
+}
+
+.ace-gruvbox-light-hard .ace_marker-layer .ace_step {
+ background: rgb(198, 219, 174)
+}
+
+.ace-gruvbox-light-hard .ace_marker-layer .ace_bracket {
+ margin: -1px 0 0 -1px;
+ border: 1px solid rgba(60, 56, 54, 0.15)
+}
+
+.ace-gruvbox-light-hard .ace_marker-layer .ace_active-line {
+ background: #ebdbb2
+}
+
+.ace-gruvbox-light-hard .ace_gutter-active-line {
+ background-color: #ebdbb2
+}
+
+.ace-gruvbox-light-hard .ace_marker-layer .ace_selected-word {
+ border: 1px solid #ebdbb2
+}
+
+.ace-gruvbox-light-hard .ace_fold {
+ background-color: #79740e;
+ border-color: rgba(60, 56, 54, 0.50)
+}
+
+.ace-gruvbox-light-hard .ace_keyword {
+ color: #9d0006
+}
+
+.ace-gruvbox-light-hard .ace_keyword.ace_operator {
+ color: #427b58
+}
+
+.ace-gruvbox-light-hard .ace_keyword.ace_other.ace_unit {
+ color: #b16286
+}
+
+.ace-gruvbox-light-hard .ace_constant {
+ color: #8f3f71
+}
+
+.ace-gruvbox-light-hard .ace_constant.ace_numeric {
+ color: #8f3f71
+}
+
+.ace-gruvbox-light-hard .ace_constant.ace_character.ace_escape {
+ color: #9d0006
+}
+
+.ace-gruvbox-light-hard .ace_constant.ace_other {
+ color: #8f3f71
+}
+
+.ace-gruvbox-light-hard .ace_support.ace_function {
+ color: #427b58
+}
+
+.ace-gruvbox-light-hard .ace_support.ace_constant {
+ color: #8f3f71
+}
+
+.ace-gruvbox-light-hard .ace_support.ace_constant.ace_property-value {
+ color: #1d2021
+}
+
+.ace-gruvbox-light-hard .ace_support.ace_class {
+ color: #b57614
+}
+
+.ace-gruvbox-light-hard .ace_support.ace_type {
+ color: #b57614
+}
+
+.ace-gruvbox-light-hard .ace_storage {
+ color: #9d0006
+}
+
+.ace-gruvbox-light-hard .ace_invalid {
+ color: #1d2021;
+ background-color: #9d0006
+}
+
+.ace-gruvbox-light-hard .ace_string {
+ color: #79740e
+}
+
+.ace-gruvbox-light-hard .ace_string.ace_regexp {
+ color: #79740e
+}
+
+.ace-gruvbox-light-hard .ace_comment {
+ font-style: italic;
+ color: #928374
+}
+
+.ace-gruvbox-light-hard .ace_variable {
+ color: #076678
+}
+
+.ace-gruvbox-light-hard .ace_variable.ace_language {
+ color: #8f3f71
+}
+
+.ace-gruvbox-light-hard .ace_variable.ace_parameter {
+ color: #1d2021
+}
+
+.ace-gruvbox-light-hard .ace_meta.ace_tag {
+ color: #1d2021
+}
+
+.ace-gruvbox-light-hard .ace_entity.ace_other.ace_attribute-name {
+ color: #b57614
+}
+
+.ace-gruvbox-light-hard .ace_entity.ace_name.ace_function {
+ color: #79740e
+}
+
+.ace-gruvbox-light-hard .ace_entity.ace_name.ace_tag {
+ color: #076678
+}
+
+.ace-gruvbox-light-hard .ace_markup.ace_heading {
+ color: #79740e
+}
+
+.ace-gruvbox-light-hard .ace_markup.ace_list {
+ color: #076678
+}
\ No newline at end of file
diff --git a/lib/ace/theme/gruvbox_light_hard.js b/lib/ace/theme/gruvbox_light_hard.js
new file mode 100644
index 00000000000..e33217c61b4
--- /dev/null
+++ b/lib/ace/theme/gruvbox_light_hard.js
@@ -0,0 +1,39 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Ajax.org B.V. nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+
+exports.isDark = false;
+exports.cssClass = "ace-gruvbox-light-hard";
+exports.cssText = require("../requirejs/text!./gruvbox_light_hard.css");
+
+var dom = require("../lib/dom");
+dom.importCssString(exports.cssText, exports.cssClass);
+});
diff --git a/tool/tmtheme.js b/tool/tmtheme.js
index c3b5ef16443..397951b1477 100755
--- a/tool/tmtheme.js
+++ b/tool/tmtheme.js
@@ -288,6 +288,8 @@ var themes = {
"solarized_light": "Solarized-light",
"katzenmilch": "Katzenmilch",
"kuroir": "Kuroir Theme",
+ "gruvbox_dark_hard": "gruvboxDarkHard",
+ "gruvbox_light_hard": "gruvboxLightHard",
//"textmate": "Textmate (Mac Classic)",
"tomorrow": "Tomorrow",
"tomorrow_night": "Tomorrow-Night",
diff --git a/tool/tmthemes/gruvboxDarkHard.tmTheme b/tool/tmthemes/gruvboxDarkHard.tmTheme
new file mode 100644
index 00000000000..64c80d32a27
--- /dev/null
+++ b/tool/tmthemes/gruvboxDarkHard.tmTheme
@@ -0,0 +1,1509 @@
+
+
+
+
+ comment
+ Based on gruvbox for Vim (https://github.com/morhetz/gruvbox)
+ originalAuthor
+ Pavel Pertsev (https://github.com/morhetz)
+ author
+ Brian Reilly (https://github.com/Briles/gruvbox)
+ name
+ gruvbox (Dark) (Hard)
+ colorSpaceName
+ sRGB
+ settings
+
+
+ settings
+
+ background
+ #1d2021
+ caret
+ #a89984
+ foreground
+ #ebdbb280
+ invisibles
+ #ebdbb226
+ lineHighlight
+ #3c3836
+ selection
+ #3c3836
+ inactiveSelection
+ #3c3836
+ guide
+ #ebdbb226
+ activeGuide
+ #ebdbb280
+ stackGuide
+ #ebdbb240
+ bracketContentsOptions
+ underline
+ bracketContentsForeground
+ #bdae93
+ bracketsOptions
+ underline
+ bracketsForeground
+ #bdae93
+ gutterForeground
+ #928374
+ highlight
+ #f9f5d7
+ highlightForeground
+ #f9f5d7
+ findHighlight
+ #d79921
+ findHighlightForeground
+ #1d2021
+ tagsOptions
+ underline
+ selectionBorder
+ #3c3836
+ popupCss
+
+ html {
+ background-color: #111313;
+ color: #f9f5d7;
+ padding: 12px;
+ }
+
+ a {
+ color: #8ec07c;
+ }
+
+ .error, .deleted {
+ color: #fb4934;
+ }
+
+ .success, .inserted, .name {
+ color: #b8bb26;
+ }
+
+ .warning, .modified {
+ color: #fabd2f;
+ }
+
+ .type {
+ color: #fabd2f;
+ font-style: italic;
+ }
+
+ .param {
+ color: #f9f5d7;
+ }
+
+ .current {
+ text-decoration: underline;
+ }
+
+
+
+
+ name
+ Text and Source Base Colors
+ scope
+ meta.group, meta.method-call.source.cs, meta.method.attribute.source.cs, meta.method.body.java, meta.method.body.source.cs, meta.method.source.cs, none, source, text
+ settings
+
+ foreground
+ #f9f5d7
+
+
+
+ name
+ Punctuation
+ scope
+ entity.quasi.element meta.group.braces, keyword.operator keyword.operator.neon, keyword.operator operator.neon, keyword.operator.accessor, keyword.other.accessor, meta.attribute-selector keyword.operator.stylus, meta.brace, meta.delimiter, meta.group.braces, meta.punctuation.separator, meta.separator, punctuation
+ settings
+
+ foreground
+ #f9f5d7
+
+
+
+ name
+ Comments
+ scope
+ comment, comment text, markup.strikethrough, punctuation.definition.comment, punctuation.whitespace.comment, string.comment, text.cancelled
+ settings
+
+ fontStyle
+ italic
+ foreground
+ #928374
+
+
+
+ name
+ Keywords Inside Comments
+ scope
+ comment.keyword, comment.keyword.punctuation
+ settings
+
+ foreground
+ #d5c4a1
+
+
+
+ name
+ DocBlockr & Other Keywords Inside Comments
+ scope
+ comment.parameter, comment.punctuation, comment.string, comment.type, keyword.other.phpdoc.php, punctuation.definition.keyword.javadoc, source.groovy keyword.other.documentation, source.java keyword.other.documentation, storage.type.annotation.coffeescript, storage.type.class.jsdoc
+ settings
+
+ foreground
+ #bdae93
+
+
+
+ name
+ Entity
+ scope
+ constant.language.name, entity.name.type, entity.other.inherited-class
+ settings
+
+ foreground
+ #fabd2f
+
+
+
+ name
+ Template String Punctuation
+ scope
+ constant.other.placeholder, entity.name.tag.mustache, entity.tag.tagbraces, punctuation.definition.string.template, punctuation.definition.template-expression, punctuation.quasi, punctuation.section.embedded, string.interpolated, variable.other.interpolation.scss
+ settings
+
+ foreground
+ #8ec07c
+
+
+
+ name
+ Keywords
+ scope
+ js.embedded.control.flow keyword.operator.js, keyword, keyword.control, keyword.operator.logical.python, meta.at-rule.media support.function.misc, meta.prolog.haml, meta.tag.sgml.doctype.html, storage.type.function.jade, storage.type.function.pug, storage.type.import.haxe, storage.type.import.include.jade, storage.type.import.include.pug, support.keyword.timing-direction, variable.documentroot
+ settings
+
+ foreground
+ #fb4934
+
+
+
+ name
+ CSS At-Rule Punctuation (@) & At-Rule Vendor Prefixes
+ scope
+ keyword.control.at-rule support.type.property-vendor, punctuation.definition.keyword
+ settings
+
+ foreground
+ #cc241d
+
+
+
+ name
+ Operators
+ scope
+ keyword.control.new, keyword.control.operator, keyword.operator, keyword.other.arrow, keyword.other.double-colon, punctuation.operator
+ settings
+
+ foreground
+ #8ec07c
+
+
+
+ name
+ Constants Punctuation
+ scope
+ constant.other.color punctuation.definition.constant, constant.other.symbol punctuation.definition.constant, constant.other.unit, keyword.other.unit, punctuation.section.flowtype, support.constant.unicode-range.prefix
+ settings
+
+ foreground
+ #b16286
+
+
+
+ name
+ Storage
+ scope
+ storage, storage.type.annotation, storage.type.primitive
+ settings
+
+ foreground
+ #fb4934
+
+
+
+ scope
+ storage.modifier.import, storage.modifier.package, storage.type.import, variable.import, variable.package
+ settings
+
+ foreground
+ #f9f5d7
+
+
+
+ name
+ Function Keyword
+ scope
+ entity.quasi.tag.name, meta.function storage.type.matlab, storage.type.function
+ settings
+
+ foreground
+ #8ec07c
+
+
+
+ name
+ Variables
+ scope
+ entity.name.val.declaration, entity.name.variable, meta.definition.variable, storage.type.variable, support.type.custom-property, support.type.variable-name, variable, variable.interpolation variable, variable.other.interpolation variable, variable.parameter.dosbatch, variable.parameter.output.function.matlab, variable.parameter.sass
+ settings
+
+ foreground
+ #83a598
+
+
+
+ name
+ Variable - Punctuation
+ scope
+ keyword.other.custom-property.prefix, punctuation.definition.custom-property, punctuation.definition.variable, support.constant.custom-property-name.prefix, variable.interpolation, variable.other.dollar punctuation.dollar, variable.other.object.dollar punctuation.dollar
+ settings
+
+ foreground
+ #458588
+
+
+
+ name
+ Function Declaration - Punctuation
+ scope
+ entity.name.function punctuation.dollar
+ settings
+
+ foreground
+ #98971a
+
+
+
+ name
+ Object Properties
+ scope
+ meta.property.object
+ settings
+
+ foreground
+ #f9f5d7
+
+
+
+ name
+ Object Literal Properties
+ scope
+ constant.other.object.key string, meta.object-literal.key
+ settings
+
+ foreground
+ #f9f5d7
+
+
+
+ name
+ Parameters
+ scope
+ meta.parameters, variable.parameter
+ settings
+
+ foreground
+ #f9f5d7
+
+
+
+ name
+ SASS Import URL
+ scope
+ variable.parameter.url
+ settings
+
+ foreground
+ #b8bb26
+
+
+
+ name
+ Language Constants
+ scope
+ constant, constant.numeric, constant.other, constant.other.color, constant.other.symbol, support.constant, support.constant.color, support.constant.font-name, support.constant.media, support.constant.prototype, variable.language
+ settings
+
+ foreground
+ #d3869b
+
+
+
+ name
+ Language Constants Punctuation
+ scope
+ variable.language punctuation.definition.variable
+ settings
+
+ foreground
+ #b16286
+
+
+
+ name
+ User-Defined Constants
+ scope
+ entity.name.constant, variable.other.constant
+ settings
+
+ foreground
+ #fabd2f
+
+
+
+ name
+ Escaped Characters
+ scope
+ constant.character.escape, constant.character.escaped, constant.character.quoted, constant.other.character-class.escape
+ settings
+
+ foreground
+ #fb4934
+
+
+
+ name
+ Invalids and Illegals
+ scope
+ invalid
+ settings
+
+ foreground
+ #f9f5d7
+ background
+ #fb4934
+
+
+
+ name
+ Inner Scopes of Invalids and Illegals
+ scope
+ invalid keyword.other.custom-property.prefix, invalid support.type.custom-property.name
+ settings
+
+ foreground
+ #f9f5d7
+
+
+
+ name
+ Errors
+ scope
+ message.error
+ settings
+
+ foreground
+ #fb4934
+
+
+
+ name
+ Strings
+ scope
+ meta.object-literal.key string, string
+ settings
+
+ foreground
+ #b8bb26
+
+
+
+ name
+ JSON Keys
+ scope
+ meta.structure.dictionary.key.json string
+ settings
+
+ foreground
+ #83a598
+
+
+
+ name
+ Regular Expressions Text
+ scope
+ source.regexp, string.regexp
+ settings
+
+ foreground
+ #b8bb26
+
+
+
+ name
+ Regular Expressions Start & End Punctuation
+ scope
+ string.regexp punctuation.definition.string
+ settings
+
+ foreground
+ #bdae93
+
+
+
+ name
+ Regular Expressions Character Class Punctuation ([])
+ scope
+ keyword.control.set.regexp, punctuation.definition.character-class, string.regexp.character-class.ruby
+ settings
+
+ foreground
+ #d3869b
+
+
+
+ name
+ Regular Expressions Capturing Group
+ scope
+ string.regexp.group
+ settings
+
+ foreground
+ #f9f5d7
+
+
+
+ name
+ Regular Expressions Assertions
+ scope
+ constant.other.assertion.regexp, punctuation.definition.group.assertion.regexp, punctuation.definition.group.capture.regexp
+ settings
+
+ foreground
+ #83a598
+
+
+
+ name
+ Regular Expressions Character Class
+ scope
+ constant.other.character-class.escape.backslash.regexp, keyword.control.character-class.regexp, string.regexp.character-class constant.character.escape
+ settings
+
+ foreground
+ #fabd2f
+
+
+
+ name
+ Regular Expressions Quantifiers & Operators
+ scope
+ string.regexp.arbitrary-repetition, string.regexp.arbitrary-repetition punctuation
+ settings
+
+ foreground
+ #8ec07c
+
+
+
+ name
+ Hyperlinks
+ scope
+ constant.other.reference.link, string.other.link
+ settings
+
+ foreground
+ #8ec07c
+
+
+
+ name
+ Hyperlink Punctuation
+ scope
+ meta.image.inline punctuation.definition.string, meta.link.inline punctuation.definition.string, meta.link.reference punctuation.definition.constant, meta.link.reference.literal punctuation.definition.constant, meta.link.reference.literal punctuation.definition.string
+ settings
+
+ foreground
+ #689d6a
+
+
+
+ name
+ Markup Tag Punctuation
+ scope
+ punctuation.definition.tag
+ settings
+
+ foreground
+ #83a598
+
+
+
+ name
+ Markdown Heading
+ scope
+ markup.heading
+ settings
+
+ foreground
+ #b8bb26
+
+
+
+ name
+ Markdown Heading Punctuation
+ scope
+ punctuation.definition.heading, punctuation.definition.identity
+ settings
+
+ foreground
+ #98971a
+
+
+
+ name
+ Markdown Bold Text
+ scope
+ markup.bold
+ settings
+
+ foreground
+ #fe8019
+ fontStyle
+ bold
+
+
+
+ name
+ Markdown Bold Text Punctuation
+ scope
+ punctuation.definition.bold
+ settings
+
+ foreground
+ #d65d0e
+ fontStyle
+ bold
+
+
+
+ name
+ Markdown Italic Text
+ scope
+ markup.italic
+ settings
+
+ foreground
+ #fb4934
+ fontStyle
+ italic
+
+
+
+ name
+ Markdown Italic Text Punctuation
+ scope
+ punctuation.definition.italic
+ settings
+
+ foreground
+ #cc241d
+ fontStyle
+ italic
+
+
+
+ name
+ Markdown Inline Code
+ scope
+ markup.raw.inline
+ settings
+
+ foreground
+ #fabd2f
+
+
+
+ name
+ Markdown Inline Code Punctuation
+ scope
+ markup.raw.inline punctuation.definition.raw
+ settings
+
+ foreground
+ #d79921
+
+
+
+ name
+ Markdown Quoted
+ scope
+ markup.quote
+ settings
+
+ foreground
+ #d3869b
+
+
+
+ name
+ Markdown Quoted Punctuation
+ scope
+ markup.quote punctuation.definition.blockquote
+ settings
+
+ foreground
+ #b16286
+
+
+
+ name
+ Markdown List
+ scope
+ markup.list
+ settings
+
+ foreground
+ #83a598
+
+
+
+ name
+ Markdown List Punctuation
+ scope
+ markup.list punctuation.definition.list_item
+ settings
+
+ foreground
+ #458588
+
+
+
+ name
+ Markdown Separators
+ scope
+ meta.separator.markdown
+ settings
+
+ foreground
+ #928374
+
+
+
+ name
+ Support
+ scope
+ meta.function-call.constructor variable.type, support.class, support.type, variable.other.class
+ settings
+
+ foreground
+ #fabd2f
+
+
+
+ name
+ Supporting Type - Dollar Punctuation
+ scope
+ support.class punctuation.dollar
+ settings
+
+ foreground
+ #d79921
+
+
+
+ name
+ Function Calls
+ scope
+ entity.name.function.jade, entity.name.function.pug, keyword.other.special-method, meta.function-call variable.function, meta.function-call variable.other.dollar.only punctuation.dollar, support.function
+ settings
+
+ foreground
+ #8ec07c
+
+
+
+ name
+ Method Calls
+ scope
+ meta.function-call.method support.function, meta.function-call.method variable.function, meta.function-call.static variable.function, meta.method-call, meta.method-call support.function, meta.method-call variable.function, support.function.mutator
+ settings
+
+ foreground
+ #689d6a
+
+
+
+ name
+ Special Variables
+ scope
+ support.module
+ settings
+
+ foreground
+ #d3869b
+
+
+
+ name
+ Entities
+ scope
+ entity.name.accessor, entity.name.function, entity.name.label, entity.name.section
+ settings
+
+ foreground
+ #b8bb26
+
+
+
+ name
+ Modules
+ scope
+ entity.name.module
+ settings
+
+ foreground
+ #fe8019
+
+
+
+ name
+ HTML & CSS ID
+ scope
+ constant.id.tag, entity.name.tag.id, entity.other.attribute-name.id
+ settings
+
+ foreground
+ #fe8019
+
+
+
+ name
+ HTML & CSS ID Punctuation (#)
+ scope
+ entity.other.attribute-name.id punctuation.definition.entity
+ settings
+
+ foreground
+ #d65d0e
+
+
+
+ name
+ HTML & CSS Class
+ scope
+ entity.name.tag.class, entity.other.attribute-name.class
+ settings
+
+ foreground
+ #fabd2f
+
+
+
+ name
+ HTML & CSS Class Punctuation (.)
+ scope
+ entity.other.attribute-name.class punctuation.definition.entity
+ settings
+
+ foreground
+ #d79921
+
+
+
+ name
+ CSS Attribute Selector Attribute Name
+ scope
+ meta.attribute-selector entity.other.attribute-name
+ settings
+
+ foreground
+ #d79921
+
+
+
+ name
+ HTML & XML Entity Punctuation
+ scope
+ constant.character.entity punctuation.definition.constant, constant.character.entity punctuation.definition.entity
+ settings
+
+ foreground
+ #b16286
+
+
+
+ scope
+ entity.name.class, entity.name.type.class
+ settings
+
+ foreground
+ #fabd2f
+
+
+
+ name
+ Markup Tag
+ scope
+ entity.name.function.neon, entity.name.namespace.wildcard, entity.name.tag, entity.tag, keyword.control.untitled, keyword.doctype.xml, keyword.operator support.other.neon, punctuation.definition.prolog.haml, source.less keyword.control.html.elements
+ settings
+
+ foreground
+ #83a598
+
+
+
+ name
+ HTML Attribute Names
+ scope
+ entity.name.attribute-name, entity.other.attribute-name, meta.section.attributes.haml constant.other.symbol.ruby
+ settings
+
+ foreground
+ #fabd2f
+
+
+
+ name
+ CSS Pseudo Elements/Classes & Vendor Prefixes
+ scope
+ entity.other.attribute-name.placeholder punctuation.definition.entity, entity.other.attribute-name.pseudo-class, entity.other.attribute-name.pseudo-element, entity.other.attribute-name.tag.pseudo-class, entity.other.attribute-name.tag.pseudo-element, entity.other.pseudo-class, entity.other.pseudo-element, support.type.vendor-prefix
+ settings
+
+ foreground
+ #d79921
+
+
+
+ name
+ CSS Animations / Keyframes
+ scope
+ entity.function-name.stylus, entity.other.animation-keyframe.stylus, entity.other.animation-name, keyword.language.function.misc.stylus, meta.at-rule.keyframes entity.name.function, variable.other.animation-name
+ settings
+
+ foreground
+ #8ec07c
+
+
+
+ name
+ Author-Defined Names
+ scope
+ entity.other.namespace-prefix
+ settings
+
+ foreground
+ #8ec07c
+
+
+
+ scope
+ meta.class.body, meta.tag
+ settings
+
+ foreground
+ #f9f5d7
+
+
+
+ name
+ Markdown Image & Hyperlink
+ scope
+ meta.image, meta.link
+ settings
+
+ foreground
+ #d3869b
+
+
+
+ name
+ Markdown Image & Hyperlink Punctuation
+ scope
+ meta.image punctuation.definition.metadata, meta.link punctuation.definition.metadata
+ settings
+
+ foreground
+ #b16286
+
+
+
+ scope
+ meta.require
+ settings
+
+ foreground
+ #b8bb26
+
+
+
+ name
+ Function Call Braces
+ scope
+ constant.name.attribute.tag.jade, constant.name.attribute.tag.pug, meta.brace.round, meta.function-call meta.group punctuation.definition.group, punctuation.definition.method-parameters, punctuation.definition.parameters
+ settings
+
+ foreground
+ #bdae93
+
+
+
+ name
+ CSS Property Names
+ scope
+ meta.property-name, support.type.property-name, support.type.shape.definition support.constant.property-value
+ settings
+
+ foreground
+ #b8bb26
+
+
+
+ name
+ CSS Property Name Vendor Prefixes
+ scope
+ meta.property-name support.type.vendor-prefix, support.type.property-name.media support.type.vendor-prefix
+ settings
+
+ foreground
+ #98971a
+
+
+
+ name
+ CSS Property Values
+ scope
+ constant.string.sass, meta.property-value, support.constant.property-value
+ settings
+
+ foreground
+ #f9f5d7
+
+
+
+ name
+ CSS Property Value Vendor Prefixes
+ scope
+ meta.property-value support.type.vendor-prefix
+ settings
+
+ foreground
+ #bdae93
+
+
+
+ name
+ Diff Foreground Text
+ scope
+ source.diff
+ settings
+
+ foreground
+ #a89984
+
+
+
+ name
+ Diff Header Text From
+ scope
+ meta.diff.header.from-file
+ settings
+
+ foreground
+ #83a598
+
+
+
+ name
+ Diff Header Text From Punctuation
+ scope
+ punctuation.definition.from-file
+ settings
+
+ foreground
+ #458588
+
+
+
+ name
+ Diff Header Text To
+ scope
+ meta.diff.header.to-file
+ settings
+
+ foreground
+ #d3869b
+
+
+
+ name
+ Diff Header Text To Punctuation
+ scope
+ punctuation.definition.to-file
+ settings
+
+ foreground
+ #b16286
+
+
+
+ name
+ Diff Additions & Deletions Stats
+ scope
+ meta.diff.range, meta.toc-list.line-number
+ settings
+
+ foreground
+ #fabd2f
+
+
+
+ name
+ Diff Additions & Deletions Stats Punctuation
+ scope
+ punctuation.definition.range.diff
+ settings
+
+ foreground
+ #d79921
+
+
+
+ name
+ FiF Line Number
+ scope
+ constant.numeric.line-number
+ settings
+
+ foreground
+ #928374
+
+
+
+ name
+ FiF Line Number Matched
+ scope
+ constant.numeric.line-number.match
+ settings
+
+ foreground
+ #8ec07c
+
+
+
+ name
+ FiF Filename
+ scope
+ entity.name.filename
+ settings
+
+ foreground
+ #b8bb26
+
+
+
+ name
+ GitGutter & Diff Deleted
+ scope
+ markup.deleted, punctuation.definition.deleted
+ settings
+
+ foreground
+ #fb4934
+
+
+
+ name
+ GitGutter & Diff Inserted
+ scope
+ markup.inserted, punctuation.definition.inserted
+ settings
+
+ foreground
+ #b8bb26
+
+
+
+ name
+ GitGutter & Diff Changed
+ scope
+ markup.changed, punctuation.definition.changed
+ settings
+
+ foreground
+ #fabd2f
+
+
+
+ name
+ GitGutter ignored
+ scope
+ markup.ignored
+ settings
+
+ foreground
+ #928374
+
+
+
+ name
+ GitGutter untracked
+ scope
+ markup.untracked
+ settings
+
+ foreground
+ #928374
+
+
+
+ name
+ Bracket Tag
+ scope
+ brackethighlighter.tag
+ settings
+
+ foreground
+ #bdae93
+
+
+
+ name
+ Bracket Curly
+ scope
+ brackethighlighter.curly
+ settings
+
+ foreground
+ #bdae93
+
+
+
+ name
+ Bracket Round
+ scope
+ brackethighlighter.round
+ settings
+
+ foreground
+ #bdae93
+
+
+
+ name
+ Bracket Square
+ scope
+ brackethighlighter.square
+ settings
+
+ foreground
+ #bdae93
+
+
+
+ name
+ Bracket Angle
+ scope
+ brackethighlighter.angle
+ settings
+
+ foreground
+ #bdae93
+
+
+
+ name
+ Bracket Quote
+ scope
+ brackethighlighter.quote
+ settings
+
+ foreground
+ #bdae93
+
+
+
+ name
+ Bracket Unmatched
+ scope
+ brackethighlighter.unmatched
+ settings
+
+ foreground
+ #fb4934
+
+
+
+ name
+ SublimeLinter Error
+ scope
+ sublimelinter.mark.error
+ settings
+
+ foreground
+ #fb4934
+
+
+
+ name
+ SublimeLinter Gutter Mark
+ scope
+ sublimelinter.gutter-mark
+ settings
+
+ foreground
+ #928374
+
+
+
+ name
+ SublimeLinter Warning
+ scope
+ sublimelinter.mark.warning
+ settings
+
+ foreground
+ #fabd2f
+
+
+
+ name
+ HexViewer Upper Byte Nibble
+ scope
+ raw.nibble.upper
+ settings
+
+ foreground
+ #f9f5d7
+
+
+
+ name
+ HexViewer Lower Byte Nibble
+ scope
+ raw.nibble.lower
+ settings
+
+ foreground
+ #f9f5d7
+
+
+
+ name
+ HexViewer Highlight
+ scope
+ hexviewer.highlight
+ settings
+
+ foreground
+ #1d2021
+ background
+ #fabd2f
+
+
+
+ name
+ HexViewer Edited Highlight
+ scope
+ hexviewer.highlight.edited
+ settings
+
+ foreground
+ #1d2021
+ background
+ #fe8019
+
+
+
+ name
+ Raw New Line: Carriage Return
+ scope
+ glyph.carriage-return
+ settings
+
+ foreground
+ #ebdbb226
+
+
+
+ name
+ Raw New Line: New Line Glyph
+ scope
+ glyph.new-line
+ settings
+
+ foreground
+ #ebdbb226
+
+
+
+ name
+ PlainTasks: Header
+ scope
+ keyword.control.header.todo
+ settings
+
+ foreground
+ #b8bb26
+ background
+ #2e3234
+
+
+
+ name
+ PlainTasks: Notes
+ scope
+ notes.todo
+ settings
+
+ foreground
+ #bdae93
+
+
+
+ name
+ PlainTasks: Punctuation
+ scope
+ text.todo punctuation.definition.bold, text.todo punctuation.definition.italic
+ settings
+
+ foreground
+ #7c6f64
+
+
+
+ name
+ PlainTasks: Task Pending
+ scope
+ meta.item.todo.pending
+ settings
+
+ foreground
+ #f9f5d7
+
+
+
+ name
+ PlainTasks: Task Pending Punctuation
+ scope
+ punctuation.definition.bullet.pending.todo
+ settings
+
+ foreground
+ #928374
+
+
+
+ name
+ PlainTasks: Task Completed Punctuation
+ scope
+ punctuation.definition.bullet.completed.todo
+ settings
+
+ foreground
+ #8ec07c
+
+
+
+ name
+ PlainTasks: Task Cancelled Punctuation
+ scope
+ punctuation.definition.bullet.cancelled.todo
+ settings
+
+ foreground
+ #fb4934
+
+
+
+ name
+ PlainTasks: Tag Critical
+ scope
+ string.other.tag.todo.critical
+ settings
+
+ foreground
+ #fb4934
+ fontStyle
+ bold
+
+
+
+ name
+ PlainTasks: Tag High
+ scope
+ string.other.tag.todo.high
+ settings
+
+ foreground
+ #fe8019
+ fontStyle
+ bold
+
+
+
+ name
+ PlainTasks: Tag Low
+ scope
+ string.other.tag.todo.low
+ settings
+
+ foreground
+ #83a598
+ fontStyle
+ bold
+
+
+
+ name
+ PlainTasks: Tag Today
+ scope
+ string.other.tag.todo.today
+ settings
+
+ foreground
+ #fabd2f
+ fontStyle
+ bold
+
+
+
+ name
+ PlainTasks: Tag
+ scope
+ meta.tag.todo
+ settings
+
+ foreground
+ #d3869b
+
+
+
+ name
+ PlainTasks: URL
+ scope
+ punctuation.definition.url, todo.url
+ settings
+
+ foreground
+ #83a598
+
+
+
+ name
+ PlainTasks: Separator
+ scope
+ meta.punctuation.archive.todo, meta.punctuation.separator.todo
+ settings
+
+ fontStyle
+ italic
+ foreground
+ #928374
+
+
+
+
+
\ No newline at end of file
diff --git a/tool/tmthemes/gruvboxLightHard.tmTheme b/tool/tmthemes/gruvboxLightHard.tmTheme
new file mode 100644
index 00000000000..c75d15f7689
--- /dev/null
+++ b/tool/tmthemes/gruvboxLightHard.tmTheme
@@ -0,0 +1,1509 @@
+
+
+
+
+ comment
+ Based on gruvbox for Vim (https://github.com/morhetz/gruvbox)
+ originalAuthor
+ Pavel Pertsev (https://github.com/morhetz)
+ author
+ Brian Reilly (https://github.com/Briles/gruvbox)
+ name
+ gruvbox (Light) (Hard)
+ colorSpaceName
+ sRGB
+ settings
+
+
+ settings
+
+ background
+ #f9f5d7
+ caret
+ #7c6f64
+ foreground
+ #3c383680
+ invisibles
+ #3c383626
+ lineHighlight
+ #ebdbb2
+ selection
+ #ebdbb2
+ inactiveSelection
+ #ebdbb2
+ guide
+ #3c383626
+ activeGuide
+ #3c383680
+ stackGuide
+ #3c383640
+ bracketContentsOptions
+ underline
+ bracketContentsForeground
+ #665c54
+ bracketsOptions
+ underline
+ bracketsForeground
+ #665c54
+ gutterForeground
+ #928374
+ highlight
+ #1d2021
+ highlightForeground
+ #1d2021
+ findHighlight
+ #d79921
+ findHighlightForeground
+ #f9f5d7
+ tagsOptions
+ underline
+ selectionBorder
+ #ebdbb2
+ popupCss
+
+ html {
+ background-color: #f6efc1;
+ color: #1d2021;
+ padding: 12px;
+ }
+
+ a {
+ color: #427b58;
+ }
+
+ .error, .deleted {
+ color: #9d0006;
+ }
+
+ .success, .inserted, .name {
+ color: #79740e;
+ }
+
+ .warning, .modified {
+ color: #b57614;
+ }
+
+ .type {
+ color: #b57614;
+ font-style: italic;
+ }
+
+ .param {
+ color: #1d2021;
+ }
+
+ .current {
+ text-decoration: underline;
+ }
+
+
+
+
+ name
+ Text and Source Base Colors
+ scope
+ meta.group, meta.method-call.source.cs, meta.method.attribute.source.cs, meta.method.body.java, meta.method.body.source.cs, meta.method.source.cs, none, source, text
+ settings
+
+ foreground
+ #1d2021
+
+
+
+ name
+ Punctuation
+ scope
+ entity.quasi.element meta.group.braces, keyword.operator keyword.operator.neon, keyword.operator operator.neon, keyword.operator.accessor, keyword.other.accessor, meta.attribute-selector keyword.operator.stylus, meta.brace, meta.delimiter, meta.group.braces, meta.punctuation.separator, meta.separator, punctuation
+ settings
+
+ foreground
+ #1d2021
+
+
+
+ name
+ Comments
+ scope
+ comment, comment text, markup.strikethrough, punctuation.definition.comment, punctuation.whitespace.comment, string.comment, text.cancelled
+ settings
+
+ fontStyle
+ italic
+ foreground
+ #928374
+
+
+
+ name
+ Keywords Inside Comments
+ scope
+ comment.keyword, comment.keyword.punctuation
+ settings
+
+ foreground
+ #504945
+
+
+
+ name
+ DocBlockr & Other Keywords Inside Comments
+ scope
+ comment.parameter, comment.punctuation, comment.string, comment.type, keyword.other.phpdoc.php, punctuation.definition.keyword.javadoc, source.groovy keyword.other.documentation, source.java keyword.other.documentation, storage.type.annotation.coffeescript, storage.type.class.jsdoc
+ settings
+
+ foreground
+ #665c54
+
+
+
+ name
+ Entity
+ scope
+ constant.language.name, entity.name.type, entity.other.inherited-class
+ settings
+
+ foreground
+ #b57614
+
+
+
+ name
+ Template String Punctuation
+ scope
+ constant.other.placeholder, entity.name.tag.mustache, entity.tag.tagbraces, punctuation.definition.string.template, punctuation.definition.template-expression, punctuation.quasi, punctuation.section.embedded, string.interpolated, variable.other.interpolation.scss
+ settings
+
+ foreground
+ #427b58
+
+
+
+ name
+ Keywords
+ scope
+ js.embedded.control.flow keyword.operator.js, keyword, keyword.control, keyword.operator.logical.python, meta.at-rule.media support.function.misc, meta.prolog.haml, meta.tag.sgml.doctype.html, storage.type.function.jade, storage.type.function.pug, storage.type.import.haxe, storage.type.import.include.jade, storage.type.import.include.pug, support.keyword.timing-direction, variable.documentroot
+ settings
+
+ foreground
+ #9d0006
+
+
+
+ name
+ CSS At-Rule Punctuation (@) & At-Rule Vendor Prefixes
+ scope
+ keyword.control.at-rule support.type.property-vendor, punctuation.definition.keyword
+ settings
+
+ foreground
+ #cc241d
+
+
+
+ name
+ Operators
+ scope
+ keyword.control.new, keyword.control.operator, keyword.operator, keyword.other.arrow, keyword.other.double-colon, punctuation.operator
+ settings
+
+ foreground
+ #427b58
+
+
+
+ name
+ Constants Punctuation
+ scope
+ constant.other.color punctuation.definition.constant, constant.other.symbol punctuation.definition.constant, constant.other.unit, keyword.other.unit, punctuation.section.flowtype, support.constant.unicode-range.prefix
+ settings
+
+ foreground
+ #b16286
+
+
+
+ name
+ Storage
+ scope
+ storage, storage.type.annotation, storage.type.primitive
+ settings
+
+ foreground
+ #9d0006
+
+
+
+ scope
+ storage.modifier.import, storage.modifier.package, storage.type.import, variable.import, variable.package
+ settings
+
+ foreground
+ #1d2021
+
+
+
+ name
+ Function Keyword
+ scope
+ entity.quasi.tag.name, meta.function storage.type.matlab, storage.type.function
+ settings
+
+ foreground
+ #427b58
+
+
+
+ name
+ Variables
+ scope
+ entity.name.val.declaration, entity.name.variable, meta.definition.variable, storage.type.variable, support.type.custom-property, support.type.variable-name, variable, variable.interpolation variable, variable.other.interpolation variable, variable.parameter.dosbatch, variable.parameter.output.function.matlab, variable.parameter.sass
+ settings
+
+ foreground
+ #076678
+
+
+
+ name
+ Variable - Punctuation
+ scope
+ keyword.other.custom-property.prefix, punctuation.definition.custom-property, punctuation.definition.variable, support.constant.custom-property-name.prefix, variable.interpolation, variable.other.dollar punctuation.dollar, variable.other.object.dollar punctuation.dollar
+ settings
+
+ foreground
+ #458588
+
+
+
+ name
+ Function Declaration - Punctuation
+ scope
+ entity.name.function punctuation.dollar
+ settings
+
+ foreground
+ #98971a
+
+
+
+ name
+ Object Properties
+ scope
+ meta.property.object
+ settings
+
+ foreground
+ #1d2021
+
+
+
+ name
+ Object Literal Properties
+ scope
+ constant.other.object.key string, meta.object-literal.key
+ settings
+
+ foreground
+ #1d2021
+
+
+
+ name
+ Parameters
+ scope
+ meta.parameters, variable.parameter
+ settings
+
+ foreground
+ #1d2021
+
+
+
+ name
+ SASS Import URL
+ scope
+ variable.parameter.url
+ settings
+
+ foreground
+ #79740e
+
+
+
+ name
+ Language Constants
+ scope
+ constant, constant.numeric, constant.other, constant.other.color, constant.other.symbol, support.constant, support.constant.color, support.constant.font-name, support.constant.media, support.constant.prototype, variable.language
+ settings
+
+ foreground
+ #8f3f71
+
+
+
+ name
+ Language Constants Punctuation
+ scope
+ variable.language punctuation.definition.variable
+ settings
+
+ foreground
+ #b16286
+
+
+
+ name
+ User-Defined Constants
+ scope
+ entity.name.constant, variable.other.constant
+ settings
+
+ foreground
+ #b57614
+
+
+
+ name
+ Escaped Characters
+ scope
+ constant.character.escape, constant.character.escaped, constant.character.quoted, constant.other.character-class.escape
+ settings
+
+ foreground
+ #9d0006
+
+
+
+ name
+ Invalids and Illegals
+ scope
+ invalid
+ settings
+
+ foreground
+ #1d2021
+ background
+ #9d0006
+
+
+
+ name
+ Inner Scopes of Invalids and Illegals
+ scope
+ invalid keyword.other.custom-property.prefix, invalid support.type.custom-property.name
+ settings
+
+ foreground
+ #1d2021
+
+
+
+ name
+ Errors
+ scope
+ message.error
+ settings
+
+ foreground
+ #9d0006
+
+
+
+ name
+ Strings
+ scope
+ meta.object-literal.key string, string
+ settings
+
+ foreground
+ #79740e
+
+
+
+ name
+ JSON Keys
+ scope
+ meta.structure.dictionary.key.json string
+ settings
+
+ foreground
+ #076678
+
+
+
+ name
+ Regular Expressions Text
+ scope
+ source.regexp, string.regexp
+ settings
+
+ foreground
+ #79740e
+
+
+
+ name
+ Regular Expressions Start & End Punctuation
+ scope
+ string.regexp punctuation.definition.string
+ settings
+
+ foreground
+ #665c54
+
+
+
+ name
+ Regular Expressions Character Class Punctuation ([])
+ scope
+ keyword.control.set.regexp, punctuation.definition.character-class, string.regexp.character-class.ruby
+ settings
+
+ foreground
+ #8f3f71
+
+
+
+ name
+ Regular Expressions Capturing Group
+ scope
+ string.regexp.group
+ settings
+
+ foreground
+ #1d2021
+
+
+
+ name
+ Regular Expressions Assertions
+ scope
+ constant.other.assertion.regexp, punctuation.definition.group.assertion.regexp, punctuation.definition.group.capture.regexp
+ settings
+
+ foreground
+ #076678
+
+
+
+ name
+ Regular Expressions Character Class
+ scope
+ constant.other.character-class.escape.backslash.regexp, keyword.control.character-class.regexp, string.regexp.character-class constant.character.escape
+ settings
+
+ foreground
+ #b57614
+
+
+
+ name
+ Regular Expressions Quantifiers & Operators
+ scope
+ string.regexp.arbitrary-repetition, string.regexp.arbitrary-repetition punctuation
+ settings
+
+ foreground
+ #427b58
+
+
+
+ name
+ Hyperlinks
+ scope
+ constant.other.reference.link, string.other.link
+ settings
+
+ foreground
+ #427b58
+
+
+
+ name
+ Hyperlink Punctuation
+ scope
+ meta.image.inline punctuation.definition.string, meta.link.inline punctuation.definition.string, meta.link.reference punctuation.definition.constant, meta.link.reference.literal punctuation.definition.constant, meta.link.reference.literal punctuation.definition.string
+ settings
+
+ foreground
+ #689d6a
+
+
+
+ name
+ Markup Tag Punctuation
+ scope
+ punctuation.definition.tag
+ settings
+
+ foreground
+ #076678
+
+
+
+ name
+ Markdown Heading
+ scope
+ markup.heading
+ settings
+
+ foreground
+ #79740e
+
+
+
+ name
+ Markdown Heading Punctuation
+ scope
+ punctuation.definition.heading, punctuation.definition.identity
+ settings
+
+ foreground
+ #98971a
+
+
+
+ name
+ Markdown Bold Text
+ scope
+ markup.bold
+ settings
+
+ foreground
+ #af3a03
+ fontStyle
+ bold
+
+
+
+ name
+ Markdown Bold Text Punctuation
+ scope
+ punctuation.definition.bold
+ settings
+
+ foreground
+ #d65d0e
+ fontStyle
+ bold
+
+
+
+ name
+ Markdown Italic Text
+ scope
+ markup.italic
+ settings
+
+ foreground
+ #9d0006
+ fontStyle
+ italic
+
+
+
+ name
+ Markdown Italic Text Punctuation
+ scope
+ punctuation.definition.italic
+ settings
+
+ foreground
+ #cc241d
+ fontStyle
+ italic
+
+
+
+ name
+ Markdown Inline Code
+ scope
+ markup.raw.inline
+ settings
+
+ foreground
+ #b57614
+
+
+
+ name
+ Markdown Inline Code Punctuation
+ scope
+ markup.raw.inline punctuation.definition.raw
+ settings
+
+ foreground
+ #d79921
+
+
+
+ name
+ Markdown Quoted
+ scope
+ markup.quote
+ settings
+
+ foreground
+ #8f3f71
+
+
+
+ name
+ Markdown Quoted Punctuation
+ scope
+ markup.quote punctuation.definition.blockquote
+ settings
+
+ foreground
+ #b16286
+
+
+
+ name
+ Markdown List
+ scope
+ markup.list
+ settings
+
+ foreground
+ #076678
+
+
+
+ name
+ Markdown List Punctuation
+ scope
+ markup.list punctuation.definition.list_item
+ settings
+
+ foreground
+ #458588
+
+
+
+ name
+ Markdown Separators
+ scope
+ meta.separator.markdown
+ settings
+
+ foreground
+ #928374
+
+
+
+ name
+ Support
+ scope
+ meta.function-call.constructor variable.type, support.class, support.type, variable.other.class
+ settings
+
+ foreground
+ #b57614
+
+
+
+ name
+ Supporting Type - Dollar Punctuation
+ scope
+ support.class punctuation.dollar
+ settings
+
+ foreground
+ #d79921
+
+
+
+ name
+ Function Calls
+ scope
+ entity.name.function.jade, entity.name.function.pug, keyword.other.special-method, meta.function-call variable.function, meta.function-call variable.other.dollar.only punctuation.dollar, support.function
+ settings
+
+ foreground
+ #427b58
+
+
+
+ name
+ Method Calls
+ scope
+ meta.function-call.method support.function, meta.function-call.method variable.function, meta.function-call.static variable.function, meta.method-call, meta.method-call support.function, meta.method-call variable.function, support.function.mutator
+ settings
+
+ foreground
+ #689d6a
+
+
+
+ name
+ Special Variables
+ scope
+ support.module
+ settings
+
+ foreground
+ #8f3f71
+
+
+
+ name
+ Entities
+ scope
+ entity.name.accessor, entity.name.function, entity.name.label, entity.name.section
+ settings
+
+ foreground
+ #79740e
+
+
+
+ name
+ Modules
+ scope
+ entity.name.module
+ settings
+
+ foreground
+ #af3a03
+
+
+
+ name
+ HTML & CSS ID
+ scope
+ constant.id.tag, entity.name.tag.id, entity.other.attribute-name.id
+ settings
+
+ foreground
+ #af3a03
+
+
+
+ name
+ HTML & CSS ID Punctuation (#)
+ scope
+ entity.other.attribute-name.id punctuation.definition.entity
+ settings
+
+ foreground
+ #d65d0e
+
+
+
+ name
+ HTML & CSS Class
+ scope
+ entity.name.tag.class, entity.other.attribute-name.class
+ settings
+
+ foreground
+ #b57614
+
+
+
+ name
+ HTML & CSS Class Punctuation (.)
+ scope
+ entity.other.attribute-name.class punctuation.definition.entity
+ settings
+
+ foreground
+ #d79921
+
+
+
+ name
+ CSS Attribute Selector Attribute Name
+ scope
+ meta.attribute-selector entity.other.attribute-name
+ settings
+
+ foreground
+ #d79921
+
+
+
+ name
+ HTML & XML Entity Punctuation
+ scope
+ constant.character.entity punctuation.definition.constant, constant.character.entity punctuation.definition.entity
+ settings
+
+ foreground
+ #b16286
+
+
+
+ scope
+ entity.name.class, entity.name.type.class
+ settings
+
+ foreground
+ #b57614
+
+
+
+ name
+ Markup Tag
+ scope
+ entity.name.function.neon, entity.name.namespace.wildcard, entity.name.tag, entity.tag, keyword.control.untitled, keyword.doctype.xml, keyword.operator support.other.neon, punctuation.definition.prolog.haml, source.less keyword.control.html.elements
+ settings
+
+ foreground
+ #076678
+
+
+
+ name
+ HTML Attribute Names
+ scope
+ entity.name.attribute-name, entity.other.attribute-name, meta.section.attributes.haml constant.other.symbol.ruby
+ settings
+
+ foreground
+ #b57614
+
+
+
+ name
+ CSS Pseudo Elements/Classes & Vendor Prefixes
+ scope
+ entity.other.attribute-name.placeholder punctuation.definition.entity, entity.other.attribute-name.pseudo-class, entity.other.attribute-name.pseudo-element, entity.other.attribute-name.tag.pseudo-class, entity.other.attribute-name.tag.pseudo-element, entity.other.pseudo-class, entity.other.pseudo-element, support.type.vendor-prefix
+ settings
+
+ foreground
+ #d79921
+
+
+
+ name
+ CSS Animations / Keyframes
+ scope
+ entity.function-name.stylus, entity.other.animation-keyframe.stylus, entity.other.animation-name, keyword.language.function.misc.stylus, meta.at-rule.keyframes entity.name.function, variable.other.animation-name
+ settings
+
+ foreground
+ #427b58
+
+
+
+ name
+ Author-Defined Names
+ scope
+ entity.other.namespace-prefix
+ settings
+
+ foreground
+ #427b58
+
+
+
+ scope
+ meta.class.body, meta.tag
+ settings
+
+ foreground
+ #1d2021
+
+
+
+ name
+ Markdown Image & Hyperlink
+ scope
+ meta.image, meta.link
+ settings
+
+ foreground
+ #8f3f71
+
+
+
+ name
+ Markdown Image & Hyperlink Punctuation
+ scope
+ meta.image punctuation.definition.metadata, meta.link punctuation.definition.metadata
+ settings
+
+ foreground
+ #b16286
+
+
+
+ scope
+ meta.require
+ settings
+
+ foreground
+ #79740e
+
+
+
+ name
+ Function Call Braces
+ scope
+ constant.name.attribute.tag.jade, constant.name.attribute.tag.pug, meta.brace.round, meta.function-call meta.group punctuation.definition.group, punctuation.definition.method-parameters, punctuation.definition.parameters
+ settings
+
+ foreground
+ #665c54
+
+
+
+ name
+ CSS Property Names
+ scope
+ meta.property-name, support.type.property-name, support.type.shape.definition support.constant.property-value
+ settings
+
+ foreground
+ #79740e
+
+
+
+ name
+ CSS Property Name Vendor Prefixes
+ scope
+ meta.property-name support.type.vendor-prefix, support.type.property-name.media support.type.vendor-prefix
+ settings
+
+ foreground
+ #98971a
+
+
+
+ name
+ CSS Property Values
+ scope
+ constant.string.sass, meta.property-value, support.constant.property-value
+ settings
+
+ foreground
+ #1d2021
+
+
+
+ name
+ CSS Property Value Vendor Prefixes
+ scope
+ meta.property-value support.type.vendor-prefix
+ settings
+
+ foreground
+ #665c54
+
+
+
+ name
+ Diff Foreground Text
+ scope
+ source.diff
+ settings
+
+ foreground
+ #7c6f64
+
+
+
+ name
+ Diff Header Text From
+ scope
+ meta.diff.header.from-file
+ settings
+
+ foreground
+ #076678
+
+
+
+ name
+ Diff Header Text From Punctuation
+ scope
+ punctuation.definition.from-file
+ settings
+
+ foreground
+ #458588
+
+
+
+ name
+ Diff Header Text To
+ scope
+ meta.diff.header.to-file
+ settings
+
+ foreground
+ #8f3f71
+
+
+
+ name
+ Diff Header Text To Punctuation
+ scope
+ punctuation.definition.to-file
+ settings
+
+ foreground
+ #b16286
+
+
+
+ name
+ Diff Additions & Deletions Stats
+ scope
+ meta.diff.range, meta.toc-list.line-number
+ settings
+
+ foreground
+ #b57614
+
+
+
+ name
+ Diff Additions & Deletions Stats Punctuation
+ scope
+ punctuation.definition.range.diff
+ settings
+
+ foreground
+ #d79921
+
+
+
+ name
+ FiF Line Number
+ scope
+ constant.numeric.line-number
+ settings
+
+ foreground
+ #928374
+
+
+
+ name
+ FiF Line Number Matched
+ scope
+ constant.numeric.line-number.match
+ settings
+
+ foreground
+ #427b58
+
+
+
+ name
+ FiF Filename
+ scope
+ entity.name.filename
+ settings
+
+ foreground
+ #79740e
+
+
+
+ name
+ GitGutter & Diff Deleted
+ scope
+ markup.deleted, punctuation.definition.deleted
+ settings
+
+ foreground
+ #9d0006
+
+
+
+ name
+ GitGutter & Diff Inserted
+ scope
+ markup.inserted, punctuation.definition.inserted
+ settings
+
+ foreground
+ #79740e
+
+
+
+ name
+ GitGutter & Diff Changed
+ scope
+ markup.changed, punctuation.definition.changed
+ settings
+
+ foreground
+ #b57614
+
+
+
+ name
+ GitGutter ignored
+ scope
+ markup.ignored
+ settings
+
+ foreground
+ #928374
+
+
+
+ name
+ GitGutter untracked
+ scope
+ markup.untracked
+ settings
+
+ foreground
+ #928374
+
+
+
+ name
+ Bracket Tag
+ scope
+ brackethighlighter.tag
+ settings
+
+ foreground
+ #665c54
+
+
+
+ name
+ Bracket Curly
+ scope
+ brackethighlighter.curly
+ settings
+
+ foreground
+ #665c54
+
+
+
+ name
+ Bracket Round
+ scope
+ brackethighlighter.round
+ settings
+
+ foreground
+ #665c54
+
+
+
+ name
+ Bracket Square
+ scope
+ brackethighlighter.square
+ settings
+
+ foreground
+ #665c54
+
+
+
+ name
+ Bracket Angle
+ scope
+ brackethighlighter.angle
+ settings
+
+ foreground
+ #665c54
+
+
+
+ name
+ Bracket Quote
+ scope
+ brackethighlighter.quote
+ settings
+
+ foreground
+ #665c54
+
+
+
+ name
+ Bracket Unmatched
+ scope
+ brackethighlighter.unmatched
+ settings
+
+ foreground
+ #9d0006
+
+
+
+ name
+ SublimeLinter Error
+ scope
+ sublimelinter.mark.error
+ settings
+
+ foreground
+ #9d0006
+
+
+
+ name
+ SublimeLinter Gutter Mark
+ scope
+ sublimelinter.gutter-mark
+ settings
+
+ foreground
+ #928374
+
+
+
+ name
+ SublimeLinter Warning
+ scope
+ sublimelinter.mark.warning
+ settings
+
+ foreground
+ #b57614
+
+
+
+ name
+ HexViewer Upper Byte Nibble
+ scope
+ raw.nibble.upper
+ settings
+
+ foreground
+ #1d2021
+
+
+
+ name
+ HexViewer Lower Byte Nibble
+ scope
+ raw.nibble.lower
+ settings
+
+ foreground
+ #1d2021
+
+
+
+ name
+ HexViewer Highlight
+ scope
+ hexviewer.highlight
+ settings
+
+ foreground
+ #f9f5d7
+ background
+ #b57614
+
+
+
+ name
+ HexViewer Edited Highlight
+ scope
+ hexviewer.highlight.edited
+ settings
+
+ foreground
+ #f9f5d7
+ background
+ #af3a03
+
+
+
+ name
+ Raw New Line: Carriage Return
+ scope
+ glyph.carriage-return
+ settings
+
+ foreground
+ #3c383626
+
+
+
+ name
+ Raw New Line: New Line Glyph
+ scope
+ glyph.new-line
+ settings
+
+ foreground
+ #3c383626
+
+
+
+ name
+ PlainTasks: Header
+ scope
+ keyword.control.header.todo
+ settings
+
+ foreground
+ #79740e
+ background
+ #fefdf6
+
+
+
+ name
+ PlainTasks: Notes
+ scope
+ notes.todo
+ settings
+
+ foreground
+ #665c54
+
+
+
+ name
+ PlainTasks: Punctuation
+ scope
+ text.todo punctuation.definition.bold, text.todo punctuation.definition.italic
+ settings
+
+ foreground
+ #a89984
+
+
+
+ name
+ PlainTasks: Task Pending
+ scope
+ meta.item.todo.pending
+ settings
+
+ foreground
+ #1d2021
+
+
+
+ name
+ PlainTasks: Task Pending Punctuation
+ scope
+ punctuation.definition.bullet.pending.todo
+ settings
+
+ foreground
+ #928374
+
+
+
+ name
+ PlainTasks: Task Completed Punctuation
+ scope
+ punctuation.definition.bullet.completed.todo
+ settings
+
+ foreground
+ #427b58
+
+
+
+ name
+ PlainTasks: Task Cancelled Punctuation
+ scope
+ punctuation.definition.bullet.cancelled.todo
+ settings
+
+ foreground
+ #9d0006
+
+
+
+ name
+ PlainTasks: Tag Critical
+ scope
+ string.other.tag.todo.critical
+ settings
+
+ foreground
+ #9d0006
+ fontStyle
+ bold
+
+
+
+ name
+ PlainTasks: Tag High
+ scope
+ string.other.tag.todo.high
+ settings
+
+ foreground
+ #af3a03
+ fontStyle
+ bold
+
+
+
+ name
+ PlainTasks: Tag Low
+ scope
+ string.other.tag.todo.low
+ settings
+
+ foreground
+ #076678
+ fontStyle
+ bold
+
+
+
+ name
+ PlainTasks: Tag Today
+ scope
+ string.other.tag.todo.today
+ settings
+
+ foreground
+ #b57614
+ fontStyle
+ bold
+
+
+
+ name
+ PlainTasks: Tag
+ scope
+ meta.tag.todo
+ settings
+
+ foreground
+ #8f3f71
+
+
+
+ name
+ PlainTasks: URL
+ scope
+ punctuation.definition.url, todo.url
+ settings
+
+ foreground
+ #076678
+
+
+
+ name
+ PlainTasks: Separator
+ scope
+ meta.punctuation.archive.todo, meta.punctuation.separator.todo
+ settings
+
+ fontStyle
+ italic
+ foreground
+ #928374
+
+
+
+
+
\ No newline at end of file
From 7531cc13ecfe4c25ba7d1efffa7c998bf8177d87 Mon Sep 17 00:00:00 2001
From: James Garbutt <43081j@users.noreply.github.com>
Date: Wed, 30 May 2018 09:26:05 +0100
Subject: [PATCH 0014/1293] re-order caption/value selection
---
lib/ace/autocomplete.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/ace/autocomplete.js b/lib/ace/autocomplete.js
index 3b99f03c409..59077385846 100644
--- a/lib/ace/autocomplete.js
+++ b/lib/ace/autocomplete.js
@@ -479,7 +479,7 @@ var FilteredList = function(array, filterText) {
var upper = needle.toUpperCase();
var lower = needle.toLowerCase();
loop: for (var i = 0, item; item = items[i]; i++) {
- var caption = item.value || item.caption || item.snippet;
+ var caption = item.snippet || item.caption || item.value;
if (!caption) continue;
var lastIndex = -1;
var matchMask = 0;
From 300cb544593d4a2bd22c69e31d687e19843e7afb Mon Sep 17 00:00:00 2001
From: "Lennart C. L. Kats"
Date: Fri, 1 Jun 2018 13:12:23 +0200
Subject: [PATCH 0015/1293] Fix err object causing exception with postMessage
---
lib/ace/worker/worker_client.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/ace/worker/worker_client.js b/lib/ace/worker/worker_client.js
index b3a610bba89..5e667b69fb3 100644
--- a/lib/ace/worker/worker_client.js
+++ b/lib/ace/worker/worker_client.js
@@ -159,6 +159,8 @@ var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl, impor
try {
// firefox refuses to clone objects which have function properties
// TODO: cleanup event
+ if (data.data && data.data.err)
+ data.data.err = {message: data.data.err.message, stack: data.data.err.stack, code: data.data.err.code};
this.$worker.postMessage({event: event, data: {data: data.data}});
}
catch(ex) {
From d005e6823684e81c84da7ed0bd96722c1285079b Mon Sep 17 00:00:00 2001
From: James Garbutt <43081j@users.noreply.github.com>
Date: Tue, 5 Jun 2018 15:15:39 +0100
Subject: [PATCH 0016/1293] lucene: add escaping and stricter keywords
---
lib/ace/mode/_test/text_lucene.txt | 17 +++
lib/ace/mode/_test/tokens_lucene.json | 188 ++++++++++++++++++-------
lib/ace/mode/lucene_highlight_rules.js | 7 +-
3 files changed, 159 insertions(+), 53 deletions(-)
diff --git a/lib/ace/mode/_test/text_lucene.txt b/lib/ace/mode/_test/text_lucene.txt
index 739c3b4d65e..9721e98d6b5 100644
--- a/lib/ace/mode/_test/text_lucene.txt
+++ b/lib/ace/mode/_test/text_lucene.txt
@@ -37,3 +37,20 @@ field:["a b c" TO def]
field:{"a b c" TO def}
field:{foo TO "bar"}
field:{20180101 TO 20190202}
+field:{"2018-01-01" TO "2019-02-02"}
+\+escaped
+\-escaped
+esc\&aped
+esc\|aped
+\!escaped
+\(escaped\)
+\{escaped\}
+\[escaped\]
+escaped\^4
+\"escaped\"
+escaped\~0.4
+escaped\*
+escaped\?
+esc\:aped
+esc\\aped
+esc\ aped:foo
diff --git a/lib/ace/mode/_test/tokens_lucene.json b/lib/ace/mode/_test/tokens_lucene.json
index 08bb1dc1747..3a569c2e43c 100644
--- a/lib/ace/mode/_test/tokens_lucene.json
+++ b/lib/ace/mode/_test/tokens_lucene.json
@@ -1,115 +1,115 @@
[[
"start",
["text"," "],
- ["string.unquoted","foo"]
+ ["term","foo"]
],[
"start",
["keyword","foo:"],
["text"," "],
- ["string.unquoted","foo"],
+ ["term","foo"],
["text"," "],
["keyword.operator","AND"],
["text"," "],
- ["string.unquoted","bar"]
+ ["term","bar"]
],[
"start",
- ["string.unquoted","foo"],
+ ["term","foo"],
["text"," "],
["keyword.operator","AND"],
["text"," "],
- ["string.unquoted","bar"]
+ ["term","bar"]
],[
"start",
- ["string.unquoted","foo"],
+ ["term","foo"],
["text"," "],
["keyword.operator","OR"],
["text"," "],
- ["string.unquoted","bar"]
+ ["term","bar"]
],[
"start",
- ["string.unquoted","foo"],
+ ["term","foo"],
["text"," "],
["keyword.operator","NOT"],
["text"," "],
- ["string.unquoted","bar"]
+ ["term","bar"]
],[
"start",
["string","\"foo bar\""]
],[
"start",
- ["string.unquoted","bar"],
+ ["term","bar"],
["text"," "],
["string","\"foo bar\""]
],[
"start",
- ["string.unquoted","bar"],
+ ["term","bar"],
["text"," "],
["constant.character.negation","-"],
- ["string.unquoted","foo"]
+ ["term","foo"]
],[
"start",
- ["string.unquoted","bar"],
+ ["term","bar"],
["text"," "],
["constant.character.negation","-"],
["string","\"foo bar\""]
],[
"start",
["constant.character.negation","-"],
- ["string.unquoted","foo"]
+ ["term","foo"]
],[
"start",
["constant.character.negation","-"],
["string","\"foo bar\""]
],[
"start",
- ["string.unquoted","bar"],
+ ["term","bar"],
["text"," "],
- ["string.unquoted","foo"],
+ ["term","foo"],
["constant.character.proximity","~100"]
],[
"start",
- ["string.unquoted","foo"],
+ ["term","foo"],
["constant.character.proximity","~100"]
],[
"start",
- ["string.unquoted","foo"],
+ ["term","foo"],
["constant.character.proximity","~100"],
["text"," "],
- ["string.unquoted","bar"]
+ ["term","bar"]
],[
"start",
["string","\"foo bar\""],
["constant.character.proximity","~10"]
],[
"start",
- ["string.unquoted","foo"],
+ ["term","foo"],
["constant.character.proximity","~"]
],[
"start",
- ["string.unquoted","bar"],
+ ["term","bar"],
["text"," "],
- ["string.unquoted","foo"],
+ ["term","foo"],
["constant.character.proximity","~"]
],[
"start",
- ["string.unquoted","foo"],
+ ["term","foo"],
["constant.character.proximity","~"],
["text"," "],
- ["string.unquoted","bar"]
+ ["term","bar"]
],[
"start",
- ["string.unquoted","foo"],
+ ["term","foo"],
["constant.character.proximity","~0.8"]
],[
"start",
["keyword","field:"],
- ["string.unquoted","foo"]
+ ["term","foo"]
],[
"start",
["keyword","field:"],
- ["string.unquoted","foo"],
+ ["term","foo"],
["text"," "],
- ["string.unquoted","bar"]
+ ["term","bar"]
],[
"start",
["keyword","field:"],
@@ -117,17 +117,17 @@
],[
"start",
["paren.lparen","("],
- ["string.unquoted","foo"],
+ ["term","foo"],
["text"," "],
["keyword.operator","AND"],
["text"," "],
- ["string.unquoted","bar"],
+ ["term","bar"],
["paren.rparen",")"]
],[
"start",
["paren.lparen","("],
["keyword","field:"],
- ["string.unquoted","foo"],
+ ["term","foo"],
["text"," "],
["keyword.operator","AND"],
["text"," "],
@@ -136,46 +136,46 @@
["paren.rparen",")"]
],[
"start",
- ["string.unquoted","foo"],
+ ["term","foo"],
["constant.character.asterisk","*"]
],[
"start",
- ["string.unquoted","f"],
+ ["term","f"],
["constant.character.interro","?"],
- ["string.unquoted","o"]
+ ["term","o"]
],[
"start",
- ["string.unquoted","f"],
+ ["term","f"],
["constant.character.asterisk","*"],
- ["string.unquoted","o"]
+ ["term","o"]
],[
"start",
["constant.character.required","+"],
- ["string.unquoted","foo"]
+ ["term","foo"]
],[
"start",
["constant.character.required","+"],
["string","\"foo bar\""]
],[
"start",
- ["string.unquoted","foo"],
+ ["term","foo"],
["constant.character.interro","?"]
],[
"start",
["constant.character.interro","?"],
- ["string.unquoted","oo"]
+ ["term","oo"]
],[
"start",
- ["string.unquoted","foo"]
+ ["term","foo"]
],[
"start",
["keyword","field:"],
["paren.lparen","("],
["constant.character.negation","-"],
- ["string.unquoted","foo"],
+ ["term","foo"],
["text"," "],
["constant.character.required","+"],
- ["string.unquoted","bar"],
+ ["term","bar"],
["text"," "],
["constant.character.required","+"],
["string","\"foo bar\""],
@@ -184,21 +184,21 @@
"start",
["keyword","field:"],
["paren.lparen","{"],
- ["string.unquoted","foo"],
+ ["term","foo"],
["text"," "],
["keyword.operator","TO"],
["text"," "],
- ["string.unquoted","bar"],
+ ["term","bar"],
["paren.rparen","}"]
],[
"start",
["keyword","field:"],
["paren.lparen","["],
- ["string.unquoted","foo"],
+ ["term","foo"],
["text"," "],
["keyword.operator","TO"],
["text"," "],
- ["string.unquoted","bar"],
+ ["term","bar"],
["paren.rparen","]"]
],[
"start",
@@ -208,7 +208,7 @@
["text"," "],
["keyword.operator","TO"],
["text"," "],
- ["string.unquoted","def"],
+ ["term","def"],
["paren.rparen","]"]
],[
"start",
@@ -218,13 +218,13 @@
["text"," "],
["keyword.operator","TO"],
["text"," "],
- ["string.unquoted","def"],
+ ["term","def"],
["paren.rparen","}"]
],[
"start",
["keyword","field:"],
["paren.lparen","{"],
- ["string.unquoted","foo"],
+ ["term","foo"],
["text"," "],
["keyword.operator","TO"],
["text"," "],
@@ -234,12 +234,98 @@
"start",
["keyword","field:"],
["paren.lparen","{"],
- ["string.unquoted","20180101"],
+ ["term","20180101"],
["text"," "],
["keyword.operator","TO"],
["text"," "],
- ["string.unquoted","20190202"],
+ ["term","20190202"],
["paren.rparen","}"]
+],[
+ "start",
+ ["keyword","field:"],
+ ["paren.lparen","{"],
+ ["string","\"2018-01-01\""],
+ ["text"," "],
+ ["keyword.operator","TO"],
+ ["text"," "],
+ ["string","\"2019-02-02\""],
+ ["paren.rparen","}"]
+],[
+ "start",
+ ["constant.language.escape","\\+"],
+ ["term","escaped"]
+],[
+ "start",
+ ["constant.language.escape","\\-"],
+ ["term","escaped"]
+],[
+ "start",
+ ["term","esc"],
+ ["constant.language.escape","\\&"],
+ ["term","aped"]
+],[
+ "start",
+ ["term","esc"],
+ ["constant.language.escape","\\|"],
+ ["term","aped"]
+],[
+ "start",
+ ["constant.language.escape","\\!"],
+ ["term","escaped"]
+],[
+ "start",
+ ["constant.language.escape","\\("],
+ ["term","escaped"],
+ ["constant.language.escape","\\)"]
+],[
+ "start",
+ ["constant.language.escape","\\{"],
+ ["term","escaped"],
+ ["constant.language.escape","\\}"]
+],[
+ "start",
+ ["constant.language.escape","\\["],
+ ["term","escaped"],
+ ["constant.language.escape","\\]"]
+],[
+ "start",
+ ["term","escaped"],
+ ["constant.language.escape","\\^"],
+ ["term","4"]
+],[
+ "start",
+ ["constant.language.escape","\\\""],
+ ["term","escaped"],
+ ["constant.language.escape","\\\""]
+],[
+ "start",
+ ["term","escaped"],
+ ["constant.language.escape","\\~"],
+ ["term","0"],
+ ["text","."],
+ ["term","4"]
+],[
+ "start",
+ ["term","escaped"],
+ ["constant.language.escape","\\*"]
+],[
+ "start",
+ ["term","escaped"],
+ ["constant.language.escape","\\?"]
+],[
+ "start",
+ ["term","esc"],
+ ["constant.language.escape","\\:"],
+ ["term","aped"]
+],[
+ "start",
+ ["term","esc"],
+ ["constant.language.escape","\\\\"],
+ ["term","aped"]
+],[
+ "start",
+ ["keyword","esc\\ aped:"],
+ ["term","foo"]
],[
"start"
]]
\ No newline at end of file
diff --git a/lib/ace/mode/lucene_highlight_rules.js b/lib/ace/mode/lucene_highlight_rules.js
index 59b134ddebf..600706f6237 100644
--- a/lib/ace/mode/lucene_highlight_rules.js
+++ b/lib/ace/mode/lucene_highlight_rules.js
@@ -9,6 +9,9 @@ var LuceneHighlightRules = function() {
this.$rules = {
"start" : [
{
+ token: "constant.language.escape",
+ regex: /\\[\+\-&\|!\(\)\{\}\[\]^"~\*\?:\\]/
+ }, {
token: "constant.character.negation",
regex: "\\-"
}, {
@@ -34,12 +37,12 @@ var LuceneHighlightRules = function() {
regex: "[\\)\\}\\]]"
}, {
token: "keyword",
- regex: "\\S+:"
+ regex: "(?:[^\\s:]+|\\\\ )*[^\\\\]:"
}, {
token: "string", // " string
regex: '"[^"]*"'
}, {
- token: "string.unquoted",
+ token: "term",
regex: "\\w+"
}, {
token: "text",
From f0bb9ac8b69f0d7cbafd88f4cbfc9d05fb26fe01 Mon Sep 17 00:00:00 2001
From: James Garbutt <43081j@users.noreply.github.com>
Date: Tue, 5 Jun 2018 15:21:10 +0100
Subject: [PATCH 0017/1293] lucene: handle escaped quotes
---
lib/ace/mode/_test/text_lucene.txt | 1 +
lib/ace/mode/_test/tokens_lucene.json | 3 +++
lib/ace/mode/lucene_highlight_rules.js | 2 +-
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/ace/mode/_test/text_lucene.txt b/lib/ace/mode/_test/text_lucene.txt
index 9721e98d6b5..66669423109 100644
--- a/lib/ace/mode/_test/text_lucene.txt
+++ b/lib/ace/mode/_test/text_lucene.txt
@@ -54,3 +54,4 @@ escaped\?
esc\:aped
esc\\aped
esc\ aped:foo
+"foo\"bar"
diff --git a/lib/ace/mode/_test/tokens_lucene.json b/lib/ace/mode/_test/tokens_lucene.json
index 3a569c2e43c..abc9ce52661 100644
--- a/lib/ace/mode/_test/tokens_lucene.json
+++ b/lib/ace/mode/_test/tokens_lucene.json
@@ -326,6 +326,9 @@
"start",
["keyword","esc\\ aped:"],
["term","foo"]
+],[
+ "start",
+ ["string","\"foo\\\"bar\""]
],[
"start"
]]
\ No newline at end of file
diff --git a/lib/ace/mode/lucene_highlight_rules.js b/lib/ace/mode/lucene_highlight_rules.js
index 600706f6237..606b305d831 100644
--- a/lib/ace/mode/lucene_highlight_rules.js
+++ b/lib/ace/mode/lucene_highlight_rules.js
@@ -40,7 +40,7 @@ var LuceneHighlightRules = function() {
regex: "(?:[^\\s:]+|\\\\ )*[^\\\\]:"
}, {
token: "string", // " string
- regex: '"[^"]*"'
+ regex: '"(?:\\\\"|[^"])*"'
}, {
token: "term",
regex: "\\w+"
From 00bdafeba644bd4909e7688c04fb9c0a2b446dff Mon Sep 17 00:00:00 2001
From: Henri Yandell
Date: Thu, 21 Jun 2018 11:56:15 -0700
Subject: [PATCH 0018/1293] Adding standard files
---
CODE_OF_CONDUCT.md | 4 ++++
1 file changed, 4 insertions(+)
create mode 100644 CODE_OF_CONDUCT.md
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 00000000000..3b64466870c
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,4 @@
+## Code of Conduct
+This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
+For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
+opensource-codeofconduct@amazon.com with any additional questions or comments.
From aee2fda5231493677a0ed11f1055c638fc4d0d30 Mon Sep 17 00:00:00 2001
From: Henri Yandell
Date: Thu, 21 Jun 2018 11:59:27 -0700
Subject: [PATCH 0019/1293] Adding .github as an exception in gitignore
---
.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitignore b/.gitignore
index 0e5c2abaab0..bf0ce1f131c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@
# Project files that should not be in the repo
.*
\#*
+!/.github
!/.gitignore
.*.gz
*.tmTheme.js
From a6b3de2175824758fef25b389bb65c9dd013acc1 Mon Sep 17 00:00:00 2001
From: Henri Yandell
Date: Thu, 21 Jun 2018 11:59:40 -0700
Subject: [PATCH 0020/1293] Adding standard PR template
---
.github/PULL_REQUEST_TEMPLATE.md | 6 ++++++
1 file changed, 6 insertions(+)
create mode 100644 .github/PULL_REQUEST_TEMPLATE.md
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 00000000000..6bdaa999fc4
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,6 @@
+*Issue #, if available:*
+
+*Description of changes:*
+
+
+By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
From 87ff0b3eb722f76d8aead47ab97fe64061a86aee Mon Sep 17 00:00:00 2001
From: nightwing
Date: Sat, 16 Jun 2018 00:00:53 +0400
Subject: [PATCH 0021/1293] fix styling of dialog in vim mode
---
lib/ace/keyboard/vim.js | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/lib/ace/keyboard/vim.js b/lib/ace/keyboard/vim.js
index 3ecf0d9fff5..fe2a932ee0e 100644
--- a/lib/ace/keyboard/vim.js
+++ b/lib/ace/keyboard/vim.js
@@ -192,6 +192,8 @@ define(function(require, exports, module) {
this.curOp.force = force;
var result = fn();
if (this.ace.curOp && this.ace.curOp.command.name == "vim") {
+ if (this.state.dialog)
+ this.ace.curOp.command.scrollIntoView = false;
this.ace.endOperation();
if (!curOp.cursorActivity && !curOp.lastChange && prevOp)
this.ace.prevOp = prevOp;
@@ -715,18 +717,18 @@ dom.importCssString(".normal-mode .ace_cursor{\
.ace_dialog {\
position: absolute;\
left: 0; right: 0;\
- background: white;\
+ background: inherit;\
z-index: 15;\
padding: .1em .8em;\
overflow: hidden;\
- color: #333;\
+ color: inherit;\
}\
.ace_dialog-top {\
- border-bottom: 1px solid #eee;\
+ border-bottom: 1px solid #444;\
top: 0;\
}\
.ace_dialog-bottom {\
- border-top: 1px solid #eee;\
+ border-top: 1px solid #444;\
bottom: 0;\
}\
.ace_dialog input {\
@@ -769,11 +771,19 @@ dom.importCssString(".normal-mode .ace_cursor{\
var dialog = dialogDiv(this, template, options.bottom);
var closed = false, me = this;
+ this.state.dialog = dialog;
function close(newVal) {
if (typeof newVal == 'string') {
inp.value = newVal;
} else {
if (closed) return;
+
+ if (newVal && newVal.type == "blur") {
+ if (document.activeElement === inp)
+ return;
+ }
+
+ me.state.dialog = null;
closed = true;
dialog.parentNode.removeChild(dialog);
me.focus();
From ff450e04a7b5f229438a54e53b0cb2fc98821dc5 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Sat, 16 Jun 2018 00:01:23 +0400
Subject: [PATCH 0022/1293] fix gutter
---
lib/ace/layer/gutter.js | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/lib/ace/layer/gutter.js b/lib/ace/layer/gutter.js
index 4d11eb30888..b3ca6138a66 100644
--- a/lib/ace/layer/gutter.js
+++ b/lib/ace/layer/gutter.js
@@ -139,8 +139,6 @@ var Gutter = function(parentEl) {
var index = -1;
var row = firstRow;
- var cells = Array.prototype.slice.call(this.element.childNodes, 0);
-
while (true) {
if (row > foldStart) {
row = fold.end.row + 1;
@@ -155,7 +153,9 @@ var Gutter = function(parentEl) {
}
cell = this.$lines.get(++index);
- if (!cell) {
+ if (cell) {
+ cell.row = row;
+ } else {
cell = this.$lines.createCell(row, config, this.session, onCreateCell);
this.$lines.push(cell);
}
@@ -164,6 +164,7 @@ var Gutter = function(parentEl) {
row++;
}
+ this._signal("afterRender");
this.$updateGutterWidth(config);
};
@@ -271,6 +272,7 @@ var Gutter = function(parentEl) {
this.updateLineHighlight();
+ this._signal("afterRender");
this.$updateGutterWidth(config);
};
@@ -308,7 +310,6 @@ var Gutter = function(parentEl) {
var firstLineNumber = session.$firstLineNumber;
- var session = this.session;
var breakpoints = session.$breakpoints;
var decorations = session.$decorations;
var gutterRenderer = session.gutterRenderer || this.$renderer;
@@ -417,8 +418,10 @@ var Gutter = function(parentEl) {
return {left: 0, right: 0};
var style = dom.computedStyle(this.element.firstChild);
this.$padding = {};
- this.$padding.left = parseInt(style.paddingLeft) + 1 || 0;
- this.$padding.right = parseInt(style.paddingRight) || 0;
+ this.$padding.left = (parseInt(style.borderLeftWidth) || 0)
+ + (parseInt(style.paddingLeft) || 0) + 1;
+ this.$padding.right = (parseInt(style.borderRightWidth) || 0)
+ + (parseInt(style.paddingRight) || 0);
return this.$padding;
};
From 965f49e3d1cb9eab29a615289dfc4d782f516db9 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Sat, 16 Jun 2018 00:03:47 +0400
Subject: [PATCH 0023/1293] add support for margin
---
lib/ace/virtual_renderer.js | 37 +++++++++++++++++++++++++++++++------
1 file changed, 31 insertions(+), 6 deletions(-)
diff --git a/lib/ace/virtual_renderer.js b/lib/ace/virtual_renderer.js
index 7231a8d5da3..e307c8527b4 100644
--- a/lib/ace/virtual_renderer.js
+++ b/lib/ace/virtual_renderer.js
@@ -160,6 +160,15 @@ var VirtualRenderer = function(container, theme) {
v: 0,
h: 0
};
+
+ this.margin = {
+ left: 0,
+ right: 0,
+ top: 0,
+ bottom: 0,
+ v: 0,
+ h: 0
+ };
this.$loop = new RenderLoop(
this.$renderChanges.bind(this),
@@ -407,8 +416,9 @@ var VirtualRenderer = function(container, theme) {
this.gutterWidth = gutterWidth;
dom.setStyle(this.scrollBarH.element.style, "left", gutterWidth + "px");
- dom.setStyle(this.scroller.style, "left", gutterWidth + "px");
- size.scrollerWidth = Math.max(0, width - gutterWidth - this.scrollBarV.getWidth());
+ dom.setStyle(this.scroller.style, "left", gutterWidth + this.margin.left + "px");
+ size.scrollerWidth = Math.max(0, width - gutterWidth - this.scrollBarV.getWidth() - this.margin.h);
+ dom.setStyle(this.$gutter.style, "left", this.margin.left + "px");
var right = this.scrollBarV.getWidth() + "px";
dom.setStyle(this.scrollBarH.element.style, "right", right);
@@ -640,7 +650,7 @@ var VirtualRenderer = function(container, theme) {
if (posLeft > this.$size.scrollerWidth - w)
posLeft = this.$size.scrollerWidth - w;
- posLeft += this.gutterWidth;
+ posLeft += this.gutterWidth + this.margin.left;
dom.setStyle(style, "height", h + "px");
dom.setStyle(style, "width", w + "px");
dom.translate(this.textarea, Math.min(posLeft, this.$size.scrollerWidth - w), Math.min(posTop, this.$size.height - h));
@@ -715,6 +725,18 @@ var VirtualRenderer = function(container, theme) {
this.session.setScrollTop(-sm.top);
this.updateFull();
};
+
+ this.setMargin = function(top, bottom, left, right) {
+ var sm = this.margin;
+ sm.top = top|0;
+ sm.bottom = bottom|0;
+ sm.right = right|0;
+ sm.left = left|0;
+ sm.v = sm.top + sm.bottom;
+ sm.h = sm.left + sm.right;
+ this.$updateCachedSize(true, this.gutterWidth, this.$size.width, this.$size.height);
+ this.updateFull();
+ };
/**
* Returns whether the horizontal scrollbar is set to be always visible.
@@ -1416,7 +1438,7 @@ var VirtualRenderer = function(container, theme) {
if (this.$hasCssTransforms) {
canvasPos = {top:0, left: 0};
var p = this.$fontMetrics.transformCoordinates([x, y]);
- x = p[1] - this.gutterWidth;
+ x = p[1] - this.gutterWidth - this.margin.left;
y = p[0];
} else {
canvasPos = this.scroller.getBoundingClientRect();
@@ -1435,7 +1457,7 @@ var VirtualRenderer = function(container, theme) {
if (this.$hasCssTransforms) {
canvasPos = {top:0, left: 0};
var p = this.$fontMetrics.transformCoordinates([x, y]);
- x = p[1] - this.gutterWidth;
+ x = p[1] - this.gutterWidth - this.margin.left;
y = p[0];
} else {
canvasPos = this.scroller.getBoundingClientRect();
@@ -1687,7 +1709,10 @@ config.defineOptions(VirtualRenderer.prototype, "renderer", {
initialValue: false
},
showFoldWidgets: {
- set: function(show) {this.$gutterLayer.setShowFoldWidgets(show);},
+ set: function(show) {
+ this.$gutterLayer.setShowFoldWidgets(show);
+ this.$loop.schedule(this.CHANGE_GUTTER);
+ },
initialValue: true
},
displayIndentGuides: {
From 4dcb9d40ff05a0ef62998c3c28f89605be1c9a95 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Tue, 15 May 2018 17:43:41 +0400
Subject: [PATCH 0024/1293] add basic support for toggle word
---
lib/ace/editor.js | 78 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 78 insertions(+)
diff --git a/lib/ace/editor.js b/lib/ace/editor.js
index e7fec475eb8..971ebabe56b 100644
--- a/lib/ace/editor.js
+++ b/lib/ace/editor.js
@@ -1656,6 +1656,84 @@ Editor.$uid = 0;
this.moveCursorTo(row, Math.max(nr.start +1, column + nnr.length - nr.value.length));
}
+ } else {
+ this.toggleWord();
+ }
+ };
+
+ this.$toggleWordPairs = [
+ ["first", "last"],
+ ["true", "false"],
+ ["yes", "no"],
+ ["width", "height"],
+ ["top", "bottom"],
+ ["right", "left"],
+ ["on", "off"],
+ ["x", "y"],
+ ["get", "set"],
+ ["max", "min"],
+ ["horizontal", "vertical"],
+ ["show", "hide"],
+ ["add", "remove"],
+ ["up", "down"],
+ ["before", "after"],
+ ["even", "odd"],
+ ["inside", "outside"],
+ ["next", "previous"],
+ ["increase", "decrease"],
+ ["attach", "detach"],
+ ["&&", "||"],
+ ["==", "!="]
+ ];
+
+ this.toggleWord = function () {
+ var row = this.selection.getCursor().row;
+ var column = this.selection.getCursor().column;
+ this.selection.selectWord();
+ var currentState = this.getSelectedText();
+ var currWordStart = this.selection.getWordRange().start.column;
+ var wordParts = currentState.replace(/([a-z]+|[A-Z]+)(?=[A-Z_]|$)/g, '$1 ').split(/\s/);
+ var delta = column - currWordStart - 1;
+ if (delta < 0) delta = 0;
+ var curLength = 0, itLength = 0;
+ var that = this;
+ if (currentState.match(/[A-Za-z0-9_]+/)) {
+ wordParts.forEach(function (item, i) {
+ itLength = curLength + item.length;
+ if (delta >= curLength && delta <= itLength) {
+ currentState = item;
+ that.selection.clearSelection();
+ that.moveCursorTo(row, curLength + currWordStart);
+ that.selection.selectTo(row, itLength + currWordStart);
+ }
+ curLength = itLength;
+ });
+ }
+
+ var wordPairs = this.$toggleWordPairs;
+ var reg;
+ for (var i = 0; i < wordPairs.length; i++) {
+ var item = wordPairs[i];
+ for (var j = 0; j <= 1; j++) {
+ var negate = +!j;
+ var firstCondition = currentState.match(new RegExp('^\\s?_?(' + lang.escapeRegExp(item[j]) + ')\\s?$', 'i'));
+ if (firstCondition) {
+ var secondCondition = currentState.match(new RegExp('([_]|^|\\s)(' + lang.escapeRegExp(firstCondition[1]) + ')($|\\s)', 'g'));
+ if (secondCondition) {
+ reg = currentState.replace(new RegExp(lang.escapeRegExp(item[j]), 'i'), function (result) {
+ var res = item[negate];
+ if (result.toUpperCase() == result) {
+ res = res.toUpperCase();
+ } else if (result.charAt(0).toUpperCase() == result.charAt(0)) {
+ res = res.substr(0, 0) + item[negate].charAt(0).toUpperCase() + res.substr(1);
+ }
+ return res;
+ });
+ this.insert(reg);
+ reg = "";
+ }
+ }
+ }
}
};
From 6e989d6b2b6d97a6c056f38342c76649dea1c5b4 Mon Sep 17 00:00:00 2001
From: 43081j <43081j@users.noreply.github.com>
Date: Tue, 26 Jun 2018 11:05:52 +0100
Subject: [PATCH 0025/1293] fall back to matching on snippets last
---
lib/ace/autocomplete.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/ace/autocomplete.js b/lib/ace/autocomplete.js
index 59077385846..bed4cbb10cb 100644
--- a/lib/ace/autocomplete.js
+++ b/lib/ace/autocomplete.js
@@ -479,7 +479,7 @@ var FilteredList = function(array, filterText) {
var upper = needle.toUpperCase();
var lower = needle.toLowerCase();
loop: for (var i = 0, item; item = items[i]; i++) {
- var caption = item.snippet || item.caption || item.value;
+ var caption = item.caption || item.value || item.snippet;
if (!caption) continue;
var lastIndex = -1;
var matchMask = 0;
From e483456da9398939219dd8f6763380c1657e5ce9 Mon Sep 17 00:00:00 2001
From: 43081j <43081j@users.noreply.github.com>
Date: Thu, 28 Jun 2018 10:51:19 +0100
Subject: [PATCH 0026/1293] separate TS module declarations
Fixes ajaxorg/ace-builds#133.
---
Makefile.dryice.js | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/Makefile.dryice.js b/Makefile.dryice.js
index 2556766137e..6f49b607320 100755
--- a/Makefile.dryice.js
+++ b/Makefile.dryice.js
@@ -112,9 +112,9 @@ function ace() {
}
function buildTypes() {
- copy.file(ACE_HOME + "/ace.d.ts", BUILD_DIR + "/ace.d.ts");
-
+ var definitions = fs.readFileSync(ACE_HOME + '/ace.d.ts', 'utf8');
var paths = fs.readdirSync(BUILD_DIR + '/src-noconflict');
+ var moduleRef = '/// ';
var pathModules = paths.map(function(path) {
if (/^(mode|theme|ext|keybinding)-/.test(path)) {
@@ -124,7 +124,8 @@ function buildTypes() {
}).filter(Boolean).join('\n')
+ "\ndeclare module 'ace-builds/webpack-resolver';\n";
- fs.appendFileSync(BUILD_DIR + '/ace.d.ts', '\n' + pathModules);
+ fs.writeFileSync(BUILD_DIR + '/ace.d.ts', moduleRef + '\n' + definitions);
+ fs.writeFileSync(BUILD_DIR + '/ace-modules.d.ts', pathModules);
var loader = paths.map(function(path) {
if (/\.js$/.test(path) && !/^ace\.js$/.test(path)) {
From 90fb9977a31c81b7756da4a3c24950388d23b78c Mon Sep 17 00:00:00 2001
From: nightwing
Date: Sun, 15 Jul 2018 17:32:02 +0400
Subject: [PATCH 0027/1293] fix deletion of autoinserted backquote in
javascript mode
---
lib/ace/mode/behaviour/behaviour_test.js | 7 +++++++
lib/ace/mode/behaviour/cstyle.js | 4 +++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/lib/ace/mode/behaviour/behaviour_test.js b/lib/ace/mode/behaviour/behaviour_test.js
index 500f3971d41..6c8580f7818 100644
--- a/lib/ace/mode/behaviour/behaviour_test.js
+++ b/lib/ace/mode/behaviour/behaviour_test.js
@@ -158,6 +158,13 @@ module.exports = {
exec("insertstring", 1, '"');
assert.equal(editor.getValue(), '"\\n"');
+ editor.setValue("");
+ exec("insertstring", 1, '`');
+ assert.equal(editor.getValue(), '``');
+ exec("insertstring", 1, 'n');
+ assert.equal(editor.getValue(), '`n`');
+ exec("backspace", 2);
+ assert.equal(editor.getValue(), '');
},
"test: xml": function() {
editor = new Editor(new MockRenderer());
diff --git a/lib/ace/mode/behaviour/cstyle.js b/lib/ace/mode/behaviour/cstyle.js
index 317c52c656f..af2d937eeea 100644
--- a/lib/ace/mode/behaviour/cstyle.js
+++ b/lib/ace/mode/behaviour/cstyle.js
@@ -307,8 +307,10 @@ var CstyleBehaviour = function(options) {
});
this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
+ var quotes = session.$mode.$quotes || defaultQuotes;
+
var selected = session.doc.getTextRange(range);
- if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
+ if (!range.isMultiLine() && quotes.hasOwnProperty(selected)) {
initContext(editor);
var line = session.doc.getLine(range.start.row);
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
From fc4746b8f222cf33bd396d56509c4118cb152cd4 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Sun, 15 Jul 2018 18:08:35 +0400
Subject: [PATCH 0028/1293] fix #3699: tsx highlighting issues
---
lib/ace/mode/javascript_highlight_rules.js | 3 +-
lib/ace/mode/typescript_highlight_rules.js | 45 ++++++++--------------
2 files changed, 17 insertions(+), 31 deletions(-)
diff --git a/lib/ace/mode/javascript_highlight_rules.js b/lib/ace/mode/javascript_highlight_rules.js
index a26af6e9f3b..7f766d23706 100644
--- a/lib/ace/mode/javascript_highlight_rules.js
+++ b/lib/ace/mode/javascript_highlight_rules.js
@@ -177,7 +177,8 @@ var JavaScriptHighlightRules = function(options) {
next : "property"
}, {
token : "storage.type",
- regex : /=>/
+ regex : /=>/,
+ next : "start"
}, {
token : "keyword.operator",
regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
diff --git a/lib/ace/mode/typescript_highlight_rules.js b/lib/ace/mode/typescript_highlight_rules.js
index 82c9fb4e9d6..0eb82458aaa 100644
--- a/lib/ace/mode/typescript_highlight_rules.js
+++ b/lib/ace/mode/typescript_highlight_rules.js
@@ -39,56 +39,41 @@
THIS FILE WAS AUTOGENERATED BY mode_highlight_rules.tmpl.js (UUID: 21e323af-f665-4161-96e7-5087d262557e) */
-define(function(require, exports, module) {
+define(function (require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
-var TypeScriptHighlightRules = function(options) {
+var TypeScriptHighlightRules = function (options) {
- var tsRules = [
- // Match stuff like: module name {...}
+ var tsRules = [
+ // Match stuff like: function name: return type)
{
- token: ["keyword.operator.ts", "text", "variable.parameter.function.ts", "text"],
- regex: "\\b(module)(\\s*)([a-zA-Z0-9_?.$][\\w?.$]*)(\\s*\\{)"
- },
- // Match stuff like: super(argument, list)
- {
- token: ["storage.type.variable.ts", "text", "keyword.other.ts", "text"],
- regex: "(super)(\\s*\\()([a-zA-Z0-9,_?.$\\s]+\\s*)(\\))"
+ token: ["storage.type", "text", "entity.name.function.ts"],
+ regex: "(function)(\\s+)([a-zA-Z0-9\$_\u00a1-\uffff][a-zA-Z0-9\d\$_\u00a1-\uffff]*)",
},
- // Match stuff like: function() {...}
{
- token: ["entity.name.function.ts","paren.lparen", "paren.rparen"],
- regex: "([a-zA-Z_?.$][\\w?.$]*)(\\()(\\))"
+ token: "keyword",
+ regex: "(?:\\b(constructor|declare|interface|as|AS|public|private|extends|export|super|readonly|module|namespace|abstract|implements)\\b)"
},
- // Match stuff like: (function: return type)
{
- token: ["variable.parameter.function.ts", "text", "variable.parameter.function.ts"],
- regex: "([a-zA-Z0-9_?.$][\\w?.$]*)(\\s*:\\s*)([a-zA-Z0-9_?.$][\\w?.$]*)"
- },
+ token: ["keyword", "storage.type.variable.ts"],
+ regex: "(class|type)(\\s+[a-zA-Z0-9_?.$][\\w?.$]*)",
+ },
{
- token: ["keyword.operator.ts"],
- regex: "(?:\\b(constructor|declare|interface|as|AS|public|private|class|extends|export|super)\\b)"
+ token: "keyword",
+ regex: "\\b(?:super|export|import|keyof|infer)\\b"
},
{
token: ["storage.type.variable.ts"],
- regex: "(?:\\b(this\\.|string\\b|bool\\b|number)\\b)"
- },
- {
- token: ["keyword.operator.ts", "storage.type.variable.ts", "keyword.operator.ts", "storage.type.variable.ts"],
- regex: "(class)(\\s+[a-zA-Z0-9_?.$][\\w?.$]*\\s+)(extends)(\\s+[a-zA-Z0-9_?.$][\\w?.$]*\\s+)?"
- },
- {
- token: "keyword",
- regex: "(?:super|export|class|extends|import)\\b"
+ regex: "(?:\\b(this\\.|string\\b|bool\\b|boolean\\b|number\\b|true\\b|false\\b|undefined\\b|any\\b|null\\b|(?:unique )?symbol\\b|object\\b|never\\b|enum\\b))"
}
];
var JSRules = new JavaScriptHighlightRules({jsx: (options && options.jsx) == true}).getRules();
- JSRules.start = tsRules.concat(JSRules.start);
+ JSRules.no_regex = tsRules.concat(JSRules.no_regex);
this.$rules = JSRules;
};
From 8e33ff510b535f85fd1d9786726ec0a4da9a1e47 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Mon, 16 Jul 2018 00:42:23 +0400
Subject: [PATCH 0029/1293] add documentation about basePath
---
index.html | 9 +++++++++
lib/ace/config.js | 17 +++++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/index.html b/index.html
index 145b727b3f4..6c6741bffee 100644
--- a/index.html
+++ b/index.html
@@ -348,6 +348,15 @@ Adding New Commands and Keybindings
},
readOnly: true // false if this command should not apply in readOnly mode
});
+ Configure dynamic loading of modes and themes
+ By default ace detcts the url for dynamic loading by finding the script node for ace.js.
+ This doesn't work if ace.js is not loaded with a separate script tag, and in this case it is required to set url explicitely
+ ace.config.set("basePath", "https://url.to.a/folder/that/contains-ace-modes");
+ Path for one module alone can be configured with:
+ ace.config.setModuleUrl("ace/theme/textmate", "url for textmate.js");
+ When using ace with webpack, it is possible to configure paths for all submodules using
+ require("ace-builds/webpack-resolver");
+ which depends on file-loader
Creating a Syntax Highlighter for Ace
diff --git a/lib/ace/config.js b/lib/ace/config.js
index 53ce5dce824..2bbc34df3fe 100644
--- a/lib/ace/config.js
+++ b/lib/ace/config.js
@@ -141,7 +141,24 @@ exports.loadModule = function(moduleName, onLoad) {
if (!exports.get("packaged"))
return afterLoad();
+
net.loadScript(exports.moduleUrl(moduleName, moduleType), afterLoad);
+ reportErrorIfPathIsNotConfigured();
+};
+
+var reportErrorIfPathIsNotConfigured = function() {
+ if (
+ !options.basePath && !options.workerPath
+ && !options.modePath && !options.themePath
+ && !Object.keys(options.$moduleUrls).length
+ ) {
+ console.error(
+ "Unable to infer path to ace from script src,",
+ "use ace.config.set('basePath', 'path') to enable dynamic loading of modes and themes",
+ "or with webpack use ace/webpack-resolver"
+ );
+ reportErrorIfPathIsNotConfigured = function() {};
+ }
};
// initialization
From 1e8e5486537a9f860b447fce514171338b9b4c01 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Tue, 17 Jul 2018 00:20:27 +0400
Subject: [PATCH 0030/1293] fix static-highlight extension
---
demo/static-highlighter/server.js | 2 +
lib/ace/ext/static_highlight.js | 109 ++++++++++++---------------
lib/ace/ext/static_highlight_test.js | 17 +++--
3 files changed, 60 insertions(+), 68 deletions(-)
diff --git a/demo/static-highlighter/server.js b/demo/static-highlighter/server.js
index ea8361d4062..80301d9a809 100644
--- a/demo/static-highlighter/server.js
+++ b/demo/static-highlighter/server.js
@@ -27,7 +27,9 @@ http.createServer(function(req, res) {
res.writeHead(200, {"Content-Type": "text/html; charset=utf-8"});
fs.readFile(path, "utf8", function(err, data) {
if (err) data = err.message;
+ var t = Date.now();
var highlighted = highlighter.render(data, new JavaScriptMode(), theme);
+ console.log("Rendered " + (data.length/1000) + "kb in " + (Date.now() - t) + "ms");
res.end(
'\n' +
'
+snippet sub
+ ${1}
+snippet summary
+
+ ${1}
+
+snippet sup
+ ${1}
+snippet table
+
+snippet table.
+
+snippet table#
+
+snippet tbody
+
+ ${1}
+
+snippet td
+ ${1}
+snippet td.
+ ${2}
+snippet td#
+ ${2}
+snippet td+
+ ${1}
+ td+${2}
+snippet textarea
+ ${6}
+snippet tfoot
+
+ ${1}
+
+snippet th
+ ${1}
+snippet th.
+ ${2}
+snippet th#
+ ${2}
+snippet th+
+ ${1}
+ th+${2}
+snippet thead
+
+ ${1}
+
+snippet time
+
+ ${2}
+
+snippet ul#
+
+snippet ul+
+
+snippet var
+ ${1}
+snippet video
+
Date: Mon, 24 Sep 2018 01:02:35 +0800
Subject: [PATCH 0080/1293] fix liquid tokens test
---
lib/ace/mode/_test/tokens_liquid.json | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/ace/mode/_test/tokens_liquid.json b/lib/ace/mode/_test/tokens_liquid.json
index 30d003cb6aa..f745a156aa4 100644
--- a/lib/ace/mode/_test/tokens_liquid.json
+++ b/lib/ace/mode/_test/tokens_liquid.json
@@ -53,7 +53,7 @@
["text.xml"," "],
["variable","{%"],
["text"," "],
- ["keyword","for"],
+ ["keyword.block","for"],
["text"," "],
["identifier","product"],
["text"," "],
@@ -257,7 +257,7 @@
["text.xml"," "],
["variable","{%"],
["text"," "],
- ["keyword","if"],
+ ["keyword.block","if"],
["text"," "],
["identifier","user"],
["text","."],
@@ -318,7 +318,7 @@
["text.xml"," "],
["variable","{%"],
["text"," "],
- ["keyword","case"],
+ ["keyword.block","case"],
["text"," "],
["identifier","template"],
["text"," "],
@@ -418,7 +418,7 @@
["text.xml"," "],
["variable","{%"],
["text"," "],
- ["keyword","for"],
+ ["keyword.block","for"],
["text"," "],
["identifier","item"],
["text"," "],
@@ -472,7 +472,7 @@
["text.xml"," "],
["variable","{%"],
["text"," "],
- ["keyword","tablerow"],
+ ["keyword.block","tablerow"],
["text"," "],
["identifier","item"],
["text"," "],
@@ -490,7 +490,7 @@
["text.xml"," "],
["variable","{%"],
["text"," "],
- ["keyword","if"],
+ ["keyword.block","if"],
["text"," "],
["variable.language","tablerowloop"],
["text","."],
From bad3d26558e42186502f46a619bc3453a152ce71 Mon Sep 17 00:00:00 2001
From: Mouhannad
Date: Mon, 24 Sep 2018 09:44:54 +0800
Subject: [PATCH 0081/1293] Revert comment style to HTML comments
---
lib/ace/mode/liquid.js | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/lib/ace/mode/liquid.js b/lib/ace/mode/liquid.js
index 5101aa3af33..5284d7f447d 100644
--- a/lib/ace/mode/liquid.js
+++ b/lib/ace/mode/liquid.js
@@ -41,15 +41,14 @@ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutd
var Mode = function() {
this.HighlightRules = LiquidHighlightRules;
this.$outdent = new MatchingBraceOutdent();
- // this.$behaviour = this.$defaultBehaviour;
this.$behaviour = new LiquidBehaviour();
this.$completer = new HtmlCompletions();
};
oop.inherits(Mode, TextMode);
(function() {
-
- this.blockComment = {start: "{% comment %}", end: "{% endcomment %}"};
+ // this.blockComment = {start: "{% comment %}", end: "{% endcomment %}"};
+ this.blockComment = {start: ""};
this.voidElements = new HtmlMode().voidElements;
this.getNextLineIndent = function(state, line, tab) {
From 0c3c34f3bb8b210ce821294c3254320842f13874 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Sun, 30 Sep 2018 00:43:00 +0400
Subject: [PATCH 0082/1293] simplify
---
lib/ace/ext/searchbox.js | 39 +++++++++++++++------------------------
1 file changed, 15 insertions(+), 24 deletions(-)
diff --git a/lib/ace/ext/searchbox.js b/lib/ace/ext/searchbox.js
index f6f5f31135e..16910b68356 100644
--- a/lib/ace/ext/searchbox.js
+++ b/lib/ace/ext/searchbox.js
@@ -72,6 +72,7 @@ var SearchBox = function(editor, range, showReplaceForm) {
this.element = div.firstChild;
this.setSession = this.setSession.bind(this);
+
this.$init();
this.setEditor(editor);
dom.importCssString(searchboxCss, "ace_searchbox", editor.container);
@@ -89,10 +90,6 @@ var SearchBox = function(editor, range, showReplaceForm) {
this.$syncOptions(true);
};
- this.$getReplaceEnabled = function() {
- return !this.editor.getReadOnly();
- };
-
this.$initElements = function(sb) {
this.searchBox = sb.querySelector(".ace_search_form");
this.replaceBox = sb.querySelector(".ace_replace_form");
@@ -167,16 +164,14 @@ var SearchBox = function(editor, range, showReplaceForm) {
this.$searchBarKb = new HashHandler();
this.$searchBarKb.bindKeys({
"Ctrl-f|Command-f": function(sb) {
- if (this.$getReplaceEnabled()) {
- var isReplace = sb.isReplace = !sb.isReplace;
- sb.replaceBox.style.display = isReplace ? "" : "none";
- sb.replaceOption.checked = false;
- }
+ var isReplace = sb.isReplace = !sb.isReplace;
+ sb.replaceBox.style.display = isReplace ? "" : "none";
+ sb.replaceOption.checked = false;
sb.$syncOptions();
sb.searchInput.focus();
},
"Ctrl-H|Command-Option-F": function(sb) {
- if (!this.$getReplaceEnabled())
+ if (sb.editor.getReadOnly())
return;
sb.replaceOption.checked = true;
sb.$syncOptions();
@@ -235,7 +230,7 @@ var SearchBox = function(editor, range, showReplaceForm) {
}, {
name: "toggleReplace",
exec: function(sb) {
- sb.replaceOption.checked = sb.$getReplaceEnabled() && !sb.replaceOption.checked;
+ sb.replaceOption.checked = !sb.replaceOption.checked;
sb.$syncOptions();
}
}, {
@@ -258,18 +253,15 @@ var SearchBox = function(editor, range, showReplaceForm) {
};
this.$syncOptions = function(preventScroll) {
+ dom.setCssClass(this.replaceOption, "checked", this.searchRange);
dom.setCssClass(this.searchOption, "checked", this.searchOption.checked);
+ this.replaceOption.textContent = this.replaceOption.checked ? "-" : "+";
dom.setCssClass(this.regExpOption, "checked", this.regExpOption.checked);
dom.setCssClass(this.wholeWordOption, "checked", this.wholeWordOption.checked);
dom.setCssClass(this.caseSensitiveOption, "checked", this.caseSensitiveOption.checked);
- if (this.$getReplaceEnabled()) {
- dom.setCssClass(this.replaceOption, "checked", this.searchRange);
- this.replaceOption.textContent = this.replaceOption.checked ? "-" : "+";
- } else {
- this.replaceOption.checked = false;
- }
- this.replaceOption.style.display = this.replaceOption.checked ? "" : "none";
- this.replaceBox.style.display = this.replaceOption.checked ? "" : "none";
+ var readOnly = this.editor.getReadOnly();
+ this.replaceOption.style.display = readOnly ? "none" : "";
+ this.replaceBox.style.display = this.replaceOption.checked && !readOnly ? "" : "none";
this.find(false, false, preventScroll);
};
@@ -345,17 +337,17 @@ var SearchBox = function(editor, range, showReplaceForm) {
this.hide();
};
this.replace = function() {
- if (this.$getReplaceEnabled())
+ if (!this.editor.getReadOnly())
this.editor.replace(this.replaceInput.value);
};
this.replaceAndFindNext = function() {
- if (this.$getReplaceEnabled()) {
+ if (!this.editor.getReadOnly()) {
this.editor.replace(this.replaceInput.value);
this.findNext();
}
};
this.replaceAll = function() {
- if (this.$getReplaceEnabled())
+ if (!this.editor.getReadOnly())
this.editor.replaceAll(this.replaceInput.value);
};
@@ -369,11 +361,10 @@ var SearchBox = function(editor, range, showReplaceForm) {
this.editor.focus();
};
this.show = function(value, isReplace) {
- var showReplace = isReplace && this.$getReplaceEnabled();
this.active = true;
this.editor.on("changeSession", this.setSession);
this.element.style.display = "";
- this.replaceOption.checked = showReplace;
+ this.replaceOption.checked = isReplace;
if (value)
this.searchInput.value = value;
From 2c4ec9472fea5ad153ba9b8c39e1be135da11908 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Sun, 30 Sep 2018 16:41:32 +0400
Subject: [PATCH 0083/1293] fix vim visual-block mode
---
lib/ace/keyboard/vim.js | 35 +++++++----------------------------
1 file changed, 7 insertions(+), 28 deletions(-)
diff --git a/lib/ace/keyboard/vim.js b/lib/ace/keyboard/vim.js
index e7fbfa5b9ec..e9d455b4db8 100644
--- a/lib/ace/keyboard/vim.js
+++ b/lib/ace/keyboard/vim.js
@@ -157,7 +157,6 @@ define(function(require, exports, module) {
var curOp = this.curOp = this.curOp || {};
if (!curOp.changeHandlers)
curOp.changeHandlers = this._eventRegistry["change"] && this._eventRegistry["change"].slice();
- if (this.virtualSelectionMode()) return;
if (!curOp.lastChange) {
curOp.lastChange = curOp.change = change;
} else {
@@ -5657,32 +5656,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
var insertModeChangeRegister = vimGlobalState.registerController.getRegister('.');
var isPlaying = macroModeState.isPlaying;
var lastChange = macroModeState.lastInsertModeChanges;
- // In case of visual block, the insertModeChanges are not saved as a
- // single word, so we convert them to a single word
- // so as to update the ". register as expected in real vim.
- var text = [];
if (!isPlaying) {
- var selLength = lastChange.inVisualBlock && vim.lastSelection ?
- vim.lastSelection.visualBlock.height : 1;
- var changes = lastChange.changes;
- var text = [];
- var i = 0;
- // In case of multiple selections in blockwise visual,
- // the inserted text, for example: 'foo', is stored as
- // 'f', 'f', InsertModeKey 'o', 'o', 'o', 'o'. (if you have a block with 2 lines).
- // We push the contents of the changes array as per the following:
- // 1. In case of InsertModeKey, just increment by 1.
- // 2. In case of a character, jump by selLength (2 in the example).
- while (i < changes.length) {
- // This loop will convert 'ffoooo' to 'foo'.
- text.push(changes[i]);
- if (changes[i] instanceof InsertModeKey) {
- i++;
- } else {
- i+= selLength;
- }
- }
- lastChange.changes = text;
cm.off('change', onChange);
CodeMirror.off(cm.getInputField(), 'keydown', onKeyEventTargetKeyDown);
}
@@ -5820,8 +5794,13 @@ dom.importCssString(".normal-mode .ace_cursor{\
if (!macroModeState.isPlaying) {
while(changeObj) {
lastChange.expectCursorActivityForChange = true;
- if (changeObj.origin == '+input' || changeObj.origin == 'paste'
+ if (lastChange.ignoreCount > 1) {
+ lastChange.ignoreCount--;
+ } else if (changeObj.origin == '+input' || changeObj.origin == 'paste'
|| changeObj.origin === undefined /* only in testing */) {
+ var selectionCount = cm.listSelections().length;
+ if (selectionCount > 1)
+ lastChange.ignoreCount = selectionCount;
var text = changeObj.text.join('\n');
if (lastChange.maybeReset) {
lastChange.changes = [];
@@ -6116,7 +6095,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
cm.curOp.cursorActivity = false;
}, true);
}
- if (isHandled)
+ if (isHandled && !vim.visualBlock && !vim.insert)
handleExternalSelection(cm, vim);
return isHandled;
}
From 0940d16115695650eea57daae3b09ecfea2d2fa3 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Sun, 7 Oct 2018 13:01:36 +0400
Subject: [PATCH 0084/1293] fix #3784 Edge autmatically adds two new lines on
first character
---
lib/ace/keyboard/textinput.js | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/ace/keyboard/textinput.js b/lib/ace/keyboard/textinput.js
index 3435fe6b60b..a80b15bdde7 100644
--- a/lib/ace/keyboard/textinput.js
+++ b/lib/ace/keyboard/textinput.js
@@ -198,7 +198,11 @@ var TextInput = function(parentNode, host) {
lastSelectionEnd = text.selectionEnd;
}
// on firefox this throws if textarea is hidden
- if (lastSelectionEnd != selectionEnd || lastSelectionStart != selectionStart) {
+ if (
+ lastSelectionEnd != selectionEnd
+ || lastSelectionStart != selectionStart
+ || text.selectionEnd != lastSelectionEnd // on ie edge selectionEnd changes silently after the initialization
+ ) {
try {
text.setSelectionRange(selectionStart, selectionEnd);
lastSelectionStart = selectionStart;
From 2b1844c4e98bd3beab5cd8f87251e5580e97a4d0 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Sun, 7 Oct 2018 18:08:01 +0400
Subject: [PATCH 0085/1293] fix gutter sizing when line numbers are hidden
---
lib/ace/layer/gutter.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/ace/layer/gutter.js b/lib/ace/layer/gutter.js
index b3ca6138a66..e54fd81a011 100644
--- a/lib/ace/layer/gutter.js
+++ b/lib/ace/layer/gutter.js
@@ -389,7 +389,7 @@ var Gutter = function(parentEl) {
this.$renderer = "";
this.setShowLineNumbers = function(show) {
this.$renderer = !show && {
- getWidth: function() {return "";},
+ getWidth: function() {return 0;},
getText: function() {return "";}
};
};
From 24d5868eee093444dcb1721ff9ccdaf107a39409 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Sun, 7 Oct 2018 18:10:23 +0400
Subject: [PATCH 0086/1293] fix opacity of the cursor in vim mode
---
lib/ace/keyboard/vim.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/ace/keyboard/vim.js b/lib/ace/keyboard/vim.js
index e9d455b4db8..c0d74c299b2 100644
--- a/lib/ace/keyboard/vim.js
+++ b/lib/ace/keyboard/vim.js
@@ -706,12 +706,12 @@ CodeMirror.defineExtension = function(name, fn) {
CodeMirror.prototype[name] = fn;
};
dom.importCssString(".normal-mode .ace_cursor{\
- border: 1px solid red;\
- background-color: red;\
- opacity: 0.5;\
+ border: none;\
+ background-color: rgba(255,0,0,0.5);\
}\
.normal-mode .ace_hidden-cursors .ace_cursor{\
background-color: transparent;\
+ border: 1px solid red;\
}\
.ace_dialog {\
position: absolute;\
From 1f6a8c0905e9253488c8393c60ab4ea116413df0 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Mon, 24 Sep 2018 13:28:35 +0400
Subject: [PATCH 0087/1293] update tests
---
lib/ace/ext/modelist.js | 2 +
lib/ace/mode/_test/tokens_pgsql.json | 12 +-
lib/ace/mode/_test/tokens_python.json | 321 ++++++++++++++++++--
lib/ace/mode/apex.js | 10 +-
lib/ace/mode/apex_highlight_rules.js | 23 +-
lib/ace/mode/visualforce.js | 12 +-
lib/ace/mode/visualforce_highlight_rules.js | 10 +-
7 files changed, 334 insertions(+), 56 deletions(-)
diff --git a/lib/ace/ext/modelist.js b/lib/ace/ext/modelist.js
index b4558ea38a4..0fb21f61ac9 100644
--- a/lib/ace/ext/modelist.js
+++ b/lib/ace/ext/modelist.js
@@ -52,6 +52,7 @@ var supportedModes = {
ASL: ["dsl|asl"],
Assembly_x86:["asm|a"],
AutoHotKey: ["ahk"],
+ Apex: ["apex|cls|trigger|tgr"],
BatchFile: ["bat|cmd"],
Bro: ["bro"],
C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"],
@@ -188,6 +189,7 @@ var supportedModes = {
Velocity: ["vm"],
Verilog: ["v|vh|sv|svh"],
VHDL: ["vhd|vhdl"],
+ Visualforce: ["vfp|component|page"],
Wollok: ["wlk|wpgm|wtest"],
XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"],
XQuery: ["xq"],
diff --git a/lib/ace/mode/_test/tokens_pgsql.json b/lib/ace/mode/_test/tokens_pgsql.json
index fef23fd24b6..3f1c3ee5e03 100644
--- a/lib/ace/mode/_test/tokens_pgsql.json
+++ b/lib/ace/mode/_test/tokens_pgsql.json
@@ -606,12 +606,12 @@
["keyword","if"],
["text"," "],
["identifier","SD"],
- ["text","."],
- ["identifier","has_key"],
+ ["punctuation","."],
+ ["function.support","has_key"],
["paren.lparen","("],
["string","\"plan\""],
["paren.rparen",")"],
- ["text",":"]
+ ["punctuation",":"]
],[
"python-start",
["text"," "],
@@ -627,7 +627,7 @@
"python-start",
["text"," "],
["keyword","else"],
- ["text",":"]
+ ["punctuation",":"]
],[
"python-start",
["text"," "],
@@ -636,8 +636,8 @@
["keyword.operator","="],
["text"," "],
["identifier","plpy"],
- ["text","."],
- ["identifier","prepare"],
+ ["punctuation","."],
+ ["function.support","prepare"],
["paren.lparen","("],
["string","\"SELECT 1\""],
["paren.rparen",")"]
diff --git a/lib/ace/mode/_test/tokens_python.json b/lib/ace/mode/_test/tokens_python.json
index 293c8ff2fc9..e2d11dacc85 100644
--- a/lib/ace/mode/_test/tokens_python.json
+++ b/lib/ace/mode/_test/tokens_python.json
@@ -8,7 +8,8 @@
["keyword","import"],
["text"," "],
["identifier","string"],
- ["text",", "],
+ ["punctuation",","],
+ ["text"," "],
["identifier","sys"]
],[
"start"
@@ -22,12 +23,12 @@
["support.function","len"],
["paren.lparen","("],
["identifier","sys"],
- ["text","."],
- ["identifier","argv"],
+ ["punctuation","."],
+ ["function.support","argv"],
["paren.rparen",")"],
["keyword.operator","=="],
["constant.numeric","1"],
- ["text",":"]
+ ["punctuation",":"]
],[
"qstring3",
["text"," "],
@@ -41,13 +42,17 @@
"start",
["text"," "],
["identifier","sys"],
- ["text","."],
- ["identifier","exit"],
+ ["punctuation","."],
+ ["function.support","exit"],
["paren.lparen","("],
["constant.numeric","0"],
["paren.rparen",")"]
],[
- "start"
+ "start",
+ ["identifier","a"],
+ ["paren.lparen","["],
+ ["string","\"x\""],
+ ["paren.rparen","]"]
],[
"start",
["comment","# Loop over the arguments"]
@@ -60,18 +65,18 @@
["keyword","in"],
["text"," "],
["identifier","sys"],
- ["text","."],
- ["identifier","argv"],
+ ["punctuation","."],
+ ["function.support","argv"],
["paren.lparen","["],
["constant.numeric","1"],
- ["text",":"],
+ ["punctuation",":"],
["paren.rparen","]"],
- ["text",":"]
+ ["punctuation",":"]
],[
"start",
["text"," "],
["keyword","try"],
- ["text",":"]
+ ["punctuation",":"]
],[
"start",
["text"," "],
@@ -80,8 +85,8 @@
["support.function","float"],
["paren.lparen","("],
["identifier","string"],
- ["text","."],
- ["identifier","atoi"],
+ ["punctuation","."],
+ ["function.support","atoi"],
["paren.lparen","("],
["identifier","i"],
["paren.rparen","))"]
@@ -91,9 +96,9 @@
["keyword","except"],
["text"," "],
["identifier","string"],
- ["text","."],
- ["identifier","atoi_error"],
- ["text",":"]
+ ["punctuation","."],
+ ["function.support","atoi_error"],
+ ["punctuation",":"]
],[
"start",
["text"," "],
@@ -103,13 +108,14 @@
["paren.lparen","("],
["identifier","i"],
["paren.rparen",")"],
- ["text",", "],
+ ["punctuation",","],
+ ["text"," "],
["string","\"not a numeric value\""]
],[
"start",
["text"," "],
["keyword","else"],
- ["text",":"]
+ ["punctuation",":"]
],[
"start",
["text"," "],
@@ -142,11 +148,286 @@
["paren.lparen","("],
["identifier","fahrenheit"],
["paren.rparen",")"],
- ["text",", "],
+ ["punctuation",","],
+ ["text"," "],
["support.function","int"],
["paren.lparen","("],
["identifier","celsius"],
["keyword.operator","+"],
["constant.numeric",".5"],
["paren.rparen","))"]
+],[
+ "start"
+],[
+ "start",
+ ["identifier","name"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["string","\"Fred\""]
+],[
+ "start",
+ ["string","f\"He said his name is "],
+ ["paren.lparen","{"],
+ ["identifier","name"],
+ ["function.support","!r"],
+ ["paren.rparen","}"],
+ ["string",".\""]
+],[
+ "start"
+],[
+ "start",
+ ["string","f\"He said his name is "],
+ ["paren.lparen","{"],
+ ["support.function","repr"],
+ ["paren.lparen","("],
+ ["identifier","name"],
+ ["text","+"],
+ ["constant.numeric","12"],
+ ["paren.rparen",")}"],
+ ["string",".\""],
+ ["text"," "],
+ ["comment","# repr() is equivalent to !r"]
+],[
+ "start"
+],[
+ "start",
+ ["identifier","width"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["constant.numeric","10"]
+],[
+ "start",
+ ["identifier","precision"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["constant.numeric","4"]
+],[
+ "start",
+ ["identifier","value"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["identifier","decimal"],
+ ["punctuation","."],
+ ["function.support","Decimal"],
+ ["paren.lparen","("],
+ ["string","\"12.34567\""],
+ ["paren.rparen",")"]
+],[
+ "start",
+ ["string","f\"result: "],
+ ["paren.lparen","{"],
+ ["identifier","value"],
+ ["text",":"],
+ ["paren.lparen","{"],
+ ["identifier","width"],
+ ["paren.rparen","}"],
+ ["text","."],
+ ["paren.lparen","{"],
+ ["identifier","precision"],
+ ["paren.rparen","}}"],
+ ["string","\""],
+ ["text"," "],
+ ["comment","# nested fields"]
+],[
+ "start",
+ ["string","'result: 12.35'"]
+],[
+ "start",
+ ["identifier","today"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["identifier","datetime"],
+ ["paren.lparen","("],
+ ["identifier","year"],
+ ["keyword.operator","="],
+ ["constant.numeric","2017"],
+ ["punctuation",","],
+ ["text"," "],
+ ["identifier","month"],
+ ["keyword.operator","="],
+ ["constant.numeric","1"],
+ ["punctuation",","],
+ ["text"," "],
+ ["identifier","day"],
+ ["keyword.operator","="],
+ ["constant.numeric","27"],
+ ["paren.rparen",")"]
+],[
+ "start",
+ ["string","f\""],
+ ["paren.lparen","{"],
+ ["identifier","today"],
+ ["text",":%"],
+ ["identifier","B"],
+ ["string"," "],
+ ["text","%"],
+ ["identifier","d"],
+ ["text",","],
+ ["string"," "],
+ ["text","%"],
+ ["identifier","Y"],
+ ["paren.rparen","}"],
+ ["string","\""],
+ ["text"," "],
+ ["comment","# using date format specifier"]
+],[
+ "start",
+ ["string","'January 27, 2017'"]
+],[
+ "start",
+ ["identifier","number"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["constant.numeric","1024"]
+],[
+ "start",
+ ["string","f\""],
+ ["paren.lparen","{"],
+ ["identifier","number"],
+ ["text",":#0"],
+ ["identifier","x"],
+ ["paren.rparen","}"],
+ ["string","\""],
+ ["text"," "],
+ ["comment","# using integer format specifier"]
+],[
+ "start",
+ ["string","'0x400'"]
+],[
+ "start"
+],[
+ "start",
+ ["string","F\"Hello, "],
+ ["paren.lparen","{"],
+ ["identifier","name"],
+ ["paren.rparen","}"],
+ ["string",". You are "],
+ ["paren.lparen","{"],
+ ["identifier","age"],
+ ["paren.rparen","}"],
+ ["string",".\""]
+],[
+ "start",
+ ["string","'Hello, Eric. You are 74.'"]
+],[
+ "start",
+ ["string","f\""],
+ ["paren.lparen","{"],
+ ["constant.numeric","2"],
+ ["string"," "],
+ ["text","*"],
+ ["string"," "],
+ ["constant.numeric","37"],
+ ["paren.rparen","}"],
+ ["string","\""]
+],[
+ "start",
+ ["string","'74'"]
+],[
+ "start",
+ ["keyword","def"],
+ ["text"," "],
+ ["identifier","to_lowercase"],
+ ["paren.lparen","("],
+ ["support.function","input"],
+ ["paren.rparen",")"],
+ ["punctuation",":"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","return"],
+ ["text"," "],
+ ["support.function","input"],
+ ["punctuation","."],
+ ["function.support","lower"],
+ ["paren.lparen","("],
+ ["paren.rparen",")"]
+],[
+ "start"
+],[
+ "start",
+ ["identifier","name"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["string","\"Eric Idle\""]
+],[
+ "start",
+ ["string","f\""],
+ ["paren.lparen","{"],
+ ["identifier","to_lowercase"],
+ ["paren.lparen","("],
+ ["identifier","name"],
+ ["paren.rparen",")}"],
+ ["string"," is funny.\""]
+],[
+ "start"
+],[
+ "start",
+ ["string","f\""],
+ ["paren.lparen","{"],
+ ["string","'Eric Idle'"],
+ ["paren.rparen","}"],
+ ["string","\""]
+],[
+ "start"
+],[
+ "start",
+ ["string","f'"],
+ ["paren.lparen","{"],
+ ["string","\"Eric Idle\""],
+ ["paren.rparen","}"],
+ ["string","'"]
+],[
+ "start"
+],[
+ "start",
+ ["string","f\"\"\""],
+ ["paren.lparen","{"],
+ ["identifier","Eric"],
+ ["string"," "],
+ ["identifier","Idle"],
+ ["paren.rparen","}"],
+ ["string","\"\"\""]
+],[
+ "start"
+],[
+ "start",
+ ["string","f'''"],
+ ["paren.lparen","{"],
+ ["identifier","Eric"],
+ ["string"," "],
+ ["identifier","Idle"],
+ ["paren.rparen","}"],
+ ["string","'''"]
+],[
+ "start",
+ ["string","f\"The "],
+ ["constant.language.escape","\\\""],
+ ["string","comedian"],
+ ["constant.language.escape","\\\""],
+ ["string"," is "],
+ ["paren.lparen","{"],
+ ["identifier","name"],
+ ["paren.rparen","}"],
+ ["string",", aged "],
+ ["paren.lparen","{"],
+ ["identifier","age"],
+ ["paren.rparen","}"],
+ ["string",".\""]
+],[
+ "start",
+ ["string","f\""],
+ ["paren.lparen","{{"],
+ ["constant.numeric","74"],
+ ["paren.rparen","}}"],
+ ["string","\""]
+],[
+ "start"
]]
\ No newline at end of file
diff --git a/lib/ace/mode/apex.js b/lib/ace/mode/apex.js
index 6b19ad0ed40..0cb9ca2b103 100644
--- a/lib/ace/mode/apex.js
+++ b/lib/ace/mode/apex.js
@@ -3,11 +3,11 @@
define(function(require, exports, module) {
"use strict";
-var oop = require("ace/lib/oop");
-var TextMode = require("ace/mode/text").Mode;
+var oop = require("../lib/oop");
+var TextMode = require("../mode/text").Mode;
var ApexHighlightRules = require("./apex_highlight_rules").ApexHighlightRules;
-var FoldMode = require("ace/mode/folding/cstyle").FoldMode;
-var CstyleBehaviour = require("ace/mode/behaviour/cstyle").CstyleBehaviour;
+var FoldMode = require("../mode/folding/cstyle").FoldMode;
+var CstyleBehaviour = require("../mode/behaviour/cstyle").CstyleBehaviour;
function ApexMode() {
TextMode.call(this);
@@ -15,7 +15,7 @@ function ApexMode() {
this.HighlightRules = ApexHighlightRules;
this.foldingRules = new FoldMode();
this.$behaviour = new CstyleBehaviour();
-};
+}
oop.inherits(ApexMode, TextMode);
diff --git a/lib/ace/mode/apex_highlight_rules.js b/lib/ace/mode/apex_highlight_rules.js
index 507feb7cfab..de127ec625c 100644
--- a/lib/ace/mode/apex_highlight_rules.js
+++ b/lib/ace/mode/apex_highlight_rules.js
@@ -32,16 +32,11 @@
define(function(require, exports, module) {
"use strict";
-var oop = require("ace/lib/oop");
-var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
-var DocCommentHighlightRules = require("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules;
+var oop = require("../lib/oop");
+var TextHighlightRules = require("../mode/text_highlight_rules").TextHighlightRules;
+var DocCommentHighlightRules = require("../mode/doc_comment_highlight_rules").DocCommentHighlightRules;
var ApexHighlightRules = function() {
- /*TODO
- extends|class|interface|enum|implements|instanceof|void|long|double|blob|date|datetime|decimal|id|integer|Object|string
- istest|future|deprecrated|readonly|remoteaction"
- system|apex|label|apexpages|userinfo|schema",
- */
var mainKeywordMapper = this.createKeywordMapper({
"variable.language": "activate|any|autonomous|begin|bigdecimal|byte|cast|char|collect|const"
+ "|end|exit|export|float|goto|group|having|hint|import|inner|into|join|loop|number|object|of|outer"
@@ -57,11 +52,11 @@ var ApexHighlightRules = function() {
+ "|tolabel|tomorrow|trigger|true|try|undelete|update|upsert|using|virtual|webservice"
+ "|where|while|yesterday|switch|case|default",
"storage.type":
- "def|boolean|byte|char|short|int|float|pblob|date|datetime|decimal|double|id|integer|long|string|time|void",
+ "def|boolean|byte|char|short|int|float|pblob|date|datetime|decimal|double|id|integer|long|string|time|void|blob|Object",
"constant.language":
"true|false|null|after|before|count|excludes|first|includes|last|order|sharing|with",
"support.function":
- "system"
+ "system|apex|label|apexpages|userinfo|schema"
}, "identifier", true);
function keywordMapper(value) {
if (value.slice(-3) == "__c") return "support.function";
@@ -106,8 +101,8 @@ var ApexHighlightRules = function() {
DocCommentHighlightRules.getTagRule(),
{token : "comment", regex : "\\*\\/", next : "start"},
{defaultToken : "comment", caseInsensitive: true}
- ],
- },
+ ]
+ }
];
}
@@ -166,7 +161,7 @@ var ApexHighlightRules = function() {
token : "paren.rparen",
regex : /[\])}]/,
merge : false
- },
+ }
],
maybe_soql: [{
regex: /\s+/,
@@ -215,7 +210,7 @@ var ApexHighlightRules = function() {
},
{
regex : /[\?\&\|\!\{\}\[\]\(\)\^\~\*\:\"\'\+\-\,\.=\\\/]/,
- token : "keyword.operator",
+ token : "keyword.operator"
}],
"log-start" : [ {
diff --git a/lib/ace/mode/visualforce.js b/lib/ace/mode/visualforce.js
index 125ca371598..3558b174809 100644
--- a/lib/ace/mode/visualforce.js
+++ b/lib/ace/mode/visualforce.js
@@ -1,13 +1,13 @@
/* caption: Visualforce; extensions: component,page,vfp */
-define(["require", "exports", "module", "ace/mode/html", "./visualforce_highlight_rules"], function(require, exports, module) {
+define(function(require, exports, module) {
"use strict";
-var oop = require("ace/lib/oop");
-var HtmlMode = require("ace/mode/html").Mode;
+var oop = require("../lib/oop");
+var HtmlMode = require("./html").Mode;
var VisualforceHighlightRules = require("./visualforce_highlight_rules").VisualforceHighlightRules;
-var XmlBehaviour = require("ace/mode/behaviour/xml").XmlBehaviour;
-var HtmlFoldMode = require("ace/mode/folding/html").FoldMode;
+var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
+var HtmlFoldMode = require("./folding/html").FoldMode;
function VisualforceMode() {
HtmlMode.call(this);
@@ -15,7 +15,7 @@ function VisualforceMode() {
this.HighlightRules = VisualforceHighlightRules;
this.foldingRules = new HtmlFoldMode();
this.$behaviour = new XmlBehaviour();
-};
+}
oop.inherits(VisualforceMode, HtmlMode);
diff --git a/lib/ace/mode/visualforce_highlight_rules.js b/lib/ace/mode/visualforce_highlight_rules.js
index 1d8d3572d58..ec63297a544 100644
--- a/lib/ace/mode/visualforce_highlight_rules.js
+++ b/lib/ace/mode/visualforce_highlight_rules.js
@@ -3,8 +3,8 @@
define(function(require, exports, module) {
"use strict";
-var oop = require("ace/lib/oop");
-var HtmlHighlightRules = require("ace/mode/html_highlight_rules").HtmlHighlightRules;
+var oop = require("../lib/oop");
+var HtmlHighlightRules = require("../mode/html_highlight_rules").HtmlHighlightRules;
function string(options) {
return {
@@ -83,13 +83,13 @@ var VisualforceHighlightRules = function() {
regex : /[a-zA-Z$_\u00a1-\uffff][a-zA-Z\d$_\u00a1-\uffff]*\b/
}, {
token : "keyword.operator",
- regex : /==|<>|!=|<=|>=|&&|\|\||[+\-*/^()=<>&]/,
+ regex : /==|<>|!=|<=|>=|&&|\|\||[+\-*/^()=<>&]/
}, {
token : "punctuation.operator",
- regex : /[?:,;.]/,
+ regex : /[?:,;.]/
}, {
token : "paren.lparen",
- regex : /[\[({]/,
+ regex : /[\[({]/
}, {
token : "paren.rparen",
regex : /[\])}]/
From 452be7188f3f1e5aad9afad2a6a578726c46d23e Mon Sep 17 00:00:00 2001
From: nightwing
Date: Tue, 9 Oct 2018 23:11:27 +0400
Subject: [PATCH 0088/1293] better fix for Edge input issue
---
lib/ace/keyboard/textinput.js | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/lib/ace/keyboard/textinput.js b/lib/ace/keyboard/textinput.js
index a80b15bdde7..58ff7472203 100644
--- a/lib/ace/keyboard/textinput.js
+++ b/lib/ace/keyboard/textinput.js
@@ -86,8 +86,18 @@ var TextInput = function(parentNode, host) {
event.addListener(text, "focus", function(e) {
if (ignoreFocusEvents) return;
isFocused = true;
+ if (useragent.isEdge) {
+ // on edge focus event nnis fired even if document itself is not focused
+ try {
+ if (!document.hasFocus())
+ return;
+ } catch(e) {}
+ }
host.onFocus(e);
- resetSelection();
+ if (useragent.isEdge)
+ setTimeout(resetSelection);
+ else
+ resetSelection();
});
this.$focusScroll = false;
this.focus = function() {
From fc83f2fbc1acb5f4c95ca00f85138a22f461ea24 Mon Sep 17 00:00:00 2001
From: Naoum Hankache
Date: Sat, 13 Oct 2018 10:18:57 +0300
Subject: [PATCH 0089/1293] Add Perl 6 mode
---
demo/kitchen-sink/docs/perl6.p6 | 41 +++
lib/ace/ext/modelist.js | 4 +-
lib/ace/mode/perl6.js | 90 ++++++
lib/ace/mode/perl6_highlight_rules.js | 395 ++++++++++++++++++++++++++
4 files changed, 529 insertions(+), 1 deletion(-)
create mode 100644 demo/kitchen-sink/docs/perl6.p6
create mode 100644 lib/ace/mode/perl6.js
create mode 100644 lib/ace/mode/perl6_highlight_rules.js
diff --git a/demo/kitchen-sink/docs/perl6.p6 b/demo/kitchen-sink/docs/perl6.p6
new file mode 100644
index 00000000000..db1ae8f24d9
--- /dev/null
+++ b/demo/kitchen-sink/docs/perl6.p6
@@ -0,0 +1,41 @@
+=begin comment
+Perl 6 example for ace
+=end comment
+class Cook is Employee {
+ has @.utensils is rw;
+ has @.cookbooks is rw;
+
+ method cook( $food ) {
+ say "Cooking $food";
+ }
+
+ method clean_utensils {
+ say "Cleaning $_" for @.utensils;
+ }
+}
+
+class Baker is Cook {
+ method cook( $confection ) {
+ say "Baking a tasty $confection";
+ }
+}
+
+my $cook = Cook.new(
+ utensils => ,
+ cookbooks => 'The Joy of Cooking',
+ salary => 40000);
+
+$cook.cook( 'pizza' ); # OUTPUT: «Cooking pizza»
+say $cook.utensils.perl; # OUTPUT: «["spoon", "ladle", "knife", "pan"]»
+say $cook.cookbooks.perl; # OUTPUT: «["The Joy of Cooking"]»
+say $cook.salary; # OUTPUT: «40000»
+
+my $baker = Baker.new(
+ utensils => 'self cleaning oven',
+ cookbooks => "The Baker's Apprentice",
+ salary => 50000);
+
+$baker.cook('brioche'); # OUTPUT: «Baking a tasty brioche»
+say $baker.utensils.perl; # OUTPUT: «["self cleaning oven"]»
+say $baker.cookbooks.perl; # OUTPUT: «["The Baker's Apprentice"]»
+say $baker.salary; # OUTPUT: «50000»
\ No newline at end of file
diff --git a/lib/ace/ext/modelist.js b/lib/ace/ext/modelist.js
index 0fb21f61ac9..6e2be29aa21 100644
--- a/lib/ace/ext/modelist.js
+++ b/lib/ace/ext/modelist.js
@@ -139,6 +139,7 @@ var supportedModes = {
OCaml: ["ml|mli"],
Pascal: ["pas|p"],
Perl: ["pl|pm"],
+ Perl6: ["p6|pl6|pm6"],
pgSQL: ["pgsql"],
PHP_Laravel_blade: ["blade.php"],
PHP: ["php|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"],
@@ -210,7 +211,8 @@ var nameOverrides = {
HTML_Ruby: "HTML (Ruby)",
HTML_Elixir: "HTML (Elixir)",
FTL: "FreeMarker",
- PHP_Laravel_blade: "PHP (Blade Template)"
+ PHP_Laravel_blade: "PHP (Blade Template)",
+ Perl6: "Perl 6"
};
var modesByName = {};
for (var name in supportedModes) {
diff --git a/lib/ace/mode/perl6.js b/lib/ace/mode/perl6.js
new file mode 100644
index 00000000000..13ca710b93a
--- /dev/null
+++ b/lib/ace/mode/perl6.js
@@ -0,0 +1,90 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Ajax.org B.V. nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Perl6HighlightRules = require("./perl6_highlight_rules").Perl6HighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+ this.HighlightRules = Perl6HighlightRules;
+
+ this.$outdent = new MatchingBraceOutdent();
+ this.foldingRules = new CStyleFoldMode({start: "^=(begin)\\b", end: "^=(end)\\b"});
+ this.$behaviour = this.$defaultBehaviour;
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+ this.lineCommentStart = "#";
+ this.blockComment = [
+ {start: "=begin", end: "=end", lineStartOnly: true},
+ {start: "=item", end: "=end", lineStartOnly: true}
+ ];
+
+
+ this.getNextLineIndent = function(state, line, tab) {
+ var indent = this.$getIndent(line);
+
+ var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+ var tokens = tokenizedLine.tokens;
+
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
+ return indent;
+ }
+
+ if (state == "start") {
+ var match = line.match(/^.*[\{\(\[:]\s*$/);
+ if (match) {
+ indent += tab;
+ }
+ }
+
+ return indent;
+ };
+
+ this.checkOutdent = function(state, line, input) {
+ return this.$outdent.checkOutdent(line, input);
+ };
+
+ this.autoOutdent = function(state, doc, row) {
+ this.$outdent.autoOutdent(doc, row);
+ };
+
+ this.$id = "ace/mode/perl6";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
diff --git a/lib/ace/mode/perl6_highlight_rules.js b/lib/ace/mode/perl6_highlight_rules.js
new file mode 100644
index 00000000000..ca7a2a64190
--- /dev/null
+++ b/lib/ace/mode/perl6_highlight_rules.js
@@ -0,0 +1,395 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Ajax.org B.V. nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var Perl6HighlightRules = function() {
+
+ var keywords = (
+ "my|our|class|role|grammar|is|does|sub|method|submethod|try|" +
+ "default|when|if|elsif|else|unless|with|orwith|without|for|given|proceed|" +
+ "succeed|loop|while|until|repeat|module|use|need|import|require|unit|" +
+ "constant|enum|multi|return|has|token|rule|make|made|proto|state|augment|" +
+ "but|anon|supersede|let|subset|gather|returns|return-rw|temp|" +
+ "BEGIN|CHECK|INIT|END|CLOSE|ENTER|LEAVE|KEEP|UNDO|PRE|POST|FIRST|NEXT|LAST|CATCH|CONTROL|QUIT|DOC"
+ );
+
+ var types = (
+ "Any|Array|Associative|AST|atomicint|Attribute|Backtrace|Backtrace::Frame|" +
+ "Bag|Baggy|BagHash|Blob|Block|Bool|Buf|Callable|CallFrame|Cancellation|" +
+ "Capture|Channel|Code|compiler|Complex|ComplexStr|Cool|CurrentThreadScheduler|" +
+ "Cursor|Date|Dateish|DateTime|Distro|Duration|Encoding|Exception|Failure|"+
+ "FatRat|Grammar|Hash|HyperWhatever|Instant|Int|IntStr|IO|IO::ArgFiles|"+
+ "IO::CatHandle|IO::Handle|IO::Notification|IO::Path|IO::Path::Cygwin|"+
+ "IO::Path::QNX|IO::Path::Unix|IO::Path::Win32|IO::Pipe|IO::Socket|"+
+ "IO::Socket::Async|IO::Socket::INET|IO::Spec|IO::Spec::Cygwin|IO::Spec::QNX|"+
+ "IO::Spec::Unix|IO::Spec::Win32|IO::Special|Iterable|Iterator|Junction|Kernel|"+
+ "Label|List|Lock|Lock::Async|Macro|Map|Match|Metamodel::AttributeContainer|"+
+ "Metamodel::C3MRO|Metamodel::ClassHOW|Metamodel::EnumHOW|Metamodel::Finalization|"+
+ "Metamodel::MethodContainer|Metamodel::MROBasedMethodDispatch|Metamodel::MultipleInheritance|"+
+ "Metamodel::Naming|Metamodel::Primitives|Metamodel::PrivateMethodContainer|"+
+ "Metamodel::RoleContainer|Metamodel::Trusting|Method|Mix|MixHash|Mixy|Mu|"+
+ "NFC|NFD|NFKC|NFKD|Nil|Num|Numeric|NumStr|ObjAt|Order|Pair|Parameter|Perl|"+
+ "Pod::Block|Pod::Block::Code|Pod::Block::Comment|Pod::Block::Declarator|"+
+ "Pod::Block::Named|Pod::Block::Para|Pod::Block::Table|Pod::Heading|Pod::Item|"+
+ "Positional|PositionalBindFailover|Proc|Proc::Async|Promise|Proxy|PseudoStash|"+
+ "QuantHash|Range|Rat|Rational|RatStr|Real|Regex|Routine|Scalar|Scheduler|"+
+ "Semaphore|Seq|Set|SetHash|Setty|Signature|Slip|Stash|Str|StrDistance|Stringy|"+
+ "Sub|Submethod|Supplier|Supplier::Preserving|Supply|Systemic|Tap|Telemetry|"+
+ "Telemetry::Instrument::Thread|Telemetry::Instrument::Usage|Telemetry::Period|"+
+ "Telemetry::Sampler|Thread|ThreadPoolScheduler|UInt|Uni|utf8|Variable|Version|"+
+ "VM|Whatever|WhateverCode|WrapHandle|int|uint|num|str|"+
+ "int8|int16|int32|int64|uint8|uint16|uint32|uint64|long|longlong|num32|num64|size_t|bool|CArray|Pointer|"+
+ "Backtrace|Backtrace::Frame|Exception|Failure|X::AdHoc|X::Anon::Augment|X::Anon::Multi|"+
+ "X::Assignment::RO|X::Attribute::NoPackage|X::Attribute::Package|X::Attribute::Undeclared|"+
+ "X::Augment::NoSuchType|X::Bind|X::Bind::NativeType|X::Bind::Slice|X::Caller::NotDynamic|"+
+ "X::Channel::ReceiveOnClosed|X::Channel::SendOnClosed|X::Comp|X::Composition::NotComposable|"+
+ "X::Constructor::Positional|X::ControlFlow|X::ControlFlow::Return|X::DateTime::TimezoneClash|"+
+ "X::Declaration::Scope|X::Declaration::Scope::Multi|X::Does::TypeObject|X::Eval::NoSuchLang|"+
+ "X::Export::NameClash|X::IO|X::IO::Chdir|X::IO::Chmod|X::IO::Copy|X::IO::Cwd|X::IO::Dir|"+
+ "X::IO::DoesNotExist|X::IO::Link|X::IO::Mkdir|X::IO::Move|X::IO::Rename|X::IO::Rmdir|X::IO::Symlink|"+
+ "X::IO::Unlink|X::Inheritance::NotComposed|X::Inheritance::Unsupported|X::Method::InvalidQualifier|"+
+ "X::Method::NotFound|X::Method::Private::Permission|X::Method::Private::Unqualified|"+
+ "X::Mixin::NotComposable|X::NYI|X::NoDispatcher|X::Numeric::Real|X::OS|X::Obsolete|X::OutOfRange|"+
+ "X::Package::Stubbed|X::Parameter::Default|X::Parameter::MultipleTypeConstraints|"+
+ "X::Parameter::Placeholder|X::Parameter::Twigil|X::Parameter::WrongOrder|X::Phaser::Multiple|"+
+ "X::Phaser::PrePost|X::Placeholder::Block|X::Placeholder::Mainline|X::Pod|X::Proc::Async|"+
+ "X::Proc::Async::AlreadyStarted|X::Proc::Async::CharsOrBytes|X::Proc::Async::MustBeStarted|"+
+ "X::Proc::Async::OpenForWriting|X::Proc::Async::TapBeforeSpawn|X::Proc::Unsuccessful|"+
+ "X::Promise::CauseOnlyValidOnBroken|X::Promise::Vowed|X::Redeclaration|X::Role::Initialization|"+
+ "X::Seq::Consumed|X::Sequence::Deduction|X::Signature::NameClash|X::Signature::Placeholder|"+
+ "X::Str::Numeric|X::StubCode|X::Syntax|X::Syntax::Augment::WithoutMonkeyTyping|"+
+ "X::Syntax::Comment::Embedded|X::Syntax::Confused|X::Syntax::InfixInTermPosition|"+
+ "X::Syntax::Malformed|X::Syntax::Missing|X::Syntax::NegatedPair|X::Syntax::NoSelf|"+
+ "X::Syntax::Number::RadixOutOfRange|X::Syntax::P5|X::Syntax::Regex::Adverb|"+
+ "X::Syntax::Regex::SolitaryQuantifier|X::Syntax::Reserved|X::Syntax::Self::WithoutObject|"+
+ "X::Syntax::Signature::InvocantMarker|X::Syntax::Term::MissingInitializer|X::Syntax::UnlessElse|"+
+ "X::Syntax::Variable::Match|X::Syntax::Variable::Numeric|X::Syntax::Variable::Twigil|X::Temporal|"+
+ "X::Temporal::InvalidFormat|X::TypeCheck|X::TypeCheck::Assignment|X::TypeCheck::Binding|"+
+ "X::TypeCheck::Return|X::TypeCheck::Splice|X::Undeclared"
+ );
+
+ var builtinFunctions = (
+ "abs|abs2rel|absolute|accept|ACCEPTS|accessed|acos|acosec|acosech|acosh|"+
+ "acotan|acotanh|acquire|act|action|actions|add|add_attribute|add_enum_value|"+
+ "add_fallback|add_method|add_parent|add_private_method|add_role|add_trustee|"+
+ "adverb|after|all|allocate|allof|allowed|alternative-names|annotations|antipair|"+
+ "antipairs|any|anyof|app_lifetime|append|arch|archname|args|arity|asec|asech|"+
+ "asin|asinh|ASSIGN-KEY|ASSIGN-POS|assuming|ast|at|atan|atan2|atanh|AT-KEY|"+
+ "atomic-assign|atomic-dec-fetch|atomic-fetch|atomic-fetch-add|atomic-fetch-dec|"+
+ "atomic-fetch-inc|atomic-fetch-sub|atomic-inc-fetch|AT-POS|attributes|auth|await|"+
+ "backtrace|Bag|BagHash|base|basename|base-repeating|batch|BIND-KEY|BIND-POS|"+
+ "bind-stderr|bind-stdin|bind-stdout|bind-udp|bits|bless|block|bool-only|"+
+ "bounds|break|Bridge|broken|BUILD|build-date|bytes|cache|callframe|calling-package|"+
+ "CALL-ME|callsame|callwith|can|cancel|candidates|cando|canonpath|caps|caption|"+
+ "Capture|cas|catdir|categorize|categorize-list|catfile|catpath|cause|ceiling|"+
+ "cglobal|changed|Channel|chars|chdir|child|child-name|child-typename|chmod|chomp|"+
+ "chop|chr|chrs|chunks|cis|classify|classify-list|cleanup|clone|close|closed|"+
+ "close-stdin|code|codes|collate|column|comb|combinations|command|comment|"+
+ "compiler|Complex|compose|compose_type|composer|condition|config|configure_destroy|"+
+ "configure_type_checking|conj|connect|constraints|construct|contains|contents|copy|"+
+ "cos|cosec|cosech|cosh|cotan|cotanh|count|count-only|cpu-cores|cpu-usage|CREATE|"+
+ "create_type|cross|cue|curdir|curupdir|d|Date|DateTime|day|daycount|day-of-month|"+
+ "day-of-week|day-of-year|days-in-month|declaration|decode|decoder|deepmap|"+
+ "defined|DEFINITE|delayed|DELETE-KEY|DELETE-POS|denominator|desc|DESTROY|destroyers|"+
+ "devnull|did-you-mean|die|dir|dirname|dir-sep|DISTROnames|do|done|duckmap|dynamic|"+
+ "e|eager|earlier|elems|emit|enclosing|encode|encoder|encoding|end|ends-with|enum_from_value|"+
+ "enum_value_list|enum_values|enums|eof|EVAL|EVALFILE|exception|excludes-max|excludes-min|"+
+ "EXISTS-KEY|EXISTS-POS|exit|exitcode|exp|expected|explicitly-manage|expmod|extension|f|"+
+ "fail|fc|feature|file|filename|find_method|find_method_qualified|finish|first|flat|flatmap|"+
+ "flip|floor|flush|fmt|format|formatter|freeze|from|from-list|from-loop|from-posix|full|"+
+ "full-barrier|get|get_value|getc|gist|got|grab|grabpairs|grep|handle|handled|handles|"+
+ "hardware|has_accessor|head|headers|hh-mm-ss|hidden|hides|hour|how|hyper|id|illegal|"+
+ "im|in|indent|index|indices|indir|infinite|infix|install_method_cache|"+
+ "Instant|instead|int-bounds|interval|in-timezone|invalid-str|invert|invocant|IO|"+
+ "IO::Notification.watch-path|is_trusted|is_type|isa|is-absolute|is-hidden|is-initial-thread|"+
+ "is-int|is-lazy|is-leap-year|isNaN|is-prime|is-relative|is-routine|is-setting|is-win|item|"+
+ "iterator|join|keep|kept|KERNELnames|key|keyof|keys|kill|kv|kxxv|l|lang|last|lastcall|later|"+
+ "lazy|lc|leading|level|line|lines|link|listen|live|local|lock|log|log10|lookup|lsb|"+
+ "MAIN|match|max|maxpairs|merge|message|method_table|methods|migrate|min|minmax|"+
+ "minpairs|minute|misplaced|Mix|MixHash|mkdir|mode|modified|month|move|mro|msb|multiness|"+
+ "name|named|named_names|narrow|nativecast|native-descriptor|nativesizeof|new|new_type|"+
+ "new-from-daycount|new-from-pairs|next|nextcallee|next-handle|nextsame|nextwith|NFC|NFD|"+
+ "NFKC|NFKD|nl-in|nl-out|nodemap|none|norm|not|note|now|nude|numerator|Numeric|of|"+
+ "offset|offset-in-hours|offset-in-minutes|old|on-close|one|on-switch|open|opened|"+
+ "operation|optional|ord|ords|orig|os-error|osname|out-buffer|pack|package|package-kind|"+
+ "package-name|packages|pair|pairs|pairup|parameter|params|parent|parent-name|parents|parse|"+
+ "parse-base|parsefile|parse-names|parts|path|path-sep|payload|peer-host|peer-port|periods|"+
+ "perl|permutations|phaser|pick|pickpairs|pid|placeholder|plus|polar|poll|polymod|pop|pos|"+
+ "positional|posix|postfix|postmatch|precomp-ext|precomp-target|pred|prefix|prematch|prepend|"+
+ "print|printf|print-nl|print-to|private|private_method_table|proc|produce|Promise|prompt|"+
+ "protect|pull-one|push|push-all|push-at-least|push-exactly|push-until-lazy|put|"+
+ "qualifier-type|quit|r|race|radix|rand|range|raw|re|read|readchars|readonly|"+
+ "ready|Real|reallocate|reals|reason|rebless|receive|recv|redispatcher|redo|reduce|"+
+ "rel2abs|relative|release|rename|repeated|replacement|report|reserved|resolve|"+
+ "restore|result|resume|rethrow|reverse|right|rindex|rmdir|roles_to_compose|"+
+ "rolish|roll|rootdir|roots|rotate|rotor|round|roundrobin|routine-type|run|rwx|s|"+
+ "samecase|samemark|samewith|say|schedule-on|scheduler|scope|sec|sech|second|seek|"+
+ "self|send|Set|set_hidden|set_name|set_package|set_rw|set_value|SetHash|"+
+ "set-instruments|setup_finalization|shape|share|shell|shift|sibling|sigil|"+
+ "sign|signal|signals|signature|sin|sinh|sink|sink-all|skip|skip-at-least|"+
+ "skip-at-least-pull-one|skip-one|sleep|sleep-timer|sleep-until|Slip|slurp|"+
+ "slurp-rest|slurpy|snap|snapper|so|socket-host|socket-port|sort|source|"+
+ "source-package|spawn|SPEC|splice|split|splitdir|splitpath|sprintf|spurt|"+
+ "sqrt|squish|srand|stable|start|started|starts-with|status|stderr|stdout|"+
+ "sub_signature|subbuf|subbuf-rw|subname|subparse|subst|subst-mutate|"+
+ "substr|substr-eq|substr-rw|succ|sum|Supply|symlink|t|tail|take|take-rw|"+
+ "tan|tanh|tap|target|target-name|tc|tclc|tell|then|throttle|throw|timezone|"+
+ "tmpdir|to|today|toggle|to-posix|total|trailing|trans|tree|trim|trim-leading|"+
+ "trim-trailing|truncate|truncated-to|trusts|try_acquire|trying|twigil|type|"+
+ "type_captures|typename|uc|udp|uncaught_handler|unimatch|uniname|uninames|"+
+ "uniparse|uniprop|uniprops|unique|unival|univals|unlink|unlock|unpack|unpolar|"+
+ "unshift|unwrap|updir|USAGE|utc|val|value|values|VAR|variable|verbose-config|"+
+ "version|VMnames|volume|vow|w|wait|warn|watch|watch-path|week|weekday-of-month|"+
+ "week-number|week-year|WHAT|WHERE|WHEREFORE|WHICH|WHO|whole-second|WHY|"+
+ "wordcase|words|workaround|wrap|write|write-to|yada|year|yield|yyyy-mm-dd|"+
+ "z|zip|zip-latest|"+
+ "plan|done-testing|bail-out|todo|skip|skip-rest|diag|subtest|pass|flunk|ok|"+
+ "nok|cmp-ok|is-deeply|isnt|is-approx|like|unlike|use-ok|isa-ok|does-ok|"+
+ "can-ok|dies-ok|lives-ok|eval-dies-ok|eval-lives-ok|throws-like|fails-like|"+
+ "rw|required|native|repr|export|symbol"
+ );
+ var constants_ascii = ("pi|Inf|tau|time");
+
+ var ops_txt = ("eq|ne|gt|lt|le|ge|div|gcd|lcm|leg|cmp|ff|fff|"+
+ "x|before|after|Z|X|and|or|andthen|notandthen|orelse|xor"
+ );
+
+ var keywordMapper = this.createKeywordMapper({
+ "keyword": keywords,
+ "storage.type" : types,
+ "constant.language": constants_ascii,
+ "support.function": builtinFunctions,
+ "keyword.operator": ops_txt
+ }, "identifier");
+
+ // regexp must not have capturing parentheses. Use (?:) instead.
+ // regexps are ordered -> the first match is used
+
+ var moduleName = "[a-zA-Z_][a-zA-Z_0-9:-]*\\b";
+
+ // Common rules used in the start block and in qqstrings and in qq-heredocs for interpolation
+
+ // Numbers - Hexadecimal
+ var hex = { token : "constant.numeric", regex : "0x[0-9a-fA-F]+\\b" };
+ // Numbers - Num & Rat
+ var num_rat = { token : "constant.numeric", regex : "[+-.]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" };
+ // Numbers - With _
+ var num_with_ = { token : "constant.numeric", regex : "(?:\\d+_?\\d+)+\\b" };
+ // Numbers - Complex
+ var complex_numbers = { token : "constant.numeric", regex : "\\+?\\d+i\\b" };
+ // Booleans
+ var booleans = { token : "constant.language.boolean", regex : "(?:True|False)\\b" };
+ // Versions
+ var versions = { token : "constant.other", regex : "v[0-9](?:\\.[a-zA-Z0-9*])*\\b" };
+ // Keywords
+ var lang_keywords = { token : keywordMapper, regex : "[a-zA-Z][\\:a-zA-Z0-9_-]*\\b" };
+ // Variables - also matches $_ and $1 $2 (regex match) etc.
+ var variables = { token : "variable.language", regex : "[$@%&][?*!.]?[a-zA-Z0-9_-]+\\b" };
+ // Special variables - matches $ $/ $! and @$/
+ var vars_special = { token: "variable.language", regex : "\\$[/|!]?|@\\$/" };
+ // Operators characters
+ var ops_char = { token : "keyword.operator", regex : "=|<|>|\\+|\\*|-|/|~|%|\\?|!|\\^|\\.|\\:|\\,|"+
+ "»|«|\\||\\&|⚛|∘" };
+ // Unicode Constants
+ var constants_unicode = { token : "constant.language", regex : "𝑒|π|τ|∞" };
+ // qstrings
+ var qstrings = { token : "string.quoted.single", regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" };
+ // Word Quoting
+ var word_quoting = { token : "string.quoted.single", regex : "[<](?:[a-zA-Z0-9 ])*[>]"};
+ //Regexp
+ var regexp = {
+ token : "string.regexp",
+ regex : "[m|rx]?[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" };
+
+
+ this.$rules = {
+ "start" : [
+ {
+ token : "comment.block", // Embedded Comments - Parentheses
+ regex : "#[`|=]\\(.*\\)"
+ }, {
+ token : "comment.block", // Embedded Comments - Brackets
+ regex : "#[`|=]\\[.*\\]"
+ }, {
+ token : "comment.doc", // Multiline Comments
+ regex : "^=(?:begin)\\b",
+ next : "block_comment"
+ }, {
+ token : "string.unquoted", // q Heredocs
+ regex : "q[x|w]?\\:to/END/;",
+ next : "qheredoc"
+ }, {
+ token : "string.unquoted", // qq Heredocs
+ regex : "qq[x|w]?\\:to/END/;",
+ next : "qqheredoc"
+ },
+ regexp,
+ qstrings
+ , {
+ token : "string.quoted.double", // Double Quoted String
+ regex : '"',
+ next : "qqstring"
+ },
+ word_quoting
+ , {
+ token: ["keyword", "text", "variable.module"], // use - Module Names, Pragmas, etc.
+ regex: "(use)(\\s+)((?:"+moduleName+"\\.?)*)"
+ },
+ hex,
+ num_rat,
+ num_with_,
+ complex_numbers,
+ booleans,
+ versions,
+ lang_keywords,
+ variables,
+ vars_special,
+ ops_char,
+ constants_unicode
+ , {
+ token : "comment", // Sigle Line Comments
+ regex : "#.*$"
+ }, {
+ token : "lparen",
+ regex : "[[({]"
+ }, {
+ token : "rparen",
+ regex : "[\\])}]"
+ }, {
+ token : "text",
+ regex : "\\s+"
+ }
+ ],
+ "qqstring" : [
+ {
+ token : "constant.language.escape",
+ regex : '\\\\(?:[nrtef\\\\"$]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2})'
+ },
+ variables,
+ vars_special
+ , {
+ token : "lparen",
+ regex : "{",
+ next : "qqinterpolation"
+ }, {
+ token : "string.quoted.double",
+ regex : '"',
+ next : "start"
+ }, {
+ defaultToken : "string.quoted.double"
+ }
+ ],
+ "qqinterpolation" : [
+ hex,
+ num_rat,
+ num_with_,
+ complex_numbers,
+ booleans,
+ versions,
+ lang_keywords,
+ variables,
+ vars_special,
+ ops_char,
+ constants_unicode,
+ qstrings,
+ regexp,
+
+ {
+ token: "rparen",
+ regex: "}",
+ next : "qqstring"
+ }
+ ],
+ "block_comment": [
+ {
+ token: "comment.doc",
+ regex: "^=end +[a-zA-Z_0-9]*",
+ next: "start"
+ },
+ {
+ defaultToken: "comment.doc"
+ }
+ ],
+ "qheredoc": [
+ {
+ token: "string.unquoted",
+ regex: "END$",
+ next: "start"
+ }, {
+ defaultToken: "string.unquoted"
+ }
+ ],
+ "qqheredoc": [
+ variables,
+ vars_special,
+ {
+ token : "lparen",
+ regex : "{",
+ next : "qqheredocinterpolation"
+ }, {
+ token: "string.unquoted",
+ regex: "END$",
+ next: "start"
+ }, {
+ defaultToken: "string.unquoted"
+ }
+ ],
+ "qqheredocinterpolation" : [
+ hex,
+ num_rat,
+ num_with_,
+ complex_numbers,
+ booleans,
+ versions,
+ lang_keywords,
+ variables,
+ vars_special,
+ ops_char,
+ constants_unicode,
+ qstrings,
+ regexp,
+ {
+ token: "rparen",
+ regex: "}",
+ next : "qqheredoc"
+ }
+ ]
+ };
+};
+
+oop.inherits(Perl6HighlightRules, TextHighlightRules);
+
+exports.Perl6HighlightRules = Perl6HighlightRules;
+});
From e2f0630a310abb128ad89170d013b7e4af71f43f Mon Sep 17 00:00:00 2001
From: Naoum Hankache
Date: Sat, 13 Oct 2018 10:51:41 +0300
Subject: [PATCH 0090/1293] Replace CRLF with LF
---
lib/ace/mode/perl6.js | 180 +++---
lib/ace/mode/perl6_highlight_rules.js | 790 +++++++++++++-------------
2 files changed, 485 insertions(+), 485 deletions(-)
diff --git a/lib/ace/mode/perl6.js b/lib/ace/mode/perl6.js
index 13ca710b93a..882724a2ae9 100644
--- a/lib/ace/mode/perl6.js
+++ b/lib/ace/mode/perl6.js
@@ -1,90 +1,90 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Distributed under the BSD license:
- *
- * Copyright (c) 2010, Ajax.org B.V.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Ajax.org B.V. nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * ***** END LICENSE BLOCK ***** */
-
-define(function(require, exports, module) {
-"use strict";
-
-var oop = require("../lib/oop");
-var TextMode = require("./text").Mode;
-var Perl6HighlightRules = require("./perl6_highlight_rules").Perl6HighlightRules;
-var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
-var CStyleFoldMode = require("./folding/cstyle").FoldMode;
-
-var Mode = function() {
- this.HighlightRules = Perl6HighlightRules;
-
- this.$outdent = new MatchingBraceOutdent();
- this.foldingRules = new CStyleFoldMode({start: "^=(begin)\\b", end: "^=(end)\\b"});
- this.$behaviour = this.$defaultBehaviour;
-};
-oop.inherits(Mode, TextMode);
-
-(function() {
-
- this.lineCommentStart = "#";
- this.blockComment = [
- {start: "=begin", end: "=end", lineStartOnly: true},
- {start: "=item", end: "=end", lineStartOnly: true}
- ];
-
-
- this.getNextLineIndent = function(state, line, tab) {
- var indent = this.$getIndent(line);
-
- var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
- var tokens = tokenizedLine.tokens;
-
- if (tokens.length && tokens[tokens.length-1].type == "comment") {
- return indent;
- }
-
- if (state == "start") {
- var match = line.match(/^.*[\{\(\[:]\s*$/);
- if (match) {
- indent += tab;
- }
- }
-
- return indent;
- };
-
- this.checkOutdent = function(state, line, input) {
- return this.$outdent.checkOutdent(line, input);
- };
-
- this.autoOutdent = function(state, doc, row) {
- this.$outdent.autoOutdent(doc, row);
- };
-
- this.$id = "ace/mode/perl6";
-}).call(Mode.prototype);
-
-exports.Mode = Mode;
-});
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Ajax.org B.V. nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Perl6HighlightRules = require("./perl6_highlight_rules").Perl6HighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+ this.HighlightRules = Perl6HighlightRules;
+
+ this.$outdent = new MatchingBraceOutdent();
+ this.foldingRules = new CStyleFoldMode({start: "^=(begin)\\b", end: "^=(end)\\b"});
+ this.$behaviour = this.$defaultBehaviour;
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+ this.lineCommentStart = "#";
+ this.blockComment = [
+ {start: "=begin", end: "=end", lineStartOnly: true},
+ {start: "=item", end: "=end", lineStartOnly: true}
+ ];
+
+
+ this.getNextLineIndent = function(state, line, tab) {
+ var indent = this.$getIndent(line);
+
+ var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+ var tokens = tokenizedLine.tokens;
+
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
+ return indent;
+ }
+
+ if (state == "start") {
+ var match = line.match(/^.*[\{\(\[:]\s*$/);
+ if (match) {
+ indent += tab;
+ }
+ }
+
+ return indent;
+ };
+
+ this.checkOutdent = function(state, line, input) {
+ return this.$outdent.checkOutdent(line, input);
+ };
+
+ this.autoOutdent = function(state, doc, row) {
+ this.$outdent.autoOutdent(doc, row);
+ };
+
+ this.$id = "ace/mode/perl6";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
diff --git a/lib/ace/mode/perl6_highlight_rules.js b/lib/ace/mode/perl6_highlight_rules.js
index ca7a2a64190..deab04d44b3 100644
--- a/lib/ace/mode/perl6_highlight_rules.js
+++ b/lib/ace/mode/perl6_highlight_rules.js
@@ -1,395 +1,395 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Distributed under the BSD license:
- *
- * Copyright (c) 2010, Ajax.org B.V.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Ajax.org B.V. nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * ***** END LICENSE BLOCK ***** */
-
-define(function(require, exports, module) {
-"use strict";
-
-var oop = require("../lib/oop");
-var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
-
-var Perl6HighlightRules = function() {
-
- var keywords = (
- "my|our|class|role|grammar|is|does|sub|method|submethod|try|" +
- "default|when|if|elsif|else|unless|with|orwith|without|for|given|proceed|" +
- "succeed|loop|while|until|repeat|module|use|need|import|require|unit|" +
- "constant|enum|multi|return|has|token|rule|make|made|proto|state|augment|" +
- "but|anon|supersede|let|subset|gather|returns|return-rw|temp|" +
- "BEGIN|CHECK|INIT|END|CLOSE|ENTER|LEAVE|KEEP|UNDO|PRE|POST|FIRST|NEXT|LAST|CATCH|CONTROL|QUIT|DOC"
- );
-
- var types = (
- "Any|Array|Associative|AST|atomicint|Attribute|Backtrace|Backtrace::Frame|" +
- "Bag|Baggy|BagHash|Blob|Block|Bool|Buf|Callable|CallFrame|Cancellation|" +
- "Capture|Channel|Code|compiler|Complex|ComplexStr|Cool|CurrentThreadScheduler|" +
- "Cursor|Date|Dateish|DateTime|Distro|Duration|Encoding|Exception|Failure|"+
- "FatRat|Grammar|Hash|HyperWhatever|Instant|Int|IntStr|IO|IO::ArgFiles|"+
- "IO::CatHandle|IO::Handle|IO::Notification|IO::Path|IO::Path::Cygwin|"+
- "IO::Path::QNX|IO::Path::Unix|IO::Path::Win32|IO::Pipe|IO::Socket|"+
- "IO::Socket::Async|IO::Socket::INET|IO::Spec|IO::Spec::Cygwin|IO::Spec::QNX|"+
- "IO::Spec::Unix|IO::Spec::Win32|IO::Special|Iterable|Iterator|Junction|Kernel|"+
- "Label|List|Lock|Lock::Async|Macro|Map|Match|Metamodel::AttributeContainer|"+
- "Metamodel::C3MRO|Metamodel::ClassHOW|Metamodel::EnumHOW|Metamodel::Finalization|"+
- "Metamodel::MethodContainer|Metamodel::MROBasedMethodDispatch|Metamodel::MultipleInheritance|"+
- "Metamodel::Naming|Metamodel::Primitives|Metamodel::PrivateMethodContainer|"+
- "Metamodel::RoleContainer|Metamodel::Trusting|Method|Mix|MixHash|Mixy|Mu|"+
- "NFC|NFD|NFKC|NFKD|Nil|Num|Numeric|NumStr|ObjAt|Order|Pair|Parameter|Perl|"+
- "Pod::Block|Pod::Block::Code|Pod::Block::Comment|Pod::Block::Declarator|"+
- "Pod::Block::Named|Pod::Block::Para|Pod::Block::Table|Pod::Heading|Pod::Item|"+
- "Positional|PositionalBindFailover|Proc|Proc::Async|Promise|Proxy|PseudoStash|"+
- "QuantHash|Range|Rat|Rational|RatStr|Real|Regex|Routine|Scalar|Scheduler|"+
- "Semaphore|Seq|Set|SetHash|Setty|Signature|Slip|Stash|Str|StrDistance|Stringy|"+
- "Sub|Submethod|Supplier|Supplier::Preserving|Supply|Systemic|Tap|Telemetry|"+
- "Telemetry::Instrument::Thread|Telemetry::Instrument::Usage|Telemetry::Period|"+
- "Telemetry::Sampler|Thread|ThreadPoolScheduler|UInt|Uni|utf8|Variable|Version|"+
- "VM|Whatever|WhateverCode|WrapHandle|int|uint|num|str|"+
- "int8|int16|int32|int64|uint8|uint16|uint32|uint64|long|longlong|num32|num64|size_t|bool|CArray|Pointer|"+
- "Backtrace|Backtrace::Frame|Exception|Failure|X::AdHoc|X::Anon::Augment|X::Anon::Multi|"+
- "X::Assignment::RO|X::Attribute::NoPackage|X::Attribute::Package|X::Attribute::Undeclared|"+
- "X::Augment::NoSuchType|X::Bind|X::Bind::NativeType|X::Bind::Slice|X::Caller::NotDynamic|"+
- "X::Channel::ReceiveOnClosed|X::Channel::SendOnClosed|X::Comp|X::Composition::NotComposable|"+
- "X::Constructor::Positional|X::ControlFlow|X::ControlFlow::Return|X::DateTime::TimezoneClash|"+
- "X::Declaration::Scope|X::Declaration::Scope::Multi|X::Does::TypeObject|X::Eval::NoSuchLang|"+
- "X::Export::NameClash|X::IO|X::IO::Chdir|X::IO::Chmod|X::IO::Copy|X::IO::Cwd|X::IO::Dir|"+
- "X::IO::DoesNotExist|X::IO::Link|X::IO::Mkdir|X::IO::Move|X::IO::Rename|X::IO::Rmdir|X::IO::Symlink|"+
- "X::IO::Unlink|X::Inheritance::NotComposed|X::Inheritance::Unsupported|X::Method::InvalidQualifier|"+
- "X::Method::NotFound|X::Method::Private::Permission|X::Method::Private::Unqualified|"+
- "X::Mixin::NotComposable|X::NYI|X::NoDispatcher|X::Numeric::Real|X::OS|X::Obsolete|X::OutOfRange|"+
- "X::Package::Stubbed|X::Parameter::Default|X::Parameter::MultipleTypeConstraints|"+
- "X::Parameter::Placeholder|X::Parameter::Twigil|X::Parameter::WrongOrder|X::Phaser::Multiple|"+
- "X::Phaser::PrePost|X::Placeholder::Block|X::Placeholder::Mainline|X::Pod|X::Proc::Async|"+
- "X::Proc::Async::AlreadyStarted|X::Proc::Async::CharsOrBytes|X::Proc::Async::MustBeStarted|"+
- "X::Proc::Async::OpenForWriting|X::Proc::Async::TapBeforeSpawn|X::Proc::Unsuccessful|"+
- "X::Promise::CauseOnlyValidOnBroken|X::Promise::Vowed|X::Redeclaration|X::Role::Initialization|"+
- "X::Seq::Consumed|X::Sequence::Deduction|X::Signature::NameClash|X::Signature::Placeholder|"+
- "X::Str::Numeric|X::StubCode|X::Syntax|X::Syntax::Augment::WithoutMonkeyTyping|"+
- "X::Syntax::Comment::Embedded|X::Syntax::Confused|X::Syntax::InfixInTermPosition|"+
- "X::Syntax::Malformed|X::Syntax::Missing|X::Syntax::NegatedPair|X::Syntax::NoSelf|"+
- "X::Syntax::Number::RadixOutOfRange|X::Syntax::P5|X::Syntax::Regex::Adverb|"+
- "X::Syntax::Regex::SolitaryQuantifier|X::Syntax::Reserved|X::Syntax::Self::WithoutObject|"+
- "X::Syntax::Signature::InvocantMarker|X::Syntax::Term::MissingInitializer|X::Syntax::UnlessElse|"+
- "X::Syntax::Variable::Match|X::Syntax::Variable::Numeric|X::Syntax::Variable::Twigil|X::Temporal|"+
- "X::Temporal::InvalidFormat|X::TypeCheck|X::TypeCheck::Assignment|X::TypeCheck::Binding|"+
- "X::TypeCheck::Return|X::TypeCheck::Splice|X::Undeclared"
- );
-
- var builtinFunctions = (
- "abs|abs2rel|absolute|accept|ACCEPTS|accessed|acos|acosec|acosech|acosh|"+
- "acotan|acotanh|acquire|act|action|actions|add|add_attribute|add_enum_value|"+
- "add_fallback|add_method|add_parent|add_private_method|add_role|add_trustee|"+
- "adverb|after|all|allocate|allof|allowed|alternative-names|annotations|antipair|"+
- "antipairs|any|anyof|app_lifetime|append|arch|archname|args|arity|asec|asech|"+
- "asin|asinh|ASSIGN-KEY|ASSIGN-POS|assuming|ast|at|atan|atan2|atanh|AT-KEY|"+
- "atomic-assign|atomic-dec-fetch|atomic-fetch|atomic-fetch-add|atomic-fetch-dec|"+
- "atomic-fetch-inc|atomic-fetch-sub|atomic-inc-fetch|AT-POS|attributes|auth|await|"+
- "backtrace|Bag|BagHash|base|basename|base-repeating|batch|BIND-KEY|BIND-POS|"+
- "bind-stderr|bind-stdin|bind-stdout|bind-udp|bits|bless|block|bool-only|"+
- "bounds|break|Bridge|broken|BUILD|build-date|bytes|cache|callframe|calling-package|"+
- "CALL-ME|callsame|callwith|can|cancel|candidates|cando|canonpath|caps|caption|"+
- "Capture|cas|catdir|categorize|categorize-list|catfile|catpath|cause|ceiling|"+
- "cglobal|changed|Channel|chars|chdir|child|child-name|child-typename|chmod|chomp|"+
- "chop|chr|chrs|chunks|cis|classify|classify-list|cleanup|clone|close|closed|"+
- "close-stdin|code|codes|collate|column|comb|combinations|command|comment|"+
- "compiler|Complex|compose|compose_type|composer|condition|config|configure_destroy|"+
- "configure_type_checking|conj|connect|constraints|construct|contains|contents|copy|"+
- "cos|cosec|cosech|cosh|cotan|cotanh|count|count-only|cpu-cores|cpu-usage|CREATE|"+
- "create_type|cross|cue|curdir|curupdir|d|Date|DateTime|day|daycount|day-of-month|"+
- "day-of-week|day-of-year|days-in-month|declaration|decode|decoder|deepmap|"+
- "defined|DEFINITE|delayed|DELETE-KEY|DELETE-POS|denominator|desc|DESTROY|destroyers|"+
- "devnull|did-you-mean|die|dir|dirname|dir-sep|DISTROnames|do|done|duckmap|dynamic|"+
- "e|eager|earlier|elems|emit|enclosing|encode|encoder|encoding|end|ends-with|enum_from_value|"+
- "enum_value_list|enum_values|enums|eof|EVAL|EVALFILE|exception|excludes-max|excludes-min|"+
- "EXISTS-KEY|EXISTS-POS|exit|exitcode|exp|expected|explicitly-manage|expmod|extension|f|"+
- "fail|fc|feature|file|filename|find_method|find_method_qualified|finish|first|flat|flatmap|"+
- "flip|floor|flush|fmt|format|formatter|freeze|from|from-list|from-loop|from-posix|full|"+
- "full-barrier|get|get_value|getc|gist|got|grab|grabpairs|grep|handle|handled|handles|"+
- "hardware|has_accessor|head|headers|hh-mm-ss|hidden|hides|hour|how|hyper|id|illegal|"+
- "im|in|indent|index|indices|indir|infinite|infix|install_method_cache|"+
- "Instant|instead|int-bounds|interval|in-timezone|invalid-str|invert|invocant|IO|"+
- "IO::Notification.watch-path|is_trusted|is_type|isa|is-absolute|is-hidden|is-initial-thread|"+
- "is-int|is-lazy|is-leap-year|isNaN|is-prime|is-relative|is-routine|is-setting|is-win|item|"+
- "iterator|join|keep|kept|KERNELnames|key|keyof|keys|kill|kv|kxxv|l|lang|last|lastcall|later|"+
- "lazy|lc|leading|level|line|lines|link|listen|live|local|lock|log|log10|lookup|lsb|"+
- "MAIN|match|max|maxpairs|merge|message|method_table|methods|migrate|min|minmax|"+
- "minpairs|minute|misplaced|Mix|MixHash|mkdir|mode|modified|month|move|mro|msb|multiness|"+
- "name|named|named_names|narrow|nativecast|native-descriptor|nativesizeof|new|new_type|"+
- "new-from-daycount|new-from-pairs|next|nextcallee|next-handle|nextsame|nextwith|NFC|NFD|"+
- "NFKC|NFKD|nl-in|nl-out|nodemap|none|norm|not|note|now|nude|numerator|Numeric|of|"+
- "offset|offset-in-hours|offset-in-minutes|old|on-close|one|on-switch|open|opened|"+
- "operation|optional|ord|ords|orig|os-error|osname|out-buffer|pack|package|package-kind|"+
- "package-name|packages|pair|pairs|pairup|parameter|params|parent|parent-name|parents|parse|"+
- "parse-base|parsefile|parse-names|parts|path|path-sep|payload|peer-host|peer-port|periods|"+
- "perl|permutations|phaser|pick|pickpairs|pid|placeholder|plus|polar|poll|polymod|pop|pos|"+
- "positional|posix|postfix|postmatch|precomp-ext|precomp-target|pred|prefix|prematch|prepend|"+
- "print|printf|print-nl|print-to|private|private_method_table|proc|produce|Promise|prompt|"+
- "protect|pull-one|push|push-all|push-at-least|push-exactly|push-until-lazy|put|"+
- "qualifier-type|quit|r|race|radix|rand|range|raw|re|read|readchars|readonly|"+
- "ready|Real|reallocate|reals|reason|rebless|receive|recv|redispatcher|redo|reduce|"+
- "rel2abs|relative|release|rename|repeated|replacement|report|reserved|resolve|"+
- "restore|result|resume|rethrow|reverse|right|rindex|rmdir|roles_to_compose|"+
- "rolish|roll|rootdir|roots|rotate|rotor|round|roundrobin|routine-type|run|rwx|s|"+
- "samecase|samemark|samewith|say|schedule-on|scheduler|scope|sec|sech|second|seek|"+
- "self|send|Set|set_hidden|set_name|set_package|set_rw|set_value|SetHash|"+
- "set-instruments|setup_finalization|shape|share|shell|shift|sibling|sigil|"+
- "sign|signal|signals|signature|sin|sinh|sink|sink-all|skip|skip-at-least|"+
- "skip-at-least-pull-one|skip-one|sleep|sleep-timer|sleep-until|Slip|slurp|"+
- "slurp-rest|slurpy|snap|snapper|so|socket-host|socket-port|sort|source|"+
- "source-package|spawn|SPEC|splice|split|splitdir|splitpath|sprintf|spurt|"+
- "sqrt|squish|srand|stable|start|started|starts-with|status|stderr|stdout|"+
- "sub_signature|subbuf|subbuf-rw|subname|subparse|subst|subst-mutate|"+
- "substr|substr-eq|substr-rw|succ|sum|Supply|symlink|t|tail|take|take-rw|"+
- "tan|tanh|tap|target|target-name|tc|tclc|tell|then|throttle|throw|timezone|"+
- "tmpdir|to|today|toggle|to-posix|total|trailing|trans|tree|trim|trim-leading|"+
- "trim-trailing|truncate|truncated-to|trusts|try_acquire|trying|twigil|type|"+
- "type_captures|typename|uc|udp|uncaught_handler|unimatch|uniname|uninames|"+
- "uniparse|uniprop|uniprops|unique|unival|univals|unlink|unlock|unpack|unpolar|"+
- "unshift|unwrap|updir|USAGE|utc|val|value|values|VAR|variable|verbose-config|"+
- "version|VMnames|volume|vow|w|wait|warn|watch|watch-path|week|weekday-of-month|"+
- "week-number|week-year|WHAT|WHERE|WHEREFORE|WHICH|WHO|whole-second|WHY|"+
- "wordcase|words|workaround|wrap|write|write-to|yada|year|yield|yyyy-mm-dd|"+
- "z|zip|zip-latest|"+
- "plan|done-testing|bail-out|todo|skip|skip-rest|diag|subtest|pass|flunk|ok|"+
- "nok|cmp-ok|is-deeply|isnt|is-approx|like|unlike|use-ok|isa-ok|does-ok|"+
- "can-ok|dies-ok|lives-ok|eval-dies-ok|eval-lives-ok|throws-like|fails-like|"+
- "rw|required|native|repr|export|symbol"
- );
- var constants_ascii = ("pi|Inf|tau|time");
-
- var ops_txt = ("eq|ne|gt|lt|le|ge|div|gcd|lcm|leg|cmp|ff|fff|"+
- "x|before|after|Z|X|and|or|andthen|notandthen|orelse|xor"
- );
-
- var keywordMapper = this.createKeywordMapper({
- "keyword": keywords,
- "storage.type" : types,
- "constant.language": constants_ascii,
- "support.function": builtinFunctions,
- "keyword.operator": ops_txt
- }, "identifier");
-
- // regexp must not have capturing parentheses. Use (?:) instead.
- // regexps are ordered -> the first match is used
-
- var moduleName = "[a-zA-Z_][a-zA-Z_0-9:-]*\\b";
-
- // Common rules used in the start block and in qqstrings and in qq-heredocs for interpolation
-
- // Numbers - Hexadecimal
- var hex = { token : "constant.numeric", regex : "0x[0-9a-fA-F]+\\b" };
- // Numbers - Num & Rat
- var num_rat = { token : "constant.numeric", regex : "[+-.]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" };
- // Numbers - With _
- var num_with_ = { token : "constant.numeric", regex : "(?:\\d+_?\\d+)+\\b" };
- // Numbers - Complex
- var complex_numbers = { token : "constant.numeric", regex : "\\+?\\d+i\\b" };
- // Booleans
- var booleans = { token : "constant.language.boolean", regex : "(?:True|False)\\b" };
- // Versions
- var versions = { token : "constant.other", regex : "v[0-9](?:\\.[a-zA-Z0-9*])*\\b" };
- // Keywords
- var lang_keywords = { token : keywordMapper, regex : "[a-zA-Z][\\:a-zA-Z0-9_-]*\\b" };
- // Variables - also matches $_ and $1 $2 (regex match) etc.
- var variables = { token : "variable.language", regex : "[$@%&][?*!.]?[a-zA-Z0-9_-]+\\b" };
- // Special variables - matches $ $/ $! and @$/
- var vars_special = { token: "variable.language", regex : "\\$[/|!]?|@\\$/" };
- // Operators characters
- var ops_char = { token : "keyword.operator", regex : "=|<|>|\\+|\\*|-|/|~|%|\\?|!|\\^|\\.|\\:|\\,|"+
- "»|«|\\||\\&|⚛|∘" };
- // Unicode Constants
- var constants_unicode = { token : "constant.language", regex : "𝑒|π|τ|∞" };
- // qstrings
- var qstrings = { token : "string.quoted.single", regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" };
- // Word Quoting
- var word_quoting = { token : "string.quoted.single", regex : "[<](?:[a-zA-Z0-9 ])*[>]"};
- //Regexp
- var regexp = {
- token : "string.regexp",
- regex : "[m|rx]?[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" };
-
-
- this.$rules = {
- "start" : [
- {
- token : "comment.block", // Embedded Comments - Parentheses
- regex : "#[`|=]\\(.*\\)"
- }, {
- token : "comment.block", // Embedded Comments - Brackets
- regex : "#[`|=]\\[.*\\]"
- }, {
- token : "comment.doc", // Multiline Comments
- regex : "^=(?:begin)\\b",
- next : "block_comment"
- }, {
- token : "string.unquoted", // q Heredocs
- regex : "q[x|w]?\\:to/END/;",
- next : "qheredoc"
- }, {
- token : "string.unquoted", // qq Heredocs
- regex : "qq[x|w]?\\:to/END/;",
- next : "qqheredoc"
- },
- regexp,
- qstrings
- , {
- token : "string.quoted.double", // Double Quoted String
- regex : '"',
- next : "qqstring"
- },
- word_quoting
- , {
- token: ["keyword", "text", "variable.module"], // use - Module Names, Pragmas, etc.
- regex: "(use)(\\s+)((?:"+moduleName+"\\.?)*)"
- },
- hex,
- num_rat,
- num_with_,
- complex_numbers,
- booleans,
- versions,
- lang_keywords,
- variables,
- vars_special,
- ops_char,
- constants_unicode
- , {
- token : "comment", // Sigle Line Comments
- regex : "#.*$"
- }, {
- token : "lparen",
- regex : "[[({]"
- }, {
- token : "rparen",
- regex : "[\\])}]"
- }, {
- token : "text",
- regex : "\\s+"
- }
- ],
- "qqstring" : [
- {
- token : "constant.language.escape",
- regex : '\\\\(?:[nrtef\\\\"$]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2})'
- },
- variables,
- vars_special
- , {
- token : "lparen",
- regex : "{",
- next : "qqinterpolation"
- }, {
- token : "string.quoted.double",
- regex : '"',
- next : "start"
- }, {
- defaultToken : "string.quoted.double"
- }
- ],
- "qqinterpolation" : [
- hex,
- num_rat,
- num_with_,
- complex_numbers,
- booleans,
- versions,
- lang_keywords,
- variables,
- vars_special,
- ops_char,
- constants_unicode,
- qstrings,
- regexp,
-
- {
- token: "rparen",
- regex: "}",
- next : "qqstring"
- }
- ],
- "block_comment": [
- {
- token: "comment.doc",
- regex: "^=end +[a-zA-Z_0-9]*",
- next: "start"
- },
- {
- defaultToken: "comment.doc"
- }
- ],
- "qheredoc": [
- {
- token: "string.unquoted",
- regex: "END$",
- next: "start"
- }, {
- defaultToken: "string.unquoted"
- }
- ],
- "qqheredoc": [
- variables,
- vars_special,
- {
- token : "lparen",
- regex : "{",
- next : "qqheredocinterpolation"
- }, {
- token: "string.unquoted",
- regex: "END$",
- next: "start"
- }, {
- defaultToken: "string.unquoted"
- }
- ],
- "qqheredocinterpolation" : [
- hex,
- num_rat,
- num_with_,
- complex_numbers,
- booleans,
- versions,
- lang_keywords,
- variables,
- vars_special,
- ops_char,
- constants_unicode,
- qstrings,
- regexp,
- {
- token: "rparen",
- regex: "}",
- next : "qqheredoc"
- }
- ]
- };
-};
-
-oop.inherits(Perl6HighlightRules, TextHighlightRules);
-
-exports.Perl6HighlightRules = Perl6HighlightRules;
-});
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Ajax.org B.V. nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var Perl6HighlightRules = function() {
+
+ var keywords = (
+ "my|our|class|role|grammar|is|does|sub|method|submethod|try|" +
+ "default|when|if|elsif|else|unless|with|orwith|without|for|given|proceed|" +
+ "succeed|loop|while|until|repeat|module|use|need|import|require|unit|" +
+ "constant|enum|multi|return|has|token|rule|make|made|proto|state|augment|" +
+ "but|anon|supersede|let|subset|gather|returns|return-rw|temp|" +
+ "BEGIN|CHECK|INIT|END|CLOSE|ENTER|LEAVE|KEEP|UNDO|PRE|POST|FIRST|NEXT|LAST|CATCH|CONTROL|QUIT|DOC"
+ );
+
+ var types = (
+ "Any|Array|Associative|AST|atomicint|Attribute|Backtrace|Backtrace::Frame|" +
+ "Bag|Baggy|BagHash|Blob|Block|Bool|Buf|Callable|CallFrame|Cancellation|" +
+ "Capture|Channel|Code|compiler|Complex|ComplexStr|Cool|CurrentThreadScheduler|" +
+ "Cursor|Date|Dateish|DateTime|Distro|Duration|Encoding|Exception|Failure|"+
+ "FatRat|Grammar|Hash|HyperWhatever|Instant|Int|IntStr|IO|IO::ArgFiles|"+
+ "IO::CatHandle|IO::Handle|IO::Notification|IO::Path|IO::Path::Cygwin|"+
+ "IO::Path::QNX|IO::Path::Unix|IO::Path::Win32|IO::Pipe|IO::Socket|"+
+ "IO::Socket::Async|IO::Socket::INET|IO::Spec|IO::Spec::Cygwin|IO::Spec::QNX|"+
+ "IO::Spec::Unix|IO::Spec::Win32|IO::Special|Iterable|Iterator|Junction|Kernel|"+
+ "Label|List|Lock|Lock::Async|Macro|Map|Match|Metamodel::AttributeContainer|"+
+ "Metamodel::C3MRO|Metamodel::ClassHOW|Metamodel::EnumHOW|Metamodel::Finalization|"+
+ "Metamodel::MethodContainer|Metamodel::MROBasedMethodDispatch|Metamodel::MultipleInheritance|"+
+ "Metamodel::Naming|Metamodel::Primitives|Metamodel::PrivateMethodContainer|"+
+ "Metamodel::RoleContainer|Metamodel::Trusting|Method|Mix|MixHash|Mixy|Mu|"+
+ "NFC|NFD|NFKC|NFKD|Nil|Num|Numeric|NumStr|ObjAt|Order|Pair|Parameter|Perl|"+
+ "Pod::Block|Pod::Block::Code|Pod::Block::Comment|Pod::Block::Declarator|"+
+ "Pod::Block::Named|Pod::Block::Para|Pod::Block::Table|Pod::Heading|Pod::Item|"+
+ "Positional|PositionalBindFailover|Proc|Proc::Async|Promise|Proxy|PseudoStash|"+
+ "QuantHash|Range|Rat|Rational|RatStr|Real|Regex|Routine|Scalar|Scheduler|"+
+ "Semaphore|Seq|Set|SetHash|Setty|Signature|Slip|Stash|Str|StrDistance|Stringy|"+
+ "Sub|Submethod|Supplier|Supplier::Preserving|Supply|Systemic|Tap|Telemetry|"+
+ "Telemetry::Instrument::Thread|Telemetry::Instrument::Usage|Telemetry::Period|"+
+ "Telemetry::Sampler|Thread|ThreadPoolScheduler|UInt|Uni|utf8|Variable|Version|"+
+ "VM|Whatever|WhateverCode|WrapHandle|int|uint|num|str|"+
+ "int8|int16|int32|int64|uint8|uint16|uint32|uint64|long|longlong|num32|num64|size_t|bool|CArray|Pointer|"+
+ "Backtrace|Backtrace::Frame|Exception|Failure|X::AdHoc|X::Anon::Augment|X::Anon::Multi|"+
+ "X::Assignment::RO|X::Attribute::NoPackage|X::Attribute::Package|X::Attribute::Undeclared|"+
+ "X::Augment::NoSuchType|X::Bind|X::Bind::NativeType|X::Bind::Slice|X::Caller::NotDynamic|"+
+ "X::Channel::ReceiveOnClosed|X::Channel::SendOnClosed|X::Comp|X::Composition::NotComposable|"+
+ "X::Constructor::Positional|X::ControlFlow|X::ControlFlow::Return|X::DateTime::TimezoneClash|"+
+ "X::Declaration::Scope|X::Declaration::Scope::Multi|X::Does::TypeObject|X::Eval::NoSuchLang|"+
+ "X::Export::NameClash|X::IO|X::IO::Chdir|X::IO::Chmod|X::IO::Copy|X::IO::Cwd|X::IO::Dir|"+
+ "X::IO::DoesNotExist|X::IO::Link|X::IO::Mkdir|X::IO::Move|X::IO::Rename|X::IO::Rmdir|X::IO::Symlink|"+
+ "X::IO::Unlink|X::Inheritance::NotComposed|X::Inheritance::Unsupported|X::Method::InvalidQualifier|"+
+ "X::Method::NotFound|X::Method::Private::Permission|X::Method::Private::Unqualified|"+
+ "X::Mixin::NotComposable|X::NYI|X::NoDispatcher|X::Numeric::Real|X::OS|X::Obsolete|X::OutOfRange|"+
+ "X::Package::Stubbed|X::Parameter::Default|X::Parameter::MultipleTypeConstraints|"+
+ "X::Parameter::Placeholder|X::Parameter::Twigil|X::Parameter::WrongOrder|X::Phaser::Multiple|"+
+ "X::Phaser::PrePost|X::Placeholder::Block|X::Placeholder::Mainline|X::Pod|X::Proc::Async|"+
+ "X::Proc::Async::AlreadyStarted|X::Proc::Async::CharsOrBytes|X::Proc::Async::MustBeStarted|"+
+ "X::Proc::Async::OpenForWriting|X::Proc::Async::TapBeforeSpawn|X::Proc::Unsuccessful|"+
+ "X::Promise::CauseOnlyValidOnBroken|X::Promise::Vowed|X::Redeclaration|X::Role::Initialization|"+
+ "X::Seq::Consumed|X::Sequence::Deduction|X::Signature::NameClash|X::Signature::Placeholder|"+
+ "X::Str::Numeric|X::StubCode|X::Syntax|X::Syntax::Augment::WithoutMonkeyTyping|"+
+ "X::Syntax::Comment::Embedded|X::Syntax::Confused|X::Syntax::InfixInTermPosition|"+
+ "X::Syntax::Malformed|X::Syntax::Missing|X::Syntax::NegatedPair|X::Syntax::NoSelf|"+
+ "X::Syntax::Number::RadixOutOfRange|X::Syntax::P5|X::Syntax::Regex::Adverb|"+
+ "X::Syntax::Regex::SolitaryQuantifier|X::Syntax::Reserved|X::Syntax::Self::WithoutObject|"+
+ "X::Syntax::Signature::InvocantMarker|X::Syntax::Term::MissingInitializer|X::Syntax::UnlessElse|"+
+ "X::Syntax::Variable::Match|X::Syntax::Variable::Numeric|X::Syntax::Variable::Twigil|X::Temporal|"+
+ "X::Temporal::InvalidFormat|X::TypeCheck|X::TypeCheck::Assignment|X::TypeCheck::Binding|"+
+ "X::TypeCheck::Return|X::TypeCheck::Splice|X::Undeclared"
+ );
+
+ var builtinFunctions = (
+ "abs|abs2rel|absolute|accept|ACCEPTS|accessed|acos|acosec|acosech|acosh|"+
+ "acotan|acotanh|acquire|act|action|actions|add|add_attribute|add_enum_value|"+
+ "add_fallback|add_method|add_parent|add_private_method|add_role|add_trustee|"+
+ "adverb|after|all|allocate|allof|allowed|alternative-names|annotations|antipair|"+
+ "antipairs|any|anyof|app_lifetime|append|arch|archname|args|arity|asec|asech|"+
+ "asin|asinh|ASSIGN-KEY|ASSIGN-POS|assuming|ast|at|atan|atan2|atanh|AT-KEY|"+
+ "atomic-assign|atomic-dec-fetch|atomic-fetch|atomic-fetch-add|atomic-fetch-dec|"+
+ "atomic-fetch-inc|atomic-fetch-sub|atomic-inc-fetch|AT-POS|attributes|auth|await|"+
+ "backtrace|Bag|BagHash|base|basename|base-repeating|batch|BIND-KEY|BIND-POS|"+
+ "bind-stderr|bind-stdin|bind-stdout|bind-udp|bits|bless|block|bool-only|"+
+ "bounds|break|Bridge|broken|BUILD|build-date|bytes|cache|callframe|calling-package|"+
+ "CALL-ME|callsame|callwith|can|cancel|candidates|cando|canonpath|caps|caption|"+
+ "Capture|cas|catdir|categorize|categorize-list|catfile|catpath|cause|ceiling|"+
+ "cglobal|changed|Channel|chars|chdir|child|child-name|child-typename|chmod|chomp|"+
+ "chop|chr|chrs|chunks|cis|classify|classify-list|cleanup|clone|close|closed|"+
+ "close-stdin|code|codes|collate|column|comb|combinations|command|comment|"+
+ "compiler|Complex|compose|compose_type|composer|condition|config|configure_destroy|"+
+ "configure_type_checking|conj|connect|constraints|construct|contains|contents|copy|"+
+ "cos|cosec|cosech|cosh|cotan|cotanh|count|count-only|cpu-cores|cpu-usage|CREATE|"+
+ "create_type|cross|cue|curdir|curupdir|d|Date|DateTime|day|daycount|day-of-month|"+
+ "day-of-week|day-of-year|days-in-month|declaration|decode|decoder|deepmap|"+
+ "defined|DEFINITE|delayed|DELETE-KEY|DELETE-POS|denominator|desc|DESTROY|destroyers|"+
+ "devnull|did-you-mean|die|dir|dirname|dir-sep|DISTROnames|do|done|duckmap|dynamic|"+
+ "e|eager|earlier|elems|emit|enclosing|encode|encoder|encoding|end|ends-with|enum_from_value|"+
+ "enum_value_list|enum_values|enums|eof|EVAL|EVALFILE|exception|excludes-max|excludes-min|"+
+ "EXISTS-KEY|EXISTS-POS|exit|exitcode|exp|expected|explicitly-manage|expmod|extension|f|"+
+ "fail|fc|feature|file|filename|find_method|find_method_qualified|finish|first|flat|flatmap|"+
+ "flip|floor|flush|fmt|format|formatter|freeze|from|from-list|from-loop|from-posix|full|"+
+ "full-barrier|get|get_value|getc|gist|got|grab|grabpairs|grep|handle|handled|handles|"+
+ "hardware|has_accessor|head|headers|hh-mm-ss|hidden|hides|hour|how|hyper|id|illegal|"+
+ "im|in|indent|index|indices|indir|infinite|infix|install_method_cache|"+
+ "Instant|instead|int-bounds|interval|in-timezone|invalid-str|invert|invocant|IO|"+
+ "IO::Notification.watch-path|is_trusted|is_type|isa|is-absolute|is-hidden|is-initial-thread|"+
+ "is-int|is-lazy|is-leap-year|isNaN|is-prime|is-relative|is-routine|is-setting|is-win|item|"+
+ "iterator|join|keep|kept|KERNELnames|key|keyof|keys|kill|kv|kxxv|l|lang|last|lastcall|later|"+
+ "lazy|lc|leading|level|line|lines|link|listen|live|local|lock|log|log10|lookup|lsb|"+
+ "MAIN|match|max|maxpairs|merge|message|method_table|methods|migrate|min|minmax|"+
+ "minpairs|minute|misplaced|Mix|MixHash|mkdir|mode|modified|month|move|mro|msb|multiness|"+
+ "name|named|named_names|narrow|nativecast|native-descriptor|nativesizeof|new|new_type|"+
+ "new-from-daycount|new-from-pairs|next|nextcallee|next-handle|nextsame|nextwith|NFC|NFD|"+
+ "NFKC|NFKD|nl-in|nl-out|nodemap|none|norm|not|note|now|nude|numerator|Numeric|of|"+
+ "offset|offset-in-hours|offset-in-minutes|old|on-close|one|on-switch|open|opened|"+
+ "operation|optional|ord|ords|orig|os-error|osname|out-buffer|pack|package|package-kind|"+
+ "package-name|packages|pair|pairs|pairup|parameter|params|parent|parent-name|parents|parse|"+
+ "parse-base|parsefile|parse-names|parts|path|path-sep|payload|peer-host|peer-port|periods|"+
+ "perl|permutations|phaser|pick|pickpairs|pid|placeholder|plus|polar|poll|polymod|pop|pos|"+
+ "positional|posix|postfix|postmatch|precomp-ext|precomp-target|pred|prefix|prematch|prepend|"+
+ "print|printf|print-nl|print-to|private|private_method_table|proc|produce|Promise|prompt|"+
+ "protect|pull-one|push|push-all|push-at-least|push-exactly|push-until-lazy|put|"+
+ "qualifier-type|quit|r|race|radix|rand|range|raw|re|read|readchars|readonly|"+
+ "ready|Real|reallocate|reals|reason|rebless|receive|recv|redispatcher|redo|reduce|"+
+ "rel2abs|relative|release|rename|repeated|replacement|report|reserved|resolve|"+
+ "restore|result|resume|rethrow|reverse|right|rindex|rmdir|roles_to_compose|"+
+ "rolish|roll|rootdir|roots|rotate|rotor|round|roundrobin|routine-type|run|rwx|s|"+
+ "samecase|samemark|samewith|say|schedule-on|scheduler|scope|sec|sech|second|seek|"+
+ "self|send|Set|set_hidden|set_name|set_package|set_rw|set_value|SetHash|"+
+ "set-instruments|setup_finalization|shape|share|shell|shift|sibling|sigil|"+
+ "sign|signal|signals|signature|sin|sinh|sink|sink-all|skip|skip-at-least|"+
+ "skip-at-least-pull-one|skip-one|sleep|sleep-timer|sleep-until|Slip|slurp|"+
+ "slurp-rest|slurpy|snap|snapper|so|socket-host|socket-port|sort|source|"+
+ "source-package|spawn|SPEC|splice|split|splitdir|splitpath|sprintf|spurt|"+
+ "sqrt|squish|srand|stable|start|started|starts-with|status|stderr|stdout|"+
+ "sub_signature|subbuf|subbuf-rw|subname|subparse|subst|subst-mutate|"+
+ "substr|substr-eq|substr-rw|succ|sum|Supply|symlink|t|tail|take|take-rw|"+
+ "tan|tanh|tap|target|target-name|tc|tclc|tell|then|throttle|throw|timezone|"+
+ "tmpdir|to|today|toggle|to-posix|total|trailing|trans|tree|trim|trim-leading|"+
+ "trim-trailing|truncate|truncated-to|trusts|try_acquire|trying|twigil|type|"+
+ "type_captures|typename|uc|udp|uncaught_handler|unimatch|uniname|uninames|"+
+ "uniparse|uniprop|uniprops|unique|unival|univals|unlink|unlock|unpack|unpolar|"+
+ "unshift|unwrap|updir|USAGE|utc|val|value|values|VAR|variable|verbose-config|"+
+ "version|VMnames|volume|vow|w|wait|warn|watch|watch-path|week|weekday-of-month|"+
+ "week-number|week-year|WHAT|WHERE|WHEREFORE|WHICH|WHO|whole-second|WHY|"+
+ "wordcase|words|workaround|wrap|write|write-to|yada|year|yield|yyyy-mm-dd|"+
+ "z|zip|zip-latest|"+
+ "plan|done-testing|bail-out|todo|skip|skip-rest|diag|subtest|pass|flunk|ok|"+
+ "nok|cmp-ok|is-deeply|isnt|is-approx|like|unlike|use-ok|isa-ok|does-ok|"+
+ "can-ok|dies-ok|lives-ok|eval-dies-ok|eval-lives-ok|throws-like|fails-like|"+
+ "rw|required|native|repr|export|symbol"
+ );
+ var constants_ascii = ("pi|Inf|tau|time");
+
+ var ops_txt = ("eq|ne|gt|lt|le|ge|div|gcd|lcm|leg|cmp|ff|fff|"+
+ "x|before|after|Z|X|and|or|andthen|notandthen|orelse|xor"
+ );
+
+ var keywordMapper = this.createKeywordMapper({
+ "keyword": keywords,
+ "storage.type" : types,
+ "constant.language": constants_ascii,
+ "support.function": builtinFunctions,
+ "keyword.operator": ops_txt
+ }, "identifier");
+
+ // regexp must not have capturing parentheses. Use (?:) instead.
+ // regexps are ordered -> the first match is used
+
+ var moduleName = "[a-zA-Z_][a-zA-Z_0-9:-]*\\b";
+
+ // Common rules used in the start block and in qqstrings and in qq-heredocs for interpolation
+
+ // Numbers - Hexadecimal
+ var hex = { token : "constant.numeric", regex : "0x[0-9a-fA-F]+\\b" };
+ // Numbers - Num & Rat
+ var num_rat = { token : "constant.numeric", regex : "[+-.]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" };
+ // Numbers - With _
+ var num_with_ = { token : "constant.numeric", regex : "(?:\\d+_?\\d+)+\\b" };
+ // Numbers - Complex
+ var complex_numbers = { token : "constant.numeric", regex : "\\+?\\d+i\\b" };
+ // Booleans
+ var booleans = { token : "constant.language.boolean", regex : "(?:True|False)\\b" };
+ // Versions
+ var versions = { token : "constant.other", regex : "v[0-9](?:\\.[a-zA-Z0-9*])*\\b" };
+ // Keywords
+ var lang_keywords = { token : keywordMapper, regex : "[a-zA-Z][\\:a-zA-Z0-9_-]*\\b" };
+ // Variables - also matches $_ and $1 $2 (regex match) etc.
+ var variables = { token : "variable.language", regex : "[$@%&][?*!.]?[a-zA-Z0-9_-]+\\b" };
+ // Special variables - matches $ $/ $! and @$/
+ var vars_special = { token: "variable.language", regex : "\\$[/|!]?|@\\$/" };
+ // Operators characters
+ var ops_char = { token : "keyword.operator", regex : "=|<|>|\\+|\\*|-|/|~|%|\\?|!|\\^|\\.|\\:|\\,|"+
+ "»|«|\\||\\&|⚛|∘" };
+ // Unicode Constants
+ var constants_unicode = { token : "constant.language", regex : "𝑒|π|τ|∞" };
+ // qstrings
+ var qstrings = { token : "string.quoted.single", regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" };
+ // Word Quoting
+ var word_quoting = { token : "string.quoted.single", regex : "[<](?:[a-zA-Z0-9 ])*[>]"};
+ //Regexp
+ var regexp = {
+ token : "string.regexp",
+ regex : "[m|rx]?[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" };
+
+
+ this.$rules = {
+ "start" : [
+ {
+ token : "comment.block", // Embedded Comments - Parentheses
+ regex : "#[`|=]\\(.*\\)"
+ }, {
+ token : "comment.block", // Embedded Comments - Brackets
+ regex : "#[`|=]\\[.*\\]"
+ }, {
+ token : "comment.doc", // Multiline Comments
+ regex : "^=(?:begin)\\b",
+ next : "block_comment"
+ }, {
+ token : "string.unquoted", // q Heredocs
+ regex : "q[x|w]?\\:to/END/;",
+ next : "qheredoc"
+ }, {
+ token : "string.unquoted", // qq Heredocs
+ regex : "qq[x|w]?\\:to/END/;",
+ next : "qqheredoc"
+ },
+ regexp,
+ qstrings
+ , {
+ token : "string.quoted.double", // Double Quoted String
+ regex : '"',
+ next : "qqstring"
+ },
+ word_quoting
+ , {
+ token: ["keyword", "text", "variable.module"], // use - Module Names, Pragmas, etc.
+ regex: "(use)(\\s+)((?:"+moduleName+"\\.?)*)"
+ },
+ hex,
+ num_rat,
+ num_with_,
+ complex_numbers,
+ booleans,
+ versions,
+ lang_keywords,
+ variables,
+ vars_special,
+ ops_char,
+ constants_unicode
+ , {
+ token : "comment", // Sigle Line Comments
+ regex : "#.*$"
+ }, {
+ token : "lparen",
+ regex : "[[({]"
+ }, {
+ token : "rparen",
+ regex : "[\\])}]"
+ }, {
+ token : "text",
+ regex : "\\s+"
+ }
+ ],
+ "qqstring" : [
+ {
+ token : "constant.language.escape",
+ regex : '\\\\(?:[nrtef\\\\"$]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2})'
+ },
+ variables,
+ vars_special
+ , {
+ token : "lparen",
+ regex : "{",
+ next : "qqinterpolation"
+ }, {
+ token : "string.quoted.double",
+ regex : '"',
+ next : "start"
+ }, {
+ defaultToken : "string.quoted.double"
+ }
+ ],
+ "qqinterpolation" : [
+ hex,
+ num_rat,
+ num_with_,
+ complex_numbers,
+ booleans,
+ versions,
+ lang_keywords,
+ variables,
+ vars_special,
+ ops_char,
+ constants_unicode,
+ qstrings,
+ regexp,
+
+ {
+ token: "rparen",
+ regex: "}",
+ next : "qqstring"
+ }
+ ],
+ "block_comment": [
+ {
+ token: "comment.doc",
+ regex: "^=end +[a-zA-Z_0-9]*",
+ next: "start"
+ },
+ {
+ defaultToken: "comment.doc"
+ }
+ ],
+ "qheredoc": [
+ {
+ token: "string.unquoted",
+ regex: "END$",
+ next: "start"
+ }, {
+ defaultToken: "string.unquoted"
+ }
+ ],
+ "qqheredoc": [
+ variables,
+ vars_special,
+ {
+ token : "lparen",
+ regex : "{",
+ next : "qqheredocinterpolation"
+ }, {
+ token: "string.unquoted",
+ regex: "END$",
+ next: "start"
+ }, {
+ defaultToken: "string.unquoted"
+ }
+ ],
+ "qqheredocinterpolation" : [
+ hex,
+ num_rat,
+ num_with_,
+ complex_numbers,
+ booleans,
+ versions,
+ lang_keywords,
+ variables,
+ vars_special,
+ ops_char,
+ constants_unicode,
+ qstrings,
+ regexp,
+ {
+ token: "rparen",
+ regex: "}",
+ next : "qqheredoc"
+ }
+ ]
+ };
+};
+
+oop.inherits(Perl6HighlightRules, TextHighlightRules);
+
+exports.Perl6HighlightRules = Perl6HighlightRules;
+});
From 6b76ab850185b9c291c29611aa94a57e91732933 Mon Sep 17 00:00:00 2001
From: adrianbj
Date: Sun, 14 Oct 2018 17:39:22 +1000
Subject: [PATCH 0091/1293] Add `inc` to PHP and `latte` to Twig in modelist.js
---
lib/ace/ext/modelist.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/ace/ext/modelist.js b/lib/ace/ext/modelist.js
index 0fb21f61ac9..1e7bda15bd3 100644
--- a/lib/ace/ext/modelist.js
+++ b/lib/ace/ext/modelist.js
@@ -141,7 +141,7 @@ var supportedModes = {
Perl: ["pl|pm"],
pgSQL: ["pgsql"],
PHP_Laravel_blade: ["blade.php"],
- PHP: ["php|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"],
+ PHP: ["inc|php|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"],
Puppet: ["epp|pp"],
Pig: ["pig"],
Powershell: ["ps1"],
@@ -182,7 +182,7 @@ var supportedModes = {
Textile: ["textile"],
Toml: ["toml"],
TSX: ["tsx"],
- Twig: ["twig|swig"],
+ Twig: ["latte|twig|swig"],
Typescript: ["ts|typescript|str"],
Vala: ["vala"],
VBScript: ["vbs|vb"],
From 27cb7232f4b203389658253e4403735a78bb6cc2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michal=20Gr=C5=88o?=
Date: Sun, 21 Oct 2018 01:03:59 +0200
Subject: [PATCH 0092/1293] rename the undefined Position interface
---
ace.d.ts | 48 ++++++++++++++++++++++++------------------------
1 file changed, 24 insertions(+), 24 deletions(-)
diff --git a/ace.d.ts b/ace.d.ts
index 2acde9758cb..2aef4365868 100644
--- a/ace.d.ts
+++ b/ace.d.ts
@@ -2,7 +2,7 @@ export namespace Ace {
export type NewLineMode = 'auto' | 'unix' | 'windows';
export interface Anchor extends EventEmitter {
- getPosition(): Position;
+ getPosition(): Point;
getDocument(): Document;
setPosition(row: number, column: number, noClip?: boolean): void;
detach(): void;
@@ -22,24 +22,24 @@ export namespace Ace {
getAllLines(): string[];
getTextRange(range: Range): string;
getLinesForRange(range: Range): string[];
- insert(position: Position, text: string): Position;
- insertInLine(position: Position, text: string): Position;
+ insert(position: Point, text: string): Point;
+ insertInLine(position: Point, text: string): Point;
clippedPos(row: number, column: number): Point;
clonePos(pos: Point): Point;
pos(row: number, column: number): Point;
insertFullLines(row: number, lines: string[]): void;
- insertMergedLines(position: Position, lines: string[]): Point;
- remove(range: Range): Position;
- removeInLine(row: number, startColumn: number, endColumn: number): Position;
+ insertMergedLines(position: Point, lines: string[]): Point;
+ remove(range: Range): Point;
+ removeInLine(row: number, startColumn: number, endColumn: number): Point;
removeFullLines(firstRow: number, lastRow: number): string[];
removeNewLine(row: number): void;
- replace(range: Range, text: string): Position;
+ replace(range: Range, text: string): Point;
applyDeltas(deltas: Delta[]): void;
revertDeltas(deltas: Delta[]): void;
applyDelta(delta: Delta, doNotValidate?: boolean): void;
revertDelta(delta: Delta): void;
- indexToPosition(index: number, startRow: number): Position;
- positionToIndex(pos: Position, startRow?: number): number;
+ indexToPosition(index: number, startRow: number): Point;
+ positionToIndex(pos: Point, startRow?: number): number;
}
export interface FoldLine {
@@ -302,7 +302,7 @@ export namespace Ace {
toggleBlockComment(state: any,
session: EditSession,
range: Range,
- cursor: Position): void;
+ cursor: Point): void;
getNextLineIndent(state: any, line: string, tab: string): string;
checkOutdent(state: any, line: string, input: string): boolean;
autoOutdent(state: any, doc: Document, row: number): void;
@@ -317,7 +317,7 @@ export namespace Ace {
getKeywords(append?: boolean): Array;
getCompletions(state: string,
session: EditSession,
- pos: Position,
+ pos: Point,
prefix: string): Completion[];
}
@@ -392,7 +392,7 @@ export namespace Ace {
getUseSoftTabs(): boolean;
setTabSize(tabSize: number): void;
getTabSize(): number;
- isTabStop(position: Position): boolean;
+ isTabStop(position: Point): boolean;
setNavigateWithinSoftTabs(navigateWithinSoftTabs: boolean): void;
getNavigateWithinSoftTabs(): boolean;
setOverwrite(overwrite: boolean): void;
@@ -438,14 +438,14 @@ export namespace Ace {
getLines(firstRow: number, lastRow: number): string[];
getLength(): number;
getTextRange(range: Range): string;
- insert(position: Position, text: string): void;
+ insert(position: Point, text: string): void;
remove(range: Range): void;
removeFullLines(firstRow: number, lastRow: number): void;
undoChanges(deltas: Delta[], dontSelect?: boolean): void;
redoChanges(deltas: Delta[], dontSelect?: boolean): void;
setUndoSelect(enable: boolean): void;
replace(range: Range, text: string): void;
- moveText(fromRange: Range, toPosition: Position, copy?: boolean): void;
+ moveText(fromRange: Range, toPosition: Point, copy?: boolean): void;
indentRows(startRow: number, endRow: number, indentString: string): void;
outdentRows(range: Range): void;
moveLinesUp(firstRow: number, lastRow: number): void;
@@ -462,16 +462,16 @@ export namespace Ace {
getRowWrapIndent(screenRow: number): number;
getScreenLastRowColumn(screenRow: number): number;
getDocumentLastRowColumn(docRow: number, docColumn: number): number;
- getdocumentLastRowColumnPosition(docRow: number, docColumn: number): Position;
+ getdocumentLastRowColumnPosition(docRow: number, docColumn: number): Point;
getRowSplitData(row: number): string | undefined;
getScreenTabSize(screenColumn: number): number;
screenToDocumentRow(screenRow: number, screenColumn: number): number;
screenToDocumentColumn(screenRow: number, screenColumn: number): number;
screenToDocumentPosition(screenRow: number,
screenColumn: number,
- offsetX?: number): Position;
- documentToScreenPosition(docRow: number, docColumn: number): Position;
- documentToScreenPosition(position: Position): Position;
+ offsetX?: number): Point;
+ documentToScreenPosition(docRow: number, docColumn: number): Point;
+ documentToScreenPosition(position: Point): Point;
documentToScreenColumn(row: number, docColumn: number): number;
documentToScreenRow(docRow: number, docColumn: number): number;
getScreenLength(): number;
@@ -565,16 +565,16 @@ export namespace Ace {
updateCursor(): void;
hideCursor(): void;
showCursor(): void;
- scrollSelectionIntoView(anchor: Position,
- lead: Position,
+ scrollSelectionIntoView(anchor: Point,
+ lead: Point,
offset?: number): void;
- scrollCursorIntoView(cursor: Position, offset?: number): void;
+ scrollCursorIntoView(cursor: Point, offset?: number): void;
getScrollTop(): number;
getScrollLeft(): number;
getScrollTopRow(): number;
getScrollBottomRow(): number;
scrollToRow(row: number): void;
- alignCursor(cursor: Position | number, alignment: number): number;
+ alignCursor(cursor: Point | number, alignment: number): number;
scrollToLine(line: number,
center: boolean,
animate: boolean,
@@ -613,8 +613,8 @@ export namespace Ace {
isMultiLine(): boolean;
setCursor(row: number, column: number): void;
setAnchor(row: number, column: number): void;
- getAnchor(): Position;
- getCursor(): Position;
+ getAnchor(): Point;
+ getCursor(): Point;
isBackwards(): boolean;
getRange(): Range;
clearSelection(): void;
From 588dd80d9a236b54b1ee274fcd3213d9352e6ea7 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Tue, 23 Oct 2018 00:18:14 +0400
Subject: [PATCH 0093/1293] fix vim visual block mode on empty lines
---
lib/ace/keyboard/vim.js | 2 +-
lib/ace/keyboard/vim_ace_test.js | 119 +++++++++++++++++++++++++++++++
2 files changed, 120 insertions(+), 1 deletion(-)
diff --git a/lib/ace/keyboard/vim.js b/lib/ace/keyboard/vim.js
index c0d74c299b2..57a5f547403 100644
--- a/lib/ace/keyboard/vim.js
+++ b/lib/ace/keyboard/vim.js
@@ -6095,7 +6095,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
cm.curOp.cursorActivity = false;
}, true);
}
- if (isHandled && !vim.visualBlock && !vim.insert)
+ if (isHandled && !vim.visualMode && !vim.insert)
handleExternalSelection(cm, vim);
return isHandled;
}
diff --git a/lib/ace/keyboard/vim_ace_test.js b/lib/ace/keyboard/vim_ace_test.js
index 44126a2b055..0fbb54f67f9 100644
--- a/lib/ace/keyboard/vim_ace_test.js
+++ b/lib/ace/keyboard/vim_ace_test.js
@@ -48,6 +48,25 @@ function testSelection(editor, data) {
assert.equal(getSelection(editor) + "", data + "");
}
+function setSelection(editor, data) {
+ if (typeof data[0] == "number")
+ data = [data];
+ editor.selection.fromJSON(data.map(function(x) {
+ var start = {row: x[0], column: x[1]};
+ var end = x.length == 2 ? start : {row: x[2], column: x[3]};
+ var isBackwards = Range.comparePoints(start, end) > 0;
+ return isBackwards ? {
+ start: end,
+ end: start,
+ isBackwards: true
+ } : {
+ start: start,
+ end: end,
+ isBackwards: true
+ };
+ }));
+}
+
function getSelection(editor) {
var data = editor.multiSelect.toJSON();
if (!data.length) data = [data];
@@ -67,6 +86,10 @@ function getSelection(editor) {
return data.length > 1 ? data : data[0];
}
+function testValue(editor, value) {
+ assert.equal(editor.getValue(), value);
+}
+
function applyEvent(data) {
if (typeof data == "function")
return data();
@@ -161,6 +184,102 @@ module.exports = {
applyEvent(data);
});
assert.equal(editor.getValue(), "hello x\n\thello x");
+ },
+ "test: vim virtual selection": function() {
+ editor.setValue("hello world\n\thello world");
+ editor.execCommand("gotoend");
+ [
+ { _: "keydown", range: [12,12], value: "\thello world\n\n", key: { code: "ControlLeft", key: "Control", keyCode: 17}, modifier: "ctrl-"},
+ { _: "keydown", range: [12,12], value: "\thello world\n\n", key: { code: "AltLeft", key: "Alt", keyCode: 18}, modifier: "ctrl-alt-"},
+ { _: "keydown", range: [6,11], value: "hello world\n\n", key: { code: "KeyL", key: "fi", keyCode: 76}, modifier: "ctrl-alt-"},
+
+ { _: "keydown", range: [6,11], value: "hello world\n\n", key: { code: "KeyC", key: "c", keyCode: 67}},
+ { _: "input", range: [7,7], value: "hello c\n\n"},
+ { _: "keydown", range: [7,7], value: "hello c\n\n", key: { code: "KeyX", key: "x", keyCode: 88}},
+ { _: "input", range: [8,8], value: "hello cx\n\n"},
+ { _: "keydown", range: [6,6], value: "hello x\n\n", key: { code: "Escape", key: "Escape", keyCode: 27}},
+ { _: "keydown", range: [6,6], value: "hello x\n\n", key: { code: "ShiftLeft", key: "Shift", keyCode: 16}, modifier: "shift-"},
+ { _: "keydown", range: [6,6], value: "hello x\n\n", key: { code: "BracketRight", key: "Dead", keyCode: 229}, modifier: "shift-"},
+ { _: "compositionstart", range: [6,6], value: "hello x\n\n"},
+ { _: "compositionupdate", range: [6,6], value: "hello x\n\n"},
+ { _: "compositionend", range: [7,7], value: "hello ^x\n\n"},
+ { _: "input", range: [7,7], value: "hello ^x\n\n"},
+ function() {
+ testSelection(editor, [[0,0],[1,1]]);
+ },
+ { _: "keydown", range: [7,7], value: "hello ^x\n\n", key: { code: "Escape", key: "Escape", keyCode: 27}},
+ { _: "keydown", key: { code: "KeyH", key: "˛", keyCode: 72}, modifier: "ctrl-alt-"},
+
+ { _: "keydown", range: [1,6], value: "\thello x\n\n", key: { code: "AltRight", key: "Alt", keyCode: 18}, modifier: "alt-"},
+ { _: "keydown", range: [1,6], value: "\thello x\n\n", key: { code: "Digit4", key: "$", keyCode: 52}, modifier: "alt-"},
+
+ { _: "input", range: [2,2], value: "\t$ x\n\n"},
+ function() {
+ testSelection(editor, [[1,5,1,8], [0,4,0,7]]);
+ },
+ { _: "keydown", key: { code: "Escape", key: "Escape", keyCode: 27}},
+ function() {
+ testSelection(editor, [[1,7],[0,6]]);
+ },
+ { _: "keydown", key: { code: "Escape", key: "Escape", keyCode: 27}},
+
+ ].forEach(function(data) {
+ applyEvent(data);
+ });
+ assert.equal(editor.getValue(), "hello x\n\thello x");
+ },
+ "test: vim visual selection": function() {
+ editor.setValue("xxx\nccc\n\nzzz\nccc");
+ setSelection(editor, [2,0]);
+ [
+ { _: "input", range: [1,1], value: "V\n\n"},
+ { _: "keyup", range: [1,1], value: "V\n\n", key: { code: "KeyV", key: "V", keyCode: 86}, modifier: "shift-"},
+ { _: "keyup", range: [1,1], value: "V\n\n", key: { code: "ShiftLeft", key: "Shift", keyCode: 16}},
+ { _: "keydown", range: [1,1], value: "V\n\n", key: { code: "KeyK", key: "k", keyCode: 75}},
+ { _: "keypress", range: [1,1], value: "V\n\n", key: { code: "KeyK", key: "k", keyCode: 107}},
+ { _: "input", range: [2,2], value: "Vk\n\n"},
+ { _: "keyup", range: [2,2], value: "Vk\n\n", key: { code: "KeyK", key: "k", keyCode: 75}},
+ { _: "keydown", range: [2,2], value: "Vk\n\n", key: { code: "KeyC", key: "c", keyCode: 67}},
+ { _: "keypress", range: [2,2], value: "Vk\n\n", key: { code: "KeyC", key: "c", keyCode: 99}},
+ { _: "input", range: [3,3], value: "Vkc\n\n"},
+ { _: "keyup", range: [3,3], value: "Vkc\n\n", key: { code: "KeyC", key: "c", keyCode: 67}},
+ { _: "keydown", range: [3,3], value: "Vkc\n\n", key: { code: "KeyO", key: "o", keyCode: 79}},
+ { _: "keypress", range: [3,3], value: "Vkc\n\n", key: { code: "KeyO", key: "o", keyCode: 111}},
+ { _: "input", range: [4,4], value: "Vkco\n\n"},
+ { _: "keyup", range: [4,4], value: "Vkco\n\n", key: { code: "KeyO", key: "o", keyCode: 79}},
+ function() {
+ testValue(editor, "xxx\nozzz\nccc")
+ testSelection(editor, [1,1])
+ },
+ { _: "keydown", range: [0,0], value: "ozzz\n\n", key: { code: "Escape", key: "Escape", keyCode: 27}},
+ { _: "keyup", range: [0,0], value: "ozzz\n\n", key: { code: "Escape", key: "Escape", keyCode: 27}},
+ { _: "keydown", range: [0,0], value: "ozzz\n\n", key: { code: "ControlLeft", key: "Control", keyCode: 17}, modifier: "ctrl-"},
+
+ { _: "keydown", range: [0,1], value: "ozzz\n\n", key: { code: "KeyV", key: "v", keyCode: 86}, modifier: "ctrl-"},
+ { _: "select", range: [0,1], value: "ozzz\n\n"},
+ { _: "keyup", range: [0,1], value: "ozzz\n\n", key: { code: "KeyV", key: "v", keyCode: 86}, modifier: "ctrl-"},
+ { _: "keyup", range: [0,1], value: "ozzz\n\n", key: { code: "ControlLeft", key: "Control", keyCode: 17}},
+
+ { _: "keydown", range: [0,1], value: "ccc\n\n", key: { code: "ArrowDown", key: "ArrowDown", keyCode: 40}},
+ { _: "select", range: [0,1], value: "ccc\n\n"},
+ { _: "keyup", range: [0,1], value: "ccc\n\n", key: { code: "ArrowDown", key: "ArrowDown", keyCode: 40}},
+ function() {
+ testValue(editor, "xxx\nozzz\nccc")
+ testSelection(editor, [[2,0,2,1],[1,0,1,1]])
+ },
+ { _: "keydown", range: [0,1], value: "ccc\n\n", key: { code: "Period", key: ".", keyCode: 190}},
+ { _: "keypress", range: [0,1], value: "ccc\n\n", key: { code: "Period", key: ".", keyCode: 46}},
+
+ { _: "input", range: [1,1], value: ".cc\n\n"},
+ { _: "keyup", range: [1,1], value: ".cc\n\n", key: { code: "Period", key: ".", keyCode: 190}},
+ function() {
+ testValue(editor, "xxx\no");
+ testSelection(editor, [1,0]);
+ }
+ ].forEach(function(data) {
+ applyEvent(data);
+ });
+
}
};
From 7578e158c1f8636bf6f3594f7bbf24dc6b2c1857 Mon Sep 17 00:00:00 2001
From: Fin Christensen
Date: Wed, 24 Oct 2018 18:32:16 +0200
Subject: [PATCH 0094/1293] Add Editor to ace exports
---
lib/ace/ace.js | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/ace/ace.js b/lib/ace/ace.js
index d65162e43b3..008288eaddd 100644
--- a/lib/ace/ace.js
+++ b/lib/ace/ace.js
@@ -3,7 +3,7 @@
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
@@ -14,7 +14,7 @@
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -120,7 +120,7 @@ exports.edit = function(el, options) {
* Creates a new [[EditSession]], and returns the associated [[Document]].
* @param {Document | String} text {:textParam}
* @param {TextMode} mode {:modeParam}
- *
+ *
**/
exports.createEditSession = function(text, mode) {
var doc = new EditSession(text, mode);
@@ -128,6 +128,7 @@ exports.createEditSession = function(text, mode) {
return doc;
};
exports.Range = Range;
+exports.Editor = Editor;
exports.EditSession = EditSession;
exports.UndoManager = UndoManager;
exports.VirtualRenderer = Renderer;
From 75d4617a4a9bed1ef258a52949250c44bc1a3d85 Mon Sep 17 00:00:00 2001
From: Nathan Whetsell
Date: Thu, 25 Oct 2018 10:28:09 -0400
Subject: [PATCH 0095/1293] Update for Csound 6.12.0
---
.../mode/csound_orchestra_highlight_rules.js | 38 ++++++++++---------
1 file changed, 21 insertions(+), 17 deletions(-)
diff --git a/lib/ace/mode/csound_orchestra_highlight_rules.js b/lib/ace/mode/csound_orchestra_highlight_rules.js
index 346bd565440..ca64d31dbd4 100644
--- a/lib/ace/mode/csound_orchestra_highlight_rules.js
+++ b/lib/ace/mode/csound_orchestra_highlight_rules.js
@@ -121,6 +121,8 @@ var CsoundOrchestraHighlightRules = function() {
"MixerSend",
"MixerSetLevel",
"MixerSetLevel_i",
+ "OSCbundle",
+ "OSCcount",
"OSCinit",
"OSCinitM",
"OSClisten",
@@ -181,6 +183,8 @@ var CsoundOrchestraHighlightRules = function() {
"barmodel",
"bbcutm",
"bbcuts",
+ "beadsynt",
+ "beosc",
"betarand",
"bexprnd",
"bformdec1",
@@ -190,8 +194,8 @@ var CsoundOrchestraHighlightRules = function() {
"biquada",
"birnd",
"bpf",
+ "bpfcos",
"bqrez",
- "buchla",
"butbp",
"butbr",
"buthp",
@@ -295,6 +299,7 @@ var CsoundOrchestraHighlightRules = function() {
"dconv",
"dct",
"dctinv",
+ "deinterleave",
"delay",
"delay1",
"delayk",
@@ -358,7 +363,9 @@ var CsoundOrchestraHighlightRules = function() {
"faustaudio",
"faustcompile",
"faustctl",
+ "faustdsp",
"faustgen",
+ "faustplay",
"fft",
"fftinv",
"ficlose",
@@ -380,16 +387,6 @@ var CsoundOrchestraHighlightRules = function() {
"flooper",
"flooper2",
"floor",
- "fluidAllOut",
- "fluidCCi",
- "fluidCCk",
- "fluidControl",
- "fluidEngine",
- "fluidLoad",
- "fluidNote",
- "fluidOut",
- "fluidProgramSelect",
- "fluidSetInterpMethod",
"fmanal",
"fmax",
"fmb3",
@@ -420,6 +417,7 @@ var CsoundOrchestraHighlightRules = function() {
"fractalnoise",
"framebuffer",
"freeverb",
+ "ftaudio",
"ftchnls",
"ftconv",
"ftcps",
@@ -433,11 +431,13 @@ var CsoundOrchestraHighlightRules = function() {
"ftlptim",
"ftmorf",
"ftom",
+ "ftprint",
"ftresize",
"ftresizei",
"ftsamplebank",
"ftsave",
"ftsavek",
+ "ftslice",
"ftsr",
"gain",
"gainslider",
@@ -454,6 +454,7 @@ var CsoundOrchestraHighlightRules = function() {
"getcol",
"getftargs",
"getrow",
+ "getrowlin",
"getseed",
"gogobel",
"grain",
@@ -509,6 +510,7 @@ var CsoundOrchestraHighlightRules = function() {
"insremot",
"int",
"integ",
+ "interleave",
"interp",
"invalue",
"inx",
@@ -703,6 +705,7 @@ var CsoundOrchestraHighlightRules = function() {
"lfo",
"limit",
"limit1",
+ "lincos",
"line",
"linen",
"linenr",
@@ -837,11 +840,6 @@ var CsoundOrchestraHighlightRules = function() {
"mp3len",
"mp3nchnls",
"mp3scal",
- "mp3scal_check",
- "mp3scal_load",
- "mp3scal_load2",
- "mp3scal_play",
- "mp3scal_play2",
"mp3sr",
"mpulse",
"mrtmsg",
@@ -988,6 +986,7 @@ var CsoundOrchestraHighlightRules = function() {
"prepiano",
"print",
"print_type",
+ "printarray",
"printf",
"printf_i",
"printk",
@@ -1166,6 +1165,7 @@ var CsoundOrchestraHighlightRules = function() {
"remoteport",
"remove",
"repluck",
+ "reshapearray",
"reson",
"resonk",
"resonr",
@@ -1244,7 +1244,6 @@ var CsoundOrchestraHighlightRules = function() {
"shaker",
"shiftin",
"shiftout",
- "signalflowgraph",
"signum",
"sin",
"sinh",
@@ -1252,6 +1251,7 @@ var CsoundOrchestraHighlightRules = function() {
"sinsyn",
"sleighbells",
"slicearray",
+ "slicearray_i",
"slider16",
"slider16f",
"slider16table",
@@ -1333,6 +1333,7 @@ var CsoundOrchestraHighlightRules = function() {
"system",
"system_i",
"tab",
+ "tab2array",
"tab2pvs",
"tab_i",
"tabifd",
@@ -1367,6 +1368,7 @@ var CsoundOrchestraHighlightRules = function() {
"tabmorphi",
"tabplay",
"tabrec",
+ "tabrowlin",
"tabsum",
"tabw",
"tabw_i",
@@ -1400,6 +1402,8 @@ var CsoundOrchestraHighlightRules = function() {
"trhighest",
"trigger",
"trigseq",
+ "trim",
+ "trim_i",
"trirand",
"trlowest",
"trmix",
From 3655565932bd4b535706308224b893131d6839f8 Mon Sep 17 00:00:00 2001
From: 43081j <43081j@users.noreply.github.com>
Date: Thu, 1 Nov 2018 17:51:07 +0000
Subject: [PATCH 0096/1293] fix lucene catastrophic backtrack
---
lib/ace/mode/lucene_highlight_rules.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/ace/mode/lucene_highlight_rules.js b/lib/ace/mode/lucene_highlight_rules.js
index 606b305d831..5c1c39be90f 100644
--- a/lib/ace/mode/lucene_highlight_rules.js
+++ b/lib/ace/mode/lucene_highlight_rules.js
@@ -37,7 +37,7 @@ var LuceneHighlightRules = function() {
regex: "[\\)\\}\\]]"
}, {
token: "keyword",
- regex: "(?:[^\\s:]+|\\\\ )*[^\\\\]:"
+ regex: "(?:\\\\.|[^\\s:\\\\])+:"
}, {
token: "string", // " string
regex: '"(?:\\\\"|[^"])*"'
From 7ec3f344b6169abc08af18d306d416b2bffec546 Mon Sep 17 00:00:00 2001
From: SjonHortensius
Date: Thu, 8 Nov 2018 13:43:21 +0100
Subject: [PATCH 0097/1293] Update list of PHP keywords
Generated using a variation of:
```bash
curl -s http://php.net/manual/en/reserved.keywords.php|grep -A999 doctable|grep -B999 /table|grep -v 'td>'|grep -o '>[^<]*'|grep -v '()'|cut -d\> -f2|cut -d\< -f1|tr '\n' '|'
```
---
lib/ace/mode/php_highlight_rules.js | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/ace/mode/php_highlight_rules.js b/lib/ace/mode/php_highlight_rules.js
index 51bbc9dfc69..829f99564cf 100644
--- a/lib/ace/mode/php_highlight_rules.js
+++ b/lib/ace/mode/php_highlight_rules.js
@@ -850,18 +850,18 @@ ziparchive_unchangeindex|ziparchive_unchangename|zlib_get_coding_type'.split('|'
// http://php.net/manual/en/reserved.keywords.php
var keywords = lang.arrayToMap(
-'abstract|and|array|as|break|case|catch|class|clone|const|continue|declare|default|do|else|elseif|enddeclare|endfor|endforeach|endif|\
-endswitch|endwhile|extends|final|for|foreach|function|global|goto|if|implements|interface|instanceof|namespace|new|or|private|protected|\
-public|static|switch|throw|trait|try|use|var|while|xor'.split('|')
+'abstract|and|array|as|break|callable|case|catch|class|clone|const|continue|declare|default|do|else|elseif|enddeclare|endfor|endforeach|\
+endif|endswitch|endwhile|extends|final|finally|for|foreach|function|global|goto|if|implements|instanceof|insteadof|interface|namespace|new|or|private|protected|\
+public|static|switch|throw|trait|try|use|var|while|xor|yield'.split('|')
);
// http://php.net/manual/en/reserved.keywords.php
var languageConstructs = lang.arrayToMap(
- ('die|echo|empty|exit|eval|include|include_once|isset|list|require|require_once|return|print|unset').split('|')
+ ('__halt_compiler|die|echo|empty|exit|eval|include|include_once|isset|list|require|require_once|return|print|unset').split('|')
);
var builtinConstants = lang.arrayToMap(
- ('true|TRUE|false|FALSE|null|NULL|__CLASS__|__DIR__|__FILE__|__LINE__|__METHOD__|__FUNCTION__|__NAMESPACE__').split('|')
+ ('true|TRUE|false|FALSE|null|NULL|__CLASS__|__DIR__|__FILE__|__LINE__|__METHOD__|__FUNCTION__|__NAMESPACE__|__TRAIT__').split('|')
);
var builtinVariables = lang.arrayToMap(
From db9efaa41085cd47cc0de827031b8a9be15bff60 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Sat, 10 Nov 2018 03:07:44 +0400
Subject: [PATCH 0098/1293] fix issue with empty lines in static highlight
---
lib/ace/ext/static.css | 1 +
lib/ace/ext/static_highlight.js | 1 +
lib/ace/ext/static_highlight_test.js | 22 ++++++++++++----------
3 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/lib/ace/ext/static.css b/lib/ace/ext/static.css
index 51986c3f2f3..8a898b09d85 100644
--- a/lib/ace/ext/static.css
+++ b/lib/ace/ext/static.css
@@ -9,6 +9,7 @@
text-align: right;
padding: 0 3px 0 0;
margin-right: 3px;
+ contain: none;
}
.ace_static_highlight.ace_show_gutter .ace_line {
diff --git a/lib/ace/ext/static_highlight.js b/lib/ace/ext/static_highlight.js
index 43f7d1cffc0..02a437780db 100644
--- a/lib/ace/ext/static_highlight.js
+++ b/lib/ace/ext/static_highlight.js
@@ -236,6 +236,7 @@ highlight.renderSync = function(input, mode, theme, lineStart, disableGutter) {
lineEl.appendChild(gutterEl);
}
textLayer.$renderLine(lineEl, ix, false);
+ lineEl.textContent += "\n";
innerEl.appendChild(lineEl);
}
diff --git a/lib/ace/ext/static_highlight_test.js b/lib/ace/ext/static_highlight_test.js
index fa29e6bb07f..467b682ff29 100644
--- a/lib/ace/ext/static_highlight_test.js
+++ b/lib/ace/ext/static_highlight_test.js
@@ -31,6 +31,7 @@ module.exports = {
"/** this is a function",
"*",
"*/",
+ "",
"function hello (a, b, c) {",
" console.log(a * b + c + 'sup$');",
" //",
@@ -40,14 +41,15 @@ module.exports = {
var mode = new JavaScriptMode();
var result = highlighter.render(snippet, mode, theme);
assert.equal(result.html, ""
- + "
"
- + "
"
- + "
"
- + "
function hello ( a , b , c ) {
"
- + "
console . log ( a * b + c + 'sup$' ) ;
"
- + "
"
- + "
"
- + "
}
"
+ + "
\n
"
+ + "
\n
"
+ + "
\n
"
+ + "
\n
"
+ + "
function hello ( a , b , c ) { \n
"
+ + "
console . log ( a * b + c + 'sup$' ) ; \n
"
+ + "
\n
"
+ + "
\n
"
+ + "
} \n
"
+ "
");
assert.ok(!!result.css);
next();
@@ -96,7 +98,7 @@ module.exports = {
var mode = new TextMode();
var result = highlighter.render(snippet, mode, theme);
- assert.ok(result.html.indexOf("$'$1$2$$$& ") != -1);
+ assert.ok(result.html.indexOf("$'$1$2$$$&\n") != -1);
next();
},
@@ -107,7 +109,7 @@ module.exports = {
var mode = new TextMode();
var result = highlighter.render(snippet, mode, theme);
- assert.ok(result.html.indexOf("&<>'"") != -1);
+ assert.ok(result.html.indexOf("&<>'"\n") != -1);
var mode = new JavaScriptMode();
var result = highlighter.render("/*" + snippet, mode, theme);
From 69da3f3a6b1caf7c971b9f425562fb5124d49ac2 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Mon, 12 Nov 2018 01:31:19 +0400
Subject: [PATCH 0099/1293] fix textinput issues on ios
---
lib/ace/css/editor.css | 7 -
lib/ace/keyboard/textinput.js | 122 ++++++-
lib/ace/keyboard/textinput_ios.js | 527 ------------------------------
lib/ace/virtual_renderer.js | 2 +-
4 files changed, 117 insertions(+), 541 deletions(-)
delete mode 100644 lib/ace/keyboard/textinput_ios.js
diff --git a/lib/ace/css/editor.css b/lib/ace/css/editor.css
index a23a6a27644..573cb86a1cb 100644
--- a/lib/ace/css/editor.css
+++ b/lib/ace/css/editor.css
@@ -528,10 +528,3 @@ styles.join("\n")
position: absolute;
z-index: 8;
}
-
-
-.ace_text-input-ios {
- position: absolute !important;
- top: -100000px !important;
- left: -100000px !important;
-}
diff --git a/lib/ace/keyboard/textinput.js b/lib/ace/keyboard/textinput.js
index 58ff7472203..405a73b4e45 100644
--- a/lib/ace/keyboard/textinput.js
+++ b/lib/ace/keyboard/textinput.js
@@ -40,11 +40,12 @@ var USE_IE_MIME_TYPE = useragent.isIE;
var HAS_FOCUS_ARGS = useragent.isChrome > 63;
var MAX_LINE_LENGTH = 400;
-var TextInputIOS = require("./textinput_ios").TextInput;
+var KEYS = require("../lib/keys");
+var MODS = KEYS.KEY_MODS;
+var isIOS = useragent.isIOS;
+var valueResetRegex = isIOS ? /\s/ : /\n/;
+
var TextInput = function(parentNode, host) {
- if (useragent.isIOS)
- return TextInputIOS.call(this, parentNode, host);
-
var text = dom.createElement("textarea");
text.className = "ace_text-input";
@@ -156,7 +157,25 @@ var TextInput = function(parentNode, host) {
resetSelection();
});
- function resetSelection() {
+ var resetSelection = isIOS
+ ? function(value) {
+ if (!isFocused || (copied && !value)) return;
+ if (!value)
+ value = "";
+ var newValue = "\n ab" + value + "cde fg\n";
+ if (newValue != text.value)
+ text.value = lastValue = newValue;
+
+ var selectionStart = 4;
+ var selectionEnd = 4 + (value.length || (host.selection.isEmpty() ? 0 : 1));
+
+ if (lastSelectionStart != selectionStart || lastSelectionEnd != selectionEnd) {
+ text.setSelectionRange(selectionStart, selectionEnd);
+ }
+ lastSelectionStart = selectionStart;
+ lastSelectionEnd = selectionEnd;
+ }
+ : function() {
if (inComposition || sendingText)
return;
// modifying selection of blured textarea can focus it (chrome mac/linux)
@@ -311,7 +330,7 @@ var TextInput = function(parentNode, host) {
return onCompositionUpdate();
var data = text.value;
var inserted = sendText(data, true);
- if (data.length > MAX_LINE_LENGTH + 100 || /\n/.test(inserted))
+ if (data.length > MAX_LINE_LENGTH + 100 || valueResetRegex.test(inserted))
resetSelection();
};
@@ -340,6 +359,13 @@ var TextInput = function(parentNode, host) {
return event.preventDefault(e);
if (handleClipboardData(e, data)) {
+ if (isIOS) {
+ resetSelection(data);
+ copied = data;
+ setTimeout(function () {
+ copied = false;
+ }, 10);
+ }
isCut ? host.onCut() : host.onCopy();
event.preventDefault(e);
} else {
@@ -587,6 +613,90 @@ var TextInput = function(parentNode, host) {
});
event.addListener(host.renderer.scroller, "contextmenu", onContextMenu);
event.addListener(text, "contextmenu", onContextMenu);
+
+ if (isIOS)
+ addIosSelectionHandler(parentNode, host, text);
+
+ function addIosSelectionHandler(parentNode, host, text) {
+ var typingResetTimeout = null;
+ var typing = false;
+
+ text.addEventListener("keydown", function (e) {
+ if (typingResetTimeout) clearTimeout(typingResetTimeout);
+ typing = true;
+ }, true);
+
+ text.addEventListener("keyup", function (e) {
+ typingResetTimeout = setTimeout(function () {
+ typing = false;
+ }, 100);
+ }, true);
+
+ // IOS doesn't fire events for arrow keys, but this unique hack changes everything!
+ var detectArrowKeys = function(e) {
+ if (document.activeElement !== text) return;
+ if (typing || inComposition) return;
+
+ if (copied) {
+ return;
+ }
+ var selectionStart = text.selectionStart;
+ var selectionEnd = text.selectionEnd;
+
+ var key = null;
+ var modifier = 0;
+ console.log(selectionStart, selectionEnd)
+ if (selectionStart == 0) {
+ key = KEYS.up;
+ } else if (selectionStart == 1) {
+ key = KEYS.home;
+ } else if (selectionEnd > lastSelectionEnd && lastValue[selectionEnd] == "\n") {
+ key = KEYS.end;
+ } else if (selectionStart < lastSelectionStart && lastValue[selectionStart - 1] == " ") {
+ key = KEYS.left
+ modifier = MODS.option;
+ } else if (
+ selectionStart < lastSelectionStart
+ || (
+ selectionStart == lastSelectionStart
+ && lastSelectionEnd != lastSelectionStart
+ && selectionStart == selectionEnd
+ )
+ ) {
+ key = KEYS.left;
+ } else if (selectionEnd > lastSelectionEnd && lastValue.slice(0, selectionEnd).split("\n").length > 2) {
+ key = KEYS.down;
+ } else if (selectionEnd > lastSelectionEnd && lastValue[selectionEnd - 1] == " ") {
+ key = KEYS.right
+ modifier = MODS.option;
+ } else if (
+ selectionEnd > lastSelectionEnd
+ || (
+ selectionEnd == lastSelectionEnd
+ && lastSelectionEnd != lastSelectionStart
+ && selectionStart == selectionEnd
+ )
+ ) {
+ key = KEYS.right;
+ }
+
+ if (selectionStart !== selectionEnd)
+ modifier |= MODS.shift;
+
+ if (key) {
+ host.onCommandKey(null, modifier, key);
+ lastSelectionStart = selectionStart;
+ lastSelectionEnd = selectionEnd;
+ resetSelection("")
+ }
+ };
+ // On iOS, "selectionchange" can only be attached to the document object...
+ document.addEventListener("selectionchange", detectArrowKeys);
+ host.on("destroy", function() {
+ document.removeEventListener("selectionchange", detectArrowKeys);
+ });
+ }
+
};
exports.TextInput = TextInput;
diff --git a/lib/ace/keyboard/textinput_ios.js b/lib/ace/keyboard/textinput_ios.js
deleted file mode 100644
index 12f6acebd2b..00000000000
--- a/lib/ace/keyboard/textinput_ios.js
+++ /dev/null
@@ -1,527 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Distributed under the BSD license:
- *
- * Copyright (c) 2010, Ajax.org B.V.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Ajax.org B.V. nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * ***** END LICENSE BLOCK ***** */
-
-define(function(require, exports, module) {
-"use strict";
-
-var event = require("../lib/event");
-var useragent = require("../lib/useragent");
-var dom = require("../lib/dom");
-var lang = require("../lib/lang");
-var KEYS = require("../lib/keys");
-var MODS = KEYS.KEY_MODS;
-var BROKEN_SETDATA = useragent.isChrome < 18;
-var USE_IE_MIME_TYPE = useragent.isIE;
-
-var TextInput = function(parentNode, host) {
- var self = this;
- var text = dom.createElement("textarea");
- text.className = useragent.isIOS ? "ace_text-input ace_text-input-ios" : "ace_text-input";
-
- if (useragent.isTouchPad)
- text.setAttribute("x-palm-disable-auto-cap", true);
-
- text.setAttribute("wrap", "off");
- text.setAttribute("autocorrect", "off");
- text.setAttribute("autocapitalize", "off");
- text.setAttribute("spellcheck", false);
-
- text.style.opacity = "0";
- parentNode.insertBefore(text, parentNode.firstChild);
-
- var PLACEHOLDER = "\n aaaa a\n";
-
- var copied = false;
- var cut = false;
- var pasted = false;
- var inComposition = false;
- var tempStyle = '';
- var isSelectionEmpty = true;
-
- // FOCUS
- // ie9 throws error if document.activeElement is accessed too soon
- try { var isFocused = document.activeElement === text; } catch(e) {}
-
- event.addListener(text, "blur", function(e) {
- host.onBlur(e);
- isFocused = false;
- });
- event.addListener(text, "focus", function(e) {
- isFocused = true;
- host.onFocus(e);
- resetSelection();
- });
- this.focus = function() {
- if (tempStyle) return text.focus();
- text.style.position = "fixed";
- text.focus();
- };
- this.blur = function() {
- text.blur();
- };
- this.isFocused = function() {
- return isFocused;
- };
-
- // modifying selection of blured textarea can focus it (chrome mac/linux)
- var syncSelection = lang.delayedCall(function() {
- isFocused && resetSelection(isSelectionEmpty);
- });
- var syncValue = lang.delayedCall(function() {
- if (!inComposition) {
- text.value = PLACEHOLDER;
- isFocused && resetSelection();
- }
- });
-
- function resetSelection(isEmpty) {
- if (inComposition)
- return;
-
- // this prevents infinite recursion on safari 8
- // see https://github.com/ajaxorg/ace/issues/2114
- inComposition = true;
-
- if (inputHandler) {
- selectionStart = 0;
- selectionEnd = isEmpty ? 0 : text.value.length - 1;
- } else {
- var selectionStart = 4;
- var selectionEnd = 5;
- }
- // on firefox this throws if textarea is hidden
- try {
- text.setSelectionRange(selectionStart, selectionEnd);
- } catch(e) {}
-
- inComposition = false;
- }
-
- function resetValue() {
- if (inComposition)
- return;
- text.value = PLACEHOLDER;
- //http://code.google.com/p/chromium/issues/detail?id=76516
- if (useragent.isWebKit)
- syncValue.schedule();
- }
-
- useragent.isWebKit || host.addEventListener('changeSelection', function() {
- if (host.selection.isEmpty() != isSelectionEmpty) {
- isSelectionEmpty = !isSelectionEmpty;
- syncSelection.schedule();
- }
- });
-
- resetValue();
- if (isFocused)
- host.onFocus();
-
-
- var isAllSelected = function(text) {
- return text.selectionStart === 0 && text.selectionEnd === text.value.length;
- };
-
- var onSelect = function(e) {
- if (isAllSelected(text)) {
- host.selectAll();
- resetSelection();
- } else if (inputHandler) {
- resetSelection(host.selection.isEmpty());
- }
- };
-
- var inputHandler = null;
- this.setInputHandler = function(cb) {inputHandler = cb;};
- this.getInputHandler = function() {return inputHandler;};
- var afterContextMenu = false;
-
- var sendText = function(data) {
- if (text.selectionStart === 4 && text.selectionEnd === 5) {
- return;
- }
- if (inputHandler) {
- data = inputHandler(data);
- inputHandler = null;
- }
- if (pasted) {
- resetSelection();
- if (data)
- host.onPaste(data);
- pasted = false;
- } else if (data == PLACEHOLDER.substr(0) && text.selectionStart === 4) {
- if (afterContextMenu)
- host.execCommand("del", {source: "ace"});
- else // some versions of android do not fire keydown when pressing backspace
- host.execCommand("backspace", {source: "ace"});
- } else if (!copied) {
- if (data.substring(0, 9) == PLACEHOLDER && data.length > PLACEHOLDER.length)
- data = data.substr(9);
- else if (data.substr(0, 4) == PLACEHOLDER.substr(0, 4))
- data = data.substr(4, data.length - PLACEHOLDER.length + 1);
- else if (data.charAt(data.length - 1) == PLACEHOLDER.charAt(0))
- data = data.slice(0, -1);
- // can happen if undo in textarea isn't stopped
- if (data == PLACEHOLDER.charAt(0)) {
- // Do nothing
- } else if (data.charAt(data.length - 1) == PLACEHOLDER.charAt(0))
- data = data.slice(0, -1);
-
- if (data)
- host.onTextInput(data);
- }
- if (copied) {
- copied = false;
- }
- if (afterContextMenu)
- afterContextMenu = false;
- };
- var onInput = function(e) {
- // console.log("onInput", inComposition)
- if (inComposition)
- return;
- var data = text.value;
- sendText(data);
- resetValue();
- };
-
- var handleClipboardData = function(e, data, forceIEMime) {
- var clipboardData = e.clipboardData || window.clipboardData;
- if (!clipboardData || BROKEN_SETDATA)
- return;
- // using "Text" doesn't work on old webkit but ie needs it
- var mime = USE_IE_MIME_TYPE || forceIEMime ? "Text" : "text/plain";
- try {
- if (data) {
- // Safari 5 has clipboardData object, but does not handle setData()
- return clipboardData.setData(mime, data) !== false;
- } else {
- return clipboardData.getData(mime);
- }
- } catch(e) {
- if (!forceIEMime)
- return handleClipboardData(e, data, true);
- }
- };
-
- var doCopy = function(e, isCut) {
- var data = host.getCopyText();
- if (!data)
- return event.preventDefault(e);
-
- if (handleClipboardData(e, data)) {
- if (useragent.isIOS) {
- cut = isCut;
- text.value = "\n aa" + data + "a a\n";
- text.setSelectionRange(4, 4 + data.length);
- copied = {
- value: data
- };
- }
- isCut ? host.onCut() : host.onCopy();
- if (!useragent.isIOS) event.preventDefault(e);
- } else {
- copied = true;
- text.value = data;
- text.select();
- setTimeout(function(){
- copied = false;
- resetValue();
- resetSelection();
- isCut ? host.onCut() : host.onCopy();
- });
- }
- };
-
- var onCut = function(e) {
- doCopy(e, true);
- };
-
- var onCopy = function(e) {
- doCopy(e, false);
- };
-
- var onPaste = function(e) {
- var data = handleClipboardData(e);
- if (typeof data == "string") {
- if (data)
- host.onPaste(data, e);
- if (useragent.isIE)
- setTimeout(resetSelection);
- event.preventDefault(e);
- }
- else {
- text.value = "";
- pasted = true;
- }
- };
-
- event.addCommandKeyListener(text, host.onCommandKey.bind(host));
-
- event.addListener(text, "select", onSelect);
-
- event.addListener(text, "input", onInput);
-
- event.addListener(text, "cut", onCut);
- event.addListener(text, "copy", onCopy);
- event.addListener(text, "paste", onPaste);
-
-
- // COMPOSITION
- var onCompositionStart = function(e) {
- if (inComposition || !host.onCompositionStart || host.$readOnly)
- return;
- // console.log("onCompositionStart", inComposition)
- inComposition = {};
- inComposition.canUndo = host.session.$undoManager;
- host.onCompositionStart();
- setTimeout(onCompositionUpdate, 0);
- host.on("mousedown", onCompositionEnd);
- if (inComposition.canUndo && !host.selection.isEmpty()) {
- host.insert("");
- host.session.markUndoGroup();
- host.selection.clearSelection();
- }
- host.session.markUndoGroup();
- };
-
- var onCompositionUpdate = function() {
- // console.log("onCompositionUpdate", inComposition && JSON.stringify(text.value))
- if (!inComposition || !host.onCompositionUpdate || host.$readOnly)
- return;
- var val = text.value.replace(/\x01/g, "");
- if (inComposition.lastValue === val) return;
-
- host.onCompositionUpdate(val);
- if (inComposition.lastValue)
- host.undo();
- if (inComposition.canUndo)
- inComposition.lastValue = val;
- if (inComposition.lastValue) {
- var r = host.selection.getRange();
- host.insert(inComposition.lastValue);
- host.session.markUndoGroup();
- inComposition.range = host.selection.getRange();
- host.selection.setRange(r);
- host.selection.clearSelection();
- }
- };
-
- var onCompositionEnd = function(e) {
- if (!host.onCompositionEnd || host.$readOnly) return;
- // console.log("onCompositionEnd", inComposition &&inComposition.lastValue)
- var c = inComposition;
- inComposition = false;
- var timer = setTimeout(function() {
- timer = null;
- var str = text.value.replace(/\x01/g, "");
- // console.log(str, c.lastValue)
- if (inComposition)
- return;
- else if (str == c.lastValue)
- resetValue();
- else if (!c.lastValue && str) {
- resetValue();
- sendText(str);
- }
- });
- inputHandler = function compositionInputHandler(str) {
- // console.log("onCompositionEnd", str, c.lastValue)
- if (timer)
- clearTimeout(timer);
- str = str.replace(/\x01/g, "");
- if (str == c.lastValue)
- return "";
- if (c.lastValue && timer)
- host.undo();
- return str;
- };
- host.onCompositionEnd();
- host.removeListener("mousedown", onCompositionEnd);
- if (e.type == "compositionend" && c.range) {
- host.selection.setRange(c.range);
- }
- // Workaround for #3027, #3045, #3097, #3100, #3249
- var needsOnInput =
- (!!useragent.isChrome && useragent.isChrome >= 53) ||
- (!!useragent.isWebKit && useragent.isWebKit >= 603);
-
- if (needsOnInput) {
- onInput();
- }
- };
-
-
-
- var syncComposition = lang.delayedCall(onCompositionUpdate, 50);
-
- event.addListener(text, "compositionstart", onCompositionStart);
- event.addListener(text, "compositionupdate", function(){syncComposition.schedule();});
- event.addListener(text, "keyup", function(){syncComposition.schedule();});
- event.addListener(text, "keydown", function(){syncComposition.schedule();});
- event.addListener(text, "compositionend", onCompositionEnd);
-
- this.getElement = function() {
- return text;
- };
-
- this.setReadOnly = function(readOnly) {
- text.readOnly = readOnly;
- };
-
- this.onContextMenu = function(e) {
- afterContextMenu = true;
- resetSelection(host.selection.isEmpty());
- host._emit("nativecontextmenu", {target: host, domEvent: e});
- this.moveToMouse(e, true);
- };
-
- this.moveToMouse = function(e, bringToFront) {
- if (!tempStyle)
- tempStyle = text.style.cssText;
- text.style.cssText = (bringToFront ? "z-index:100000;" : "")
- + "height:" + text.style.height + ";"
- + (useragent.isIE ? "opacity:0.1;" : "");
-
- var rect = host.container.getBoundingClientRect();
- var style = dom.computedStyle(host.container);
- var top = rect.top + (parseInt(style.borderTopWidth) || 0);
- var left = rect.left + (parseInt(rect.borderLeftWidth) || 0);
- var maxTop = rect.bottom - top - text.clientHeight -2;
- var move = function(e) {
- text.style.left = e.clientX - left - 2 + "px";
- text.style.top = Math.min(e.clientY - top - 2, maxTop) + "px";
- };
- move(e);
-
- if (e.type != "mousedown")
- return;
-
- if (host.renderer.$keepTextAreaAtCursor)
- host.renderer.$keepTextAreaAtCursor = null;
-
- clearTimeout(closeTimeout);
- // on windows context menu is opened after mouseup
- if (useragent.isWin)
- event.capture(host.container, move, onContextMenuClose);
- };
-
- this.onContextMenuClose = onContextMenuClose;
- var closeTimeout;
- function onContextMenuClose() {
- clearTimeout(closeTimeout);
- closeTimeout = setTimeout(function () {
- if (tempStyle) {
- text.style.cssText = tempStyle;
- tempStyle = '';
- }
- if (host.renderer.$keepTextAreaAtCursor == null) {
- host.renderer.$keepTextAreaAtCursor = true;
- host.renderer.$moveTextAreaToCursor();
- }
- }, 0);
- }
-
- var onContextMenu = function(e) {
- host.textInput.onContextMenu(e);
- onContextMenuClose();
- };
- event.addListener(text, "mouseup", onContextMenu);
- event.addListener(text, "mousedown", function(e) {
- e.preventDefault();
- onContextMenuClose();
- });
- event.addListener(host.renderer.scroller, "contextmenu", onContextMenu);
- event.addListener(text, "contextmenu", onContextMenu);
-
- if (useragent.isIOS) {
- var typingResetTimeout = null;
- var typing = false;
-
- parentNode.addEventListener("keydown", function (e) {
- if (typingResetTimeout) clearTimeout(typingResetTimeout);
- typing = true;
- });
-
- parentNode.addEventListener("keyup", function (e) {
- typingResetTimeout = setTimeout(function () {
- typing = false;
- }, 100);
- });
-
- // IOS doesn't fire events for arrow keys, but this unique hack changes everything!
- var detectArrowKeys = function(e) {
- if (document.activeElement !== text) return;
- if (typing) return;
-
- if (cut) {
- return setTimeout(function () {
- cut = false;
- }, 100);
- }
- var selectionStart = text.selectionStart;
- var selectionEnd = text.selectionEnd;
- text.setSelectionRange(4, 5);
- if (selectionStart == selectionEnd) {
- switch (selectionStart) {
- case 0: host.onCommandKey(null, 0, KEYS.up); break;
- case 1: host.onCommandKey(null, 0, KEYS.home); break;
- case 2: host.onCommandKey(null, MODS.option, KEYS.left); break;
- case 4: host.onCommandKey(null, 0, KEYS.left); break;
- case 5: host.onCommandKey(null, 0, KEYS.right); break;
- case 7: host.onCommandKey(null, MODS.option, KEYS.right); break;
- case 8: host.onCommandKey(null, 0, KEYS.end); break;
- case 9: host.onCommandKey(null, 0, KEYS.down); break;
- }
- } else {
- switch (selectionEnd) {
- case 6: host.onCommandKey(null, MODS.shift, KEYS.right); break;
- case 7: host.onCommandKey(null, MODS.shift | MODS.option, KEYS.right); break;
- case 8: host.onCommandKey(null, MODS.shift, KEYS.end); break;
- case 9: host.onCommandKey(null, MODS.shift, KEYS.down); break;
- }
- switch (selectionStart) {
- case 0: host.onCommandKey(null, MODS.shift, KEYS.up); break;
- case 1: host.onCommandKey(null, MODS.shift, KEYS.home); break;
- case 2: host.onCommandKey(null, MODS.shift | MODS.option, KEYS.left); break;
- case 3: host.onCommandKey(null, MODS.shift, KEYS.left); break;
- }
- }
- };
- // On iOS, "selectionchange" can only be attached to the document object...
- document.addEventListener("selectionchange", detectArrowKeys);
- host.on("destroy", function() {
- document.removeEventListener("selectionchange", detectArrowKeys);
- });
- }
-};
-
-exports.TextInput = TextInput;
-});
diff --git a/lib/ace/virtual_renderer.js b/lib/ace/virtual_renderer.js
index a30e6f68081..7f5eebcad3b 100644
--- a/lib/ace/virtual_renderer.js
+++ b/lib/ace/virtual_renderer.js
@@ -173,7 +173,7 @@ var VirtualRenderer = function(container, theme) {
h: 0
};
- this.$keepTextAreaAtCursor = true;
+ this.$keepTextAreaAtCursor = !useragent.isIOS;
this.$loop = new RenderLoop(
this.$renderChanges.bind(this),
From ff226cf69da5b56a6f5987065cd26f758d7db182 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Mon, 12 Nov 2018 01:59:22 +0400
Subject: [PATCH 0100/1293] include snippets in webpack resolver
---
.travis.yml | 2 +-
Makefile.dryice.js | 16 ++++++++++------
lib/ace/keyboard/textinput.js | 10 +++++-----
3 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index c8f52807fba..0bf282193fc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,7 +9,7 @@ install:
cmp --silent package.json node_modules/package.json || install;
script:
- - changes=$(git diff --name-only origin/HEAD);
+ - changes=$(git diff --name-only origin/HEAD --no-renames --diff-filter=ACMR);
if [ "$changes" == "" ]; then
echo "checking all files";
node node_modules/eslint/bin/eslint "lib/ace/**/*.js";
diff --git a/Makefile.dryice.js b/Makefile.dryice.js
index e4faa4dfa9f..d7d5e33b6a9 100755
--- a/Makefile.dryice.js
+++ b/Makefile.dryice.js
@@ -116,8 +116,12 @@ function buildTypes() {
var paths = fs.readdirSync(BUILD_DIR + '/src-noconflict');
var moduleRef = '/// ';
+ fs.readdirSync(BUILD_DIR + '/src-noconflict/snippets').forEach(function(path) {
+ paths.push("snippets/" + path);
+ });
+
var pathModules = paths.map(function(path) {
- if (/^(mode|theme|ext|keybinding)-/.test(path)) {
+ if (/^(mode|theme|ext|keybinding)-|^snippets\//.test(path)) {
var moduleName = path.split('.')[0];
return "declare module 'ace-builds/src-noconflict/" + moduleName + "';";
}
@@ -184,8 +188,8 @@ function demo() {
removeRequireJS = true;
var scripts = m.split(/,\s*/);
var result = [];
- function comment(str) {result.push("")}
- function script(str) {result.push('')}
+ function comment(str) {result.push("");}
+ function script(str) {result.push('');}
scripts.forEach(function(s) {
s = s.replace(/"/g, "");
if (s == "ace/ace") {
@@ -422,7 +426,7 @@ function buildAce(options, callback) {
//
function addCb() {
addCb.count = (addCb.count || 0) + 1;
- return done
+ return done;
}
function done() {
if (--addCb.count > 0)
@@ -434,7 +438,7 @@ function buildAce(options, callback) {
if (callback)
return callback();
- console.log("Finished building " + getTargetDir(options))
+ console.log("Finished building " + getTargetDir(options));
}
}
@@ -616,7 +620,7 @@ function addSnippetFile(modeName) {
function compress(text) {
var uglify = require("dryice").copy.filter.uglifyjs;
uglify.options.mangle_toplevel = {except: ["ACE_NAMESPACE", "requirejs"]};
- uglify.options.beautify = {ascii_only: true, inline_script: true}
+ uglify.options.beautify = {ascii_only: true, inline_script: true};
return asciify(uglify(text));
// copy.filter.uglifyjs.options.ascii_only = true; doesn't work with some uglify.js versions
function asciify(text) {
diff --git a/lib/ace/keyboard/textinput.js b/lib/ace/keyboard/textinput.js
index 405a73b4e45..321f4575ed9 100644
--- a/lib/ace/keyboard/textinput.js
+++ b/lib/ace/keyboard/textinput.js
@@ -239,7 +239,7 @@ var TextInput = function(parentNode, host) {
} catch(e){}
}
inComposition = false;
- }
+ };
if (isFocused)
host.onFocus();
@@ -645,7 +645,7 @@ var TextInput = function(parentNode, host) {
var key = null;
var modifier = 0;
- console.log(selectionStart, selectionEnd)
+ console.log(selectionStart, selectionEnd);
if (selectionStart == 0) {
key = KEYS.up;
} else if (selectionStart == 1) {
@@ -653,7 +653,7 @@ var TextInput = function(parentNode, host) {
} else if (selectionEnd > lastSelectionEnd && lastValue[selectionEnd] == "\n") {
key = KEYS.end;
} else if (selectionStart < lastSelectionStart && lastValue[selectionStart - 1] == " ") {
- key = KEYS.left
+ key = KEYS.left;
modifier = MODS.option;
} else if (
selectionStart < lastSelectionStart
@@ -667,7 +667,7 @@ var TextInput = function(parentNode, host) {
} else if (selectionEnd > lastSelectionEnd && lastValue.slice(0, selectionEnd).split("\n").length > 2) {
key = KEYS.down;
} else if (selectionEnd > lastSelectionEnd && lastValue[selectionEnd - 1] == " ") {
- key = KEYS.right
+ key = KEYS.right;
modifier = MODS.option;
} else if (
selectionEnd > lastSelectionEnd
@@ -687,7 +687,7 @@ var TextInput = function(parentNode, host) {
host.onCommandKey(null, modifier, key);
lastSelectionStart = selectionStart;
lastSelectionEnd = selectionEnd;
- resetSelection("")
+ resetSelection("");
}
};
// On iOS, "selectionchange" can only be attached to the document object...
From bb91e50945c63f0c2afa56310983ecae722d18f8 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Tue, 13 Nov 2018 19:50:09 +0400
Subject: [PATCH 0101/1293] fix text blinking when scrolling up at the top
---
lib/ace/renderloop.js | 17 +++++++++++++++--
lib/ace/virtual_renderer.js | 6 +++---
2 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/lib/ace/renderloop.js b/lib/ace/renderloop.js
index 93d8de6e9c6..805df36ce75 100644
--- a/lib/ace/renderloop.js
+++ b/lib/ace/renderloop.js
@@ -45,9 +45,11 @@ var RenderLoop = function(onRender, win) {
this.onRender = onRender;
this.pending = false;
this.changes = 0;
+ this.$recursionLimit = 2;
this.window = win || window;
var _self = this;
this._flush = function(ts) {
+ _self.pending = false;
var changes = _self.changes;
if (changes) {
@@ -56,8 +58,12 @@ var RenderLoop = function(onRender, win) {
_self.onRender(changes);
}
- if (_self.changes)
+ if (_self.changes) {
+ if (_self.$recursionLimit-- < 0) return;
_self.schedule();
+ } else {
+ _self.$recursionLimit = 2;
+ }
};
};
@@ -65,11 +71,18 @@ var RenderLoop = function(onRender, win) {
this.schedule = function(change) {
this.changes = this.changes | change;
- if (this.changes) {
+ if (this.changes && !this.pending) {
event.nextFrame(this._flush);
+ this.pending = true;
}
};
+ this.clear = function(change) {
+ var changes = this.changes;
+ this.changes = 0;
+ return changes;
+ };
+
}).call(RenderLoop.prototype);
exports.RenderLoop = RenderLoop;
diff --git a/lib/ace/virtual_renderer.js b/lib/ace/virtual_renderer.js
index 7f5eebcad3b..9dd767554d4 100644
--- a/lib/ace/virtual_renderer.js
+++ b/lib/ace/virtual_renderer.js
@@ -848,7 +848,7 @@ var VirtualRenderer = function(container, theme) {
changes & this.CHANGE_SCROLL ||
changes & this.CHANGE_H_SCROLL
) {
- changes |= this.$computeLayerConfig();
+ changes |= this.$computeLayerConfig() | this.$loop.clear();
// If a change is made offscreen and wrapMode is on, then the onscreen
// lines may have been pushed down. If so, the first screen row will not
// have changed, but the first actual row will. In that case, adjust
@@ -860,7 +860,7 @@ var VirtualRenderer = function(container, theme) {
// this check is needed as a workaround for the documentToScreenRow returning -1 if document.length == 0
this.scrollTop = st;
changes = changes | this.CHANGE_SCROLL;
- changes |= this.$computeLayerConfig();
+ changes |= this.$computeLayerConfig() | this.$loop.clear();
}
}
config = this.layerConfig;
@@ -1007,7 +1007,6 @@ var VirtualRenderer = function(container, theme) {
if (this.$maxLines && this.lineHeight > 1)
this.$autosize();
- var offset = this.scrollTop % this.lineHeight;
var minHeight = size.scrollerHeight + this.lineHeight;
var scrollPastEnd = !this.$maxLines && this.$scrollPastEnd
@@ -1030,6 +1029,7 @@ var VirtualRenderer = function(container, theme) {
this.scrollBarV.setVisible(vScroll);
}
+ var offset = this.scrollTop % this.lineHeight;
var lineCount = Math.ceil(minHeight / this.lineHeight) - 1;
var firstRow = Math.max(0, Math.round((this.scrollTop - offset) / this.lineHeight));
var lastRow = firstRow + lineCount;
From 53ab0f5620827dc8b804edb144c3920e06c18dd9 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Tue, 13 Nov 2018 19:50:50 +0400
Subject: [PATCH 0102/1293] cleanup
---
index.html | 56 ++++++++----------------------------------------------
1 file changed, 8 insertions(+), 48 deletions(-)
diff --git a/index.html b/index.html
index f28a1b5c07e..d61b015c7d1 100644
--- a/index.html
+++ b/index.html
@@ -826,11 +826,6 @@ Projects Using Ace
style="left: 10px; top: -4px; width:80px" />
Codiad
-
-
- Plunker
-
@@ -864,11 +859,6 @@ Projects Using Ace
style="left: 18px; top: 6px;">
MODX
-
-
- Chrome Dev Editor
-
@@ -878,15 +868,13 @@ Projects Using Ace
Code Combat
-
-
- Repl.it
+ ShareLaTeX
+ ShareLaTeX
+
+
+
+ Papeeria
Projects Using Ace
Dillinger
Dillinger
-
- Evaluzio
- Evaluzio
-
CodeHelper
CodeHelper
@@ -941,10 +925,6 @@ Projects Using Ace
style="width: 106px; left: -4px; top: 26px;">
Simply Text
-
- ShareLaTeX
- ShareLaTeX
-
ACEView
ACEView
@@ -962,22 +942,11 @@ Projects Using Ace
Debuggex
Debuggex
-
- S
- Slim Text
-
Decor
-
-
- Papeeria
-
");
+ next();
+ },
+
+ "test beautify js object": function(next) {
+ var s = new EditSession([
+ ''
+ ], new PHPMode());
+ s.setUseSoftTabs(false);
+
+ beautify.beautify(s);
+ assert.equal(s.getValue(), "");
+
next();
}
};
From 340260b4f9ebcad31d6f88fd36eabfb7dec32e47 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Mon, 17 Dec 2018 14:14:00 +0400
Subject: [PATCH 0119/1293] remove unnecessary use of innerHTML
---
lib/ace/bidihandler.js | 2 +-
lib/ace/ext/searchbox.js | 48 +++++++++++++++----------------
lib/ace/theme/solarized_light.css | 2 +-
3 files changed, 25 insertions(+), 27 deletions(-)
diff --git a/lib/ace/bidihandler.js b/lib/ace/bidihandler.js
index cb8df42b12a..4d8adc3c9ac 100644
--- a/lib/ace/bidihandler.js
+++ b/lib/ace/bidihandler.js
@@ -178,7 +178,7 @@ var BidiHandler = function(session) {
});
if (this.isRtlDir) {
- this.fontMetrics.$main.innerHTML = (this.line.charAt(this.line.length - 1) == bidiUtil.DOT) ? this.line.substr(0, this.line.length - 1) : this.line;
+ this.fontMetrics.$main.textContent = (this.line.charAt(this.line.length - 1) == bidiUtil.DOT) ? this.line.substr(0, this.line.length - 1) : this.line;
this.rtlLineOffset = this.contentWidth - this.fontMetrics.$main.getBoundingClientRect().width;
}
};
diff --git a/lib/ace/ext/searchbox.js b/lib/ace/ext/searchbox.js
index 16910b68356..9812c8d614a 100644
--- a/lib/ace/ext/searchbox.js
+++ b/lib/ace/ext/searchbox.js
@@ -42,33 +42,31 @@ var MAX_COUNT = 999;
dom.importCssString(searchboxCss, "ace_searchbox");
-var html = '\
-
\
-
\
- \
- \
- \
- All \
-
\
-
\
- \
- Replace \
- All \
-
\
-
\
- + \
- \
- .* \
- Aa \
- \\b \
- S \
-
\
-
'.replace(/> +/g, ">");
-
var SearchBox = function(editor, range, showReplaceForm) {
var div = dom.createElement("div");
- div.innerHTML = html;
+ dom.buildDom(["div", {class:"ace_search right"},
+ ["span", {action: "hide", class: "ace_searchbtn_close"}],
+ ["div", {class: "ace_search_form"},
+ ["input", {class: "ace_search_field", placeholder: "Search for", spellcheck: "false"}],
+ ["span", {action: "findPrev", class: "ace_searchbtn prev"}],
+ ["span", {action: "findNext", class: "ace_searchbtn next"}],
+ ["span", {action: "findAll", class: "ace_searchbtn", title: "Alt-Enter"}, "All"]
+ ],
+ ["div", {class: "ace_replace_form"},
+ ["input", {class: "ace_search_field", placeholder: "Replace with", spellcheck: "false"}],
+ ["span", {action: "replaceAndFindNext", class: "ace_searchbtn"}, "Replace"],
+ ["span", {action: "replaceAll", class: "ace_searchbtn"}, "All"]
+ ],
+ ["div", {class: "ace_search_options"},
+ ["span", {action: "toggleReplace", class: "ace_button", title: "Toggle Replace mode",
+ style: "float:left;margin-top:-2px;padding:0 5px;"}, "+"],
+ ["span", {class: "ace_search_counter"}],
+ ["span", {action: "toggleRegexpMode", class: "ace_button", title: "RegExp Search"}, ".*"],
+ ["span", {action: "toggleCaseSensitive", class: "ace_button", title: "CaseSensitive Search"}, "Aa"],
+ ["span", {action: "toggleWholeWords", class: "ace_button", title: "Whole Word Search"}, "\\b"],
+ ["span", {action: "searchInSelection", class: "ace_button", title: "Search In Selection"}, "S"]
+ ]
+ ], div);
this.element = div.firstChild;
this.setSession = this.setSession.bind(this);
diff --git a/lib/ace/theme/solarized_light.css b/lib/ace/theme/solarized_light.css
index 65399fdaa7b..9e48e4f4499 100644
--- a/lib/ace/theme/solarized_light.css
+++ b/lib/ace/theme/solarized_light.css
@@ -43,7 +43,7 @@
}
.ace-solarized-light .ace_marker-layer .ace_selected-word {
- border: 1px solid #073642
+ border: 1px solid #7f9390
}
.ace-solarized-light .ace_invisible {
From 87ce087ed1cf20eeabe56fb0894e048d9bc9c481 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Mon, 17 Dec 2018 14:32:17 +0400
Subject: [PATCH 0120/1293] fix exception in markdown mode
---
lib/ace/mode/behaviour/behaviour_test.js | 8 +++++++-
lib/ace/mode/text.js | 4 ++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/lib/ace/mode/behaviour/behaviour_test.js b/lib/ace/mode/behaviour/behaviour_test.js
index 6c8580f7818..7b8ca79e6d3 100644
--- a/lib/ace/mode/behaviour/behaviour_test.js
+++ b/lib/ace/mode/behaviour/behaviour_test.js
@@ -48,6 +48,7 @@ var RustMode = require("../rust").Mode;
var XMLMode = require("../xml").Mode;
var HTMLMode = require("../html").Mode;
var CSSMode = require("../css").Mode;
+var MarkdownMode = require("../markdown").Mode;
var editor;
var exec = function(name, times, args) {
do {
@@ -388,8 +389,13 @@ module.exports = {
editor.selection.moveTo(0, 3);
exec("insertstring", 1, "!");
assert.equal(editor.getValue(), "a {!padding:10px!important;}");
+ },
+ "test: markdown": function() {
+ editor.session.setMode(new MarkdownMode());
+ editor.setValue("```html", 1);
+ exec("insertstring", 1, "\n");
+ assert.equal(editor.getValue(), "```html\n");
}
-
};
});
diff --git a/lib/ace/mode/text.js b/lib/ace/mode/text.js
index ec9bdc61c37..152f884ac0e 100644
--- a/lib/ace/mode/text.js
+++ b/lib/ace/mode/text.js
@@ -296,7 +296,7 @@ var Mode = function() {
};
this.$delegator = function(method, args, defaultHandler) {
- var state = args[0];
+ var state = args[0] || "start";
if (typeof state != "string") {
if (Array.isArray(state[2])) {
var language = state[2][state[2].length - 1];
@@ -304,7 +304,7 @@ var Mode = function() {
if (mode)
return mode[method].apply(mode, [state[1]].concat([].slice.call(args, 1)));
}
- state = state[0];
+ state = state[0] || "start";
}
for (var i = 0; i < this.$embeds.length; i++) {
From 8a588da6063c085c5c55da42918d23925cd2bf08 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Tue, 18 Dec 2018 18:40:29 +0400
Subject: [PATCH 0121/1293] fix highlighting of (*) in fsharp mode
---
demo/kitchen-sink/docs/fsharp.fsi | 1 +
lib/ace/mode/fsharp_highlight_rules.js | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/demo/kitchen-sink/docs/fsharp.fsi b/demo/kitchen-sink/docs/fsharp.fsi
index 6be8a8a099c..43d6cf6547e 100644
--- a/demo/kitchen-sink/docs/fsharp.fsi
+++ b/demo/kitchen-sink/docs/fsharp.fsi
@@ -1,5 +1,6 @@
(* fsharp (* example *) *)
module Test =
+ let (*) x y = (x + y)
let func1 x =
if x < 100 then
x*x
diff --git a/lib/ace/mode/fsharp_highlight_rules.js b/lib/ace/mode/fsharp_highlight_rules.js
index 9291d93a418..a968f2a9414 100644
--- a/lib/ace/mode/fsharp_highlight_rules.js
+++ b/lib/ace/mode/fsharp_highlight_rules.js
@@ -61,7 +61,7 @@ var FSharpHighlightRules = function () {
},
{
token: "comment.start",
- regex: /\(\*/,
+ regex: /\(\*(?!\))/,
push: "blockComment"
},
{
@@ -135,7 +135,7 @@ var FSharpHighlightRules = function () {
},
{
token: "keyword.operator",
- regex: "\\+\\.|\\-\\.|\\*\\.|\\/\\.|#|;;|\\+|\\-|\\*|\\*\\*\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|<-|="
+ regex: "\\+\\.|\\-\\.|\\*\\.|\\/\\.|#|;;|\\+|\\-|\\*|\\*\\*\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|<-|=|\\(\\*\\)"
},
{
token: "paren.lpar",
From e2c3b79ce6158362957e604a9bd105857bba0eaa Mon Sep 17 00:00:00 2001
From: "Burt.K"
Date: Sun, 23 Dec 2018 00:46:48 +0900
Subject: [PATCH 0122/1293] Add open, internal and fileprivate access level
keywords
---
lib/ace/mode/swift_highlight_rules.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/ace/mode/swift_highlight_rules.js b/lib/ace/mode/swift_highlight_rules.js
index 86c0fecf9fb..55b49cd3fcb 100644
--- a/lib/ace/mode/swift_highlight_rules.js
+++ b/lib/ace/mode/swift_highlight_rules.js
@@ -50,7 +50,7 @@ var SwiftHighlightRules = function() {
+ "|convenience|dynamic|final|infix|lazy|mutating|nonmutating|optional|override|postfix"
+ "|prefix|required|static|guard|defer",
"storage.type": "bool|double|Double"
- + "|extension|float|Float|int|Int|private|public|string|String",
+ + "|extension|float|Float|int|Int|open|internal|fileprivate|private|public|string|String",
"constant.language":
"false|Infinity|NaN|nil|no|null|null|off|on|super|this|true|undefined|yes",
"support.function":
From 30522154a1d7fe37744def3fae4bc3d0a74319bc Mon Sep 17 00:00:00 2001
From: nightwing
Date: Mon, 24 Dec 2018 20:15:03 +0400
Subject: [PATCH 0123/1293] add option to allow loading worker directly
---
lib/ace/config.js | 3 ++-
lib/ace/keyboard/vim.js | 2 +-
lib/ace/worker/worker_client.js | 15 +++++++++------
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/lib/ace/config.js b/lib/ace/config.js
index 2bbc34df3fe..bfbd83f44fc 100644
--- a/lib/ace/config.js
+++ b/lib/ace/config.js
@@ -49,7 +49,8 @@ var options = {
themePath: null,
basePath: "",
suffix: ".js",
- $moduleUrls: {}
+ $moduleUrls: {},
+ loadWorkerFromBlob: true
};
exports.get = function(key) {
diff --git a/lib/ace/keyboard/vim.js b/lib/ace/keyboard/vim.js
index ec5965f79b3..5842aea46b1 100644
--- a/lib/ace/keyboard/vim.js
+++ b/lib/ace/keyboard/vim.js
@@ -497,7 +497,7 @@ define(function(require, exports, module) {
return this.ace.textInput.getElement();
};
this.getWrapperElement = function() {
- return this.ace.containter;
+ return this.ace.container;
};
var optMap = {
indentWithTabs: "useSoftTabs",
diff --git a/lib/ace/worker/worker_client.js b/lib/ace/worker/worker_client.js
index 5e667b69fb3..d28ee255a92 100644
--- a/lib/ace/worker/worker_client.js
+++ b/lib/ace/worker/worker_client.js
@@ -53,11 +53,14 @@ function $workerBlob(workerUrl) {
function createWorker(workerUrl) {
if (typeof Worker == "undefined")
return { postMessage: function() {}, terminate: function() {} };
- var blob = $workerBlob(workerUrl);
- var URL = window.URL || window.webkitURL;
- var blobURL = URL.createObjectURL(blob);
- // calling URL.revokeObjectURL before worker is terminated breaks it on IE Edge
- return new Worker(blobURL);
+ if (config.get("loadWorkerFromBlob")) {
+ var blob = $workerBlob(workerUrl);
+ var URL = window.URL || window.webkitURL;
+ var blobURL = URL.createObjectURL(blob);
+ // calling URL.revokeObjectURL before worker is terminated breaks it on IE Edge
+ return new Worker(blobURL);
+ }
+ return new Worker(workerUrl);
}
var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl, importScripts) {
@@ -81,7 +84,7 @@ var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl, impor
});
}
- this.$worker = createWorker(workerUrl);
+ this.$worker = exports.createWorker(workerUrl);
if (importScripts) {
this.send("importScripts", importScripts);
}
From 8fb88ea6f8711ab63ba9b9c6e2d4a12d571edf49 Mon Sep 17 00:00:00 2001
From: JQ Zhu
Date: Tue, 25 Dec 2018 13:45:05 +0800
Subject: [PATCH 0124/1293] nameOverrides AutoHotKey to "AutoHotkey / AutoIt"
---
lib/ace/ext/modelist.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/ace/ext/modelist.js b/lib/ace/ext/modelist.js
index d45a4dd5df1..f4ea2fde9a4 100644
--- a/lib/ace/ext/modelist.js
+++ b/lib/ace/ext/modelist.js
@@ -213,7 +213,8 @@ var nameOverrides = {
HTML_Elixir: "HTML (Elixir)",
FTL: "FreeMarker",
PHP_Laravel_blade: "PHP (Blade Template)",
- Perl6: "Perl 6"
+ Perl6: "Perl 6",
+ AutoHotKey: "AutoHotkey / AutoIt"
};
var modesByName = {};
for (var name in supportedModes) {
From 0d95ca3c06230b5504f77c9d9cd01f4a9e9a6cd5 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Tue, 29 Jan 2019 00:28:27 +0400
Subject: [PATCH 0125/1293] add option to switch text direction for the whole
editor
---
demo/kitchen-sink/demo.js | 6 +++++-
lib/ace/bidihandler.js | 4 +++-
lib/ace/ext/rtl.js | 14 ++++++++++++++
3 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/demo/kitchen-sink/demo.js b/demo/kitchen-sink/demo.js
index da9704b7896..d8909ff1c26 100644
--- a/demo/kitchen-sink/demo.js
+++ b/demo/kitchen-sink/demo.js
@@ -369,7 +369,11 @@ optionsPanel.add({
}
},
More: {
- "Rtl Text": {
+ "RTL": {
+ path: "rtl",
+ position: 900
+ },
+ "Line based RTL switching": {
path: "rtlText",
position: 900
},
diff --git a/lib/ace/bidihandler.js b/lib/ace/bidihandler.js
index 4d8adc3c9ac..097babdd8f2 100644
--- a/lib/ace/bidihandler.js
+++ b/lib/ace/bidihandler.js
@@ -58,6 +58,7 @@ var BidiHandler = function(session) {
this.EOL = "\xAC";
this.showInvisibles = true;
this.isRtlDir = false;
+ this.$isRtl = false;
this.line = "";
this.wrapIndent = 0;
this.EOF = "\xB6";
@@ -143,7 +144,7 @@ var BidiHandler = function(session) {
this.wrapIndent = 0;
this.line = this.session.getLine(docRow);
- this.isRtlDir = this.line.charAt(0) === this.RLE;
+ this.isRtlDir = this.$isRtl || this.line.charAt(0) === this.RLE;
if (this.session.$useWrapMode) {
var splits = this.session.$wrapData[docRow];
if (splits) {
@@ -234,6 +235,7 @@ var BidiHandler = function(session) {
};
this.isRtlLine = function(row) {
+ if (this.$isRtl) return true;
if (row != undefined)
return (this.session.getLine(row).charAt(0) == this.RLE);
else
diff --git a/lib/ace/ext/rtl.js b/lib/ace/ext/rtl.js
index 4ab2f140b4d..07405c5d6e1 100644
--- a/lib/ace/ext/rtl.js
+++ b/lib/ace/ext/rtl.js
@@ -40,6 +40,20 @@ require("../config").defineOptions(Editor.prototype, "editor", {
}
this.renderer.updateFull();
}
+ },
+ rtl: {
+ set: function(val) {
+ this.session.$bidiHandler.$isRtl = val;
+ if (val) {
+ this.setOption("rtlText", false);
+ this.renderer.on("afterRender", updateLineDirection);
+ this.session.$bidiHandler.seenBidi = true;
+ } else {
+ this.renderer.off("afterRender", updateLineDirection);
+ clearTextLayer(this.renderer);
+ }
+ this.renderer.updateFull();
+ }
}
});
From 548af1e3e2e0df88ec2c5d4db36cd17a49fd05fd Mon Sep 17 00:00:00 2001
From: nightwing
Date: Tue, 29 Jan 2019 00:31:27 +0400
Subject: [PATCH 0126/1293] fix #3878: F# (*) operator within block comments
---
lib/ace/mode/fsharp_highlight_rules.js | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/ace/mode/fsharp_highlight_rules.js b/lib/ace/mode/fsharp_highlight_rules.js
index a968f2a9414..98345f82702 100644
--- a/lib/ace/mode/fsharp_highlight_rules.js
+++ b/lib/ace/mode/fsharp_highlight_rules.js
@@ -147,7 +147,10 @@ var FSharpHighlightRules = function () {
}
],
blockComment: [{
- regex: /\(\*/,
+ regex: /\(\*\)/,
+ token: "comment"
+ }, {
+ regex: /\(\*(?!\))/,
token: "comment.start",
push: "blockComment"
}, {
From d09968e6206a52d3e60b73e55f1fe6144e04d8f4 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Tue, 29 Jan 2019 00:32:04 +0400
Subject: [PATCH 0127/1293] fix searchbox rendering in quirks mode
---
lib/ace/ext/searchbox.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/ace/ext/searchbox.js b/lib/ace/ext/searchbox.js
index 9812c8d614a..76d1b28352f 100644
--- a/lib/ace/ext/searchbox.js
+++ b/lib/ace/ext/searchbox.js
@@ -48,8 +48,8 @@ var SearchBox = function(editor, range, showReplaceForm) {
["span", {action: "hide", class: "ace_searchbtn_close"}],
["div", {class: "ace_search_form"},
["input", {class: "ace_search_field", placeholder: "Search for", spellcheck: "false"}],
- ["span", {action: "findPrev", class: "ace_searchbtn prev"}],
- ["span", {action: "findNext", class: "ace_searchbtn next"}],
+ ["span", {action: "findPrev", class: "ace_searchbtn prev"}, "\u200b"],
+ ["span", {action: "findNext", class: "ace_searchbtn next"}, "\u200b"],
["span", {action: "findAll", class: "ace_searchbtn", title: "Alt-Enter"}, "All"]
],
["div", {class: "ace_replace_form"},
From 3f4ec206a54ed35c8fa214525a608b885fcc9c51 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Tue, 29 Jan 2019 01:08:08 +0400
Subject: [PATCH 0128/1293] do not allow invalid value of tabsize to break the
editor
fixes #3879
---
lib/ace/edit_session.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/ace/edit_session.js b/lib/ace/edit_session.js
index 740d85a31d0..ba0167702f9 100644
--- a/lib/ace/edit_session.js
+++ b/lib/ace/edit_session.js
@@ -2529,6 +2529,7 @@ config.defineOptions(EditSession.prototype, "session", {
useSoftTabs: {initialValue: true},
tabSize: {
set: function(tabSize) {
+ tabSize = parseInt(tabSize);
if (isNaN(tabSize) || this.$tabSize === tabSize) return;
this.$modified = true;
From c6ea9f0b22e6f43f199c2be6f5cba4751db810ab Mon Sep 17 00:00:00 2001
From: nightwing
Date: Tue, 29 Jan 2019 01:03:18 +0400
Subject: [PATCH 0129/1293] implement ` and < text objects in vim
---
lib/ace/edit_session/bracket_match.js | 4 +++-
lib/ace/keyboard/vim.js | 16 ++++++++++------
lib/ace/keyboard/vim_test.js | 4 ++++
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/lib/ace/edit_session/bracket_match.js b/lib/ace/edit_session/bracket_match.js
index 62a8499ca5e..ebd2aa94ce6 100644
--- a/lib/ace/edit_session/bracket_match.js
+++ b/lib/ace/edit_session/bracket_match.js
@@ -99,7 +99,9 @@ function BracketMatch() {
"]": "[",
"[": "]",
"{": "}",
- "}": "{"
+ "}": "{",
+ "<": ">",
+ ">": "<"
};
this.$findOpeningBracket = function(bracket, position, typeRe) {
diff --git a/lib/ace/keyboard/vim.js b/lib/ace/keyboard/vim.js
index ec5965f79b3..7f641f4dd59 100644
--- a/lib/ace/keyboard/vim.js
+++ b/lib/ace/keyboard/vim.js
@@ -613,10 +613,11 @@ define(function(require, exports, module) {
};
this.scanForBracket = function(pos, dir, _, options) {
var re = options.bracketRegex.source;
+ var tokenRe = /paren|text|operator|tag/;
if (dir == 1) {
- var m = this.ace.session.$findClosingBracket(re.slice(1, 2), toAcePos(pos), /paren|text/);
+ var m = this.ace.session.$findClosingBracket(re.slice(1, 2), toAcePos(pos), tokenRe);
} else {
- var m = this.ace.session.$findOpeningBracket(re.slice(-2, -1), {row: pos.line, column: pos.ch + 1}, /paren|text/);
+ var m = this.ace.session.$findOpeningBracket(re.slice(-2, -1), {row: pos.line, column: pos.ch + 1}, tokenRe);
}
return m && {pos: toCmPos(m)};
};
@@ -2695,8 +2696,9 @@ dom.importCssString(".normal-mode .ace_cursor{\
// they're operators
var mirroredPairs = {'(': ')', ')': '(',
'{': '}', '}': '{',
- '[': ']', ']': '['};
- var selfPaired = {'\'': true, '"': true};
+ '[': ']', ']': '[',
+ '<': '>', '>': '<'};
+ var selfPaired = {'\'': true, '"': true, '`': true};
var character = motionArgs.selectedCharacter;
// 'b' refers to '()' block.
@@ -4332,11 +4334,13 @@ dom.importCssString(".normal-mode .ace_cursor{\
var bracketRegexp = ({
'(': /[()]/, ')': /[()]/,
'[': /[[\]]/, ']': /[[\]]/,
- '{': /[{}]/, '}': /[{}]/})[symb];
+ '{': /[{}]/, '}': /[{}]/,
+ '<': /[<>]/, '>': /[<>]/})[symb];
var openSym = ({
'(': '(', ')': '(',
'[': '[', ']': '[',
- '{': '{', '}': '{'})[symb];
+ '{': '{', '}': '{',
+ '<': '<', '>': '<'})[symb];
var curChar = cm.getLine(cur.line).charAt(cur.ch);
// Due to the behavior of scanForBracket, we need to add an offset if the
// cursor is on a matching open bracket.
diff --git a/lib/ace/keyboard/vim_test.js b/lib/ace/keyboard/vim_test.js
index c64e17f8af8..cbe92ab1686 100644
--- a/lib/ace/keyboard/vim_test.js
+++ b/lib/ace/keyboard/vim_test.js
@@ -1353,6 +1353,10 @@ testEdit('di)_close_spc', 'foo (bAr) baz', /\)/, 'di)', 'foo () baz');
testEdit('da(_close_spc', 'foo (bAr) baz', /\)/, 'da(', 'foo baz');
testEdit('da)_close_spc', 'foo (bAr) baz', /\)/, 'da)', 'foo baz');
+testEdit('di`', 'foo `bAr` baz', /`/, 'di`', 'foo `` baz');
+testEdit('di>', 'foo baz', /, 'di>', 'foo <> baz');
+testEdit('da<', 'foo baz', /, 'da<', 'foo baz');
+
// delete around and inner b.
testEdit('dab_on_(_should_delete_around_()block', 'o( in(abc) )', /\(a/, 'dab', 'o( in )');
From f9b7156dac69a0d4682a77bf7da84adb69869759 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Fri, 8 Feb 2019 22:52:40 +0400
Subject: [PATCH 0130/1293] fix removeToLineStart at the start of the line
---
lib/ace/editor.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/ace/editor.js b/lib/ace/editor.js
index 1724765ea27..4c3e4f020ae 100644
--- a/lib/ace/editor.js
+++ b/lib/ace/editor.js
@@ -1426,7 +1426,8 @@ Editor.$uid = 0;
this.removeToLineStart = function() {
if (this.selection.isEmpty())
this.selection.selectLineStart();
-
+ if (this.selection.isEmpty())
+ this.selection.selectLeft();
this.session.remove(this.getSelectionRange());
this.clearSelection();
};
From 23cd324d06609bddbd03810bdef44fd979f00589 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Fri, 27 Jul 2018 23:06:04 +0400
Subject: [PATCH 0131/1293] add sublime keybinding
---
lib/ace/ext/options.js | 4 +-
lib/ace/keyboard/state_handler.js | 249 -----------------
lib/ace/keyboard/sublime.js | 425 ++++++++++++++++++++++++++++++
lib/ace/keyboard/sublime_test.js | 75 ++++++
lib/ace/test/all_browser.js | 1 +
5 files changed, 503 insertions(+), 251 deletions(-)
delete mode 100644 lib/ace/keyboard/state_handler.js
create mode 100644 lib/ace/keyboard/sublime.js
create mode 100644 lib/ace/keyboard/sublime_test.js
diff --git a/lib/ace/ext/options.js b/lib/ace/ext/options.js
index 21d2116a345..dafe40387c8 100644
--- a/lib/ace/ext/options.js
+++ b/lib/ace/ext/options.js
@@ -39,8 +39,8 @@ var optionGroups = {
items: [
{ caption : "Ace", value : null },
{ caption : "Vim", value : "ace/keyboard/vim" },
- { caption : "Emacs", value : "ace/keyboard/emacs" }
- // { caption : "Sublime", value : "ace/keyboard/sublime" }
+ { caption : "Emacs", value : "ace/keyboard/emacs" },
+ { caption : "Sublime", value : "ace/keyboard/sublime" }
]
},
"Font Size": {
diff --git a/lib/ace/keyboard/state_handler.js b/lib/ace/keyboard/state_handler.js
deleted file mode 100644
index 6859e743bd9..00000000000
--- a/lib/ace/keyboard/state_handler.js
+++ /dev/null
@@ -1,249 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Distributed under the BSD license:
- *
- * Copyright (c) 2010, Ajax.org B.V.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Ajax.org B.V. nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * ***** END LICENSE BLOCK ***** */
-
-define(function(require, exports, module) {
-"use strict";
-
-// If you're developing a new keymapping and want to get an idea what's going
-// on, then enable debugging.
-var DEBUG = false;
-
-function StateHandler(keymapping) {
- this.keymapping = this.$buildKeymappingRegex(keymapping);
-}
-
-StateHandler.prototype = {
- /*
- * Build the RegExp from the keymapping as RegExp can't stored directly
- * in the metadata JSON and as the RegExp used to match the keys/buffer
- * need to be adapted.
- */
- $buildKeymappingRegex: function(keymapping) {
- for (var state in keymapping) {
- this.$buildBindingsRegex(keymapping[state]);
- }
- return keymapping;
- },
-
- $buildBindingsRegex: function(bindings) {
- // Escape a given Regex string.
- bindings.forEach(function(binding) {
- if (binding.key) {
- binding.key = new RegExp('^' + binding.key + '$');
- } else if (Array.isArray(binding.regex)) {
- if (!('key' in binding))
- binding.key = new RegExp('^' + binding.regex[1] + '$');
- binding.regex = new RegExp(binding.regex.join('') + '$');
- } else if (binding.regex) {
- binding.regex = new RegExp(binding.regex + '$');
- }
- });
- },
-
- $composeBuffer: function(data, hashId, key, e) {
- // Initialize the data object.
- if (data.state == null || data.buffer == null) {
- data.state = "start";
- data.buffer = "";
- }
-
- var keyArray = [];
- if (hashId & 1) keyArray.push("ctrl");
- if (hashId & 8) keyArray.push("command");
- if (hashId & 2) keyArray.push("option");
- if (hashId & 4) keyArray.push("shift");
- if (key) keyArray.push(key);
-
- var symbolicName = keyArray.join("-");
- var bufferToUse = data.buffer + symbolicName;
-
- // Don't add the symbolic name to the key buffer if the alt_ key is
- // part of the symbolic name. If it starts with alt_, this means
- // that the user hit an alt keycombo and there will be a single,
- // new character detected after this event, which then will be
- // added to the buffer (e.g. alt_j will result in ∆).
- //
- // We test for 2 and not for & 2 as we only want to exclude the case where
- // the option key is pressed alone.
- if (hashId != 2) {
- data.buffer = bufferToUse;
- }
-
- var bufferObj = {
- bufferToUse: bufferToUse,
- symbolicName: symbolicName
- };
-
- if (e) {
- bufferObj.keyIdentifier = e.keyIdentifier;
- }
-
- return bufferObj;
- },
-
- $find: function(data, buffer, symbolicName, hashId, key, keyIdentifier) {
- // Holds the command to execute and the args if a command matched.
- var result = {};
-
- // Loop over all the bindings of the keymap until a match is found.
- this.keymapping[data.state].some(function(binding) {
- var match;
-
- // Check if the key matches.
- if (binding.key && !binding.key.test(symbolicName)) {
- return false;
- }
-
- // Check if the regex matches.
- if (binding.regex && !(match = binding.regex.exec(buffer))) {
- return false;
- }
-
- // Check if the match function matches.
- if (binding.match && !binding.match(buffer, hashId, key, symbolicName, keyIdentifier)) {
- return false;
- }
-
- // Check for disallowed matches.
- if (binding.disallowMatches) {
- for (var i = 0; i < binding.disallowMatches.length; i++) {
- if (!!match[binding.disallowMatches[i]]) {
- return false;
- }
- }
- }
-
- // If there is a command to execute, then figure out the
- // command and the arguments.
- if (binding.exec) {
- result.command = binding.exec;
-
- // Build the arguments.
- if (binding.params) {
- var value;
- result.args = {};
- binding.params.forEach(function(param) {
- if (param.match != null && match != null) {
- value = match[param.match] || param.defaultValue;
- } else {
- value = param.defaultValue;
- }
-
- if (param.type === 'number') {
- value = parseInt(value);
- }
-
- result.args[param.name] = value;
- });
- }
- data.buffer = "";
- }
-
- // Handle the 'then' property.
- if (binding.then) {
- data.state = binding.then;
- data.buffer = "";
- }
-
- // If no command is set, then execute the "null" fake command.
- if (result.command == null) {
- result.command = "null";
- }
-
- if (DEBUG) {
- console.log("KeyboardStateMapper#find", binding);
- }
- return true;
- });
-
- if (result.command) {
- return result;
- } else {
- data.buffer = "";
- return false;
- }
- },
-
- /*
- * This function is called by keyBinding.
- */
- handleKeyboard: function(data, hashId, key, keyCode, e) {
- if (hashId == -1)
- hashId = 0;
- // If we pressed any command key but no other key, then ignore the input.
- // Otherwise "shift-" is added to the buffer, and later on "shift-g"
- // which results in "shift-shift-g" which doesn't make sense.
- if (hashId != 0 && (key == "" || key == String.fromCharCode(0))) {
- return null;
- }
-
- // Compute the current value of the keyboard input buffer.
- var r = this.$composeBuffer(data, hashId, key, e);
- var buffer = r.bufferToUse;
- var symbolicName = r.symbolicName;
- var keyId = r.keyIdentifier;
-
- r = this.$find(data, buffer, symbolicName, hashId, key, keyId);
- if (DEBUG) {
- console.log("KeyboardStateMapper#match", buffer, symbolicName, r);
- }
-
- return r;
- }
-};
-
-/*
- * This is a useful matching function and therefore is defined here so that
- * users of KeyboardStateMapper can use it.
- *
- * @return {Boolean} If no command key (Command|Option|Shift|Ctrl) is pressed, it
- * returns true. If the only the Shift key is pressed + a character
- * true is returned as well. Otherwise, false is returned.
- * Summing up, the function returns true whenever the user typed
- * a normal character on the keyboard and no shortcut.
- */
-exports.matchCharacterOnly = function(buffer, hashId, key, symbolicName) {
- // If no command keys are pressed, then catch the input.
- if (hashId == 0) {
- return true;
- }
- // If only the shift key is pressed and a character key, then
- // catch that input as well.
- else if ((hashId == 4) && key.length == 1) {
- return true;
- }
- // Otherwise, we let the input got through.
- else {
- return false;
- }
-};
-
-exports.StateHandler = StateHandler;
-});
diff --git a/lib/ace/keyboard/sublime.js b/lib/ace/keyboard/sublime.js
new file mode 100644
index 00000000000..0e6237bc632
--- /dev/null
+++ b/lib/ace/keyboard/sublime.js
@@ -0,0 +1,425 @@
+define(function(require, exports, module) {
+"use strict";
+
+var keyUtil = require("../lib/keys");
+var oop = require("../lib/oop");
+var useragent = require("../lib/useragent");
+var HashHandler = require("../keyboard/hash_handler").HashHandler;
+
+function moveBySubWords(editor, direction, extend) {
+ var selection = editor.selection;
+ var row = selection.lead.row;
+ var column = selection.lead.column;
+
+ var line = editor.session.getLine(row);
+ if (!line[column + direction]) {
+ var method = (extend ? "selectWord" : "moveCursorShortWord")
+ + (direction == 1 ? "Right" : "Left");
+ return editor.selection[method]();
+ }
+ if (direction == -1) column--;
+ while (line[column]) {
+ var type = getType(line[column]) + getType(line[column + direction]);
+ column += direction;
+ if (direction == 1) {
+ if (type == "WW" && getType(line[column + 1]) == "w")
+ break;
+ }
+ else {
+ if (type == "wW") {
+ if (getType(line[column - 1]) == "W") {
+ column -= 1;
+ break;
+ } else {
+ continue;
+ }
+ }
+ if (type == "Ww")
+ break;
+ }
+ if (/w[s_oW]|_[sWo]|o[s_wW]|s[W]|W[so]/.test(type))
+ break;
+ }
+ if (direction == -1) column++;
+ if (extend)
+ editor.selection.moveCursorTo(row, column);
+ else
+ editor.selection.moveTo(row, column);
+
+ function getType(x) {
+ if (!x) return "-";
+ if (/\s/.test(x)) return "s";
+ if (x == "_") return "_";
+ if (x.toUpperCase() == x && x.toLowerCase() != x) return "W";
+ if (x.toUpperCase() != x && x.toLowerCase() == x) return "w";
+ return "o";
+ }
+}
+
+exports.handler = new HashHandler();
+
+exports.handler.addCommands([{
+ name: "find_all_under",
+ exec: function(editor) {
+ if (editor.selection.isEmpty())
+ editor.selection.selectWord();
+ editor.findAll();
+ },
+ readOnly: true
+}, {
+ name: "find_under",
+ exec: function(editor) {
+ if (editor.selection.isEmpty())
+ editor.selection.selectWord();
+ editor.findNext();
+ },
+ readOnly: true
+}, {
+ name: "find_under_prev",
+ exec: function(editor) {
+ if (editor.selection.isEmpty())
+ editor.selection.selectWord();
+ editor.findPrevious();
+ },
+ readOnly: true
+}, {
+ name: "find_under_expand",
+ exec: function(editor) {
+ editor.selectMore(1, false, true);
+ },
+ scrollIntoView: "animate",
+ readOnly: true
+}, {
+ name: "find_under_expand_skip",
+ exec: function(editor) {
+ editor.selectMore(1, true, true);
+ },
+ scrollIntoView: "animate",
+ readOnly: true
+}, {
+ name: "delete_to_hard_bol",
+ exec: function(editor) {
+ var pos = editor.selection.getCursor();
+ editor.session.remove({
+ start: { row: pos.row, column: 0 },
+ end: pos
+ });
+ },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor"
+}, {
+ name: "delete_to_hard_eol",
+ exec: function(editor) {
+ var pos = editor.selection.getCursor();
+ editor.session.remove({
+ start: pos,
+ end: { row: pos.row, column: Infinity }
+ });
+ },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor"
+}, {
+ name: "moveToWordStartLeft",
+ exec: function(editor) {
+ editor.selection.moveCursorLongWordLeft();
+ editor.clearSelection();
+ },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor"
+}, {
+ name: "moveToWordEndRight",
+ exec: function(editor) {
+ editor.selection.moveCursorLongWordRight();
+ editor.clearSelection();
+ },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor"
+}, {
+ name: "selectToWordStartLeft",
+ exec: function(editor) {
+ var sel = editor.selection;
+ sel.$moveSelection(sel.moveCursorLongWordLeft);
+ },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor"
+}, {
+ name: "selectToWordEndRight",
+ exec: function(editor) {
+ var sel = editor.selection;
+ sel.$moveSelection(sel.moveCursorLongWordRight);
+ },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor"
+}, {
+ name: "selectSubWordRight",
+ exec: function(editor) {
+ moveBySubWords(editor, 1, true);
+ },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "selectSubWordLeft",
+ exec: function(editor) {
+ moveBySubWords(editor, -1, true);
+ },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "moveSubWordRight",
+ exec: function(editor) {
+ moveBySubWords(editor, 1);
+ },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "moveSubWordLeft",
+ exec: function(editor) {
+ moveBySubWords(editor, -1);
+ },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor",
+ readOnly: true
+}]);
+
+
+[{
+ bindKey: { mac: "cmd-k cmd-backspace|cmd-backspace", win: "ctrl-shift-backspace|ctrl-k ctrl-backspace" },
+ name: "removetolinestarthard"
+}, {
+ bindKey: { mac: "cmd-k cmd-k|cmd-delete|ctrl-k", win: "ctrl-shift-delete|ctrl-k ctrl-k" },
+ name: "removetolineendhard"
+}, {
+ bindKey: { mac: "cmd-shift-d", win: "ctrl-shift-d" },
+ name: "duplicateSelection"
+}, {
+ bindKey: { mac: "cmd-l", win: "ctrl-l" },
+ name: "expandtoline"
+},
+{
+ bindKey: {mac: "cmd-shift-a", win: "ctrl-shift-a"},
+ name: "expandSelection",
+ args: {to: "tag"}
+}, {
+ bindKey: {mac: "cmd-shift-j", win: "ctrl-shift-j"},
+ name: "expandSelection",
+ args: {to: "indentation"}
+}, {
+ bindKey: {mac: "ctrl-shift-m", win: "ctrl-shift-m"},
+ name: "expandSelection",
+ args: {to: "brackets"}
+}, {
+ bindKey: {mac: "cmd-shift-space", win: "ctrl-shift-space"},
+ name: "expandSelection",
+ args: {to: "scope"}
+},
+{
+ bindKey: { mac: "ctrl-cmd-g", win: "alt-f3" },
+ name: "find_all_under"
+}, {
+ bindKey: { mac: "alt-cmd-g", win: "ctrl-f3" },
+ name: "find_under"
+}, {
+ bindKey: { mac: "shift-alt-cmd-g", win: "ctrl-shift-f3" },
+ name: "find_under_prev"
+}, {
+ bindKey: { mac: "cmd-g", win: "f3" },
+ name: "findnext"
+}, {
+ bindKey: { mac: "shift-cmd-g", win: "shift-f3" },
+ name: "findprevious"
+}, {
+ bindKey: { mac: "cmd-d", win: "ctrl-d" },
+ name: "find_under_expand"
+}, {
+ bindKey: { mac: "cmd-k cmd-d", win: "ctrl-k ctrl-d" },
+ name: "find_under_expand_skip"
+},
+
+/* fold */
+{
+ bindKey: { mac: "cmd-alt-[", win: "ctrl-shift-[" },
+ name: "toggleFoldWidget"
+}, {
+ bindKey: { mac: "cmd-alt-]", win: "ctrl-shift-]" },
+ name: "unfold"
+}, {
+ bindKey: { mac: "cmd-k cmd-0|cmd-k cmd-j", win: "ctrl-k ctrl-0|ctrl-k ctrl-j" },
+ name: "unfoldall"
+}, {
+ bindKey: { mac: "cmd-k cmd-1", win: "ctrl-k ctrl-1" },
+ name: "foldOther",
+ args: { level: 1 }
+},
+
+
+/* move */
+{
+ bindKey: { win: "ctrl-left", mac: "alt-left" },
+ name: "moveToWordStartLeft"
+}, {
+ bindKey: { win: "ctrl-right", mac: "alt-right" },
+ name: "moveToWordEndRight"
+}, {
+ bindKey: { win: "ctrl-shift-left", mac: "alt-shift-left" },
+ name: "selectToWordStartLeft"
+}, {
+ bindKey: { win: "ctrl-shift-right", mac: "alt-shift-right" },
+ name: "selectToWordEndRight"
+},
+
+// subwords
+{
+ bindKey: {mac: "ctrl-alt-shift-right|ctrl-shift-right", win: "alt-shift-right"},
+ name: "selectSubWordRight"
+}, {
+ bindKey: {mac: "ctrl-alt-shift-left|ctrl-shift-left", win: "alt-shift-left"},
+ name: "selectSubWordLeft"
+}, {
+ bindKey: {mac: "ctrl-alt-right|ctrl-right", win: "alt-right"},
+ name: "moveSubWordRight"
+}, {
+ bindKey: {mac: "ctrl-alt-left|ctrl-left", win: "alt-left"},
+ name: "moveSubWordLeft"
+},
+{
+ bindKey: { mac: "ctrl-m", win: "ctrl-m" },
+ name: "jumptomatching",
+ args: { to: "brackets" }
+},
+{
+ bindKey: { mac: "ctrl-f6", win: "ctrl-f6" },
+ name: "goToNextError"
+}, {
+ bindKey: { mac: "ctrl-shift-f6", win: "ctrl-shift-f6" },
+ name: "goToPreviousError"
+},
+
+{
+ bindKey: { mac: "ctrl-o" },
+ name: "splitline"
+},
+{
+ bindKey: {mac: "ctrl-shift-w", win: "alt-shift-w"},
+ name: "surrowndWithTag"
+},{
+ bindKey: {mac: "cmd-alt-.", win: "alt-."},
+ name: "close_tag"
+},
+{
+ bindKey: { mac: "cmd-j", win: "ctrl-j" },
+ name: "joinlines"
+},
+
+{
+ bindKey: {mac: "ctrl--", win: "alt--"},
+ name: "jumpBack"
+}, {
+ bindKey: {mac: "ctrl-shift--", win: "alt-shift--"},
+ name: "jumpForward"
+},
+
+{
+ bindKey: { mac: "cmd-k cmd-l", win: "ctrl-k ctrl-l" },
+ name: "tolowercase"
+}, {
+ bindKey: { mac: "cmd-k cmd-u", win: "ctrl-k ctrl-u" },
+ name: "touppercase"
+},
+
+{
+ bindKey: {mac: "cmd-shift-v", win: "ctrl-shift-v"},
+ name: "paste_and_indent"
+}, {
+ bindKey: {mac: "cmd-k cmd-v|cmd-alt-v", win: "ctrl-k ctrl-v"},
+ name: "paste_from_history"
+},
+
+{
+ bindKey: { mac: "cmd-shift-enter", win: "ctrl-shift-enter" },
+ name: "addLineBefore"
+}, {
+ bindKey: { mac: "cmd-enter", win: "ctrl-enter" },
+ name: "addLineAfter"
+}, {
+ bindKey: { mac: "ctrl-shift-k", win: "ctrl-shift-k" },
+ name: "removeline"
+}, {
+ bindKey: { mac: "ctrl-alt-up", win: "ctrl-up" },
+ name: "scrollup"
+}, {
+ bindKey: { mac: "ctrl-alt-down", win: "ctrl-down" },
+ name: "scrolldown"
+}, {
+ bindKey: { mac: "cmd-a", win: "ctrl-a" },
+ name: "selectall"
+}, {
+ bindKey: { linux: "alt-shift-down", mac: "ctrl-shift-down", win: "ctrl-alt-down" },
+ name: "addCursorBelow"
+}, {
+ bindKey: { linux: "alt-shift-up", mac: "ctrl-shift-up", win: "ctrl-alt-up" },
+ name: "addCursorAbove"
+},
+
+
+{
+ bindKey: { mac: "cmd-k cmd-c|ctrl-l", win: "ctrl-k ctrl-c" },
+ name: "centerselection"
+},
+
+{
+ bindKey: { mac: "f5", win: "f9" },
+ name: "sortlines"
+},
+{
+ bindKey: {mac: "ctrl-f5", win: "ctrl-f9"},
+ name: "sortlines",
+ args: {caseSensitive: true}
+},
+{
+ bindKey: { mac: "cmd-shift-l", win: "ctrl-shift-l" },
+ name: "splitIntoLines"
+}, {
+ bindKey: { mac: "ctrl-cmd-down", win: "ctrl-shift-down" },
+ name: "movelinesdown"
+}, {
+ bindKey: { mac: "ctrl-cmd-up", win: "ctrl-shift-up" },
+ name: "movelinesup"
+}, {
+ bindKey: { mac: "alt-down", win: "alt-down" },
+ name: "modifyNumberDown"
+}, {
+ bindKey: { mac: "alt-up", win: "alt-up" },
+ name: "modifyNumberUp"
+}, {
+ bindKey: { mac: "cmd-/", win: "ctrl-/" },
+ name: "togglecomment"
+}, {
+ bindKey: { mac: "cmd-alt-/", win: "ctrl-shift-/" },
+ name: "toggleBlockComment"
+},
+
+
+{
+ bindKey: { linux: "ctrl-alt-q", mac: "ctrl-q", win: "ctrl-q" },
+ name: "togglerecording"
+}, {
+ bindKey: { linux: "ctrl-alt-shift-q", mac: "ctrl-shift-q", win: "ctrl-shift-q" },
+ name: "replaymacro"
+},
+
+{
+ bindKey: { mac: "ctrl-t", win: "ctrl-t" },
+ name: "transpose"
+}
+
+].forEach(function(binding) {
+ var command = exports.handler.commands[binding.name];
+ if (command)
+ command.bindKey = binding.bindKey;
+ exports.handler.bindKey(binding.bindKey, command || binding.name);
+});
+
+});
diff --git a/lib/ace/keyboard/sublime_test.js b/lib/ace/keyboard/sublime_test.js
new file mode 100644
index 00000000000..9630c9d93c9
--- /dev/null
+++ b/lib/ace/keyboard/sublime_test.js
@@ -0,0 +1,75 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Ajax.org B.V. nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+ require("amd-loader");
+ require("../test/mockdom");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+require("../multi_select");
+
+var EditSession = require("./../edit_session").EditSession;
+var Editor = require("./../editor").Editor;
+var Range = require("./../range").Range;
+var MockRenderer = require("./../test/mockrenderer").MockRenderer;
+var assert = require("./../test/assertions");
+var handler = require("./sublime").handler;
+var editor;
+
+function initEditor(docString) {
+ var doc = new EditSession(docString.split("\n"));
+ editor = new Editor(new MockRenderer(), doc);
+ editor.setKeyboardHandler(handler);
+}
+
+module.exports = {
+
+ "test: move by subwords": function() {
+ initEditor("\n abcDefGHKLmn_op ++ xyz$\nt");
+
+ [0, 3, 6, 9, 12, 15, 18, 21, 25, 26, 0, 1, 1].forEach(function(col) {
+ assert.equal(editor.selection.lead.column, col);
+ editor.execCommand(handler.commands.moveSubWordRight);
+ });
+ [1, 0, 26, 25, 22, 19, 16, 12, 9, 6, 3, 0, 0].forEach(function(col) {
+ assert.equal(editor.selection.lead.column, col);
+ editor.execCommand(handler.commands.moveSubWordLeft);
+ });
+ }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+ require("asyncjs").test.testcase(module.exports).exec();
+}
diff --git a/lib/ace/test/all_browser.js b/lib/ace/test/all_browser.js
index 783289007af..13acb416d4c 100644
--- a/lib/ace/test/all_browser.js
+++ b/lib/ace/test/all_browser.js
@@ -32,6 +32,7 @@ var testNames = [
"ace/keyboard/keybinding_test",
"ace/keyboard/vim_test",
"ace/keyboard/vim_ace_test",
+ "ace/keyboard/sublime_test",
"ace/layer/text_test",
"ace/lib/event_emitter_test",
"ace/mode/coffee/parser_test",
From 5ec606ffcf780699ecfb663cbdbf9583c12a6d71 Mon Sep 17 00:00:00 2001
From: Harutyun Amirjanyan
Date: Wed, 20 Feb 2019 00:02:07 +0400
Subject: [PATCH 0132/1293] fix highlighting of raw identifiers
---
lib/ace/mode/rust_highlight_rules.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/ace/mode/rust_highlight_rules.js b/lib/ace/mode/rust_highlight_rules.js
index 538d9ccb2c9..718e79ee1bd 100644
--- a/lib/ace/mode/rust_highlight_rules.js
+++ b/lib/ace/mode/rust_highlight_rules.js
@@ -49,6 +49,8 @@ var RustHighlightRules = function() {
regex: '\'[a-zA-Z_][a-zA-Z0-9_]*(?![\\\'])' },
{ token: 'string.quoted.single.source.rust',
regex: "'(?:[^'\\\\]|" + stringEscape + ")'" },
+ { token: 'identifier',
+ regex: /r#[a-zA-Z_][a-zA-Z0-9_]*\b/ },
{
stateName: "bracketedComment",
onMatch : function(value, currentState, stack){
@@ -88,7 +90,7 @@ var RustHighlightRules = function() {
regex: stringEscape },
{ defaultToken: 'string.quoted.double.source.rust' } ] },
{ token: [ 'keyword.source.rust', 'text', 'entity.name.function.source.rust' ],
- regex: '\\b(fn)(\\s+)([a-zA-Z_][a-zA-Z0-9_]*)' },
+ regex: '\\b(fn)(\\s+)((?:r#)?[a-zA-Z_][a-zA-Z0-9_]*)' },
{ token: 'support.constant', regex: '\\b[a-zA-Z_][\\w\\d]*::' },
{ token: 'keyword.source.rust',
regex: '\\b(?:abstract|alignof|as|become|box|break|catch|continue|const|crate|default|do|dyn|else|enum|extern|for|final|if|impl|in|let|loop|macro|match|mod|move|mut|offsetof|override|priv|proc|pub|pure|ref|return|self|sizeof|static|struct|super|trait|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\\b' },
From 58828f5613fc8865dc6ffeb1d3365aa62c5ee09c Mon Sep 17 00:00:00 2001
From: nightwing
Date: Tue, 5 Feb 2019 00:05:22 +0400
Subject: [PATCH 0133/1293] allow passing Worker instance to WorkerClient
---
lib/ace/worker/worker_client.js | 97 +++++++++++++++++----------------
1 file changed, 50 insertions(+), 47 deletions(-)
diff --git a/lib/ace/worker/worker_client.js b/lib/ace/worker/worker_client.js
index d28ee255a92..7c7be791738 100644
--- a/lib/ace/worker/worker_client.js
+++ b/lib/ace/worker/worker_client.js
@@ -63,37 +63,14 @@ function createWorker(workerUrl) {
return new Worker(workerUrl);
}
-var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl, importScripts) {
+var WorkerClient = function(worker) {
+ if (!worker.postMessage)
+ worker = this.$createWorkerFromOldConfig.apply(this, arguments);
+
+ this.$worker = worker;
this.$sendDeltaQueue = this.$sendDeltaQueue.bind(this);
this.changeListener = this.changeListener.bind(this);
this.onMessage = this.onMessage.bind(this);
-
- // nameToUrl is renamed to toUrl in requirejs 2
- if (require.nameToUrl && !require.toUrl)
- require.toUrl = require.nameToUrl;
-
- if (config.get("packaged") || !require.toUrl) {
- workerUrl = workerUrl || config.moduleUrl(mod, "worker");
- } else {
- var normalizePath = this.$normalizePath;
- workerUrl = workerUrl || normalizePath(require.toUrl("ace/worker/worker.js", null, "_"));
-
- var tlns = {};
- topLevelNamespaces.forEach(function(ns) {
- tlns[ns] = normalizePath(require.toUrl(ns, null, "_").replace(/(\.js)?(\?.*)?$/, ""));
- });
- }
-
- this.$worker = exports.createWorker(workerUrl);
- if (importScripts) {
- this.send("importScripts", importScripts);
- }
- this.$worker.postMessage({
- init : true,
- tlns : tlns,
- module : mod,
- classname : classname
- });
this.callbackId = 1;
this.callbacks = {};
@@ -105,6 +82,36 @@ var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl, impor
oop.implement(this, EventEmitter);
+ this.$createWorkerFromOldConfig = function(topLevelNamespaces, mod, classname, workerUrl, importScripts) {
+ // nameToUrl is renamed to toUrl in requirejs 2
+ if (require.nameToUrl && !require.toUrl)
+ require.toUrl = require.nameToUrl;
+
+ if (config.get("packaged") || !require.toUrl) {
+ workerUrl = workerUrl || config.moduleUrl(mod, "worker");
+ } else {
+ var normalizePath = this.$normalizePath;
+ workerUrl = workerUrl || normalizePath(require.toUrl("ace/worker/worker.js", null, "_"));
+
+ var tlns = {};
+ topLevelNamespaces.forEach(function(ns) {
+ tlns[ns] = normalizePath(require.toUrl(ns, null, "_").replace(/(\.js)?(\?.*)?$/, ""));
+ });
+ }
+
+ this.$worker = createWorker(workerUrl);
+ if (importScripts) {
+ this.send("importScripts", importScripts);
+ }
+ this.$worker.postMessage({
+ init : true,
+ tlns : tlns,
+ module : mod,
+ classname : classname
+ });
+ return this.$worker;
+ };
+
this.onMessage = function(e) {
var msg = e.data;
switch (msg.type) {
@@ -205,32 +212,28 @@ var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl, impor
var UIWorkerClient = function(topLevelNamespaces, mod, classname) {
- this.$sendDeltaQueue = this.$sendDeltaQueue.bind(this);
- this.changeListener = this.changeListener.bind(this);
- this.callbackId = 1;
- this.callbacks = {};
- this.messageBuffer = [];
-
var main = null;
var emitSync = false;
var sender = Object.create(EventEmitter);
- var _self = this;
- this.$worker = {};
- this.$worker.terminate = function() {};
- this.$worker.postMessage = function(e) {
- _self.messageBuffer.push(e);
- if (main) {
+ var messageBuffer = [];
+ var workerClient = new WorkerClient({
+ messageBuffer: messageBuffer,
+ terminate: function() {},
+ postMessage: function(e) {
+ messageBuffer.push(e);
+ if (!main) return;
if (emitSync)
setTimeout(processNext);
else
processNext();
}
- };
- this.setEmitSync = function(val) { emitSync = val; };
+ });
+
+ workerClient.setEmitSync = function(val) { emitSync = val; };
var processNext = function() {
- var msg = _self.messageBuffer.shift();
+ var msg = messageBuffer.shift();
if (msg.command)
main[msg.command].apply(main, msg.args);
else if (msg.event)
@@ -238,7 +241,7 @@ var UIWorkerClient = function(topLevelNamespaces, mod, classname) {
};
sender.postMessage = function(msg) {
- _self.onMessage({data: msg});
+ workerClient.onMessage({data: msg});
};
sender.callback = function(data, callbackId) {
this.postMessage({type: "call", id: callbackId, data: data});
@@ -249,12 +252,12 @@ var UIWorkerClient = function(topLevelNamespaces, mod, classname) {
config.loadModule(["worker", mod], function(Main) {
main = new Main[classname](sender);
- while (_self.messageBuffer.length)
+ while (messageBuffer.length)
processNext();
});
-};
-UIWorkerClient.prototype = WorkerClient.prototype;
+ return workerClient;
+};
exports.UIWorkerClient = UIWorkerClient;
exports.WorkerClient = WorkerClient;
From abc6330dee91048ae79d1359247e4f071d8358be Mon Sep 17 00:00:00 2001
From: nightwing
Date: Thu, 21 Feb 2019 15:51:39 +0400
Subject: [PATCH 0134/1293] enable css completions in scss mode
---
lib/ace/mode/css_completions.js | 6 +-----
lib/ace/mode/scss.js | 8 ++++++++
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/lib/ace/mode/css_completions.js b/lib/ace/mode/css_completions.js
index bda5f11b5f3..178e7ed93ae 100644
--- a/lib/ace/mode/css_completions.js
+++ b/lib/ace/mode/css_completions.js
@@ -156,11 +156,7 @@ var CssCompletions = function() {
this.defineCompletions();
}
- var token = session.getTokenAt(pos.row, pos.column);
-
- if (!token)
- return [];
- if (state==='ruleset'){
+ if (state==='ruleset' || session.$mode.$id == "ace/mode/scss") {
//css attribute value
var line = session.getLine(pos.row).substr(0, pos.column);
if (/:[^;]+$/.test(line)) {
diff --git a/lib/ace/mode/scss.js b/lib/ace/mode/scss.js
index f672d2571cf..bffc3bbb45c 100644
--- a/lib/ace/mode/scss.js
+++ b/lib/ace/mode/scss.js
@@ -37,11 +37,14 @@ var ScssHighlightRules = require("./scss_highlight_rules").ScssHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var CssBehaviour = require("./behaviour/css").CssBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+var CssCompletions = require("./css_completions").CssCompletions;
+
var Mode = function() {
this.HighlightRules = ScssHighlightRules;
this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CssBehaviour();
+ this.$completer = new CssCompletions();
this.foldingRules = new CStyleFoldMode();
};
oop.inherits(Mode, TextMode);
@@ -75,6 +78,11 @@ oop.inherits(Mode, TextMode);
this.autoOutdent = function(state, doc, row) {
this.$outdent.autoOutdent(doc, row);
};
+
+ this.getCompletions = function(state, session, pos, prefix) {
+ return this.$completer.getCompletions(state, session, pos, prefix);
+ };
+
this.$id = "ace/mode/scss";
}).call(Mode.prototype);
From b23ed2497333b18bf7d7dc4d1fb25d6a59198f9f Mon Sep 17 00:00:00 2001
From: nightwing
Date: Thu, 21 Feb 2019 16:54:36 +0400
Subject: [PATCH 0135/1293] release v1.4.3
---
ChangeLog.txt | 5 +++++
Makefile.dryice.js | 2 +-
build | 2 +-
lib/ace/ace.js | 2 +-
package.json | 2 +-
5 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/ChangeLog.txt b/ChangeLog.txt
index edb2a450d89..6be5d6d98b1 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,3 +1,8 @@
+2019.02.21 Version 1.4.3
+* add sublime keybindings
+* add rtl option
+* implement ` and < textobjects in vim mode
+
2018.11.21 Version 1.4.2
* fix regression in vim mode
* improve keyboard input handling on ipad and IE
diff --git a/Makefile.dryice.js b/Makefile.dryice.js
index d7d5e33b6a9..dc5776114f9 100755
--- a/Makefile.dryice.js
+++ b/Makefile.dryice.js
@@ -397,7 +397,7 @@ function buildAce(options, callback) {
}, "theme-" + name, addCb());
});
// keybindings
- ["vim", "emacs"].forEach(function(name) {
+ ["vim", "emacs", "sublime"].forEach(function(name) {
buildSubmodule(options, {
projectType: "keybinding",
require: ["ace/keyboard/" + name ]
diff --git a/build b/build
index 0d62c26de7b..32e27226d66 160000
--- a/build
+++ b/build
@@ -1 +1 @@
-Subproject commit 0d62c26de7b2e1922d8dd95ba587c9845c018c51
+Subproject commit 32e27226d66b2f3a63d4e393853f84ef3e17a003
diff --git a/lib/ace/ace.js b/lib/ace/ace.js
index cdd0e6fe03e..a40add50732 100644
--- a/lib/ace/ace.js
+++ b/lib/ace/ace.js
@@ -132,5 +132,5 @@ exports.Editor = Editor;
exports.EditSession = EditSession;
exports.UndoManager = UndoManager;
exports.VirtualRenderer = Renderer;
-exports.version = "1.4.2";
+exports.version = "1.4.3";
});
diff --git a/package.json b/package.json
index a3d44ced9a5..7d4405cd5f1 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "ace",
"description": "Ajax.org Code Editor is a full featured source code highlighting editor that powers the Cloud9 IDE",
- "version": "1.4.2",
+ "version": "1.4.3",
"homepage": "http://github.com/ajaxorg/ace",
"engines": {
"node": ">= 0.6.0"
From 6babd4889ed1182252d71fae80fac5930e2e0368 Mon Sep 17 00:00:00 2001
From: Philip Pham
Date: Thu, 21 Feb 2019 19:59:00 -0800
Subject: [PATCH 0136/1293] Fixes Emacs' killRingSave Behavior
The mark should be cleared when saving to the kill ring. This is consistent with
the actual behvaior of Emacs. The change is similar to #2821.
Tested in the kitchen sink.
---
lib/ace/keyboard/emacs.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/ace/keyboard/emacs.js b/lib/ace/keyboard/emacs.js
index fe8be728cce..988ec7cce25 100644
--- a/lib/ace/keyboard/emacs.js
+++ b/lib/ace/keyboard/emacs.js
@@ -598,6 +598,7 @@ exports.handler.addCommands({
editor.$handlesEmacsOnCopy = false;
if (editor.inMultiSelectMode) editor.forEachSelection({exec: deselect});
else deselect();
+ editor.setEmacsMark(null);
editor.session.$emacsMarkRing = marks.concat(deselectedMarks.reverse());
}, 0);
},
From ffe830515465da890b6e13c2f33ca463f73c3377 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Mon, 4 Mar 2019 19:59:37 +0400
Subject: [PATCH 0137/1293] add nim and nginx modes
---
demo/kitchen-sink/docs/nginx.nginx | 70 +++++++++
demo/kitchen-sink/docs/nim.nim | 15 ++
lib/ace/ext/modelist.js | 2 +
lib/ace/mode/nginx.js | 55 +++++++
lib/ace/mode/nim.js | 57 ++++++++
lib/ace/mode/nim_highlight_rules.js | 217 ++++++++++++++++++++++++++++
6 files changed, 416 insertions(+)
create mode 100644 demo/kitchen-sink/docs/nginx.nginx
create mode 100644 demo/kitchen-sink/docs/nim.nim
create mode 100644 lib/ace/mode/nginx.js
create mode 100644 lib/ace/mode/nim.js
create mode 100644 lib/ace/mode/nim_highlight_rules.js
diff --git a/demo/kitchen-sink/docs/nginx.nginx b/demo/kitchen-sink/docs/nginx.nginx
new file mode 100644
index 00000000000..5fec6bc14eb
--- /dev/null
+++ b/demo/kitchen-sink/docs/nginx.nginx
@@ -0,0 +1,70 @@
+user www www; ## Default: nobody
+worker_processes 5; ## Default: 1
+error_log logs/error.log;
+pid logs/nginx.pid;
+worker_rlimit_nofile 8192;
+
+events {
+ worker_connections 4096; ## Default: 1024
+}
+
+http {
+ include conf/mime.types;
+ include /etc/nginx/proxy.conf;
+ include /etc/nginx/fastcgi.conf;
+ index index.html index.htm index.php;
+
+ default_type application/octet-stream;
+ log_format main '$remote_addr - $remote_user [$time_local] $status '
+ '"$request" $body_bytes_sent "$http_referer" '
+ '"$http_user_agent" "$http_x_forwarded_for"';
+ access_log logs/access.log main;
+ sendfile on;
+ tcp_nopush on;
+ server_names_hash_bucket_size 128; # this seems to be required for some vhosts
+
+ server { # php/fastcgi
+ listen 80;
+ server_name domain1.com www.domain1.com;
+ access_log logs/domain1.access.log main;
+ root html;
+
+ location ~ \.php$ {
+ fastcgi_pass 127.0.0.1:1025;
+ }
+ }
+
+ server { # simple reverse-proxy
+ listen 80;
+ server_name domain2.com www.domain2.com;
+ access_log logs/domain2.access.log main;
+
+ # serve static files
+ location ~ ^/(images|javascript|js|css|flash|media|static)/ {
+ root /var/www/virtual/big.server.com/htdocs;
+ expires 30d;
+ }
+
+ # pass requests for dynamic content to rails/turbogears/zope, et al
+ location / {
+ proxy_pass http://127.0.0.1:8080;
+ }
+ }
+
+ upstream big_server_com {
+ server 127.0.0.3:8000 weight=5;
+ server 127.0.0.3:8001 weight=5;
+ server 192.168.0.1:8000;
+ server 192.168.0.1:8001;
+ }
+
+ server { # simple load balancing
+ listen 80;
+ server_name big.server.com;
+ access_log logs/big.server.access.log main;
+
+ location / {
+ proxy_pass http://big_server_com;
+ }
+ }
+}
\ No newline at end of file
diff --git a/demo/kitchen-sink/docs/nim.nim b/demo/kitchen-sink/docs/nim.nim
new file mode 100644
index 00000000000..834514ab2c5
--- /dev/null
+++ b/demo/kitchen-sink/docs/nim.nim
@@ -0,0 +1,15 @@
+#[ #[ Multiline comment in already
+ commented out code. ]#
+proc p[T](x: T) = discard
+]#
+echo "This is code"
+var
+ p = 0B0_10001110100_0000101001000111101011101111111011000101001101001001'f64
+
+proc getAlphabet(): string =
+ var accm = ""
+ for letter in 'a'..'z': # see iterators
+ accm.add(letter)
+ return accm
+
+assert("a" * 10 == "aaaaaaaaaa")
diff --git a/lib/ace/ext/modelist.js b/lib/ace/ext/modelist.js
index f4ea2fde9a4..7fbb9140d7b 100644
--- a/lib/ace/ext/modelist.js
+++ b/lib/ace/ext/modelist.js
@@ -134,7 +134,9 @@ var supportedModes = {
MIXAL: ["mixal"],
MUSHCode: ["mc|mush"],
MySQL: ["mysql"],
+ Nginx: ["nginx|conf"],
Nix: ["nix"],
+ Nim: ["nim"],
NSIS: ["nsi|nsh"],
ObjectiveC: ["m|mm"],
OCaml: ["ml|mli"],
diff --git a/lib/ace/mode/nginx.js b/lib/ace/mode/nginx.js
new file mode 100644
index 00000000000..9a20d3c2a56
--- /dev/null
+++ b/lib/ace/mode/nginx.js
@@ -0,0 +1,55 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Ajax.org B.V. nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function (require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var NginxHighlightRules = require("./nginx_highlight_rules").NginxHighlightRules;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function () {
+ TextMode.call(this);
+ this.HighlightRules = NginxHighlightRules;
+ this.foldingRules = new CStyleFoldMode();
+};
+
+oop.inherits(Mode, TextMode);
+
+
+(function () {
+ this.lineCommentStart = "#";
+
+ this.$id = "ace/mode/nginx";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
diff --git a/lib/ace/mode/nim.js b/lib/ace/mode/nim.js
new file mode 100644
index 00000000000..51462e7728d
--- /dev/null
+++ b/lib/ace/mode/nim.js
@@ -0,0 +1,57 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Ajax.org B.V. nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function (require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var NimHighlightRules = require("./nim_highlight_rules").NimHighlightRules;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function () {
+ TextMode.call(this);
+ this.HighlightRules = NimHighlightRules;
+ this.foldingRules = new CStyleFoldMode();
+};
+
+oop.inherits(Mode, TextMode);
+
+
+(function () {
+ this.lineCommentStart = "#";
+ this.blockComment = {start: "#[", end: "]#", nestable: true};
+
+
+ this.$id = "ace/mode/nim";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
diff --git a/lib/ace/mode/nim_highlight_rules.js b/lib/ace/mode/nim_highlight_rules.js
new file mode 100644
index 00000000000..5d9158e19f8
--- /dev/null
+++ b/lib/ace/mode/nim_highlight_rules.js
@@ -0,0 +1,217 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Ajax.org B.V. nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function (require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+var NimHighlightRules = function () {
+
+ var keywordMapper = this.createKeywordMapper({
+ "variable": "var|let|const",
+ "keyword": "assert|parallel|spawn|export|include|from|template|mixin|bind|import|concept|raise|defer|try|finally|except|converter|proc|func|macro|method|and|or|not|xor|shl|shr|div|mod|in|notin|is|isnot|of|static|if|elif|else|case|of|discard|when|return|yield|block|break|while|echo|continue|asm|using|cast|addr|unsafeAddr|type|ref|ptr|do|declared|defined|definedInScope|compiles|sizeOf|is|shallowCopy|getAst|astToStr|spawn|procCall|for|iterator|as",
+ "storage.type": "newSeq|int|int8|int16|int32|int64|uint|uint8|uint16|uint32|uint64|float|char|bool|string|set|pointer|float32|float64|enum|object|cstring|array|seq|openArray|varargs|UncheckedArray|tuple|set|distinct|void|auto|openarray|range",
+ "support.function": "lock|ze|toU8|toU16|toU32|ord|low|len|high|add|pop|contains|card|incl|excl|dealloc|inc",
+ "constant.language": "nil|true|false"
+ }, "identifier");
+
+ var hexNumber = "(?:0[xX][\\dA-Fa-f][\\dA-Fa-f_]*)";
+ var decNumber = "(?:[0-9][\\d_]*)";
+ var octNumber = "(?:0o[0-7][0-7_]*)";
+ var binNumber = "(?:0[bB][01][01_]*)";
+ var intNumber = "(?:" + hexNumber + "|" + decNumber + "|" + octNumber + "|" + binNumber + ")(?:'?[iIuU](?:8|16|32|64)|u)?\\b";
+ var exponent = "(?:[eE][+-]?[\\d][\\d_]*)";
+ var floatNumber = "(?:[\\d][\\d_]*(?:[.][\\d](?:[\\d_]*)" + exponent + "?)|" + exponent + ")";
+ var floatNumberExt = "(?:" + hexNumber + "(?:'(?:(?:[fF](?:32|64)?)|[dD])))|(?:" + floatNumber + "|" + decNumber + "|" + octNumber + "|" + binNumber + ")(?:'(?:(?:[fF](?:32|64)?)|[dD]))";
+ var stringEscape = "\\\\([abeprcnlftv\\\"']|x[0-9A-Fa-f]{2}|[0-2][0-9]{2}|u[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})";
+ var identifier = '[a-zA-Z][a-zA-Z0-9_]*';
+ this.$rules = {
+ "start": [{
+ token: ["identifier", "keyword.operator", "support.function"],
+ regex: "(" + identifier + ")([.]{1})(" + identifier + ")(?=\\()"
+ }, {//pragmas
+ token: "paren.lpar",
+ regex: "(\\{\\.)",
+ next: [{
+ token: "paren.rpar",
+ regex: '(\\.\\}|\\})',
+ next: "start"
+ }, {
+ include: "methods"
+ }, {
+ token: "identifier",
+ regex: identifier
+ }, {
+ token: "punctuation",
+ regex: /[,]/
+ }, {
+ token: "keyword.operator",
+ regex: /[=:.]/
+ }, {
+ token: "paren.lpar",
+ regex: /[[(]/
+ }, {
+ token: "paren.rpar",
+ regex: /[\])]/
+ }, {
+ include: "math"
+ }, {
+ include: "strings"
+ }, {
+ defaultToken: "text"
+ }]
+ }, {
+ token: "comment.doc.start",
+ regex: /##\[(?!])/,
+ push: "docBlockComment"
+ }, {
+ token: "comment.start",
+ regex: /#\[(?!])/,
+ push: "blockComment"
+ }, {
+ token: "comment.doc",
+ regex: '##.*$'
+ }, {
+ token: "comment",
+ regex: '#.*$'
+ }, {
+ include: "strings"
+ }, {// character
+ token: "string",
+ regex: "'(?:\\\\(?:[abercnlftv]|x[0-9A-Fa-f]{2}|[0-2][0-9]{2}|u[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})|.{1})?'"
+ }, {
+ include: "methods"
+ }, {
+ token: keywordMapper,
+ regex: "[a-zA-Z][a-zA-Z0-9_]*\\b"
+ }, {
+ token: ["keyword.operator", "text", "storage.type"],
+ regex: "([:])(\\s+)(" + identifier + ")(?=$|\\)|\\[|,|\\s+=|;|\\s+\\{)"
+ }, {
+ token: "paren.lpar",
+ regex: /\[\.|{\||\(\.|\[:|[[({`]/
+ }, {
+ token: "paren.rpar",
+ regex: /\.\)|\|}|\.]|[\])}]/
+ }, {
+ token: "keyword.operator",
+ regex: /[=+\-*\/<>@$~&%|!?^.:\\]/
+ }, {
+ token: "punctuation",
+ regex: /[,;]/
+ }, {
+ include: "math"
+ }],
+ blockComment: [{
+ regex: /#\[]/,
+ token: "comment"
+ }, {
+ regex: /#\[(?!])/,
+ token: "comment.start",
+ push: "blockComment"
+ }, {
+ regex: /]#/,
+ token: "comment.end",
+ next: "pop"
+ }, {
+ defaultToken: "comment"
+ }],
+ docBlockComment: [{
+ regex: /##\[]/,
+ token: "comment.doc"
+ }, {
+ regex: /##\[(?!])/,
+ token: "comment.doc.start",
+ push: "docBlockComment"
+ }, {
+ regex: /]##/,
+ token: "comment.doc.end",
+ next: "pop"
+ }, {
+ defaultToken: "comment.doc"
+ }],
+ math: [{
+ token: "constant.float",
+ regex: floatNumberExt
+ }, {
+ token: "constant.float",
+ regex: floatNumber
+ }, {
+ token: "constant.integer",
+ regex: intNumber
+ }],
+ methods: [{
+ token: "support.function",
+ regex: "(\\w+)(?=\\()"
+ }],
+ strings: [{
+ token: "string",
+ regex: '(\\b' + identifier + ')?"""',
+ push: [{
+ token: "string",
+ regex: '"""',
+ next: "pop"
+ }, {
+ defaultToken: "string"
+ }]
+ }, {
+ token: "string",
+ regex: "\\b" + identifier + '"(?=.)',
+ push: [{
+ token: "string",
+ regex: '"|$',
+ next: "pop"
+ }, {
+ defaultToken: "string"
+ }]
+ }, {
+ token: "string",
+ regex: '"',
+ push: [{
+ token: "string",
+ regex: '"|$',
+ next: "pop"
+ }, {
+ token: "constant.language.escape",
+ regex: stringEscape
+ }, {
+ defaultToken: "string"
+ }]
+ }]
+ };
+ this.normalizeRules();
+};
+
+
+oop.inherits(NimHighlightRules, TextHighlightRules);
+
+exports.NimHighlightRules = NimHighlightRules;
+});
From 9f6a7021e5d998dbde8d99931009f81e6ac90467 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Tue, 5 Mar 2019 02:13:00 +0400
Subject: [PATCH 0138/1293] add nginx_highlight_rules.js to git
---
lib/ace/mode/_test/tokens_apex.json | 551 ++++++++++++++++++
lib/ace/mode/_test/tokens_asl.json | 508 +++++++++++++++++
lib/ace/mode/_test/tokens_bro.json | 106 ++++
lib/ace/mode/_test/tokens_edifact.json | 252 +++++++++
lib/ace/mode/_test/tokens_fsl.json | 341 +++++++++++
lib/ace/mode/_test/tokens_logtalk.json | 222 ++++++++
lib/ace/mode/_test/tokens_nginx.json | 386 +++++++++++++
lib/ace/mode/_test/tokens_nim.json | 105 ++++
lib/ace/mode/_test/tokens_perl6.json | 315 +++++++++++
lib/ace/mode/_test/tokens_puppet.json | 443 +++++++++++++++
lib/ace/mode/_test/tokens_terraform.json | 629 +++++++++++++++++++++
lib/ace/mode/_test/tokens_visualforce.json | 306 ++++++++++
lib/ace/mode/nginx_highlight_rules.js | 154 +++++
13 files changed, 4318 insertions(+)
create mode 100644 lib/ace/mode/_test/tokens_apex.json
create mode 100644 lib/ace/mode/_test/tokens_asl.json
create mode 100644 lib/ace/mode/_test/tokens_bro.json
create mode 100644 lib/ace/mode/_test/tokens_edifact.json
create mode 100644 lib/ace/mode/_test/tokens_fsl.json
create mode 100644 lib/ace/mode/_test/tokens_logtalk.json
create mode 100644 lib/ace/mode/_test/tokens_nginx.json
create mode 100644 lib/ace/mode/_test/tokens_nim.json
create mode 100644 lib/ace/mode/_test/tokens_perl6.json
create mode 100644 lib/ace/mode/_test/tokens_puppet.json
create mode 100644 lib/ace/mode/_test/tokens_terraform.json
create mode 100644 lib/ace/mode/_test/tokens_visualforce.json
create mode 100644 lib/ace/mode/nginx_highlight_rules.js
diff --git a/lib/ace/mode/_test/tokens_apex.json b/lib/ace/mode/_test/tokens_apex.json
new file mode 100644
index 00000000000..e2874965ec6
--- /dev/null
+++ b/lib/ace/mode/_test/tokens_apex.json
@@ -0,0 +1,551 @@
+[[
+ "start",
+ ["keyword","public"],
+ ["text"," "],
+ ["keyword","class"],
+ ["text"," "],
+ ["identifier","testBlockDuplicatesLeadTrigger"],
+ ["text"," "],
+ ["paren.lparen","{"]
+],[
+ "start",
+ ["text","\t"]
+],[
+ "start",
+ ["text","\t"],
+ ["keyword","static"],
+ ["text"," "],
+ ["keyword","testMethod"],
+ ["text"," "],
+ ["storage.type","void"],
+ ["text"," "],
+ ["identifier","testDuplicateTrigger"],
+ ["paren.lparen","("],
+ ["paren.rparen",")"],
+ ["paren.lparen","{"],
+ ["text"," "]
+],[
+ "start",
+ ["text","\t"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["identifier","Lead"],
+ ["paren.lparen","["],
+ ["paren.rparen","]"],
+ ["text"," "],
+ ["identifier","l1"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["keyword","new"],
+ ["text"," "],
+ ["identifier","Lead"],
+ ["paren.lparen","["],
+ ["paren.rparen","]"],
+ ["paren.lparen","{"]
+],[
+ "start",
+ ["text","\t\t\t"],
+ ["keyword","new"],
+ ["text"," "],
+ ["identifier","Lead"],
+ ["paren.lparen","("],
+ ["text"," "],
+ ["identifier","Email"],
+ ["keyword.operator","="],
+ ["string.start","'"],
+ ["string","homer@fox.tv"],
+ ["string.end","'"],
+ ["punctuation.operator",","],
+ ["text"," "],
+ ["identifier","LastName"],
+ ["keyword.operator","="],
+ ["string.start","'"],
+ ["string","Simpson"],
+ ["string.end","'"],
+ ["punctuation.operator",","],
+ ["text"," "],
+ ["identifier","Company"],
+ ["keyword.operator","="],
+ ["string.start","'"],
+ ["string","fox"],
+ ["string.end","'"],
+ ["text"," "],
+ ["paren.rparen",")"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["paren.rparen","}"],
+ ["punctuation.operator",";"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["keyword","insert"],
+ ["text"," "],
+ ["identifier","l1"],
+ ["punctuation.operator",";"],
+ ["text","\t\t"],
+ ["comment","// add a known lead"]
+],[
+ "start",
+ ["text","\t\t"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["identifier","Lead"],
+ ["paren.lparen","["],
+ ["paren.rparen","]"],
+ ["text"," "],
+ ["identifier","l2"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["keyword","new"],
+ ["text"," "],
+ ["identifier","Lead"],
+ ["paren.lparen","["],
+ ["paren.rparen","]"],
+ ["paren.lparen","{"]
+],[
+ "start",
+ ["text","\t\t\t"],
+ ["keyword","new"],
+ ["text"," "],
+ ["identifier","Lead"],
+ ["paren.lparen","("],
+ ["text"," "],
+ ["identifier","Email"],
+ ["keyword.operator","="],
+ ["string.start","'"],
+ ["string","homer@fox.tv"],
+ ["string.end","'"],
+ ["punctuation.operator",","],
+ ["text"," "],
+ ["identifier","LastName"],
+ ["keyword.operator","="],
+ ["string.start","'"],
+ ["string","Simpson"],
+ ["string.end","'"],
+ ["punctuation.operator",","],
+ ["text"," "],
+ ["identifier","Company"],
+ ["keyword.operator","="],
+ ["string.start","'"],
+ ["string","fox"],
+ ["string.end","'"],
+ ["text"," "],
+ ["paren.rparen",")"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["paren.rparen","}"],
+ ["punctuation.operator",";"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["comment","// try to add a matching lead"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["keyword","try"],
+ ["text"," "],
+ ["paren.lparen","{"],
+ ["text","\t"],
+ ["keyword","insert"],
+ ["text"," "],
+ ["identifier","l2"],
+ ["punctuation.operator",";"],
+ ["text","\t"],
+ ["paren.rparen","}"],
+ ["text"," "],
+ ["keyword","catch"],
+ ["text"," "],
+ ["paren.lparen","("],
+ ["text"," "],
+ ["support.function","System"],
+ ["punctuation.operator","."],
+ ["identifier","DmlException"],
+ ["text"," "],
+ ["identifier","e"],
+ ["paren.rparen",")"],
+ ["text"," "],
+ ["paren.lparen","{"],
+ ["text"," "]
+],[
+ "start",
+ ["text","\t\t\t"],
+ ["support.function","system"],
+ ["punctuation.operator","."],
+ ["identifier","assert"],
+ ["paren.lparen","("],
+ ["identifier","e"],
+ ["punctuation.operator","."],
+ ["identifier","getMessage"],
+ ["paren.lparen","("],
+ ["paren.rparen",")"],
+ ["punctuation.operator","."],
+ ["identifier","contains"],
+ ["paren.lparen","("],
+ ["string.start","'"],
+ ["string","first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, A lead with this email address already exists"],
+ ["string.end","'"],
+ ["paren.rparen",")"],
+ ["punctuation.operator",","]
+],[
+ "start",
+ ["text","\t\t\t "],
+ ["identifier","e"],
+ ["punctuation.operator","."],
+ ["identifier","getMessage"],
+ ["paren.lparen","("],
+ ["paren.rparen",")"],
+ ["paren.rparen",")"],
+ ["punctuation.operator",";"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["paren.rparen","}"]
+],[
+ "start",
+ ["text","\t\t"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["comment","// test duplicates in the same batch"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["identifier","Lead"],
+ ["paren.lparen","["],
+ ["paren.rparen","]"],
+ ["text"," "],
+ ["identifier","l3"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["keyword","new"],
+ ["text"," "],
+ ["identifier","Lead"],
+ ["paren.lparen","["],
+ ["paren.rparen","]"],
+ ["paren.lparen","{"]
+],[
+ "start",
+ ["text","\t\t\t"],
+ ["keyword","new"],
+ ["text"," "],
+ ["identifier","Lead"],
+ ["paren.lparen","("],
+ ["text"," "],
+ ["identifier","Email"],
+ ["keyword.operator","="],
+ ["string.start","'"],
+ ["string","marge@fox.tv"],
+ ["string.end","'"],
+ ["punctuation.operator",","],
+ ["text"," "],
+ ["identifier","LastName"],
+ ["keyword.operator","="],
+ ["string.start","'"],
+ ["string","Simpson"],
+ ["string.end","'"],
+ ["punctuation.operator",","],
+ ["text"," "],
+ ["identifier","Company"],
+ ["keyword.operator","="],
+ ["string.start","'"],
+ ["string","fox"],
+ ["string.end","'"],
+ ["text"," "],
+ ["paren.rparen",")"],
+ ["punctuation.operator",","]
+],[
+ "start",
+ ["text","\t\t\t"],
+ ["keyword","new"],
+ ["text"," "],
+ ["identifier","Lead"],
+ ["paren.lparen","("],
+ ["text"," "],
+ ["identifier","Email"],
+ ["keyword.operator","="],
+ ["string.start","'"],
+ ["string","marge@fox.tv"],
+ ["string.end","'"],
+ ["punctuation.operator",","],
+ ["text"," "],
+ ["identifier","LastName"],
+ ["keyword.operator","="],
+ ["string.start","'"],
+ ["string","Simpson"],
+ ["string.end","'"],
+ ["punctuation.operator",","],
+ ["text"," "],
+ ["identifier","Company"],
+ ["keyword.operator","="],
+ ["string.start","'"],
+ ["string","fox"],
+ ["string.end","'"],
+ ["text"," "],
+ ["paren.rparen",")"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["paren.rparen","}"],
+ ["punctuation.operator",";"],
+ ["text","\t\t"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["keyword","try"],
+ ["text"," "],
+ ["paren.lparen","{"],
+ ["text"," "],
+ ["keyword","insert"],
+ ["text"," "],
+ ["identifier","l3"],
+ ["punctuation.operator",";"],
+ ["text","\t"],
+ ["paren.rparen","}"],
+ ["text"," "],
+ ["keyword","catch"],
+ ["text"," "],
+ ["paren.lparen","("],
+ ["text"," "],
+ ["support.function","System"],
+ ["punctuation.operator","."],
+ ["identifier","DmlException"],
+ ["text"," "],
+ ["identifier","e"],
+ ["paren.rparen",")"],
+ ["text"," "],
+ ["paren.lparen","{"],
+ ["text"," "]
+],[
+ "start",
+ ["text","\t\t\t"],
+ ["support.function","system"],
+ ["punctuation.operator","."],
+ ["identifier","assert"],
+ ["paren.lparen","("],
+ ["identifier","e"],
+ ["punctuation.operator","."],
+ ["identifier","getMessage"],
+ ["paren.lparen","("],
+ ["paren.rparen",")"],
+ ["punctuation.operator","."],
+ ["identifier","contains"],
+ ["paren.lparen","("],
+ ["string.start","'"],
+ ["string","first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Another new lead has the same email"],
+ ["string.end","'"],
+ ["paren.rparen",")"],
+ ["punctuation.operator",","]
+],[
+ "start",
+ ["text","\t\t\t\t"],
+ ["identifier","e"],
+ ["punctuation.operator","."],
+ ["identifier","getMessage"],
+ ["paren.lparen","("],
+ ["paren.rparen",")"],
+ ["paren.rparen",")"],
+ ["punctuation.operator",";"]
+],[
+ "start",
+ ["text","\t\t\t"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["paren.rparen","}"]
+],[
+ "start",
+ ["text","\t\t"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["comment","// test update also"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["identifier","Lead"],
+ ["paren.lparen","["],
+ ["paren.rparen","]"],
+ ["text"," "],
+ ["identifier","lup"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["keyword","new"],
+ ["text"," "],
+ ["identifier","Lead"],
+ ["paren.lparen","["],
+ ["paren.rparen","]"],
+ ["paren.lparen","{"]
+],[
+ "start",
+ ["text","\t\t\t"],
+ ["keyword","new"],
+ ["text"," "],
+ ["identifier","Lead"],
+ ["paren.lparen","("],
+ ["text"," "],
+ ["identifier","Email"],
+ ["keyword.operator","="],
+ ["string.start","'"],
+ ["string","marge@fox.tv"],
+ ["string.end","'"],
+ ["punctuation.operator",","],
+ ["text"," "],
+ ["identifier","LastName"],
+ ["keyword.operator","="],
+ ["string.start","'"],
+ ["string","Simpson"],
+ ["string.end","'"],
+ ["punctuation.operator",","],
+ ["text"," "],
+ ["identifier","Company"],
+ ["keyword.operator","="],
+ ["string.start","'"],
+ ["string","fox"],
+ ["string.end","'"],
+ ["text"," "],
+ ["paren.rparen",")"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["paren.rparen","}"],
+ ["punctuation.operator",";"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["keyword","insert"],
+ ["text"," "],
+ ["identifier","lup"],
+ ["punctuation.operator",";"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["identifier","Lead"],
+ ["text"," "],
+ ["identifier","marge"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["paren.lparen","["],
+ ["text"," "],
+ ["keyword","select"],
+ ["text"," id"],
+ ["keyword.operator",","],
+ ["text","Email "],
+ ["keyword","from"],
+ ["text"," lead "],
+ ["keyword","where"],
+ ["text"," Email "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["string.start","'"],
+ ["string","marge@fox.tv"],
+ ["string.end","'"],
+ ["text"," "],
+ ["keyword","limit"],
+ ["text"," 1"],
+ ["paren.rparen","]"],
+ ["punctuation.operator",";"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["support.function","system"],
+ ["punctuation.operator","."],
+ ["identifier","assert"],
+ ["paren.lparen","("],
+ ["identifier","marge"],
+ ["keyword.operator","!="],
+ ["constant.language","null"],
+ ["paren.rparen",")"],
+ ["punctuation.operator",";"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["identifier","marge"],
+ ["punctuation.operator","."],
+ ["identifier","Email"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["string.start","'"],
+ ["string","homer@fox.tv"],
+ ["string.end","'"],
+ ["punctuation.operator",";"],
+ ["text"," "]
+],[
+ "start",
+ ["text","\t\t"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["keyword","try"],
+ ["text"," "],
+ ["paren.lparen","{"],
+ ["text"," "],
+ ["keyword","update"],
+ ["text"," "],
+ ["identifier","marge"],
+ ["punctuation.operator",";"],
+ ["text"," "],
+ ["paren.rparen","}"],
+ ["text"," "],
+ ["keyword","catch"],
+ ["text"," "],
+ ["paren.lparen","("],
+ ["text"," "],
+ ["support.function","System"],
+ ["punctuation.operator","."],
+ ["identifier","DmlException"],
+ ["text"," "],
+ ["identifier","e"],
+ ["paren.rparen",")"],
+ ["text"," "],
+ ["paren.lparen","{"],
+ ["text"," "]
+],[
+ "start",
+ ["text","\t\t\t"],
+ ["support.function","system"],
+ ["punctuation.operator","."],
+ ["identifier","assert"],
+ ["paren.lparen","("],
+ ["identifier","e"],
+ ["punctuation.operator","."],
+ ["identifier","getMessage"],
+ ["paren.lparen","("],
+ ["paren.rparen",")"],
+ ["punctuation.operator","."],
+ ["identifier","contains"],
+ ["paren.lparen","("],
+ ["string.start","'"],
+ ["string","irst error: FIELD_CUSTOM_VALIDATION_EXCEPTION, A lead with this email address already exists"],
+ ["string.end","'"],
+ ["paren.rparen",")"],
+ ["punctuation.operator",","]
+],[
+ "start",
+ ["text","\t\t\t\t"],
+ ["identifier","e"],
+ ["punctuation.operator","."],
+ ["identifier","getMessage"],
+ ["paren.lparen","("],
+ ["paren.rparen",")"],
+ ["paren.rparen",")"],
+ ["punctuation.operator",";"],
+ ["text","\t"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["paren.rparen","}"]
+],[
+ "start",
+ ["text","\t"],
+ ["paren.rparen","}"]
+],[
+ "start",
+ ["paren.rparen","}"]
+]]
\ No newline at end of file
diff --git a/lib/ace/mode/_test/tokens_asl.json b/lib/ace/mode/_test/tokens_asl.json
new file mode 100644
index 00000000000..9218492ae5f
--- /dev/null
+++ b/lib/ace/mode/_test/tokens_asl.json
@@ -0,0 +1,508 @@
+[[
+ "comment",
+ ["comment","/*"]
+],[
+ "comment",
+ ["comment"," * Intel ACPI Component Architecture"]
+],[
+ "comment",
+ ["comment"," * AML/ASL+ Disassembler version 20180105"]
+],[
+ "comment",
+ ["comment"," *"]
+],[
+ "comment",
+ ["comment"," * ASL example"]
+],[
+ "start",
+ ["comment"," */"]
+],[
+ "start",
+ ["keyword","DefinitionBlock"],
+ ["text"," "],
+ ["lparen","("],
+ ["string","\"\""],
+ ["text",", "],
+ ["string","\"SSDT\""],
+ ["text",", "],
+ ["constant.numeric","1"],
+ ["text",", "],
+ ["string","\"PmRef\""],
+ ["text",", "],
+ ["string","\"Cpu0Ist\""],
+ ["text",", "],
+ ["constant.numeric","0x00003000"],
+ ["rparen",")"]
+],[
+ "start",
+ ["lparen","{"]
+],[
+ "start",
+ ["text"," "],
+ ["function.buildin","External"],
+ ["text"," "],
+ ["lparen","("],
+ ["identifier","_PR_"],
+ ["text","."],
+ ["identifier","CPU0"],
+ ["text",", "],
+ ["storage.type","DeviceObj"],
+ ["rparen",")"]
+],[
+ "start",
+ ["text"," "],
+ ["function.buildin","External"],
+ ["text"," "],
+ ["lparen","("],
+ ["identifier","_SB_"],
+ ["text","."],
+ ["identifier","CPUP"],
+ ["text",", "],
+ ["storage.type","UnknownObj"],
+ ["rparen",")"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword","Scope"],
+ ["text"," "],
+ ["lparen","("],
+ ["text","\\"],
+ ["identifier","_PR"],
+ ["text","."],
+ ["identifier","CPU0"],
+ ["rparen",")"]
+],[
+ "start",
+ ["text"," "],
+ ["lparen","{"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","Method"],
+ ["text"," "],
+ ["lparen","("],
+ ["identifier","_PCT"],
+ ["text",", "],
+ ["constant.numeric","0"],
+ ["text",", "],
+ ["constant.character","NotSerialized"],
+ ["rparen",")"],
+ ["text"," "],
+ ["comment","// _PCT: Performance Control"]
+],[
+ "start",
+ ["text"," "],
+ ["lparen","{"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","If"],
+ ["text"," "],
+ ["lparen","((("],
+ ["identifier","CFGD"],
+ ["text"," "],
+ ["keyword.operator","&"],
+ ["text"," "],
+ ["constant.numeric","One"],
+ ["rparen",")"],
+ ["text"," "],
+ ["keyword.operator","&&"],
+ ["text"," "],
+ ["lparen","("],
+ ["identifier","PDC0"],
+ ["text"," "],
+ ["keyword.operator","&"],
+ ["text"," "],
+ ["constant.numeric","One"],
+ ["rparen",")))"]
+],[
+ "start",
+ ["text"," "],
+ ["lparen","{"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","Return"],
+ ["text"," "],
+ ["lparen","("],
+ ["function.buildin","Package"],
+ ["text"," "],
+ ["lparen","("],
+ ["constant.numeric","0x02"],
+ ["rparen",")"]
+],[
+ "start",
+ ["text"," "],
+ ["lparen","{"]
+],[
+ "start",
+ ["text"," "],
+ ["function.buildin","ResourceTemplate"],
+ ["text"," "],
+ ["lparen","("],
+ ["rparen",")"]
+],[
+ "start",
+ ["text"," "],
+ ["lparen","{"]
+],[
+ "start",
+ ["text"," "],
+ ["function.buildin","Register"],
+ ["text"," "],
+ ["lparen","("],
+ ["constant.character","FFixedHW"],
+ ["text",", "]
+],[
+ "start",
+ ["text"," "],
+ ["constant.numeric","0x00"],
+ ["text",", "],
+ ["comment","// Bit Width"]
+],[
+ "start",
+ ["text"," "],
+ ["constant.numeric","0x00"],
+ ["text",", "],
+ ["comment","// Bit Offset"]
+],[
+ "start",
+ ["text"," "],
+ ["constant.numeric","0x0000000000000000"],
+ ["text",", "],
+ ["comment","// Address"]
+],[
+ "start",
+ ["text"," ,"],
+ ["rparen",")"]
+],[
+ "start",
+ ["text"," "],
+ ["rparen","}"],
+ ["text",", "]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["function.buildin","ResourceTemplate"],
+ ["text"," "],
+ ["lparen","("],
+ ["rparen",")"]
+],[
+ "start",
+ ["text"," "],
+ ["lparen","{"]
+],[
+ "start",
+ ["text"," "],
+ ["function.buildin","Register"],
+ ["text"," "],
+ ["lparen","("],
+ ["constant.character","FFixedHW"],
+ ["text",", "]
+],[
+ "start",
+ ["text"," "],
+ ["constant.numeric","0x00"],
+ ["text",", "],
+ ["comment","// Bit Width"]
+],[
+ "start",
+ ["text"," "],
+ ["constant.numeric","0x00"],
+ ["text",", "],
+ ["comment","// Bit Offset"]
+],[
+ "start",
+ ["text"," "],
+ ["constant.numeric","0x0000000000000000"],
+ ["text",", "],
+ ["comment","// Address"]
+],[
+ "start",
+ ["text"," ,"],
+ ["rparen",")"]
+],[
+ "start",
+ ["text"," "],
+ ["rparen","}"]
+],[
+ "start",
+ ["text"," "],
+ ["rparen","})"]
+],[
+ "start",
+ ["text"," "],
+ ["rparen","}"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword","Return"],
+ ["text"," "],
+ ["lparen","("],
+ ["function.buildin","Package"],
+ ["text"," "],
+ ["lparen","("],
+ ["constant.numeric","0x02"],
+ ["rparen",")"]
+],[
+ "start",
+ ["text"," "],
+ ["lparen","{"]
+],[
+ "start",
+ ["text"," "],
+ ["function.buildin","ResourceTemplate"],
+ ["text"," "],
+ ["lparen","("],
+ ["rparen",")"]
+],[
+ "start",
+ ["text"," "],
+ ["lparen","{"]
+],[
+ "start",
+ ["text"," "],
+ ["function.buildin","Register"],
+ ["text"," "],
+ ["lparen","("],
+ ["constant.character","SystemIO"],
+ ["text",", "]
+],[
+ "start",
+ ["text"," "],
+ ["constant.numeric","0x10"],
+ ["text",", "],
+ ["comment","// Bit Width"]
+],[
+ "start",
+ ["text"," "],
+ ["constant.numeric","0x00"],
+ ["text",", "],
+ ["comment","// Bit Offset"]
+],[
+ "start",
+ ["text"," "],
+ ["constant.numeric","0x0000000000001000"],
+ ["text",", "],
+ ["comment","// Address"]
+],[
+ "start",
+ ["text"," ,"],
+ ["rparen",")"]
+],[
+ "start",
+ ["text"," "],
+ ["rparen","}"],
+ ["text",", "]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["function.buildin","ResourceTemplate"],
+ ["text"," "],
+ ["lparen","("],
+ ["rparen",")"]
+],[
+ "start",
+ ["text"," "],
+ ["lparen","{"]
+],[
+ "start",
+ ["text"," "],
+ ["function.buildin","Register"],
+ ["text"," "],
+ ["lparen","("],
+ ["constant.character","SystemIO"],
+ ["text",", "]
+],[
+ "start",
+ ["text"," "],
+ ["constant.numeric","0x08"],
+ ["text",", "],
+ ["comment","// Bit Width"]
+],[
+ "start",
+ ["text"," "],
+ ["constant.numeric","0x00"],
+ ["text",", "],
+ ["comment","// Bit Offset"]
+],[
+ "start",
+ ["text"," "],
+ ["constant.numeric","0x00000000000000B3"],
+ ["text",", "],
+ ["comment","// Address"]
+],[
+ "start",
+ ["text"," ,"],
+ ["rparen",")"]
+],[
+ "start",
+ ["text"," "],
+ ["rparen","}"]
+],[
+ "start",
+ ["text"," "],
+ ["rparen","})"]
+],[
+ "start",
+ ["text"," "],
+ ["rparen","}"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["function.buildin","Name"],
+ ["text"," "],
+ ["lparen","("],
+ ["identifier","PSDF"],
+ ["text",", "],
+ ["constant.numeric","Zero"],
+ ["rparen",")"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","Method"],
+ ["text"," "],
+ ["lparen","("],
+ ["identifier","_PSD"],
+ ["text",", "],
+ ["constant.numeric","0"],
+ ["text",", "],
+ ["constant.character","NotSerialized"],
+ ["rparen",")"],
+ ["text"," "],
+ ["comment","// _PSD: Power State Dependencies"]
+],[
+ "start",
+ ["text"," "],
+ ["lparen","{"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","If"],
+ ["text"," "],
+ ["lparen","("],
+ ["keyword.operator","!"],
+ ["identifier","PSDF"],
+ ["rparen",")"]
+],[
+ "start",
+ ["text"," "],
+ ["lparen","{"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.operator","DerefOf"],
+ ["text"," "],
+ ["lparen","("],
+ ["identifier","HPSD"],
+ ["text"," "],
+ ["comment","[Zero]"],
+ ["rparen",")"],
+ ["text"," "],
+ ["comment","[0x04]"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["identifier","TCNT"],
+ ["text"," "],
+ ["comment","/* External reference */"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.operator","DerefOf"],
+ ["text"," "],
+ ["lparen","("],
+ ["identifier","SPSD"],
+ ["text"," "],
+ ["comment","[Zero]"],
+ ["rparen",")"],
+ ["text"," "],
+ ["comment","[0x04]"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["identifier","TCNT"],
+ ["text"," "],
+ ["comment","/* External reference */"]
+],[
+ "start",
+ ["text"," "],
+ ["identifier","PSDF"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["constant.numeric","Ones"]
+],[
+ "start",
+ ["text"," "],
+ ["rparen","}"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword","If"],
+ ["text"," "],
+ ["lparen","(("],
+ ["identifier","PDC0"],
+ ["text"," "],
+ ["keyword.operator","&"],
+ ["text"," "],
+ ["constant.numeric","0x0800"],
+ ["rparen","))"]
+],[
+ "start",
+ ["text"," "],
+ ["lparen","{"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","Return"],
+ ["text"," "],
+ ["lparen","("],
+ ["identifier","HPSD"],
+ ["rparen",")"],
+ ["text"," "],
+ ["comment","/* \\_PR_.CPU0.HPSD */"]
+],[
+ "start",
+ ["text"," "],
+ ["rparen","}"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword","Return"],
+ ["text"," "],
+ ["lparen","("],
+ ["identifier","SPSD"],
+ ["rparen",")"],
+ ["text"," "],
+ ["comment","/* \\_PR_.CPU0.SPSD */"]
+],[
+ "start",
+ ["text"," "],
+ ["rparen","}"]
+],[
+ "start",
+ ["text"," "],
+ ["rparen","}"]
+],[
+ "start",
+ ["rparen","}"]
+],[
+ "start"
+],[
+ "start"
+]]
\ No newline at end of file
diff --git a/lib/ace/mode/_test/tokens_bro.json b/lib/ace/mode/_test/tokens_bro.json
new file mode 100644
index 00000000000..b0f42015ae4
--- /dev/null
+++ b/lib/ace/mode/_test/tokens_bro.json
@@ -0,0 +1,106 @@
+[[
+ "start",
+ ["punctuation.definition.comment.bro","#"],
+ ["comment.line.number-sign.bro","#! Add countries for the originator and responder of a connection"]
+],[
+ "start",
+ ["punctuation.definition.comment.bro","#"],
+ ["comment.line.number-sign.bro","#! to the connection logs."]
+],[
+ "start"
+],[
+ "start",
+ ["text","module Conn;"]
+],[
+ "start"
+],[
+ "start",
+ ["text","export {"]
+],[
+ "start",
+ ["text","\t"],
+ ["storage.modifier.bro","redef"],
+ ["text"," "],
+ ["storage.type.bro","record"],
+ ["text"," Conn::Info += {"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["punctuation.definition.comment.bro","#"],
+ ["comment.line.number-sign.bro","# Country code for the originator of the connection based "]
+],[
+ "start",
+ ["text","\t\t"],
+ ["punctuation.definition.comment.bro","#"],
+ ["comment.line.number-sign.bro","# on a GeoIP lookup."]
+],[
+ "start",
+ ["text","\t\torig_cc: "],
+ ["storage.type.bro","string"],
+ ["text"," &optional &log;"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["punctuation.definition.comment.bro","#"],
+ ["comment.line.number-sign.bro","# Country code for the responser of the connection based "]
+],[
+ "start",
+ ["text","\t\t"],
+ ["punctuation.definition.comment.bro","#"],
+ ["comment.line.number-sign.bro","# on a GeoIP lookup."]
+],[
+ "start",
+ ["text","\t\tresp_cc: "],
+ ["storage.type.bro","string"],
+ ["text"," &optional &log;"]
+],[
+ "start",
+ ["text","\t};"]
+],[
+ "start",
+ ["text","}"]
+],[
+ "start"
+],[
+ "start",
+ ["meta.function.bro"," "],
+ ["storage.type.bro","connection_state_remove"],
+ ["meta.function.bro","("],
+ ["entity.name.function.bro","c: connection"],
+ ["meta.function.bro",") "],
+ "event connection_state_remove(c: connection) "
+],[
+ "start",
+ ["text","\t{"]
+],[
+ "start",
+ ["text","\t"],
+ ["storage.modifier.bro","local"],
+ ["text"," orig_loc = lookup_location(c$id$orig_h);"]
+],[
+ "start",
+ ["text","\t"],
+ ["keyword.control.bro","if"],
+ ["text"," ( orig_loc?$country_code )"]
+],[
+ "start",
+ ["text","\t\tc$conn$orig_cc = orig_loc$country_code;"]
+],[
+ "start"
+],[
+ "start",
+ ["text","\t"],
+ ["storage.modifier.bro","local"],
+ ["text"," resp_loc = lookup_location(c$id$resp_h);"]
+],[
+ "start",
+ ["text","\t"],
+ ["keyword.control.bro","if"],
+ ["text"," ( resp_loc?$country_code )"]
+],[
+ "start",
+ ["text","\t\tc$conn$resp_cc = resp_loc$country_code;"]
+],[
+ "start",
+ ["text","\t}"]
+]]
\ No newline at end of file
diff --git a/lib/ace/mode/_test/tokens_edifact.json b/lib/ace/mode/_test/tokens_edifact.json
new file mode 100644
index 00000000000..cb5f4c1d7ce
--- /dev/null
+++ b/lib/ace/mode/_test/tokens_edifact.json
@@ -0,0 +1,252 @@
+[[
+ "start",
+ ["entity.name.segment","UNB"],
+ ["keyword.operator","+"],
+ ["keyword","UNOA"],
+ ["punctuation.operator",":"],
+ ["text","1"],
+ ["keyword.operator","+"],
+ ["text","005435656"],
+ ["punctuation.operator",":"],
+ ["text","1"],
+ ["keyword.operator","+"],
+ ["text","006415160"],
+ ["punctuation.operator",":"],
+ ["text","1"],
+ ["keyword.operator","+"],
+ ["text","060515"],
+ ["punctuation.operator",":"],
+ ["text","1434"],
+ ["keyword.operator","+"],
+ ["text","00000000000778"],
+ ["punctuation.operator","'"]
+],[
+ "start",
+ ["entity.name.header","UNH"],
+ ["keyword.operator","+"],
+ ["text","00000000000117"],
+ ["keyword.operator","+"],
+ ["identifier","INVnrOIC"],
+ ["punctuation.operator",":"],
+ ["identifier","D"],
+ ["punctuation.operator",":"],
+ ["text","97"],
+ ["identifier","B"],
+ ["punctuation.operator",":"],
+ ["identifier","UN"],
+ ["punctuation.operator","'"]
+],[
+ "start",
+ ["entity.name.segment","BGM"],
+ ["keyword.operator","+"],
+ ["text","380"],
+ ["keyword.operator","+"],
+ ["text","342459"],
+ ["keyword.operator","+"],
+ ["text","9"],
+ ["punctuation.operator","'"]
+],[
+ "start",
+ ["entity.name.segment","DTM"],
+ ["keyword.operator","+"],
+ ["text","3"],
+ ["punctuation.operator",":"],
+ ["text","20060515"],
+ ["punctuation.operator",":"],
+ ["text","102"],
+ ["punctuation.operator","'"]
+],[
+ "start",
+ ["entity.name.segment","RFF"],
+ ["keyword.operator","+"],
+ ["keyword","ON"],
+ ["punctuation.operator",":"],
+ ["text","521052"],
+ ["punctuation.operator","'"]
+],[
+ "start",
+ ["entity.name.segment","NAD"],
+ ["keyword.operator","+"],
+ ["keyword","BY"],
+ ["keyword.operator","+"],
+ ["text","792820524"],
+ ["punctuation.operator","::"],
+ ["text","16"],
+ ["keyword.operator","++"],
+ ["identifier","CUMMINS"],
+ ["text"," "],
+ ["identifier","MID"],
+ ["text","-"],
+ ["identifier","RANGE"],
+ ["text"," "],
+ ["identifier","ENGINE"],
+ ["text"," "],
+ ["identifier","PLANT"],
+ ["punctuation.operator","'"]
+],[
+ "start",
+ ["entity.name.segment","NAD"],
+ ["keyword.operator","+"],
+ ["keyword","SE"],
+ ["keyword.operator","+"],
+ ["text","005435656"],
+ ["punctuation.operator","::"],
+ ["text","16"],
+ ["keyword.operator","++"],
+ ["identifier","GENERAL"],
+ ["text"," "],
+ ["identifier","WIDGET"],
+ ["text"," "],
+ ["identifier","COMPANY"],
+ ["punctuation.operator","'"]
+],[
+ "start",
+ ["entity.name.segment","CUX"],
+ ["keyword.operator","+"],
+ ["text","1"],
+ ["punctuation.operator",":"],
+ ["identifier","USD"],
+ ["punctuation.operator","'"]
+],[
+ "start",
+ ["entity.name.segment","LIN"],
+ ["punctuation.operator","+1+"],
+ ["keyword.operator","+"],
+ ["text","157870"],
+ ["punctuation.operator",":"],
+ ["identifier","IN"],
+ ["punctuation.operator","'"]
+],[
+ "start",
+ ["entity.name.segment","IMD"],
+ ["punctuation.operator","+F+"],
+ ["keyword.operator","+"],
+ ["punctuation.operator",":::"],
+ ["identifier","WIDGET"],
+ ["punctuation.operator","'"]
+],[
+ "start",
+ ["entity.name.segment","QTY"],
+ ["keyword.operator","+"],
+ ["text","47"],
+ ["punctuation.operator",":"],
+ ["text","1020"],
+ ["punctuation.operator",":"],
+ ["identifier","EA"],
+ ["punctuation.operator","'"]
+],[
+ "start",
+ ["entity.name.segment","ALI"],
+ ["keyword.operator","+"],
+ ["identifier","US"],
+ ["punctuation.operator","'"]
+],[
+ "start",
+ ["entity.name.segment","MOA"],
+ ["keyword.operator","+"],
+ ["text","203"],
+ ["punctuation.operator",":"],
+ ["text","1202.58"],
+ ["punctuation.operator","'"]
+],[
+ "start",
+ ["entity.name.segment","PRI"],
+ ["keyword.operator","+"],
+ ["entity.name.segment","INV"],
+ ["punctuation.operator",":"],
+ ["text","1.179"],
+ ["punctuation.operator","'"]
+],[
+ "start",
+ ["entity.name.segment","LIN"],
+ ["punctuation.operator","+2+"],
+ ["keyword.operator","+"],
+ ["text","157871"],
+ ["punctuation.operator",":"],
+ ["identifier","IN"],
+ ["punctuation.operator","'"]
+],[
+ "start",
+ ["entity.name.segment","IMD"],
+ ["punctuation.operator","+F+"],
+ ["keyword.operator","+"],
+ ["punctuation.operator",":::"],
+ ["identifier","DIFFERENT"],
+ ["text"," "],
+ ["identifier","WIDGET"],
+ ["punctuation.operator","'"]
+],[
+ "start",
+ ["entity.name.segment","QTY"],
+ ["keyword.operator","+"],
+ ["text","47"],
+ ["punctuation.operator",":"],
+ ["text","20"],
+ ["punctuation.operator",":"],
+ ["identifier","EA"],
+ ["punctuation.operator","'"]
+],[
+ "start",
+ ["entity.name.segment","ALI"],
+ ["keyword.operator","+"],
+ ["keyword","JP"],
+ ["punctuation.operator","'"]
+],[
+ "start",
+ ["entity.name.segment","MOA"],
+ ["keyword.operator","+"],
+ ["text","203"],
+ ["punctuation.operator",":"],
+ ["text","410"],
+ ["punctuation.operator","'"]
+],[
+ "start",
+ ["entity.name.segment","PRI"],
+ ["keyword.operator","+"],
+ ["entity.name.segment","INV"],
+ ["punctuation.operator",":"],
+ ["text","20.5"],
+ ["punctuation.operator","'"]
+],[
+ "start",
+ ["entity.name.segment","UNS"],
+ ["keyword.operator","+"],
+ ["identifier","S"],
+ ["punctuation.operator","'"]
+],[
+ "start",
+ ["entity.name.segment","MOA"],
+ ["keyword.operator","+"],
+ ["text","39"],
+ ["punctuation.operator",":"],
+ ["text","2137.58"],
+ ["punctuation.operator","'"]
+],[
+ "start",
+ ["entity.name.segment","ALC"],
+ ["punctuation.operator","+C+"],
+ ["identifier","ABG"],
+ ["punctuation.operator","'"]
+],[
+ "start",
+ ["entity.name.segment","MOA"],
+ ["keyword.operator","+"],
+ ["text","8"],
+ ["punctuation.operator",":"],
+ ["text","525"],
+ ["punctuation.operator","'"]
+],[
+ "start",
+ ["entity.name.segment","UNT"],
+ ["keyword.operator","+"],
+ ["text","23"],
+ ["keyword.operator","+"],
+ ["text","00000000000117"],
+ ["punctuation.operator","'"]
+],[
+ "start",
+ ["entity.name.segment","UNZ"],
+ ["punctuation.operator","+1+"],
+ ["text","00000000000778"],
+ ["punctuation.operator","'"]
+]]
\ No newline at end of file
diff --git a/lib/ace/mode/_test/tokens_fsl.json b/lib/ace/mode/_test/tokens_fsl.json
new file mode 100644
index 00000000000..e1cff132924
--- /dev/null
+++ b/lib/ace/mode/_test/tokens_fsl.json
@@ -0,0 +1,341 @@
+[[
+ "start",
+ ["constant.language.fslLanguage","machine_name :"],
+ ["text"," "],
+ ["string.quoted.double.fslLabel.doublequoted","\"BGP\""],
+ ["text",";"]
+],[
+ "start",
+ ["constant.language.fslLanguage","machine_version :"],
+ ["text"," "],
+ ["constant.numeric","1.0.0"],
+ ["text",";"]
+],[
+ "start"
+],[
+ "start",
+ ["constant.language.fslLanguage","machine_author :"],
+ ["text"," "],
+ ["string.quoted.double.fslLabel.doublequoted","\"John Haugeland \""],
+ ["text",";"]
+],[
+ "start",
+ ["constant.language.fslLanguage","machine_license :"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","MIT"],
+ ["text",";"]
+],[
+ "start"
+],[
+ "start",
+ ["constant.language.fslLanguage","graph_layout :"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","dot"],
+ ["text",";"]
+],[
+ "start"
+],[
+ "start"
+],[
+ "start"
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","Idle"],
+ ["text"," "],
+ ["constant.character.fslAction","'Invite'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","=>"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","Invited"],
+ ["text",";"]
+],[
+ "start"
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","Invited"],
+ ["text"," "],
+ ["constant.character.fslAction","'Invite, 1xx'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","->"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","Invited"],
+ ["text",";"]
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","Invited"],
+ ["text"," "],
+ ["constant.character.fslAction","'3xx'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","->"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","Redirecting"],
+ ["text",";"]
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","Invited"],
+ ["text"," "],
+ ["constant.character.fslAction","'Cancel'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","->"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","Cancelling"],
+ ["text",";"]
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","Invited"],
+ ["text"," "],
+ ["constant.character.fslAction","'200'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","=>"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","Accepted"],
+ ["text",";"]
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","Invited"],
+ ["text"," "],
+ ["constant.character.fslAction","'407'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","=>"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","AuthRequested"],
+ ["text",";"]
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","Invited"],
+ ["text"," "],
+ ["constant.character.fslAction","'4xx-6xx'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","->"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","Failed"],
+ ["text",";"]
+],[
+ "start"
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","AuthRequested"],
+ ["text"," "],
+ ["constant.character.fslAction","'Ack'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","=>"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","Invited"],
+ ["text",";"]
+],[
+ "start"
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","Redirecting"],
+ ["text"," "],
+ ["constant.character.fslAction","'Act'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","->"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","Redirected"],
+ ["text",";"]
+],[
+ "start"
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","Cancelling"],
+ ["text"," "],
+ ["constant.character.fslAction","'200 (Invite)'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","->"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","LateCancel"],
+ ["text",";"]
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","Cancelling"],
+ ["text"," "],
+ ["constant.character.fslAction","'200 (Cancel)'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","->"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","Cancelled"],
+ ["text",";"]
+],[
+ "start"
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","Accepted"],
+ ["text"," "],
+ ["constant.character.fslAction","'Cancel'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","->"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","LateCancel"],
+ ["text",";"]
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","Accepted"],
+ ["text"," "],
+ ["constant.character.fslAction","'Ack'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","=>"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","Established"],
+ ["text",";"]
+],[
+ "start"
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","Failed"],
+ ["text"," "],
+ ["constant.character.fslAction","'Ack'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","->"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","Terminated"],
+ ["text",";"]
+],[
+ "start"
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","Redirected"],
+ ["text"," "],
+ ["constant.character.fslAction","'Invite'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","->"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","Invited"],
+ ["text",";"]
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","Redirected"],
+ ["text"," "],
+ ["constant.character.fslAction","'Timeout'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","->"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","Terminated"],
+ ["text",";"]
+],[
+ "start"
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","LateCancel"],
+ ["text"," "],
+ ["constant.character.fslAction","'Ack'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","->"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","Established"],
+ ["text",";"]
+],[
+ "start"
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","Cancelled"],
+ ["text"," "],
+ ["constant.character.fslAction","'487'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","->"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","Failed"],
+ ["text",";"]
+],[
+ "start"
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","Established"],
+ ["text"," "],
+ ["constant.character.fslAction","'Invite'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","=>"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","SessionModifying"],
+ ["text",";"]
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","Established"],
+ ["text"," "],
+ ["constant.character.fslAction","'Bye'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","->"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","Closing"],
+ ["text",";"]
+],[
+ "start"
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","SessionModifying"],
+ ["text"," "],
+ ["constant.character.fslAction","'488'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","->"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","SessionModificationRefused"],
+ ["text",";"]
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","SessionModifying"],
+ ["text"," "],
+ ["constant.character.fslAction","'200'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","=>"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","SessionModified"],
+ ["text",";"]
+],[
+ "start"
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","Closing"],
+ ["text"," "],
+ ["constant.character.fslAction","'Bye,Ack,200 (Invite)'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","->"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","Closing"],
+ ["text",";"]
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","Closing"],
+ ["text"," "],
+ ["constant.character.fslAction","'200 (Bye)'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","->"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","Terminated"],
+ ["text",";"]
+],[
+ "start"
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","SessionModificationRefused"],
+ ["text"," "],
+ ["constant.character.fslAction","'Ack'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","->"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","Established"],
+ ["text",";"]
+],[
+ "start"
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","SessionModified"],
+ ["text"," "],
+ ["constant.character.fslAction","'Ack'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","=>"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","Established"],
+ ["text",";"]
+],[
+ "start",
+ ["entity.name.tag.fslLabel.atom","SessionModified"],
+ ["text"," "],
+ ["constant.character.fslAction","'Bye'"],
+ ["text"," "],
+ ["keyword.control.transition.fslArrow","->"],
+ ["text"," "],
+ ["entity.name.tag.fslLabel.atom","Closing"],
+ ["text",";"]
+],[
+ "start"
+]]
\ No newline at end of file
diff --git a/lib/ace/mode/_test/tokens_logtalk.json b/lib/ace/mode/_test/tokens_logtalk.json
new file mode 100644
index 00000000000..e257005affc
--- /dev/null
+++ b/lib/ace/mode/_test/tokens_logtalk.json
@@ -0,0 +1,222 @@
+[[
+ "start",
+ ["storage.type.opening.logtalk",":- object"],
+ ["text","(bottles)"],
+ ["keyword.operator.misc.logtalk","."]
+],[
+ "start"
+],[
+ "start",
+ ["text","\t"],
+ ["storage.modifier.others.logtalk",":- initialization"],
+ ["text","(sing("],
+ ["constant.numeric.logtalk","99"],
+ ["text","))"],
+ ["keyword.operator.misc.logtalk","."]
+],[
+ "start"
+],[
+ "start",
+ ["text","\tsing("],
+ ["constant.numeric.logtalk","0"],
+ ["text",") "],
+ ["keyword.operator.message-sending.logtalk",":"],
+ ["keyword.operator.evaluable.logtalk","-"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["support.function.term-io.logtalk","write"],
+ ["text","("],
+ ["punctuation.definition.string.begin.logtalk","'"],
+ ["string.quoted.single.logtalk","No more bottles of beer on the wall, no more bottles of beer."],
+ ["punctuation.definition.string.end.logtalk","'"],
+ ["text",")"],
+ ["keyword.operator.misc.logtalk",","],
+ ["text"," "],
+ ["support.function.chars-and-bytes-io.logtalk","nl"],
+ ["keyword.operator.misc.logtalk",","]
+],[
+ "start",
+ ["text","\t\t"],
+ ["support.function.term-io.logtalk","write"],
+ ["text","("],
+ ["punctuation.definition.string.begin.logtalk","'"],
+ ["string.quoted.single.logtalk","Go to the store and buy some more, 99 bottles of beer on the wall."],
+ ["punctuation.definition.string.end.logtalk","'"],
+ ["text",")"],
+ ["keyword.operator.misc.logtalk",","],
+ ["text"," "],
+ ["support.function.chars-and-bytes-io.logtalk","nl"],
+ ["keyword.operator.misc.logtalk",","],
+ ["text"," "],
+ ["support.function.chars-and-bytes-io.logtalk","nl"],
+ ["keyword.operator.misc.logtalk","."]
+],[
+ "start",
+ ["text","\tsing("],
+ ["variable.other.logtalk","N"],
+ ["text",") "],
+ ["keyword.operator.message-sending.logtalk",":"],
+ ["keyword.operator.evaluable.logtalk","-"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["variable.other.logtalk","N"],
+ ["text"," "],
+ ["keyword.operator.comparison.arithmetic.logtalk",">"],
+ ["text"," "],
+ ["constant.numeric.logtalk","0"],
+ ["keyword.operator.misc.logtalk",","]
+],[
+ "start",
+ ["text","\t\t"],
+ ["variable.other.logtalk","N2"],
+ ["text"," "],
+ ["keyword.operator.misc.logtalk","is"],
+ ["text"," "],
+ ["variable.other.logtalk","N"],
+ ["text"," "],
+ ["keyword.operator.evaluable.logtalk","-"],
+ ["text"," "],
+ ["constant.numeric.logtalk","1"],
+ ["keyword.operator.misc.logtalk",","]
+],[
+ "start",
+ ["text","\t\tbeers("],
+ ["variable.other.logtalk","N"],
+ ["text",")"],
+ ["keyword.operator.misc.logtalk",","],
+ ["text"," "],
+ ["support.function.term-io.logtalk","write"],
+ ["text","("],
+ ["punctuation.definition.string.begin.logtalk","'"],
+ ["string.quoted.single.logtalk"," of beer on the wall, "],
+ ["punctuation.definition.string.end.logtalk","'"],
+ ["text",")"],
+ ["keyword.operator.misc.logtalk",","],
+ ["text"," beers("],
+ ["variable.other.logtalk","N"],
+ ["text",")"],
+ ["keyword.operator.misc.logtalk",","],
+ ["text"," "],
+ ["support.function.term-io.logtalk","write"],
+ ["text","("],
+ ["punctuation.definition.string.begin.logtalk","'"],
+ ["string.quoted.single.logtalk"," of beer."],
+ ["punctuation.definition.string.end.logtalk","'"],
+ ["text",")"],
+ ["keyword.operator.misc.logtalk",","],
+ ["text"," "],
+ ["support.function.chars-and-bytes-io.logtalk","nl"],
+ ["keyword.operator.misc.logtalk",","]
+],[
+ "start",
+ ["text","\t\t"],
+ ["support.function.term-io.logtalk","write"],
+ ["text","("],
+ ["punctuation.definition.string.begin.logtalk","'"],
+ ["string.quoted.single.logtalk","Take one down and pass it around, "],
+ ["punctuation.definition.string.end.logtalk","'"],
+ ["text",")"],
+ ["keyword.operator.misc.logtalk",","],
+ ["text"," beers("],
+ ["variable.other.logtalk","N2"],
+ ["text",")"],
+ ["keyword.operator.misc.logtalk",","],
+ ["text"," "],
+ ["support.function.term-io.logtalk","write"],
+ ["text","("],
+ ["punctuation.definition.string.begin.logtalk","'"],
+ ["string.quoted.single.logtalk"," of beer on the wall."],
+ ["punctuation.definition.string.end.logtalk","'"],
+ ["text",")"],
+ ["keyword.operator.misc.logtalk",","],
+ ["text"," "],
+ ["support.function.chars-and-bytes-io.logtalk","nl"],
+ ["keyword.operator.misc.logtalk",","],
+ ["text"," "],
+ ["support.function.chars-and-bytes-io.logtalk","nl"],
+ ["keyword.operator.misc.logtalk",","]
+],[
+ "start",
+ ["text","\t\tsing("],
+ ["variable.other.logtalk","N2"],
+ ["text",")"],
+ ["keyword.operator.misc.logtalk","."]
+],[
+ "start"
+],[
+ "start",
+ ["text","\tbeers("],
+ ["constant.numeric.logtalk","0"],
+ ["text",") "],
+ ["keyword.operator.message-sending.logtalk",":"],
+ ["keyword.operator.evaluable.logtalk","-"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["support.function.term-io.logtalk","write"],
+ ["text","("],
+ ["punctuation.definition.string.begin.logtalk","'"],
+ ["string.quoted.single.logtalk","no more bottles"],
+ ["punctuation.definition.string.end.logtalk","'"],
+ ["text",")"],
+ ["keyword.operator.misc.logtalk","."]
+],[
+ "start",
+ ["text","\tbeers("],
+ ["constant.numeric.logtalk","1"],
+ ["text",") "],
+ ["keyword.operator.message-sending.logtalk",":"],
+ ["keyword.operator.evaluable.logtalk","-"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["support.function.term-io.logtalk","write"],
+ ["text","("],
+ ["punctuation.definition.string.begin.logtalk","'"],
+ ["string.quoted.single.logtalk","1 bottle"],
+ ["punctuation.definition.string.end.logtalk","'"],
+ ["text",")"],
+ ["keyword.operator.misc.logtalk","."]
+],[
+ "start",
+ ["text","\tbeers("],
+ ["variable.other.logtalk","N"],
+ ["text",") "],
+ ["keyword.operator.message-sending.logtalk",":"],
+ ["keyword.operator.evaluable.logtalk","-"]
+],[
+ "start",
+ ["text","\t\t"],
+ ["variable.other.logtalk","N"],
+ ["text"," "],
+ ["keyword.operator.comparison.arithmetic.logtalk",">"],
+ ["text"," "],
+ ["constant.numeric.logtalk","1"],
+ ["keyword.operator.misc.logtalk",","]
+],[
+ "start",
+ ["text","\t\t"],
+ ["support.function.term-io.logtalk","write"],
+ ["text","("],
+ ["variable.other.logtalk","N"],
+ ["text",")"],
+ ["keyword.operator.misc.logtalk",","],
+ ["text"," "],
+ ["support.function.term-io.logtalk","write"],
+ ["text","("],
+ ["punctuation.definition.string.begin.logtalk","'"],
+ ["string.quoted.single.logtalk"," bottles"],
+ ["punctuation.definition.string.end.logtalk","'"],
+ ["text",")"],
+ ["keyword.operator.misc.logtalk","."]
+],[
+ "start"
+],[
+ "start",
+ ["storage.type.closing.logtalk",":- end_object"],
+ ["keyword.operator.misc.logtalk","."]
+],[
+ "start"
+]]
\ No newline at end of file
diff --git a/lib/ace/mode/_test/tokens_nginx.json b/lib/ace/mode/_test/tokens_nginx.json
new file mode 100644
index 00000000000..0142b2a4b48
--- /dev/null
+++ b/lib/ace/mode/_test/tokens_nginx.json
@@ -0,0 +1,386 @@
+[[
+ "start",
+ ["keyword","user"],
+ ["text"," www www"],
+ ["punctuation",";"],
+ ["text"," "],
+ ["comment","## Default: nobody"]
+],[
+ "start",
+ ["keyword","worker_processes"],
+ ["text"," 5"],
+ ["punctuation",";"],
+ ["text"," "],
+ ["comment","## Default: 1"]
+],[
+ "start",
+ ["keyword","error_log"],
+ ["text"," logs/error.log"],
+ ["punctuation",";"]
+],[
+ "start",
+ ["keyword","pid"],
+ ["text"," logs/nginx.pid"],
+ ["punctuation",";"]
+],[
+ "start",
+ ["keyword","worker_rlimit_nofile"],
+ ["text"," 8192"],
+ ["punctuation",";"]
+],[
+ "start"
+],[
+ "start",
+ ["storage.type","events"],
+ ["text"," "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","worker_connections"],
+ ["text"," 4096"],
+ ["punctuation",";"],
+ ["text"," "],
+ ["comment","## Default: 1024"]
+],[
+ "start",
+ ["paren.rpar","}"]
+],[
+ "start"
+],[
+ "start",
+ ["storage.type","http"],
+ ["text"," "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","include"],
+ ["text"," conf/mime.types"],
+ ["punctuation",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","include"],
+ ["text"," /etc/nginx/proxy.conf"],
+ ["punctuation",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","include"],
+ ["text"," /etc/nginx/fastcgi.conf"],
+ ["punctuation",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","index"],
+ ["text"," index.html index.htm index.php"],
+ ["punctuation",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword","default_type"],
+ ["text"," application/octet-stream"],
+ ["punctuation",";"]
+],[
+ "keyword",
+ ["text"," "],
+ ["keyword","log_format"],
+ ["text"," "],
+ ["constant.language","main"],
+ ["text"," "],
+ ["string","'"],
+ ["variable","$remote_addr"],
+ ["string"," - "],
+ ["variable","$remote_user"],
+ ["string"," ["],
+ ["variable","$time_local"],
+ ["string","] "],
+ ["variable","$status"],
+ ["string"," '"]
+],[
+ "keyword",
+ ["text"," "],
+ ["string","'\""],
+ ["variable","$request"],
+ ["string","\" "],
+ ["variable","$body_bytes_sent"],
+ ["string"," \""],
+ ["variable","$http_referer"],
+ ["string","\" '"]
+],[
+ "start",
+ ["text"," "],
+ ["string","'\""],
+ ["variable","$http_user_agent"],
+ ["string","\" \""],
+ ["variable","$http_x_forwarded_for"],
+ ["string","\"'"],
+ ["punctuation",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","access_log"],
+ ["text"," logs/access.log "],
+ ["constant.language","main"],
+ ["punctuation",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","sendfile"],
+ ["text"," "],
+ ["constant.language","on"],
+ ["punctuation",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","tcp_nopush"],
+ ["text"," "],
+ ["constant.language","on"],
+ ["punctuation",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","server_names_hash_bucket_size"],
+ ["text"," 128"],
+ ["punctuation",";"],
+ ["text"," "],
+ ["comment","# this seems to be required for some vhosts"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["storage.type","server"],
+ ["text"," "],
+ ["paren.lpar","{"],
+ ["text"," "],
+ ["comment","# php/fastcgi"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","listen"],
+ ["text"," 80"],
+ ["punctuation",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","server_name"],
+ ["text"," domain1.com www.domain1.com"],
+ ["punctuation",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","access_log"],
+ ["text"," logs/domain1.access.log "],
+ ["constant.language","main"],
+ ["punctuation",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","root"],
+ ["text"," html"],
+ ["punctuation",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["storage.type","location"],
+ ["text"," "],
+ ["string.regexp","~ \\.php$ "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","fastcgi_pass"],
+ ["text"," 127.0.0.1:1025"],
+ ["punctuation",";"]
+],[
+ "start",
+ ["text"," "],
+ ["paren.rpar","}"]
+],[
+ "start",
+ ["text"," "],
+ ["paren.rpar","}"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["storage.type","server"],
+ ["text"," "],
+ ["paren.lpar","{"],
+ ["text"," "],
+ ["comment","# simple reverse-proxy"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","listen"],
+ ["text"," 80"],
+ ["punctuation",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","server_name"],
+ ["text"," domain2.com www.domain2.com"],
+ ["punctuation",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","access_log"],
+ ["text"," logs/domain2.access.log "],
+ ["constant.language","main"],
+ ["punctuation",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["comment","# serve static files"]
+],[
+ "start",
+ ["text"," "],
+ ["storage.type","location"],
+ ["text"," "],
+ ["string.regexp","~ ^/(images|javascript|js|css|flash|media|static)/ "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","root"],
+ ["text"," /var/www/virtual/big.server.com/htdocs"],
+ ["punctuation",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","expires"],
+ ["text"," 30d"],
+ ["punctuation",";"]
+],[
+ "start",
+ ["text"," "],
+ ["paren.rpar","}"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["comment","# pass requests for dynamic content to rails/turbogears/zope, et al"]
+],[
+ "start",
+ ["text"," "],
+ ["storage.type","location"],
+ ["text"," "],
+ ["text","/ "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","proxy_pass"],
+ ["text"," http://127.0.0.1:8080"],
+ ["punctuation",";"]
+],[
+ "start",
+ ["text"," "],
+ ["paren.rpar","}"]
+],[
+ "start",
+ ["text"," "],
+ ["paren.rpar","}"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["storage.type","upstream"],
+ ["text"," "],
+ ["text","big_server_com "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","server"],
+ ["text"," 127.0.0.3:8000 weight=5"],
+ ["punctuation",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","server"],
+ ["text"," 127.0.0.3:8001 weight=5"],
+ ["punctuation",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","server"],
+ ["text"," 192.168.0.1:8000"],
+ ["punctuation",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","server"],
+ ["text"," 192.168.0.1:8001"],
+ ["punctuation",";"]
+],[
+ "start",
+ ["text"," "],
+ ["paren.rpar","}"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["storage.type","server"],
+ ["text"," "],
+ ["paren.lpar","{"],
+ ["text"," "],
+ ["comment","# simple load balancing"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","listen"],
+ ["text"," 80"],
+ ["punctuation",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","server_name"],
+ ["text"," big.server.com"],
+ ["punctuation",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","access_log"],
+ ["text"," logs/big.server.access.log "],
+ ["constant.language","main"],
+ ["punctuation",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["storage.type","location"],
+ ["text"," "],
+ ["text","/ "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","proxy_pass"],
+ ["text"," http://big_server_com"],
+ ["punctuation",";"]
+],[
+ "start",
+ ["text"," "],
+ ["paren.rpar","}"]
+],[
+ "start",
+ ["text"," "],
+ ["paren.rpar","}"]
+],[
+ "start",
+ ["paren.rpar","}"]
+]]
\ No newline at end of file
diff --git a/lib/ace/mode/_test/tokens_nim.json b/lib/ace/mode/_test/tokens_nim.json
new file mode 100644
index 00000000000..85d2a99407e
--- /dev/null
+++ b/lib/ace/mode/_test/tokens_nim.json
@@ -0,0 +1,105 @@
+[[
+ ["blockComment","blockComment"],
+ ["comment.start","#["],
+ ["comment"," "],
+ ["comment.start","#["],
+ ["comment"," Multiline comment in already"]
+],[
+ "blockComment",
+ ["comment"," commented out code. "],
+ ["comment.end","]#"]
+],[
+ "blockComment",
+ ["comment","proc p[T](x: T) = discard"]
+],[
+ "start",
+ ["comment.end","]#"]
+],[
+ "start",
+ ["keyword","echo"],
+ ["text"," "],
+ ["string","\"This is code\""]
+],[
+ "start",
+ ["variable","var"]
+],[
+ "start",
+ ["text"," "],
+ ["identifier","p"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["constant.float","0B0_10001110100_0000101001000111101011101111111011000101001101001001'f64"]
+],[
+ "start"
+],[
+ "start",
+ ["keyword","proc"],
+ ["text"," "],
+ ["support.function","getAlphabet"],
+ ["paren.lpar","("],
+ ["paren.rpar",")"],
+ ["keyword.operator",":"],
+ ["text"," "],
+ ["storage.type","string"],
+ ["text"," "],
+ ["keyword.operator","="]
+],[
+ "start",
+ ["text"," "],
+ ["variable","var"],
+ ["text"," "],
+ ["identifier","accm"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["string","\"\""]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","for"],
+ ["text"," "],
+ ["identifier","letter"],
+ ["text"," "],
+ ["keyword","in"],
+ ["text"," "],
+ ["string","'a'"],
+ ["keyword.operator",".."],
+ ["string","'z'"],
+ ["keyword.operator",":"],
+ ["text"," "],
+ ["comment","# see iterators"]
+],[
+ "start",
+ ["text"," "],
+ ["identifier","accm"],
+ ["keyword.operator","."],
+ ["support.function","add"],
+ ["paren.lpar","("],
+ ["identifier","letter"],
+ ["paren.rpar",")"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","return"],
+ ["text"," "],
+ ["identifier","accm"]
+],[
+ "start"
+],[
+ "start",
+ ["support.function","assert"],
+ ["paren.lpar","("],
+ ["string","\"a\""],
+ ["text"," "],
+ ["keyword.operator","*"],
+ ["text"," "],
+ ["constant.integer","10"],
+ ["text"," "],
+ ["keyword.operator","=="],
+ ["text"," "],
+ ["string","\"aaaaaaaaaa\""],
+ ["paren.rpar",")"]
+],[
+ "start"
+]]
\ No newline at end of file
diff --git a/lib/ace/mode/_test/tokens_perl6.json b/lib/ace/mode/_test/tokens_perl6.json
new file mode 100644
index 00000000000..a45e3793481
--- /dev/null
+++ b/lib/ace/mode/_test/tokens_perl6.json
@@ -0,0 +1,315 @@
+[[
+ "block_comment",
+ ["comment.doc","=begin comment"]
+],[
+ "block_comment",
+ ["comment.doc","Perl 6 example for ace"]
+],[
+ "start",
+ ["comment.doc","=end comment"]
+],[
+ "start",
+ ["keyword","class"],
+ ["text"," "],
+ ["identifier","Cook"],
+ ["text"," "],
+ ["keyword","is"],
+ ["text"," "],
+ ["identifier","Employee"],
+ ["text"," "],
+ ["lparen","{"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","has"],
+ ["text"," "],
+ ["variable.language","@.utensils"],
+ ["text"," "],
+ ["keyword","is"],
+ ["text"," "],
+ ["support.function","rw"],
+ ["text",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","has"],
+ ["text"," "],
+ ["variable.language","@.cookbooks"],
+ ["text"," "],
+ ["keyword","is"],
+ ["text"," "],
+ ["support.function","rw"],
+ ["text",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword","method"],
+ ["text"," "],
+ ["identifier","cook"],
+ ["lparen","("],
+ ["text"," "],
+ ["variable.language","$food"],
+ ["text"," "],
+ ["rparen",")"],
+ ["text"," "],
+ ["lparen","{"]
+],[
+ "start",
+ ["text"," "],
+ ["support.function","say"],
+ ["text"," "],
+ ["string.quoted.double","\"Cooking "],
+ ["variable.language","$food"],
+ ["string.quoted.double","\""],
+ ["text",";"]
+],[
+ "start",
+ ["text"," "],
+ ["rparen","}"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword","method"],
+ ["text"," "],
+ ["identifier","clean_utensils"],
+ ["text"," "],
+ ["lparen","{"]
+],[
+ "start",
+ ["text"," "],
+ ["support.function","say"],
+ ["text"," "],
+ ["string.quoted.double","\"Cleaning "],
+ ["variable.language","$_"],
+ ["string.quoted.double","\""],
+ ["text"," "],
+ ["keyword","for"],
+ ["text"," "],
+ ["variable.language","@.utensils"],
+ ["text",";"]
+],[
+ "start",
+ ["text"," "],
+ ["rparen","}"]
+],[
+ "start",
+ ["rparen","}"]
+],[
+ "start"
+],[
+ "start",
+ ["keyword","class"],
+ ["text"," "],
+ ["identifier","Baker"],
+ ["text"," "],
+ ["keyword","is"],
+ ["text"," "],
+ ["identifier","Cook"],
+ ["text"," "],
+ ["lparen","{"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword","method"],
+ ["text"," "],
+ ["identifier","cook"],
+ ["lparen","("],
+ ["text"," "],
+ ["variable.language","$confection"],
+ ["text"," "],
+ ["rparen",")"],
+ ["text"," "],
+ ["lparen","{"]
+],[
+ "start",
+ ["text"," "],
+ ["support.function","say"],
+ ["text"," "],
+ ["string.quoted.double","\"Baking a tasty "],
+ ["variable.language","$confection"],
+ ["string.quoted.double","\""],
+ ["text",";"]
+],[
+ "start",
+ ["text"," "],
+ ["rparen","}"]
+],[
+ "start",
+ ["rparen","}"]
+],[
+ "start"
+],[
+ "start",
+ ["keyword","my"],
+ ["text"," "],
+ ["variable.language","$cook"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["identifier","Cook"],
+ ["keyword.operator","."],
+ ["support.function","new"],
+ ["lparen","("]
+],[
+ "start",
+ ["text"," "],
+ ["identifier","utensils"],
+ ["text"," "],
+ ["keyword.operator","=>"],
+ ["text"," "],
+ ["string.quoted.single",""],
+ ["keyword.operator",","]
+],[
+ "start",
+ ["text"," "],
+ ["identifier","cookbooks"],
+ ["text"," "],
+ ["keyword.operator","=>"],
+ ["text"," "],
+ ["string.quoted.single","'The Joy of Cooking'"],
+ ["keyword.operator",","]
+],[
+ "start",
+ ["text"," "],
+ ["identifier","salary"],
+ ["text"," "],
+ ["keyword.operator","=>"],
+ ["text"," "],
+ ["constant.numeric","40000"],
+ ["rparen",")"],
+ ["text",";"]
+],[
+ "start"
+],[
+ "start",
+ ["variable.language","$cook"],
+ ["keyword.operator","."],
+ ["identifier","cook"],
+ ["lparen","("],
+ ["text"," "],
+ ["string.quoted.single","'pizza'"],
+ ["text"," "],
+ ["rparen",")"],
+ ["text","; "],
+ ["comment","# OUTPUT: «Cooking pizza»"]
+],[
+ "start",
+ ["support.function","say"],
+ ["text"," "],
+ ["variable.language","$cook"],
+ ["keyword.operator","."],
+ ["identifier","utensils"],
+ ["keyword.operator","."],
+ ["support.function","perl"],
+ ["text","; "],
+ ["comment","# OUTPUT: «[\"spoon\", \"ladle\", \"knife\", \"pan\"]»"]
+],[
+ "start",
+ ["support.function","say"],
+ ["text"," "],
+ ["variable.language","$cook"],
+ ["keyword.operator","."],
+ ["identifier","cookbooks"],
+ ["keyword.operator","."],
+ ["support.function","perl"],
+ ["text","; "],
+ ["comment","# OUTPUT: «[\"The Joy of Cooking\"]»"]
+],[
+ "start",
+ ["support.function","say"],
+ ["text"," "],
+ ["variable.language","$cook"],
+ ["keyword.operator","."],
+ ["identifier","salary"],
+ ["text","; "],
+ ["comment","# OUTPUT: «40000»"]
+],[
+ "start"
+],[
+ "start",
+ ["keyword","my"],
+ ["text"," "],
+ ["variable.language","$baker"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["identifier","Baker"],
+ ["keyword.operator","."],
+ ["support.function","new"],
+ ["lparen","("]
+],[
+ "start",
+ ["text"," "],
+ ["identifier","utensils"],
+ ["text"," "],
+ ["keyword.operator","=>"],
+ ["text"," "],
+ ["string.quoted.single","'self cleaning oven'"],
+ ["keyword.operator",","]
+],[
+ "start",
+ ["text"," "],
+ ["identifier","cookbooks"],
+ ["text"," "],
+ ["keyword.operator","=>"],
+ ["text"," "],
+ ["string.quoted.double","\"The Baker's Apprentice\""],
+ ["keyword.operator",","]
+],[
+ "start",
+ ["text"," "],
+ ["identifier","salary"],
+ ["text"," "],
+ ["keyword.operator","=>"],
+ ["text"," "],
+ ["constant.numeric","50000"],
+ ["rparen",")"],
+ ["text",";"]
+],[
+ "start"
+],[
+ "start",
+ ["variable.language","$baker"],
+ ["keyword.operator","."],
+ ["identifier","cook"],
+ ["lparen","("],
+ ["string.quoted.single","'brioche'"],
+ ["rparen",")"],
+ ["text","; "],
+ ["comment","# OUTPUT: «Baking a tasty brioche»"]
+],[
+ "start",
+ ["support.function","say"],
+ ["text"," "],
+ ["variable.language","$baker"],
+ ["keyword.operator","."],
+ ["identifier","utensils"],
+ ["keyword.operator","."],
+ ["support.function","perl"],
+ ["text","; "],
+ ["comment","# OUTPUT: «[\"self cleaning oven\"]»"]
+],[
+ "start",
+ ["support.function","say"],
+ ["text"," "],
+ ["variable.language","$baker"],
+ ["keyword.operator","."],
+ ["identifier","cookbooks"],
+ ["keyword.operator","."],
+ ["support.function","perl"],
+ ["text","; "],
+ ["comment","# OUTPUT: «[\"The Baker's Apprentice\"]»"]
+],[
+ "start",
+ ["support.function","say"],
+ ["text"," "],
+ ["variable.language","$baker"],
+ ["keyword.operator","."],
+ ["identifier","salary"],
+ ["text","; "],
+ ["comment","# OUTPUT: «50000» "]
+]]
\ No newline at end of file
diff --git a/lib/ace/mode/_test/tokens_puppet.json b/lib/ace/mode/_test/tokens_puppet.json
new file mode 100644
index 00000000000..fda5217325d
--- /dev/null
+++ b/lib/ace/mode/_test/tokens_puppet.json
@@ -0,0 +1,443 @@
+[[
+ "start",
+ ["storage.function.puppet","define"],
+ ["name.function.puppet"," apache::vhost "],
+ ["punctuation.lpar","("],
+ ["variable.puppet","$port"],
+ ["keyword.operator",","],
+ ["string"," "],
+ ["variable.puppet","$docroot"],
+ ["keyword.operator",","],
+ ["string"," "],
+ ["variable.puppet","$servername"],
+ ["string"," "],
+ ["keyword.operator","="],
+ ["string"," "],
+ ["variable.puppet","$title"],
+ ["keyword.operator",","],
+ ["string"," "],
+ ["variable.puppet","$vhost_name"],
+ ["string"," "],
+ ["keyword.operator","="],
+ ["string"," "],
+ ["punctuation.quote.puppet","'"],
+ ["string","*"],
+ ["punctuation.quote.puppet","'"],
+ ["punctuation.rpar.puppet",")"],
+ ["keyword.name.resource.puppet"," "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.control.puppet","include"],
+ ["text"," apache"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.control.puppet","include"],
+ ["text"," apache"],
+ ["keyword.operator","::"],
+ ["text","params"]
+],[
+ "start",
+ ["text"," "],
+ ["variable.puppet","$vhost_dir"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["qualified.variable.puppet","$apache::params::vhost_dir"]
+],[
+ "start",
+ ["keyword.name.resource.puppet"," file"],
+ ["paren.lpar"," {"],
+ ["text"," "],
+ ["punctuation.quote.puppet","\""],
+ ["variable.puppet","${vhost_dir"],
+ ["string","}/"],
+ ["variable.puppet","${servername"],
+ ["string","}.conf"],
+ ["punctuation.quote.puppet","\""],
+ ["text",":"]
+],[
+ "start",
+ ["text"," "],
+ ["language.support.class","content"],
+ ["keyword.operator"," =>"],
+ ["text"," "],
+ ["support.function.puppet","template"],
+ ["paren.lpar","("],
+ ["punctuation.quote.puppet","'"],
+ ["string","apache/vhost-default.conf.erb"],
+ ["punctuation.quote.puppet","'"],
+ ["paren.rpar",")"],
+ ["keyword.operator",","]
+],[
+ "start",
+ ["text"," "],
+ ["language.support.class","owner"],
+ ["keyword.operator"," =>"],
+ ["text"," "],
+ ["punctuation.quote.puppet","'"],
+ ["string","www"],
+ ["punctuation.quote.puppet","'"],
+ ["keyword.operator",","]
+],[
+ "start",
+ ["text"," "],
+ ["language.support.class","group"],
+ ["keyword.operator"," =>"],
+ ["text"," "],
+ ["punctuation.quote.puppet","'"],
+ ["string","www"],
+ ["punctuation.quote.puppet","'"],
+ ["keyword.operator",","]
+],[
+ "start",
+ ["text"," "],
+ ["language.support.class","mode"],
+ ["keyword.operator"," =>"],
+ ["text"," "],
+ ["punctuation.quote.puppet","'"],
+ ["string","644"],
+ ["punctuation.quote.puppet","'"],
+ ["keyword.operator",","]
+],[
+ "start",
+ ["text"," "],
+ ["language.support.class","require"],
+ ["keyword.operator"," =>"],
+ ["text"," "],
+ ["constant.types.puppet","Package"],
+ ["paren.lpar","["],
+ ["punctuation.quote.puppet","'"],
+ ["string","httpd"],
+ ["punctuation.quote.puppet","'"],
+ ["paren.rpar","]"],
+ ["keyword.operator",","]
+],[
+ "start",
+ ["text"," "],
+ ["language.support.class","notify"],
+ ["keyword.operator"," =>"],
+ ["text"," "],
+ ["constant.types.puppet","Service"],
+ ["paren.lpar","["],
+ ["punctuation.quote.puppet","'"],
+ ["string","httpd"],
+ ["punctuation.quote.puppet","'"],
+ ["paren.rpar","]"],
+ ["keyword.operator",","]
+],[
+ "start",
+ ["text"," "],
+ ["paren.rpar","}"]
+],[
+ "start",
+ ["paren.rpar","}"]
+],[
+ "start"
+],[
+ "start",
+ ["support.function.puppet","type"],
+ ["text"," MyModule"],
+ ["keyword.operator","::"],
+ ["text","Tree "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["constant.types.puppet","Array"],
+ ["paren.lpar","["],
+ ["constant.types.puppet","Variant"],
+ ["paren.lpar","["],
+ ["constant.types.puppet","Data"],
+ ["keyword.operator",","],
+ ["text"," Tree"],
+ ["paren.rpar","]]"]
+],[
+ "start"
+],[
+ "start",
+ ["keyword.control.puppet","function"],
+ ["text"," apache"],
+ ["keyword.operator","::"],
+ ["text","bool2http"],
+ ["paren.lpar","("],
+ ["constant.types.puppet","Variant"],
+ ["paren.lpar","["],
+ ["constant.types.puppet","String"],
+ ["keyword.operator",","],
+ ["text"," "],
+ ["constant.types.puppet","Boolean"],
+ ["paren.rpar","]"],
+ ["text"," "],
+ ["variable.puppet","$arg"],
+ ["paren.rpar",")"],
+ ["text"," "],
+ ["keyword.operator",">>"],
+ ["keyword.name.resource.puppet"," String"],
+ ["paren.lpar"," {"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.control.puppet","case "],
+ ["variable.puppet","$arg"],
+ ["keyword.name.resource.puppet"," "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["text"," "],
+ ["constant.language.puppet","false"],
+ ["keyword.operator",","],
+ ["text"," "],
+ ["constant.language.puppet","undef"],
+ ["keyword.operator",","],
+ ["regexp.begin.string.puppet"," /(?i:false)/"],
+ ["text"," :"],
+ ["keyword.name.resource.puppet"," "],
+ ["paren.lpar","{"],
+ ["text"," "],
+ ["punctuation.quote.puppet","'"],
+ ["string","Off"],
+ ["punctuation.quote.puppet","'"],
+ ["text"," "],
+ ["paren.rpar","}"]
+],[
+ "start",
+ ["text"," "],
+ ["constant.language.puppet","true"],
+ ["keyword.operator",","],
+ ["regexp.begin.string.puppet"," /(?i:true)/"],
+ ["text"," :"],
+ ["keyword.name.resource.puppet"," "],
+ ["paren.lpar","{"],
+ ["text"," "],
+ ["punctuation.quote.puppet","'"],
+ ["string","On"],
+ ["punctuation.quote.puppet","'"],
+ ["text"," "],
+ ["paren.rpar","}"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.control.puppet","default"],
+ ["text"," :"],
+ ["keyword.name.resource.puppet"," "],
+ ["paren.lpar","{"],
+ ["text"," "],
+ ["punctuation.quote.puppet","\""],
+ ["variable.puppet","$arg"],
+ ["punctuation.quote.puppet","\""],
+ ["text"," "],
+ ["paren.rpar","}"]
+],[
+ "start",
+ ["text"," "],
+ ["paren.rpar","}"]
+],[
+ "start",
+ ["paren.rpar","}"]
+],[
+ "start"
+],[
+ "start",
+ ["singleline.comment.puppet","# A class with parameters"]
+],[
+ "start",
+ ["keyword.type.puppet","class"],
+ ["constant.class.puppet"," apache "],
+ ["paren.lpar","("],
+ ["constant.types.puppet","String"],
+ ["text"," "],
+ ["variable.puppet","$version"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["punctuation.quote.puppet","'"],
+ ["string","latest"],
+ ["punctuation.quote.puppet","'"],
+ ["paren.rpar",")"],
+ ["keyword.name.resource.puppet"," "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["keyword.name.resource.puppet"," package"],
+ ["paren.lpar"," {"],
+ ["punctuation.quote.puppet","'"],
+ ["string","httpd"],
+ ["punctuation.quote.puppet","'"],
+ ["text",":"]
+],[
+ "start",
+ ["text"," "],
+ ["language.support.class","ensure"],
+ ["keyword.operator"," =>"],
+ ["text"," "],
+ ["variable.puppet","$version"],
+ ["keyword.operator",","],
+ ["text"," "],
+ ["singleline.comment.puppet","# Using the class parameter from above"]
+],[
+ "start",
+ ["text"," "],
+ ["language.support.class","before"],
+ ["keyword.operator"," =>"],
+ ["text"," "],
+ ["constant.types.puppet","File"],
+ ["paren.lpar","["],
+ ["punctuation.quote.puppet","'"],
+ ["string","/etc/httpd.conf"],
+ ["punctuation.quote.puppet","'"],
+ ["paren.rpar","]"],
+ ["keyword.operator",","]
+],[
+ "start",
+ ["text"," "],
+ ["paren.rpar","}"]
+],[
+ "start",
+ ["keyword.name.resource.puppet"," file"],
+ ["paren.lpar"," {"],
+ ["punctuation.quote.puppet","'"],
+ ["string","/etc/httpd.conf"],
+ ["punctuation.quote.puppet","'"],
+ ["text",":"]
+],[
+ "start",
+ ["text"," "],
+ ["language.support.class","ensure"],
+ ["keyword.operator"," =>"],
+ ["text"," "],
+ ["support.function.puppet","file"],
+ ["keyword.operator",","]
+],[
+ "start",
+ ["text"," "],
+ ["language.support.class","owner"],
+ ["keyword.operator"," =>"],
+ ["text"," "],
+ ["punctuation.quote.puppet","'"],
+ ["string","httpd"],
+ ["punctuation.quote.puppet","'"],
+ ["keyword.operator",","]
+],[
+ "start",
+ ["text"," "],
+ ["language.support.class","content"],
+ ["keyword.operator"," =>"],
+ ["text"," "],
+ ["support.function.puppet","template"],
+ ["paren.lpar","("],
+ ["punctuation.quote.puppet","'"],
+ ["string","apache/httpd.conf.erb"],
+ ["punctuation.quote.puppet","'"],
+ ["paren.rpar",")"],
+ ["keyword.operator",","],
+ ["text"," "],
+ ["singleline.comment.puppet","# Template from a module"]
+],[
+ "start",
+ ["text"," "],
+ ["paren.rpar","}"]
+],[
+ "start",
+ ["keyword.name.resource.puppet"," service"],
+ ["paren.lpar"," {"],
+ ["punctuation.quote.puppet","'"],
+ ["string","httpd"],
+ ["punctuation.quote.puppet","'"],
+ ["text",":"]
+],[
+ "start",
+ ["text"," "],
+ ["language.support.class","ensure"],
+ ["keyword.operator"," =>"],
+ ["text"," "],
+ ["constant.language.puppet","running"],
+ ["keyword.operator",","]
+],[
+ "start",
+ ["text"," "],
+ ["language.support.class","enable"],
+ ["keyword.operator"," =>"],
+ ["text"," "],
+ ["constant.language.puppet","true"],
+ ["keyword.operator",","]
+],[
+ "start",
+ ["text"," "],
+ ["language.support.class","subscribe"],
+ ["keyword.operator"," =>"],
+ ["text"," "],
+ ["constant.types.puppet","File"],
+ ["paren.lpar","["],
+ ["punctuation.quote.puppet","'"],
+ ["string","/etc/httpd.conf"],
+ ["punctuation.quote.puppet","'"],
+ ["paren.rpar","]"],
+ ["keyword.operator",","]
+],[
+ "start",
+ ["text"," "],
+ ["paren.rpar","}"]
+],[
+ "start",
+ ["paren.rpar","}"]
+],[
+ "start"
+],[
+ "start"
+],[
+ "start",
+ ["keyword.control.puppet","if "],
+ ["variable.puppet","$is_virtual"],
+ ["keyword.name.resource.puppet"," "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["text"," "],
+ ["support.function.puppet","warning"],
+ ["paren.lpar","("],
+ ["text"," "],
+ ["punctuation.quote.puppet","'"],
+ ["string","Tried to include class ntp on virtual machine; this node might be misclassified."],
+ ["punctuation.quote.puppet","'"],
+ ["text"," "],
+ ["paren.rpar",")"]
+],[
+ "start",
+ ["paren.rpar","}"]
+],[
+ "start",
+ ["keyword.control.puppet","elsif "],
+ ["variable.puppet","$operatingsystem"],
+ ["text"," "],
+ ["keyword.operator","=="],
+ ["text"," "],
+ ["punctuation.quote.puppet","'"],
+ ["string","Darwin"],
+ ["punctuation.quote.puppet","'"],
+ ["keyword.name.resource.puppet"," "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["text"," "],
+ ["support.function.puppet","warning"],
+ ["paren.lpar","("],
+ ["text"," "],
+ ["punctuation.quote.puppet","'"],
+ ["string","This NTP module does not yet work on our Mac laptops."],
+ ["punctuation.quote.puppet","'"],
+ ["text"," "],
+ ["paren.rpar",")"]
+],[
+ "start",
+ ["keyword.name.resource.puppet","else"],
+ ["paren.lpar"," {"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.control.puppet","include"],
+ ["text"," ntp"]
+],[
+ "start",
+ ["paren.rpar","}"]
+]]
\ No newline at end of file
diff --git a/lib/ace/mode/_test/tokens_terraform.json b/lib/ace/mode/_test/tokens_terraform.json
new file mode 100644
index 00000000000..bc0eb22c9d9
--- /dev/null
+++ b/lib/ace/mode/_test/tokens_terraform.json
@@ -0,0 +1,629 @@
+[[
+ "start",
+ ["storage.function.terraform","export"],
+ ["text"," "],
+ ["variable.assignment.terraform","TF_LOG"],
+ ["keyword.operator","="],
+ ["text","TRACE"]
+],[
+ "start"
+],[
+ "start",
+ ["singleline.comment.terraform","# An AMI"]
+],[
+ "start",
+ ["storage.function.terraform","variable"],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","ami"],
+ ["punctuation.quote.terraform","\""],
+ ["text"," "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["text"," "],
+ ["variable.assignment.terraform","description"],
+ ["keyword.operator"," ="],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","the AMI to use"],
+ ["punctuation.quote.terraform","\""]
+],[
+ "start",
+ ["paren.rpar","}"]
+],[
+ "start"
+],[
+ "blockComment",
+ ["multiline.comment.begin.terraform","/*"],
+ ["comment"," A multi"]
+],[
+ "start",
+ ["comment"," line comment. "],
+ ["multiline.comment.end.terraform","*/"]
+],[
+ "start",
+ ["storage.function.terraform","resource"],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","aws_instance"],
+ ["punctuation.quote.terraform","\""],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","web"],
+ ["punctuation.quote.terraform","\""],
+ ["text"," "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["text"," "],
+ ["variable.assignment.terraform","ami"],
+ ["keyword.operator"," ="],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["punctuation.interpolated.begin.terraform","${"],
+ ["variable.terraform","var.ami"],
+ ["punctuation.interpolated.end.terraform","}"],
+ ["punctuation.quote.terraform","\""]
+],[
+ "start",
+ ["text"," "],
+ ["variable.assignment.terraform","count"],
+ ["keyword.operator"," ="],
+ ["text"," "],
+ ["constant.numeric.terraform","2"]
+],[
+ "start",
+ ["text"," "],
+ ["variable.assignment.terraform","source_dest_check"],
+ ["keyword.operator"," ="],
+ ["text"," "],
+ ["constant.language.terraform","false"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["language.support.class","connection"],
+ ["text"," "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["text"," "],
+ ["variable.assignment.terraform","user"],
+ ["keyword.operator"," ="],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","root"],
+ ["punctuation.quote.terraform","\""]
+],[
+ "start",
+ ["text"," "],
+ ["paren.rpar","}"]
+],[
+ "start",
+ ["paren.rpar","}"]
+],[
+ "start"
+],[
+ "start",
+ ["storage.function.terraform","resource"],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","aws_instance"],
+ ["punctuation.quote.terraform","\""],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","web"],
+ ["punctuation.quote.terraform","\""],
+ ["text"," "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["text"," "],
+ ["variable.assignment.terraform","subnet"],
+ ["keyword.operator"," ="],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["punctuation.interpolated.begin.terraform","${"],
+ ["variable.terraform","var.env"],
+ ["punctuation"," "],
+ ["keyword.operator","=="],
+ ["punctuation"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","production"],
+ ["punctuation.quote.terraform","\""],
+ ["punctuation"," "],
+ ["keyword.operator","?"],
+ ["punctuation"," "],
+ ["variable.terraform","var.prod_subnet"],
+ ["punctuation"," "],
+ ["keyword.operator",":"],
+ ["punctuation"," "],
+ ["variable.terraform","var.dev_subnet"],
+ ["punctuation.interpolated.end.terraform","}"],
+ ["punctuation.quote.terraform","\""]
+],[
+ "start",
+ ["paren.rpar","}"]
+],[
+ "start"
+],[
+ "start",
+ ["storage.function.terraform","variable"],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","count"],
+ ["punctuation.quote.terraform","\""],
+ ["text"," "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["text"," "],
+ ["variable.assignment.terraform","default"],
+ ["keyword.operator"," ="],
+ ["text"," "],
+ ["constant.numeric.terraform","2"]
+],[
+ "start",
+ ["paren.rpar","}"]
+],[
+ "start"
+],[
+ "start",
+ ["storage.function.terraform","variable"],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","hostnames"],
+ ["punctuation.quote.terraform","\""],
+ ["text"," "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["text"," "],
+ ["variable.assignment.terraform","default"],
+ ["keyword.operator"," ="],
+ ["text"," "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","0"],
+ ["punctuation.quote.terraform","\""],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","example1.org"],
+ ["punctuation.quote.terraform","\""]
+],[
+ "start",
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","1"],
+ ["punctuation.quote.terraform","\""],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","example2.net"],
+ ["punctuation.quote.terraform","\""]
+],[
+ "start",
+ ["text"," "],
+ ["paren.rpar","}"]
+],[
+ "start",
+ ["paren.rpar","}"]
+],[
+ "start"
+],[
+ "start",
+ ["storage.function.terraform","data"],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","template_file"],
+ ["punctuation.quote.terraform","\""],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","web_init"],
+ ["punctuation.quote.terraform","\""],
+ ["text"," "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["text"," "],
+ ["singleline.comment.terraform","# Render the template once for each instance"]
+],[
+ "start",
+ ["text"," "],
+ ["variable.assignment.terraform","count"],
+ ["keyword.operator"," ="],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["punctuation.interpolated.begin.terraform","${"],
+ ["keyword.function.terraform","length"],
+ ["punctuation","("],
+ ["variable.terraform","var.hostnames"],
+ ["punctuation",")"],
+ ["punctuation.interpolated.end.terraform","}"],
+ ["punctuation.quote.terraform","\""]
+],[
+ "start",
+ ["text"," "],
+ ["variable.assignment.terraform","template"],
+ ["keyword.operator"," ="],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["punctuation.interpolated.begin.terraform","${"],
+ ["keyword.function.terraform","file"],
+ ["punctuation","("],
+ ["punctuation.quote.terraform","\""],
+ ["string","templates/web_init.tpl"],
+ ["punctuation.quote.terraform","\""],
+ ["punctuation",")"],
+ ["punctuation.interpolated.end.terraform","}"],
+ ["punctuation.quote.terraform","\""]
+],[
+ "start",
+ ["text"," vars "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["text"," "],
+ ["singleline.comment.terraform","# count.index tells us the index of the instance we are rendering"]
+],[
+ "start",
+ ["text"," "],
+ ["variable.assignment.terraform","hostname"],
+ ["keyword.operator"," ="],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["punctuation.interpolated.begin.terraform","${"],
+ ["variable.terraform","var.hostnames"],
+ ["paren.lpar","["],
+ ["variable.terraform","count.index"],
+ ["paren.rpar","]"],
+ ["punctuation.interpolated.end.terraform","}"],
+ ["punctuation.quote.terraform","\""]
+],[
+ "start",
+ ["text"," "],
+ ["paren.rpar","}"]
+],[
+ "start",
+ ["paren.rpar","}"]
+],[
+ "start"
+],[
+ "start",
+ ["storage.function.terraform","resource"],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","aws_instance"],
+ ["punctuation.quote.terraform","\""],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","web"],
+ ["punctuation.quote.terraform","\""],
+ ["text"," "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["text"," "],
+ ["singleline.comment.terraform","# Create one instance for each hostname"]
+],[
+ "start",
+ ["text"," "],
+ ["variable.assignment.terraform","count"],
+ ["keyword.operator"," ="],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["punctuation.interpolated.begin.terraform","${"],
+ ["keyword.function.terraform","length"],
+ ["punctuation","("],
+ ["variable.terraform","var.hostnames"],
+ ["punctuation",")"],
+ ["punctuation.interpolated.end.terraform","}"],
+ ["punctuation.quote.terraform","\""]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["singleline.comment.terraform","# Pass each instance its corresponding template_file"]
+],[
+ "start",
+ ["text"," "],
+ ["variable.assignment.terraform","user_data"],
+ ["keyword.operator"," ="],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["punctuation.interpolated.begin.terraform","${"],
+ ["punctuation","data.template_file.web_init."],
+ ["keyword.operator","*"],
+ ["punctuation",".rendered"],
+ ["paren.lpar","["],
+ ["variable.terraform","count.index"],
+ ["paren.rpar","]"],
+ ["punctuation.interpolated.end.terraform","}"],
+ ["punctuation.quote.terraform","\""]
+],[
+ "start",
+ ["paren.rpar","}"]
+],[
+ "start"
+],[
+ "start",
+ ["storage.function.terraform","variable"],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","count"],
+ ["punctuation.quote.terraform","\""],
+ ["text"," "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["text"," "],
+ ["variable.assignment.terraform","default"],
+ ["keyword.operator"," ="],
+ ["text"," "],
+ ["constant.numeric.terraform","2"]
+],[
+ "start",
+ ["paren.rpar","}"]
+],[
+ "start"
+],[
+ "start",
+ ["singleline.comment.terraform","# Define the common tags for all resources"]
+],[
+ "start",
+ ["storage.function.terraform","locals {"]
+],[
+ "start",
+ ["text"," "],
+ ["variable.assignment.terraform","common_tags"],
+ ["keyword.operator"," ="],
+ ["text"," "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["text"," "],
+ ["variable.assignment.terraform","Component"],
+ ["keyword.operator"," ="],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","awesome-app"],
+ ["punctuation.quote.terraform","\""]
+],[
+ "start",
+ ["text"," "],
+ ["variable.assignment.terraform","Environment"],
+ ["keyword.operator"," ="],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","production"],
+ ["punctuation.quote.terraform","\""]
+],[
+ "start",
+ ["text"," "],
+ ["paren.rpar","}"]
+],[
+ "start",
+ ["paren.rpar","}"]
+],[
+ "start"
+],[
+ "start",
+ ["singleline.comment.terraform","# Create a resource that blends the common tags with instance-specific tags."]
+],[
+ "start",
+ ["storage.function.terraform","resource"],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","aws_instance"],
+ ["punctuation.quote.terraform","\""],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","server"],
+ ["punctuation.quote.terraform","\""],
+ ["text"," "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["text"," "],
+ ["variable.assignment.terraform","ami"],
+ ["keyword.operator"," ="],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","ami-123456"],
+ ["punctuation.quote.terraform","\""]
+],[
+ "start",
+ ["text"," "],
+ ["variable.assignment.terraform","instance_type"],
+ ["keyword.operator"," ="],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","t2.micro"],
+ ["punctuation.quote.terraform","\""]
+],[
+ "start"
+],[
+ ["punctuation.interpolated.begin.terraform","punctuation.quote.terraform0"],
+ ["text"," "],
+ ["variable.assignment.terraform","tags"],
+ ["keyword.operator"," ="],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["punctuation.interpolated.begin.terraform","${"],
+ ["keyword.function.terraform","merge"],
+ ["punctuation","("]
+],[
+ ["punctuation.interpolated.begin.terraform","punctuation.quote.terraform0"],
+ ["punctuation"," "],
+ ["variable.terraform","local.common_tags"],
+ ["punctuation",","]
+],[
+ ["punctuation.interpolated.begin.terraform","punctuation.quote.terraform0"],
+ ["punctuation"," "],
+ ["keyword.function.terraform","map"],
+ ["punctuation","("]
+],[
+ ["punctuation.interpolated.begin.terraform","punctuation.quote.terraform0"],
+ ["punctuation"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","Name"],
+ ["punctuation.quote.terraform","\""],
+ ["punctuation",", "],
+ ["punctuation.quote.terraform","\""],
+ ["string","awesome-app-server"],
+ ["punctuation.quote.terraform","\""],
+ ["punctuation",","]
+],[
+ ["punctuation.interpolated.begin.terraform","punctuation.quote.terraform0"],
+ ["punctuation"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","Role"],
+ ["punctuation.quote.terraform","\""],
+ ["punctuation",", "],
+ ["punctuation.quote.terraform","\""],
+ ["string","server"],
+ ["punctuation.quote.terraform","\""]
+],[
+ ["punctuation.interpolated.begin.terraform","punctuation.quote.terraform0"],
+ ["punctuation"," )"]
+],[
+ "start",
+ ["punctuation"," )"],
+ ["punctuation.interpolated.end.terraform","}"],
+ ["punctuation.quote.terraform","\""]
+],[
+ "start",
+ ["paren.rpar","}"]
+],[
+ "start"
+],[
+ "start",
+ ["variable.terraform","$ "],
+ ["text","terraform apply "],
+ ["keyword.terraform","-var"],
+ ["text"," "],
+ ["variable.assignment.terraform","foo"],
+ ["keyword.operator","="],
+ ["text","bar "],
+ ["keyword.terraform","-var"],
+ ["text"," "],
+ ["variable.assignment.terraform","foo"],
+ ["keyword.operator","="],
+ ["text","baz"]
+],[
+ "variable.terraform",
+ ["variable.terraform","$ "],
+ ["text","terraform apply "],
+ ["keyword.terraform","-var"],
+ ["text"," "],
+ ["punctuation.quote.terraform","'"],
+ ["string","foo={quux=\"bar\"}"],
+ ["punctuation.quote.terraform","'"],
+ ["text"," "],
+ ["keyword.terraform","-var"],
+ ["text"," "],
+ ["punctuation.quote.terraform","'"],
+ ["string","foo={bar=\"baz\"}"],
+ ["punctuation.quote.terraform","'"]
+],[
+ "start"
+],[
+ "start",
+ ["variable.terraform","$ "],
+ ["text","terraform apply "],
+ ["keyword.terraform","-var-file"],
+ ["keyword.operator","="],
+ ["text","foo.tfvars "],
+ ["keyword.terraform","-var-file"],
+ ["keyword.operator","="],
+ ["text","bar.tfvars"]
+],[
+ "start",
+ ["variable.terraform","$ "],
+ ["variable.assignment.terraform","TF_VAR_somemap"],
+ ["keyword.operator","="],
+ ["punctuation.quote.terraform","'"],
+ ["string","{foo = \"bar\", baz = \"qux\"}"],
+ ["punctuation.quote.terraform","'"],
+ ["text"," terraform plan"]
+],[
+ "start"
+],[
+ "start",
+ ["storage.function.terraform","resource"],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","aws_instance"],
+ ["punctuation.quote.terraform","\""],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["string","web"],
+ ["punctuation.quote.terraform","\""],
+ ["text"," "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["text"," "],
+ ["singleline.comment.terraform","# ..."]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["variable.assignment.terraform","count"],
+ ["keyword.operator"," ="],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["punctuation.interpolated.begin.terraform","${"],
+ ["variable.terraform","var.count"],
+ ["punctuation.interpolated.end.terraform","}"],
+ ["punctuation.quote.terraform","\""]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["singleline.comment.terraform","# Tag the instance with a counter starting at 1, ie. web-001"]
+],[
+ "start",
+ ["text"," tags "],
+ ["paren.lpar","{"]
+],[
+ "start",
+ ["text"," "],
+ ["variable.assignment.terraform","Name"],
+ ["keyword.operator"," ="],
+ ["text"," "],
+ ["punctuation.quote.terraform","\""],
+ ["punctuation.interpolated.begin.terraform","${"],
+ ["keyword.function.terraform","format"],
+ ["punctuation","("],
+ ["punctuation.quote.terraform","\""],
+ ["string","web-%03d"],
+ ["punctuation.quote.terraform","\""],
+ ["punctuation",", "],
+ ["variable.terraform","count.index"],
+ ["punctuation"," "],
+ ["keyword.operator","+"],
+ ["punctuation"," "],
+ ["constant.numeric.terraform","1"],
+ ["punctuation",")"],
+ ["punctuation.interpolated.end.terraform","}"],
+ ["punctuation.quote.terraform","\""]
+],[
+ "start",
+ ["text"," "],
+ ["paren.rpar","}"]
+],[
+ "start",
+ ["paren.rpar","}"]
+]]
\ No newline at end of file
diff --git a/lib/ace/mode/_test/tokens_visualforce.json b/lib/ace/mode/_test/tokens_visualforce.json
new file mode 100644
index 00000000000..ebf416ae8df
--- /dev/null
+++ b/lib/ace/mode/_test/tokens_visualforce.json
@@ -0,0 +1,306 @@
+[[
+ "start",
+ ["meta.tag.punctuation.tag-open.xml","<"],
+ ["meta.tag.tag-name.xml","apex:stylesheet"],
+ ["text.tag-whitespace.xml"," "],
+ ["entity.other.attribute-name.xml","value"],
+ ["keyword.operator.attribute-equals.xml","="],
+ ["string.attribute-value.xml","\""],
+ ["keyword.start","{!"],
+ ["support.function","URLFOR"],
+ ["keyword.operator","("],
+ ["variable.language","$Resource"],
+ ["punctuation.operator","."],
+ ["identifier","BrowserCompatibility"],
+ ["punctuation.operator",","],
+ ["text"," "],
+ ["string.start","'"],
+ ["string","css/style.css"],
+ ["string.end","'"],
+ ["keyword.operator",")"],
+ ["keyword.end","}"],
+ ["string.attribute-value.xml","\""],
+ ["meta.tag.punctuation.tag-close.xml","/>"]
+],[
+ "start"
+],[
+ ["Visualforce","string.attribute-value.xml0","string.attribute-value.xml0","tag_stuff"],
+ ["meta.tag.punctuation.tag-open.xml","<"],
+ ["meta.tag.tag-name.xml","apex:page"],
+ ["text.tag-whitespace.xml"," "],
+ ["entity.other.attribute-name.xml","action"],
+ ["keyword.operator.attribute-equals.xml","="],
+ ["string.attribute-value.xml","\""],
+ ["keyword.start","{!"],
+ ["support.function","IF"],
+ ["keyword.operator","("],
+ ["variable.language","$User"],
+ ["punctuation.operator","."],
+ ["identifier","Alias"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["string.start","'"],
+ ["string","JohnDoe"],
+ ["string.end","'"],
+ ["text"," "],
+ ["keyword.operator","||"],
+ ["text"," "],
+ ["variable.language","$User"],
+ ["punctuation.operator","."],
+ ["identifier","Alias"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["string.start","'"],
+ ["string","JBloggs"],
+ ["string.end","'"],
+ ["text"," "],
+ ["keyword.operator","||"],
+ ["text"," "],
+ ["variable.language","$User"],
+ ["punctuation.operator","."],
+ ["identifier","Alias"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["string.start","'"],
+ ["string","FooBar"],
+ ["string.end","'"],
+ ["punctuation.operator",","]
+],[
+ ["Visualforce","string.attribute-value.xml0","string.attribute-value.xml0","tag_stuff"],
+ ["text"," "],
+ ["constant.language","null"],
+ ["punctuation.operator",","]
+],[
+ ["Visualforce","string.attribute-value.xml0","string.attribute-value.xml0","tag_stuff"],
+ ["text"," "],
+ ["identifier","urlFor"],
+ ["keyword.operator","("],
+ ["variable.language","$Action"],
+ ["punctuation.operator","."],
+ ["identifier","Account"],
+ ["punctuation.operator","."],
+ ["identifier","Delete"],
+ ["punctuation.operator",","],
+ ["text"," "],
+ ["variable.language","$CurrentPage"],
+ ["punctuation.operator","."],
+ ["identifier","Parameters"],
+ ["punctuation.operator","."],
+ ["identifier","id"],
+ ["punctuation.operator",","],
+ ["text"," "],
+ ["paren.lparen","["],
+ ["identifier","retURL"],
+ ["keyword.operator","="],
+ ["string.start","'"],
+ ["string","/001"],
+ ["string.end","'"],
+ ["paren.rparen","]"],
+ ["punctuation.operator",","],
+ ["text"," "],
+ ["constant.language","true"],
+ ["keyword.operator",")"]
+],[
+ "start",
+ ["keyword.operator",")"],
+ ["keyword.end","}"],
+ ["string.attribute-value.xml","\""],
+ ["text.tag-whitespace.xml"," "],
+ ["entity.other.attribute-name.xml","standardController"],
+ ["keyword.operator.attribute-equals.xml","="],
+ ["string.attribute-value.xml","\"Account\""],
+ ["meta.tag.punctuation.tag-close.xml",">"],
+ ["meta.tag.punctuation.end-tag-open.xml",""],
+ ["meta.tag.tag-name.xml","apex:page"],
+ ["meta.tag.punctuation.tag-close.xml",">"]
+],[
+ "start"
+],[
+ ["Visualforce","string.attribute-value.xml0","string.attribute-value.xml0","tag_stuff"],
+ ["meta.tag.punctuation.tag-open.xml","<"],
+ ["meta.tag.tag-name.xml","apex:page"],
+ ["text.tag-whitespace.xml"," "],
+ ["entity.other.attribute-name.xml","action"],
+ ["keyword.operator.attribute-equals.xml","="],
+ ["string.attribute-value.xml","\""],
+ ["keyword.start","{!"],
+ ["support.function","IF"],
+ ["keyword.operator","("],
+ ["support.function","OR"],
+ ["keyword.operator","("],
+ ["variable.language","$User"],
+ ["punctuation.operator","."],
+ ["identifier","Alias"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["string.start","'"],
+ ["string","JohnDoe"],
+ ["string.end","'"],
+ ["punctuation.operator",","],
+ ["text"," "],
+ ["variable.language","$User"],
+ ["punctuation.operator","."],
+ ["identifier","Alias"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["string.start","'"],
+ ["string","JBloggs"],
+ ["string.end","'"],
+ ["punctuation.operator",","],
+ ["text"," "],
+ ["variable.language","$User"],
+ ["punctuation.operator","."],
+ ["identifier","Alias"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["string.start","'"],
+ ["string","FooBar"],
+ ["string.end","'"],
+ ["keyword.operator",")"],
+ ["punctuation.operator",","]
+],[
+ ["Visualforce","string.attribute-value.xml0","string.attribute-value.xml0","tag_stuff"],
+ ["text"," "],
+ ["constant.language","NULL"],
+ ["punctuation.operator",","]
+],[
+ ["Visualforce","string.attribute-value.xml0","string.attribute-value.xml0","tag_stuff"],
+ ["text"," "],
+ ["support.function","URLFOR"],
+ ["keyword.operator","("],
+ ["variable.language","$Action"],
+ ["punctuation.operator","."],
+ ["identifier","Account"],
+ ["punctuation.operator","."],
+ ["identifier","Delete"],
+ ["punctuation.operator",","],
+ ["text"," "],
+ ["variable.language","$CurrentPage"],
+ ["punctuation.operator","."],
+ ["identifier","Parameters"],
+ ["punctuation.operator","."],
+ ["identifier","id"],
+ ["punctuation.operator",","],
+ ["text"," "],
+ ["paren.lparen","["],
+ ["identifier","retURL"],
+ ["keyword.operator","="],
+ ["string.start","'"],
+ ["string","/001"],
+ ["string.end","'"],
+ ["paren.rparen","]"],
+ ["punctuation.operator",","],
+ ["text"," "],
+ ["constant.language","TRUE"],
+ ["keyword.operator",")"]
+],[
+ "start",
+ ["keyword.operator",")"],
+ ["keyword.end","}"],
+ ["string.attribute-value.xml","\""],
+ ["text.tag-whitespace.xml"," "],
+ ["entity.other.attribute-name.xml","standardController"],
+ ["keyword.operator.attribute-equals.xml","="],
+ ["string.attribute-value.xml","\"Account\""],
+ ["meta.tag.punctuation.tag-close.xml",">"],
+ ["meta.tag.punctuation.end-tag-open.xml",""],
+ ["meta.tag.tag-name.xml","apex:page"],
+ ["meta.tag.punctuation.tag-close.xml",">"]
+],[
+ "start"
+],[
+ "tag_stuff",
+ ["meta.tag.punctuation.tag-open.xml","<"],
+ ["meta.tag.tag-name.xml","apex:commandLink"],
+ ["text.tag-whitespace.xml"," "],
+ ["entity.other.attribute-name.xml","action"],
+ ["keyword.operator.attribute-equals.xml","="],
+ ["string.attribute-value.xml","\""],
+ ["keyword.start","{!"],
+ ["support.function","URLFOR"],
+ ["keyword.operator","("],
+ ["string.start","'"],
+ ["string","/apex/"],
+ ["string.end","'"],
+ ["text"," "],
+ ["keyword.operator","+"],
+ ["text"," "],
+ ["variable.language","$CurrentPage"],
+ ["punctuation.operator","."],
+ ["identifier","Name"],
+ ["punctuation.operator",","],
+ ["text"," "],
+ ["constant.language","null"],
+ ["punctuation.operator",","],
+ ["text"," "],
+ ["paren.lparen","["],
+ ["string.start","'"],
+ ["string","id"],
+ ["string.end","'"],
+ ["keyword.operator","="],
+ ["identifier","id"],
+ ["paren.rparen","]"],
+ ["keyword.operator",")"],
+ ["keyword.end","}"],
+ ["string.attribute-value.xml","\""],
+ ["text.tag-whitespace.xml"," "]
+],[
+ "start",
+ ["text.tag-whitespace.xml"," "],
+ ["entity.other.attribute-name.xml","value"],
+ ["keyword.operator.attribute-equals.xml","="],
+ ["string.attribute-value.xml","\"Full List\""],
+ ["text.tag-whitespace.xml"," "],
+ ["meta.tag.punctuation.tag-close.xml","/>"]
+],[
+ "start",
+ ["meta.tag.punctuation.tag-open.xml","<"],
+ ["meta.tag.tag-name.xml","ideas:listOutputLink"],
+ ["text.tag-whitespace.xml"," "],
+ ["entity.other.attribute-name.xml","stickyAttributes"],
+ ["keyword.operator.attribute-equals.xml","="],
+ ["string.attribute-value.xml","\"false\""],
+ ["meta.tag.punctuation.tag-close.xml",">"]
+],[
+ "start",
+ ["text.xml"," "]
+],[
+ "start",
+ ["meta.tag.punctuation.end-tag-open.xml",""],
+ ["meta.tag.tag-name.xml","ideas:listOutputLink"],
+ ["meta.tag.punctuation.tag-close.xml",">"]
+],[
+ "start",
+ ["keyword.start","{!"],
+ ["support.function","IF"],
+ ["keyword.operator","("],
+ ["support.function","AND"],
+ ["keyword.operator","("],
+ ["identifier","Price"],
+ ["text"," "],
+ ["keyword.operator","<"],
+ ["text"," 1"],
+ ["punctuation.operator",","],
+ ["text"," "],
+ ["identifier","Quantity"],
+ ["text"," "],
+ ["keyword.operator","<"],
+ ["text"," 1"],
+ ["keyword.operator",")"],
+ ["punctuation.operator",","],
+ ["text"," "],
+ ["string.start","\""],
+ ["string","Small"],
+ ["string.end","\""],
+ ["punctuation.operator",","],
+ ["text"," "],
+ ["constant.language","null"],
+ ["keyword.operator",")"],
+ ["keyword.end","}"]
+]]
\ No newline at end of file
diff --git a/lib/ace/mode/nginx_highlight_rules.js b/lib/ace/mode/nginx_highlight_rules.js
new file mode 100644
index 00000000000..b93d953d527
--- /dev/null
+++ b/lib/ace/mode/nginx_highlight_rules.js
@@ -0,0 +1,154 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Ajax.org B.V. nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function (require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+var NginxHighlightRules = function () {
+ var keywords = "include|index|absolute_redirect|aio|output_buffers|directio|sendfile|aio_write|alias|root|chunked_transfer_encoding|client_body_buffer_size|client_body_in_file_only|client_body_in_single_buffer|client_body_temp_path|client_body_timeout|client_header_buffer_size|client_header_timeout|client_max_body_size|connection_pool_size|default_type|disable_symlinks|directio_alignment|error_page|etag|if_modified_since|ignore_invalid_headers|internal|keepalive_requests|keepalive_disable|keepalive_timeout|limit_except|large_client_header_buffers|limit_rate|limit_rate_after|lingering_close|lingering_time|lingering_timeout|listen|log_not_found|log_subrequest|max_ranges|merge_slashes|msie_padding|msie_refresh|open_file_cache|open_file_cache_errors|open_file_cache_min_uses|open_file_cache_valid|output_buffers|port_in_redirect|postpone_output|read_ahead|recursive_error_pages|request_pool_size|reset_timedout_connection|resolver|resolver_timeout|satisfy|send_lowat|send_timeout|sendfile|sendfile_max_chunk|server_name|server_name_in_redirect|server_names_hash_bucket_size|server_names_hash_max_size|server_tokens|subrequest_output_buffer_size|tcp_nodelay|tcp_nopush|try_files|types|types_hash_bucket_size|types_hash_max_size|underscores_in_headers|variables_hash_bucket_size|variables_hash_max_size|accept_mutex|accept_mutex_delay|debug_connection|error_log|daemon|debug_points|env|load_module|lock_file|master_process|multi_accept|pcre_jit|pid|ssl_engine|thread_pool|timer_resolution|use|user|worker_aio_requests|worker_connections|worker_cpu_affinity|worker_priority|worker_processes|worker_rlimit_core|worker_rlimit_nofile|worker_shutdown_timeout|working_directory|allow|deny|add_before_body|add_after_body|addition_types|api|status_zone|auth_basic|auth_basic_user_file|auth_jwt|auth_jwt|auth_jwt_claim_set|auth_jwt_header_set|auth_jwt_key_file|auth_jwt_key_request|auth_jwt_leeway|auth_request|auth_request_set|autoindex|autoindex_exact_size|autoindex_format|autoindex_localtime|ancient_browser|ancient_browser_value|modern_browser|modern_browser_value|charset|charset_map|charset_types|override_charset|source_charset|create_full_put_path|dav_access|dav_methods|min_delete_depth|empty_gif|f4f|f4f_buffer_size|fastcgi_bind|fastcgi_buffer_size|fastcgi_buffering|fastcgi_buffers|fastcgi_busy_buffers_size|fastcgi_cache|fastcgi_cache_background_update|fastcgi_cache_bypass|fastcgi_cache_key|fastcgi_cache_lock|fastcgi_cache_lock_age|fastcgi_cache_lock_timeout|fastcgi_cache_max_range_offset|fastcgi_cache_methods|fastcgi_cache_min_uses|fastcgi_cache_min_uses|fastcgi_cache_path|fastcgi_cache_purge|fastcgi_cache_revalidate|fastcgi_cache_use_stale|fastcgi_cache_valid|fastcgi_catch_stderr|fastcgi_connect_timeout|fastcgi_force_ranges|fastcgi_hide_header|fastcgi_ignore_client_abort|fastcgi_ignore_headers|fastcgi_index|fastcgi_intercept_errors|fastcgi_keep_conn|fastcgi_limit_rate|fastcgi_max_temp_file_size|fastcgi_next_upstream|fastcgi_next_upstream_timeout|fastcgi_next_upstream_tries|fastcgi_no_cache|fastcgi_param|fastcgi_pass|fastcgi_pass_header|fastcgi_pass_request_body|fastcgi_pass_request_headers|fastcgi_read_timeout|fastcgi_request_buffering|fastcgi_send_lowat|fastcgi_send_timeout|fastcgi_socket_keepalive|fastcgi_split_path_info|fastcgi_store|fastcgi_store_access|fastcgi_temp_file_write_size|fastcgi_temp_path|flv|geoip_country|geoip_city|geoip_org|geoip_proxy|geoip_proxy_recursive|grpc_bind|grpc_buffer_size|grpc_connect_timeout|grpc_hide_header|grpc_ignore_headers|grpc_intercept_errors|grpc_next_upstream|grpc_next_upstream_timeout|grpc_next_upstream_tries|grpc_pass|grpc_pass_header|grpc_read_timeout|grpc_send_timeout|grpc_set_header|grpc_socket_keepalive|grpc_ssl_certificate|grpc_ssl_certificate_key|grpc_ssl_ciphers|grpc_ssl_crl|grpc_ssl_name|grpc_ssl_password_file|grpc_ssl_protocols|grpc_ssl_server_name|grpc_ssl_session_reuse|grpc_ssl_trusted_certificate|grpc_ssl_verify|grpc_ssl_verify_depth|gunzip|gunzip_buffers|gzip|gzip_buffers|gzip_comp_level|gzip_disable|gzip_http_version|gzip_min_length|gzip_proxied|gzip_types|gzip_vary|gzip_static|add_header|add_trailer|expires|hlshls_buffers|hls_forward_args|hls_fragment|hls_mp4_buffer_size|hls_mp4_max_buffer_size|image_filter|image_filter_buffer|image_filter_interlace|image_filter_jpeg_quality|image_filter_sharpen|image_filter_transparency|image_filter_webp_quality|js_content|js_include|js_set|keyval|keyval_zone|limit_conn|limit_conn_log_level|limit_conn_status|limit_conn_zone|limit_zone|limit_req|limit_req_log_level|limit_req_status|limit_req_zone|access_log|log_format|open_log_file_cache|map_hash_bucket_size|map_hash_max_size|memcached_bind|memcached_buffer_size|memcached_connect_timeout|memcached_force_ranges|memcached_gzip_flag|memcached_next_upstream|memcached_next_upstream_timeout|memcached_next_upstream_tries|memcached_pass|memcached_read_timeout|memcached_send_timeout|memcached_socket_keepalive|mirror|mirror_request_body|mp4|mp4_buffer_size|mp4_max_buffer_size|mp4_limit_rate|mp4_limit_rate_after|perl_modules|perl_require|perl_set|proxy_bind|proxy_buffer_size|proxy_buffering|proxy_buffers|proxy_busy_buffers_size|proxy_cache|proxy_cache_background_update|proxy_cache_bypass|proxy_cache_convert_head|proxy_cache_key|proxy_cache_lock|proxy_cache_lock_age|proxy_cache_lock_timeout|proxy_cache_max_range_offset|proxy_cache_methods|proxy_cache_min_uses|proxy_cache_path|proxy_cache_purge|proxy_cache_revalidate|proxy_cache_use_stale|proxy_cache_valid|proxy_connect_timeout|proxy_cookie_domain|proxy_cookie_path|proxy_force_ranges|proxy_headers_hash_bucket_size|proxy_headers_hash_max_size|proxy_hide_header|proxy_http_version|proxy_ignore_client_abort|proxy_ignore_headers|proxy_intercept_errors|proxy_limit_rate|proxy_max_temp_file_size|proxy_method|proxy_next_upstream|proxy_next_upstream_timeout|proxy_next_upstream_tries|proxy_no_cache|proxy_pass|proxy_pass_header|proxy_pass_request_body|proxy_pass_request_headers|proxy_read_timeout|proxy_redirect|proxy_send_lowat|proxy_send_timeout|proxy_set_body|proxy_set_header|proxy_socket_keepalive|proxy_ssl_certificate|proxy_ssl_certificate_key|proxy_ssl_ciphers|proxy_ssl_crl|proxy_ssl_name|proxy_ssl_password_file|proxy_ssl_protocols|proxy_ssl_server_name|proxy_ssl_session_reuse|proxy_ssl_trusted_certificate|proxy_ssl_verify|proxy_ssl_verify_depth|proxy_store|proxy_store_access|proxy_temp_file_write_size|proxy_temp_path|random_index|set_real_ip_from|real_ip_header|real_ip_recursive|referer_hash_bucket_size|referer_hash_max_size|valid_referers|break|return|rewrite_log|set|uninitialized_variable_warn|scgi_bind|scgi_buffer_size|scgi_buffering|scgi_buffers|scgi_busy_buffers_size|scgi_cache|scgi_cache_background_update|scgi_cache_key|scgi_cache_lock|scgi_cache_lock_age|scgi_cache_lock_timeout|scgi_cache_max_range_offset|scgi_cache_methods|scgi_cache_min_uses|scgi_cache_path|scgi_cache_purge|scgi_cache_revalidate|scgi_cache_use_stale|scgi_cache_valid|scgi_connect_timeout|scgi_force_ranges|scgi_hide_header|scgi_ignore_client_abort|scgi_ignore_headers|scgi_intercept_errors|scgi_limit_rate|scgi_max_temp_file_size|scgi_next_upstream|scgi_next_upstream_timeout|scgi_next_upstream_tries|scgi_no_cache|scgi_param|scgi_pass|scgi_pass_header|scgi_pass_request_body|scgi_pass_request_headers|scgi_read_timeout|scgi_request_buffering|scgi_send_timeout|scgi_socket_keepalive|scgi_store|scgi_store_access|scgi_temp_file_write_size|scgi_temp_path|secure_link|secure_link_md5|secure_link_secret|session_log|session_log_format|session_log_zone|slice|spdy_chunk_size|spdy_headers_comp|ssi|ssi_last_modified|ssi_min_file_chunk|ssi_silent_errors|ssi_types|ssi_value_length|ssl|ssl_buffer_size|ssl_certificate|ssl_certificate_key|ssl_ciphers|ssl_client_certificate|ssl_crl|ssl_dhparam|ssl_early_data|ssl_ecdh_curve|ssl_password_file|ssl_prefer_server_ciphers|ssl_protocols|ssl_session_cache|ssl_session_ticket_key|ssl_session_tickets|ssl_session_timeout|ssl_stapling|ssl_stapling_file|ssl_stapling_responder|ssl_stapling_verify|ssl_trusted_certificate|ssl_verify_client|ssl_verify_depth|status|status_format|status_zone|stub_status|sub_filter|sub_filter_last_modified|sub_filter_once|sub_filter_types|server|zone|state|hash|ip_hash|keepalive|keepalive_requests|keepalive_timeout|ntlm|least_conn|least_time|queue|random|sticky|sticky_cookie_insert|upstream_conf|health_check|userid|userid_domain|userid_expires|userid_mark|userid_name|userid_p3p|userid_path|userid_service|uwsgi_bind|uwsgi_buffer_size|uwsgi_buffering|uwsgi_buffers|uwsgi_busy_buffers_size|uwsgi_cache|uwsgi_cache_background_update|uwsgi_cache_bypass|uwsgi_cache_key|uwsgi_cache_lock|uwsgi_cache_lock_age|uwsgi_cache_lock_timeout|uwsgi_cache_max_range_offset|uwsgi_cache_methods|uwsgi_cache_min_uses|uwsgi_cache_path|uwsgi_cache_purge|uwsgi_cache_revalidate|uwsgi_cache_use_stale|uwsgi_cache_valid|uwsgi_connect_timeout|uwsgi_force_ranges|uwsgi_hide_header|uwsgi_ignore_client_abort|uwsgi_ignore_headers|uwsgi_intercept_errors|uwsgi_limit_rate|uwsgi_max_temp_file_size|uwsgi_modifier1|uwsgi_modifier2|uwsgi_next_upstream|uwsgi_next_upstream_timeout|uwsgi_next_upstream_tries|uwsgi_no_cache|uwsgi_param|uwsgi_pass|uwsgi_pass_header|uwsgi_pass_request_body|uwsgi_pass_request_headers|uwsgi_read_timeout|uwsgi_request_buffering|uwsgi_send_timeout|uwsgi_socket_keepalive|uwsgi_ssl_certificate|uwsgi_ssl_certificate_key|uwsgi_ssl_ciphers|uwsgi_ssl_crl|uwsgi_ssl_name|uwsgi_ssl_password_file|uwsgi_ssl_protocols|uwsgi_ssl_server_name|uwsgi_ssl_session_reuse|uwsgi_ssl_trusted_certificate|uwsgi_ssl_verify|uwsgi_ssl_verify_depth|uwsgi_store|uwsgi_store_access|uwsgi_temp_file_write_size|uwsgi_temp_path|http2_body_preread_size|http2_chunk_size|http2_idle_timeout|http2_max_concurrent_pushes|http2_max_concurrent_streams|http2_max_field_size|http2_max_header_size|http2_max_requests|http2_push|http2_push_preload|http2_recv_buffer_size|http2_recv_timeout|xml_entities|xslt_last_modified|xslt_param|xslt_string_param|xslt_stylesheet|xslt_types|listen|protocol|resolver|resolver_timeout|timeout|auth_http|auth_http_header|auth_http_pass_client_cert|auth_http_timeout|proxy_buffer|proxy_pass_error_message|proxy_timeout|xclient|starttls|imap_auth|imap_capabilities|imap_client_buffer|pop3_auth|pop3_capabilities|smtp_auth|smtp_capabilities|smtp_client_buffer|smtp_greeting_delay|preread_buffer_size|preread_timeout|proxy_protocol_timeout|js_access|js_filter|js_preread|proxy_download_rate|proxy_requests|proxy_responses|proxy_upload_rate|ssl_handshake_timeout|ssl_preread|health_check_timeout|zone_sync|zone_sync_buffers|zone_sync_connect_retry_interval|zone_sync_connect_timeout|zone_sync_interval|zone_sync_recv_buffer_size|zone_sync_server|zone_sync_ssl|zone_sync_ssl_certificate|zone_sync_ssl_certificate_key|zone_sync_ssl_ciphers|zone_sync_ssl_crl|zone_sync_ssl_name|zone_sync_ssl_password_file|zone_sync_ssl_protocols|zone_sync_ssl_server_name|zone_sync_ssl_trusted_certificate|zone_sync_ssl_verify_depth|zone_sync_timeout|google_perftools_profiles|proxy|perl";
+
+ this.$rules = {
+ "start": [{
+ token: ["storage.type", "text", "string.regexp", "paren.lpar"],
+ regex: "\\b(location)(\\s+)([\\^]?~[\\*]?\\s+.*?)({)"
+ }, {
+ token: ["storage.type", "text", "text", "paren.lpar"],
+ regex: "\\b(location|match|upstream)(\\s+)(.*?)({)"
+ }, {
+ token: ["storage.type", "text", "string", "text", "variable", "text", "paren.lpar"],
+ regex: '\\b(split_clients|map)(\\s+)(\\".*\\")(\\s+)(\\$[\\w_]+)(\\s*)({)'
+ }, {
+ token: ["storage.type", "text", "paren.lpar"],
+ regex: "\\b(http|events|server|mail|stream)(\\s*)({)"
+ }, {
+ token: ["storage.type", "text", "variable", "text", "variable", "text", "paren.lpar"],
+ regex: '\\b(geo|map)(\\s+)(\\$[\\w_]+)?(\\s*)(\\$[\\w_]+)(\\s*)({)'
+ }, {
+ token: "paren.rpar",
+ regex: "(})"
+ }, {
+ token: "paren.lpar",
+ regex: "({)"
+ }, {
+ token: ["storage.type", "text", "paren.lpar"],
+ regex: "\\b(if)(\\s+)(\\()",
+ push: [{
+ token: "paren.rpar",
+ regex: "\\)|$",
+ next: "pop"
+ }, {
+ include: "lexical"
+ }]
+ }, {
+ token: "keyword",
+ regex: "\\b(" + keywords + ")\\b",
+ push: [{
+ token: "punctuation",
+ regex: ";",
+ next: "pop"
+ }, {
+ include: "lexical"
+ }]
+ }, {
+ token: ["keyword", "text", "string.regexp", "text", "punctuation"],
+ regex: "\\b(rewrite)(\\s)(\\S*)(\\s.*)(;)"
+ }, {
+ include: "lexical"
+ }, {
+ include: "comments"
+ }],
+ comments: [{
+ token: "comment",
+ regex: '#.*$'
+ }],
+ lexical: [{
+ token: "string",
+ regex: "'",
+ push: [{
+ token: "string",
+ regex: "'",
+ next: "pop"
+ }, {
+ include: "variables"
+ }, {
+ defaultToken: "string"
+ }]
+ }, {
+ token: "string",
+ regex: '"',
+ push: [{
+ token: "string",
+ regex: '"',
+ next: "pop"
+ }, {
+ include: "variables"
+ }, {
+ defaultToken: "string"
+ }]
+ }, {
+ token: "string.regexp",
+ regex: /[!]?[~][*]?\s+.*(?=\))/
+ }, {
+ token: "string.regexp",
+ regex: /[\^]\S*(?=;$)/
+ }, {
+ token: "string.regexp",
+ regex: /[\^]\S*(?=;|\s|$)/
+ }, {
+ token: "keyword.operator",
+ regex: "\\B(\\+|\\-|\\*|\\=|!=)\\B"
+ }, {
+ token: "constant.language",
+ regex: "\\b(true|false|on|off|all|any|main|always)\\b"
+ }, {
+ token: "text",
+ regex: "\\s+"
+ }, {
+ include: "variables"
+ }
+ ],
+ variables: [{
+ token: "variable",
+ regex: "\\$[\\w_]+"
+ }, {
+ token: "variable.language",
+ regex: "\\b(GET|POST|HEAD)\\b"
+ }]
+ };
+ this.normalizeRules();
+};
+
+
+oop.inherits(NginxHighlightRules, TextHighlightRules);
+
+exports.NginxHighlightRules = NginxHighlightRules;
+});
From 9c02b5a450251c0a1f5b7ad8df78ec0c531b39d5 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Mon, 18 Mar 2019 23:51:39 +0400
Subject: [PATCH 0139/1293] add crystal mode
---
demo/kitchen-sink/docs/crystal.cr | 33 ++
lib/ace/ext/modelist.js | 1 +
lib/ace/mode/crystal.js | 100 +++++
lib/ace/mode/crystal_highlight_rules.js | 469 ++++++++++++++++++++++++
4 files changed, 603 insertions(+)
create mode 100644 demo/kitchen-sink/docs/crystal.cr
create mode 100644 lib/ace/mode/crystal.js
create mode 100644 lib/ace/mode/crystal_highlight_rules.js
diff --git a/demo/kitchen-sink/docs/crystal.cr b/demo/kitchen-sink/docs/crystal.cr
new file mode 100644
index 00000000000..fe27502adce
--- /dev/null
+++ b/demo/kitchen-sink/docs/crystal.cr
@@ -0,0 +1,33 @@
+# crystal comment
+
+require "llvm"
+
+NUM_CELLS = 30000
+CELL_SIZE_IN_BYTES = 1
+
+abstract class Instruction
+ abstract def compile(program, bb)
+end
+
+class Increment < Instruction
+ def initialize(@amount : Int32)
+ end
+
+ def compile(program, bb)
+ cell_val_is_zero = builder.icmp LLVM::IntPredicate::EQ, cell_val, zero
+ call_args = [@ctx.int32.const_int(NUM_CELLS), @ctx.int32.const_int(CELL_SIZE_IN_BYTES)]
+ builder.cond cell_val_is_zero, loop_after, loop_body_block
+
+ @body.each do |instruction|
+ loop_body_block = instruction.compile(program, loop_body_block)
+ end
+
+ builder.position_at_end loop_body_block
+
+ unless matching_close_index
+ error "Unmatched '[' at position #{i}"
+ end
+
+ bb
+ end
+end
diff --git a/lib/ace/ext/modelist.js b/lib/ace/ext/modelist.js
index 7fbb9140d7b..858652080ac 100644
--- a/lib/ace/ext/modelist.js
+++ b/lib/ace/ext/modelist.js
@@ -57,6 +57,7 @@ var supportedModes = {
Bro: ["bro"],
C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"],
C9Search: ["c9search_results"],
+ Crystal: ["cr"],
Cirru: ["cirru|cr"],
Clojure: ["clj|cljs"],
Cobol: ["CBL|COB"],
diff --git a/lib/ace/mode/crystal.js b/lib/ace/mode/crystal.js
new file mode 100644
index 00000000000..4b08dc6eece
--- /dev/null
+++ b/lib/ace/mode/crystal.js
@@ -0,0 +1,100 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Ajax.org B.V. nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var CrystalHighlightRules = require("./crystal_highlight_rules").CrystalHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var Range = require("../range").Range;
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
+var FoldMode = require("./folding/coffee").FoldMode;
+
+var Mode = function() {
+ this.HighlightRules = CrystalHighlightRules;
+ this.$outdent = new MatchingBraceOutdent();
+ this.$behaviour = new CstyleBehaviour();
+ this.foldingRules = new FoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+
+ this.lineCommentStart = "#";
+
+ this.getNextLineIndent = function(state, line, tab) {
+ var indent = this.$getIndent(line);
+
+ var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+ var tokens = tokenizedLine.tokens;
+
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
+ return indent;
+ }
+
+ if (state == "start") {
+ var match = line.match(/^.*[\{\(\[]\s*$/);
+ var startingClassOrMethod = line.match(/^\s*(class|def|module)\s.*$/);
+ var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/);
+ var startingConditional = line.match(/^\s*(if|else|when)\s*/);
+ if (match || startingClassOrMethod || startingDoBlock || startingConditional) {
+ indent += tab;
+ }
+ }
+
+ return indent;
+ };
+
+ this.checkOutdent = function(state, line, input) {
+ return /^\s+(end|else)$/.test(line + input) || this.$outdent.checkOutdent(line, input);
+ };
+
+ this.autoOutdent = function(state, session, row) {
+ var line = session.getLine(row);
+ if (/}/.test(line))
+ return this.$outdent.autoOutdent(session, row);
+ var indent = this.$getIndent(line);
+ var prevLine = session.getLine(row - 1);
+ var prevIndent = this.$getIndent(prevLine);
+ var tab = session.getTabString();
+ if (prevIndent.length <= indent.length) {
+ if (indent.slice(-tab.length) == tab)
+ session.remove(new Range(row, indent.length-tab.length, row, indent.length));
+ }
+ };
+
+ this.$id = "ace/mode/crystal";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
diff --git a/lib/ace/mode/crystal_highlight_rules.js b/lib/ace/mode/crystal_highlight_rules.js
new file mode 100644
index 00000000000..f754143a20b
--- /dev/null
+++ b/lib/ace/mode/crystal_highlight_rules.js
@@ -0,0 +1,469 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Ajax.org B.V. nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function (require, exports, module) {
+ "use strict";
+
+ var oop = require("../lib/oop");
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+ var CrystalHighlightRules = function () {
+
+ var builtinFunctions = (
+ "puts|initialize|previous_def|typeof|as|pointerof|sizeof|instance_sizeof"
+ );
+
+ var keywords = (
+ "if|end|else|elsif|unless|case|when|break|while|next|until|def|return|class|new|getter|setter|property|lib"
+ + "|fun|do|struct|private|protected|public|module|super|abstract|include|extend|begin|enum|raise|yield|with"
+ + "|alias|rescue|ensure|macro|uninitialized|union|type|require"
+ );
+
+ var buildinConstants = (
+ "true|TRUE|false|FALSE|nil|NIL|__LINE__|__END_LINE__|__FILE__|__DIR__"
+ );
+
+ var builtinVariables = (
+ "$DEBUG|$defout|$FILENAME|$LOAD_PATH|$SAFE|$stdin|$stdout|$stderr|$VERBOSE|" +
+ "root_url|flash|session|cookies|params|request|response|logger|self"
+ );
+
+ var keywordMapper = this.$keywords = this.createKeywordMapper({
+ "keyword": keywords,
+ "constant.language": buildinConstants,
+ "variable.language": builtinVariables,
+ "support.function": builtinFunctions
+ }, "identifier");
+
+ var hexNumber = "(?:0[xX][\\dA-Fa-f]+)";
+ var decNumber = "(?:[0-9][\\d_]*)";
+ var octNumber = "(?:0o[0-7][0-7]*)";
+ var binNumber = "(?:0[bB][01]+)";
+ var intNumber = "(?:[+-]?)(?:" + hexNumber + "|" + decNumber + "|" + octNumber + "|" + binNumber + ")(?:_?[iIuU](?:8|16|32|64))?\\b";
+ var escapeExpression = /\\(?:[nsrtvfbae'"\\]|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4}|u{[\da-fA-F]{1,6}})/;
+ var extEscapeExspresssion = /\\(?:[nsrtvfbae'"\\]|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4}|u{[\da-fA-F]{1,6}}|u{(:?[\da-fA-F]{2}\s)*[\da-fA-F]{2}})/;
+ // regexp must not have capturing parentheses. Use (?:) instead.
+ // regexps are ordered -> the first match is used
+
+ this.$rules = {
+ "start": [
+ {
+ token: "comment",
+ regex: "#.*$"
+ }, {
+ token: "string.regexp",
+ regex: "[/]",
+ push: [{
+ token: "constant.language.escape",
+ regex: extEscapeExspresssion
+ }, {
+ token: "string.regexp",
+ regex: "[/][imx]*(?=[).,;\\s]|$)",
+ next: "pop"
+ }, {
+ defaultToken: "string.regexp"
+ }]
+ },
+ [{
+ regex: "[{}]", onMatch: function (val, state, stack) {
+ this.next = val == "{" ? this.nextState : "";
+ if (val == "{" && stack.length) {
+ stack.unshift("start", state);
+ return "paren.lparen";
+ }
+ if (val == "}" && stack.length) {
+ stack.shift();
+ this.next = stack.shift();
+ if (this.next.indexOf("string") != -1)
+ return "paren.end";
+ }
+ return val == "{" ? "paren.lparen" : "paren.rparen";
+ },
+ nextState: "start"
+ }, {
+ token: "string.start",
+ regex: /"/,
+ push: [{
+ token: "constant.language.escape",
+ regex: extEscapeExspresssion
+ }, {
+ token: "string",
+ regex: /\\#{/
+ }, {
+ token: "paren.start",
+ regex: /#{/,
+ push: "start"
+ }, {
+ token: "string.end",
+ regex: /"/,
+ next: "pop"
+ }, {
+ defaultToken: "string"
+ }]
+ }, {
+ token: "string.start",
+ regex: /`/,
+ push: [{
+ token: "constant.language.escape",
+ regex: extEscapeExspresssion
+ }, {
+ token: "string",
+ regex: /\\#{/
+ }, {
+ token: "paren.start",
+ regex: /#{/,
+ push: "start"
+ }, {
+ token: "string.end",
+ regex: /`/,
+ next: "pop"
+ }, {
+ defaultToken: "string"
+ }]
+ }, {
+ stateName: "rpstring",
+ token: "string.start",
+ regex: /%[Qx]?\(/,
+ push: [{
+ token: "constant.language.escape",
+ regex: extEscapeExspresssion
+ }, {
+ token: "string.start",
+ regex: /\(/,
+ push: "rpstring"
+ }, {
+ token: "string.end",
+ regex: /\)/,
+ next: "pop"
+ }, {
+ token: "paren.start",
+ regex: /#{/,
+ push: "start"
+ }, {
+ defaultToken: "string"
+ }]
+ }, {
+ stateName: "spstring",
+ token: "string.start",
+ regex: /%[Qx]?\[/,
+ push: [{
+ token: "constant.language.escape",
+ regex: extEscapeExspresssion
+ }, {
+ token: "string.start",
+ regex: /\[/,
+ push: "spstring"
+ }, {
+ token: "string.end",
+ regex: /]/,
+ next: "pop"
+ }, {
+ token: "paren.start",
+ regex: /#{/,
+ push: "start"
+ }, {
+ defaultToken: "string"
+ }]
+ }, {
+ stateName: "fpstring",
+ token: "string.start",
+ regex: /%[Qx]?{/,
+ push: [{
+ token: "constant.language.escape",
+ regex: extEscapeExspresssion
+ }, {
+ token: "string.start",
+ regex: /{/,
+ push: "fpstring"
+ }, {
+ token: "string.end",
+ regex: /}/,
+ next: "pop"
+ }, {
+ token: "paren.start",
+ regex: /#{/,
+ push: "start"
+ }, {
+ defaultToken: "string"
+ }]
+ }, {
+ stateName: "tpstring",
+ token: "string.start",
+ regex: /%[Qx]?,
+ push: [{
+ token: "constant.language.escape",
+ regex: extEscapeExspresssion
+ }, {
+ token: "string.start",
+ regex: /,
+ push: "tpstring"
+ }, {
+ token: "string.end",
+ regex: />/,
+ next: "pop"
+ }, {
+ token: "paren.start",
+ regex: /#{/,
+ push: "start"
+ }, {
+ defaultToken: "string"
+ }]
+ }, {
+ stateName: "ppstring",
+ token: "string.start",
+ regex: /%[Qx]?\|/,
+ push: [{
+ token: "constant.language.escape",
+ regex: extEscapeExspresssion
+ }, {
+ token: "string.end",
+ regex: /\|/,
+ next: "pop"
+ }, {
+ token: "paren.start",
+ regex: /#{/,
+ push: "start"
+ }, {
+ defaultToken: "string"
+ }]
+ }, {
+ stateName: "rpqstring",
+ token: "string.start",
+ regex: /%[qwir]\(/,
+ push: [{
+ token: "string.start",
+ regex: /\(/,
+ push: "rpqstring"
+ }, {
+ token: "string.end",
+ regex: /\)/,
+ next: "pop"
+ }, {
+ defaultToken: "string"
+ }]
+ }, {
+ stateName: "spqstring",
+ token: "string.start",
+ regex: /%[qwir]\[/,
+ push: [{
+ token: "string.start",
+ regex: /\[/,
+ push: "spqstring"
+ }, {
+ token: "string.end",
+ regex: /]/,
+ next: "pop"
+ }, {
+ defaultToken: "string"
+ }]
+ }, {
+ stateName: "fpqstring",
+ token: "string.start",
+ regex: /%[qwir]{/,
+ push: [{
+ token: "string.start",
+ regex: /{/,
+ push: "fpqstring"
+ }, {
+ token: "string.end",
+ regex: /}/,
+ next: "pop"
+ }, {
+ defaultToken: "string"
+ }]
+ }, {
+ stateName: "tpqstring",
+ token: "string.start",
+ regex: /%[qwir],
+ push: [{
+ token: "string.start",
+ regex: /,
+ push: "tpqstring"
+ }, {
+ token: "string.end",
+ regex: />/,
+ next: "pop"
+ }, {
+ defaultToken: "string"
+ }]
+ }, {
+ stateName: "ppqstring",
+ token: "string.start",
+ regex: /%[qwir]\|/,
+ push: [{
+ token: "string.end",
+ regex: /\|/,
+ next: "pop"
+ }, {
+ defaultToken: "string"
+ }]
+ }, {
+ token: "string.start",
+ regex: /'/,
+ push: [{
+ token: "constant.language.escape",
+ regex: escapeExpression
+ }, {
+ token: "string.end",
+ regex: /'|$/,
+ next: "pop"
+ }, {
+ defaultToken: "string"
+ }]
+ }], {
+ token: "text", // namespaces aren't symbols
+ regex: "::"
+ }, {
+ token: "variable.instance", // instance variable
+ regex: "@{1,2}[a-zA-Z_\\d]+"
+ }, {
+ token: "variable.fresh", // fresh variable
+ regex: "%[a-zA-Z_\\d]+"
+ }, {
+ token: "support.class", // class name
+ regex: "[A-Z][a-zA-Z_\\d]+"
+ }, {
+ token: "constant.other.symbol", // symbol
+ regex: "[:](?:(?:===|<=>|\\[]\\?|\\[]=|\\[]|>>|\\*\\*|<<|==|!=|>=|<=|!~|=~|<|\\+|-|\\*|\\/|%|&|\\||\\^|>|!|~)|(?:(?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?))"
+ }, {
+ token: "constant.numeric", // float
+ regex: "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?(?:_?[fF](?:32|64))?\\b"
+ }, {
+ token: "constant.numeric",
+ regex: intNumber
+ }, {
+ token: "constant.other.symbol",
+ regex: ':"',
+ push: [{
+ token: "constant.language.escape",
+ regex: extEscapeExspresssion
+ }, {
+ token: "constant.other.symbol",
+ regex: '"',
+ next: "pop"
+ }, {
+ defaultToken: "constant.other.symbol"
+ }]
+ }, {
+ token: "constant.language.boolean",
+ regex: "(?:true|false)\\b"
+ }, {
+ token: "support.function",
+ regex: "(?:is_a\\?|nil\\?|responds_to\\?|as\\?)"
+ }, {
+ token: keywordMapper,
+ regex: "[a-zA-Z_$][a-zA-Z0-9_$!?]*\\b"
+ }, {
+ token: "variable.system",
+ regex: "\\$\\!|\\$\\?"
+ }, {
+ token: "punctuation.separator.key-value",
+ regex: "=>"
+ }, {
+ stateName: "heredoc",
+ onMatch: function (value, currentState, stack) {
+ var next = "heredoc";
+ var tokens = value.split(this.splitRegex);
+ stack.push(next, tokens[3]);
+ return [
+ {type: "constant", value: tokens[1]},
+ {type: "string", value: tokens[2]},
+ {type: "support.class", value: tokens[3]},
+ {type: "string", value: tokens[4]}
+ ];
+ },
+ regex: "(<<-)([']?)([\\w]+)([']?)",
+ rules: {
+ heredoc: [{
+ token: "string",
+ regex: "^ +"
+ }, {
+ onMatch: function (value, currentState, stack) {
+ if (value === stack[1]) {
+ stack.shift();
+ stack.shift();
+ this.next = stack[0] || "start";
+ return "support.class";
+ }
+ this.next = "";
+ return "string";
+ },
+ regex: ".*$",
+ next: "start"
+ }]
+ }
+ }, {
+ regex: "$",
+ token: "empty",
+ next: function (currentState, stack) {
+ if (stack[0] === "heredoc")
+ return stack[0];
+ return currentState;
+ }
+ }, {
+ token: "punctuation.operator",
+ regex: /[.]\s*(?![.])/,
+ push: [{
+ token : "punctuation.operator",
+ regex : /[.]\s*(?![.])/
+ }, {
+ token : "support.function",
+ regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+ }, {
+ regex: "",
+ token: "empty",
+ next: "pop"
+ }]
+ }, {
+ token: "keyword.operator",
+ regex: "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|\\?|\\:|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\^|\\|"
+ }, {
+ token: "punctuation.operator",
+ regex: /[?:,;.]/
+ }, {
+ token: "paren.lparen",
+ regex: "[[({]"
+ }, {
+ token: "paren.rparen",
+ regex: "[\\])}]"
+ }, {
+ token: "text",
+ regex: "\\s+"
+ }
+ ]
+ };
+
+ this.normalizeRules();
+ };
+
+ oop.inherits(CrystalHighlightRules, TextHighlightRules);
+
+ exports.CrystalHighlightRules = CrystalHighlightRules;
+});
From a4a5af473e13fc28669ce00dceb01d084cbc4467 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Mon, 18 Mar 2019 23:56:38 +0400
Subject: [PATCH 0140/1293] add missing snippet files
---
lib/ace/snippets/apex.js | 7 +++++++
lib/ace/snippets/apex.snippets | 0
lib/ace/snippets/bro.snippets | 0
lib/ace/snippets/crystal.js | 7 +++++++
lib/ace/snippets/crystal.snippets | 0
lib/ace/snippets/csp.snippets | 0
lib/ace/snippets/fortran.js | 7 +++++++
lib/ace/snippets/fortran.snippets | 0
lib/ace/snippets/haskell_cabal.js | 7 +++++++
lib/ace/snippets/haskell_cabal.snippets | 0
lib/ace/snippets/hjson.snippets | 0
lib/ace/snippets/kotlin.snippets | 0
lib/ace/snippets/logtalk.js | 7 +++++++
lib/ace/snippets/logtalk.snippets | 0
lib/ace/snippets/mask.js | 7 +++++++
lib/ace/snippets/mask.snippets | 0
lib/ace/snippets/mixal.js | 7 +++++++
lib/ace/snippets/mixal.snippets | 0
lib/ace/snippets/nginx.js | 7 +++++++
lib/ace/snippets/nginx.snippets | 0
lib/ace/snippets/nim.js | 7 +++++++
lib/ace/snippets/nim.snippets | 0
lib/ace/snippets/nsis.snippets | 0
lib/ace/snippets/perl6.js | 7 +++++++
lib/ace/snippets/perl6.snippets | 0
lib/ace/snippets/pig.js | 7 +++++++
lib/ace/snippets/pig.snippets | 0
lib/ace/snippets/redshift.js | 7 +++++++
lib/ace/snippets/redshift.snippets | 0
lib/ace/snippets/rst.js | 7 +++++++
lib/ace/snippets/sparql.snippets | 0
lib/ace/snippets/swift.js | 7 +++++++
lib/ace/snippets/swift.snippets | 0
lib/ace/snippets/tsx.js | 7 +++++++
lib/ace/snippets/tsx.snippets | 0
lib/ace/snippets/turtle.snippets | 0
lib/ace/snippets/visualforce.js | 7 +++++++
lib/ace/snippets/visualforce.snippets | 0
38 files changed, 112 insertions(+)
create mode 100644 lib/ace/snippets/apex.js
create mode 100644 lib/ace/snippets/apex.snippets
create mode 100644 lib/ace/snippets/bro.snippets
create mode 100644 lib/ace/snippets/crystal.js
create mode 100644 lib/ace/snippets/crystal.snippets
create mode 100644 lib/ace/snippets/csp.snippets
create mode 100644 lib/ace/snippets/fortran.js
create mode 100644 lib/ace/snippets/fortran.snippets
create mode 100644 lib/ace/snippets/haskell_cabal.js
create mode 100644 lib/ace/snippets/haskell_cabal.snippets
create mode 100644 lib/ace/snippets/hjson.snippets
create mode 100644 lib/ace/snippets/kotlin.snippets
create mode 100644 lib/ace/snippets/logtalk.js
create mode 100644 lib/ace/snippets/logtalk.snippets
create mode 100644 lib/ace/snippets/mask.js
create mode 100644 lib/ace/snippets/mask.snippets
create mode 100644 lib/ace/snippets/mixal.js
create mode 100644 lib/ace/snippets/mixal.snippets
create mode 100644 lib/ace/snippets/nginx.js
create mode 100644 lib/ace/snippets/nginx.snippets
create mode 100644 lib/ace/snippets/nim.js
create mode 100644 lib/ace/snippets/nim.snippets
create mode 100644 lib/ace/snippets/nsis.snippets
create mode 100644 lib/ace/snippets/perl6.js
create mode 100644 lib/ace/snippets/perl6.snippets
create mode 100644 lib/ace/snippets/pig.js
create mode 100644 lib/ace/snippets/pig.snippets
create mode 100644 lib/ace/snippets/redshift.js
create mode 100644 lib/ace/snippets/redshift.snippets
create mode 100644 lib/ace/snippets/rst.js
create mode 100644 lib/ace/snippets/sparql.snippets
create mode 100644 lib/ace/snippets/swift.js
create mode 100644 lib/ace/snippets/swift.snippets
create mode 100644 lib/ace/snippets/tsx.js
create mode 100644 lib/ace/snippets/tsx.snippets
create mode 100644 lib/ace/snippets/turtle.snippets
create mode 100644 lib/ace/snippets/visualforce.js
create mode 100644 lib/ace/snippets/visualforce.snippets
diff --git a/lib/ace/snippets/apex.js b/lib/ace/snippets/apex.js
new file mode 100644
index 00000000000..104722134c0
--- /dev/null
+++ b/lib/ace/snippets/apex.js
@@ -0,0 +1,7 @@
+define(function(require, exports, module) {
+"use strict";
+
+exports.snippetText = require("../requirejs/text!./apex.snippets");
+exports.scope = "apex";
+
+});
diff --git a/lib/ace/snippets/apex.snippets b/lib/ace/snippets/apex.snippets
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/lib/ace/snippets/bro.snippets b/lib/ace/snippets/bro.snippets
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/lib/ace/snippets/crystal.js b/lib/ace/snippets/crystal.js
new file mode 100644
index 00000000000..84b4a41a192
--- /dev/null
+++ b/lib/ace/snippets/crystal.js
@@ -0,0 +1,7 @@
+define(function(require, exports, module) {
+"use strict";
+
+exports.snippetText = require("../requirejs/text!./crystal.snippets");
+exports.scope = "crystal";
+
+});
diff --git a/lib/ace/snippets/crystal.snippets b/lib/ace/snippets/crystal.snippets
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/lib/ace/snippets/csp.snippets b/lib/ace/snippets/csp.snippets
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/lib/ace/snippets/fortran.js b/lib/ace/snippets/fortran.js
new file mode 100644
index 00000000000..65d8a0d98dd
--- /dev/null
+++ b/lib/ace/snippets/fortran.js
@@ -0,0 +1,7 @@
+define(function(require, exports, module) {
+"use strict";
+
+exports.snippetText = require("../requirejs/text!./fortran.snippets");
+exports.scope = "fortran";
+
+});
diff --git a/lib/ace/snippets/fortran.snippets b/lib/ace/snippets/fortran.snippets
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/lib/ace/snippets/haskell_cabal.js b/lib/ace/snippets/haskell_cabal.js
new file mode 100644
index 00000000000..0dfda712cfe
--- /dev/null
+++ b/lib/ace/snippets/haskell_cabal.js
@@ -0,0 +1,7 @@
+define(function(require, exports, module) {
+"use strict";
+
+exports.snippetText = require("../requirejs/text!./haskell_cabal.snippets");
+exports.scope = "haskell_cabal";
+
+});
diff --git a/lib/ace/snippets/haskell_cabal.snippets b/lib/ace/snippets/haskell_cabal.snippets
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/lib/ace/snippets/hjson.snippets b/lib/ace/snippets/hjson.snippets
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/lib/ace/snippets/kotlin.snippets b/lib/ace/snippets/kotlin.snippets
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/lib/ace/snippets/logtalk.js b/lib/ace/snippets/logtalk.js
new file mode 100644
index 00000000000..707176896b1
--- /dev/null
+++ b/lib/ace/snippets/logtalk.js
@@ -0,0 +1,7 @@
+define(function(require, exports, module) {
+"use strict";
+
+exports.snippetText = require("../requirejs/text!./logtalk.snippets");
+exports.scope = "logtalk";
+
+});
diff --git a/lib/ace/snippets/logtalk.snippets b/lib/ace/snippets/logtalk.snippets
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/lib/ace/snippets/mask.js b/lib/ace/snippets/mask.js
new file mode 100644
index 00000000000..7fbca678066
--- /dev/null
+++ b/lib/ace/snippets/mask.js
@@ -0,0 +1,7 @@
+define(function(require, exports, module) {
+"use strict";
+
+exports.snippetText = require("../requirejs/text!./mask.snippets");
+exports.scope = "mask";
+
+});
diff --git a/lib/ace/snippets/mask.snippets b/lib/ace/snippets/mask.snippets
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/lib/ace/snippets/mixal.js b/lib/ace/snippets/mixal.js
new file mode 100644
index 00000000000..0acfae2f338
--- /dev/null
+++ b/lib/ace/snippets/mixal.js
@@ -0,0 +1,7 @@
+define(function(require, exports, module) {
+"use strict";
+
+exports.snippetText = require("../requirejs/text!./mixal.snippets");
+exports.scope = "mixal";
+
+});
diff --git a/lib/ace/snippets/mixal.snippets b/lib/ace/snippets/mixal.snippets
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/lib/ace/snippets/nginx.js b/lib/ace/snippets/nginx.js
new file mode 100644
index 00000000000..068115831a4
--- /dev/null
+++ b/lib/ace/snippets/nginx.js
@@ -0,0 +1,7 @@
+define(function(require, exports, module) {
+"use strict";
+
+exports.snippetText = require("../requirejs/text!./nginx.snippets");
+exports.scope = "nginx";
+
+});
diff --git a/lib/ace/snippets/nginx.snippets b/lib/ace/snippets/nginx.snippets
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/lib/ace/snippets/nim.js b/lib/ace/snippets/nim.js
new file mode 100644
index 00000000000..6e6d02bbe48
--- /dev/null
+++ b/lib/ace/snippets/nim.js
@@ -0,0 +1,7 @@
+define(function(require, exports, module) {
+"use strict";
+
+exports.snippetText = require("../requirejs/text!./nim.snippets");
+exports.scope = "nim";
+
+});
diff --git a/lib/ace/snippets/nim.snippets b/lib/ace/snippets/nim.snippets
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/lib/ace/snippets/nsis.snippets b/lib/ace/snippets/nsis.snippets
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/lib/ace/snippets/perl6.js b/lib/ace/snippets/perl6.js
new file mode 100644
index 00000000000..af05b2520bb
--- /dev/null
+++ b/lib/ace/snippets/perl6.js
@@ -0,0 +1,7 @@
+define(function(require, exports, module) {
+"use strict";
+
+exports.snippetText = require("../requirejs/text!./perl6.snippets");
+exports.scope = "perl6";
+
+});
diff --git a/lib/ace/snippets/perl6.snippets b/lib/ace/snippets/perl6.snippets
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/lib/ace/snippets/pig.js b/lib/ace/snippets/pig.js
new file mode 100644
index 00000000000..07d0d777e7b
--- /dev/null
+++ b/lib/ace/snippets/pig.js
@@ -0,0 +1,7 @@
+define(function(require, exports, module) {
+"use strict";
+
+exports.snippetText = require("../requirejs/text!./pig.snippets");
+exports.scope = "pig";
+
+});
diff --git a/lib/ace/snippets/pig.snippets b/lib/ace/snippets/pig.snippets
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/lib/ace/snippets/redshift.js b/lib/ace/snippets/redshift.js
new file mode 100644
index 00000000000..1564301a4cd
--- /dev/null
+++ b/lib/ace/snippets/redshift.js
@@ -0,0 +1,7 @@
+define(function(require, exports, module) {
+"use strict";
+
+exports.snippetText = require("../requirejs/text!./redshift.snippets");
+exports.scope = "redshift";
+
+});
diff --git a/lib/ace/snippets/redshift.snippets b/lib/ace/snippets/redshift.snippets
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/lib/ace/snippets/rst.js b/lib/ace/snippets/rst.js
new file mode 100644
index 00000000000..3e4a67eacb1
--- /dev/null
+++ b/lib/ace/snippets/rst.js
@@ -0,0 +1,7 @@
+define(function(require, exports, module) {
+"use strict";
+
+exports.snippetText = require("../requirejs/text!./rst.snippets");
+exports.scope = "rst";
+
+});
diff --git a/lib/ace/snippets/sparql.snippets b/lib/ace/snippets/sparql.snippets
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/lib/ace/snippets/swift.js b/lib/ace/snippets/swift.js
new file mode 100644
index 00000000000..46e5e1106b4
--- /dev/null
+++ b/lib/ace/snippets/swift.js
@@ -0,0 +1,7 @@
+define(function(require, exports, module) {
+"use strict";
+
+exports.snippetText = require("../requirejs/text!./swift.snippets");
+exports.scope = "swift";
+
+});
diff --git a/lib/ace/snippets/swift.snippets b/lib/ace/snippets/swift.snippets
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/lib/ace/snippets/tsx.js b/lib/ace/snippets/tsx.js
new file mode 100644
index 00000000000..457e33b24e6
--- /dev/null
+++ b/lib/ace/snippets/tsx.js
@@ -0,0 +1,7 @@
+define(function(require, exports, module) {
+"use strict";
+
+exports.snippetText = require("../requirejs/text!./tsx.snippets");
+exports.scope = "tsx";
+
+});
diff --git a/lib/ace/snippets/tsx.snippets b/lib/ace/snippets/tsx.snippets
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/lib/ace/snippets/turtle.snippets b/lib/ace/snippets/turtle.snippets
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/lib/ace/snippets/visualforce.js b/lib/ace/snippets/visualforce.js
new file mode 100644
index 00000000000..2d01c0f5d72
--- /dev/null
+++ b/lib/ace/snippets/visualforce.js
@@ -0,0 +1,7 @@
+define(function(require, exports, module) {
+"use strict";
+
+exports.snippetText = require("../requirejs/text!./visualforce.snippets");
+exports.scope = "visualforce";
+
+});
diff --git a/lib/ace/snippets/visualforce.snippets b/lib/ace/snippets/visualforce.snippets
new file mode 100644
index 00000000000..e69de29bb2d
From 9ec1ecc86e2fe411cfbd207d8928612560af39e3 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Tue, 19 Mar 2019 23:55:39 +0400
Subject: [PATCH 0141/1293] use keywordMapper in pascal mode
---
lib/ace/mode/_test/tokens_pascal.json | 156 +++++++++++------------
lib/ace/mode/pascal_highlight_rules.js | 166 +++++++++++++------------
2 files changed, 163 insertions(+), 159 deletions(-)
diff --git a/lib/ace/mode/_test/tokens_pascal.json b/lib/ace/mode/_test/tokens_pascal.json
index 22c1f0c43e5..50fd5264840 100644
--- a/lib/ace/mode/_test/tokens_pascal.json
+++ b/lib/ace/mode/_test/tokens_pascal.json
@@ -1,20 +1,20 @@
[[
- "punctuation.definition.comment.pascal",
- ["punctuation.definition.comment.pascal","(*"],
- ["comment.block.pascal.one","****************************************************************************"]
+ "punctuation.definition.comment",
+ ["punctuation.definition.comment","(*"],
+ ["comment.block.one","****************************************************************************"]
],[
- "punctuation.definition.comment.pascal",
- ["comment.block.pascal.one"," * A simple bubble sort program. Reads integers, one per line, and prints *"]
+ "punctuation.definition.comment",
+ ["comment.block.one"," * A simple bubble sort program. Reads integers, one per line, and prints *"]
],[
- "punctuation.definition.comment.pascal",
- ["comment.block.pascal.one"," * them out in sorted order. Blows up if there are more than 49. *"]
+ "punctuation.definition.comment",
+ ["comment.block.one"," * them out in sorted order. Blows up if there are more than 49. *"]
],[
"start",
- ["comment.block.pascal.one"," ****************************************************************************"],
- ["punctuation.definition.comment.pascal","*)"]
+ ["comment.block.one"," ****************************************************************************"],
+ ["punctuation.definition.comment","*)"]
],[
"start",
- ["keyword.control.pascal","PROGRAM"],
+ ["keyword.control","PROGRAM"],
["text"," Sort(input"],
["keyword.operator",","],
["text"," output)"],
@@ -22,41 +22,41 @@
],[
"start",
["text"," "],
- ["keyword.control.pascal","CONST"]
+ ["keyword.control","CONST"]
],[
"start",
["text"," "],
- ["punctuation.definition.comment.pascal","(*"],
- ["comment.block.pascal.one"," Max array size. "],
- ["punctuation.definition.comment.pascal","*)"]
+ ["punctuation.definition.comment","(*"],
+ ["comment.block.one"," Max array size. "],
+ ["punctuation.definition.comment","*)"]
],[
"start",
["text"," MaxElts "],
["keyword.operator","="],
["text"," "],
- ["constant.numeric.pascal","50"],
+ ["constant.numeric","50"],
["keyword.operator",";"]
],[
"start",
["text"," "],
- ["keyword.control.pascal","TYPE"],
+ ["keyword.control","TYPE"],
["text"," "]
],[
"start",
["text"," "],
- ["punctuation.definition.comment.pascal","(*"],
- ["comment.block.pascal.one"," Type of the element array. "],
- ["punctuation.definition.comment.pascal","*)"]
+ ["punctuation.definition.comment","(*"],
+ ["comment.block.one"," Type of the element array. "],
+ ["punctuation.definition.comment","*)"]
],[
"start",
["text"," IntArrType "],
["keyword.operator","="],
["text"," "],
- ["keyword.control.pascal","ARRAY"],
+ ["keyword.control","ARRAY"],
["text"," ["],
- ["constant.numeric.pascal","1"],
+ ["constant.numeric","1"],
["text","..MaxElts] "],
- ["keyword.control.pascal","OF"],
+ ["keyword.control","OF"],
["text"," Integer"],
["keyword.operator",";"]
],[
@@ -64,13 +64,13 @@
],[
"start",
["text"," "],
- ["keyword.control.pascal","VAR"]
+ ["keyword.control","VAR"]
],[
"start",
["text"," "],
- ["punctuation.definition.comment.pascal","(*"],
- ["comment.block.pascal.one"," Indexes, exchange temp, array size. "],
- ["punctuation.definition.comment.pascal","*)"]
+ ["punctuation.definition.comment","(*"],
+ ["comment.block.one"," Indexes, exchange temp, array size. "],
+ ["punctuation.definition.comment","*)"]
],[
"start",
["text"," i"],
@@ -86,9 +86,9 @@
],[
"start",
["text"," "],
- ["punctuation.definition.comment.pascal","(*"],
- ["comment.block.pascal.one"," Array of ints "],
- ["punctuation.definition.comment.pascal","*)"]
+ ["punctuation.definition.comment","(*"],
+ ["comment.block.one"," Array of ints "],
+ ["punctuation.definition.comment","*)"]
],[
"start",
["text"," arr: IntArrType"],
@@ -98,45 +98,45 @@
],[
"start",
["text"," "],
- ["punctuation.definition.comment.pascal","(*"],
- ["comment.block.pascal.one"," Read in the integers. "],
- ["punctuation.definition.comment.pascal","*)"]
+ ["punctuation.definition.comment","(*"],
+ ["comment.block.one"," Read in the integers. "],
+ ["punctuation.definition.comment","*)"]
],[
"start",
["text"," "],
- ["variable.pascal","PROCEDURE"],
+ ["variable","PROCEDURE"],
["text"," "],
- ["storage.type.function.pascal","ReadArr"],
+ ["storage.type.function","ReadArr"],
["text","("],
- ["keyword.control.pascal","VAR"],
+ ["keyword.control","VAR"],
["text"," size: Integer"],
["keyword.operator",";"],
["text"," "],
- ["keyword.control.pascal","VAR"],
+ ["keyword.control","VAR"],
["text"," a: IntArrType)"],
["keyword.operator",";"],
["text"," "]
],[
"start",
["text"," "],
- ["keyword.control.pascal","BEGIN"]
+ ["keyword.control","BEGIN"]
],[
"start",
["text"," size "],
["keyword.operator",":="],
["text"," "],
- ["constant.numeric.pascal","1"],
+ ["constant.numeric","1"],
["keyword.operator",";"]
],[
"start",
["text"," "],
- ["keyword.control.pascal","WHILE"],
+ ["keyword.control","WHILE"],
["text"," "],
- ["keyword.control.pascal","NOT"],
+ ["keyword.control","NOT"],
["text"," eof "],
- ["keyword.control.pascal","DO"],
+ ["keyword.control","DO"],
["text"," "],
- ["keyword.control.pascal","BEGIN"]
+ ["keyword.control","BEGIN"]
],[
"start",
["text"," readln(a[size])"],
@@ -144,11 +144,11 @@
],[
"start",
["text"," "],
- ["keyword.control.pascal","IF"],
+ ["keyword.control","IF"],
["text"," "],
- ["keyword.control.pascal","NOT"],
+ ["keyword.control","NOT"],
["text"," eof "],
- ["keyword.control.pascal","THEN"],
+ ["keyword.control","THEN"],
["text"," "]
],[
"start",
@@ -157,28 +157,28 @@
["text"," size "],
["keyword.operator","+"],
["text"," "],
- ["constant.numeric.pascal","1"]
+ ["constant.numeric","1"]
],[
"start",
["text"," "],
- ["keyword.control.pascal","END"]
+ ["keyword.control","END"]
],[
"start",
["text"," "],
- ["keyword.control.pascal","END"],
+ ["keyword.control","END"],
["keyword.operator",";"]
],[
"start"
],[
"start",
["text"," "],
- ["keyword.control.pascal","BEGIN"]
+ ["keyword.control","BEGIN"]
],[
"start",
["text"," "],
- ["punctuation.definition.comment.pascal","(*"],
- ["comment.block.pascal.one"," Read "],
- ["punctuation.definition.comment.pascal","*)"]
+ ["punctuation.definition.comment","(*"],
+ ["comment.block.one"," Read "],
+ ["punctuation.definition.comment","*)"]
],[
"start",
["text"," ReadArr(size"],
@@ -190,48 +190,48 @@
],[
"start",
["text"," "],
- ["punctuation.definition.comment.pascal","(*"],
- ["comment.block.pascal.one"," Sort using bubble sort. "],
- ["punctuation.definition.comment.pascal","*)"]
+ ["punctuation.definition.comment","(*"],
+ ["comment.block.one"," Sort using bubble sort. "],
+ ["punctuation.definition.comment","*)"]
],[
"start",
["text"," "],
- ["keyword.control.pascal","FOR"],
+ ["keyword.control","FOR"],
["text"," i "],
["keyword.operator",":="],
["text"," size "],
["keyword.operator","-"],
["text"," "],
- ["constant.numeric.pascal","1"],
+ ["constant.numeric","1"],
["text"," DOWNTO "],
- ["constant.numeric.pascal","1"],
+ ["constant.numeric","1"],
["text"," "],
- ["keyword.control.pascal","DO"]
+ ["keyword.control","DO"]
],[
"start",
["text"," "],
- ["keyword.control.pascal","FOR"],
+ ["keyword.control","FOR"],
["text"," j "],
["keyword.operator",":="],
["text"," "],
- ["constant.numeric.pascal","1"],
+ ["constant.numeric","1"],
["text"," "],
- ["keyword.control.pascal","TO"],
+ ["keyword.control","TO"],
["text"," i "],
- ["keyword.control.pascal","DO"],
+ ["keyword.control","DO"],
["text"," "]
],[
"start",
["text"," "],
- ["keyword.control.pascal","IF"],
+ ["keyword.control","IF"],
["text"," arr[j] > arr[j "],
["keyword.operator","+"],
["text"," "],
- ["constant.numeric.pascal","1"],
+ ["constant.numeric","1"],
["text","] "],
- ["keyword.control.pascal","THEN"],
+ ["keyword.control","THEN"],
["text"," "],
- ["keyword.control.pascal","BEGIN"]
+ ["keyword.control","BEGIN"]
],[
"start",
["text"," tmp "],
@@ -245,7 +245,7 @@
["text"," arr[j "],
["keyword.operator","+"],
["text"," "],
- ["constant.numeric.pascal","1"],
+ ["constant.numeric","1"],
["text","]"],
["keyword.operator",";"]
],[
@@ -253,7 +253,7 @@
["text"," arr[j "],
["keyword.operator","+"],
["text"," "],
- ["constant.numeric.pascal","1"],
+ ["constant.numeric","1"],
["text","] "],
["keyword.operator",":="],
["text"," tmp"],
@@ -261,35 +261,35 @@
],[
"start",
["text"," "],
- ["keyword.control.pascal","END"],
+ ["keyword.control","END"],
["keyword.operator",";"]
],[
"start"
],[
"start",
["text"," "],
- ["punctuation.definition.comment.pascal","(*"],
- ["comment.block.pascal.one"," Print. "],
- ["punctuation.definition.comment.pascal","*)"]
+ ["punctuation.definition.comment","(*"],
+ ["comment.block.one"," Print. "],
+ ["punctuation.definition.comment","*)"]
],[
"start",
["text"," "],
- ["keyword.control.pascal","FOR"],
+ ["keyword.control","FOR"],
["text"," i "],
["keyword.operator",":="],
["text"," "],
- ["constant.numeric.pascal","1"],
+ ["constant.numeric","1"],
["text"," "],
- ["keyword.control.pascal","TO"],
+ ["keyword.control","TO"],
["text"," size "],
- ["keyword.control.pascal","DO"]
+ ["keyword.control","DO"]
],[
"start",
["text"," writeln(arr[i])"]
],[
"start",
["text"," "],
- ["keyword.control.pascal","END"],
+ ["keyword.control","END"],
["text","."]
],[
"start",
diff --git a/lib/ace/mode/pascal_highlight_rules.js b/lib/ace/mode/pascal_highlight_rules.js
index a617da7709f..6befbd8e991 100644
--- a/lib/ace/mode/pascal_highlight_rules.js
+++ b/lib/ace/mode/pascal_highlight_rules.js
@@ -28,18 +28,6 @@
*
* ***** END LICENSE BLOCK ***** */
-/* THIS FILE WAS AUTOGENERATED FROM tool\tm bundles\pascal.tmbundle\Syntaxes\Pascal.plist (UUID: F42FA544-6B1C-11D9-9517-000D93589AF6) */
-/****************************************************************
- * IT MIGHT NOT BE PERFECT, PARTICULARLY: *
- * IN DECIDING STATES TO TRANSITION TO, *
- * IGNORING WHITESPACE, *
- * IGNORING GROUPS WITH ?:, *
- * EXTENDING EXISTING MODES, *
- * GATHERING KEYWORDS, OR *
- * DECIDING WHEN TO USE PUSH. *
- * ...But it's a good start from an existing *.tmlanguage file. *
- ****************************************************************/
-
define(function(require, exports, module) {
"use strict";
@@ -47,81 +35,97 @@ var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var PascalHighlightRules = function() {
- // regexp must not have capturing parentheses. Use (?:) instead.
- // regexps are ordered -> the first match is used
+ var keywordMapper = this.createKeywordMapper({
+ "keyword.control": "absolute|abstract|all|and|and_then|array|as|asm|attribute|begin|bindable|case|class" +
+ "|const|constructor|destructor|div|do|do|else|end|except|export|exports|external|far|file|finalization" +
+ "|finally|for|forward|goto|if|implementation|import|in|inherited|initialization|interface|interrupt|is" +
+ "|label|library|mod|module|name|near|nil|not|object|of|only|operator|or|or_else|otherwise|packed|pow|private" +
+ "|program|property|protected|public|published|qualified|record|repeat|resident|restricted|segment|set|shl|shr" +
+ "|then|to|try|type|unit|until|uses|value|var|view|virtual|while|with|xor"
+ }, "identifier", true);
- this.$rules = { start:
- [ { caseInsensitive: true,
- token: 'keyword.control.pascal',
- regex: '\\b(?:(absolute|abstract|all|and|and_then|array|as|asm|attribute|begin|bindable|case|class|const|constructor|destructor|div|do|do|else|end|except|export|exports|external|far|file|finalization|finally|for|forward|goto|if|implementation|import|in|inherited|initialization|interface|interrupt|is|label|library|mod|module|name|near|nil|not|object|of|only|operator|or|or_else|otherwise|packed|pow|private|program|property|protected|public|published|qualified|record|repeat|resident|restricted|segment|set|shl|shr|then|to|try|type|unit|until|uses|value|var|view|virtual|while|with|xor))\\b' },
- { caseInsensitive: true,
- token:
- [ 'variable.pascal', "text",
- 'storage.type.prototype.pascal',
- 'entity.name.function.prototype.pascal' ],
- regex: '\\b(function|procedure)(\\s+)(\\w+)(\\.\\w+)?(?=(?:\\(.*?\\))?;\\s*(?:attribute|forward|external))' },
- { caseInsensitive: true,
- token:
- [ 'variable.pascal', "text",
- 'storage.type.function.pascal',
- 'entity.name.function.pascal' ],
- regex: '\\b(function|procedure)(\\s+)(\\w+)(\\.\\w+)?' },
- { token: 'constant.numeric.pascal',
- regex: '\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b' },
- { token: 'punctuation.definition.comment.pascal',
- regex: '--.*$',
- push_:
- [ { token: 'comment.line.double-dash.pascal.one',
- regex: '$',
- next: 'pop' },
- { defaultToken: 'comment.line.double-dash.pascal.one' } ] },
- { token: 'punctuation.definition.comment.pascal',
- regex: '//.*$',
- push_:
- [ { token: 'comment.line.double-slash.pascal.two',
- regex: '$',
- next: 'pop' },
- { defaultToken: 'comment.line.double-slash.pascal.two' } ] },
- { token: 'punctuation.definition.comment.pascal',
- regex: '\\(\\*',
- push:
- [ { token: 'punctuation.definition.comment.pascal',
- regex: '\\*\\)',
- next: 'pop' },
- { defaultToken: 'comment.block.pascal.one' } ] },
- { token: 'punctuation.definition.comment.pascal',
- regex: '\\{',
- push:
- [ { token: 'punctuation.definition.comment.pascal',
- regex: '\\}',
- next: 'pop' },
- { defaultToken: 'comment.block.pascal.two' } ] },
- { token: 'punctuation.definition.string.begin.pascal',
- regex: '"',
- push:
- [ { token: 'constant.character.escape.pascal', regex: '\\\\.' },
- { token: 'punctuation.definition.string.end.pascal',
+ this.$rules = {
+ start: [{
+ caseInsensitive: true,
+ token: ['variable', "text",
+ 'storage.type.prototype',
+ 'entity.name.function.prototype'
+ ],
+ regex: '\\b(function|procedure)(\\s+)(\\w+)(\\.\\w+)?(?=(?:\\(.*?\\))?;\\s*(?:attribute|forward|external))'
+ }, {
+ caseInsensitive: true,
+ token: ['variable', "text", 'storage.type.function', 'entity.name.function'],
+ regex: '\\b(function|procedure)(\\s+)(\\w+)(\\.\\w+)?'
+ }, {
+ caseInsensitive: true,
+ token: keywordMapper,
+ regex: /\b[a-z_]+\b/
+ }, {
+ token: 'constant.numeric',
+ regex: '\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b'
+ }, {
+ token: 'punctuation.definition.comment',
+ regex: '--.*$'
+ }, {
+ token: 'punctuation.definition.comment',
+ regex: '//.*$'
+ }, {
+ token: 'punctuation.definition.comment',
+ regex: '\\(\\*',
+ push: [{
+ token: 'punctuation.definition.comment',
+ regex: '\\*\\)',
+ next: 'pop'
+ },
+ { defaultToken: 'comment.block.one' }
+ ]
+ }, {
+ token: 'punctuation.definition.comment',
+ regex: '\\{',
+ push: [{
+ token: 'punctuation.definition.comment',
+ regex: '\\}',
+ next: 'pop'
+ },
+ { defaultToken: 'comment.block.two' }
+ ]
+ }, {
+ token: 'punctuation.definition.string.begin',
regex: '"',
- next: 'pop' },
- { defaultToken: 'string.quoted.double.pascal' } ]
- //Double quoted strings are an extension and (generally) support C-style escape sequences.
- },
- { token: 'punctuation.definition.string.begin.pascal',
- regex: '\'',
- push:
- [ { token: 'constant.character.escape.apostrophe.pascal',
- regex: '\'\'' },
- { token: 'punctuation.definition.string.end.pascal',
+ push: [{ token: 'constant.character.escape', regex: '\\\\.' },
+ {
+ token: 'punctuation.definition.string.end',
+ regex: '"',
+ next: 'pop'
+ },
+ { defaultToken: 'string.quoted.double' }
+ ]
+ //Double quoted strings are an extension and (generally) support C-style escape sequences.
+ }, {
+ token: 'punctuation.definition.string.begin',
regex: '\'',
- next: 'pop' },
- { defaultToken: 'string.quoted.single.pascal' } ] },
- { token: 'keyword.operator',
- regex: '[+\\-;,/*%]|:=|=' } ] };
-
+ push: [{
+ token: 'constant.character.escape.apostrophe',
+ regex: '\'\''
+ },
+ {
+ token: 'punctuation.definition.string.end',
+ regex: '\'',
+ next: 'pop'
+ },
+ { defaultToken: 'string.quoted.single' }
+ ]
+ }, {
+ token: 'keyword.operator',
+ regex: '[+\\-;,/*%]|:=|='
+ }
+ ]
+ };
+
this.normalizeRules();
};
oop.inherits(PascalHighlightRules, TextHighlightRules);
exports.PascalHighlightRules = PascalHighlightRules;
-});
\ No newline at end of file
+});
From 2ebb93c77ff3c8e1ad0ec3ec3ba5bbff0dbfdf7b Mon Sep 17 00:00:00 2001
From: nightwing
Date: Tue, 19 Mar 2019 23:56:55 +0400
Subject: [PATCH 0142/1293] update pascal test
---
lib/ace/mode/_test/tokens_pascal.json | 168 ++++++++++++++++++++------
1 file changed, 132 insertions(+), 36 deletions(-)
diff --git a/lib/ace/mode/_test/tokens_pascal.json b/lib/ace/mode/_test/tokens_pascal.json
index 50fd5264840..4e41e2ab62f 100644
--- a/lib/ace/mode/_test/tokens_pascal.json
+++ b/lib/ace/mode/_test/tokens_pascal.json
@@ -15,9 +15,14 @@
],[
"start",
["keyword.control","PROGRAM"],
- ["text"," Sort(input"],
+ ["text"," "],
+ ["identifier","Sort"],
+ ["text","("],
+ ["identifier","input"],
["keyword.operator",","],
- ["text"," output)"],
+ ["text"," "],
+ ["identifier","output"],
+ ["text",")"],
["keyword.operator",";"]
],[
"start",
@@ -31,7 +36,9 @@
["punctuation.definition.comment","*)"]
],[
"start",
- ["text"," MaxElts "],
+ ["text"," "],
+ ["identifier","MaxElts"],
+ ["text"," "],
["keyword.operator","="],
["text"," "],
["constant.numeric","50"],
@@ -49,15 +56,20 @@
["punctuation.definition.comment","*)"]
],[
"start",
- ["text"," IntArrType "],
+ ["text"," "],
+ ["identifier","IntArrType"],
+ ["text"," "],
["keyword.operator","="],
["text"," "],
["keyword.control","ARRAY"],
["text"," ["],
["constant.numeric","1"],
- ["text","..MaxElts] "],
+ ["text",".."],
+ ["identifier","MaxElts"],
+ ["text","] "],
["keyword.control","OF"],
- ["text"," Integer"],
+ ["text"," "],
+ ["identifier","Integer"],
["keyword.operator",";"]
],[
"start"
@@ -73,13 +85,19 @@
["punctuation.definition.comment","*)"]
],[
"start",
- ["text"," i"],
+ ["text"," "],
+ ["identifier","i"],
["keyword.operator",","],
- ["text"," j"],
+ ["text"," "],
+ ["identifier","j"],
["keyword.operator",","],
- ["text"," tmp"],
+ ["text"," "],
+ ["identifier","tmp"],
["keyword.operator",","],
- ["text"," size: integer"],
+ ["text"," "],
+ ["identifier","size"],
+ ["text",": "],
+ ["identifier","integer"],
["keyword.operator",";"]
],[
"start"
@@ -91,7 +109,10 @@
["punctuation.definition.comment","*)"]
],[
"start",
- ["text"," arr: IntArrType"],
+ ["text"," "],
+ ["identifier","arr"],
+ ["text",": "],
+ ["identifier","IntArrType"],
["keyword.operator",";"]
],[
"start"
@@ -109,11 +130,18 @@
["storage.type.function","ReadArr"],
["text","("],
["keyword.control","VAR"],
- ["text"," size: Integer"],
+ ["text"," "],
+ ["identifier","size"],
+ ["text",": "],
+ ["identifier","Integer"],
["keyword.operator",";"],
["text"," "],
["keyword.control","VAR"],
- ["text"," a: IntArrType)"],
+ ["text"," "],
+ ["identifier","a"],
+ ["text",": "],
+ ["identifier","IntArrType"],
+ ["text",")"],
["keyword.operator",";"],
["text"," "]
],[
@@ -122,7 +150,9 @@
["keyword.control","BEGIN"]
],[
"start",
- ["text"," size "],
+ ["text"," "],
+ ["identifier","size"],
+ ["text"," "],
["keyword.operator",":="],
["text"," "],
["constant.numeric","1"],
@@ -133,13 +163,21 @@
["keyword.control","WHILE"],
["text"," "],
["keyword.control","NOT"],
- ["text"," eof "],
+ ["text"," "],
+ ["identifier","eof"],
+ ["text"," "],
["keyword.control","DO"],
["text"," "],
["keyword.control","BEGIN"]
],[
"start",
- ["text"," readln(a[size])"],
+ ["text"," "],
+ ["identifier","readln"],
+ ["text","("],
+ ["identifier","a"],
+ ["text","["],
+ ["identifier","size"],
+ ["text","])"],
["keyword.operator",";"]
],[
"start",
@@ -147,14 +185,20 @@
["keyword.control","IF"],
["text"," "],
["keyword.control","NOT"],
- ["text"," eof "],
+ ["text"," "],
+ ["identifier","eof"],
+ ["text"," "],
["keyword.control","THEN"],
["text"," "]
],[
"start",
- ["text"," size "],
+ ["text"," "],
+ ["identifier","size"],
+ ["text"," "],
["keyword.operator",":="],
- ["text"," size "],
+ ["text"," "],
+ ["identifier","size"],
+ ["text"," "],
["keyword.operator","+"],
["text"," "],
["constant.numeric","1"]
@@ -181,9 +225,14 @@
["punctuation.definition.comment","*)"]
],[
"start",
- ["text"," ReadArr(size"],
+ ["text"," "],
+ ["identifier","ReadArr"],
+ ["text","("],
+ ["identifier","size"],
["keyword.operator",","],
- ["text"," arr)"],
+ ["text"," "],
+ ["identifier","arr"],
+ ["text",")"],
["keyword.operator",";"]
],[
"start"
@@ -197,13 +246,19 @@
"start",
["text"," "],
["keyword.control","FOR"],
- ["text"," i "],
+ ["text"," "],
+ ["identifier","i"],
+ ["text"," "],
["keyword.operator",":="],
- ["text"," size "],
+ ["text"," "],
+ ["identifier","size"],
+ ["text"," "],
["keyword.operator","-"],
["text"," "],
["constant.numeric","1"],
- ["text"," DOWNTO "],
+ ["text"," "],
+ ["identifier","DOWNTO"],
+ ["text"," "],
["constant.numeric","1"],
["text"," "],
["keyword.control","DO"]
@@ -211,20 +266,32 @@
"start",
["text"," "],
["keyword.control","FOR"],
- ["text"," j "],
+ ["text"," "],
+ ["identifier","j"],
+ ["text"," "],
["keyword.operator",":="],
["text"," "],
["constant.numeric","1"],
["text"," "],
["keyword.control","TO"],
- ["text"," i "],
+ ["text"," "],
+ ["identifier","i"],
+ ["text"," "],
["keyword.control","DO"],
["text"," "]
],[
"start",
["text"," "],
["keyword.control","IF"],
- ["text"," arr[j] > arr[j "],
+ ["text"," "],
+ ["identifier","arr"],
+ ["text","["],
+ ["identifier","j"],
+ ["text","] > "],
+ ["identifier","arr"],
+ ["text","["],
+ ["identifier","j"],
+ ["text"," "],
["keyword.operator","+"],
["text"," "],
["constant.numeric","1"],
@@ -234,15 +301,29 @@
["keyword.control","BEGIN"]
],[
"start",
- ["text"," tmp "],
+ ["text"," "],
+ ["identifier","tmp"],
+ ["text"," "],
["keyword.operator",":="],
- ["text"," arr[j]"],
+ ["text"," "],
+ ["identifier","arr"],
+ ["text","["],
+ ["identifier","j"],
+ ["text","]"],
["keyword.operator",";"]
],[
"start",
- ["text"," arr[j] "],
+ ["text"," "],
+ ["identifier","arr"],
+ ["text","["],
+ ["identifier","j"],
+ ["text","] "],
["keyword.operator",":="],
- ["text"," arr[j "],
+ ["text"," "],
+ ["identifier","arr"],
+ ["text","["],
+ ["identifier","j"],
+ ["text"," "],
["keyword.operator","+"],
["text"," "],
["constant.numeric","1"],
@@ -250,13 +331,18 @@
["keyword.operator",";"]
],[
"start",
- ["text"," arr[j "],
+ ["text"," "],
+ ["identifier","arr"],
+ ["text","["],
+ ["identifier","j"],
+ ["text"," "],
["keyword.operator","+"],
["text"," "],
["constant.numeric","1"],
["text","] "],
["keyword.operator",":="],
- ["text"," tmp"],
+ ["text"," "],
+ ["identifier","tmp"],
["keyword.operator",";"]
],[
"start",
@@ -275,17 +361,27 @@
"start",
["text"," "],
["keyword.control","FOR"],
- ["text"," i "],
+ ["text"," "],
+ ["identifier","i"],
+ ["text"," "],
["keyword.operator",":="],
["text"," "],
["constant.numeric","1"],
["text"," "],
["keyword.control","TO"],
- ["text"," size "],
+ ["text"," "],
+ ["identifier","size"],
+ ["text"," "],
["keyword.control","DO"]
],[
"start",
- ["text"," writeln(arr[i])"]
+ ["text"," "],
+ ["identifier","writeln"],
+ ["text","("],
+ ["identifier","arr"],
+ ["text","["],
+ ["identifier","i"],
+ ["text","])"]
],[
"start",
["text"," "],
From 65c0953f692c9a4d0cd82735c21c59bc73b08957 Mon Sep 17 00:00:00 2001
From: Olivier BONNAURE
Date: Thu, 21 Mar 2019 23:34:02 +0100
Subject: [PATCH 0143/1293] AQL syntax
---
demo/kitchen-sink/docs/aql.aql | 3 +
lib/ace/ext/modelist.js | 1 +
lib/ace/mode/aql.js | 53 +++++++++++++++
lib/ace/mode/aql_highlight_rules.js | 102 ++++++++++++++++++++++++++++
4 files changed, 159 insertions(+)
create mode 100644 demo/kitchen-sink/docs/aql.aql
create mode 100644 lib/ace/mode/aql.js
create mode 100644 lib/ace/mode/aql_highlight_rules.js
diff --git a/demo/kitchen-sink/docs/aql.aql b/demo/kitchen-sink/docs/aql.aql
new file mode 100644
index 00000000000..a5baf333a1a
--- /dev/null
+++ b/demo/kitchen-sink/docs/aql.aql
@@ -0,0 +1,3 @@
+FOR user IN users
+ FILTER user.username == "olivier"
+ RETURN user
\ No newline at end of file
diff --git a/lib/ace/ext/modelist.js b/lib/ace/ext/modelist.js
index f4ea2fde9a4..3e6f90bd41f 100644
--- a/lib/ace/ext/modelist.js
+++ b/lib/ace/ext/modelist.js
@@ -53,6 +53,7 @@ var supportedModes = {
Assembly_x86:["asm|a"],
AutoHotKey: ["ahk"],
Apex: ["apex|cls|trigger|tgr"],
+ AQL: ["aql"],
BatchFile: ["bat|cmd"],
Bro: ["bro"],
C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"],
diff --git a/lib/ace/mode/aql.js b/lib/ace/mode/aql.js
new file mode 100644
index 00000000000..0a3e96fa128
--- /dev/null
+++ b/lib/ace/mode/aql.js
@@ -0,0 +1,53 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Ajax.org B.V. nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+ "use strict";
+
+ var oop = require("../lib/oop");
+ var TextMode = require("./text").Mode;
+ var AqlHighlightRules = require("./aql_highlight_rules").AqlHighlightRules;
+
+ var Mode = function() {
+ this.HighlightRules = AqlHighlightRules;
+ this.$behaviour = this.$defaultBehaviour;
+ };
+ oop.inherits(Mode, TextMode);
+
+ (function() {
+
+ this.lineCommentStart = "//";
+
+ this.$id = "ace/mode/aql";
+ }).call(Mode.prototype);
+
+ exports.Mode = Mode;
+
+ });
diff --git a/lib/ace/mode/aql_highlight_rules.js b/lib/ace/mode/aql_highlight_rules.js
new file mode 100644
index 00000000000..085d03cb6d7
--- /dev/null
+++ b/lib/ace/mode/aql_highlight_rules.js
@@ -0,0 +1,102 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Ajax.org B.V. nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+ "use strict";
+
+ var oop = require("../lib/oop");
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+ var AqlHighlightRules = function() {
+
+ var keywords = (
+ "for|search|outbound|inbound|any|graph|prune|options|shortest_path|to|in|return|filter|sort|limit|let|collect|remove|update|replace|insers|upsert|with"
+ );
+
+ var builtinConstants = (
+ "true|false"
+ );
+
+ var builtinFunctions = (
+ "append|contains_array|count|count_distinct|count_unique|first|flatten|intersection|last|length|minus|nth|outersection|pop|position|push|remove_nth|remove_value|remove_values|reverse|shift|slice|sorted|sorted_unique|union|union_distinct|unique|unshift|" +
+ "date_now|date_iso8601|date_timestamp|is_datestring|date_dayofweek|date_year|date_month|date_day|date_hour|date_minute|date_second|date_millisecond|date_dayofyear|date_isoweek|date_leapyear|date_quarter|date_days_in_month|date_trunc|date_format|date_add|date_subtract|date_diff|date_compare|" +
+ "attributes|count|has|is_same_collection|keep|length|matches|merge|merge_recursive|parse_identifier|translate|unset|unset_recursive|values|zip|" +
+ "fulltext|" +
+ "distance|geo_contains|geo_distance|geo_equals|geo_intersects|is_in_polygon|" +
+ "not_null|first_list|first_document|check_document|collection_count|collections|count|current_user|document|length|hash|apply|assert|/ warn|call|fail|noopt|passthru|sleep|v8|version|" +
+ "abs|acos|asin|atan|atan2|average|avg|ceil|cos|degrees|exp|exp2|floor|log|log2|log10|max|median|min|percentile|pi|pow|radians|rand|range|round|sin|sqrt|stddev_population|stddev_sample|stddev|sum|tan|variance_population|variance_sample|variance|" +
+ "char_length|concat|concat_separator|contains|count|encode_uri_component|find_first|find_last|json_parse|json_stringify|left|length|levenshtein_distance|like|lower|ltrim|md5|random_token|regex_matches|regex_split|regex_test|regex_replace|reverse|right|rtrim|sha1|sha512|split|soundex|substitute|substring|tokens|to_base64|to_hex|trim|upper|uuid|" +
+ "to_bool|to_number|to_string|to_array|to_list|is_null|is_bool|is_number|is_string|is_array|is_list|is_object|is_document|is_datestring|is_key|typename|"
+ );
+
+ var keywordMapper = this.createKeywordMapper({
+ "support.function": builtinFunctions,
+ "keyword": keywords,
+ "constant.language": builtinConstants
+ }, "identifier", true);
+
+ this.$rules = {
+ "start" : [ {
+ token : "comment",
+ regex : "//.*$"
+ }, {
+ token : "string", // " string
+ regex : '".*?"'
+ }, {
+ token : "string", // ' string
+ regex : "'.*?'"
+ }, {
+ token : "constant.numeric", // float
+ regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+ }, {
+ token : keywordMapper,
+ regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+ }, {
+ token : "keyword.operator",
+ regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
+ }, {
+ token : "paren.lparen",
+ regex : "[\\(]"
+ }, {
+ token : "paren.rparen",
+ regex : "[\\)]"
+ }, {
+ token : "text",
+ regex : "\\s+"
+ } ]
+ };
+ this.normalizeRules();
+ };
+
+ oop.inherits(AqlHighlightRules, TextHighlightRules);
+
+ exports.AqlHighlightRules = AqlHighlightRules;
+ });
+
From 7afd4ab0eb8dd01ae7d9fb885e5c7b770a3d4f22 Mon Sep 17 00:00:00 2001
From: emontnemery
Date: Tue, 26 Mar 2019 23:08:03 +0100
Subject: [PATCH 0144/1293] fix highlighting of multiline yaml string in lists
---
lib/ace/mode/yaml_highlight_rules.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/ace/mode/yaml_highlight_rules.js b/lib/ace/mode/yaml_highlight_rules.js
index 35425e63b50..7495f6f207f 100644
--- a/lib/ace/mode/yaml_highlight_rules.js
+++ b/lib/ace/mode/yaml_highlight_rules.js
@@ -74,7 +74,7 @@ var YamlHighlightRules = function() {
token : "string", // multi line string start
regex : /[|>][-+\d\s]*$/,
onMatch: function(val, state, stack, line) {
- var indent = /^\s*/.exec(line)[0];
+ var indent = /^\s*(?:[-?]\s)?/.exec(line)[0];
if (stack.length < 1) {
stack.push(this.next);
} else {
From 57c2ffe780a3de110a2da8ea029092e914e62838 Mon Sep 17 00:00:00 2001
From: emontnemery
Date: Wed, 27 Mar 2019 21:28:17 +0100
Subject: [PATCH 0145/1293] Update yaml_highlight_rules.js
---
lib/ace/mode/yaml_highlight_rules.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/ace/mode/yaml_highlight_rules.js b/lib/ace/mode/yaml_highlight_rules.js
index 7495f6f207f..063db80bcae 100644
--- a/lib/ace/mode/yaml_highlight_rules.js
+++ b/lib/ace/mode/yaml_highlight_rules.js
@@ -74,7 +74,7 @@ var YamlHighlightRules = function() {
token : "string", // multi line string start
regex : /[|>][-+\d\s]*$/,
onMatch: function(val, state, stack, line) {
- var indent = /^\s*(?:[-?]\s)?/.exec(line)[0];
+ var indent = /^\s*(?:[-?]\s)?\s*/.exec(line)[0];
if (stack.length < 1) {
stack.push(this.next);
} else {
From 8cbab2bcca20d7d94f41edec4bc6d53c1212a362 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Thu, 4 Apr 2019 18:01:49 +0200
Subject: [PATCH 0146/1293] fix textinput on ios in vim mode
---
lib/ace/keyboard/textinput.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/ace/keyboard/textinput.js b/lib/ace/keyboard/textinput.js
index 321f4575ed9..ca16825c3f6 100644
--- a/lib/ace/keyboard/textinput.js
+++ b/lib/ace/keyboard/textinput.js
@@ -159,7 +159,7 @@ var TextInput = function(parentNode, host) {
var resetSelection = isIOS
? function(value) {
- if (!isFocused || (copied && !value)) return;
+ if (!isFocused || (copied && !value) || sendingText) return;
if (!value)
value = "";
var newValue = "\n ab" + value + "cde fg\n";
From 32e531da44b096f313c19f54af945c3e01914cb7 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Sun, 14 Apr 2019 18:00:50 +0400
Subject: [PATCH 0147/1293] support manual indentation specification in yaml
strings
---
lib/ace/mode/_test/text_yaml.txt | 71 +++++++++++
lib/ace/mode/_test/tokens_yaml.json | 172 +++++++++++++++++++++++++--
lib/ace/mode/yaml_highlight_rules.js | 57 +++++++--
3 files changed, 278 insertions(+), 22 deletions(-)
create mode 100644 lib/ace/mode/_test/text_yaml.txt
diff --git a/lib/ace/mode/_test/text_yaml.txt b/lib/ace/mode/_test/text_yaml.txt
new file mode 100644
index 00000000000..506d3478e99
--- /dev/null
+++ b/lib/ace/mode/_test/text_yaml.txt
@@ -0,0 +1,71 @@
+# This sample document was taken from wikipedia:
+# http://en.wikipedia.org/wiki/YAML#Sample_document
+---
+receipt: Oz-Ware Purchase Invoice
+date: 2007-08-06
+customer:
+ given: Dorothy
+ family: Gale
+
+items:
+ - part_no: 'A4786'
+ descrip: Water Bucket (Filled)
+ price: 1.47
+ quantity: 4
+
+ - part_no: 'E1628'
+ descrip: High Heeled "Ruby" Slippers
+ size: 8
+ price: 100.27
+ quantity: 1
+
+bill-to: &id001
+ street: |
+ 123 Tornado Alley
+ Suite 16
+ city: East Centerville
+ state: KS
+
+ship-to: *id001
+
+specialDelivery: >
+ Follow the Yellow Brick
+ Road to the Emerald City.
+ Pay no attention to the
+ man behind the curtain.
+
+? |
+ block key #1
+ kkk
+: - |
+ one
+ - |
+ tw #o
+ - ? |-
+
+ as #d
+
+ q
+ b
+ -
+ x: xx
+ r: xx
+ z: sss
+ zdd: dddd
+ "block key 2" :
+ - two # block value
+ - ? |
+ as #d
+ : |
+ asdadas #d
+ asd
+ a: 2
+ - ? |
+ asdas #d
+ : |
+ xx
+ s: |4+ #comment
+ 7
+
+ a
+ a
diff --git a/lib/ace/mode/_test/tokens_yaml.json b/lib/ace/mode/_test/tokens_yaml.json
index 0d2acadc4b9..29a89c6d76e 100644
--- a/lib/ace/mode/_test/tokens_yaml.json
+++ b/lib/ace/mode/_test/tokens_yaml.json
@@ -106,17 +106,17 @@
["text"," "],
["constant.language","&id001"]
],[
- ["mlString",4],
+ ["mlStringPre",4],
["meta.tag"," street"],
["keyword",":"],
["text"," "],
["string","|"]
],[
- ["mlString",4],
+ ["mlString",11],
["indent"," "],
["string","123 Tornado Alley"]
],[
- ["mlString",4],
+ ["mlString",11],
["indent"," "],
["string","Suite 16"]
],[
@@ -141,27 +141,181 @@
],[
"start"
],[
- ["mlString",0],
+ ["mlStringPre",0],
["meta.tag","specialDelivery"],
["keyword",":"],
["text"," "],
["string",">"]
],[
- ["mlString",0],
+ ["mlString",3],
["indent"," "],
["string","Follow the Yellow Brick"]
],[
- ["mlString",0],
+ ["mlString",3],
["indent"," "],
["string","Road to the Emerald City."]
],[
- ["mlString",0],
+ ["mlString",3],
["indent"," "],
["string","Pay no attention to the"]
],[
- ["mlString",0],
+ ["mlString",3],
["indent"," "],
["string","man behind the curtain."]
],[
- ["mlString",0]
+ ["mlString",3]
+],[
+ ["mlStringPre",0],
+ ["list.markup","? "],
+ ["text"," "],
+ ["string","|"]
+],[
+ ["mlString",0],
+ ["indent"," "],
+ ["string","block key #1"]
+],[
+ ["mlString",0],
+ ["indent"," "],
+ ["string","kkk"]
+],[
+ ["mlStringPre",2],
+ ["text",": - "],
+ ["string","|"]
+],[
+ ["mlString",2],
+ ["indent"," "],
+ ["string","one "]
+],[
+ ["mlStringPre",2],
+ ["indent"," "],
+ ["text","- "],
+ ["string","|"]
+],[
+ ["mlString",2],
+ ["indent"," "],
+ ["string","tw #o "]
+],[
+ ["mlStringPre",4],
+ ["indent"," "],
+ ["text","- ? "],
+ ["string","|- "]
+],[
+ ["mlStringPre",4]
+],[
+ ["mlString",4],
+ ["indent"," "],
+ ["string","as #d"]
+],[
+ ["mlString",4]
+],[
+ ["mlString",4],
+ ["indent"," "],
+ ["string","q"]
+],[
+ "start",
+ ["indent"," "],
+ ["text","b"]
+],[
+ "start",
+ ["list.markup"," - "]
+],[
+ "start",
+ ["meta.tag"," x"],
+ ["keyword",":"],
+ ["text"," xx"]
+],[
+ "start",
+ ["meta.tag"," r"],
+ ["keyword",":"],
+ ["text"," xx"]
+],[
+ "start",
+ ["meta.tag"," z"],
+ ["keyword",":"],
+ ["text"," sss"]
+],[
+ "start",
+ ["meta.tag"," zdd"],
+ ["keyword",":"],
+ ["text"," dddd"]
+],[
+ "start",
+ ["text"," "],
+ ["string","\"block key 2\""],
+ ["text"," : "]
+],[
+ "start",
+ ["list.markup"," - "],
+ ["text","two "],
+ ["comment","# block value"]
+],[
+ ["mlStringPre",9],
+ ["list.markup"," - "],
+ ["text","? "],
+ ["string","| "]
+],[
+ ["mlString",9],
+ ["indent"," "],
+ ["string","as #d"]
+],[
+ ["mlStringPre",9],
+ ["indent"," "],
+ ["text",": "],
+ ["string","|"]
+],[
+ ["mlString",9],
+ ["indent"," "],
+ ["string","asdadas #d"]
+],[
+ ["mlString",9],
+ ["indent"," "],
+ ["string","asd"]
+],[
+ "start",
+ ["indent"," "],
+ ["meta.tag","a"],
+ ["keyword",":"],
+ ["text"," "],
+ ["constant.numeric","2"]
+],[
+ ["mlStringPre",9],
+ ["list.markup"," - "],
+ ["text","? "],
+ ["string","| "]
+],[
+ ["mlString",9],
+ ["indent"," "],
+ ["string","asdas #d"]
+],[
+ ["mlStringPre",9],
+ ["indent"," "],
+ ["text",": "],
+ ["string","|"]
+],[
+ ["mlString",9],
+ ["indent"," "],
+ ["string","xx"]
+],[
+ ["mlString",12],
+ ["indent"," "],
+ ["meta.tag","s"],
+ ["keyword",":"],
+ ["text"," "],
+ ["string","|4+ #comment"]
+],[
+ ["mlString",12],
+ ["indent"," "],
+ ["string","7"]
+],[
+ ["mlString",12]
+],[
+ ["mlString",12],
+ ["indent"," "],
+ ["string","a "]
+],[
+ "start",
+ ["indent"," "],
+ ["text","a"]
+],[
+ "start"
]]
\ No newline at end of file
diff --git a/lib/ace/mode/yaml_highlight_rules.js b/lib/ace/mode/yaml_highlight_rules.js
index 063db80bcae..56c9db44179 100644
--- a/lib/ace/mode/yaml_highlight_rules.js
+++ b/lib/ace/mode/yaml_highlight_rules.js
@@ -72,20 +72,25 @@ var YamlHighlightRules = function() {
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
}, {
token : "string", // multi line string start
- regex : /[|>][-+\d\s]*$/,
+ regex : /[|>][-+\d]*(?:$|\s+(?:$|#))/,
onMatch: function(val, state, stack, line) {
- var indent = /^\s*(?:[-?]\s)?\s*/.exec(line)[0];
- if (stack.length < 1) {
- stack.push(this.next);
+ line = line.replace(/ #.*/, "");
+ var indent = /^ *((:\s*)?-(\s*[^|>])?)?/.exec(line)[0]
+ .replace(/\S\s*$/, "").length;
+ var indentationIndicator = parseInt(/\d+[\s+-]*$/.exec(line));
+
+ if (indentationIndicator) {
+ indent += indentationIndicator - 1;
+ this.next = "mlString";
} else {
- stack[0] = "mlString";
- }
-
- if (stack.length < 2) {
- stack.push(indent.length);
+ this.next = "mlStringPre";
}
- else {
- stack[1] = indent.length;
+ if (!stack.length) {
+ stack.push(this.next);
+ stack.push(indent);
+ } else {
+ stack[0] = this.next;
+ stack[1] = indent;
}
return this.token;
},
@@ -113,13 +118,39 @@ var YamlHighlightRules = function() {
regex : /[^\s,:\[\]\{\}]+/
}
],
+ "mlStringPre" : [
+ {
+ token : "indent",
+ regex : /^ *$/
+ }, {
+ token : "indent",
+ regex : /^ */,
+ onMatch: function(val, state, stack) {
+ var curIndent = stack[1];
+
+ if (curIndent >= val.length) {
+ this.next = "start";
+ stack.shift();
+ stack.shift();
+ }
+ else {
+ stack[1] = val.length - 1;
+ this.next = stack[0] = "mlString";
+ }
+ return this.token;
+ },
+ next : "mlString"
+ }, {
+ defaultToken : "string"
+ }
+ ],
"mlString" : [
{
token : "indent",
- regex : /^\s*$/
+ regex : /^ *$/
}, {
token : "indent",
- regex : /^\s*/,
+ regex : /^ */,
onMatch: function(val, state, stack) {
var curIndent = stack[1];
From 99bd8c644d2ca16edb205dbf77d70f272d6a09c7 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Fri, 22 Mar 2019 23:46:49 +0400
Subject: [PATCH 0148/1293] initial implementation of command prompt
---
build | 2 +-
demo/kitchen-sink/demo.js | 15 -
lib/ace/autocomplete.js | 12 +-
lib/ace/autocomplete/popup.js | 22 +-
lib/ace/commands/default_commands.js | 110 ++++-
lib/ace/commands/multi_select_commands.js | 12 +
lib/ace/editor.js | 10 +
lib/ace/ext/beautify.js | 1 +
lib/ace/ext/keybinding_menu.js | 2 +-
lib/ace/ext/menu_tools/overlay_page.js | 48 +--
lib/ace/ext/prompt.js | 472 ++++++++++++++++++++++
lib/ace/ext/settings_menu.js | 2 +-
lib/ace/ext/whitespace.js | 4 +
lib/ace/selection.js | 2 +-
14 files changed, 648 insertions(+), 66 deletions(-)
create mode 100644 lib/ace/ext/prompt.js
diff --git a/build b/build
index 32e27226d66..f17f0751fc4 160000
--- a/build
+++ b/build
@@ -1 +1 @@
-Subproject commit 32e27226d66b2f3a63d4e393853f84ef3e17a003
+Subproject commit f17f0751fc4c2bb73cd9340e9cbc02e4d979608f
diff --git a/demo/kitchen-sink/demo.js b/demo/kitchen-sink/demo.js
index d8909ff1c26..49e0e771e1b 100644
--- a/demo/kitchen-sink/demo.js
+++ b/demo/kitchen-sink/demo.js
@@ -134,21 +134,6 @@ env.editor.showCommandLine = function(val) {
* This demonstrates how you can define commands and bind shortcuts to them.
*/
env.editor.commands.addCommands([{
- name: "gotoline",
- bindKey: {win: "Ctrl-L", mac: "Command-L"},
- exec: function(editor, line) {
- if (typeof line == "object") {
- var arg = this.name + " " + editor.getCursorPosition().row;
- editor.cmdLine.setValue(arg, 1);
- editor.cmdLine.focus();
- return;
- }
- line = parseInt(line, 10);
- if (!isNaN(line))
- editor.gotoLine(line);
- },
- readOnly: true
-}, {
name: "snippet",
bindKey: {win: "Alt-C", mac: "Command-Alt-C"},
exec: function(editor, needle) {
diff --git a/lib/ace/autocomplete.js b/lib/ace/autocomplete.js
index a323dd882a6..1802d720e60 100644
--- a/lib/ace/autocomplete.js
+++ b/lib/ace/autocomplete.js
@@ -163,17 +163,7 @@ var Autocomplete = function() {
};
this.goTo = function(where) {
- var row = this.popup.getRow();
- var max = this.popup.session.getLength() - 1;
-
- switch(where) {
- case "up": row = row <= 0 ? max : row - 1; break;
- case "down": row = row >= max ? -1 : row + 1; break;
- case "start": row = 0; break;
- case "end": row = max; break;
- }
-
- this.popup.setRow(row);
+ this.popup.goTo(where);
};
this.insertMatch = function(data, options) {
diff --git a/lib/ace/autocomplete/popup.js b/lib/ace/autocomplete/popup.js
index bb0e21ea86d..01e9e02409d 100644
--- a/lib/ace/autocomplete/popup.js
+++ b/lib/ace/autocomplete/popup.js
@@ -204,6 +204,8 @@ var AcePopup = function(parentNode) {
if (data.meta)
tokens.push({type: "completion-meta", value: data.meta});
+ if (data.message)
+ tokens.push({type: "completion-message", value: data.message});
return tokens;
};
@@ -292,6 +294,21 @@ var AcePopup = function(parentNode) {
popup.isOpen = true;
};
+ popup.goTo = function(where) {
+ var row = this.getRow();
+ var max = this.session.getLength() - 1;
+
+ switch(where) {
+ case "up": row = row < 0 ? max : row - 1; break;
+ case "down": row = row >= max ? -1 : row + 1; break;
+ case "start": row = 0; break;
+ case "end": row = max; break;
+ }
+
+ this.setRow(row);
+ };
+
+
popup.getTextLeftOffset = function() {
return this.$borderSize + this.renderer.$padding + this.$imageSize;
};
@@ -325,6 +342,9 @@ dom.importCssString("\
opacity: 0.5;\
margin: 0.9em;\
}\
+.ace_completion-message {\
+ color: blue;\
+}\
.ace_editor.ace_autocomplete .ace_completion-highlight{\
color: #2d69c7;\
}\
@@ -350,7 +370,7 @@ dom.importCssString("\
}", "autocompletion.css");
exports.AcePopup = AcePopup;
-
+exports.$singleLineEditor = $singleLineEditor;
});
diff --git a/lib/ace/commands/default_commands.js b/lib/ace/commands/default_commands.js
index 527bebe874a..ac15251ab12 100644
--- a/lib/ace/commands/default_commands.js
+++ b/lib/ace/commands/default_commands.js
@@ -75,23 +75,25 @@ exports.commands = [{
readOnly: true
}, {
name: "selectall",
+ description: "Select all",
bindKey: bindKey("Ctrl-A", "Command-A"),
exec: function(editor) { editor.selectAll(); },
readOnly: true
}, {
name: "centerselection",
+ description: "Center selection",
bindKey: bindKey(null, "Ctrl-L"),
exec: function(editor) { editor.centerSelection(); },
readOnly: true
}, {
name: "gotoline",
+ description: "Go to line...",
bindKey: bindKey("Ctrl-L", "Command-L"),
exec: function(editor, line) {
- if (typeof line !== "number")
- line = parseInt(prompt("Enter line number:"), 10);
- if (!isNaN(line)) {
+ // backwards compatibility
+ if (typeof line === "number" && !isNaN(line))
editor.gotoLine(line);
- }
+ editor.prompt({ $type: "gotoLine" });
},
readOnly: true
}, {
@@ -124,12 +126,14 @@ exports.commands = [{
readOnly: true
}, {
name: "foldall",
+ description: "Fold all",
bindKey: bindKey(null, "Ctrl-Command-Option-0"),
exec: function(editor) { editor.session.foldAll(); },
scrollIntoView: "center",
readOnly: true
}, {
name: "foldOther",
+ description: "Fold other",
bindKey: bindKey("Alt-0", "Command-Option-0"),
exec: function(editor) {
editor.session.foldAll();
@@ -139,12 +143,14 @@ exports.commands = [{
readOnly: true
}, {
name: "unfoldall",
+ description: "Unfold all",
bindKey: bindKey("Alt-Shift-0", "Command-Option-Shift-0"),
exec: function(editor) { editor.session.unfold(); },
scrollIntoView: "center",
readOnly: true
}, {
name: "findnext",
+ description: "Find next",
bindKey: bindKey("Ctrl-K", "Command-G"),
exec: function(editor) { editor.findNext(); },
multiSelectAction: "forEach",
@@ -152,6 +158,7 @@ exports.commands = [{
readOnly: true
}, {
name: "findprevious",
+ description: "Find previous",
bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"),
exec: function(editor) { editor.findPrevious(); },
multiSelectAction: "forEach",
@@ -159,6 +166,7 @@ exports.commands = [{
readOnly: true
}, {
name: "selectOrFindNext",
+ description: "Select or find next",
bindKey: bindKey("Alt-K", "Ctrl-G"),
exec: function(editor) {
if (editor.selection.isEmpty())
@@ -169,6 +177,7 @@ exports.commands = [{
readOnly: true
}, {
name: "selectOrFindPrevious",
+ description: "Select or find previous",
bindKey: bindKey("Alt-Shift-K", "Ctrl-Shift-G"),
exec: function(editor) {
if (editor.selection.isEmpty())
@@ -179,6 +188,7 @@ exports.commands = [{
readOnly: true
}, {
name: "find",
+ description: "Find",
bindKey: bindKey("Ctrl-F", "Command-F"),
exec: function(editor) {
config.loadModule("ace/ext/searchbox", function(e) {e.Search(editor);});
@@ -186,11 +196,13 @@ exports.commands = [{
readOnly: true
}, {
name: "overwrite",
+ description: "Overwrite",
bindKey: "Insert",
exec: function(editor) { editor.toggleOverwrite(); },
readOnly: true
}, {
name: "selecttostart",
+ description: "Select to start",
bindKey: bindKey("Ctrl-Shift-Home", "Command-Shift-Home|Command-Shift-Up"),
exec: function(editor) { editor.getSelection().selectFileStart(); },
multiSelectAction: "forEach",
@@ -199,6 +211,7 @@ exports.commands = [{
aceCommandGroup: "fileJump"
}, {
name: "gotostart",
+ description: "Go to start",
bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"),
exec: function(editor) { editor.navigateFileStart(); },
multiSelectAction: "forEach",
@@ -207,6 +220,7 @@ exports.commands = [{
aceCommandGroup: "fileJump"
}, {
name: "selectup",
+ description: "Select up",
bindKey: bindKey("Shift-Up", "Shift-Up|Ctrl-Shift-P"),
exec: function(editor) { editor.getSelection().selectUp(); },
multiSelectAction: "forEach",
@@ -214,6 +228,7 @@ exports.commands = [{
readOnly: true
}, {
name: "golineup",
+ description: "Go line up",
bindKey: bindKey("Up", "Up|Ctrl-P"),
exec: function(editor, args) { editor.navigateUp(args.times); },
multiSelectAction: "forEach",
@@ -221,6 +236,7 @@ exports.commands = [{
readOnly: true
}, {
name: "selecttoend",
+ description: "Select to end",
bindKey: bindKey("Ctrl-Shift-End", "Command-Shift-End|Command-Shift-Down"),
exec: function(editor) { editor.getSelection().selectFileEnd(); },
multiSelectAction: "forEach",
@@ -229,6 +245,7 @@ exports.commands = [{
aceCommandGroup: "fileJump"
}, {
name: "gotoend",
+ description: "Go to end",
bindKey: bindKey("Ctrl-End", "Command-End|Command-Down"),
exec: function(editor) { editor.navigateFileEnd(); },
multiSelectAction: "forEach",
@@ -237,6 +254,7 @@ exports.commands = [{
aceCommandGroup: "fileJump"
}, {
name: "selectdown",
+ description: "Select down",
bindKey: bindKey("Shift-Down", "Shift-Down|Ctrl-Shift-N"),
exec: function(editor) { editor.getSelection().selectDown(); },
multiSelectAction: "forEach",
@@ -244,6 +262,7 @@ exports.commands = [{
readOnly: true
}, {
name: "golinedown",
+ description: "Go line down",
bindKey: bindKey("Down", "Down|Ctrl-N"),
exec: function(editor, args) { editor.navigateDown(args.times); },
multiSelectAction: "forEach",
@@ -251,6 +270,7 @@ exports.commands = [{
readOnly: true
}, {
name: "selectwordleft",
+ description: "Select word left",
bindKey: bindKey("Ctrl-Shift-Left", "Option-Shift-Left"),
exec: function(editor) { editor.getSelection().selectWordLeft(); },
multiSelectAction: "forEach",
@@ -258,6 +278,7 @@ exports.commands = [{
readOnly: true
}, {
name: "gotowordleft",
+ description: "Go to word left",
bindKey: bindKey("Ctrl-Left", "Option-Left"),
exec: function(editor) { editor.navigateWordLeft(); },
multiSelectAction: "forEach",
@@ -265,6 +286,7 @@ exports.commands = [{
readOnly: true
}, {
name: "selecttolinestart",
+ description: "Select to line start",
bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left|Ctrl-Shift-A"),
exec: function(editor) { editor.getSelection().selectLineStart(); },
multiSelectAction: "forEach",
@@ -272,6 +294,7 @@ exports.commands = [{
readOnly: true
}, {
name: "gotolinestart",
+ description: "Go to line start",
bindKey: bindKey("Alt-Left|Home", "Command-Left|Home|Ctrl-A"),
exec: function(editor) { editor.navigateLineStart(); },
multiSelectAction: "forEach",
@@ -279,6 +302,7 @@ exports.commands = [{
readOnly: true
}, {
name: "selectleft",
+ description: "Select left",
bindKey: bindKey("Shift-Left", "Shift-Left|Ctrl-Shift-B"),
exec: function(editor) { editor.getSelection().selectLeft(); },
multiSelectAction: "forEach",
@@ -286,6 +310,7 @@ exports.commands = [{
readOnly: true
}, {
name: "gotoleft",
+ description: "Go to left",
bindKey: bindKey("Left", "Left|Ctrl-B"),
exec: function(editor, args) { editor.navigateLeft(args.times); },
multiSelectAction: "forEach",
@@ -293,6 +318,7 @@ exports.commands = [{
readOnly: true
}, {
name: "selectwordright",
+ description: "Select word right",
bindKey: bindKey("Ctrl-Shift-Right", "Option-Shift-Right"),
exec: function(editor) { editor.getSelection().selectWordRight(); },
multiSelectAction: "forEach",
@@ -300,6 +326,7 @@ exports.commands = [{
readOnly: true
}, {
name: "gotowordright",
+ description: "Go to word right",
bindKey: bindKey("Ctrl-Right", "Option-Right"),
exec: function(editor) { editor.navigateWordRight(); },
multiSelectAction: "forEach",
@@ -307,6 +334,7 @@ exports.commands = [{
readOnly: true
}, {
name: "selecttolineend",
+ description: "Select to line end",
bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right|Shift-End|Ctrl-Shift-E"),
exec: function(editor) { editor.getSelection().selectLineEnd(); },
multiSelectAction: "forEach",
@@ -314,6 +342,7 @@ exports.commands = [{
readOnly: true
}, {
name: "gotolineend",
+ description: "Go to line end",
bindKey: bindKey("Alt-Right|End", "Command-Right|End|Ctrl-E"),
exec: function(editor) { editor.navigateLineEnd(); },
multiSelectAction: "forEach",
@@ -321,6 +350,7 @@ exports.commands = [{
readOnly: true
}, {
name: "selectright",
+ description: "Select right",
bindKey: bindKey("Shift-Right", "Shift-Right"),
exec: function(editor) { editor.getSelection().selectRight(); },
multiSelectAction: "forEach",
@@ -328,6 +358,7 @@ exports.commands = [{
readOnly: true
}, {
name: "gotoright",
+ description: "Go to right",
bindKey: bindKey("Right", "Right|Ctrl-F"),
exec: function(editor, args) { editor.navigateRight(args.times); },
multiSelectAction: "forEach",
@@ -335,46 +366,55 @@ exports.commands = [{
readOnly: true
}, {
name: "selectpagedown",
+ description: "Select page down",
bindKey: "Shift-PageDown",
exec: function(editor) { editor.selectPageDown(); },
readOnly: true
}, {
name: "pagedown",
+ description: "Page down",
bindKey: bindKey(null, "Option-PageDown"),
exec: function(editor) { editor.scrollPageDown(); },
readOnly: true
}, {
name: "gotopagedown",
+ description: "Go to page down",
bindKey: bindKey("PageDown", "PageDown|Ctrl-V"),
exec: function(editor) { editor.gotoPageDown(); },
readOnly: true
}, {
name: "selectpageup",
+ description: "Select page up",
bindKey: "Shift-PageUp",
exec: function(editor) { editor.selectPageUp(); },
readOnly: true
}, {
name: "pageup",
+ description: "Page up",
bindKey: bindKey(null, "Option-PageUp"),
exec: function(editor) { editor.scrollPageUp(); },
readOnly: true
}, {
name: "gotopageup",
+ description: "Go to page up",
bindKey: "PageUp",
exec: function(editor) { editor.gotoPageUp(); },
readOnly: true
}, {
name: "scrollup",
+ description: "Scroll up",
bindKey: bindKey("Ctrl-Up", null),
exec: function(e) { e.renderer.scrollBy(0, -2 * e.renderer.layerConfig.lineHeight); },
readOnly: true
}, {
name: "scrolldown",
+ description: "Scroll down",
bindKey: bindKey("Ctrl-Down", null),
exec: function(e) { e.renderer.scrollBy(0, 2 * e.renderer.layerConfig.lineHeight); },
readOnly: true
}, {
name: "selectlinestart",
+ description: "Select line start",
bindKey: "Shift-Home",
exec: function(editor) { editor.getSelection().selectLineStart(); },
multiSelectAction: "forEach",
@@ -382,6 +422,7 @@ exports.commands = [{
readOnly: true
}, {
name: "selectlineend",
+ description: "Select line end",
bindKey: "Shift-End",
exec: function(editor) { editor.getSelection().selectLineEnd(); },
multiSelectAction: "forEach",
@@ -389,16 +430,19 @@ exports.commands = [{
readOnly: true
}, {
name: "togglerecording",
+ description: "Toggle recording",
bindKey: bindKey("Ctrl-Alt-E", "Command-Option-E"),
exec: function(editor) { editor.commands.toggleRecording(editor); },
readOnly: true
}, {
name: "replaymacro",
+ description: "Replay macro",
bindKey: bindKey("Ctrl-Shift-E", "Command-Shift-E"),
exec: function(editor) { editor.commands.replay(editor); },
readOnly: true
}, {
name: "jumptomatching",
+ description: "Jump to matching",
bindKey: bindKey("Ctrl-P", "Ctrl-P"),
exec: function(editor) { editor.jumpToMatching(); },
multiSelectAction: "forEach",
@@ -406,6 +450,7 @@ exports.commands = [{
readOnly: true
}, {
name: "selecttomatching",
+ description: "Select to matching",
bindKey: bindKey("Ctrl-Shift-P", "Ctrl-Shift-P"),
exec: function(editor) { editor.jumpToMatching(true); },
multiSelectAction: "forEach",
@@ -413,6 +458,7 @@ exports.commands = [{
readOnly: true
}, {
name: "expandToMatching",
+ description: "Expand to matching",
bindKey: bindKey("Ctrl-Shift-M", "Ctrl-Shift-M"),
exec: function(editor) { editor.jumpToMatching(true, true); },
multiSelectAction: "forEach",
@@ -420,12 +466,14 @@ exports.commands = [{
readOnly: true
}, {
name: "passKeysToBrowser",
+ description: "Pass keys to browser",
bindKey: bindKey(null, null),
exec: function() {},
passEvent: true,
readOnly: true
}, {
name: "copy",
+ description: "Copy",
exec: function(editor) {
// placeholder for replay macro
},
@@ -435,6 +483,7 @@ exports.commands = [{
// commands disabled in readOnly mode
{
name: "cut",
+ description: "Cut",
exec: function(editor) {
var cutLine = editor.$copyWithEmptySelection && editor.selection.isEmpty();
var range = cutLine ? editor.selection.getLineRange() : editor.selection.getRange();
@@ -448,94 +497,111 @@ exports.commands = [{
multiSelectAction: "forEach"
}, {
name: "paste",
+ description: "Paste",
exec: function(editor, args) {
editor.$handlePaste(args);
},
scrollIntoView: "cursor"
}, {
name: "removeline",
+ description: "Remove line",
bindKey: bindKey("Ctrl-D", "Command-D"),
exec: function(editor) { editor.removeLines(); },
scrollIntoView: "cursor",
multiSelectAction: "forEachLine"
}, {
name: "duplicateSelection",
+ description: "Duplicate selection",
bindKey: bindKey("Ctrl-Shift-D", "Command-Shift-D"),
exec: function(editor) { editor.duplicateSelection(); },
scrollIntoView: "cursor",
multiSelectAction: "forEach"
}, {
name: "sortlines",
+ description: "Sort lines",
bindKey: bindKey("Ctrl-Alt-S", "Command-Alt-S"),
exec: function(editor) { editor.sortLines(); },
scrollIntoView: "selection",
multiSelectAction: "forEachLine"
}, {
name: "togglecomment",
+ description: "Toggle comment",
bindKey: bindKey("Ctrl-/", "Command-/"),
exec: function(editor) { editor.toggleCommentLines(); },
multiSelectAction: "forEachLine",
scrollIntoView: "selectionPart"
}, {
name: "toggleBlockComment",
+ description: "Toggle block comment",
bindKey: bindKey("Ctrl-Shift-/", "Command-Shift-/"),
exec: function(editor) { editor.toggleBlockComment(); },
multiSelectAction: "forEach",
scrollIntoView: "selectionPart"
}, {
name: "modifyNumberUp",
+ description: "Modify number up",
bindKey: bindKey("Ctrl-Shift-Up", "Alt-Shift-Up"),
exec: function(editor) { editor.modifyNumber(1); },
scrollIntoView: "cursor",
multiSelectAction: "forEach"
}, {
name: "modifyNumberDown",
+ description: "Modify number down",
bindKey: bindKey("Ctrl-Shift-Down", "Alt-Shift-Down"),
exec: function(editor) { editor.modifyNumber(-1); },
scrollIntoView: "cursor",
multiSelectAction: "forEach"
}, {
name: "replace",
+ description: "Replace",
bindKey: bindKey("Ctrl-H", "Command-Option-F"),
exec: function(editor) {
config.loadModule("ace/ext/searchbox", function(e) {e.Search(editor, true);});
}
}, {
name: "undo",
+ description: "Undo",
bindKey: bindKey("Ctrl-Z", "Command-Z"),
exec: function(editor) { editor.undo(); }
}, {
name: "redo",
+ description: "Redo",
bindKey: bindKey("Ctrl-Shift-Z|Ctrl-Y", "Command-Shift-Z|Command-Y"),
exec: function(editor) { editor.redo(); }
}, {
name: "copylinesup",
+ description: "Copy lines up",
bindKey: bindKey("Alt-Shift-Up", "Command-Option-Up"),
exec: function(editor) { editor.copyLinesUp(); },
scrollIntoView: "cursor"
}, {
name: "movelinesup",
+ description: "Move lines up",
bindKey: bindKey("Alt-Up", "Option-Up"),
exec: function(editor) { editor.moveLinesUp(); },
scrollIntoView: "cursor"
}, {
name: "copylinesdown",
+ description: "Copy lines down",
bindKey: bindKey("Alt-Shift-Down", "Command-Option-Down"),
exec: function(editor) { editor.copyLinesDown(); },
scrollIntoView: "cursor"
}, {
name: "movelinesdown",
+ description: "Move lines down",
bindKey: bindKey("Alt-Down", "Option-Down"),
exec: function(editor) { editor.moveLinesDown(); },
scrollIntoView: "cursor"
}, {
name: "del",
+ description: "Delete",
bindKey: bindKey("Delete", "Delete|Ctrl-D|Shift-Delete"),
exec: function(editor) { editor.remove("right"); },
multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, {
name: "backspace",
+ description: "Backspace",
bindKey: bindKey(
"Shift-Backspace|Backspace",
"Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"
@@ -545,6 +611,7 @@ exports.commands = [{
scrollIntoView: "cursor"
}, {
name: "cut_or_delete",
+ description: "Cut or delete",
bindKey: bindKey("Shift-Delete", null),
exec: function(editor) {
if (editor.selection.isEmpty()) {
@@ -557,18 +624,21 @@ exports.commands = [{
scrollIntoView: "cursor"
}, {
name: "removetolinestart",
+ description: "Remove to line start",
bindKey: bindKey("Alt-Backspace", "Command-Backspace"),
exec: function(editor) { editor.removeToLineStart(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, {
name: "removetolineend",
+ description: "Remove to line end",
bindKey: bindKey("Alt-Delete", "Ctrl-K|Command-Delete"),
exec: function(editor) { editor.removeToLineEnd(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, {
name: "removetolinestarthard",
+ description: "Remove to line start hard",
bindKey: bindKey("Ctrl-Shift-Backspace", null),
exec: function(editor) {
var range = editor.selection.getRange();
@@ -579,6 +649,7 @@ exports.commands = [{
scrollIntoView: "cursor"
}, {
name: "removetolineendhard",
+ description: "Remove to line end hard",
bindKey: bindKey("Ctrl-Shift-Delete", null),
exec: function(editor) {
var range = editor.selection.getRange();
@@ -589,47 +660,55 @@ exports.commands = [{
scrollIntoView: "cursor"
}, {
name: "removewordleft",
+ description: "Remove word left",
bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"),
exec: function(editor) { editor.removeWordLeft(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, {
name: "removewordright",
+ description: "Remove word right",
bindKey: bindKey("Ctrl-Delete", "Alt-Delete"),
exec: function(editor) { editor.removeWordRight(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, {
name: "outdent",
+ description: "Outdent",
bindKey: bindKey("Shift-Tab", "Shift-Tab"),
exec: function(editor) { editor.blockOutdent(); },
multiSelectAction: "forEach",
scrollIntoView: "selectionPart"
}, {
name: "indent",
+ description: "Indent",
bindKey: bindKey("Tab", "Tab"),
exec: function(editor) { editor.indent(); },
multiSelectAction: "forEach",
scrollIntoView: "selectionPart"
}, {
name: "blockoutdent",
+ description: "Block outdent",
bindKey: bindKey("Ctrl-[", "Ctrl-["),
exec: function(editor) { editor.blockOutdent(); },
multiSelectAction: "forEachLine",
scrollIntoView: "selectionPart"
}, {
name: "blockindent",
+ description: "Block indent",
bindKey: bindKey("Ctrl-]", "Ctrl-]"),
exec: function(editor) { editor.blockIndent(); },
multiSelectAction: "forEachLine",
scrollIntoView: "selectionPart"
}, {
name: "insertstring",
+ description: "Insert string",
exec: function(editor, str) { editor.insert(str); },
multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, {
name: "inserttext",
+ description: "Insert text",
exec: function(editor, args) {
editor.insert(lang.stringRepeat(args.text || "", args.times || 1));
},
@@ -637,30 +716,35 @@ exports.commands = [{
scrollIntoView: "cursor"
}, {
name: "splitline",
+ description: "Split line",
bindKey: bindKey(null, "Ctrl-O"),
exec: function(editor) { editor.splitLine(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, {
name: "transposeletters",
+ description: "Transpose letters",
bindKey: bindKey("Alt-Shift-X", "Ctrl-T"),
exec: function(editor) { editor.transposeLetters(); },
multiSelectAction: function(editor) {editor.transposeSelections(1); },
scrollIntoView: "cursor"
}, {
name: "touppercase",
+ description: "To uppercase",
bindKey: bindKey("Ctrl-U", "Ctrl-U"),
exec: function(editor) { editor.toUpperCase(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, {
name: "tolowercase",
+ description: "To lowercase",
bindKey: bindKey("Ctrl-Shift-U", "Ctrl-Shift-U"),
exec: function(editor) { editor.toLowerCase(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, {
name: "expandtoline",
+ description: "Expand to line",
bindKey: bindKey("Ctrl-Shift-L", "Command-Shift-L"),
exec: function(editor) {
var range = editor.selection.getRange();
@@ -674,6 +758,7 @@ exports.commands = [{
readOnly: true
}, {
name: "joinlines",
+ description: "Join lines",
bindKey: bindKey(null, null),
exec: function(editor) {
var isBackwards = editor.selection.isBackwards();
@@ -714,6 +799,7 @@ exports.commands = [{
readOnly: true
}, {
name: "invertSelection",
+ description: "Invert selection",
bindKey: bindKey(null, null),
exec: function(editor) {
var endRow = editor.session.doc.getLength() - 1;
@@ -753,6 +839,22 @@ exports.commands = [{
},
readOnly: true,
scrollIntoView: "none"
+}, {
+ name: "openCommandPallete",
+ description: "Open command pallete",
+ bindKey: bindKey("F1", "F1"),
+ exec: function(editor) {
+ editor.prompt({ $type: "commands" });
+ },
+ readOnly: true
+}, {
+ name: "modeSelect",
+ description: "Change language mode...",
+ bindKey: bindKey(null, null),
+ exec: function(editor) {
+ editor.prompt({ $type: "modes" });
+ },
+ readOnly: true
}];
});
diff --git a/lib/ace/commands/multi_select_commands.js b/lib/ace/commands/multi_select_commands.js
index 26adc8351fb..361f625458e 100644
--- a/lib/ace/commands/multi_select_commands.js
+++ b/lib/ace/commands/multi_select_commands.js
@@ -33,64 +33,75 @@ define(function(require, exports, module) {
// commands to enter multiselect mode
exports.defaultCommands = [{
name: "addCursorAbove",
+ description: "Add cursor above",
exec: function(editor) { editor.selectMoreLines(-1); },
bindKey: {win: "Ctrl-Alt-Up", mac: "Ctrl-Alt-Up"},
scrollIntoView: "cursor",
readOnly: true
}, {
name: "addCursorBelow",
+ description: "Add cursor below",
exec: function(editor) { editor.selectMoreLines(1); },
bindKey: {win: "Ctrl-Alt-Down", mac: "Ctrl-Alt-Down"},
scrollIntoView: "cursor",
readOnly: true
}, {
name: "addCursorAboveSkipCurrent",
+ description: "Add cursor above (skip current)",
exec: function(editor) { editor.selectMoreLines(-1, true); },
bindKey: {win: "Ctrl-Alt-Shift-Up", mac: "Ctrl-Alt-Shift-Up"},
scrollIntoView: "cursor",
readOnly: true
}, {
name: "addCursorBelowSkipCurrent",
+ description: "Add cursor below (skip current)",
exec: function(editor) { editor.selectMoreLines(1, true); },
bindKey: {win: "Ctrl-Alt-Shift-Down", mac: "Ctrl-Alt-Shift-Down"},
scrollIntoView: "cursor",
readOnly: true
}, {
name: "selectMoreBefore",
+ description: "Select more before",
exec: function(editor) { editor.selectMore(-1); },
bindKey: {win: "Ctrl-Alt-Left", mac: "Ctrl-Alt-Left"},
scrollIntoView: "cursor",
readOnly: true
}, {
name: "selectMoreAfter",
+ description: "Select more after",
exec: function(editor) { editor.selectMore(1); },
bindKey: {win: "Ctrl-Alt-Right", mac: "Ctrl-Alt-Right"},
scrollIntoView: "cursor",
readOnly: true
}, {
name: "selectNextBefore",
+ description: "Select next before",
exec: function(editor) { editor.selectMore(-1, true); },
bindKey: {win: "Ctrl-Alt-Shift-Left", mac: "Ctrl-Alt-Shift-Left"},
scrollIntoView: "cursor",
readOnly: true
}, {
name: "selectNextAfter",
+ description: "Select next after",
exec: function(editor) { editor.selectMore(1, true); },
bindKey: {win: "Ctrl-Alt-Shift-Right", mac: "Ctrl-Alt-Shift-Right"},
scrollIntoView: "cursor",
readOnly: true
}, {
name: "splitIntoLines",
+ description: "Split into lines",
exec: function(editor) { editor.multiSelect.splitIntoLines(); },
bindKey: {win: "Ctrl-Alt-L", mac: "Ctrl-Alt-L"},
readOnly: true
}, {
name: "alignCursors",
+ description: "Align cursors",
exec: function(editor) { editor.alignCursors(); },
bindKey: {win: "Ctrl-Alt-A", mac: "Ctrl-Alt-A"},
scrollIntoView: "cursor"
}, {
name: "findAll",
+ description: "Find all",
exec: function(editor) { editor.findAll(); },
bindKey: {win: "Ctrl-Alt-K", mac: "Ctrl-Alt-G"},
scrollIntoView: "cursor",
@@ -100,6 +111,7 @@ exports.defaultCommands = [{
// commands active only in multiselect mode
exports.multiSelectCommands = [{
name: "singleSelection",
+ description: "Single selection",
bindKey: "esc",
exec: function(editor) { editor.exitMultiSelectMode(); },
scrollIntoView: "cursor",
diff --git a/lib/ace/editor.js b/lib/ace/editor.js
index 4c3e4f020ae..70a37ad482c 100644
--- a/lib/ace/editor.js
+++ b/lib/ace/editor.js
@@ -2735,6 +2735,16 @@ Editor.$uid = 0;
dom.setCssClass(cursorLayer.element, "ace_slim-cursors", /slim/.test(style));
};
+ /**
+ * opens a prompt displaying message
+ **/
+ this.prompt = function(message, options, callback) {
+ var editor = this;
+ config.loadModule("./ext/prompt", function (module) {
+ module.prompt(editor, message, options, callback);
+ });
+ };
+
}).call(Editor.prototype);
diff --git a/lib/ace/ext/beautify.js b/lib/ace/ext/beautify.js
index 98f6abfef1b..a15bfbd8a9c 100644
--- a/lib/ace/ext/beautify.js
+++ b/lib/ace/ext/beautify.js
@@ -398,6 +398,7 @@ exports.beautify = function(session) {
exports.commands = [{
name: "beautify",
+ description: "Format selection (Beautify)",
exec: function(editor) {
exports.beautify(editor.session);
},
diff --git a/lib/ace/ext/keybinding_menu.js b/lib/ace/ext/keybinding_menu.js
index 38e578d81f4..0898d7283a2 100644
--- a/lib/ace/ext/keybinding_menu.js
+++ b/lib/ace/ext/keybinding_menu.js
@@ -67,7 +67,7 @@ define(function(require, exports, module) {
el.id = 'kbshortcutmenu';
el.innerHTML = 'Keyboard Shortcuts ' + commands + '';
- overlayPage(editor, el, '0', '0', '0', null);
+ overlayPage(editor, el);
}
}
module.exports.init = function(editor) {
diff --git a/lib/ace/ext/menu_tools/overlay_page.js b/lib/ace/ext/menu_tools/overlay_page.js
index bf985e29c6a..3ab3415d6ab 100644
--- a/lib/ace/ext/menu_tools/overlay_page.js
+++ b/lib/ace/ext/menu_tools/overlay_page.js
@@ -57,60 +57,46 @@ dom.importCssString(cssText);
* ☭ Hial Atropa!! ☭
* @param {DOMElement} contentElement Any element which may be presented inside
* a div.
- * @param {string|number} top absolute position value.
- * @param {string|number} right absolute position value.
- * @param {string|number} bottom absolute position value.
- * @param {string|number} left absolute position value.
*/
-module.exports.overlayPage = function overlayPage(editor, contentElement, top, right, bottom, left) {
- top = top ? 'top: ' + top + ';' : '';
- bottom = bottom ? 'bottom: ' + bottom + ';' : '';
- right = right ? 'right: ' + right + ';' : '';
- left = left ? 'left: ' + left + ';' : '';
+module.exports.overlayPage = function overlayPage(editor, contentElement, callback) {
var closer = document.createElement('div');
- var contentContainer = document.createElement('div');
function documentEscListener(e) {
if (e.keyCode === 27) {
- closer.click();
+ close();
}
}
+ function close() {
+ if (!closer) return;
+ document.removeEventListener('keydown', documentEscListener);
+ closer.parentNode.removeChild(closer);
+ editor.focus();
+ closer = null;
+ callback && callback();
+ }
+
closer.style.cssText = 'margin: 0; padding: 0; ' +
'position: fixed; top:0; bottom:0; left:0; right:0;' +
'z-index: 9990; ' +
'background-color: rgba(0, 0, 0, 0.3);';
closer.addEventListener('click', function() {
- document.removeEventListener('keydown', documentEscListener);
- closer.parentNode.removeChild(closer);
- editor.focus();
- closer = null;
+ close();
});
// click closer if esc key is pressed
document.addEventListener('keydown', documentEscListener);
- contentContainer.style.cssText = top + right + bottom + left;
- contentContainer.addEventListener('click', function(e) {
+ contentElement.addEventListener('click', function (e) {
e.stopPropagation();
});
- var wrapper = dom.createElement("div");
- wrapper.style.position = "relative";
-
- var closeButton = dom.createElement("div");
- closeButton.className = "ace_closeButton";
- closeButton.addEventListener('click', function() {
- closer.click();
- });
-
- wrapper.appendChild(closeButton);
- contentContainer.appendChild(wrapper);
-
- contentContainer.appendChild(contentElement);
- closer.appendChild(contentContainer);
+ closer.appendChild(contentElement);
document.body.appendChild(closer);
editor.blur();
+ return {
+ close: close
+ };
};
});
\ No newline at end of file
diff --git a/lib/ace/ext/prompt.js b/lib/ace/ext/prompt.js
new file mode 100644
index 00000000000..e0c50f056bf
--- /dev/null
+++ b/lib/ace/ext/prompt.js
@@ -0,0 +1,472 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Ajax.org B.V. nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var Range = require("../range").Range;
+var dom = require("../lib/dom");
+var shortcuts = require("../ext/menu_tools/get_editor_keyboard_shortcuts");
+var FilteredList= require("../autocomplete").FilteredList;
+var AcePopup = require('../autocomplete/popup').AcePopup;
+var $singleLineEditor = require('../autocomplete/popup').$singleLineEditor;
+var UndoManager = require("../undomanager").UndoManager;
+var Tokenizer = require("ace/tokenizer").Tokenizer;
+var overlayPage = require('./menu_tools/overlay_page').overlayPage;
+var modelist = require("ace/ext/modelist");
+var openPrompt;
+
+function prompt(editor, message, options, callback) {
+ if (typeof message == "object") {
+ return prompt(editor, "", message, options);
+ }
+ if (openPrompt) {
+ var lastPrompt = openPrompt;
+ editor = lastPrompt.editor;
+ lastPrompt.close();
+ if (lastPrompt.name && lastPrompt.name == options.name)
+ return;
+ }
+ if (options.$type)
+ return prompt[options.$type](editor, callback);
+
+ var cmdLine = $singleLineEditor();
+ cmdLine.session.setUndoManager(new UndoManager());
+ cmdLine.setOption("fontSize", editor.getOption("fontSize"));
+
+ var el = dom.buildDom(["div", {class: "ace_prompt_container"}]);
+ var overlay = overlayPage(editor, el, done);
+ el.appendChild(cmdLine.container);
+
+ editor.cmdLine = cmdLine;
+ cmdLine.setValue(message, 1);
+ if (options.selection) {
+ cmdLine.selection.setRange({
+ start: cmdLine.session.doc.indexToPosition(options.selection[0]),
+ end: cmdLine.session.doc.indexToPosition(options.selection[1])
+ });
+ }
+
+ if (options.getCompletions) {
+ var popup = new AcePopup();
+ popup.renderer.setStyle("ace_autocomplete_inline");
+ popup.container.style.display = "block";
+ popup.container.style.maxWidth = "600px";
+ popup.container.style.width = "100%";
+ popup.container.style.marginTop = "3px";
+ popup.renderer.setScrollMargin(2, 2, 0, 0);
+ popup.autoSelect = false;
+ popup.renderer.$maxLines = 15;
+ popup.setRow(-1);
+ popup.on("click", function(e) {
+ var data = popup.getData(popup.getRow());
+ if (!data.error) {
+ cmdLine.setValue(data.value || data.name || data);
+ accept();
+ e.stop();
+ }
+ });
+ el.appendChild(popup.container);
+ updateCompletions();
+ }
+
+ if (options.$rules) {
+ var tokenizer = new Tokenizer(options.$rules);
+ cmdLine.session.bgTokenizer.setTokenizer(tokenizer);
+ }
+
+ function accept() {
+ var val;
+ if (popup.getCursorPosition().row > 0) {
+ val = valueFromRecentList();
+ } else {
+ val = cmdLine.getValue();
+ }
+ var curData = popup.getData(popup.getRow());
+ if (curData && !curData.error) {
+ done();
+ options.onAccept && options.onAccept({
+ value: val,
+ item: curData
+ }, cmdLine);
+ }
+ }
+
+ cmdLine.commands.bindKeys({
+ "Enter": accept,
+ "Esc|Shift-Esc": function() {
+ options.onCancel && options.onCancel(cmdLine.getValue(), cmdLine);
+ done();
+ },
+ "Up": function(editor) { popup.goTo("up"); valueFromRecentList();},
+ "Down": function(editor) { popup.goTo("down"); valueFromRecentList();},
+ "Ctrl-Up|Ctrl-Home": function(editor) { popup.goTo("start"); valueFromRecentList();},
+ "Ctrl-Down|Ctrl-End": function(editor) { popup.goTo("end"); valueFromRecentList();},
+ "Tab": function(editor) {
+ popup.goTo("down"); valueFromRecentList();
+ },
+ "PageUp": function(editor) { popup.gotoPageUp(); valueFromRecentList();},
+ "PageDown": function(editor) { popup.gotoPageDown(); valueFromRecentList();}
+ });
+
+ function done() {
+ overlay.close();
+ callback && callback();
+ openPrompt = null;
+ }
+
+ cmdLine.on("input", function() {
+ options.onInput && options.onInput();
+ updateCompletions();
+ });
+
+ function updateCompletions() {
+ if (options.getCompletions) {
+ var prefix;
+ if (options.getPrefix) {
+ prefix = options.getPrefix(cmdLine);
+ }
+
+ var completions = options.getCompletions(cmdLine);
+ popup.setData(completions, prefix);
+ popup.resize(true);
+ }
+ }
+
+ function valueFromRecentList() {
+ var current = popup.getData(popup.getRow());
+ if (current && !current.error)
+ return current.value || current.caption || current;
+ }
+
+ cmdLine.resize(true);
+ popup.resize(true);
+ cmdLine.focus();
+
+ openPrompt = {
+ close: done,
+ name: options.name,
+ editor: editor
+ };
+}
+
+prompt.gotoLine = function(editor, callback) {
+ function stringifySelection(selection) {
+ if (!Array.isArray(selection))
+ selection = [selection];
+ return selection.map(function(r) {
+ var cursor = r.isBackwards ? r.start: r.end;
+ var anchor = r.isBackwards ? r.end: r.start;
+ var row = anchor.row;
+ var s = (row + 1) + ":" + anchor.column;
+
+ if (anchor.row == cursor.row) {
+ if (anchor.column != cursor.column)
+ s += ">" + ":" + cursor.column;
+ } else {
+ s += ">" + (cursor.row + 1) + ":" + cursor.column;
+ }
+ return s;
+ }).reverse().join(", ");
+ }
+
+ prompt(editor, ":" + stringifySelection(editor.selection.toJSON()), {
+ name: "gotoLine",
+ selection: [1, Number.MAX_VALUE],
+ onAccept: function(data) {
+ var value = data.value;
+ var _history = prompt.gotoLine._history;
+ if (!_history)
+ prompt.gotoLine._history = _history = [];
+ if (_history.indexOf(value) != -1)
+ _history.splice(_history.indexOf(value), 1);
+ _history.unshift(value);
+ if (_history.length > 20) _history.length = 20;
+
+
+ var pos = editor.getCursorPosition();
+ var ranges = [];
+ value.replace(/^:/, "").split(/,/).map(function(str) {
+ var parts = str.split(/([<>:+-]|c?\d+)|[^c\d<>:+-]+/).filter(Boolean);
+ var i = 0;
+ function readPosition() {
+ var c = parts[i++];
+ if (!c) return;
+ if (c[0] == "c") {
+ var index = parseInt(c.slice(1)) || 0;
+ return editor.session.doc.indexToPosition(index);
+ }
+ var row = pos.row;
+ var column = 0;
+ if (/\d/.test(c)) {
+ row = parseInt(c) - 1;
+ c = parts[i++];
+ }
+ if (c == ":") {
+ c = parts[i++];
+ if (/\d/.test(c)) {
+ column = parseInt(c) || 0;
+ }
+ }
+ return {row: row, column: column};
+ }
+ pos = readPosition();
+ var range = Range.fromPoints(pos, pos);
+ if (parts[i] == ">") {
+ i++;
+ range.end = readPosition();
+ }
+ else if (parts[i] == "<") {
+ i++;
+ range.start = readPosition();
+ }
+ ranges.unshift(range);
+ });
+ editor.selection.fromJSON(ranges);
+ var scrollTop = editor.renderer.scrollTop;
+ editor.renderer.scrollSelectionIntoView(
+ editor.selection.anchor,
+ editor.selection.cursor,
+ 0.5
+ );
+ editor.renderer.animateScrolling(scrollTop);
+ },
+ history: function() {
+ var undoManager = editor.session.getUndoManager();
+ if (!prompt.gotoLine._history)
+ return [];
+ return prompt.gotoLine._history;
+
+ },
+ getCompletions: function(cmdLine) {
+ var value = cmdLine.getValue();
+ var m = value.replace(/^:/, "").split(":");
+ var row = Math.min(parseInt(m[0]) || 1, editor.session.getLength()) - 1;
+ var line = editor.session.getLine(row);
+ var current = value + " " + line;
+ return [current].concat(this.history());
+ },
+ $rules: {
+ start: [{
+ regex: /\d+/,
+ token: "string"
+ }, {
+ regex: /[:,><+\-c]/,
+ token: "keyword"
+ }]
+ }
+ });
+};
+
+prompt.commands = function(editor, callback) {
+ function normalizeName(name) {
+ return (name || "").replace(/^./, function(x) {
+ return x.toUpperCase(x);
+ }).replace(/[a-z][A-Z]/g, function(x) {
+ return x[0] + " " + x[1].toLowerCase(x);
+ });
+ }
+ function getEditorCommandsByName(excludeCommands) {
+ var commandsByName = [];
+ var commandMap = {};
+ editor.keyBinding.$handlers.forEach(function(handler) {
+ var platform = handler.platform;
+ var cbn = handler.byName;
+ for (var i in cbn) {
+ var key;
+ if (cbn[i].bindKey && cbn[i].bindKey[platform] !== null) {
+ key = cbn[i].bindKey["win"];
+ } else {
+ key = "";
+ }
+
+ var commands = cbn[i];
+ var description = commands.description || normalizeName(commands.name);
+ if (!Array.isArray(commands))
+ commands = [commands];
+ commands.forEach(function(command) {
+ if (typeof command != "string")
+ command = command.name;
+ var needle = excludeCommands.find(function(el) {
+ return el === command;
+ });
+ if (!needle) {
+ if (commandMap[command]) {
+ commandMap[command].key += "|" + key;
+ } else {
+ commandMap[command] = {key: key, command: command, description: description};
+ commandsByName.push(commandMap[command]);
+ }
+ }
+ });
+ }
+ });
+ return commandsByName;
+ }
+ // exclude commands that can not be executed without args
+ var excludeCommandsList = ["insertstring", "inserttext", "setIndentation", "paste"];
+ var shortcutsArray = getEditorCommandsByName(excludeCommandsList);
+ shortcutsArray = shortcutsArray.map(function(item) {
+ return {value: item.description, meta: item.key, command: item.command};
+ });
+ prompt(editor, "", {
+ name: "commands",
+ selection: [0, Number.MAX_VALUE],
+ maxHistoryCount: 5,
+ onAccept: function(data) {
+ if (data.item) {
+ var commandName = data.item.command;
+ this.addToHistory(data.item);
+
+ editor.execCommand(commandName);
+ }
+ },
+ addToHistory: function(item) {
+ var history = this.history();
+ history.unshift(item);
+ delete item.message;
+ for (var i = 1; i < history.length; i++) {
+ if (history[i]["command"] == item.command ) {
+ history.splice(i, 1);
+ break;
+ }
+ }
+ if (this.maxHistoryCount > 0 && history.length > this.maxHistoryCount) {
+ history.splice(history.length - 1, 1);
+ }
+ prompt.commands.history = history;
+ },
+ history: function() {
+ return prompt.commands.history || [];
+ },
+ getPrefix: function(cmdLine) {
+ var currentPos = cmdLine.getCursorPosition();
+ var filterValue = cmdLine.getValue();
+ return filterValue.substring(0, currentPos.column);
+ },
+ getCompletions: function(cmdLine) {
+ function getFilteredCompletions(commands, prefix) {
+ var resultCommands = JSON.parse(JSON.stringify(commands));
+
+ var filtered = new FilteredList(resultCommands);
+ return filtered.filterCompletions(resultCommands, prefix);
+ }
+
+ function getUniqueCommandList(commands, usedCommands) {
+ if (!usedCommands || !usedCommands.length) {
+ return commands;
+ }
+ var excludeCommands = [];
+ usedCommands.forEach(function(item) {
+ excludeCommands.push(item.command);
+ });
+
+ var resultCommands = [];
+
+ commands.forEach(function(item) {
+ if (excludeCommands.indexOf(item.command) === -1) {
+ resultCommands.push(item);
+ }
+ });
+
+ return resultCommands;
+ }
+
+ var prefix = this.getPrefix(cmdLine);
+ var recentlyUsedCommands = getFilteredCompletions(this.history(), prefix);
+ var otherCommands = getUniqueCommandList(shortcutsArray, recentlyUsedCommands);
+ otherCommands = getFilteredCompletions(otherCommands, prefix);
+
+ if (recentlyUsedCommands.length && otherCommands.length) {
+ recentlyUsedCommands[0]["message"] = " Recently used";
+ otherCommands[0]["message"] = " Other commands";
+ }
+
+ var completions = recentlyUsedCommands.concat(otherCommands);
+ return completions.length > 0 ? completions : [{
+ value: "No matching commands",
+ error: 1
+ }];
+ }
+ });
+};
+
+prompt.modes = function(editor, callback) {
+ var modesArray = modelist.modes;
+ modesArray = modesArray.map(function(item) {
+ return {value: item.caption, mode: item.name};
+ });
+ prompt(editor, "", {
+ name: "modes",
+ selection: [0, Number.MAX_VALUE],
+ onAccept: function(data) {
+ if (data.item) {
+ var modeName = "ace/mode/" + data.item.mode;
+ editor.session.setMode(modeName);
+ }
+ },
+ getPrefix: function(cmdLine) {
+ var currentPos = cmdLine.getCursorPosition();
+ var filterValue = cmdLine.getValue();
+ return filterValue.substring(0, currentPos.column);
+ },
+ getCompletions: function(cmdLine) {
+ function getFilteredCompletions(modes, prefix) {
+ var resultCommands = JSON.parse(JSON.stringify(modes));
+
+ var filtered = new FilteredList(resultCommands);
+ return filtered.filterCompletions(resultCommands, prefix);
+ }
+
+ var prefix = this.getPrefix(cmdLine);
+ var completions = getFilteredCompletions(modesArray, prefix);
+ return completions.length > 0 ? completions : [{
+ "caption": "No mode matching",
+ "value": "No mode matching",
+ "error": 1
+ }];
+ }
+ });
+};
+
+dom.importCssString(".ace_prompt_container {\
+ max-width: 600px;\
+ width: 100%;\
+ margin: 20px auto;\
+ padding: 3px;\
+ background: white;\
+ border-radius: 2px;\
+ box-shadow: 0px 2px 3px 0px #555;\
+}");
+
+
+exports.prompt = prompt;
+
+});
diff --git a/lib/ace/ext/settings_menu.js b/lib/ace/ext/settings_menu.js
index 7ead5f9eeca..b03dfffe411 100644
--- a/lib/ace/ext/settings_menu.js
+++ b/lib/ace/ext/settings_menu.js
@@ -60,7 +60,7 @@ function showSettingsMenu(editor) {
var options = new OptionPanel(editor);
options.render();
options.container.id = "ace_settingsmenu";
- overlayPage(editor, options.container, '0', '0', '0');
+ overlayPage(editor, options.container);
options.container.querySelector("select,input,button,checkbox").focus();
}
}
diff --git a/lib/ace/ext/whitespace.js b/lib/ace/ext/whitespace.js
index d820a6902b4..b8044813618 100644
--- a/lib/ace/ext/whitespace.js
+++ b/lib/ace/ext/whitespace.js
@@ -216,23 +216,27 @@ exports.$parseArg = function(arg) {
exports.commands = [{
name: "detectIndentation",
+ description: "Detect indentation from content",
exec: function(editor) {
exports.detectIndentation(editor.session);
// todo show message?
}
}, {
name: "trimTrailingSpace",
+ description: "Trim trailing whitespace",
exec: function(editor, args) {
exports.trimTrailingSpace(editor.session, args);
}
}, {
name: "convertIndentation",
+ description: "Convert indentation to ...",
exec: function(editor, arg) {
var indent = exports.$parseArg(arg);
exports.convertIndentation(editor.session, indent.ch, indent.length);
}
}, {
name: "setIndentation",
+ description: "Set indentation",
exec: function(editor, arg) {
var indent = exports.$parseArg(arg);
indent.length && editor.session.setTabSize(indent.length);
diff --git a/lib/ace/selection.js b/lib/ace/selection.js
index 6be44c7a8b4..bf44460341c 100644
--- a/lib/ace/selection.js
+++ b/lib/ace/selection.js
@@ -894,7 +894,7 @@ var Selection = function(session) {
this.fromJSON = function(data) {
if (data.start == undefined) {
- if (this.rangeList) {
+ if (this.rangeList && data.length > 1) {
this.toSingleRange(data[0]);
for (var i = data.length; i--; ) {
var r = Range.fromPoints(data[i].start, data[i].end);
From 14a06c1d6027a4b1d967bb147a0a36dfe46cf6e3 Mon Sep 17 00:00:00 2001
From: Ryan Lee
Date: Tue, 16 Apr 2019 14:01:28 +0800
Subject: [PATCH 0149/1293] Fix wrong "span"
It will append element like "[object HTMLSpanElement]" into valueFragment.
---
lib/ace/layer/text.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/ace/layer/text.js b/lib/ace/layer/text.js
index 5623bb427ec..b85d3ec43e3 100644
--- a/lib/ace/layer/text.js
+++ b/lib/ace/layer/text.js
@@ -387,7 +387,7 @@ var Text = function(parentEl) {
valueFragment.appendChild(span);
} else if (cjk) {
screenColumn += 1;
- var span = dom.createElement("span");
+ var span = this.dom.createElement("span");
span.style.width = (self.config.characterWidth * 2) + "px";
span.className = "ace_cjk";
span.textContent = cjk;
From 59985569f091b694822c987dcb965d6152ba3c4b Mon Sep 17 00:00:00 2001
From: Bruno Souza
Date: Tue, 16 Apr 2019 11:27:04 -0300
Subject: [PATCH 0150/1293] Fix changes variable overwrite
---
lib/ace/virtual_renderer.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/ace/virtual_renderer.js b/lib/ace/virtual_renderer.js
index 9dd767554d4..c82679aefcd 100644
--- a/lib/ace/virtual_renderer.js
+++ b/lib/ace/virtual_renderer.js
@@ -1061,7 +1061,7 @@ var VirtualRenderer = function(container, theme) {
// Horizontal scrollbar visibility may have changed, which changes
// the client height of the scroller
if (hScrollChanged || vScrollChanged) {
- changes = this.$updateCachedSize(true, this.gutterWidth, size.width, size.height);
+ changes += this.$updateCachedSize(true, this.gutterWidth, size.width, size.height);
this._signal("scrollbarVisibilityChanged");
if (vScrollChanged)
longestLine = this.$getLongestLine();
From 58a36fa805bd5cbe008a8df50d16a77770c4dedb Mon Sep 17 00:00:00 2001
From: Bruno Souza
Date: Thu, 18 Apr 2019 09:25:24 -0300
Subject: [PATCH 0151/1293] Fix changes variable overwrite bitwise or
---
lib/ace/virtual_renderer.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/ace/virtual_renderer.js b/lib/ace/virtual_renderer.js
index c82679aefcd..6f3aea37625 100644
--- a/lib/ace/virtual_renderer.js
+++ b/lib/ace/virtual_renderer.js
@@ -1061,7 +1061,7 @@ var VirtualRenderer = function(container, theme) {
// Horizontal scrollbar visibility may have changed, which changes
// the client height of the scroller
if (hScrollChanged || vScrollChanged) {
- changes += this.$updateCachedSize(true, this.gutterWidth, size.width, size.height);
+ changes |= this.$updateCachedSize(true, this.gutterWidth, size.width, size.height);
this._signal("scrollbarVisibilityChanged");
if (vScrollChanged)
longestLine = this.$getLongestLine();
From c483663034186d036e43818db71829c0614eee6a Mon Sep 17 00:00:00 2001
From: nightwing
Date: Tue, 23 Apr 2019 02:47:09 +0400
Subject: [PATCH 0152/1293] fix outdent regression in lua mode
---
index.html | 4 ++--
lib/ace/mode/folding/lua.js | 8 +++++++-
lib/ace/mode/lua.js | 33 +++++++++++++++++++++++----------
3 files changed, 32 insertions(+), 13 deletions(-)
diff --git a/index.html b/index.html
index b9d80172890..8177ad17088 100644
--- a/index.html
+++ b/index.html
@@ -133,8 +133,8 @@ History
Related Projects
diff --git a/lib/ace/mode/folding/lua.js b/lib/ace/mode/folding/lua.js
index f4b52334259..30c824d9d7e 100644
--- a/lib/ace/mode/folding/lua.js
+++ b/lib/ace/mode/folding/lua.js
@@ -108,7 +108,7 @@ oop.inherits(FoldMode, BaseFoldMode);
}
};
- this.luaBlock = function(session, row, column) {
+ this.luaBlock = function(session, row, column, tokenRange) {
var stream = new TokenIterator(session, row, column);
var indentKeywords = {
"function": 1,
@@ -151,6 +151,12 @@ oop.inherits(FoldMode, BaseFoldMode);
}
}
+ if (!token)
+ return null;
+
+ if (tokenRange)
+ return stream.getCurrentTokenRange();
+
var row = stream.getCurrentTokenRow();
if (dir === -1)
return new Range(row, session.getLine(row).length, startRow, startColumn);
diff --git a/lib/ace/mode/lua.js b/lib/ace/mode/lua.js
index 51c9304c557..752ce69dd6c 100644
--- a/lib/ace/mode/lua.js
+++ b/lib/ace/mode/lua.js
@@ -131,18 +131,31 @@ oop.inherits(Mode, TextMode);
return (tokens[0].type == "keyword" && outdentKeywords.indexOf(tokens[0].value) != -1);
};
+ this.getMatching = function(session, row, column) {
+ if (row == undefined) {
+ var pos = session.selection.lead;
+ column = pos.column;
+ row = pos.row;
+ }
+
+ var startToken = session.getTokenAt(row, column);
+ if (startToken && startToken.value in indentKeywords)
+ return this.foldingRules.luaBlock(session, row, column, true);
+ };
+
this.autoOutdent = function(state, session, row) {
- var prevLine = session.getLine(row - 1);
- var prevIndent = this.$getIndent(prevLine).length;
- var prevTokens = this.getTokenizer().getLineTokens(prevLine, "start").tokens;
- var tabLength = session.getTabString().length;
- var expectedIndent = prevIndent + tabLength * getNetIndentLevel(prevTokens);
- var curIndent = this.$getIndent(session.getLine(row)).length;
- if (curIndent <= expectedIndent) {
- // User already outdented //
- return;
+ var line = session.getLine(row);
+ var column = line.match(/^\s*/)[0].length;
+ if (!column || !row) return;
+
+ var startRange = this.getMatching(session, row, column + 1);
+ if (!startRange || startRange.start.row == row)
+ return;
+ var indent = this.$getIndent(session.getLine(startRange.start.row));
+ if (indent.length != column) {
+ session.replace(new Range(row, 0, row, column), indent);
+ session.outdentRows(new Range(row + 1, 0, row + 1, 0));
}
- session.outdentRows(new Range(row, 0, row + 2, 0));
};
this.createWorker = function(session) {
From 2a0d9ab03d5ce263c0ae8a280b3a4dd898be9936 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Wed, 24 Apr 2019 22:19:38 +0400
Subject: [PATCH 0153/1293] release v1.4.4
---
ChangeLog.txt | 5 +++++
build | 2 +-
lib/ace/ace.js | 2 +-
lib/ace/ext/modelist.js | 2 +-
package.json | 2 +-
5 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 6be5d6d98b1..06d9e104305 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,3 +1,8 @@
+2019.04.24 Version 1.4.4
+* add experimental command prompt
+* add chrystal, nim and nginx highlight rules
+* fix regression in vim mode on ios
+
2019.02.21 Version 1.4.3
* add sublime keybindings
* add rtl option
diff --git a/build b/build
index f17f0751fc4..5fe4368221f 160000
--- a/build
+++ b/build
@@ -1 +1 @@
-Subproject commit f17f0751fc4c2bb73cd9340e9cbc02e4d979608f
+Subproject commit 5fe4368221f48b114387c2e7d67c9cd904ec30a2
diff --git a/lib/ace/ace.js b/lib/ace/ace.js
index a40add50732..e34003b670e 100644
--- a/lib/ace/ace.js
+++ b/lib/ace/ace.js
@@ -132,5 +132,5 @@ exports.Editor = Editor;
exports.EditSession = EditSession;
exports.UndoManager = UndoManager;
exports.VirtualRenderer = Renderer;
-exports.version = "1.4.3";
+exports.version = "1.4.4";
});
diff --git a/lib/ace/ext/modelist.js b/lib/ace/ext/modelist.js
index f22ffc08f4f..bb14e3455ce 100644
--- a/lib/ace/ext/modelist.js
+++ b/lib/ace/ext/modelist.js
@@ -166,7 +166,7 @@ var supportedModes = {
Rust: ["rs"],
SASS: ["sass"],
SCAD: ["scad"],
- Scala: ["scala"],
+ Scala: ["scala|sbt"],
Scheme: ["scm|sm|rkt|oak|scheme"],
SCSS: ["scss"],
SH: ["sh|bash|^.bashrc"],
diff --git a/package.json b/package.json
index 7d4405cd5f1..30b08a160d2 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "ace",
"description": "Ajax.org Code Editor is a full featured source code highlighting editor that powers the Cloud9 IDE",
- "version": "1.4.3",
+ "version": "1.4.4",
"homepage": "http://github.com/ajaxorg/ace",
"engines": {
"node": ">= 0.6.0"
From 9d90696f6bcae3bcc7b16bd714a39e4c2fec9588 Mon Sep 17 00:00:00 2001
From: Kevin Ushey
Date: Thu, 25 Apr 2019 09:47:11 -0700
Subject: [PATCH 0154/1293] fix external selection check (closes #3943)
---
lib/ace/keyboard/vim.js | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/lib/ace/keyboard/vim.js b/lib/ace/keyboard/vim.js
index a9a04f8749d..acfb9a8c279 100644
--- a/lib/ace/keyboard/vim.js
+++ b/lib/ace/keyboard/vim.js
@@ -5854,7 +5854,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
}
vim.fakeCursor = cm.markText(from, to, {className: 'cm-animate-fat-cursor'});
}
- function handleExternalSelection(cm, vim) {
+ function handleExternalSelection(cm, vim, keepHPos) {
var anchor = cm.getCursor('anchor');
var head = cm.getCursor('head');
// Enter or exit visual mode to match mouse selection.
@@ -5878,7 +5878,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
};
updateMark(cm, vim, '<', cursorMin(head, anchor));
updateMark(cm, vim, '>', cursorMax(head, anchor));
- } else if (!vim.insertMode) {
+ } else if (!vim.insertMode && !keepHPos) {
// Reset lastHPos if selection was modified by something outside of vim mode e.g. by mouse.
vim.lastHPos = cm.getCursor().ch;
}
@@ -6064,15 +6064,16 @@ dom.importCssString(".normal-mode .ace_cursor{\
var isHandled = false;
var vim = Vim.maybeInitVimState_(cm);
var visualBlock = vim.visualBlock || vim.wasInVisualBlock;
- if (vim.wasInVisualBlock && !cm.ace.inMultiSelectMode) {
+ if (vim.wasInVisualBlock && !wasMultiselect) {
vim.wasInVisualBlock = false;
- } else if (cm.ace.inMultiSelectMode && vim.visualBlock) {
+ } else if (wasMultiselect && vim.visualBlock) {
vim.wasInVisualBlock = true;
}
- if (key == '' && !vim.insertMode && !vim.visualMode && cm.ace.inMultiSelectMode) {
+ var wasMultiselect = cm.ace.inMultiSelectMode;
+ if (key == '' && !vim.insertMode && !vim.visualMode && wasMultiselect) {
cm.ace.exitMultiSelectMode();
- } else if (visualBlock || !cm.ace.inMultiSelectMode || cm.ace.inVirtualSelectionMode) {
+ } else if (visualBlock || !wasMultiselect || cm.ace.inVirtualSelectionMode) {
isHandled = Vim.handleKey(cm, key, origin);
} else {
var old = cloneVimState(vim);
@@ -6099,8 +6100,10 @@ dom.importCssString(".normal-mode .ace_cursor{\
cm.curOp.cursorActivity = false;
}, true);
}
- if (isHandled && !vim.visualMode && !vim.insert)
- handleExternalSelection(cm, vim);
+ // ace commands like ctrl-alt-l may bring visualMode and selection out of sync
+ if (isHandled && !vim.visualMode && !vim.insert && vim.visualMode != cm.somethingSelected()) {
+ handleExternalSelection(cm, vim, true);
+ }
return isHandled;
}
exports.CodeMirror = CodeMirror;
From db76ae82ea3dc7837421a604d7bd35bdbc148810 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Mon, 6 May 2019 17:44:21 +0400
Subject: [PATCH 0155/1293] add tests
---
lib/ace/keyboard/vim.js | 32 ++++++++++++++++++--------------
lib/ace/keyboard/vim_test.js | 27 ++++++++++++++++++++++++++-
2 files changed, 44 insertions(+), 15 deletions(-)
diff --git a/lib/ace/keyboard/vim.js b/lib/ace/keyboard/vim.js
index acfb9a8c279..c2166f7c9f8 100644
--- a/lib/ace/keyboard/vim.js
+++ b/lib/ace/keyboard/vim.js
@@ -2400,6 +2400,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
vim.lastEditActionCommand = actionCommand;
macroModeState.lastInsertModeChanges.changes = [];
macroModeState.lastInsertModeChanges.expectCursorActivityForChange = false;
+ macroModeState.lastInsertModeChanges.visualBlock = vim.visualBlock ? vim.sel.head.line - vim.sel.anchor.line : 0;
}
};
@@ -2530,7 +2531,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
if (line < first && cur.line == first){
return this.moveToStartOfLine(cm, head, motionArgs, vim);
}else if (line > last && cur.line == last){
- return this.moveToEol(cm, head, motionArgs, vim);
+ return this.moveToEol(cm, head, motionArgs, vim, true);
}
// ace_patch{
var fold = cm.ace.session.getFoldLine(line);
@@ -2639,13 +2640,15 @@ dom.importCssString(".normal-mode .ace_cursor{\
vim.lastHSPos = cm.charCoords(head,'div').left;
return moveToColumn(cm, repeat);
},
- moveToEol: function(cm, head, motionArgs, vim) {
+ moveToEol: function(cm, head, motionArgs, vim, keepHPos) {
var cur = head;
- vim.lastHPos = Infinity;
var retval= Pos(cur.line + motionArgs.repeat - 1, Infinity);
var end=cm.clipPos(retval);
end.ch--;
- vim.lastHSPos = cm.charCoords(end,'div').left;
+ if (!keepHPos) {
+ vim.lastHPos = Infinity;
+ vim.lastHSPos = cm.charCoords(end,'div').left;
+ }
return retval;
},
moveToFirstNonWhiteSpaceCharacter: function(cm, head) {
@@ -2786,7 +2789,6 @@ dom.importCssString(".normal-mode .ace_cursor{\
change: function(cm, args, ranges) {
var finalHead, text;
var vim = cm.state.vim;
- vimGlobalState.macroModeState.lastInsertModeChanges.inVisualBlock = vim.visualBlock;
if (!vim.visualMode) {
var anchor = ranges[0].anchor,
head = ranges[0].head;
@@ -3046,6 +3048,8 @@ dom.importCssString(".normal-mode .ace_cursor{\
} else if (insertAt == 'firstNonBlank') {
head = motions.moveToFirstNonWhiteSpaceCharacter(cm, head);
} else if (insertAt == 'startOfSelectedArea') {
+ if (!vim.visualMode)
+ return;
if (!vim.visualBlock) {
if (sel.head.line < sel.anchor.line) {
head = sel.head;
@@ -3059,6 +3063,8 @@ dom.importCssString(".normal-mode .ace_cursor{\
height = Math.abs(sel.head.line - sel.anchor.line) + 1;
}
} else if (insertAt == 'endOfSelectedArea') {
+ if (!vim.visualMode)
+ return;
if (!vim.visualBlock) {
if (sel.head.line >= sel.anchor.line) {
head = offsetCursor(sel.head, 0, 1);
@@ -5978,18 +5984,15 @@ dom.importCssString(".normal-mode .ace_cursor{\
return true;
}
var head = cm.getCursor('head');
- var inVisualBlock = vimGlobalState.macroModeState.lastInsertModeChanges.inVisualBlock;
- if (inVisualBlock) {
+ var visualBlock = vimGlobalState.macroModeState.lastInsertModeChanges.visualBlock;
+ if (visualBlock) {
// Set up block selection again for repeating the changes.
- var vim = cm.state.vim;
- var lastSel = vim.lastSelection;
- var offset = getOffset(lastSel.anchor, lastSel.head);
- selectForInsert(cm, head, offset.line + 1);
+ selectForInsert(cm, head, visualBlock + 1);
repeat = cm.listSelections().length;
cm.setCursor(head);
}
for (var i = 0; i < repeat; i++) {
- if (inVisualBlock) {
+ if (visualBlock) {
cm.setCursor(offsetCursor(head, i, 0));
}
for (var j = 0; j < changes.length; j++) {
@@ -6006,7 +6009,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
}
}
}
- if (inVisualBlock) {
+ if (visualBlock) {
cm.setCursor(offsetCursor(head, 0, 1));
}
}
@@ -6064,13 +6067,14 @@ dom.importCssString(".normal-mode .ace_cursor{\
var isHandled = false;
var vim = Vim.maybeInitVimState_(cm);
var visualBlock = vim.visualBlock || vim.wasInVisualBlock;
+
+ var wasMultiselect = cm.ace.inMultiSelectMode;
if (vim.wasInVisualBlock && !wasMultiselect) {
vim.wasInVisualBlock = false;
} else if (wasMultiselect && vim.visualBlock) {
vim.wasInVisualBlock = true;
}
- var wasMultiselect = cm.ace.inMultiSelectMode;
if (key == '' && !vim.insertMode && !vim.visualMode && wasMultiselect) {
cm.ace.exitMultiSelectMode();
} else if (visualBlock || !wasMultiselect || cm.ace.inVirtualSelectionMode) {
diff --git a/lib/ace/keyboard/vim_test.js b/lib/ace/keyboard/vim_test.js
index cbe92ab1686..8a4316f9fde 100644
--- a/lib/ace/keyboard/vim_test.js
+++ b/lib/ace/keyboard/vim_test.js
@@ -231,7 +231,10 @@ function testVim(name, run, opts, expectedFail) {
arguments = args;
}
for (var i = 0; i < arguments.length; i++) {
- var result = CodeMirror.Vim.handleKey(cm, arguments[i]);
+ var ch = arguments[i];
+ var result = ch.length == 1
+ ? cm.ace.keyBinding.$callKeyboardHandlers(-1, ch, 0)
+ : CodeMirror.Vim.handleKey(cm, arguments[i]);
if (!result && cm.state.vim.insertMode) {
cm.replaceSelections(fillArray(arguments[i], cm.listSelections().length));
}
@@ -1141,6 +1144,28 @@ testVim('c_visual_block_replay', function(cm, vim, helpers) {
helpers.doKeys('.');
eq('foo4\nfoo8\nfoodefg', cm.getValue());
}, {value: '1234\n5678\nabcdefg'});
+testVim('I_visual_block_replay', function(cm, vim, helpers) {
+ cm.setCursor(0, 2);
+ helpers.doKeys('', '2', 'j', 'l', 'I');
+ var replacement = fillArray('+-', 3);
+ cm.replaceSelections(replacement);
+ eq('12+-34\n56+-78\nab+-cdefg\nxyz', cm.getValue());
+ helpers.doKeys('');
+ // ensure that repeat location doesn't depend on last selection
+ cm.setCursor(3, 2);
+ helpers.doKeys('g', 'v')
+ eq("+-34\n+-78\n+-cd", cm.getSelection())
+ cm.setCursor(0, 3);
+ helpers.doKeys('', '1', 'j', '2', 'l');
+ eq("-34\n-78", cm.getSelection());
+ cm.setCursor(0, 0);
+ eq("", cm.getSelection());
+ helpers.doKeys('g', 'v');
+ eq("-34\n-78", cm.getSelection());
+ cm.setCursor(1, 1);
+ helpers.doKeys('.');
+ eq('12+-34\n5+-6+-78\na+-b+-cdefg\nx+-yz', cm.getValue());
+}, {value: '1234\n5678\nabcdefg\nxyz'});
testVim('d_visual_block', function(cm, vim, helpers) {
cm.setCursor(0, 1);
From 70bf1447e9ffed3a591e309b2f2e505c1849bc8a Mon Sep 17 00:00:00 2001
From: nppoly
Date: Thu, 9 May 2019 11:30:35 +0800
Subject: [PATCH 0156/1293] fix addMarker type
---
ace.d.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ace.d.ts b/ace.d.ts
index 1241ee83d8b..a1c7d2b9c81 100644
--- a/ace.d.ts
+++ b/ace.d.ts
@@ -439,7 +439,7 @@ export namespace Ace {
clearBreakpoint(row: number): void;
addMarker(range: Range,
clazz: string,
- type: MarkerRenderer,
+ type: MarkerRenderer | string,
inFront: boolean): number;
addDynamicMarker(marker: MarkerLike, inFront: boolean): MarkerLike;
removeMarker(markerId: number): void;
From 448b2edbcb93e5cb2d2f12a346fe139476756f8b Mon Sep 17 00:00:00 2001
From: Jon Siwek
Date: Thu, 9 May 2019 10:06:10 -0700
Subject: [PATCH 0157/1293] Rename Bro to Zeek and improve syntax highlighting
---
demo/kitchen-sink/docs/bro.bro | 26 -
demo/kitchen-sink/docs/zeek.zeek | 179 +++
lib/ace/ext/modelist.js | 2 +-
lib/ace/mode/_test/tokens_bro.json | 106 --
lib/ace/mode/_test/tokens_zeek.json | 1270 +++++++++++++++++
lib/ace/mode/bro_highlight_rules.js | 204 ---
lib/ace/mode/{bro.js => zeek.js} | 12 +-
lib/ace/mode/zeek_highlight_rules.js | 407 ++++++
lib/ace/snippets/{bro.js => zeek.js} | 2 +-
.../snippets/{bro.snippets => zeek.snippets} | 0
10 files changed, 1863 insertions(+), 345 deletions(-)
delete mode 100644 demo/kitchen-sink/docs/bro.bro
create mode 100644 demo/kitchen-sink/docs/zeek.zeek
delete mode 100644 lib/ace/mode/_test/tokens_bro.json
create mode 100644 lib/ace/mode/_test/tokens_zeek.json
delete mode 100644 lib/ace/mode/bro_highlight_rules.js
rename lib/ace/mode/{bro.js => zeek.js} (88%)
create mode 100644 lib/ace/mode/zeek_highlight_rules.js
rename lib/ace/snippets/{bro.js => zeek.js} (55%)
rename lib/ace/snippets/{bro.snippets => zeek.snippets} (100%)
diff --git a/demo/kitchen-sink/docs/bro.bro b/demo/kitchen-sink/docs/bro.bro
deleted file mode 100644
index 937d37dcd39..00000000000
--- a/demo/kitchen-sink/docs/bro.bro
+++ /dev/null
@@ -1,26 +0,0 @@
-##! Add countries for the originator and responder of a connection
-##! to the connection logs.
-
-module Conn;
-
-export {
- redef record Conn::Info += {
- ## Country code for the originator of the connection based
- ## on a GeoIP lookup.
- orig_cc: string &optional &log;
- ## Country code for the responser of the connection based
- ## on a GeoIP lookup.
- resp_cc: string &optional &log;
- };
-}
-
-event connection_state_remove(c: connection)
- {
- local orig_loc = lookup_location(c$id$orig_h);
- if ( orig_loc?$country_code )
- c$conn$orig_cc = orig_loc$country_code;
-
- local resp_loc = lookup_location(c$id$resp_h);
- if ( resp_loc?$country_code )
- c$conn$resp_cc = resp_loc$country_code;
- }
\ No newline at end of file
diff --git a/demo/kitchen-sink/docs/zeek.zeek b/demo/kitchen-sink/docs/zeek.zeek
new file mode 100644
index 00000000000..a4c4bb7c50e
--- /dev/null
+++ b/demo/kitchen-sink/docs/zeek.zeek
@@ -0,0 +1,179 @@
+# An example of the Zeek scripting language.
+
+##! A Zeekygen-style summmary comment.
+
+# TODO: just an example of a todo-indicator
+
+@load base/frameworks/notice
+
+@if ( F )
+@endif
+
+module Example;
+
+export {
+
+ type SimpleEnum: enum { ONE, TWO, THREE };
+
+ redef enum SimpleEnum += {
+
+ ## A Zeekygen-style comment.
+ FOUR,
+ FIVE, ##< A Zeekygen-style comment.
+ };
+
+ type SimpleRecord: record {
+ field1: count;
+ field2: bool;
+ } &redef;
+
+ redef record SimpleRecord += {
+
+ field3: string &optional;
+
+ field4: string &default="blah";
+ };
+
+ const init_option: bool = T;
+
+ option runtime_option: bool = F;
+
+ global test_opaque: opaque of md5;
+
+ global test_vector: vector of count;
+
+ global myfunction: function(msg: string, c: count &default=0): count;
+
+ global myhook: hook(tag: string);
+
+ global myevent: event(tag: string);
+}
+
+function myfunction(msg: string, c: count): count
+ {
+ print "in myfunction", msg, c;
+ return 0;
+ }
+
+event myevent(msg: string) &priority=1
+ {
+ print "in myevent";
+ }
+
+hook myhook(msg: string)
+ {
+ print "in myevent";
+ }
+
+event zeek_init()
+ {
+ local b = T;
+ local s = "\xff\xaf\"and more after the escaped quote";
+ local p = /foo|bar\xbe\/and more after the escaped slash/;
+ local c = 10;
+
+ local sr = SimpleRecord($field1 = 0, $field2 = T, $field3 = "hi");
+
+ print sr?$field3, sr$field1;
+
+ local myset: set[string] = set("one", "two", "three");
+
+ add myset["four"];
+ delete myset["one"];
+
+ for ( ms in myset )
+ {
+ print ms is string, s as string;
+
+ print s[1:3];
+
+ local tern: count = s == "two" ? 2 : 0;
+
+ if ( s !in myset )
+ print fmt("error %4.2f: %s", 3.14159, "wtf?");
+ }
+
+ switch ( c ) {
+ case 1:
+ break;
+ case 2:
+ fallthrough;
+ default:
+ break;
+ }
+
+ if ( ! b )
+ print "here";
+ else
+ print "there";
+
+ while ( c != 0 )
+ {
+ if ( c >= 5 )
+ c += 0;
+ else if ( c == 8 )
+ c -= 0;
+
+ c = c / 1;
+ c = c / 1;
+ c = c - 1;
+ }
+
+ print |myset|;
+ print ~5;
+ print 1 & 0xff;
+ print 2 ^ 5;
+
+ myfunction("hello function");
+ hook myhook("hell hook");
+ event myevent("hello event");
+ schedule 1sec { myevent("hello scheduled event") };
+
+ print 0, 7;
+ print 0xff, 0xdeadbeef;
+
+ print 3.14159;
+ print 1234.0;
+ print 1234e0;
+ print .003E-23;
+ print .003E+23;
+
+ print 123/udp;
+ print 8000/tcp;
+ print 13/icmp;
+ print 42/unknown;
+
+ print google.com;
+ print 192.168.50.1;
+ print 255.255.255.255;
+ print 0.0.0.0;
+
+ print 10.0.0.0/16;
+
+ print [2001:0db8:85a3:0000:0000:8a2e:0370:7334];
+ # test for case insensitivity
+ print [2001:0DB8:85A3:0000:0000:8A2E:0370:7334];
+ # any case mixture is allowed
+ print [2001:0dB8:85a3:0000:0000:8A2E:0370:7334];
+ # leading zeroes of a 16-bit group may be omitted
+ print [2001:db8:85a3:0:0:8a2e:370:7334];
+ # a single occurrence of consecutive groups of zeroes may be replaced by ::
+ print [2001:db8:85a3::8a2e:370:7334];
+ # all zeroes should work
+ print [0:0:0:0:0:0:0:0];
+ # all zeroes condensed should work
+ print [::];
+ # hybrid ipv6-ipv4 address should work
+ print [2001:db8:0:0:0:FFFF:192.168.0.5];
+ # hybrid ipv6-ipv4 address with zero ommission should work
+ print [2001:db8::FFFF:192.168.0.5];
+
+ print [2001:0db8:85a3:0000:0000:8a2e:0370:7334]/64;
+
+ print 1day, 1days, 1.0day, 1.0days;
+ print 1hr, 1hrs, 1.0hr, 1.0hrs;
+ print 1min, 1mins, 1.0min, 1.0mins;
+ print 1sec, 1secs, 1.0sec, 1.0secs;
+ print 1msec, 1msecs, 1.0msec, 1.0msecs;
+ print 1usec, 1usecs, 1.0usec, 1.0usecs;
+ }
diff --git a/lib/ace/ext/modelist.js b/lib/ace/ext/modelist.js
index bb14e3455ce..021e7fb06a5 100644
--- a/lib/ace/ext/modelist.js
+++ b/lib/ace/ext/modelist.js
@@ -55,7 +55,6 @@ var supportedModes = {
Apex: ["apex|cls|trigger|tgr"],
AQL: ["aql"],
BatchFile: ["bat|cmd"],
- Bro: ["bro"],
C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"],
C9Search: ["c9search_results"],
Crystal: ["cr"],
@@ -200,6 +199,7 @@ var supportedModes = {
XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"],
XQuery: ["xq"],
YAML: ["yaml|yml"],
+ Zeek: ["zeek|bro"],
// Add the missing mode "Django" to ext-modelist
Django: ["html"]
};
diff --git a/lib/ace/mode/_test/tokens_bro.json b/lib/ace/mode/_test/tokens_bro.json
deleted file mode 100644
index b0f42015ae4..00000000000
--- a/lib/ace/mode/_test/tokens_bro.json
+++ /dev/null
@@ -1,106 +0,0 @@
-[[
- "start",
- ["punctuation.definition.comment.bro","#"],
- ["comment.line.number-sign.bro","#! Add countries for the originator and responder of a connection"]
-],[
- "start",
- ["punctuation.definition.comment.bro","#"],
- ["comment.line.number-sign.bro","#! to the connection logs."]
-],[
- "start"
-],[
- "start",
- ["text","module Conn;"]
-],[
- "start"
-],[
- "start",
- ["text","export {"]
-],[
- "start",
- ["text","\t"],
- ["storage.modifier.bro","redef"],
- ["text"," "],
- ["storage.type.bro","record"],
- ["text"," Conn::Info += {"]
-],[
- "start",
- ["text","\t\t"],
- ["punctuation.definition.comment.bro","#"],
- ["comment.line.number-sign.bro","# Country code for the originator of the connection based "]
-],[
- "start",
- ["text","\t\t"],
- ["punctuation.definition.comment.bro","#"],
- ["comment.line.number-sign.bro","# on a GeoIP lookup."]
-],[
- "start",
- ["text","\t\torig_cc: "],
- ["storage.type.bro","string"],
- ["text"," &optional &log;"]
-],[
- "start",
- ["text","\t\t"],
- ["punctuation.definition.comment.bro","#"],
- ["comment.line.number-sign.bro","# Country code for the responser of the connection based "]
-],[
- "start",
- ["text","\t\t"],
- ["punctuation.definition.comment.bro","#"],
- ["comment.line.number-sign.bro","# on a GeoIP lookup."]
-],[
- "start",
- ["text","\t\tresp_cc: "],
- ["storage.type.bro","string"],
- ["text"," &optional &log;"]
-],[
- "start",
- ["text","\t};"]
-],[
- "start",
- ["text","}"]
-],[
- "start"
-],[
- "start",
- ["meta.function.bro"," "],
- ["storage.type.bro","connection_state_remove"],
- ["meta.function.bro","("],
- ["entity.name.function.bro","c: connection"],
- ["meta.function.bro",") "],
- "event connection_state_remove(c: connection) "
-],[
- "start",
- ["text","\t{"]
-],[
- "start",
- ["text","\t"],
- ["storage.modifier.bro","local"],
- ["text"," orig_loc = lookup_location(c$id$orig_h);"]
-],[
- "start",
- ["text","\t"],
- ["keyword.control.bro","if"],
- ["text"," ( orig_loc?$country_code )"]
-],[
- "start",
- ["text","\t\tc$conn$orig_cc = orig_loc$country_code;"]
-],[
- "start"
-],[
- "start",
- ["text","\t"],
- ["storage.modifier.bro","local"],
- ["text"," resp_loc = lookup_location(c$id$resp_h);"]
-],[
- "start",
- ["text","\t"],
- ["keyword.control.bro","if"],
- ["text"," ( resp_loc?$country_code )"]
-],[
- "start",
- ["text","\t\tc$conn$resp_cc = resp_loc$country_code;"]
-],[
- "start",
- ["text","\t}"]
-]]
\ No newline at end of file
diff --git a/lib/ace/mode/_test/tokens_zeek.json b/lib/ace/mode/_test/tokens_zeek.json
new file mode 100644
index 00000000000..d9695b28c72
--- /dev/null
+++ b/lib/ace/mode/_test/tokens_zeek.json
@@ -0,0 +1,1270 @@
+[[
+ "start",
+ ["comment.line","# An example of the Zeek scripting language."]
+],[
+ "start"
+],[
+ "start",
+ ["comment.line","##! A Zeekygen-style summmary comment."]
+],[
+ "start"
+],[
+ "start",
+ ["comment.line","# TODO: just an example of a todo-indicator"]
+],[
+ "start"
+],[
+ "start",
+ ["keyword.other","@load"],
+ ["meta.preprocessor"," base/frameworks/notice"]
+],[
+ "start"
+],[
+ "start",
+ ["keyword.other","@if"],
+ ["text"," "],
+ ["punctuation.section.parens.begin","("],
+ ["text"," "],
+ ["constant.language","F"],
+ ["text"," "],
+ ["punctuation.section.parens.end",")"]
+],[
+ "start",
+ ["keyword.other","@endif"]
+],[
+ "start"
+],[
+ "start",
+ ["keyword.other","module"],
+ ["meta.namespace"," "],
+ ["entity.name.namespace","Example"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["keyword.other","export"],
+ ["text"," "],
+ ["punctuation.section.block.begin","{"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","type"],
+ ["meta.enum"," "],
+ ["entity.name.enum","SimpleEnum"],
+ ["punctuation.separator",":"],
+ ["meta.enum"," "],
+ ["storage.type.enum","enum"],
+ ["text"," "],
+ ["punctuation.section.block.begin","{"],
+ ["text"," ONE"],
+ ["punctuation.separator",","],
+ ["text"," TWO"],
+ ["punctuation.separator",","],
+ ["text"," THREE "],
+ ["punctuation.section.block.end","}"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","redef"],
+ ["meta.enum"," "],
+ ["storage.type.enum","enum"],
+ ["meta.enum"," "],
+ ["entity.name.enum","SimpleEnum"],
+ ["text"," "],
+ ["keyword.operator","+="],
+ ["text"," "],
+ ["punctuation.section.block.begin","{"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["comment.line","## A Zeekygen-style comment."]
+],[
+ "start",
+ ["text"," FOUR"],
+ ["punctuation.separator",","]
+],[
+ "start",
+ ["text"," FIVE"],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["comment.line","##< A Zeekygen-style comment."]
+],[
+ "start",
+ ["text"," "],
+ ["punctuation.section.block.end","}"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","type"],
+ ["meta.struct.record"," "],
+ ["entity.name.struct.record","SimpleRecord"],
+ ["punctuation.separator",":"],
+ ["meta.struct.record"," "],
+ ["storage.type.struct.record","record"],
+ ["text"," "],
+ ["punctuation.section.block.begin","{"]
+],[
+ "start",
+ ["text"," field1"],
+ ["punctuation.separator",":"],
+ ["text"," "],
+ ["storage.type","count"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," field2"],
+ ["punctuation.separator",":"],
+ ["text"," "],
+ ["storage.type","bool"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["punctuation.section.block.end","}"],
+ ["text"," "],
+ ["storage.modifier.attribute","&redef"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","redef"],
+ ["meta.struct.record"," "],
+ ["storage.type.struct.record","record"],
+ ["meta.struct.record"," "],
+ ["entity.name.struct.record","SimpleRecord"],
+ ["text"," "],
+ ["keyword.operator","+="],
+ ["text"," "],
+ ["punctuation.section.block.begin","{"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," field3"],
+ ["punctuation.separator",":"],
+ ["text"," "],
+ ["storage.type","string"],
+ ["text"," "],
+ ["storage.modifier.attribute","&optional"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," field4"],
+ ["punctuation.separator",":"],
+ ["text"," "],
+ ["storage.type","string"],
+ ["text"," "],
+ ["storage.modifier.attribute","&default"],
+ ["keyword.operator","="],
+ ["string.double","\"blah\""],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["punctuation.section.block.end","}"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["storage.modifier","const"],
+ ["text"," init_option"],
+ ["punctuation.separator",":"],
+ ["text"," "],
+ ["storage.type","bool"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["constant.language","T"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["storage.modifier","option"],
+ ["text"," runtime_option"],
+ ["punctuation.separator",":"],
+ ["text"," "],
+ ["storage.type","bool"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["constant.language","F"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["storage.modifier","global"],
+ ["text"," test_opaque"],
+ ["punctuation.separator",":"],
+ ["text"," "],
+ ["storage.type","opaque"],
+ ["text"," "],
+ ["keyword.operator","of"],
+ ["text"," "],
+ ["storage.type","md5"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["storage.modifier","global"],
+ ["text"," test_vector"],
+ ["punctuation.separator",":"],
+ ["text"," "],
+ ["storage.type","vector"],
+ ["text"," "],
+ ["keyword.operator","of"],
+ ["text"," "],
+ ["storage.type","count"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["storage.modifier","global"],
+ ["text"," myfunction"],
+ ["punctuation.separator",":"],
+ ["text"," "],
+ ["storage.type","function"],
+ ["punctuation.section.parens.begin","("],
+ ["text","msg"],
+ ["punctuation.separator",":"],
+ ["text"," "],
+ ["storage.type","string"],
+ ["punctuation.separator",","],
+ ["text"," c"],
+ ["punctuation.separator",":"],
+ ["text"," "],
+ ["storage.type","count"],
+ ["text"," "],
+ ["storage.modifier.attribute","&default"],
+ ["keyword.operator","="],
+ ["constant.numeric.integer.decimal","0"],
+ ["punctuation.section.parens.end",")"],
+ ["punctuation.separator",":"],
+ ["text"," "],
+ ["storage.type","count"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["storage.modifier","global"],
+ ["text"," myhook"],
+ ["punctuation.separator",":"],
+ ["text"," "],
+ ["storage.type","hook"],
+ ["punctuation.section.parens.begin","("],
+ ["text","tag"],
+ ["punctuation.separator",":"],
+ ["text"," "],
+ ["storage.type","string"],
+ ["punctuation.section.parens.end",")"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["storage.modifier","global"],
+ ["text"," myevent"],
+ ["punctuation.separator",":"],
+ ["text"," "],
+ ["storage.type","event"],
+ ["punctuation.section.parens.begin","("],
+ ["text","tag"],
+ ["punctuation.separator",":"],
+ ["text"," "],
+ ["storage.type","string"],
+ ["punctuation.section.parens.end",")"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["punctuation.section.block.end","}"]
+],[
+ "start"
+],[
+ "start",
+ ["storage.type","function"],
+ ["text"," "],
+ ["entity.name.function","myfunction"],
+ ["punctuation.section.parens.begin","("],
+ ["text","msg"],
+ ["punctuation.separator",":"],
+ ["text"," "],
+ ["storage.type","string"],
+ ["punctuation.separator",","],
+ ["text"," c"],
+ ["punctuation.separator",":"],
+ ["text"," "],
+ ["storage.type","count"],
+ ["punctuation.section.parens.end",")"],
+ ["punctuation.separator",":"],
+ ["text"," "],
+ ["storage.type","count"]
+],[
+ "start",
+ ["text"," "],
+ ["punctuation.section.block.begin","{"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["string.double","\"in myfunction\""],
+ ["punctuation.separator",","],
+ ["text"," msg"],
+ ["punctuation.separator",","],
+ ["text"," c"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.control","return"],
+ ["text"," "],
+ ["constant.numeric.integer.decimal","0"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["punctuation.section.block.end","}"]
+],[
+ "start"
+],[
+ "start",
+ ["storage.type","event"],
+ ["text"," "],
+ ["entity.name.function.event","myevent"],
+ ["punctuation.section.parens.begin","("],
+ ["text","msg"],
+ ["punctuation.separator",":"],
+ ["text"," "],
+ ["storage.type","string"],
+ ["punctuation.section.parens.end",")"],
+ ["text"," "],
+ ["storage.modifier.attribute","&priority"],
+ ["keyword.operator","="],
+ ["constant.numeric.integer.decimal","1"]
+],[
+ "start",
+ ["text"," "],
+ ["punctuation.section.block.begin","{"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["string.double","\"in myevent\""],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["punctuation.section.block.end","}"]
+],[
+ "start"
+],[
+ "start",
+ ["storage.type","hook"],
+ ["text"," "],
+ ["entity.name.function.hook","myhook"],
+ ["punctuation.section.parens.begin","("],
+ ["text","msg"],
+ ["punctuation.separator",":"],
+ ["text"," "],
+ ["storage.type","string"],
+ ["punctuation.section.parens.end",")"]
+],[
+ "start",
+ ["text"," "],
+ ["punctuation.section.block.begin","{"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["string.double","\"in myevent\""],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["punctuation.section.block.end","}"]
+],[
+ "start"
+],[
+ "start",
+ ["storage.type","event"],
+ ["text"," "],
+ ["entity.name.function.event","zeek_init"],
+ ["punctuation.section.parens.begin","("],
+ ["punctuation.section.parens.end",")"]
+],[
+ "start",
+ ["text"," "],
+ ["punctuation.section.block.begin","{"]
+],[
+ "start",
+ ["text"," "],
+ ["storage.modifier","local"],
+ ["text"," b "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["constant.language","T"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["storage.modifier","local"],
+ ["text"," s "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["string.double","\""],
+ ["constant.character.escape","\\x"],
+ ["string.double","ff"],
+ ["constant.character.escape","\\x"],
+ ["string.double","af"],
+ ["constant.character.escape","\\\""],
+ ["string.double","and more after the escaped quote\""],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["storage.modifier","local"],
+ ["text"," p "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["string.regexp","/foo|bar"],
+ ["constant.character.escape","\\x"],
+ ["string.regexp","be"],
+ ["constant.character.escape","\\/"],
+ ["string.regexp","and more after the escaped slash/"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["storage.modifier","local"],
+ ["text"," c "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["constant.numeric.integer.decimal","10"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["storage.modifier","local"],
+ ["text"," sr "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["entity.name.function.call","SimpleRecord"],
+ ["punctuation.section.parens.begin","("],
+ ["punctuation.accessor","$"],
+ ["text","field1 "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["constant.numeric.integer.decimal","0"],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["punctuation.accessor","$"],
+ ["text","field2 "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["constant.language","T"],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["punctuation.accessor","$"],
+ ["text","field3 "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["string.double","\"hi\""],
+ ["punctuation.section.parens.end",")"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," sr"],
+ ["punctuation.accessor","?$"],
+ ["text","field3"],
+ ["punctuation.separator",","],
+ ["text"," sr"],
+ ["punctuation.accessor","$"],
+ ["text","field1"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["storage.modifier","local"],
+ ["text"," myset"],
+ ["punctuation.separator",":"],
+ ["text"," "],
+ ["storage.type","set"],
+ ["punctuation.section.brackets.begin","["],
+ ["storage.type","string"],
+ ["punctuation.section.brackets.end","]"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," "],
+ ["storage.type","set"],
+ ["punctuation.section.parens.begin","("],
+ ["string.double","\"one\""],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["string.double","\"two\""],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["string.double","\"three\""],
+ ["punctuation.section.parens.end",")"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","add"],
+ ["text"," myset"],
+ ["punctuation.section.brackets.begin","["],
+ ["string.double","\"four\""],
+ ["punctuation.section.brackets.end","]"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","delete"],
+ ["text"," myset"],
+ ["punctuation.section.brackets.begin","["],
+ ["string.double","\"one\""],
+ ["punctuation.section.brackets.end","]"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword.control","for"],
+ ["text"," "],
+ ["punctuation.section.parens.begin","("],
+ ["text"," ms "],
+ ["keyword.operator","in"],
+ ["text"," myset "],
+ ["punctuation.section.parens.end",")"]
+],[
+ "start",
+ ["text"," "],
+ ["punctuation.section.block.begin","{"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," ms "],
+ ["keyword.operator","is"],
+ ["text"," "],
+ ["storage.type","string"],
+ ["punctuation.separator",","],
+ ["text"," s "],
+ ["keyword.operator","as"],
+ ["text"," "],
+ ["storage.type","string"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," s"],
+ ["punctuation.section.brackets.begin","["],
+ ["constant.numeric.integer.decimal","1"],
+ ["punctuation.separator",":"],
+ ["constant.numeric.integer.decimal","3"],
+ ["punctuation.section.brackets.end","]"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["storage.modifier","local"],
+ ["text"," tern"],
+ ["punctuation.separator",":"],
+ ["text"," "],
+ ["storage.type","count"],
+ ["text"," "],
+ ["keyword.operator","="],
+ ["text"," s "],
+ ["keyword.operator","=="],
+ ["text"," "],
+ ["string.double","\"two\""],
+ ["text"," "],
+ ["keyword.operator","?"],
+ ["text"," "],
+ ["constant.numeric.integer.decimal","2"],
+ ["text"," "],
+ ["punctuation.separator",":"],
+ ["text"," "],
+ ["constant.numeric.integer.decimal","0"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword.control.conditional","if"],
+ ["text"," "],
+ ["punctuation.section.parens.begin","("],
+ ["text"," s "],
+ ["keyword.operator","!in"],
+ ["text"," myset "],
+ ["punctuation.section.parens.end",")"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["entity.name.function.call","fmt"],
+ ["punctuation.section.parens.begin","("],
+ ["string.double","\"error "],
+ ["constant.other.placeholder","%4.2f"],
+ ["string.double",": "],
+ ["constant.other.placeholder","%s"],
+ ["string.double","\""],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["constant.numeric.float.decimal","3.14159"],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["string.double","\"wtf?\""],
+ ["punctuation.section.parens.end",")"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["punctuation.section.block.end","}"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword.control","switch"],
+ ["text"," "],
+ ["punctuation.section.parens.begin","("],
+ ["text"," c "],
+ ["punctuation.section.parens.end",")"],
+ ["text"," "],
+ ["punctuation.section.block.begin","{"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.control","case"],
+ ["text"," "],
+ ["constant.numeric.integer.decimal","1"],
+ ["punctuation.separator",":"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.control","break"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.control","case"],
+ ["text"," "],
+ ["constant.numeric.integer.decimal","2"],
+ ["punctuation.separator",":"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.control","fallthrough"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.control","default"],
+ ["punctuation.separator",":"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.control","break"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["punctuation.section.block.end","}"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword.control.conditional","if"],
+ ["text"," "],
+ ["punctuation.section.parens.begin","("],
+ ["text"," "],
+ ["keyword.operator","!"],
+ ["text"," b "],
+ ["punctuation.section.parens.end",")"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["string.double","\"here\""],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.control.conditional","else"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["string.double","\"there\""],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword.control","while"],
+ ["text"," "],
+ ["punctuation.section.parens.begin","("],
+ ["text"," c "],
+ ["keyword.operator","!="],
+ ["text"," "],
+ ["constant.numeric.integer.decimal","0"],
+ ["text"," "],
+ ["punctuation.section.parens.end",")"]
+],[
+ "start",
+ ["text"," "],
+ ["punctuation.section.block.begin","{"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.control.conditional","if"],
+ ["text"," "],
+ ["punctuation.section.parens.begin","("],
+ ["text"," c "],
+ ["keyword.operator",">="],
+ ["text"," "],
+ ["constant.numeric.integer.decimal","5"],
+ ["text"," "],
+ ["punctuation.section.parens.end",")"]
+],[
+ "start",
+ ["text"," c "],
+ ["keyword.operator","+="],
+ ["text"," "],
+ ["constant.numeric.integer.decimal","0"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.control.conditional","else"],
+ ["text"," "],
+ ["keyword.control.conditional","if"],
+ ["text"," "],
+ ["punctuation.section.parens.begin","("],
+ ["text"," c "],
+ ["keyword.operator","=="],
+ ["text"," "],
+ ["constant.numeric.integer.decimal","8"],
+ ["text"," "],
+ ["punctuation.section.parens.end",")"]
+],[
+ "start",
+ ["text"," c "],
+ ["keyword.operator","-="],
+ ["text"," "],
+ ["constant.numeric.integer.decimal","0"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," c "],
+ ["keyword.operator","="],
+ ["text"," c "],
+ ["keyword.operator","/"],
+ ["text"," "],
+ ["constant.numeric.integer.decimal","1"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," c "],
+ ["keyword.operator","="],
+ ["text"," c "],
+ ["keyword.operator","/"],
+ ["text"," "],
+ ["constant.numeric.integer.decimal","1"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," c "],
+ ["keyword.operator","="],
+ ["text"," c "],
+ ["keyword.operator","-"],
+ ["text"," "],
+ ["constant.numeric.integer.decimal","1"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["punctuation.section.block.end","}"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["keyword.operator","|"],
+ ["text","myset"],
+ ["keyword.operator","|"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["keyword.operator","~"],
+ ["constant.numeric.integer.decimal","5"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.integer.decimal","1"],
+ ["text"," "],
+ ["keyword.operator","&"],
+ ["text"," "],
+ ["constant.numeric.integer.hexadecimal","0xff"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.integer.decimal","2"],
+ ["text"," "],
+ ["keyword.operator","^"],
+ ["text"," "],
+ ["constant.numeric.integer.decimal","5"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["entity.name.function.call","myfunction"],
+ ["punctuation.section.parens.begin","("],
+ ["string.double","\"hello function\""],
+ ["punctuation.section.parens.end",")"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["storage.type","hook"],
+ ["text"," "],
+ ["entity.name.function.hook","myhook"],
+ ["punctuation.section.parens.begin","("],
+ ["string.double","\"hell hook\""],
+ ["punctuation.section.parens.end",")"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["storage.type","event"],
+ ["text"," "],
+ ["entity.name.function.event","myevent"],
+ ["punctuation.section.parens.begin","("],
+ ["string.double","\"hello event\""],
+ ["punctuation.section.parens.end",")"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.control","schedule"],
+ ["text"," "],
+ ["constant.numeric.float.decimal.interval","1sec"],
+ ["text"," "],
+ ["punctuation.section.block.begin","{"],
+ ["text"," "],
+ ["entity.name.function.call","myevent"],
+ ["punctuation.section.parens.begin","("],
+ ["string.double","\"hello scheduled event\""],
+ ["punctuation.section.parens.end",")"],
+ ["text"," "],
+ ["punctuation.section.block.end","}"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.integer.decimal","0"],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["constant.numeric.integer.decimal","7"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.integer.hexadecimal","0xff"],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["constant.numeric.integer.hexadecimal","0xdeadbeef"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.float.decimal","3.14159"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.float.decimal","1234.0"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.float.decimal","1234e0"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.float.decimal",".003E-23"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.float.decimal",".003E+23"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.port","123/udp"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.port","8000/tcp"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.port","13/icmp"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.port","42/unknown"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.hostname","google.com"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.addr","192.168.50.1"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.addr","255.255.255.255"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.addr","0.0.0.0"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.addr","10.0.0.0"],
+ ["keyword.operator","/"],
+ ["constant.numeric.integer.decimal","16"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.addr","[2001:0db8:85a3:0000:0000:8a2e:0370:7334]"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["comment.line","# test for case insensitivity"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.addr","[2001:0DB8:85A3:0000:0000:8A2E:0370:7334]"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["comment.line","# any case mixture is allowed"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.addr","[2001:0dB8:85a3:0000:0000:8A2E:0370:7334]"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["comment.line","# leading zeroes of a 16-bit group may be omitted"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.addr","[2001:db8:85a3:0:0:8a2e:370:7334]"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["comment.line","# a single occurrence of consecutive groups of zeroes may be replaced by ::"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.addr","[2001:db8:85a3::8a2e:370:7334]"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["comment.line","# all zeroes should work"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.addr","[0:0:0:0:0:0:0:0]"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["comment.line","# all zeroes condensed should work"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.addr","[::]"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["comment.line","# hybrid ipv6-ipv4 address should work"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.addr","[2001:db8:0:0:0:FFFF:192.168.0.5]"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["comment.line","# hybrid ipv6-ipv4 address with zero ommission should work"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.addr","[2001:db8::FFFF:192.168.0.5]"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.addr","[2001:0db8:85a3:0000:0000:8a2e:0370:7334]"],
+ ["keyword.operator","/"],
+ ["constant.numeric.integer.decimal","64"],
+ ["punctuation.terminator",";"]
+],[
+ "start"
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.float.decimal.interval","1day"],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["constant.numeric.float.decimal.interval","1days"],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["constant.numeric.float.decimal.interval","1.0day"],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["constant.numeric.float.decimal.interval","1.0days"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.float.decimal.interval","1hr"],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["constant.numeric.float.decimal.interval","1hrs"],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["constant.numeric.float.decimal.interval","1.0hr"],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["constant.numeric.float.decimal.interval","1.0hrs"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.float.decimal.interval","1min"],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["constant.numeric.float.decimal.interval","1mins"],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["constant.numeric.float.decimal.interval","1.0min"],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["constant.numeric.float.decimal.interval","1.0mins"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.float.decimal.interval","1sec"],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["constant.numeric.float.decimal.interval","1secs"],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["constant.numeric.float.decimal.interval","1.0sec"],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["constant.numeric.float.decimal.interval","1.0secs"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.float.decimal.interval","1msec"],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["constant.numeric.float.decimal.interval","1msecs"],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["constant.numeric.float.decimal.interval","1.0msec"],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["constant.numeric.float.decimal.interval","1.0msecs"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["keyword.other","print"],
+ ["text"," "],
+ ["constant.numeric.float.decimal.interval","1usec"],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["constant.numeric.float.decimal.interval","1usecs"],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["constant.numeric.float.decimal.interval","1.0usec"],
+ ["punctuation.separator",","],
+ ["text"," "],
+ ["constant.numeric.float.decimal.interval","1.0usecs"],
+ ["punctuation.terminator",";"]
+],[
+ "start",
+ ["text"," "],
+ ["punctuation.section.block.end","}"]
+],[
+ "start"
+]]
\ No newline at end of file
diff --git a/lib/ace/mode/bro_highlight_rules.js b/lib/ace/mode/bro_highlight_rules.js
deleted file mode 100644
index 6c36a839f75..00000000000
--- a/lib/ace/mode/bro_highlight_rules.js
+++ /dev/null
@@ -1,204 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Distributed under the BSD license:
- *
- * Copyright (c) 2012, Ajax.org B.V.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Ajax.org B.V. nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/* This file was autogenerated from Bro.tmLanguage (uuid: ) */
-/****************************************************************************************
- * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
- * fileTypes *
- ****************************************************************************************/
-
-define(function(require, exports, module) {
-"use strict";
-
-var oop = require("../lib/oop");
-var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
-
-var BroHighlightRules = function() {
- // regexp must not have capturing parentheses. Use (?:) instead.
- // regexps are ordered -> the first match is used
-
- this.$rules = {
- start: [{
- token: "punctuation.definition.comment.bro",
- regex: /#/,
- push: [{
- token: "comment.line.number-sign.bro",
- regex: /$/,
- next: "pop"
- }, {
- defaultToken: "comment.line.number-sign.bro"
- }]
- }, {
- token: "keyword.control.bro",
- regex: /\b(?:break|case|continue|else|for|if|return|switch|next|when|timeout|schedule)\b/
- }, {
- token: [
- "meta.function.bro",
- "meta.function.bro",
- "storage.type.bro",
- "meta.function.bro",
- "entity.name.function.bro",
- "meta.function.bro"
- ],
- regex: /^(\s*)(?:function|hook|event)(\s*)(.*)(\s*\()(.*)(\).*$)/
- }, {
- token: "storage.type.bro",
- regex: /\b(?:bool|enum|double|int|count|port|addr|subnet|any|file|interval|time|string|table|vector|set|record|pattern|hook)\b/
- }, {
- token: "storage.modifier.bro",
- regex: /\b(?:global|const|redef|local|&(?:optional|rotate_interval|rotate_size|add_func|del_func|expire_func|expire_create|expire_read|expire_write|persistent|synchronized|encrypt|mergeable|priority|group|type_column|log|error_handler))\b/
- }, {
- token: "keyword.operator.bro",
- regex: /\s*(?:\||&&|(?:>|<|!)=?|==)\s*|\b!?in\b/
- }, {
- token: "constant.language.bro",
- regex: /\b(?:T|F)\b/
- }, {
- token: "constant.numeric.bro",
- regex: /\b(?:0(?:x|X)[0-9a-fA-F]*|(?:[0-9]+\.?[0-9]*|\.[0-9]+)(?:(?:e|E)(?:\+|-)?[0-9]+)?)(?:\/(?:tcp|udp|icmp)|\s*(?:u?sec|min|hr|day)s?)?\b/
- }, {
- token: "punctuation.definition.string.begin.bro",
- regex: /"/,
- push: [{
- token: "punctuation.definition.string.end.bro",
- regex: /"/,
- next: "pop"
- }, {
- include: "#string_escaped_char"
- }, {
- include: "#string_placeholder"
- }, {
- defaultToken: "string.quoted.double.bro"
- }]
- }, {
- token: "punctuation.definition.string.begin.bro",
- regex: /\//,
- push: [{
- token: "punctuation.definition.string.end.bro",
- regex: /\//,
- next: "pop"
- }, {
- include: "#string_escaped_char"
- }, {
- include: "#string_placeholder"
- }, {
- defaultToken: "string.quoted.regex.bro"
- }]
- }, {
- token: [
- "meta.preprocessor.bro.load",
- "keyword.other.special-method.bro"
- ],
- regex: /^(\s*)(\@load(?:-sigs)?)\b/,
- push: [{
- token: [],
- regex: /(?=\#)|$/,
- next: "pop"
- }, {
- defaultToken: "meta.preprocessor.bro.load"
- }]
- }, {
- token: [
- "meta.preprocessor.bro.if",
- "keyword.other.special-method.bro",
- "meta.preprocessor.bro.if"
- ],
- regex: /^(\s*)(\@endif|\@if(?:n?def)?)(.*$)/,
- push: [{
- token: [],
- regex: /$/,
- next: "pop"
- }, {
- defaultToken: "meta.preprocessor.bro.if"
- }]
- }],
- "#disabled": [{
- token: "text",
- regex: /^\s*\@if(?:n?def)?\b.*$/,
- push: [{
- token: "text",
- regex: /^\s*\@endif\b.*$/,
- next: "pop"
- }, {
- include: "#disabled"
- }, {
- include: "#pragma-mark"
- }],
- comment: "eat nested preprocessor ifdefs"
- }],
- "#preprocessor-rule-other": [{
- token: [
- "text",
- "meta.preprocessor.bro",
- "meta.preprocessor.bro",
- "text"
- ],
- regex: /^(\s*)(@if)((?:n?def)?)\b(.*?)(?:(?=)|$)/,
- push: [{
- token: ["text", "meta.preprocessor.bro", "text"],
- regex: /^(\s*)(@endif)\b(.*$)/,
- next: "pop"
- }, {
- include: "$base"
- }]
- }],
- "#string_escaped_char": [{
- token: "constant.character.escape.bro",
- regex: /\\(?:\\|[abefnprtv'"?]|[0-3]\d{,2}|[4-7]\d?|x[a-fA-F0-9]{,2})/
- }, {
- token: "invalid.illegal.unknown-escape.bro",
- regex: /\\./
- }],
- "#string_placeholder": [{
- token: "constant.other.placeholder.bro",
- regex: /%(?:\d+\$)?[#0\- +']*[,;:_]?(?:-?\d+|\*(?:-?\d+\$)?)?(?:\.(?:-?\d+|\*(?:-?\d+\$)?)?)?(?:hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)?[diouxXDOUeEfFgGaACcSspn%]/
- }, {
- token: "invalid.illegal.placeholder.bro",
- regex: /%/
- }]
- };
-
- this.normalizeRules();
-};
-
-BroHighlightRules.metaData = {
- fileTypes: ["bro"],
- foldingStartMarker: "^(\\@if(n?def)?)",
- foldingStopMarker: "^\\@endif",
- keyEquivalent: "@B",
- name: "Bro",
- scopeName: "source.bro"
-};
-
-
-oop.inherits(BroHighlightRules, TextHighlightRules);
-
-exports.BroHighlightRules = BroHighlightRules;
-});
\ No newline at end of file
diff --git a/lib/ace/mode/bro.js b/lib/ace/mode/zeek.js
similarity index 88%
rename from lib/ace/mode/bro.js
rename to lib/ace/mode/zeek.js
index fd9ff82eeb8..efcfe6e4951 100644
--- a/lib/ace/mode/bro.js
+++ b/lib/ace/mode/zeek.js
@@ -37,22 +37,20 @@ define(function(require, exports, module) {
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
-var BroHighlightRules = require("./bro_highlight_rules").BroHighlightRules;
-// TODO: pick appropriate fold mode
+var ZeekHighlightRules = require("./zeek_highlight_rules").ZeekHighlightRules;
var FoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
- this.HighlightRules = BroHighlightRules;
+ this.HighlightRules = ZeekHighlightRules;
this.foldingRules = new FoldMode();
};
oop.inherits(Mode, TextMode);
(function() {
- // this.lineCommentStart = ""#"";
- // this.blockComment = {start: ""/*"", end: ""*/""};
+ this.lineCommentStart = "#";
// Extra logic goes here.
- this.$id = "ace/mode/bro";
+ this.$id = "ace/mode/zeek";
}).call(Mode.prototype);
exports.Mode = Mode;
-});
\ No newline at end of file
+});
diff --git a/lib/ace/mode/zeek_highlight_rules.js b/lib/ace/mode/zeek_highlight_rules.js
new file mode 100644
index 00000000000..bd70065efcf
--- /dev/null
+++ b/lib/ace/mode/zeek_highlight_rules.js
@@ -0,0 +1,407 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Ajax.org B.V. nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var ZeekHighlightRules = function() {
+ // regexp must not have capturing parentheses. Use (?:) instead.
+ // regexps are ordered -> the first match is used
+
+ this.$rules = {
+ "start": [
+ {
+ token: "comment.line",
+ regex: "#.*$"
+ },
+ {
+ token: "string.double",
+ regex: /"/,
+ next: "string-state"
+ },
+ {
+ token: "string.regexp",
+ regex: "(/)(?=.*/)",
+ next: "pattern-state"
+ },
+ {
+ token: ["keyword.other", "meta.preprocessor"],
+ regex: /(@(?:load-plugin|load-sigs|load|unload))(.*$)/
+ },
+ {
+ token: "keyword.other",
+ regex: /@(?:DEBUG|DIR|FILENAME|deprecated|if|ifdef|ifndef|else|endif)/
+ },
+ {
+ token: [
+ "keyword.other",
+ "meta.preprocessor",
+ "keyword.operator",
+ "meta.preprocessor"
+ ],
+ regex: /(@prefixes)(\s*)(\+?=)(.*$)/
+ },
+ {
+ token: "storage.modifier.attribute",
+ 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/
+ },
+ {
+ token: "constant.language",
+ regex: /\b(?:T|F)\b/
+ },
+ {
+ token: "constant.numeric.port",
+ regex: /\b\d{1,5}\/(?:udp|tcp|icmp|unknown)\b/
+ },
+ {
+ token: "constant.numeric.addr",
+ 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/,
+ comment: "IPv4 address"
+ },
+ {
+ token: "constant.numeric.addr",
+ 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}))?\]/,
+ comment: "IPv6 address"
+ },
+ {
+ token: "constant.numeric.float.decimal.interval",
+ regex: /(?:(?:\d*\.\d*(?:[eE][+-]?\d+)?|\d*[eE][+-]?\d+|\d*\.\d*)|\d+)\s*(?:day|hr|min|msec|usec|sec)s?/
+ },
+ {
+ token: "constant.numeric.float.decimal",
+ regex: /\d*\.\d*(?:[eE][+-]?\d+)?|\d*[eE][+-]?\d+|\d*\.\d*/
+ },
+ {
+ token: "constant.numeric.hostname",
+ regex: /\b[A-Za-z0-9][A-Za-z0-9\-]*(?:\.[A-Za-z0-9][A-Za-z0-9\-]*)+\b/
+ },
+ {
+ token: "constant.numeric.integer.hexadecimal",
+ regex: /\b0x[0-9a-fA-F]+\b/
+ },
+ {
+ token: "constant.numeric.integer.decimal",
+ regex: /\b\d+\b/
+ },
+ {
+ token: "keyword.operator",
+ regex: /==|!=|<=|<|>=|>/
+ },
+ {
+ token: "keyword.operator",
+ regex: /(&&)|(\|\|)|(!)/
+ },
+ {
+ token: "keyword.operator",
+ regex: /=|\+=|-=/
+ },
+ {
+ token: "keyword.operator",
+ regex: /\+\+|\+|--|-|\*|\/|%/
+ },
+ {
+ token: "keyword.operator",
+ regex: /&|\||\^|~/
+ },
+ {
+ token: "keyword.operator",
+ regex: /\b(?:in|as|is)\b/
+ },
+ {
+ token: "punctuation.terminator",
+ regex: /;/
+ },
+ {
+ token: "punctuation.accessor",
+ regex: /\??\$/
+ },
+ {
+ token: "punctuation.accessor",
+ regex: /::/
+ },
+ {
+ token: "keyword.operator",
+ regex: /\?/
+ },
+ // Unsure how to tell if colon is used as operator vs. separator.
+ // {
+ // token: "keyword.operator",
+ // regex: /:/
+ // },
+ {
+ token: "punctuation.separator",
+ regex: /:/
+ },
+ {
+ token: "punctuation.separator",
+ regex: /,/
+ },
+ {
+ token: [
+ "keyword.other",
+ "meta.namespace",
+ "entity.name.namespace"
+ ],
+ regex: /(module)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)/
+ },
+ {
+ token: "keyword.other",
+ regex: /\bexport\b/
+ },
+ {
+ token: "keyword.control.conditional",
+ regex: /\b(?:if|else)\b/
+ },
+ {
+ token: "keyword.control",
+ regex: /\b(?:for|while)\b/
+ },
+ {
+ token: "keyword.control",
+ regex: /\b(?:return|break|next|continue|fallthrough)\b/
+ },
+ {
+ token: "keyword.control",
+ regex: /\b(?:switch|default|case)\b/
+ },
+ {
+ token: "keyword.other",
+ regex: /\b(?:add|delete)\b/
+ },
+ {
+ token: "keyword.other",
+ regex: /\bprint\b/
+ },
+ {
+ token: "keyword.control",
+ regex: /\b(?:when|timeout|schedule)\b/
+ },
+ {
+ token: [
+ "keyword.other",
+ "meta.struct.record",
+ "entity.name.struct.record",
+ "meta.struct.record",
+ "punctuation.separator",
+ "meta.struct.record",
+ "storage.type.struct.record"
+ ],
+ 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/
+ },
+ {
+ token: [
+ "keyword.other",
+ "meta.enum",
+ "entity.name.enum",
+ "meta.enum",
+ "punctuation.separator",
+ "meta.enum",
+ "storage.type.enum"
+ ],
+ 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/
+ },
+ {
+ token: [
+ "keyword.other",
+ "meta.type",
+ "entity.name.type",
+ "meta.type",
+ "punctuation.separator"
+ ],
+ regex: /\b(type)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)(\s*)(:)/
+ },
+ {
+ token: [
+ "keyword.other",
+ "meta.struct.record",
+ "storage.type.struct.record",
+ "meta.struct.record",
+ "entity.name.struct.record"
+ ],
+ regex: /\b(redef)(\s+)(record)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)\b/
+ },
+ {
+ token: [
+ "keyword.other",
+ "meta.enum",
+ "storage.type.enum",
+ "meta.enum",
+ "entity.name.enum"
+ ],
+ regex: /\b(redef)(\s+)(enum)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)\b/
+ },
+ {
+ token: [
+ "storage.type",
+ "text",
+ "entity.name.function.event"
+ ],
+ regex: /\b(event)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)(?=s*\()/
+ },
+ {
+ token: [
+ "storage.type",
+ "text",
+ "entity.name.function.hook"
+ ],
+ regex: /\b(hook)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)(?=s*\()/
+ },
+ {
+ token: [
+ "storage.type",
+ "text",
+ "entity.name.function"
+ ],
+ regex: /\b(function)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)(?=s*\()/
+ },
+ {
+ token: "keyword.other",
+ regex: /\bredef\b/
+ },
+ {
+ token: "storage.type",
+ regex: /\bany\b/
+ },
+ {
+ token: "storage.type",
+ regex: /\b(?:enum|record|set|table|vector)\b/
+ },
+ {
+ token: [
+ "storage.type",
+ "text",
+ "keyword.operator",
+ "text",
+ "storage.type"
+ ],
+ regex: /\b(opaque)(\s+)(of)(\s+)([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)\b/
+ },
+ {
+ token: "keyword.operator",
+ regex: /\bof\b/
+ },
+ {
+ token: "storage.type",
+ regex: /\b(?:addr|bool|count|double|file|int|interval|pattern|port|string|subnet|time)\b/
+ },
+ {
+ token: "storage.type",
+ regex: /\b(?:function|hook|event)\b/
+ },
+ {
+ token: "storage.modifier",
+ regex: /\b(?:global|local|const|option)\b/
+ },
+ {
+ token: "entity.name.function.call",
+ regex: /\b[A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*(?=s*\()/
+ },
+ {
+ token: "punctuation.section.block.begin",
+ regex: /\{/
+ },
+ {
+ token: "punctuation.section.block.end",
+ regex: /\}/
+ },
+ {
+ token: "punctuation.section.brackets.begin",
+ regex: /\[/
+ },
+ {
+ token: "punctuation.section.brackets.end",
+ regex: /\]/
+ },
+ {
+ token: "punctuation.section.parens.begin",
+ regex: /\(/
+ },
+ {
+ token: "punctuation.section.parens.end",
+ regex: /\)/
+ }
+
+ ], // state: start
+
+ "string-state": [
+ {
+ token: "constant.character.escape",
+ regex: /\\./
+ },
+ {
+ token: "string.double",
+ regex: /"/,
+ next: "start"
+ },
+ {
+ token: "constant.other.placeholder",
+ regex: /%-?[0-9]*(\.[0-9]+)?[DTdxsefg]/
+ },
+ {
+ token: "string.double",
+ regex: "."
+ }
+ ], // state: string-state
+
+ "pattern-state": [
+ {
+ token: "constant.character.escape",
+ regex: /\\./
+ },
+ {
+ token: "string.regexp",
+ regex: "/",
+ next: "start"
+ },
+ {
+ token: "string.regexp",
+ regex: "."
+ }
+ ] // state: pattern-state
+
+ };
+
+ this.normalizeRules();
+};
+
+ZeekHighlightRules.metaData = {
+ fileTypes: ["bro", "zeek"],
+ name: "Zeek",
+ scopeName: "source.zeek"
+};
+
+
+oop.inherits(ZeekHighlightRules, TextHighlightRules);
+
+exports.ZeekHighlightRules = ZeekHighlightRules;
+});
diff --git a/lib/ace/snippets/bro.js b/lib/ace/snippets/zeek.js
similarity index 55%
rename from lib/ace/snippets/bro.js
rename to lib/ace/snippets/zeek.js
index 359d9103986..fa638070c33 100644
--- a/lib/ace/snippets/bro.js
+++ b/lib/ace/snippets/zeek.js
@@ -1,7 +1,7 @@
define(function(require, exports, module) {
"use strict";
-exports.snippetText = require("../requirejs/text!./.snippets");
+exports.snippetText = require("../requirejs/text!./zeek.snippets");
exports.scope = "";
});
diff --git a/lib/ace/snippets/bro.snippets b/lib/ace/snippets/zeek.snippets
similarity index 100%
rename from lib/ace/snippets/bro.snippets
rename to lib/ace/snippets/zeek.snippets
From 7c5ae22b86ce2eb8894e6e19343c74a31ceafa28 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Thu, 9 May 2019 23:41:08 +0400
Subject: [PATCH 0158/1293] improve the type of addMarker
---
ace.d.ts | 8 ++++----
build | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/ace.d.ts b/ace.d.ts
index a1c7d2b9c81..330603d99b4 100644
--- a/ace.d.ts
+++ b/ace.d.ts
@@ -438,16 +438,16 @@ export namespace Ace {
setBreakpoint(row: number, className: string): void;
clearBreakpoint(row: number): void;
addMarker(range: Range,
- clazz: string,
- type: MarkerRenderer | string,
- inFront: boolean): number;
+ className: string,
+ type: "fullLine" | "screenLine" | "text" | MarkerRenderer,
+ inFront?: boolean): number;
addDynamicMarker(marker: MarkerLike, inFront: boolean): MarkerLike;
removeMarker(markerId: number): void;
getMarkers(inFront?: boolean): MarkerLike[];
highlight(re: RegExp): void;
highlightLines(startRow: number,
endRow: number,
- clazz: string,
+ className: string,
inFront?: boolean): Range;
setAnnotations(annotations: Annotation[]): void;
getAnnotations(): Annotation[];
diff --git a/build b/build
index 5fe4368221f..812e2c56aed 160000
--- a/build
+++ b/build
@@ -1 +1 @@
-Subproject commit 5fe4368221f48b114387c2e7d67c9cd904ec30a2
+Subproject commit 812e2c56aed246931a667f16c28b096e34597016
From ef35db4182f7cb05a5fc6ff55c82e7ce97aefd3d Mon Sep 17 00:00:00 2001
From: Adam Jimenez
Date: Sun, 12 May 2019 10:53:43 +0100
Subject: [PATCH 0159/1293] missing grid properties and fr unit
---
lib/ace/mode/css/csslint.js | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/ace/mode/css/csslint.js b/lib/ace/mode/css/csslint.js
index fec652802a2..b9d0fa3d35f 100644
--- a/lib/ace/mode/css/csslint.js
+++ b/lib/ace/mode/css/csslint.js
@@ -3875,8 +3875,13 @@ var Properties = {
"grid-row" : 1,
"grid-rows" : 1,
"grid-row-align" : "start | end | center | stretch",
+ "grid-row-gap" : 1,
"grid-row-span" : "",
"grid-row-sizing" : 1,
+ "grid-template" : 1,
+ "grid-template-areas" : 1,
+ "grid-template-columns" : 1,
+ "grid-template-rows" : 1,
//H
"hanging-punctuation" : 1,
@@ -4308,6 +4313,7 @@ function PropertyValuePart(text, line, col){
case "ch":
case "vh":
case "vw":
+ case "fr":
case "vmax":
case "vmin":
this.type = "length";
From fb1c82e2872e7aa9913e94db6ffcd7bd04d6c624 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Tue, 14 May 2019 01:19:39 +0400
Subject: [PATCH 0160/1293] update vim
---
lib/ace/keyboard/vim.js | 340 +++++++++++++++++++++++++++++----
lib/ace/keyboard/vim_test.js | 351 ++++++++++++++++++++++++++---------
2 files changed, 559 insertions(+), 132 deletions(-)
diff --git a/lib/ace/keyboard/vim.js b/lib/ace/keyboard/vim.js
index c2166f7c9f8..de7b14e5ac6 100644
--- a/lib/ace/keyboard/vim.js
+++ b/lib/ace/keyboard/vim.js
@@ -1,9 +1,9 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
/**
* Supported keybindings:
- * Too many to list. Refer to defaultKeyMap below.
+ * Too many to list. Refer to defaultKeymap below.
*
* Supported Ex commands:
* Refer to defaultExCommandMap below.
@@ -114,6 +114,7 @@ define(function(require, exports, module) {
};
};
CodeMirror.lookupKey = function lookupKey(key, map, handle) {
+ if (!map) map = "default";
if (typeof map == "string")
map = CodeMirror.keyMap[map];
var found = typeof map == "function" ? map(key) : map[key];
@@ -513,6 +514,10 @@ define(function(require, exports, module) {
name = optMap[name];
val = !val;
break;
+ case 'keyMap':
+ this.state.$keyMap = val;
+ return;
+ break;
default:
name = optMap[name];
}
@@ -527,6 +532,8 @@ define(function(require, exports, module) {
case 'indentWithTabs':
name = optMap[name];
return !val;
+ case 'keyMap':
+ return this.state.$keyMap;
}
return aceOpt ? val : this.state[name];
};
@@ -580,7 +587,7 @@ define(function(require, exports, module) {
return this.ace.getValue();
};
this.setValue = function(v) {
- return this.ace.setValue(v);
+ return this.ace.setValue(v, -1);
};
this.getTokenTypeAt = function(pos) {
var token = this.ace.session.getTokenAt(pos.line, pos.ch);
@@ -626,7 +633,10 @@ define(function(require, exports, module) {
};
this.getMode = function() {
return { name : this.getOption("mode") };
- }
+ };
+ this.execCommand = function() {
+
+ };
}).call(CodeMirror.prototype);
function toAcePos(cmPos) {
return {row: cmPos.line, column: cmPos.ch};
@@ -867,6 +877,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
{ keys: '', type: 'keyToKey', toKeys: 'j' },
{ keys: '', type: 'keyToKey', toKeys: 'l' },
{ keys: '', type: 'keyToKey', toKeys: 'h', context: 'normal'},
+ { keys: '', type: 'keyToKey', toKeys: 'x', context: 'normal'},
{ keys: '', type: 'keyToKey', toKeys: 'W' },
{ keys: '', type: 'keyToKey', toKeys: 'B', context: 'normal' },
{ keys: '', type: 'keyToKey', toKeys: 'w' },
@@ -907,6 +918,8 @@ dom.importCssString(".normal-mode .ace_cursor{\
{ keys: 'gE', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: true, bigWord: true, inclusive: true }},
{ keys: '{', type: 'motion', motion: 'moveByParagraph', motionArgs: { forward: false, toJumplist: true }},
{ keys: '}', type: 'motion', motion: 'moveByParagraph', motionArgs: { forward: true, toJumplist: true }},
+ { keys: '(', type: 'motion', motion: 'moveBySentence', motionArgs: { forward: false }},
+ { keys: ')', type: 'motion', motion: 'moveBySentence', motionArgs: { forward: true }},
{ keys: '', type: 'motion', motion: 'moveByPage', motionArgs: { forward: true }},
{ keys: '', type: 'motion', motion: 'moveByPage', motionArgs: { forward: false }},
{ keys: '', type: 'motion', motion: 'moveByScroll', motionArgs: { forward: true, explicitRepeat: true }},
@@ -944,6 +957,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
{ keys: 'd', type: 'operator', operator: 'delete' },
{ keys: 'y', type: 'operator', operator: 'yank' },
{ keys: 'c', type: 'operator', operator: 'change' },
+ { keys: '=', type: 'operator', operator: 'indentAuto' },
{ keys: '>', type: 'operator', operator: 'indent', operatorArgs: { indentRight: true }},
{ keys: '<', type: 'operator', operator: 'indent', operatorArgs: { indentRight: false }},
{ keys: 'g~', type: 'operator', operator: 'changeCase' },
@@ -956,13 +970,15 @@ dom.importCssString(".normal-mode .ace_cursor{\
{ keys: 'X', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: false }, operatorMotionArgs: { visualLine: true }},
{ keys: 'D', type: 'operatorMotion', operator: 'delete', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'},
{ keys: 'D', type: 'operator', operator: 'delete', operatorArgs: { linewise: true }, context: 'visual'},
- { keys: 'Y', type: 'operatorMotion', operator: 'yank', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'},
+ { keys: 'Y', type: 'operatorMotion', operator: 'yank', motion: 'expandToLine', motionArgs: { linewise: true }, context: 'normal'},
{ keys: 'Y', type: 'operator', operator: 'yank', operatorArgs: { linewise: true }, context: 'visual'},
{ keys: 'C', type: 'operatorMotion', operator: 'change', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'},
{ keys: 'C', type: 'operator', operator: 'change', operatorArgs: { linewise: true }, context: 'visual'},
{ keys: '~', type: 'operatorMotion', operator: 'changeCase', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorArgs: { shouldMoveCursor: true }, context: 'normal'},
{ keys: '~', type: 'operator', operator: 'changeCase', context: 'visual'},
{ keys: '', type: 'operatorMotion', operator: 'delete', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false }, context: 'insert' },
+ //ignore C-w in normal mode
+ { keys: '', type: 'idle', context: 'normal' },
// Actions
{ keys: '', type: 'action', action: 'jumpListWalk', actionArgs: { forward: true }},
{ keys: '', type: 'action', action: 'jumpListWalk', actionArgs: { forward: false }},
@@ -1019,6 +1035,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
// Ex command
{ keys: ':', type: 'ex' }
];
+ var defaultKeymapLength = defaultKeymap.length;
/**
* Ex commands
@@ -1190,6 +1207,9 @@ dom.importCssString(".normal-mode .ace_cursor{\
function isWhiteSpaceString(k) {
return (/^\s*$/).test(k);
}
+ function isEndOfSentenceSymbol(k) {
+ return '.?!'.indexOf(k) != -1;
+ }
function inArray(val, arr) {
for (var i = 0; i < arr.length; i++) {
if (arr[i] == val) {
@@ -1504,6 +1524,78 @@ dom.importCssString(".normal-mode .ace_cursor{\
unmap: function(lhs, ctx) {
exCommandDispatcher.unmap(lhs, ctx);
},
+ // Non-recursive map function.
+ // NOTE: This will not create mappings to key maps that aren't present
+ // in the default key map. See TODO at bottom of function.
+ noremap: function(lhs, rhs, ctx) {
+ function toCtxArray(ctx) {
+ return ctx ? [ctx] : ['normal', 'insert', 'visual'];
+ }
+ var ctxsToMap = toCtxArray(ctx);
+ // Look through all actual defaults to find a map candidate.
+ var actualLength = defaultKeymap.length, origLength = defaultKeymapLength;
+ for (var i = actualLength - origLength;
+ i < actualLength && ctxsToMap.length;
+ i++) {
+ var mapping = defaultKeymap[i];
+ // Omit mappings that operate in the wrong context(s) and those of invalid type.
+ if (mapping.keys == rhs &&
+ (!ctx || !mapping.context || mapping.context === ctx) &&
+ mapping.type.substr(0, 2) !== 'ex' &&
+ mapping.type.substr(0, 3) !== 'key') {
+ // Make a shallow copy of the original keymap entry.
+ var newMapping = {};
+ for (var key in mapping) {
+ newMapping[key] = mapping[key];
+ }
+ // Modify it point to the new mapping with the proper context.
+ newMapping.keys = lhs;
+ if (ctx && !newMapping.context) {
+ newMapping.context = ctx;
+ }
+ // Add it to the keymap with a higher priority than the original.
+ this._mapCommand(newMapping);
+ // Record the mapped contexts as complete.
+ var mappedCtxs = toCtxArray(mapping.context);
+ ctxsToMap = ctxsToMap.filter(function(el) { return mappedCtxs.indexOf(el) === -1; });
+ }
+ }
+ // TODO: Create non-recursive keyToKey mappings for the unmapped contexts once those exist.
+ },
+ // Remove all user-defined mappings for the provided context.
+ mapclear: function(ctx) {
+ // Partition the existing keymap into user-defined and true defaults.
+ var actualLength = defaultKeymap.length,
+ origLength = defaultKeymapLength;
+ var userKeymap = defaultKeymap.slice(0, actualLength - origLength);
+ defaultKeymap = defaultKeymap.slice(actualLength - origLength);
+ if (ctx) {
+ // If a specific context is being cleared, we need to keep mappings
+ // from all other contexts.
+ for (var i = userKeymap.length - 1; i >= 0; i--) {
+ var mapping = userKeymap[i];
+ if (ctx !== mapping.context) {
+ if (mapping.context) {
+ this._mapCommand(mapping);
+ } else {
+ // `mapping` applies to all contexts so create keymap copies
+ // for each context except the one being cleared.
+ var contexts = ['normal', 'insert', 'visual'];
+ for (var j in contexts) {
+ if (contexts[j] !== ctx) {
+ var newMapping = {};
+ for (var key in mapping) {
+ newMapping[key] = mapping[key];
+ }
+ newMapping.context = contexts[j];
+ this._mapCommand(newMapping);
+ }
+ }
+ }
+ }
+ }
+ }
+ },
// TODO: Expose setOption and getOption as instance methods. Need to decide how to namespace
// them, or somehow make them work with the existing CodeMirror setOption/getOption API.
setOption: setOption,
@@ -1633,7 +1725,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
if (vim.insertMode) { command = handleKeyInsertMode(); }
else { command = handleKeyNonInsertMode(); }
if (command === false) {
- return undefined;
+ return undefined; //ace_patch
} else if (command === true) {
// TODO: Look into using CodeMirror's multi-key handling.
// Return no-op since we are caching the key. Counts as handled, but
@@ -1922,7 +2014,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
}
if (bestMatch.keys.slice(-11) == '') {
var character = lastChar(keys);
- if (//.test(character)) return {type: 'none'};
+ if (//.test(character) || !character) return {type: 'none'}; //ace_patch
inputState.selectedCharacter = character;
}
return {type: 'full', command: bestMatch};
@@ -2591,6 +2683,10 @@ dom.importCssString(".normal-mode .ace_cursor{\
var dir = motionArgs.forward ? 1 : -1;
return findParagraph(cm, head, motionArgs.repeat, dir);
},
+ moveBySentence: function(cm, head, motionArgs) {
+ var dir = motionArgs.forward ? 1 : -1;
+ return findSentence(cm, head, motionArgs.repeat, dir);
+ },
moveByScroll: function(cm, head, motionArgs, vim) {
var scrollbox = cm.getScrollInfo();
var curEnd = null;
@@ -2664,17 +2760,19 @@ dom.importCssString(".normal-mode .ace_cursor{\
var ch = cursor.ch;
var lineText = cm.getLine(line);
var symbol;
- do {
- symbol = lineText.charAt(ch++);
+ for (; ch < lineText.length; ch++) {
+ symbol = lineText.charAt(ch);
if (symbol && isMatchableSymbol(symbol)) {
- var style = cm.getTokenTypeAt(Pos(line, ch));
+ var style = cm.getTokenTypeAt(Pos(line, ch + 1));
if (style !== "string" && style !== "comment") {
break;
}
}
- } while (symbol);
- if (symbol) {
- var matched = cm.findMatchingBracket(Pos(line, ch));
+ }
+ if (ch < lineText.length) {
+ // Only include angle brackets in analysis if they are being matched.
+ var re = /[<>]/.test(lineText[ch]) ? /[(){}[\]<>]/ : /[(){}[\]]/;
+ var matched = cm.findMatchingBracket(Pos(line, ch+1), {bracketRegex: re});
return matched.to;
} else {
return cursor;
@@ -2694,9 +2792,6 @@ dom.importCssString(".normal-mode .ace_cursor{\
textObjectManipulation: function(cm, head, motionArgs, vim) {
// TODO: lots of possible exceptions that can be thrown here. Try da(
// outside of a () block.
-
- // TODO: adding <> >< to this map doesn't work, presumably because
- // they're operators
var mirroredPairs = {'(': ')', ')': '(',
'{': '}', '}': '{',
'[': ']', ']': '[',
@@ -2888,6 +2983,10 @@ dom.importCssString(".normal-mode .ace_cursor{\
}
return motions.moveToFirstNonWhiteSpaceCharacter(cm, ranges[0].anchor);
},
+ indentAuto: function(cm, _args, ranges) {
+ cm.execCommand("indentAuto");
+ return motions.moveToFirstNonWhiteSpaceCharacter(cm, ranges[0].anchor);
+ },
changeCase: function(cm, args, ranges, oldAnchor, newHead) {
var selections = cm.getSelections();
var swapped = [];
@@ -2997,9 +3096,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
switch (actionArgs.position) {
case 'center': y = y - (height / 2) + lineHeight;
break;
- case 'bottom': y = y - height + lineHeight*1.4;
- break;
- case 'top': y = y + lineHeight*0.4;
+ case 'bottom': y = y - height + lineHeight;
break;
}
cm.scrollTo(null, y);
@@ -3010,6 +3107,8 @@ dom.importCssString(".normal-mode .ace_cursor{\
var macroModeState = vimGlobalState.macroModeState;
if (registerName == '@') {
registerName = macroModeState.latestRegister;
+ } else {
+ macroModeState.latestRegister = registerName;
}
while(repeat--){
executeMacroRegister(cm, vim, macroModeState, registerName);
@@ -3258,7 +3357,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
}
var linewise = register.linewise;
var blockwise = register.blockwise;
- if (linewise && !blockwise) {
+ if (linewise && !blockwise) { // ace_patch
if(vim.visualMode) {
text = vim.visualLine ? text.slice(0, -1) : '\n' + text.slice(0, text.length - 1) + '\n';
} else if (actionArgs.after) {
@@ -3510,12 +3609,6 @@ dom.importCssString(".normal-mode .ace_cursor{\
}
return Pos(cur.line + offsetLine, cur.ch + offsetCh);
}
- function getOffset(anchor, head) {
- return {
- line: head.line - anchor.line,
- ch: head.line - anchor.line
- };
- }
function commandMatches(keys, keyMap, context, inputState) {
// Partial matches are not applied. They inform the key handler
// that the current key sequence is a subsequence of a valid key
@@ -4332,6 +4425,179 @@ dom.importCssString(".normal-mode .ace_cursor{\
return { start: start, end: end };
}
+ function findSentence(cm, cur, repeat, dir) {
+
+ /*
+ Takes an index object
+ {
+ line: the line string,
+ ln: line number,
+ pos: index in line,
+ dir: direction of traversal (-1 or 1)
+ }
+ and modifies the line, ln, and pos members to represent the
+ next valid position or sets them to null if there are
+ no more valid positions.
+ */
+ function nextChar(cm, idx) {
+ if (idx.pos + idx.dir < 0 || idx.pos + idx.dir >= idx.line.length) {
+ idx.ln += idx.dir;
+ if (!isLine(cm, idx.ln)) {
+ idx.line = null;
+ idx.ln = null;
+ idx.pos = null;
+ return;
+ }
+ idx.line = cm.getLine(idx.ln);
+ idx.pos = (idx.dir > 0) ? 0 : idx.line.length - 1;
+ }
+ else {
+ idx.pos += idx.dir;
+ }
+ }
+
+ /*
+ Performs one iteration of traversal in forward direction
+ Returns an index object of the new location
+ */
+ function forward(cm, ln, pos, dir) {
+ var line = cm.getLine(ln);
+ var stop = (line === "");
+
+ var curr = {
+ line: line,
+ ln: ln,
+ pos: pos,
+ dir: dir,
+ }
+
+ var last_valid = {
+ ln: curr.ln,
+ pos: curr.pos,
+ }
+
+ var skip_empty_lines = (curr.line === "");
+
+ // Move one step to skip character we start on
+ nextChar(cm, curr);
+
+ while (curr.line !== null) {
+ last_valid.ln = curr.ln;
+ last_valid.pos = curr.pos;
+
+ if (curr.line === "" && !skip_empty_lines) {
+ return { ln: curr.ln, pos: curr.pos, };
+ }
+ else if (stop && curr.line !== "" && !isWhiteSpaceString(curr.line[curr.pos])) {
+ return { ln: curr.ln, pos: curr.pos, };
+ }
+ else if (isEndOfSentenceSymbol(curr.line[curr.pos])
+ && !stop
+ && (curr.pos === curr.line.length - 1
+ || isWhiteSpaceString(curr.line[curr.pos + 1]))) {
+ stop = true;
+ }
+
+ nextChar(cm, curr);
+ }
+
+ /*
+ Set the position to the last non whitespace character on the last
+ valid line in the case that we reach the end of the document.
+ */
+ var line = cm.getLine(last_valid.ln);
+ last_valid.pos = 0;
+ for(var i = line.length - 1; i >= 0; --i) {
+ if (!isWhiteSpaceString(line[i])) {
+ last_valid.pos = i;
+ break;
+ }
+ }
+
+ return last_valid;
+
+ }
+
+ /*
+ Performs one iteration of traversal in reverse direction
+ Returns an index object of the new location
+ */
+ function reverse(cm, ln, pos, dir) {
+ var line = cm.getLine(ln);
+
+ var curr = {
+ line: line,
+ ln: ln,
+ pos: pos,
+ dir: dir,
+ }
+
+ var last_valid = {
+ ln: curr.ln,
+ pos: null,
+ };
+
+ var skip_empty_lines = (curr.line === "");
+
+ // Move one step to skip character we start on
+ nextChar(cm, curr);
+
+ while (curr.line !== null) {
+
+ if (curr.line === "" && !skip_empty_lines) {
+ if (last_valid.pos !== null) {
+ return last_valid;
+ }
+ else {
+ return { ln: curr.ln, pos: curr.pos };
+ }
+ }
+ else if (isEndOfSentenceSymbol(curr.line[curr.pos])
+ && last_valid.pos !== null
+ && !(curr.ln === last_valid.ln && curr.pos + 1 === last_valid.pos)) {
+ return last_valid;
+ }
+ else if (curr.line !== "" && !isWhiteSpaceString(curr.line[curr.pos])) {
+ skip_empty_lines = false;
+ last_valid = { ln: curr.ln, pos: curr.pos }
+ }
+
+ nextChar(cm, curr);
+ }
+
+ /*
+ Set the position to the first non whitespace character on the last
+ valid line in the case that we reach the beginning of the document.
+ */
+ var line = cm.getLine(last_valid.ln);
+ last_valid.pos = 0;
+ for(var i = 0; i < line.length; ++i) {
+ if (!isWhiteSpaceString(line[i])) {
+ last_valid.pos = i;
+ break;
+ }
+ }
+ return last_valid;
+ }
+
+ var curr_index = {
+ ln: cur.line,
+ pos: cur.ch,
+ };
+
+ while (repeat > 0) {
+ if (dir < 0) {
+ curr_index = reverse(cm, curr_index.ln, curr_index.pos, dir);
+ }
+ else {
+ curr_index = forward(cm, curr_index.ln, curr_index.pos, dir);
+ }
+ repeat--;
+ }
+
+ return Pos(curr_index.ln, curr_index.pos);
+ }
+
// TODO: perhaps this finagling of start and end positions belonds
// in codemirror/replaceRange?
function selectCompanionObject(cm, head, symb, inclusive) {
@@ -4352,8 +4618,8 @@ dom.importCssString(".normal-mode .ace_cursor{\
// cursor is on a matching open bracket.
var offset = curChar === openSym ? 1 : 0;
- start = cm.scanForBracket(Pos(cur.line, cur.ch + offset), -1, null, {'bracketRegex': bracketRegexp});
- end = cm.scanForBracket(Pos(cur.line, cur.ch + offset), 1, null, {'bracketRegex': bracketRegexp});
+ start = cm.scanForBracket(Pos(cur.line, cur.ch + offset), -1, undefined, {'bracketRegex': bracketRegexp});
+ end = cm.scanForBracket(Pos(cur.line, cur.ch + offset), 1, undefined, {'bracketRegex': bracketRegexp});
if (!start || !end) {
return { start: cur, end: cur };
@@ -4487,11 +4753,10 @@ dom.importCssString(".normal-mode .ace_cursor{\
onClose(prompt(shortText, ''));
}
}
-
function splitBySlash(argString) {
return splitBySeparator(argString, '/');
}
-
+
function findUnescapedSlashes(argString) {
return findUnescapedSeparators(argString, '/');
}
@@ -5710,13 +5975,6 @@ dom.importCssString(".normal-mode .ace_cursor{\
CodeMirror.keyMap['vim-insert'] = {
// TODO: override navigation keys so that Esc will cancel automatic
// indentation from o, O, i_
- 'Ctrl-N': 'autocomplete',
- 'Ctrl-P': 'autocomplete',
- 'Enter': function(cm) {
- var fn = CodeMirror.commands.newlineAndIndentContinueComment ||
- CodeMirror.commands.newlineAndIndent;
- fn(cm);
- },
fallthrough: ['default'],
attach: attachVimMap,
detach: detachVimMap,
@@ -5816,10 +6074,12 @@ dom.importCssString(".normal-mode .ace_cursor{\
lastChange.changes = [];
lastChange.maybeReset = false;
}
- if (cm.state.overwrite && !/\n/.test(text)) {
+ if (text) {
+ if (cm.state.overwrite && !/\n/.test(text)) {
lastChange.changes.push([text]);
- } else {
+ } else {
lastChange.changes.push(text);
+ }
}
}
// Change objects may be chained with next.
@@ -6319,6 +6579,4 @@ dom.importCssString(".normal-mode .ace_cursor{\
exports.handler.defaultKeymap = defaultKeymap;
exports.handler.actions = actions;
exports.Vim = Vim;
-
- Vim.map("Y", "yy", "normal");
});
diff --git a/lib/ace/keyboard/vim_test.js b/lib/ace/keyboard/vim_test.js
index 8a4316f9fde..ecd964d73e8 100644
--- a/lib/ace/keyboard/vim_test.js
+++ b/lib/ace/keyboard/vim_test.js
@@ -74,15 +74,6 @@ function test(name, fn) {
else
exports["test " + name] = fn;
}
-function expectFail(fn, silent) {
- try {
- fn();
- } catch(expected) {
- return;
- };
- if (!silent)
- throw new Error("Expected to throw an error");
-}
vim.CodeMirror.Vim.unmap("Y");
vim.CodeMirror.Vim.defineEx('write', 'w', function(cm) {
@@ -208,6 +199,15 @@ function forEach(arr, func) {
}
}
+function expectFail(fn) {
+ try {
+ fn();
+ } catch(expected) {
+ return;
+ };
+ throw new Error("Expected to throw an error");
+}
+
function testVim(name, run, opts, expectedFail) {
var vimOpts = {
lineNumbers: true,
@@ -231,10 +231,12 @@ function testVim(name, run, opts, expectedFail) {
arguments = args;
}
for (var i = 0; i < arguments.length; i++) {
+ // ace_patch{
var ch = arguments[i];
var result = ch.length == 1
? cm.ace.keyBinding.$callKeyboardHandlers(-1, ch, 0)
: CodeMirror.Vim.handleKey(cm, arguments[i]);
+ // ace_patch}
if (!result && cm.state.vim.insertMode) {
cm.replaceSelections(fillArray(arguments[i], cm.listSelections().length));
}
@@ -319,8 +321,8 @@ function testVim(name, run, opts, expectedFail) {
cm.openDialog = savedOpenDialog;
// ace_patch
}
- });
-}
+ }, expectedFail);
+};
testVim('qq@q', function(cm, vim, helpers) {
cm.setCursor(0, 0);
helpers.doKeys('q', 'q', 'l', 'l', 'q');
@@ -425,6 +427,8 @@ testMotion('k', 'k', offsetCursor(word3.end, -1, 0), word3.end);
testMotion('k_repeat', ['2', 'k'], makeCursor(0, 4), makeCursor(2, 4));
testMotion('k_repeat_clip', ['1000', 'k'], makeCursor(0, 4), makeCursor(2, 4));
testMotion('w', 'w', word1.start);
+testMotion('keepHPos', ['5', 'j', 'j', '7', 'k'], makeCursor(8, 12), makeCursor(12, 12));
+testMotion('keepHPosEol', ['$', '2', 'j'], makeCursor(2, 18));
testMotion('w_multiple_newlines_no_space', 'w', makeCursor(12, 2), makeCursor(11, 2));
testMotion('w_multiple_newlines_with_space', 'w', makeCursor(14, 0), makeCursor(12, 51));
testMotion('w_repeat', ['2', 'w'], word2.start);
@@ -536,7 +540,6 @@ testVim('gj_gk_clipping', function(cm,vim,helpers){
},{value: 'line 1\n\nline 2'});
//testing a mix of j/k and gj/gk
testVim('j_k_and_gj_gk', function(cm,vim,helpers){
- if (phantom) return;
cm.setSize(120);
cm.setCursor(0, 0);
//go to the last character on the first line
@@ -612,6 +615,40 @@ testVim('{', function(cm, vim, helpers) {
helpers.doKeys('6', '{');
helpers.assertCursorAt(0, 0);
}, { value: 'a\n\nb\nc\n\nd' });
+testVim('(', function(cm, vim, helpers) {
+ cm.setCursor(6, 23);
+ helpers.doKeys('(');
+ helpers.assertCursorAt(6, 14);
+ helpers.doKeys('2', '(');
+ helpers.assertCursorAt(5, 0);
+ helpers.doKeys('(');
+ helpers.assertCursorAt(4, 0);
+ helpers.doKeys('(');
+ helpers.assertCursorAt(3, 0);
+ helpers.doKeys('(');
+ helpers.assertCursorAt(2, 0);
+ helpers.doKeys('(');
+ helpers.assertCursorAt(0, 0);
+ helpers.doKeys('(');
+ helpers.assertCursorAt(0, 0);
+}, { value: 'sentence1.\n\n\nsentence2\n\nsentence3. sentence4\n sentence5? sentence6!' });
+testVim(')', function(cm, vim, helpers) {
+ cm.setCursor(0, 0);
+ helpers.doKeys('2', ')');
+ helpers.assertCursorAt(3, 0);
+ helpers.doKeys(')');
+ helpers.assertCursorAt(4, 0);
+ helpers.doKeys(')');
+ helpers.assertCursorAt(5, 0);
+ helpers.doKeys(')');
+ helpers.assertCursorAt(5, 11);
+ helpers.doKeys(')');
+ helpers.assertCursorAt(6, 14);
+ helpers.doKeys(')');
+ helpers.assertCursorAt(6, 23);
+ helpers.doKeys(')');
+ helpers.assertCursorAt(6, 23);
+}, { value: 'sentence1.\n\n\nsentence2\n\nsentence3. sentence4\n sentence5? sentence6!' });
testVim('paragraph_motions', function(cm, vim, helpers) {
cm.setCursor(10, 0);
helpers.doKeys('{');
@@ -1123,21 +1160,18 @@ function fillArray(val, times) {
testVim('c_visual_block', function(cm, vim, helpers) {
cm.setCursor(0, 1);
helpers.doKeys('', '2', 'j', 'l', 'l', 'l', 'c');
- var replacement = fillArray('hello', 3);
- cm.replaceSelections(replacement);
+ helpers.doKeys('hello');
eq('1hello\n5hello\nahellofg', cm.getValue());
helpers.doKeys('');
cm.setCursor(2, 3);
helpers.doKeys('', '2', 'k', 'h', 'C');
- replacement = fillArray('world', 3);
- cm.replaceSelections(replacement);
+ helpers.doKeys('world');
eq('1hworld\n5hworld\nahworld', cm.getValue());
}, {value: '1234\n5678\nabcdefg'});
testVim('c_visual_block_replay', function(cm, vim, helpers) {
cm.setCursor(0, 1);
helpers.doKeys('', '2', 'j', 'l', 'c');
- var replacement = fillArray('fo', 3);
- cm.replaceSelections(replacement);
+ helpers.doKeys('fo');
eq('1fo4\n5fo8\nafodefg', cm.getValue());
helpers.doKeys('');
cm.setCursor(0, 0);
@@ -1147,8 +1181,7 @@ testVim('c_visual_block_replay', function(cm, vim, helpers) {
testVim('I_visual_block_replay', function(cm, vim, helpers) {
cm.setCursor(0, 2);
helpers.doKeys('', '2', 'j', 'l', 'I');
- var replacement = fillArray('+-', 3);
- cm.replaceSelections(replacement);
+ helpers.doKeys('+-')
eq('12+-34\n56+-78\nab+-cdefg\nxyz', cm.getValue());
helpers.doKeys('');
// ensure that repeat location doesn't depend on last selection
@@ -1181,14 +1214,12 @@ testVim('D_visual_block', function(cm, vim, helpers) {
testVim('s_visual_block', function(cm, vim, helpers) {
cm.setCursor(0, 1);
helpers.doKeys('', '2', 'j', 'l', 'l', 'l', 's');
- var replacement = fillArray('hello{', 3);
- cm.replaceSelections(replacement);
+ helpers.doKeys('hello{');
eq('1hello{\n5hello{\nahello{fg\n', cm.getValue());
helpers.doKeys('');
cm.setCursor(2, 3);
helpers.doKeys('', '1', 'k', 'h', 'S');
- replacement = fillArray('world', 1);
- cm.replaceSelections(replacement);
+ helpers.doKeys('world');
eq('1hello{\n world\n', cm.getValue());
}, {value: '1234\n5678\nabcdefg\n'});
@@ -1313,6 +1344,13 @@ testVim('<<', function(cm, vim, helpers) {
is(!register.linewise);
helpers.assertCursorAt(0, 1);
}, { value: ' word1\n word2\nword3 ', indentUnit: 2 });
+isAce || testVim('=', function(cm, vim, helpers) {
+ cm.setCursor(0, 3);
+ helpers.doKeys('', 'j', 'j');
+ var expectedValue = 'word1\nword2\nword3';
+ helpers.doKeys('=');
+ eq(expectedValue, cm.getValue());
+}, { value: ' word1\n word2\n word3', indentUnit: 2 });
// Edit tests
function testEdit(name, before, pos, edit, after) {
@@ -1415,6 +1453,12 @@ testEdit('di]_middle_spc', 'a\t[\n\tbar\n]b', /r/, 'di]', 'a\t[]b');
testEdit('da[_middle_spc', 'a\t[\n\tbar\n]b', /r/, 'da[', 'a\tb');
testEdit('da]_middle_spc', 'a\t[\n\tbar\n]b', /r/, 'da]', 'a\tb');
+// open and close on diff lines, open indented more than close
+testEdit('di<_middle_spc', 'a\t<\n\tbar\n>b', /r/, 'di<', 'a\t<>b');
+testEdit('di>_middle_spc', 'a\t<\n\tbar\n>b', /r/, 'di>', 'a\t<>b');
+testEdit('da<_middle_spc', 'a\t<\n\tbar\n>b', /r/, 'da<', 'a\tb');
+testEdit('da>_middle_spc', 'a\t<\n\tbar\n>b', /r/, 'da>', 'a\tb');
+
function testSelection(name, before, pos, keys, sel) {
return testVim(name, function(cm, vim, helpers) {
var ch = before.search(pos)
@@ -1528,6 +1572,16 @@ testVim('insert_ctrl_w', function(cm, vim, helpers) {
eqCursorPos(curEnd, cm.getCursor());
eq('vim-insert', cm.getOption('keyMap'));
}, { value: 'word1/word2' });
+testVim('normal_ctrl_w', function(cm, vim, helpers) {
+ var curStart = makeCursor(0, 3);
+ cm.setCursor(curStart);
+ helpers.doKeys('');
+ eq('word', cm.getValue());
+ var curEnd = makeCursor(0, 3);
+ helpers.assertCursorAt(0,3);
+ eqCursorPos(curEnd, cm.getCursor());
+ is(!vim.insertMode);
+}, {value: 'word'});
testVim('a', function(cm, vim, helpers) {
cm.setCursor(0, 1);
helpers.doKeys('a');
@@ -1555,7 +1609,7 @@ testVim('i', function(cm, vim, helpers) {
});
testVim('i_repeat', function(cm, vim, helpers) {
helpers.doKeys('3', 'i');
- cm.replaceRange('test', cm.getCursor());
+ helpers.doKeys('test')
helpers.doKeys('');
eq('testtesttest', cm.getValue());
helpers.assertCursorAt(0, 11);
@@ -1563,7 +1617,7 @@ testVim('i_repeat', function(cm, vim, helpers) {
testVim('i_repeat_delete', function(cm, vim, helpers) {
cm.setCursor(0, 4);
helpers.doKeys('2', 'i');
- cm.replaceRange('z', cm.getCursor());
+ helpers.doKeys('z')
helpers.doInsertModeKeys('Backspace', 'Backspace');
helpers.doKeys('');
eq('abe', cm.getValue());
@@ -1595,6 +1649,31 @@ isAce || testVim('i_overwrite_backspace', function(cm, vim, helpers) {
helpers.assertCursorAt(Pos(0, 9, "after"));
eq('0123456789', cm.getValue());
}, { value: '0123456789'});
+testVim('i_forward_delete', function(cm, vim, helpers) {
+ cm.setCursor(0, 3);
+ helpers.doKeys('i');
+ helpers.doInsertModeKeys('Delete');
+ helpers.assertCursorAt(0, 3);
+ eq('A124\nBCD', cm.getValue());
+ helpers.doInsertModeKeys('Delete');
+ helpers.assertCursorAt(0, 3);
+ eq('A12\nBCD', cm.getValue());
+ helpers.doInsertModeKeys('Delete');
+ helpers.assertCursorAt(0, 3);
+ eq('A12BCD', cm.getValue());
+}, { value: 'A1234\nBCD'});
+testVim('forward_delete', function(cm, vim, helpers) {
+ cm.setCursor(0, 3);
+ helpers.doKeys('');
+ helpers.assertCursorAt(0, 3);
+ eq('A124\nBCD', cm.getValue());
+ helpers.doKeys('');
+ helpers.assertCursorAt(0, 2);
+ eq('A12\nBCD', cm.getValue());
+ helpers.doKeys('');
+ helpers.assertCursorAt(0, 1);
+ eq('A1\nBCD', cm.getValue());
+}, { value: 'A1234\nBCD'});
testVim('A', function(cm, vim, helpers) {
helpers.doKeys('A');
helpers.assertCursorAt(0, lines[0].length);
@@ -1603,9 +1682,7 @@ testVim('A', function(cm, vim, helpers) {
testVim('A_visual_block', function(cm, vim, helpers) {
cm.setCursor(0, 1);
helpers.doKeys('', '2', 'j', 'l', 'l', 'A');
- var replacement = new Array(cm.listSelections().length+1).join('hello ').split(' ');
- replacement.pop();
- cm.replaceSelections(replacement);
+ helpers.doKeys('hello');
eq('testhello\nmehello\npleahellose', cm.getValue());
helpers.doKeys('');
cm.setCursor(0, 0);
@@ -1622,7 +1699,7 @@ testVim('I', function(cm, vim, helpers) {
testVim('I_repeat', function(cm, vim, helpers) {
cm.setCursor(0, 1);
helpers.doKeys('3', 'I');
- cm.replaceRange('test', cm.getCursor());
+ helpers.doKeys('test')
helpers.doKeys('');
eq('testtesttestblah', cm.getValue());
helpers.assertCursorAt(0, 11);
@@ -1630,9 +1707,7 @@ testVim('I_repeat', function(cm, vim, helpers) {
testVim('I_visual_block', function(cm, vim, helpers) {
cm.setCursor(0, 0);
helpers.doKeys('', '2', 'j', 'l', 'l', 'I');
- var replacement = new Array(cm.listSelections().length+1).join('hello ').split(' ');
- replacement.pop();
- cm.replaceSelections(replacement);
+ helpers.doKeys('hello');
eq('hellotest\nhellome\nhelloplease', cm.getValue());
}, {value: 'test\nme\nplease'});
testVim('o', function(cm, vim, helpers) {
@@ -1645,7 +1720,7 @@ testVim('o', function(cm, vim, helpers) {
testVim('o_repeat', function(cm, vim, helpers) {
cm.setCursor(0, 0);
helpers.doKeys('3', 'o');
- cm.replaceRange('test', cm.getCursor());
+ helpers.doKeys('test')
helpers.doKeys('');
eq('\ntest\ntest\ntest', cm.getValue());
helpers.assertCursorAt(3, 3);
@@ -1753,7 +1828,6 @@ testVim('r', function(cm, vim, helpers) {
cm.setCursor(0, 4);
helpers.doKeys('v', 'j', 'h', 'r', '');
eq('wuuu \n her', cm.getValue(),'Replacing selection by space-characters failed');
- if (isAce) return;
cm.setValue("ox");
helpers.doKeys('r', '');
eq('ox', cm.getValue());
@@ -1771,8 +1845,8 @@ testVim('r_visual_block', function(cm, vim, helpers) {
eq('1 l\n5 l\nalllefg', cm.getValue());
cm.setCursor(2, 0);
helpers.doKeys('o');
+ helpers.doKeys('\t\t')
helpers.doKeys('');
- cm.replaceRange('\t\t', cm.getCursor());
helpers.doKeys('', 'h', 'h', 'r', 'r');
eq('1 l\n5 l\nalllefg\nrrrrrrrr', cm.getValue());
}, {value: '1234\n5678\nabcdefg'});
@@ -2616,7 +2690,7 @@ testVim('g#', function(cm, vim, helpers) {
testVim('macro_insert', function(cm, vim, helpers) {
cm.setCursor(0, 0);
helpers.doKeys('q', 'a', '0', 'i');
- cm.replaceRange('foo', cm.getCursor());
+ helpers.doKeys('foo')
helpers.doKeys('');
helpers.doKeys('q', '@', 'a');
eq('foofoo', cm.getValue());
@@ -2624,14 +2698,14 @@ testVim('macro_insert', function(cm, vim, helpers) {
testVim('macro_insert_repeat', function(cm, vim, helpers) {
cm.setCursor(0, 0);
helpers.doKeys('q', 'a', '$', 'a');
- cm.replaceRange('larry.', cm.getCursor());
+ helpers.doKeys('larry.')
helpers.doKeys('');
helpers.doKeys('a');
- cm.replaceRange('curly.', cm.getCursor());
+ helpers.doKeys('curly.')
helpers.doKeys('');
helpers.doKeys('q');
helpers.doKeys('a');
- cm.replaceRange('moe.', cm.getCursor());
+ helpers.doKeys('moe.')
helpers.doKeys('');
helpers.doKeys('@', 'a');
// At this point, the most recent edit should be the 2nd insert change
@@ -2697,13 +2771,22 @@ testVim('macro_last_ex_command_register', function (cm, vim, helpers) {
eq('bbbaa', cm.getValue());
helpers.assertCursorAt(0, 2);
}, { value: 'aaaaa'});
+testVim('macro_last_run_macro', function (cm, vim, helpers) {
+ cm.setCursor(0, 0);
+ helpers.doKeys('q', 'a', 'C', 'a', '', 'q');
+ helpers.doKeys('q', 'b', 'C', 'b', '', 'q');
+ helpers.doKeys('@', 'a');
+ helpers.doKeys('d', 'd');
+ helpers.doKeys('@', '@');
+ eq('a', cm.getValue());
+}, { value: ''});
testVim('macro_parens', function(cm, vim, helpers) {
cm.setCursor(0, 0);
helpers.doKeys('q', 'z', 'i');
- cm.replaceRange('(', cm.getCursor());
+ helpers.doKeys('(')
helpers.doKeys('');
helpers.doKeys('e', 'a');
- cm.replaceRange(')', cm.getCursor());
+ helpers.doKeys(')')
helpers.doKeys('');
helpers.doKeys('q');
helpers.doKeys('w', '@', 'z');
@@ -2713,13 +2796,13 @@ testVim('macro_parens', function(cm, vim, helpers) {
testVim('macro_overwrite', function(cm, vim, helpers) {
cm.setCursor(0, 0);
helpers.doKeys('q', 'z', '0', 'i');
- cm.replaceRange('I ', cm.getCursor());
+ helpers.doKeys('I ')
helpers.doKeys('');
helpers.doKeys('q');
helpers.doKeys('e');
// Now replace the macro with something else.
helpers.doKeys('q', 'z', 'a');
- cm.replaceRange('.', cm.getCursor());
+ helpers.doKeys('.')
helpers.doKeys('');
helpers.doKeys('q');
helpers.doKeys('e', '@', 'z');
@@ -2818,11 +2901,11 @@ testVim('yank_append_word_to_line_register', function(cm, vim, helpers) {
testVim('macro_register', function(cm, vim, helpers) {
cm.setCursor(0, 0);
helpers.doKeys('q', 'a', 'i');
- cm.replaceRange('gangnam', cm.getCursor());
+ helpers.doKeys('gangnam')
helpers.doKeys('');
helpers.doKeys('q');
helpers.doKeys('q', 'b', 'o');
- cm.replaceRange('style', cm.getCursor());
+ helpers.doKeys('style')
helpers.doKeys('');
helpers.doKeys('q');
cm.openDialog = helpers.fakeOpenDialog('registers');
@@ -2835,7 +2918,7 @@ testVim('macro_register', function(cm, vim, helpers) {
testVim('._register', function(cm,vim,helpers) {
cm.setCursor(0,0);
helpers.doKeys('i');
- cm.replaceRange('foo',cm.getCursor());
+ helpers.doKeys('foo')
helpers.doKeys('');
cm.openDialog = helpers.fakeOpenDialog('registers');
cm.openNotification = helpers.fakeOpenNotification(function(text) {
@@ -3024,13 +3107,13 @@ testVim('._repeat', function(cm, vim, helpers) {
}, { value: '1 2 3 4 5 6'});
testVim('._insert', function(cm, vim, helpers) {
helpers.doKeys('i');
- cm.replaceRange('test', cm.getCursor());
+ helpers.doKeys('test')
helpers.doKeys('');
helpers.doKeys('.');
eq('testestt', cm.getValue());
helpers.assertCursorAt(0, 6);
helpers.doKeys('O');
- cm.replaceRange('xyz', cm.getCursor());
+ helpers.doKeys('xyz')
helpers.doInsertModeKeys('Backspace');
helpers.doInsertModeKeys('Down');
helpers.doKeys('');
@@ -3040,7 +3123,7 @@ testVim('._insert', function(cm, vim, helpers) {
}, { value: ''});
testVim('._insert_repeat', function(cm, vim, helpers) {
helpers.doKeys('i');
- cm.replaceRange('test', cm.getCursor());
+ helpers.doKeys('test')
cm.setCursor(0, 4);
helpers.doKeys('');
helpers.doKeys('2', '.');
@@ -3049,7 +3132,7 @@ testVim('._insert_repeat', function(cm, vim, helpers) {
}, { value: ''});
testVim('._repeat_insert', function(cm, vim, helpers) {
helpers.doKeys('3', 'i');
- cm.replaceRange('te', cm.getCursor());
+ helpers.doKeys('te')
cm.setCursor(0, 2);
helpers.doKeys('');
helpers.doKeys('.');
@@ -3058,7 +3141,7 @@ testVim('._repeat_insert', function(cm, vim, helpers) {
}, { value: ''});
testVim('._insert_o', function(cm, vim, helpers) {
helpers.doKeys('o');
- cm.replaceRange('z', cm.getCursor());
+ helpers.doKeys('z')
cm.setCursor(1, 1);
helpers.doKeys('');
helpers.doKeys('.');
@@ -3067,7 +3150,7 @@ testVim('._insert_o', function(cm, vim, helpers) {
}, { value: ''});
testVim('._insert_o_repeat', function(cm, vim, helpers) {
helpers.doKeys('o');
- cm.replaceRange('z', cm.getCursor());
+ helpers.doKeys('z')
helpers.doKeys('');
cm.setCursor(1, 0);
helpers.doKeys('2', '.');
@@ -3076,7 +3159,7 @@ testVim('._insert_o_repeat', function(cm, vim, helpers) {
}, { value: ''});
testVim('._insert_o_indent', function(cm, vim, helpers) {
helpers.doKeys('o');
- cm.replaceRange('z', cm.getCursor());
+ helpers.doKeys('z')
helpers.doKeys('');
cm.setCursor(1, 2);
helpers.doKeys('.');
@@ -3085,7 +3168,7 @@ testVim('._insert_o_indent', function(cm, vim, helpers) {
}, { value: '{'});
testVim('._insert_cw', function(cm, vim, helpers) {
helpers.doKeys('c', 'w');
- cm.replaceRange('test', cm.getCursor());
+ helpers.doKeys('test')
helpers.doKeys('');
cm.setCursor(0, 3);
helpers.doKeys('2', 'l');
@@ -3097,7 +3180,7 @@ testVim('._insert_cw_repeat', function(cm, vim, helpers) {
// For some reason, repeat cw in desktop VIM will does not repeat insert mode
// changes. Will conform to that behavior.
helpers.doKeys('c', 'w');
- cm.replaceRange('test', cm.getCursor());
+ helpers.doKeys('test');
helpers.doKeys('');
cm.setCursor(0, 4);
helpers.doKeys('l');
@@ -3334,7 +3417,6 @@ testVim('Ty,;', function(cm, vim, helpers) {
eq('01230123456789', cm.getValue());
}, { value: '0123456789'});
testVim('HML', function(cm, vim, helpers) {
- if (phantom) return;
var lines = 35;
var textHeight = cm.defaultTextHeight();
cm.setSize(600, lines*textHeight);
@@ -3394,11 +3476,9 @@ testVim('zt_to_top', function(cm, vim, helpers){
return new Array(500).join('\n');
})()});
testVim('zb', 'insert');
@@ -4336,21 +4445,21 @@ testVim('ex_imap', function(cm, vim, helpers) {
cm.setCursor(0, 1);
CodeMirror.Vim.map('jj', '', 'insert');
helpers.doKeys('', '2', 'j', 'l', 'c');
- var replacement = fillArray('fo', 3);
- cm.replaceSelections(replacement);
+ helpers.doKeys('f', 'o');
eq('1fo4\n5fo8\nafodefg', cm.getValue());
helpers.doKeys('j', 'j');
cm.setCursor(0, 0);
helpers.doKeys('.');
eq('foo4\nfoo8\nfoodefg', cm.getValue());
+ CodeMirror.Vim.mapclear();
}, { value: '1234\n5678\nabcdefg' });
testVim('ex_unmap_api', function(cm, vim, helpers) {
CodeMirror.Vim.map('', 'gg', 'normal');
is(CodeMirror.Vim.handleKey(cm, "", "normal"), "Alt-X key is mapped");
CodeMirror.Vim.unmap("", "normal");
is(!CodeMirror.Vim.handleKey(cm, "", "normal"), "Alt-X key is unmapped");
+ CodeMirror.Vim.mapclear();
});
-
// Testing registration of functions as ex-commands and mapping to -keys
testVim('ex_api_test', function(cm, vim, helpers) {
var res=false;
@@ -4364,6 +4473,7 @@ testVim('ex_api_test', function(cm, vim, helpers) {
CodeMirror.Vim.map('',':ext');
helpers.doKeys('','');
is(res,'Mapping to key failed');
+ CodeMirror.Vim.mapclear();
});
// For now, this test needs to be last because it messes up : for future tests.
testVim('ex_map_key2key_from_colon', function(cm, vim, helpers) {
@@ -4371,8 +4481,67 @@ testVim('ex_map_key2key_from_colon', function(cm, vim, helpers) {
helpers.doKeys(':');
helpers.assertCursorAt(0, 0);
eq('bc', cm.getValue());
+ CodeMirror.Vim.mapclear();
}, { value: 'abc' });
+testVim('noremap', function(cm, vim, helpers) {
+ CodeMirror.Vim.noremap(';', 'l');
+ cm.setCursor(0, 0);
+ eq('wOrd1', cm.getValue());
+ // Mapping should work in normal mode.
+ helpers.doKeys(';', 'r', '1');
+ eq('w1rd1', cm.getValue());
+ // Mapping will not work in insert mode because of no current fallback
+ // keyToKey mapping support.
+ helpers.doKeys('i', ';', '');
+ eq('w;1rd1', cm.getValue());
+ // unmap all mappings
+ CodeMirror.Vim.mapclear();
+}, { value: 'wOrd1' });
+testVim('noremap_swap', function(cm, vim, helpers) {
+ CodeMirror.Vim.noremap('i', 'a', 'normal');
+ CodeMirror.Vim.noremap('a', 'i', 'normal');
+ cm.setCursor(0, 0);
+ // 'a' should act like 'i'.
+ helpers.doKeys('a');
+ eqCursorPos(Pos(0, 0), cm.getCursor());
+ // ...and 'i' should act like 'a'.
+ helpers.doKeys('', 'i');
+ eqCursorPos(Pos(0, 1), cm.getCursor());
+ // unmap all mappings
+ CodeMirror.Vim.mapclear();
+}, { value: 'foo' });
+testVim('noremap_map_interaction', function(cm, vim, helpers) {
+ // noremap should clobber map
+ CodeMirror.Vim.map(';', 'l');
+ CodeMirror.Vim.noremap(';', 'l');
+ CodeMirror.Vim.map('l', 'j');
+ cm.setCursor(0, 0);
+ helpers.doKeys(';');
+ eqCursorPos(Pos(0, 1), cm.getCursor());
+ helpers.doKeys('l');
+ eqCursorPos(Pos(1, 1), cm.getCursor());
+ // map should be able to point to a noremap
+ CodeMirror.Vim.map('m', ';');
+ helpers.doKeys('m');
+ eqCursorPos(Pos(1, 2), cm.getCursor());
+ // unmap all mappings
+ CodeMirror.Vim.mapclear();
+}, { value: 'wOrd1\nwOrd2' });
+testVim('noremap_map_interaction2', function(cm, vim, helpers) {
+ // map should point to the most recent noremap
+ CodeMirror.Vim.noremap(';', 'l');
+ CodeMirror.Vim.map('m', ';');
+ CodeMirror.Vim.noremap(';', 'h');
+ cm.setCursor(0, 0);
+ helpers.doKeys('l');
+ eqCursorPos(Pos(0, 1), cm.getCursor());
+ helpers.doKeys('m');
+ eqCursorPos(Pos(0, 0), cm.getCursor());
+ // unmap all mappings
+ CodeMirror.Vim.mapclear();
+}, { value: 'wOrd1\nwOrd2' });
+
// Test event handlers
testVim('beforeSelectionChange', function(cm, vim, helpers) {
cm.setCursor(0, 100);
From 641037837261916bd9096f02067f3681f31e99ef Mon Sep 17 00:00:00 2001
From: nightwing
Date: Tue, 14 May 2019 21:37:23 +0400
Subject: [PATCH 0161/1293] [vim] fix blockwise yank
---
lib/ace/keyboard/vim.js | 18 +++++++++++-------
lib/ace/keyboard/vim_test.js | 15 +++++++++++++++
2 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/lib/ace/keyboard/vim.js b/lib/ace/keyboard/vim.js
index de7b14e5ac6..4125a210faf 100644
--- a/lib/ace/keyboard/vim.js
+++ b/lib/ace/keyboard/vim.js
@@ -3357,7 +3357,17 @@ dom.importCssString(".normal-mode .ace_cursor{\
}
var linewise = register.linewise;
var blockwise = register.blockwise;
- if (linewise && !blockwise) { // ace_patch
+ if (blockwise) {
+ text = text.split('\n');
+ if (linewise) {
+ text.pop();
+ }
+ for (var i = 0; i < text.length; i++) {
+ text[i] = (text[i] == '') ? ' ' : text[i];
+ }
+ cur.ch += actionArgs.after ? 1 : 0;
+ cur.ch = Math.min(lineLength(cm, cur.line), cur.ch);
+ } else if (linewise) {
if(vim.visualMode) {
text = vim.visualLine ? text.slice(0, -1) : '\n' + text.slice(0, text.length - 1) + '\n';
} else if (actionArgs.after) {
@@ -3369,12 +3379,6 @@ dom.importCssString(".normal-mode .ace_cursor{\
cur.ch = 0;
}
} else {
- if (blockwise) {
- text = text.split('\n');
- for (var i = 0; i < text.length; i++) {
- text[i] = (text[i] == '') ? ' ' : text[i];
- }
- }
cur.ch += actionArgs.after ? 1 : 0;
}
var curPosFinal;
diff --git a/lib/ace/keyboard/vim_test.js b/lib/ace/keyboard/vim_test.js
index ecd964d73e8..ac3084ffae1 100644
--- a/lib/ace/keyboard/vim_test.js
+++ b/lib/ace/keyboard/vim_test.js
@@ -1523,6 +1523,21 @@ testVim('Y', function(cm, vim, helpers) {
is(register.linewise);
helpers.assertCursorAt(0, 3);
}, { value: ' word1\nword2\n word3' });
+testVim('Yy_blockwise', function(cm, vim, helpers) {
+ helpers.doKeys('', 'j', '2', 'l', 'Y');
+ helpers.doKeys('G', 'p', 'g', 'g');
+ helpers.doKeys('', 'j', '2', 'l', 'y');
+ helpers.assertCursorAt(0, 0);
+ helpers.doKeys('$', 'p');
+ eq('123456123\n123456123\n123456\n123456', cm.getValue());
+ var register = helpers.getRegisterController().getRegister();
+ eq('123\n123', register.toString());
+ is(register.blockwise);
+ helpers.assertCursorAt(0, 6);
+ helpers.doKeys('$', 'j', 'p');
+ helpers.doKeys('$', 'j', 'P');
+ eq("123456123\n123456123123\n123456 121233\n123456 123", cm.getValue());
+}, { value: '123456\n123456\n' });
testVim('~', function(cm, vim, helpers) {
helpers.doKeys('3', '~');
eq('ABCdefg', cm.getValue());
From dd94d564b8ea143b81ad39998b6d76745e8177bc Mon Sep 17 00:00:00 2001
From: nightwing
Date: Tue, 14 May 2019 21:38:21 +0400
Subject: [PATCH 0162/1293] improve devutil
---
demo/kitchen-sink/dev_util.js | 22 ++++++----------------
package.json | 3 ++-
2 files changed, 8 insertions(+), 17 deletions(-)
diff --git a/demo/kitchen-sink/dev_util.js b/demo/kitchen-sink/dev_util.js
index 33bf0ca0292..b16fef61a5f 100644
--- a/demo/kitchen-sink/dev_util.js
+++ b/demo/kitchen-sink/dev_util.js
@@ -34,18 +34,6 @@ var event = require("ace/lib/event");
var Range = require("ace/range").Range;
var EditSession = require("ace/edit_session").EditSession;
var UndoManager = require("ace/undomanager").UndoManager;
-function warn() {
- var s = (new Error()).stack || "";
- s = s.split("\n");
- if (s[1] == "Error") s.shift(); // remove error description on chrome
- s.shift(); // remove warn
- s.shift(); // remove the getter
- s = s.join("\n");
- // allow easy access to ace in console, but not in ace code
- if (!/at Object.InjectedScript.|@debugger eval|snippets:\/{3}|:\d+:\d+/.test(s)) {
- console.error("trying to access to global variable");
- }
-}
function def(o, key, get) {
try {
Object.defineProperty(o, key, {
@@ -60,13 +48,13 @@ function def(o, key, get) {
console.error(e);
}
}
-def(window, "ace", function(){ warn(); return window.env.editor });
-def(window, "editor", function(){ warn(); return window.env.editor == logEditor ? editor : window.env.editor });
+def(window, "ace", function(){ return window.env.editor });
+def(window, "editor", function(){ return window.env.editor == logEditor ? editor : window.env.editor });
def(window, "session", function(){ return window.editor.session });
-def(window, "split", function(){ warn(); return window.env.split });
+def(window, "split", function(){ return window.env.split });
-def(window, "devUtil", function(){ warn(); return exports });
+def(window, "devUtil", function(){ return exports });
exports.showTextArea = function(argument) {
dom.importCssString("\
.ace_text-input {\
@@ -428,4 +416,6 @@ exports.textInputDebugger = {
}
}
+exports.addGlobals();
+
});
diff --git a/package.json b/package.json
index 30b08a160d2..f9323dc7ec3 100644
--- a/package.json
+++ b/package.json
@@ -34,6 +34,7 @@
"scripts": {
"start": "node static.js",
"test": "node lib/ace/test/all.js",
- "lint": "eslint 'lib/ace/**/*.js'"
+ "lint": "eslint 'lib/ace/**/*.js'",
+ "fix": "eslint --fix 'lib/ace/**/*.js'"
}
}
From 9bfb4f362ce5278be9dcd8e20d4d4711d2226e74 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Sat, 27 Apr 2019 01:15:35 +0400
Subject: [PATCH 0163/1293] move version to config
---
lib/ace/ace.js | 2 +-
lib/ace/config.js | 2 ++
lib/ace/ext/options.js | 4 +++-
tool/release.sh | 2 +-
4 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/lib/ace/ace.js b/lib/ace/ace.js
index e34003b670e..be2be04b63e 100644
--- a/lib/ace/ace.js
+++ b/lib/ace/ace.js
@@ -132,5 +132,5 @@ exports.Editor = Editor;
exports.EditSession = EditSession;
exports.UndoManager = UndoManager;
exports.VirtualRenderer = Renderer;
-exports.version = "1.4.4";
+exports.version = exports.config.version;
});
diff --git a/lib/ace/config.js b/lib/ace/config.js
index bfbd83f44fc..c41fb604a9c 100644
--- a/lib/ace/config.js
+++ b/lib/ace/config.js
@@ -219,4 +219,6 @@ function deHyphenate(str) {
return str.replace(/-(.)/g, function(m, m1) { return m1.toUpperCase(); });
}
+exports.version = "1.4.4";
+
});
diff --git a/lib/ace/ext/options.js b/lib/ace/ext/options.js
index dafe40387c8..58cbb507332 100644
--- a/lib/ace/ext/options.js
+++ b/lib/ace/ext/options.js
@@ -5,6 +5,7 @@ var overlayPage = require('./menu_tools/overlay_page').overlayPage;
var dom = require("../lib/dom");
var oop = require("../lib/oop");
+var config = require("../config");
var EventEmitter = require("../lib/event_emitter").EventEmitter;
var buildDom = dom.buildDom;
@@ -209,7 +210,8 @@ var OptionPanel = function(editor, element) {
["table", {id: "more-controls"},
this.renderOptionGroup(optionGroups.More)
]
- ]]
+ ]],
+ ["tr", null, ["td", {colspan: 2}, "version " + config.version]]
], this.container);
};
diff --git a/tool/release.sh b/tool/release.sh
index 9caee348194..5c1a25f0886 100755
--- a/tool/release.sh
+++ b/tool/release.sh
@@ -73,7 +73,7 @@ node -e "
}
update('package.json');
update('build/package.json');
- update('./lib/ace/ace.js');
+ update('./lib/ace/config.js');
update('ChangeLog.txt', function(str) {
var date='"`date +%Y.%m.%d`"';
return date + ' Version ' + version + '\n' + str.replace(/^\d+.*/, '').replace(/^\n/, '');
From e2adfefdeea85ba3f38a5a74f18adf596d056ea5 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Tue, 14 May 2019 23:39:05 +0400
Subject: [PATCH 0164/1293] add ` to markdown quotes
---
lib/ace/mode/markdown.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/ace/mode/markdown.js b/lib/ace/mode/markdown.js
index 61a96f7edd0..f6c73d2ce03 100644
--- a/lib/ace/mode/markdown.js
+++ b/lib/ace/mode/markdown.js
@@ -59,6 +59,7 @@ oop.inherits(Mode, TextMode);
(function() {
this.type = "text";
this.blockComment = {start: ""};
+ this.$quotes = {'"': '"', "`": "`"};
this.getNextLineIndent = function(state, line, tab) {
if (state == "listblock") {
From 49b923d2ed46c2e495538715c07b13b5e549a0b4 Mon Sep 17 00:00:00 2001
From: nightwing
Date: Mon, 13 May 2019 16:06:54 +0000
Subject: [PATCH 0165/1293] touch handler
---
.eslintrc | 4 +-
experiments/cut_copy.html | 41 +++++-
kitchen-sink.html | 1 +
lib/ace/lib/event.js | 24 ----
lib/ace/mouse/default_handlers.js | 5 -
lib/ace/mouse/mouse_handler.js | 11 +-
lib/ace/mouse/touch_handler.js | 232 ++++++++++++++++++++++++++++++
7 files changed, 277 insertions(+), 41 deletions(-)
create mode 100644 lib/ace/mouse/touch_handler.js
diff --git a/.eslintrc b/.eslintrc
index 89da3026afa..5395a034dcb 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -75,7 +75,7 @@
no-undef: 2,
no-redeclare: 0,
- // no-unused-vars: 1,
+ no-unused-vars: 1,
no-debugger: 2,
@@ -88,7 +88,7 @@
// no-useless-concat: 2,
// no-eval: 2,
// dot-notation: 2,
- // no-alert: 2,
+ no-alert: 2,
no-extra-semi: 2, // doesn't handle ;(function() {})() pattern
// radix: 2,
// no-invalid-this: 2,
diff --git a/experiments/cut_copy.html b/experiments/cut_copy.html
index 3299f3ad618..9fcaf224111 100644
--- a/experiments/cut_copy.html
+++ b/experiments/cut_copy.html
@@ -4,6 +4,7 @@
+
Text Events
@@ -20,6 +21,10 @@
width: 590px;
height: 400px;
}
+
+ #text {
+ position: absolute;
+ }
@@ -70,6 +75,39 @@
console.log(e.type, e.charCode, e.keyCode, e);
}
+addListener(canvas, "mousedown", function(e) {
+ text.focus();
+ e.preventDefault();
+}, false);
+
+var pos;
+addListener(canvas, "touchstart", function(e) {
+ text.value = ""
+ pos = e.touches[0]
+ text.focus();
+}, false);
+addListener(canvas, "contextmenu", function(e) {
+ text.value = "xxxxx";
+ var rect = canvas.getBoundingClientRect()
+ // text.selectionStart = 0
+ // text.selectionEnd = 20
+ text.style.opacity = 0
+ text.style.top = pos.clientY - 15 - rect.top + "px"
+ text.style.left = pos.clientX - 15 - rect.left + "px"
+ // canvas.style.fontSize = "300px"
+ // text.readOnly = true
+ // text.focus();
+ text.style.width = "50px"
+ text.style.height = "50px"
+ text.select();
+ setTimeout(function() {
+ text.readOnly = false
+ // text.style.top = pos.clientY - 5 + "px"
+ // text.style.left = pos.clientY - 5 + "px"
+ }, 100)
+ //e.preventDefault();
+}, false);
+
addListener(text, "keydown", logKey, false);
addListener(text, "keyup", logKey, false);
addListener(text, "keypress", logKey, false);
@@ -78,8 +116,9 @@
console.log(e.type, e.data, e);
}, false);
+var i = 0;
function fillSelection() {
- text.value = "Juhu Kinners";
+ text.value = "Juhu Kinners " + (i++);
text.select();
}
diff --git a/kitchen-sink.html b/kitchen-sink.html
index c4be9da5a9f..89cd9443899 100644
--- a/kitchen-sink.html
+++ b/kitchen-sink.html
@@ -3,6 +3,7 @@
+
Ace Kitchen Sink
");
-
- next();
},
- "test beautify js array of objects": function(next) {
+ "test beautify js array of objects": function() {
var s = new EditSession([
"");
-
- next();
},
- "test beautify js object": function(next) {
+ "test beautify js object": function() {
var s = new EditSession([
''
], new PHPMode());
@@ -423,8 +381,6 @@ module.exports = {
+ "\t\t\"b\": \"2\"\n"
+ "\t}\n"
+ "");
-
- next();
}
};
From 9a229d02b525ec667bc6d389a2e3d7b616336d4d Mon Sep 17 00:00:00 2001
From: Bill
Date: Sat, 1 Feb 2020 14:20:16 +0700
Subject: [PATCH 0278/1293] removing preventDefault method
this method cause editor to open virtual keyboard when scrolling and has focus at the same time
---
lib/ace/mouse/touch_handler.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/ace/mouse/touch_handler.js b/lib/ace/mouse/touch_handler.js
index 07ae36b8b9f..78b2f9f5cfe 100644
--- a/lib/ace/mouse/touch_handler.js
+++ b/lib/ace/mouse/touch_handler.js
@@ -251,7 +251,6 @@ exports.addTouchListeners = function(el, editor) {
showContextMenu();
} else if (mode == "scroll") {
animate();
- e.preventDefault();
hideContextMenu();
} else {
showContextMenu();
From 473831323e61feab63ff9e824f83d41b78ffe916 Mon Sep 17 00:00:00 2001
From: Nathan Whetsell
Date: Wed, 5 Feb 2020 09:20:45 -0500
Subject: [PATCH 0279/1293] Update for Csound 6.14.0
---
lib/ace/mode/csound_orchestra_highlight_rules.js | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/lib/ace/mode/csound_orchestra_highlight_rules.js b/lib/ace/mode/csound_orchestra_highlight_rules.js
index 138f106e004..da5d6ef8253 100644
--- a/lib/ace/mode/csound_orchestra_highlight_rules.js
+++ b/lib/ace/mode/csound_orchestra_highlight_rules.js
@@ -230,11 +230,19 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"chnclear",
"chnexport",
"chnget",
+ "chngeta",
+ "chngeti",
+ "chngetk",
"chngetks",
+ "chngets",
"chnmix",
"chnparams",
"chnset",
+ "chnseta",
+ "chnseti",
+ "chnsetk",
"chnsetks",
+ "chnsets",
"chuap",
"clear",
"clfilt",
@@ -432,6 +440,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"ftchnls",
"ftconv",
"ftcps",
+ "ftexists",
"ftfree",
"ftgen",
"ftgenonce",
@@ -713,6 +722,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"la_k_upper_solve_mr",
"la_k_vc_set",
"la_k_vr_set",
+ "lastcycle",
"lenarray",
"lfo",
"limit",
@@ -803,6 +813,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"median",
"mediank",
"metro",
+ "metro2",
"mfb",
"midglobal",
"midiarp",
@@ -1157,6 +1168,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"qnan",
"r2c",
"rand",
+ "randc",
"randh",
"randi",
"random",
@@ -1217,6 +1229,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"schedkwhen",
"schedkwhennamed",
"schedule",
+ "schedulek",
"schedwhen",
"scoreline",
"scoreline_i",
@@ -1327,6 +1340,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"strrindex",
"strrindexk",
"strset",
+ "strstrip",
"strsub",
"strsubk",
"strtod",
From b48c893b731c18a8763cc88a52134ac6f1cb0d88 Mon Sep 17 00:00:00 2001
From: lmn8 <60514150+lmn8@users.noreply.github.com>
Date: Fri, 14 Feb 2020 18:53:34 +0000
Subject: [PATCH 0280/1293] Add files via upload
---
lib/ace/mode/mediawiki.js | 20 +
lib/ace/mode/mediawiki_highlight_rules.js | 558 ++++++++++++++++++++++
2 files changed, 578 insertions(+)
create mode 100644 lib/ace/mode/mediawiki.js
create mode 100644 lib/ace/mode/mediawiki_highlight_rules.js
diff --git a/lib/ace/mode/mediawiki.js b/lib/ace/mode/mediawiki.js
new file mode 100644
index 00000000000..e6a48f31877
--- /dev/null
+++ b/lib/ace/mode/mediawiki.js
@@ -0,0 +1,20 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var MediaWikiHighlightRules = require("./mediawiki_highlight_rules").MediaWikiHighlightRules;
+
+var Mode = function() {
+ this.HighlightRules = MediaWikiHighlightRules;
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+ this.type = "text";
+ this.blockComment = {start: ""};
+ this.$id = "ace/mode/mediawiki";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
diff --git a/lib/ace/mode/mediawiki_highlight_rules.js b/lib/ace/mode/mediawiki_highlight_rules.js
new file mode 100644
index 00000000000..65063bcb31f
--- /dev/null
+++ b/lib/ace/mode/mediawiki_highlight_rules.js
@@ -0,0 +1,558 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var MediaWikiHighlightRules = function() {
+ this.$rules = {
+ start: [{
+ include: "#variable"
+ }, {
+ include: "#comment"
+ }, {
+ include: "#entity"
+ }, {
+ include: "#emphasis"
+ }, {
+ include: "#tag"
+ }, {
+ include: "#table"
+ }, {
+ include: "#hr"
+ }, {
+ include: "#heading"
+ }, {
+ include: "#link"
+ }, {
+ include: "#list"
+ }, {
+ include: "#template"
+ }],
+ "#hr": [{
+ token: "markup.bold",
+ regex: /^[-]{4,}/
+ }],
+ "#variable": [{
+ token: "storage.type.variable",
+ regex: /{{{/,
+ push: [{
+ token: "storage.type.variable",
+ regex: /}}}/,
+ next: "pop"
+ }, {
+ token: [
+ "text",
+ "variable.other",
+ "text",
+ "keyword.operator"
+ ],
+ regex: /(\s*)(\w+)(\s*)((?:\|)?)/
+ }, {
+ defaultToken: "storage.type.variable"
+ }]
+ }],
+ "#entity": [{
+ token: "constant.character.entity",
+ regex: /&\w+;/
+ }],
+ "#list": [{
+ token: "markup.bold",
+ regex: /^[#*;:]+/,
+ push: [{
+ token: "markup.list",
+ regex: /$/,
+ next: "pop"
+ }, {
+ include: "$self"
+ }, {
+ defaultToken: "markup.list"
+ }]
+ }],
+ "#template": [{
+ token: [
+ "storage.type.function",
+ "meta.template",
+ "entity.name.function",
+ "meta.template"
+ ],
+ regex: /({{)(\s*)([\w ]+)(\s*)/,
+ push: [{
+ token: "storage.type.function",
+ regex: /}}/,
+ next: "pop"
+ }, {
+ token: [
+ "storage",
+ "meta.structure.dictionary",
+ "support.type.property-name",
+ "meta.structure.dictionary",
+ "punctuation.separator.dictionary.key-value.mediawiki",
+ "meta.structure.dictionary",
+ "meta.structure.dictionary.value"
+ ],
+ regex: /(\|)(\s*)([a-zA-Z-]*)(\s*)(=)(\s*)([^|}]*)/,
+ push: [{
+ token: "meta.structure.dictionary",
+ regex: /(?=}}|[|])/,
+ next: "pop"
+ }, {
+ defaultToken: "meta.structure.dictionary"
+ }]
+ }, {
+ token: ["storage", "meta.template.value"],
+ regex: /(\|)(.*?)/,
+ push: [{
+ token: [],
+ regex: /(?=}}|[|])/,
+ next: "pop"
+ }, {
+ include: "$self"
+ }, {
+ defaultToken: "meta.template.value"
+ }]
+ }, {
+ defaultToken: "meta.template"
+ }]
+ }],
+ "#link": [{
+ token: [
+ "punctuation.definition.tag.begin",
+ "meta.tag.link.internal",
+ "entity.name.tag.mediawiki",
+ "meta.tag.link.internal",
+ "string.other.link.title.mediawiki",
+ "meta.tag.link.internal",
+ "punctuation.definition.tag"
+ ],
+ regex: /(\[\[)(\s*)((?:Category|Wikipedia)?)(:?)([^\]\]\|]+)(\s*)((?:\|)*)/,
+ push: [{
+ token: "punctuation.definition.tag.end",
+ regex: /\]\]/,
+ next: "pop"
+ }, {
+ include: "$self"
+ }, {
+ defaultToken: "meta.tag.link.internal"
+ }]
+ }, {
+ token: [
+ "punctuation.definition.tag.begin",
+ "meta.tag.link.external",
+ "meta.tag.link.external",
+ "string.unquoted",
+ "punctuation.definition.tag.end"
+ ],
+ regex: /(\[)(.*?)([\s]+)(.*?)(\])/
+ }],
+ "#comment": [{
+ token: "punctuation.definition.comment.html",
+ regex: //,
+ next: "pop"
+ }, {
+ token: "invalid.illegal.characters-not-allowed-here.html",
+ regex: /[^-]*-?>/
+ }, {
+ token: "invalid.illegal.characters-not-allowed-here.html",
+ regex: /)/
+ }, {
+ token: "invalid.illegal.characters-not-allowed-here.html",
+ regex: /--!>/
+ }, {
+ defaultToken: "comment.block.html"
+ }]
+ }],
+ "#emphasis": [{
+ token: [
+ "punctuation.definition.tag.begin",
+ "markup.italic.bold",
+ "punctuation.definition.tag.end"
+ ],
+ regex: /(''''')(?!')(.*?)('''''|$)/
+ }, {
+ token: [
+ "punctuation.definition.tag.begin",
+ "markup.bold",
+ "punctuation.definition.tag.end"
+ ],
+ regex: /(''')(?!')(.*?)('''|$)/
+ }, {
+ token: [
+ "punctuation.definition.tag.begin",
+ "markup.italic",
+ "punctuation.definition.tag.end"
+ ],
+ regex: /('')(?!')(.*?)(''|$)/
+ }],
+ "#heading": [{
+ token: [
+ "punctuation.definition.heading",
+ "entity.name.section.mediawiki",
+ "punctuation.definition.heading"
+ ],
+ regex: /(={1,6})(.+?)(\1)(?!=)/
+ }],
+ "#tag": [{
+ token: [
+ "punctuation.definition.tag.begin",
+ "entity.name.tag",
+ "meta.tag.block.ref",
+ "punctuation.definition.tag.end"
+ ],
+ regex: /(<)(ref)((?:\s+.*?)?)(>)/,
+ caseInsensitive: true,
+ push: [{
+ token: [
+ "punctuation.definition.tag.begin",
+ "entity.name.tag",
+ "meta.tag.block.ref",
+ "punctuation.definition.tag.end"
+ ],
+ regex: /(<\/)(ref)(\s*)(>)/,
+ caseInsensitive: true,
+ next: "pop"
+ }, {
+ include: "$self"
+ }, {
+ defaultToken: "meta.tag.block.ref"
+ }]
+ },
+ {
+ token: [
+ "punctuation.definition.tag.begin",
+ "entity.name.tag",
+ "meta.tag.block.nowiki",
+ "punctuation.definition.tag.end"
+ ],
+ regex: /(<)(nowiki)((?:\s+.*?)?)(>)/,
+ caseInsensitive: true,
+ push: [{
+ token: [
+ "punctuation.definition.tag.begin",
+ "entity.name.tag",
+ "meta.tag.block.nowiki",
+ "punctuation.definition.tag.end"
+ ],
+ regex: /(<\/)(nowiki)(\s*)(>)/,
+ caseInsensitive: true,
+ next: "pop"
+ }, {
+ defaultToken: "meta.tag.block.nowiki"
+ }]
+ }, {
+ token: [
+ "punctuation.definition.tag.begin",
+ "entity.name.tag"
+ ],
+ regex: /(<\/?)(noinclude|includeonly|onlyinclude)(?=\W)/,
+ caseInsensitive: true,
+ push: [{
+ token: [
+ "invalid.illegal.characters-not-allowed-here",
+ "punctuation.definition.tag.end"
+ ],
+ regex: /((?:\/)?)(>)/,
+ next: "pop"
+ }, {
+ include: "#attribute"
+ }, {
+ defaultToken: "meta.tag.block.any"
+ }]
+ }, {
+ token: [
+ "punctuation.definition.tag.begin",
+ "entity.name.tag"
+ ],
+ regex: /(<)(br|wbr|hr|meta|link)(?=\W)/,
+ caseInsensitive: true,
+ push: [{
+ token: "punctuation.definition.tag.end",
+ regex: /\/?>/,
+ next: "pop"
+ }, {
+ include: "#attribute"
+ }, {
+ defaultToken: "meta.tag.other"
+ }]
+ }, {
+ token: [
+ "punctuation.definition.tag.begin",
+ "entity.name.tag"
+ ],
+ regex: /(<\/?)(div|center|span|h1|h2|h3|h4|h5|h6|bdo|em|strong|cite|dfn|code|samp|kbd|var|abbr|blockquote|q|sub|sup|p|pre|ins|del|ul|ol|li|dl|dd|dt|table|caption|thead|tfoot|tbody|colgroup|col|tr|td|th|a|img|video|source|track|tt|b|i|big|small|strike|s|u|font|ruby|rb|rp|rt|rtc|math|figure|figcaption|bdi|data|time|mark|html)(?=\W)/,
+ caseInsensitive: true,
+ push: [{
+ token: [
+ "invalid.illegal.characters-not-allowed-here",
+ "punctuation.definition.tag.end"
+ ],
+ regex: /((?:\/)?)(>)/,
+ next: "pop"
+ }, {
+ include: "#attribute"
+ }, {
+ defaultToken: "meta.tag.block"
+ }]
+ }, {
+ token: [
+ "punctuation.definition.tag.begin",
+ "invalid.illegal.characters-not-allowed-here"
+ ],
+ regex: /(<\/)(br|wbr|hr|meta|link)(?=\W)/,
+ caseInsensitive: true,
+ push: [{
+ token: "punctuation.definition.tag.end",
+ regex: /\/?>/,
+ next: "pop"
+ }, {
+ include: "#attribute"
+ }, {
+ defaultToken: "meta.tag.other"
+ }]
+ }],
+ "#caption": [{
+ token: [
+ "meta.tag.block.table-caption",
+ "punctuation.definition.tag.begin"
+ ],
+ regex: /^(\s*)(\|\+)/,
+ push: [{
+ token: "meta.tag.block.table-caption",
+ regex: /$/,
+ next: "pop"
+ }, {
+ defaultToken: "meta.tag.block.table-caption"
+ }]
+ }],
+ "#tr": [{
+ token: [
+ "meta.tag.block.tr",
+ "punctuation.definition.tag.begin",
+ "meta.tag.block.tr",
+ "invalid.illegal"
+ ],
+ regex: /^(\s*)(\|\-)([\s]*)(.*)/
+ }],
+ "#th": [{
+ token: [
+ "meta.tag.block.th.heading",
+ "punctuation.definition.tag.begin",
+ "meta.tag.block.th.heading",
+ "punctuation.definition.tag",
+ "markup.bold"
+ ],
+ regex: /^(\s*)(!)(?:(.*?)(\|))?(.*?)(?=!!|$)/,
+ push: [{
+ token: "meta.tag.block.th.heading",
+ regex: /$/,
+ next: "pop"
+ }, {
+ token: [
+ "punctuation.definition.tag.begin",
+ "meta.tag.block.th.inline",
+ "punctuation.definition.tag",
+ "markup.bold"
+ ],
+ regex: /(!!)(?:(.*?)(\|))?(.*?)(?=!!|$)/
+ }, {
+ include: "$self"
+ }, {
+ defaultToken: "meta.tag.block.th.heading"
+ }]
+ }],
+ "#td": [{
+ token: [
+ "meta.tag.block.td",
+ "punctuation.definition.tag.begin"
+ ],
+ regex: /^(\s*)(\|)/,
+ push: [{
+ token: "meta.tag.block.td",
+ regex: /$/,
+ next: "pop"
+ }, {
+ include: "$self"
+ }, {
+ defaultToken: "meta.tag.block.td"
+ }]
+ }],
+ "#table": [{
+ patterns: [{
+ name: "meta.tag.block.table",
+ begin: "^\\s*({\\|)(.*?)$",
+ end: "^\\s*\\|}",
+ beginCaptures: {
+ 1: {
+ name: "punctuation.definition.tag.begin"
+ },
+ 2: {
+ patterns: [{
+ include: "#attribute"
+ }]
+ },
+ 3: {
+ name: "invalid.illegal"
+ }
+ },
+ endCaptures: {
+ 0: {
+ name: "punctuation.definition.tag.end"
+ }
+ },
+ patterns: [{
+ include: "#comment"
+ }, {
+ include: "#template"
+ }, {
+ include: "#caption"
+ }, {
+ include: "#tr"
+ }, {
+ include: "#th"
+ }, {
+ include: "#td"
+ }]
+ }],
+ repository: {
+ caption: {
+ name: "meta.tag.block.table-caption",
+ begin: "^\\s*(\\|\\+)",
+ end: "$",
+ beginCaptures: {
+ 1: {
+ name: "punctuation.definition.tag.begin"
+ }
+ }
+ },
+ tr: {
+ name: "meta.tag.block.tr",
+ match: "^\\s*(\\|\\-)[\\s]*(.*)",
+ captures: {
+ 1: {
+ name: "punctuation.definition.tag.begin"
+ },
+ 2: {
+ name: "invalid.illegal"
+ }
+ }
+ },
+ th: {
+ name: "meta.tag.block.th.heading",
+ begin: "^\\s*(!)((.*?)(\\|))?(.*?)(?=(!!)|$)",
+ end: "$",
+ beginCaptures: {
+ 1: {
+ name: "punctuation.definition.tag.begin"
+ },
+ 3: {
+ patterns: [{
+ include: "#attribute"
+ }]
+ },
+ 4: {
+ name: "punctuation.definition.tag"
+ },
+ 5: {
+ name: "markup.bold"
+ }
+ },
+ patterns: [{
+ name: "meta.tag.block.th.inline",
+ match: "(!!)((.*?)(\\|))?(.*?)(?=(!!)|$)",
+ captures: {
+ 1: {
+ name: "punctuation.definition.tag.begin"
+ },
+ 3: {
+ patterns: [{
+ include: "#attribute"
+ }]
+ },
+ 4: {
+ name: "punctuation.definition.tag"
+ },
+ 5: {
+ name: "markup.bold"
+ }
+ }
+ }, {
+ include: "$self"
+ }]
+ },
+ td: {
+ name: "meta.tag.block.td",
+ begin: "^\\s*(\\|)",
+ end: "$",
+ beginCaptures: {
+ 1: {
+ name: "punctuation.definition.tag.begin"
+ },
+ 2: {
+ patterns: [{
+ include: "#attribute"
+ }]
+ },
+ 3: {
+ name: "punctuation.definition.tag"
+ }
+ },
+ patterns: [{
+ include: "$self"
+ }]
+ }
+ }
+ }],
+ "#attribute": [{
+ include: "#string"
+ }, {
+ token: "entity.other.attribute-name",
+ regex: /\w+/
+ }],
+ "#string": [{
+ token: "string.quoted.double",
+ regex: /\"/,
+ push: [{
+ token: "string.quoted.double",
+ regex: /\"/,
+ next: "pop"
+ }, {
+ defaultToken: "string.quoted.double"
+ }]
+ }, {
+ token: "string.quoted.single",
+ regex: /\'/,
+ push: [{
+ token: "string.quoted.single",
+ regex: /\'/,
+ next: "pop"
+ }, {
+ defaultToken: "string.quoted.single"
+ }]
+ }],
+ "#url": [{
+ token: "markup.underline.link",
+ regex: /(?:http(?:s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:\/?#\[\]@!\$&'\(\)\*\+,;=.]+/
+ }, {
+ token: "invalid.illegal.characters-not-allowed-here",
+ regex: /.*/
+ }]
+ };
+
+
+ this.normalizeRules();
+};
+
+MediaWikiHighlightRules.metaData = {
+ name: "MediaWiki",
+ scopeName: "text.html.mediawiki",
+ fileTypes: ["mediawiki", "wiki"]
+};
+
+
+oop.inherits(MediaWikiHighlightRules, TextHighlightRules);
+
+exports.MediaWikiHighlightRules = MediaWikiHighlightRules;
+});
From 2087a585e5ed28c4c0be2b5092c3caea6072d8b1 Mon Sep 17 00:00:00 2001
From: lmn8 <60514150+lmn8@users.noreply.github.com>
Date: Fri, 14 Feb 2020 19:36:51 +0000
Subject: [PATCH 0281/1293] remove comment validation & vscode token classes
---
lib/ace/mode/mediawiki_highlight_rules.js | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/lib/ace/mode/mediawiki_highlight_rules.js b/lib/ace/mode/mediawiki_highlight_rules.js
index 65063bcb31f..a3b894df6d7 100644
--- a/lib/ace/mode/mediawiki_highlight_rules.js
+++ b/lib/ace/mode/mediawiki_highlight_rules.js
@@ -152,15 +152,6 @@ var MediaWikiHighlightRules = function() {
token: "punctuation.definition.comment.html",
regex: /-->/,
next: "pop"
- }, {
- token: "invalid.illegal.characters-not-allowed-here.html",
- regex: /[^-]*-?>/
- }, {
- token: "invalid.illegal.characters-not-allowed-here.html",
- regex: /)/
- }, {
- token: "invalid.illegal.characters-not-allowed-here.html",
- regex: /--!>/
}, {
defaultToken: "comment.block.html"
}]
@@ -251,7 +242,7 @@ var MediaWikiHighlightRules = function() {
caseInsensitive: true,
push: [{
token: [
- "invalid.illegal.characters-not-allowed-here",
+ "invalid.illegal",
"punctuation.definition.tag.end"
],
regex: /((?:\/)?)(>)/,
@@ -286,7 +277,7 @@ var MediaWikiHighlightRules = function() {
caseInsensitive: true,
push: [{
token: [
- "invalid.illegal.characters-not-allowed-here",
+ "invalid.illegal",
"punctuation.definition.tag.end"
],
regex: /((?:\/)?)(>)/,
@@ -299,7 +290,7 @@ var MediaWikiHighlightRules = function() {
}, {
token: [
"punctuation.definition.tag.begin",
- "invalid.illegal.characters-not-allowed-here"
+ "invalid.illegal"
],
regex: /(<\/)(br|wbr|hr|meta|link)(?=\W)/,
caseInsensitive: true,
@@ -536,7 +527,7 @@ var MediaWikiHighlightRules = function() {
token: "markup.underline.link",
regex: /(?:http(?:s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:\/?#\[\]@!\$&'\(\)\*\+,;=.]+/
}, {
- token: "invalid.illegal.characters-not-allowed-here",
+ token: "invalid.illegal",
regex: /.*/
}]
};
From e5b81c0104249fc19835840b7b90854b210ef566 Mon Sep 17 00:00:00 2001
From: lmn8 <60514150+lmn8@users.noreply.github.com>
Date: Fri, 14 Feb 2020 20:51:04 +0000
Subject: [PATCH 0282/1293] add support for parser functions, Lua invocations
---
lib/ace/mode/mediawiki_highlight_rules.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/ace/mode/mediawiki_highlight_rules.js b/lib/ace/mode/mediawiki_highlight_rules.js
index a3b894df6d7..36e5e18784a 100644
--- a/lib/ace/mode/mediawiki_highlight_rules.js
+++ b/lib/ace/mode/mediawiki_highlight_rules.js
@@ -76,7 +76,7 @@ var MediaWikiHighlightRules = function() {
"entity.name.function",
"meta.template"
],
- regex: /({{)(\s*)([\w ]+)(\s*)/,
+ regex: /({{)(\s*)([#\w: ]+)(\s*)/,
push: [{
token: "storage.type.function",
regex: /}}/,
From 58cab80c616b3633448d62200b3832547e59d6c7 Mon Sep 17 00:00:00 2001
From: Gary
Date: Thu, 20 Feb 2020 11:05:54 -0800
Subject: [PATCH 0283/1293] accessibility fixes to Kitchen Sink demo page
I will be working with a developer who is blind to help evaluate Ace accessibility improvements I'll be making so having the kitchen sink be usable by him is potentially helpful.
Also doing this for the practice and to avoid working on the more difficult problems of screen reader support in Ace itself just a little bit longer.
- Fix the toggle control in upper-left work like a button (keyboard and screen reader in addition to mouse), and give it a label for screen readers
- Mark layout tables as being for presentation so they aren't surfaced as containing tabular data by screen readers
- Wrap the Test controls in a named group so screen reader identifies them as part of that group
- Give the "O" and "X" test buttons more descriptive names for screen reader
- Supply alt-text for the two image-based links in the options panel
- Fix how ids and labels are associated for options containing multiple controls such as "Soft Tabs" and "Show Print Margin" and give the second control a screen reader label
- Separate the option for persistent horizontal and vertical scrollbars into two rows
- Improve the button-bar control to put them in named groups and to indicate which button is pressed via aria-pressed
- Change styling of keyboard focus indicators (defaults are very hard to see on a blue background)
---
demo/kitchen-sink/demo.js | 22 +++++++++++++++++-----
demo/kitchen-sink/dev_util.js | 6 +++---
demo/kitchen-sink/styles.css | 11 ++++++++++-
kitchen-sink.html | 8 ++++----
lib/ace/ext/options.js | 31 ++++++++++++++++++++++---------
5 files changed, 56 insertions(+), 22 deletions(-)
diff --git a/demo/kitchen-sink/demo.js b/demo/kitchen-sink/demo.js
index 634da7d2c64..603475e5c7f 100644
--- a/demo/kitchen-sink/demo.js
+++ b/demo/kitchen-sink/demo.js
@@ -255,13 +255,22 @@ commands.addCommand({
/*********** manage layout ***************************/
-var sidePanelContainer = document.getElementById("sidePanel");
-sidePanelContainer.onclick = function(e) {
+function handleToggleActivate(target) {
if (dom.hasCssClass(sidePanelContainer, "closed"))
onResize(null, false);
- else if (dom.hasCssClass(e.target, "toggleButton"))
+ else if (dom.hasCssClass(target, "toggleButton"))
onResize(null, true);
-}
+};
+var sidePanelContainer = document.getElementById("sidePanel");
+sidePanelContainer.onclick = function(e) {
+ handleToggleActivate(e.target);
+};
+var optionToggle = document.getElementById("optionToggle");
+optionToggle.onkeydown = function(e) {
+ if (e.code === "Space" || e.code === "Enter") {
+ handleToggleActivate(e.target);
+ }
+};
var consoleHeight = 20;
function onResize(e, closeSidePanel) {
var left = 280;
@@ -269,8 +278,11 @@ function onResize(e, closeSidePanel) {
var height = document.documentElement.clientHeight;
if (closeSidePanel == null)
closeSidePanel = width < 2 * left;
- if (closeSidePanel)
+ if (closeSidePanel) {
left = 20;
+ document.getElementById("optionToggle").setAttribute("aria-label", "Show Options");
+ } else
+ document.getElementById("optionToggle").setAttribute("aria-label", "Hide Options");
width -= left;
container.style.width = width + "px";
container.style.height = height - consoleHeight + "px";
diff --git a/demo/kitchen-sink/dev_util.js b/demo/kitchen-sink/dev_util.js
index b049c325157..c22cc4b1706 100644
--- a/demo/kitchen-sink/dev_util.js
+++ b/demo/kitchen-sink/dev_util.js
@@ -293,13 +293,13 @@ function toString(x) {
}
exports.getUI = function(container) {
- return ["div", {},
+ return ["div", {role: "group", "aria-label": "Test"},
" Test ",
- ["button", {onclick: exports.openLogView}, "O"],
+ ["button", {"aria-label": "Open Log View", onclick: exports.openLogView}, "O"],
["button", {onclick: exports.record}, "Record"],
["button", {onclick: exports.stop}, "Stop"],
["button", {onclick: exports.play}, "Play"],
- ["button", {onclick: exports.closeLogView}, "X"],
+ ["button", {"aria-label": "Close Log View", onclick: exports.closeLogView}, "X"],
];
};
diff --git a/demo/kitchen-sink/styles.css b/demo/kitchen-sink/styles.css
index d2f822bcf53..a0ad03869ca 100644
--- a/demo/kitchen-sink/styles.css
+++ b/demo/kitchen-sink/styles.css
@@ -60,7 +60,16 @@ body {
background-color: #eee;
pointer-events: none;
transition: 0.5s;
-}
+}
+
+#sidePanel *:focus {
+ outline: 3px solid orange;
+}
+
+#sidePanel a {
+ display: inline-block;
+}
+
#sidePanel:not(.closed) .toggleButton >div:nth-child(1) {transform: translate(0px, 5px) rotate(-45deg)}
#sidePanel:not(.closed) .toggleButton >div:nth-child(2) {opacity: 0}
#sidePanel:not(.closed) .toggleButton >div:nth-child(3) {transform: translate(0px, -5px) rotate(45deg)}
diff --git a/kitchen-sink.html b/kitchen-sink.html
index 45689816272..6cf83c887c0 100644
--- a/kitchen-sink.html
+++ b/kitchen-sink.html
@@ -21,18 +21,18 @@