package
This commit is contained in:
parent
8584581a32
commit
3645c88c63
245 changed files with 6074 additions and 3051 deletions
|
|
@ -244,7 +244,7 @@ exportAce(ACE_NAMESPACE);
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
define('kitchen-sink/demo', ['require', 'exports', 'module' , 'ace/lib/fixoldbrowsers', 'ace/config', 'ace/lib/event', 'ace/theme/textmate', 'ace/edit_session', 'ace/undomanager', 'ace/keyboard/keybinding/vim', 'ace/keyboard/keybinding/emacs', 'ace/keyboard/hash_handler', 'text!kitchen-sink/docs/plaintext.txt', 'text!kitchen-sink/docs/javascript.js', 'text!kitchen-sink/docs/coffeescript.coffee', 'text!kitchen-sink/docs/json.json', 'text!kitchen-sink/docs/css.css', 'text!kitchen-sink/docs/scss.scss', 'text!kitchen-sink/docs/less.less', 'text!kitchen-sink/docs/html.html', 'text!kitchen-sink/docs/xml.xml', 'text!kitchen-sink/docs/svg.svg', 'text!kitchen-sink/docs/php.php', 'text!kitchen-sink/docs/coldfusion.cfm', 'text!kitchen-sink/docs/python.py', 'text!kitchen-sink/docs/ruby.rb', 'text!kitchen-sink/docs/perl.pl', 'text!kitchen-sink/docs/ocaml.ml', 'text!kitchen-sink/docs/lua.lua', 'text!kitchen-sink/docs/liquid.liquid', 'text!kitchen-sink/docs/java.java', 'text!kitchen-sink/docs/clojure.clj', 'text!kitchen-sink/docs/groovy.groovy', 'text!kitchen-sink/docs/scala.scala', 'text!kitchen-sink/docs/csharp.cs', 'text!kitchen-sink/docs/powershell.ps1', 'text!kitchen-sink/docs/cpp.cpp', 'text!kitchen-sink/docs/Haxe.hx', 'text!kitchen-sink/docs/sh.sh', 'text!kitchen-sink/docs/xquery.xq', 'text!kitchen-sink/docs/markdown.md', 'text!kitchen-sink/docs/textile.textile', 'text!kitchen-sink/docs/latex.tex', 'text!kitchen-sink/docs/sql.sql', 'text!kitchen-sink/docs/pgsql.pgsql', 'ace/split', 'ace/multi_select'], function(require, exports, module) {
|
||||
define('kitchen-sink/demo', ['require', 'exports', 'module' , 'ace/lib/fixoldbrowsers', 'ace/config', 'ace/lib/event', 'ace/theme/textmate', 'ace/edit_session', 'ace/undomanager', 'ace/keyboard/keybinding/vim', 'ace/keyboard/keybinding/emacs', 'ace/keyboard/hash_handler', 'text!kitchen-sink/docs/plaintext.txt', 'text!kitchen-sink/docs/javascript.js', 'text!kitchen-sink/docs/coffeescript.coffee', 'text!kitchen-sink/docs/json.json', 'text!kitchen-sink/docs/css.css', 'text!kitchen-sink/docs/scss.scss', 'text!kitchen-sink/docs/less.less', 'text!kitchen-sink/docs/html.html', 'text!kitchen-sink/docs/xml.xml', 'text!kitchen-sink/docs/svg.svg', 'text!kitchen-sink/docs/php.php', 'text!kitchen-sink/docs/coldfusion.cfm', 'text!kitchen-sink/docs/python.py', 'text!kitchen-sink/docs/ruby.rb', 'text!kitchen-sink/docs/perl.pl', 'text!kitchen-sink/docs/ocaml.ml', 'text!kitchen-sink/docs/lua.lua', 'text!kitchen-sink/docs/liquid.liquid', 'text!kitchen-sink/docs/java.java', 'text!kitchen-sink/docs/clojure.clj', 'text!kitchen-sink/docs/groovy.groovy', 'text!kitchen-sink/docs/scala.scala', 'text!kitchen-sink/docs/csharp.cs', 'text!kitchen-sink/docs/powershell.ps1', 'text!kitchen-sink/docs/cpp.cpp', 'text!kitchen-sink/docs/Haxe.hx', 'text!kitchen-sink/docs/sh.sh', 'text!kitchen-sink/docs/xquery.xq', 'text!kitchen-sink/docs/markdown.md', 'text!kitchen-sink/docs/textile.textile', 'text!kitchen-sink/docs/latex.tex', 'text!kitchen-sink/docs/sql.sql', 'text!kitchen-sink/docs/pgsql.pgsql', 'text!kitchen-sink/docs/golang.go', 'ace/split', 'ace/multi_select'], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
require("ace/lib/fixoldbrowsers");
|
||||
|
|
@ -299,6 +299,7 @@ var modes = [
|
|||
new Mode("coldfusion", "ColdFusion", ["cfm"]),
|
||||
new Mode("csharp", "C#", ["cs"]),
|
||||
new Mode("css", "CSS", ["css"]),
|
||||
new Mode("golang", "Go", ["go"]),
|
||||
new Mode("groovy", "Groovy", ["groovy"]),
|
||||
new Mode("haxe", "haXe", ["hx"]),
|
||||
new Mode("html", "HTML", ["html", "htm"]),
|
||||
|
|
@ -467,6 +468,10 @@ var docs = [
|
|||
new WrappedDoc(
|
||||
"pgsql", "pgSQL",
|
||||
require("text!./docs/pgsql.pgsql")
|
||||
),
|
||||
new Doc(
|
||||
"golang", "Go",
|
||||
require("text!./docs/golang.go")
|
||||
)
|
||||
];
|
||||
|
||||
|
|
@ -3265,7 +3270,7 @@ exports.cssText = ".ace-tm .ace_editor {\
|
|||
}\
|
||||
\
|
||||
.ace-tm .ace_cursor {\
|
||||
border-left: 1px solid black;\
|
||||
border-left: 2px solid black;\
|
||||
}\
|
||||
\
|
||||
.ace-tm .ace_cursor.ace_overwrite {\
|
||||
|
|
@ -3367,7 +3372,10 @@ exports.cssText = ".ace-tm .ace_editor {\
|
|||
.ace-tm .ace_marker-layer .ace_selection {\
|
||||
background: rgb(181, 213, 255);\
|
||||
}\
|
||||
\
|
||||
.ace-tm.multiselect .ace_selection.start {\
|
||||
box-shadow: 0 0 3px 0px white;\
|
||||
border-radius: 2px;\
|
||||
}\
|
||||
.ace-tm .ace_marker-layer .ace_step {\
|
||||
background: rgb(252, 255, 0);\
|
||||
}\
|
||||
|
|
@ -6004,7 +6012,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
|
||||
}
|
||||
|
||||
this.intersectsRange = function(range) {
|
||||
this.intersects = function(range) {
|
||||
var cmp = this.compareRange(range);
|
||||
return (cmp == -1 || cmp == 0 || cmp == 1);
|
||||
}
|
||||
|
|
@ -6565,9 +6573,8 @@ var Tokenizer = function(rules, flag) {
|
|||
else
|
||||
type = rule.token;
|
||||
|
||||
var next = rule.next;
|
||||
if (next && next !== currentState) {
|
||||
currentState = next;
|
||||
if (rule.next) {
|
||||
currentState = rule.next;
|
||||
state = this.rules[currentState];
|
||||
mapping = this.matchMappings[currentState];
|
||||
lastIndex = re.lastIndex;
|
||||
|
|
@ -6687,8 +6694,6 @@ var TextHighlightRules = function() {
|
|||
var rule = state[i];
|
||||
if (rule.next) {
|
||||
rule.next = prefix + rule.next;
|
||||
} else {
|
||||
rule.next = prefix + key;
|
||||
}
|
||||
}
|
||||
this.$rules[prefix + key] = state;
|
||||
|
|
@ -11137,6 +11142,42 @@ define("text!kitchen-sink/docs/pgsql.pgsql", [], "\n" +
|
|||
"END;\n" +
|
||||
"");
|
||||
|
||||
define("text!kitchen-sink/docs/golang.go", [], "// Concurrent computation of pi.\n" +
|
||||
"// See http://goo.gl/ZuTZM.\n" +
|
||||
"//\n" +
|
||||
"// This demonstrates Go's ability to handle\n" +
|
||||
"// large numbers of concurrent processes.\n" +
|
||||
"// It is an unreasonable way to calculate pi.\n" +
|
||||
"package main\n" +
|
||||
"\n" +
|
||||
"import (\n" +
|
||||
" \"fmt\"\n" +
|
||||
" \"math\"\n" +
|
||||
")\n" +
|
||||
"\n" +
|
||||
"func main() {\n" +
|
||||
" fmt.Println(pi(5000))\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"// pi launches n goroutines to compute an\n" +
|
||||
"// approximation of pi.\n" +
|
||||
"func pi(n int) float64 {\n" +
|
||||
" ch := make(chan float64)\n" +
|
||||
" for k := 0; k <= n; k++ {\n" +
|
||||
" go term(ch, float64(k))\n" +
|
||||
" }\n" +
|
||||
" f := 0.0\n" +
|
||||
" for k := 0; k <= n; k++ {\n" +
|
||||
" f += <-ch\n" +
|
||||
" }\n" +
|
||||
" return f\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"func term(ch chan float64, k float64) {\n" +
|
||||
" ch <- 4 * math.Pow(-1, k) / (2*k + 1)\n" +
|
||||
"}\n" +
|
||||
"");
|
||||
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
|
|
@ -11195,7 +11236,7 @@ var Split = function(container, theme, splits) {
|
|||
this.$splits = 0;
|
||||
this.$editorCSS = "";
|
||||
this.$editors = [];
|
||||
this.$oriantation = this.BESIDE;
|
||||
this.$orientation = this.BESIDE;
|
||||
|
||||
this.setSplits(splits || 1);
|
||||
this.$cEditor = this.$editors[0];
|
||||
|
|
@ -11352,15 +11393,15 @@ var Split = function(container, theme, splits) {
|
|||
return session;
|
||||
};
|
||||
|
||||
this.getOriantation = function() {
|
||||
return this.$oriantation;
|
||||
this.getOrientation = function() {
|
||||
return this.$orientation;
|
||||
};
|
||||
|
||||
this.setOriantation = function(oriantation) {
|
||||
if (this.$oriantation == oriantation) {
|
||||
this.setOrientation = function(orientation) {
|
||||
if (this.$orientation == orientation) {
|
||||
return;
|
||||
}
|
||||
this.$oriantation = oriantation;
|
||||
this.$orientation = orientation;
|
||||
this.resize();
|
||||
};
|
||||
|
||||
|
|
@ -11369,7 +11410,7 @@ var Split = function(container, theme, splits) {
|
|||
var height = this.$container.clientHeight;
|
||||
var editor;
|
||||
|
||||
if (this.$oriantation == this.BESIDE) {
|
||||
if (this.$orientation == this.BESIDE) {
|
||||
var editorWidth = width / this.$splits;
|
||||
for (var i = 0; i < this.$splits; i++) {
|
||||
editor = this.$editors[i];
|
||||
|
|
@ -12598,11 +12639,12 @@ var Editor = function(renderer, session) {
|
|||
if (!ranges.length)
|
||||
return replaced;
|
||||
|
||||
this.$blockScrolling += 1;
|
||||
|
||||
var selection = this.getSelectionRange();
|
||||
this.clearSelection();
|
||||
this.selection.moveCursorTo(0, 0);
|
||||
|
||||
this.$blockScrolling += 1;
|
||||
for (var i = ranges.length - 1; i >= 0; --i) {
|
||||
if(this.$tryReplace(ranges[i], replacement)) {
|
||||
replaced++;
|
||||
|
|
@ -16017,7 +16059,7 @@ var Marker = function(parentEl) {
|
|||
}
|
||||
else {
|
||||
this.drawSingleLineMarker(
|
||||
html, range, marker.clazz, config,
|
||||
html, range, marker.clazz + " start", config,
|
||||
null, marker.type
|
||||
);
|
||||
}
|
||||
|
|
@ -16040,7 +16082,7 @@ var Marker = function(parentEl) {
|
|||
row, range.start.column,
|
||||
row, this.session.getScreenLastRowColumn(row)
|
||||
);
|
||||
this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 1, "text");
|
||||
this.drawSingleLineMarker(stringBuilder, lineRange, clazz + " start", layerConfig, 1, "text");
|
||||
|
||||
// selection end
|
||||
row = range.end.row;
|
||||
|
|
@ -16070,7 +16112,7 @@ var Marker = function(parentEl) {
|
|||
);
|
||||
|
||||
stringBuilder.push(
|
||||
"<div class='", clazz, "' style='",
|
||||
"<div class='", clazz, " start' style='",
|
||||
"height:", height, "px;",
|
||||
"width:", width, "px;",
|
||||
"top:", top, "px;",
|
||||
|
|
@ -16856,11 +16898,11 @@ var Cursor = function(parentEl) {
|
|||
if (!this.isVisible)
|
||||
return;
|
||||
|
||||
var element = this.element;
|
||||
var element = this.cursors.length == 1 ? this.cursor : this.element;
|
||||
this.blinkId = setInterval(function() {
|
||||
element.style.visibility = "hidden";
|
||||
setTimeout(function() {
|
||||
element.style.visibility = "visible";
|
||||
element.style.visibility = "";
|
||||
}, 400);
|
||||
}, 1000);
|
||||
};
|
||||
|
|
@ -16890,7 +16932,7 @@ var Cursor = function(parentEl) {
|
|||
this.update = function(config) {
|
||||
this.config = config;
|
||||
|
||||
if (this.session.selectionMarkerCount > 1) {
|
||||
if (this.session.selectionMarkerCount > 0) {
|
||||
var selections = this.session.$selectionMarkers;
|
||||
var i = 0, sel, cursorIndex = 0;
|
||||
|
||||
|
|
@ -17268,6 +17310,10 @@ define("text!ace/css/editor.css", [], "@import url(//fonts.googleapis.com/css?fa
|
|||
" opacity: 0.2;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".ace_editor.multiselect .ace_cursor {\n" +
|
||||
" border-left-width: 1px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".ace_line {\n" +
|
||||
" white-space: nowrap;\n" +
|
||||
"}\n" +
|
||||
|
|
@ -17482,18 +17528,19 @@ var EditSession = require("./edit_session").EditSession;
|
|||
*
|
||||
* adds a range to selection entering multiselect mode if necessary
|
||||
**/
|
||||
this.addRange = function(range) {
|
||||
if (!this.inMultiSelectMode && this.rangeCount == 0) {
|
||||
var oldRange = this.toOrientedRange();
|
||||
if (!range || !range.isEqual(oldRange)) {
|
||||
this.rangeList.add(oldRange);
|
||||
this.$onAddRange(oldRange);
|
||||
}
|
||||
}
|
||||
|
||||
this.addRange = function(range, $blockChangeEvents) {
|
||||
if (!range)
|
||||
return;
|
||||
|
||||
if (!this.inMultiSelectMode && this.rangeCount == 0) {
|
||||
var oldRange = this.toOrientedRange();
|
||||
if (range.intersects(oldRange))
|
||||
return $blockChangeEvents || this.fromOrientedRange(range);
|
||||
|
||||
this.rangeList.add(oldRange);
|
||||
this.$onAddRange(oldRange);
|
||||
}
|
||||
|
||||
if (!range.cursor)
|
||||
range.cursor = range.end;
|
||||
|
||||
|
|
@ -17504,12 +17551,14 @@ var EditSession = require("./edit_session").EditSession;
|
|||
if (removed.length)
|
||||
this.$onRemoveRange(removed);
|
||||
|
||||
if (this.rangeCount > 0 && !this.inMultiSelectMode) {
|
||||
if (this.rangeCount > 1 && !this.inMultiSelectMode) {
|
||||
this._emit("multiSelect");
|
||||
this.inMultiSelectMode = true;
|
||||
this.session.$undoSelect = false;
|
||||
this.rangeList.attach(this.session);
|
||||
}
|
||||
|
||||
return $blockChangeEvents || this.fromOrientedRange(range);
|
||||
};
|
||||
|
||||
this.toSingleRange = function(range) {
|
||||
|
|
@ -17551,7 +17600,6 @@ var EditSession = require("./edit_session").EditSession;
|
|||
this.$onAddRange = function(range) {
|
||||
this.rangeCount = this.rangeList.ranges.length;
|
||||
this.ranges.unshift(range);
|
||||
this.fromOrientedRange(range);
|
||||
this._emit("addRange", {range: range});
|
||||
};
|
||||
|
||||
|
|
@ -17715,17 +17763,34 @@ var Editor = require("./editor").Editor;
|
|||
return orientedRange;
|
||||
};
|
||||
|
||||
/**
|
||||
* Editor.removeSelectionMarker(range) -> Void
|
||||
* - range: selection range added with addSelectionMarker
|
||||
*
|
||||
* removes selection marker
|
||||
**/
|
||||
this.removeSelectionMarker = function(range) {
|
||||
if (!range.marker)
|
||||
return;
|
||||
this.session.removeMarker(range.marker);
|
||||
var index = this.session.$selectionMarkers.indexOf(range);
|
||||
if (index != -1)
|
||||
this.session.$selectionMarkers.splice(index, 1);
|
||||
this.session.selectionMarkerCount = this.session.$selectionMarkers.length;
|
||||
};
|
||||
|
||||
this.removeSelectionMarkers = function(ranges) {
|
||||
var markerList = this.session.$selectionMarkers;
|
||||
for (var i = ranges.length; i--; ) {
|
||||
var range = ranges[i];
|
||||
if (!range.marker)
|
||||
continue;
|
||||
this.session.removeMarker(range.marker);
|
||||
var index = this.session.$selectionMarkers.indexOf(range);
|
||||
var index = markerList.indexOf(range);
|
||||
if (index != -1)
|
||||
this.session.$selectionMarkers.splice(index, 1);
|
||||
markerList.splice(index, 1);
|
||||
}
|
||||
this.session.selectionMarkerCount = this.session.$selectionMarkers.length;
|
||||
this.session.selectionMarkerCount = markerList.length;
|
||||
};
|
||||
|
||||
this.$onAddRange = function(e) {
|
||||
|
|
@ -17848,6 +17913,37 @@ var Editor = require("./editor").Editor;
|
|||
return text;
|
||||
};
|
||||
|
||||
/**
|
||||
* Editor.findAll(dir, options) -> Number
|
||||
* - needle: text to find
|
||||
* - options: search options
|
||||
* - additive: keeps
|
||||
*
|
||||
* finds and selects all the occurencies of needle
|
||||
* returns number of found ranges
|
||||
**/
|
||||
this.findAll = function(needle, options, additive) {
|
||||
options = options || {};
|
||||
options.needle = needle || options.needle;
|
||||
this.$search.set(options);
|
||||
|
||||
var ranges = this.$search.findAll(this.session);
|
||||
if (!ranges.length)
|
||||
return 0;
|
||||
|
||||
this.$blockScrolling += 1;
|
||||
var selection = this.multiSelect;
|
||||
|
||||
if (!additive)
|
||||
selection.toSingleRange(ranges[0]);
|
||||
|
||||
for (var i = ranges.length; i--; )
|
||||
selection.addRange(ranges[i], true);
|
||||
|
||||
this.$blockScrolling -= 1;
|
||||
|
||||
return ranges.length;
|
||||
};
|
||||
|
||||
// commands
|
||||
/**
|
||||
|
|
@ -18029,6 +18125,33 @@ function MultiSelect(editor) {
|
|||
|
||||
editor.on("mousedown", onMouseDown);
|
||||
editor.commands.addCommands(exports.commands.defaultCommands);
|
||||
|
||||
addAltCursorListeners(editor);
|
||||
}
|
||||
|
||||
function addAltCursorListeners(editor){
|
||||
var el = editor.textInput.getElement();
|
||||
var altCursor = false;
|
||||
var contentEl = editor.renderer.content;
|
||||
el.addEventListener("keydown", function(e) {
|
||||
if (e.keyCode == 18 && !(e.ctrlKey || e.shiftKey || e.metaKey)) {
|
||||
if (!altCursor) {
|
||||
contentEl.style.cursor = "crosshair";
|
||||
altCursor = true;
|
||||
}
|
||||
} else if (altCursor) {
|
||||
contentEl.style.cursor = "";
|
||||
}
|
||||
});
|
||||
|
||||
el.addEventListener("keyup", reset);
|
||||
el.addEventListener("blur", reset);
|
||||
function reset() {
|
||||
if (altCursor) {
|
||||
contentEl.style.cursor = "";
|
||||
altCursor = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.MultiSelect = MultiSelect;
|
||||
|
|
@ -18377,9 +18500,10 @@ function onMouseDown(e) {
|
|||
if (!isMultiSelect && inSelection)
|
||||
return; // dragging
|
||||
|
||||
if (!isMultiSelect)
|
||||
selection.addRange(selection.toOrientedRange());
|
||||
|
||||
if (!isMultiSelect) {
|
||||
var range = selection.toOrientedRange();
|
||||
editor.addSelectionMarker(range);
|
||||
}
|
||||
|
||||
var oldRange = selection.rangeList.rangeAtPoint(pos);
|
||||
|
||||
|
|
@ -18388,8 +18512,13 @@ function onMouseDown(e) {
|
|||
|
||||
if (oldRange && tmpSel.isEmpty() && isSamePoint(oldRange.cursor, tmpSel.cursor))
|
||||
selection.substractPoint(tmpSel.cursor);
|
||||
else
|
||||
else {
|
||||
if (range) {
|
||||
editor.removeSelectionMarker(range);
|
||||
selection.addRange(range);
|
||||
}
|
||||
selection.addRange(tmpSel);
|
||||
}
|
||||
});
|
||||
|
||||
} else if (!shift && alt && button == 0) {
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ var c_cppHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : "\\/\\/.*$"
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -303,7 +303,7 @@ var c_cppHighlightRules = function() {
|
|||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(c_cppHighlightRules, TextHighlightRules);
|
||||
|
|
@ -381,27 +381,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
|
|
@ -1360,7 +1360,7 @@ var JavaScriptHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : /\/\/.*$/
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -1368,11 +1368,11 @@ var JavaScriptHighlightRules = function() {
|
|||
next : "comment"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
regex : "'(?=.)",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
regex : '"(?=.)',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
|
|
@ -1392,11 +1392,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -1408,7 +1407,8 @@ var JavaScriptHighlightRules = function() {
|
|||
"keyword.operator",
|
||||
"text"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.play = function() { }
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -1419,11 +1419,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: play = function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -1432,22 +1431,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match regular function like: function myFunc(arg) { }
|
||||
token : [
|
||||
"storage.type",
|
||||
"text",
|
||||
"entity.name.function",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: foobar: function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -1456,22 +1453,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||
token : [
|
||||
"text",
|
||||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "constant.language.boolean",
|
||||
regex : /(?:true|false)\b/
|
||||
|
|
@ -1541,6 +1536,7 @@ var JavaScriptHighlightRules = function() {
|
|||
// regular expressions are only allowed after certain tokens. This
|
||||
// makes sure we don't mix up regexps with the divison operator
|
||||
"regex_allowed": [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -1568,10 +1564,9 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
// flag
|
||||
// flag
|
||||
token: "string.regexp",
|
||||
regex: "/\\w*",
|
||||
next: "start",
|
||||
|
|
@ -1579,7 +1574,6 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp",
|
||||
regex: "[^\\\\/\\[]+",
|
||||
next: "regex",
|
||||
merge: true
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
|
|
@ -1595,8 +1589,7 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex_character_class"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "]",
|
||||
|
|
@ -1605,7 +1598,24 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "[^\\\\\\]]+",
|
||||
next: "regex_character_class",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "start"
|
||||
}
|
||||
],
|
||||
"function_arguments": [
|
||||
{
|
||||
token: "variable.parameter",
|
||||
regex: identifierRe,
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "[, ]+",
|
||||
merge: true
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "$",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
|
|
@ -1643,11 +1653,18 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]+'
|
||||
regex : '[^"\\\\]+',
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qqstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
|
|
@ -1656,17 +1673,24 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "[^'\\\\]+"
|
||||
regex : "[^'\\\\]+",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||
|
|
@ -1744,27 +1768,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
|
|
@ -231,27 +231,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
378
build/demo/kitchen-sink/mode-golang-uncompressed.js
Normal file
378
build/demo/kitchen-sink/mode-golang-uncompressed.js
Normal file
|
|
@ -0,0 +1,378 @@
|
|||
define('ace/mode/golang', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/golang_highlight_rules', 'ace/mode/matching_brace_outdent'], function(require, exports, module) {
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var GolangHighlightRules = require("./golang_highlight_rules").GolangHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new GolangHighlightRules().getRules());
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.toggleCommentLines = function(state, doc, startRow, endRow) {
|
||||
var outdent = true;
|
||||
var outentedRows = [];
|
||||
var re = /^(\s*)\/\//;
|
||||
|
||||
for (var i=startRow; i<= endRow; i++) {
|
||||
if (!re.test(doc.getLine(i))) {
|
||||
outdent = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (outdent) {
|
||||
var deleteRange = new Range(0, 0, 0, 0);
|
||||
for (var i=startRow; i<= endRow; i++)
|
||||
{
|
||||
var line = doc.getLine(i);
|
||||
var m = line.match(re);
|
||||
deleteRange.start.row = i;
|
||||
deleteRange.end.row = i;
|
||||
deleteRange.end.column = m[0].length;
|
||||
doc.replace(deleteRange, m[1]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
doc.indentRows(startRow, endRow, "//");
|
||||
}
|
||||
};
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
var indent = this.$getIndent(line);
|
||||
|
||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
||||
var tokens = tokenizedLine.tokens;
|
||||
var endState = tokenizedLine.state;
|
||||
|
||||
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;
|
||||
};//end getNextLineIndent
|
||||
|
||||
this.checkOutdent = function(state, line, input) {
|
||||
return this.$outdent.checkOutdent(line, input);
|
||||
};
|
||||
|
||||
this.autoOutdent = function(state, doc, row) {
|
||||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
define('ace/mode/golang_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||
var oop = require("../lib/oop");
|
||||
var lang = require("../lib/lang");
|
||||
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var GolangHighlightRules = function() {
|
||||
var keywords = lang.arrayToMap(
|
||||
("true|else|false|break|case|return|goto|if|const|" +
|
||||
"continue|struct|default|switch|for|" +
|
||||
"func|import|package|chan|defer|fallthrough|go|interface|map|range" +
|
||||
"select|type|var").split("|")
|
||||
);
|
||||
|
||||
var buildinConstants = lang.arrayToMap(
|
||||
("nit|true|false|iota").split("|")
|
||||
);
|
||||
|
||||
this.$rules = {
|
||||
"start" : [
|
||||
{
|
||||
token : "comment",
|
||||
regex : "\\/\\/.*$"
|
||||
},
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
regex : "\\/\\*",
|
||||
next : "comment"
|
||||
}, {
|
||||
token : "string", // single line
|
||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||
}, {
|
||||
token : "string", // multi line string start
|
||||
merge : true,
|
||||
regex : '["].*\\\\$',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "string", // single line
|
||||
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||
}, {
|
||||
token : "string", // multi line string start
|
||||
merge : true,
|
||||
regex : "['].*\\\\$",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
||||
}, {
|
||||
token : "constant.numeric", // float
|
||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||
}, {
|
||||
token : "constant", // <CONSTANT>
|
||||
regex : "<[a-zA-Z0-9.]+>"
|
||||
}, {
|
||||
token : "keyword", // pre-compiler directivs
|
||||
regex : "(?:#include|#pragma|#line|#define|#undef|#ifdef|#else|#elif|#endif|#ifndef)"
|
||||
}, {
|
||||
token : function(value) {
|
||||
if (value == "this")
|
||||
return "variable.language";
|
||||
else if (keywords.hasOwnProperty(value))
|
||||
return "keyword";
|
||||
else if (buildinConstants.hasOwnProperty(value))
|
||||
return "constant.language";
|
||||
else
|
||||
return "identifier";
|
||||
},
|
||||
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||
}, {
|
||||
token : "keyword.operator",
|
||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)"
|
||||
}, {
|
||||
token : "punctuation.operator",
|
||||
regex : "\\?|\\:|\\,|\\;|\\."
|
||||
}, {
|
||||
token : "paren.lparen",
|
||||
regex : "[[({]"
|
||||
}, {
|
||||
token : "paren.rparen",
|
||||
regex : "[\\])}]"
|
||||
}, {
|
||||
token : "text",
|
||||
regex : "\\s+"
|
||||
}
|
||||
],
|
||||
"comment" : [
|
||||
{
|
||||
token : "comment", // closing comment
|
||||
regex : ".*?\\*\\/",
|
||||
next : "start"
|
||||
}, {
|
||||
token : "comment", // comment spanning whole line
|
||||
merge : true,
|
||||
regex : ".+"
|
||||
}
|
||||
],
|
||||
"qqstring" : [
|
||||
{
|
||||
token : "string",
|
||||
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
|
||||
next : "start"
|
||||
}, {
|
||||
token : "string",
|
||||
merge : true,
|
||||
regex : '.+'
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
{
|
||||
token : "string",
|
||||
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
|
||||
next : "start"
|
||||
}, {
|
||||
token : "string",
|
||||
merge : true,
|
||||
regex : '.+'
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
oop.inherits(GolangHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.GolangHighlightRules = GolangHighlightRules;
|
||||
});
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var DocCommentHighlightRules = function() {
|
||||
|
||||
this.$rules = {
|
||||
"start" : [ {
|
||||
token : "comment.doc.tag",
|
||||
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
||||
}, {
|
||||
token : "comment.doc",
|
||||
merge : true,
|
||||
regex : "\\s+"
|
||||
}, {
|
||||
token : "comment.doc",
|
||||
merge : true,
|
||||
regex : "TODO"
|
||||
}, {
|
||||
token : "comment.doc",
|
||||
merge : true,
|
||||
regex : "[^@\\*]+"
|
||||
}, {
|
||||
token : "comment.doc",
|
||||
merge : true,
|
||||
regex : "."
|
||||
}]
|
||||
};
|
||||
};
|
||||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
});
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var MatchingBraceOutdent = function() {};
|
||||
|
||||
(function() {
|
||||
|
||||
this.checkOutdent = function(line, input) {
|
||||
if (! /^\s+$/.test(line))
|
||||
return false;
|
||||
|
||||
return /^\s*\}/.test(input);
|
||||
};
|
||||
|
||||
this.autoOutdent = function(doc, row) {
|
||||
var line = doc.getLine(row);
|
||||
var match = line.match(/^(\s*\})/);
|
||||
|
||||
if (!match) return 0;
|
||||
|
||||
var column = match[1].length;
|
||||
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||
|
||||
if (!openBracePos || openBracePos.row == row) return 0;
|
||||
|
||||
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||
};
|
||||
|
||||
this.$getIndent = function(line) {
|
||||
var match = line.match(/^(\s+)/);
|
||||
if (match) {
|
||||
return match[1];
|
||||
}
|
||||
|
||||
return "";
|
||||
};
|
||||
|
||||
}).call(MatchingBraceOutdent.prototype);
|
||||
|
||||
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||
});
|
||||
|
|
@ -304,7 +304,7 @@ var JavaScriptHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : /\/\/.*$/
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -312,11 +312,11 @@ var JavaScriptHighlightRules = function() {
|
|||
next : "comment"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
regex : "'(?=.)",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
regex : '"(?=.)',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
|
|
@ -336,11 +336,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -352,7 +351,8 @@ var JavaScriptHighlightRules = function() {
|
|||
"keyword.operator",
|
||||
"text"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.play = function() { }
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -363,11 +363,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: play = function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -376,22 +375,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match regular function like: function myFunc(arg) { }
|
||||
token : [
|
||||
"storage.type",
|
||||
"text",
|
||||
"entity.name.function",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: foobar: function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -400,22 +397,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||
token : [
|
||||
"text",
|
||||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "constant.language.boolean",
|
||||
regex : /(?:true|false)\b/
|
||||
|
|
@ -485,6 +480,7 @@ var JavaScriptHighlightRules = function() {
|
|||
// regular expressions are only allowed after certain tokens. This
|
||||
// makes sure we don't mix up regexps with the divison operator
|
||||
"regex_allowed": [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -512,10 +508,9 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
// flag
|
||||
// flag
|
||||
token: "string.regexp",
|
||||
regex: "/\\w*",
|
||||
next: "start",
|
||||
|
|
@ -523,7 +518,6 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp",
|
||||
regex: "[^\\\\/\\[]+",
|
||||
next: "regex",
|
||||
merge: true
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
|
|
@ -539,8 +533,7 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex_character_class"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "]",
|
||||
|
|
@ -549,7 +542,24 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "[^\\\\\\]]+",
|
||||
next: "regex_character_class",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "start"
|
||||
}
|
||||
],
|
||||
"function_arguments": [
|
||||
{
|
||||
token: "variable.parameter",
|
||||
regex: identifierRe,
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "[, ]+",
|
||||
merge: true
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "$",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
|
|
@ -587,11 +597,18 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]+'
|
||||
regex : '[^"\\\\]+',
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qqstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
|
|
@ -600,17 +617,24 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "[^'\\\\]+"
|
||||
regex : "[^'\\\\]+",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||
|
|
@ -688,27 +712,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
@ -1457,7 +1478,7 @@ var GroovyHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : "\\/\\/.*$"
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -1527,7 +1548,7 @@ var GroovyHighlightRules = function() {
|
|||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(GroovyHighlightRules, TextHighlightRules);
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ var HaxeHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : "\\/\\/.*$"
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
regex : "\\/\\*",
|
||||
|
|
@ -153,7 +153,7 @@ var HaxeHighlightRules = function() {
|
|||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(HaxeHighlightRules, TextHighlightRules);
|
||||
|
|
@ -231,27 +231,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
|
|
@ -363,7 +363,7 @@ var JavaScriptHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : /\/\/.*$/
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -371,11 +371,11 @@ var JavaScriptHighlightRules = function() {
|
|||
next : "comment"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
regex : "'(?=.)",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
regex : '"(?=.)',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
|
|
@ -395,11 +395,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -411,7 +410,8 @@ var JavaScriptHighlightRules = function() {
|
|||
"keyword.operator",
|
||||
"text"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.play = function() { }
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -422,11 +422,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: play = function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -435,22 +434,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match regular function like: function myFunc(arg) { }
|
||||
token : [
|
||||
"storage.type",
|
||||
"text",
|
||||
"entity.name.function",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: foobar: function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -459,22 +456,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||
token : [
|
||||
"text",
|
||||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "constant.language.boolean",
|
||||
regex : /(?:true|false)\b/
|
||||
|
|
@ -544,6 +539,7 @@ var JavaScriptHighlightRules = function() {
|
|||
// regular expressions are only allowed after certain tokens. This
|
||||
// makes sure we don't mix up regexps with the divison operator
|
||||
"regex_allowed": [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -571,10 +567,9 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
// flag
|
||||
// flag
|
||||
token: "string.regexp",
|
||||
regex: "/\\w*",
|
||||
next: "start",
|
||||
|
|
@ -582,7 +577,6 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp",
|
||||
regex: "[^\\\\/\\[]+",
|
||||
next: "regex",
|
||||
merge: true
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
|
|
@ -598,8 +592,7 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex_character_class"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "]",
|
||||
|
|
@ -608,7 +601,24 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "[^\\\\\\]]+",
|
||||
next: "regex_character_class",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "start"
|
||||
}
|
||||
],
|
||||
"function_arguments": [
|
||||
{
|
||||
token: "variable.parameter",
|
||||
regex: identifierRe,
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "[, ]+",
|
||||
merge: true
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "$",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
|
|
@ -646,11 +656,18 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]+'
|
||||
regex : '[^"\\\\]+',
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qqstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
|
|
@ -659,17 +676,24 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "[^'\\\\]+"
|
||||
regex : "[^'\\\\]+",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||
|
|
@ -747,27 +771,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ var JavaScriptHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : /\/\/.*$/
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -313,11 +313,11 @@ var JavaScriptHighlightRules = function() {
|
|||
next : "comment"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
regex : "'(?=.)",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
regex : '"(?=.)',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
|
|
@ -337,11 +337,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -353,7 +352,8 @@ var JavaScriptHighlightRules = function() {
|
|||
"keyword.operator",
|
||||
"text"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.play = function() { }
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -364,11 +364,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: play = function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -377,22 +376,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match regular function like: function myFunc(arg) { }
|
||||
token : [
|
||||
"storage.type",
|
||||
"text",
|
||||
"entity.name.function",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: foobar: function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -401,22 +398,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||
token : [
|
||||
"text",
|
||||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "constant.language.boolean",
|
||||
regex : /(?:true|false)\b/
|
||||
|
|
@ -486,6 +481,7 @@ var JavaScriptHighlightRules = function() {
|
|||
// regular expressions are only allowed after certain tokens. This
|
||||
// makes sure we don't mix up regexps with the divison operator
|
||||
"regex_allowed": [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -513,10 +509,9 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
// flag
|
||||
// flag
|
||||
token: "string.regexp",
|
||||
regex: "/\\w*",
|
||||
next: "start",
|
||||
|
|
@ -524,7 +519,6 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp",
|
||||
regex: "[^\\\\/\\[]+",
|
||||
next: "regex",
|
||||
merge: true
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
|
|
@ -540,8 +534,7 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex_character_class"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "]",
|
||||
|
|
@ -550,7 +543,24 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "[^\\\\\\]]+",
|
||||
next: "regex_character_class",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "start"
|
||||
}
|
||||
],
|
||||
"function_arguments": [
|
||||
{
|
||||
token: "variable.parameter",
|
||||
regex: identifierRe,
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "[, ]+",
|
||||
merge: true
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "$",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
|
|
@ -588,11 +598,18 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]+'
|
||||
regex : '[^"\\\\]+',
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qqstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
|
|
@ -601,17 +618,24 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "[^'\\\\]+"
|
||||
regex : "[^'\\\\]+",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||
|
|
@ -689,27 +713,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
@ -1459,7 +1480,7 @@ var JavaHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : "\\/\\/.*$"
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -1529,7 +1550,7 @@ var JavaHighlightRules = function() {
|
|||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(JavaHighlightRules, TextHighlightRules);
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@ var JavaScriptHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : /\/\/.*$/
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -288,11 +288,11 @@ var JavaScriptHighlightRules = function() {
|
|||
next : "comment"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
regex : "'(?=.)",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
regex : '"(?=.)',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
|
|
@ -312,11 +312,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -328,7 +327,8 @@ var JavaScriptHighlightRules = function() {
|
|||
"keyword.operator",
|
||||
"text"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.play = function() { }
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -339,11 +339,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: play = function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -352,22 +351,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match regular function like: function myFunc(arg) { }
|
||||
token : [
|
||||
"storage.type",
|
||||
"text",
|
||||
"entity.name.function",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: foobar: function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -376,22 +373,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||
token : [
|
||||
"text",
|
||||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "constant.language.boolean",
|
||||
regex : /(?:true|false)\b/
|
||||
|
|
@ -461,6 +456,7 @@ var JavaScriptHighlightRules = function() {
|
|||
// regular expressions are only allowed after certain tokens. This
|
||||
// makes sure we don't mix up regexps with the divison operator
|
||||
"regex_allowed": [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -488,10 +484,9 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
// flag
|
||||
// flag
|
||||
token: "string.regexp",
|
||||
regex: "/\\w*",
|
||||
next: "start",
|
||||
|
|
@ -499,7 +494,6 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp",
|
||||
regex: "[^\\\\/\\[]+",
|
||||
next: "regex",
|
||||
merge: true
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
|
|
@ -515,8 +509,7 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex_character_class"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "]",
|
||||
|
|
@ -525,7 +518,24 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "[^\\\\\\]]+",
|
||||
next: "regex_character_class",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "start"
|
||||
}
|
||||
],
|
||||
"function_arguments": [
|
||||
{
|
||||
token: "variable.parameter",
|
||||
regex: identifierRe,
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "[, ]+",
|
||||
merge: true
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "$",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
|
|
@ -563,11 +573,18 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]+'
|
||||
regex : '[^"\\\\]+',
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qqstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
|
|
@ -576,17 +593,24 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "[^'\\\\]+"
|
||||
regex : "[^'\\\\]+",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||
|
|
@ -664,27 +688,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
|
|
@ -694,7 +694,7 @@ var JavaScriptHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : /\/\/.*$/
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -702,11 +702,11 @@ var JavaScriptHighlightRules = function() {
|
|||
next : "comment"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
regex : "'(?=.)",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
regex : '"(?=.)',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
|
|
@ -726,11 +726,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -742,7 +741,8 @@ var JavaScriptHighlightRules = function() {
|
|||
"keyword.operator",
|
||||
"text"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.play = function() { }
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -753,11 +753,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: play = function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -766,22 +765,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match regular function like: function myFunc(arg) { }
|
||||
token : [
|
||||
"storage.type",
|
||||
"text",
|
||||
"entity.name.function",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: foobar: function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -790,22 +787,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||
token : [
|
||||
"text",
|
||||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "constant.language.boolean",
|
||||
regex : /(?:true|false)\b/
|
||||
|
|
@ -875,6 +870,7 @@ var JavaScriptHighlightRules = function() {
|
|||
// regular expressions are only allowed after certain tokens. This
|
||||
// makes sure we don't mix up regexps with the divison operator
|
||||
"regex_allowed": [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -902,10 +898,9 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
// flag
|
||||
// flag
|
||||
token: "string.regexp",
|
||||
regex: "/\\w*",
|
||||
next: "start",
|
||||
|
|
@ -913,7 +908,6 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp",
|
||||
regex: "[^\\\\/\\[]+",
|
||||
next: "regex",
|
||||
merge: true
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
|
|
@ -929,8 +923,7 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex_character_class"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "]",
|
||||
|
|
@ -939,7 +932,24 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "[^\\\\\\]]+",
|
||||
next: "regex_character_class",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "start"
|
||||
}
|
||||
],
|
||||
"function_arguments": [
|
||||
{
|
||||
token: "variable.parameter",
|
||||
regex: identifierRe,
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "[, ]+",
|
||||
merge: true
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "$",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
|
|
@ -977,11 +987,18 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]+'
|
||||
regex : '[^"\\\\]+',
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qqstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
|
|
@ -990,17 +1007,24 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "[^'\\\\]+"
|
||||
regex : "[^'\\\\]+",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||
|
|
@ -1078,27 +1102,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
|
|
@ -360,7 +360,7 @@ var JavaScriptHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : /\/\/.*$/
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -368,11 +368,11 @@ var JavaScriptHighlightRules = function() {
|
|||
next : "comment"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
regex : "'(?=.)",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
regex : '"(?=.)',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
|
|
@ -392,11 +392,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -408,7 +407,8 @@ var JavaScriptHighlightRules = function() {
|
|||
"keyword.operator",
|
||||
"text"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.play = function() { }
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -419,11 +419,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: play = function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -432,22 +431,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match regular function like: function myFunc(arg) { }
|
||||
token : [
|
||||
"storage.type",
|
||||
"text",
|
||||
"entity.name.function",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: foobar: function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -456,22 +453,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||
token : [
|
||||
"text",
|
||||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "constant.language.boolean",
|
||||
regex : /(?:true|false)\b/
|
||||
|
|
@ -541,6 +536,7 @@ var JavaScriptHighlightRules = function() {
|
|||
// regular expressions are only allowed after certain tokens. This
|
||||
// makes sure we don't mix up regexps with the divison operator
|
||||
"regex_allowed": [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -568,10 +564,9 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
// flag
|
||||
// flag
|
||||
token: "string.regexp",
|
||||
regex: "/\\w*",
|
||||
next: "start",
|
||||
|
|
@ -579,7 +574,6 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp",
|
||||
regex: "[^\\\\/\\[]+",
|
||||
next: "regex",
|
||||
merge: true
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
|
|
@ -595,8 +589,7 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex_character_class"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "]",
|
||||
|
|
@ -605,7 +598,24 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "[^\\\\\\]]+",
|
||||
next: "regex_character_class",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "start"
|
||||
}
|
||||
],
|
||||
"function_arguments": [
|
||||
{
|
||||
token: "variable.parameter",
|
||||
regex: identifierRe,
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "[, ]+",
|
||||
merge: true
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "$",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
|
|
@ -643,11 +653,18 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]+'
|
||||
regex : '[^"\\\\]+',
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qqstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
|
|
@ -656,17 +673,24 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "[^'\\\\]+"
|
||||
regex : "[^'\\\\]+",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||
|
|
@ -744,27 +768,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
|
|
@ -520,7 +520,7 @@ var PgsqlHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : "--.*$"
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi-line comment
|
||||
merge : true,
|
||||
|
|
@ -649,7 +649,7 @@ var PgsqlHighlightRules = function() {
|
|||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-", [ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
this.embedRules(PerlHighlightRules, "perl-", [{token : "string", regex : "\\$perl\\$", next : "statement"}]);
|
||||
this.embedRules(PythonHighlightRules, "python-", [{token : "string", regex : "\\$python\\$", next : "statement"}]);
|
||||
};
|
||||
|
|
@ -730,27 +730,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocComme
|
|||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var PhpHighlightRules = function() {
|
||||
var docComment = new DocCommentHighlightRules();
|
||||
var docComment = DocCommentHighlightRules;
|
||||
// http://php.net/quickref.php
|
||||
var builtinFunctions = lang.arrayToMap(
|
||||
('abs|acos|acosh|addcslashes|addslashes|aggregate|aggregate_info|aggregate_methods|aggregate_methods_by_list|aggregate_methods_by_regexp|' +
|
||||
|
|
@ -1269,7 +1269,7 @@ var PhpHighlightRules = function() {
|
|||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(PhpHighlightRules, TextHighlightRules);
|
||||
|
|
@ -1347,27 +1347,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ var scadHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : "\\/\\/.*$"
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("start"),
|
||||
DocCommentHighlightRules.getStartRule("start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -291,7 +291,7 @@ var scadHighlightRules = function() {
|
|||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(scadHighlightRules, TextHighlightRules);
|
||||
|
|
@ -369,27 +369,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ var JavaScriptHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : /\/\/.*$/
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -313,11 +313,11 @@ var JavaScriptHighlightRules = function() {
|
|||
next : "comment"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
regex : "'(?=.)",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
regex : '"(?=.)',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
|
|
@ -337,11 +337,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -353,7 +352,8 @@ var JavaScriptHighlightRules = function() {
|
|||
"keyword.operator",
|
||||
"text"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.play = function() { }
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -364,11 +364,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: play = function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -377,22 +376,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match regular function like: function myFunc(arg) { }
|
||||
token : [
|
||||
"storage.type",
|
||||
"text",
|
||||
"entity.name.function",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: foobar: function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -401,22 +398,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||
token : [
|
||||
"text",
|
||||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "constant.language.boolean",
|
||||
regex : /(?:true|false)\b/
|
||||
|
|
@ -486,6 +481,7 @@ var JavaScriptHighlightRules = function() {
|
|||
// regular expressions are only allowed after certain tokens. This
|
||||
// makes sure we don't mix up regexps with the divison operator
|
||||
"regex_allowed": [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -513,10 +509,9 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
// flag
|
||||
// flag
|
||||
token: "string.regexp",
|
||||
regex: "/\\w*",
|
||||
next: "start",
|
||||
|
|
@ -524,7 +519,6 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp",
|
||||
regex: "[^\\\\/\\[]+",
|
||||
next: "regex",
|
||||
merge: true
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
|
|
@ -540,8 +534,7 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex_character_class"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "]",
|
||||
|
|
@ -550,7 +543,24 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "[^\\\\\\]]+",
|
||||
next: "regex_character_class",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "start"
|
||||
}
|
||||
],
|
||||
"function_arguments": [
|
||||
{
|
||||
token: "variable.parameter",
|
||||
regex: identifierRe,
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "[, ]+",
|
||||
merge: true
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "$",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
|
|
@ -588,11 +598,18 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]+'
|
||||
regex : '[^"\\\\]+',
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qqstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
|
|
@ -601,17 +618,24 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "[^'\\\\]+"
|
||||
regex : "[^'\\\\]+",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||
|
|
@ -689,27 +713,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
@ -1459,7 +1480,7 @@ var ScalaHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : "\\/\\/.*$"
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -1529,7 +1550,7 @@ var ScalaHighlightRules = function() {
|
|||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(ScalaHighlightRules, TextHighlightRules);
|
||||
|
|
|
|||
|
|
@ -164,6 +164,8 @@ exports.Mode = Mode;
|
|||
*
|
||||
* Contributor(s):
|
||||
* Rich Healey <richo AT psych0tik DOT net>
|
||||
* Javier Perez-Griffo <javier AT besol DOT es>
|
||||
* James Tan <jamestyj AT gmail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
|
@ -191,14 +193,20 @@ var ShHighlightRules = function() {
|
|||
var reservedKeywords = lang.arrayToMap(
|
||||
('!|{|}|case|do|done|elif|else|'+
|
||||
'esac|fi|for|if|in|then|until|while|'+
|
||||
'&|;'
|
||||
'&|;|export|local|read|typeset|unset|'+
|
||||
'elif|select|set'
|
||||
).split('|')
|
||||
);
|
||||
|
||||
var languageConstructs = lang.arrayToMap(
|
||||
// TODO
|
||||
('echo|exit|eval|source|[|]|test|'+
|
||||
'true|false|read'
|
||||
('[|]|alias|bg|bind|break|builtin|'+
|
||||
'cd|command|compgen|complete|continue|'+
|
||||
'dirs|disown|echo|enable|eval|exec|'+
|
||||
'exit|fc|fg|getopts|hash|help|history|'+
|
||||
'jobs|kill|let|logout|popd|printf|pushd|'+
|
||||
'pwd|return|set|shift|shopt|source|'+
|
||||
'suspend|test|times|trap|type|ulimit|'+
|
||||
'umask|unalias|wait'
|
||||
).split('|')
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -1367,7 +1367,7 @@ var JavaScriptHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : /\/\/.*$/
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -1375,11 +1375,11 @@ var JavaScriptHighlightRules = function() {
|
|||
next : "comment"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
regex : "'(?=.)",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
regex : '"(?=.)',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
|
|
@ -1399,11 +1399,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -1415,7 +1414,8 @@ var JavaScriptHighlightRules = function() {
|
|||
"keyword.operator",
|
||||
"text"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.play = function() { }
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -1426,11 +1426,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: play = function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -1439,22 +1438,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match regular function like: function myFunc(arg) { }
|
||||
token : [
|
||||
"storage.type",
|
||||
"text",
|
||||
"entity.name.function",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: foobar: function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -1463,22 +1460,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||
token : [
|
||||
"text",
|
||||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "constant.language.boolean",
|
||||
regex : /(?:true|false)\b/
|
||||
|
|
@ -1548,6 +1543,7 @@ var JavaScriptHighlightRules = function() {
|
|||
// regular expressions are only allowed after certain tokens. This
|
||||
// makes sure we don't mix up regexps with the divison operator
|
||||
"regex_allowed": [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -1575,10 +1571,9 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
// flag
|
||||
// flag
|
||||
token: "string.regexp",
|
||||
regex: "/\\w*",
|
||||
next: "start",
|
||||
|
|
@ -1586,7 +1581,6 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp",
|
||||
regex: "[^\\\\/\\[]+",
|
||||
next: "regex",
|
||||
merge: true
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
|
|
@ -1602,8 +1596,7 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex_character_class"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "]",
|
||||
|
|
@ -1612,7 +1605,24 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "[^\\\\\\]]+",
|
||||
next: "regex_character_class",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "start"
|
||||
}
|
||||
],
|
||||
"function_arguments": [
|
||||
{
|
||||
token: "variable.parameter",
|
||||
regex: identifierRe,
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "[, ]+",
|
||||
merge: true
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "$",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
|
|
@ -1650,11 +1660,18 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]+'
|
||||
regex : '[^"\\\\]+',
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qqstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
|
|
@ -1663,17 +1680,24 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "[^'\\\\]+"
|
||||
regex : "[^'\\\\]+",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||
|
|
@ -1751,27 +1775,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
|||
}\
|
||||
\
|
||||
.ace-clouds .ace_cursor {\
|
||||
border-left: 1px solid #000000;\
|
||||
border-left: 2px solid #000000;\
|
||||
}\
|
||||
\
|
||||
.ace-clouds .ace_cursor.ace_overwrite {\
|
||||
|
|
@ -80,6 +80,11 @@ exports.cssText = "\
|
|||
background: #BDD5FC;\
|
||||
}\
|
||||
\
|
||||
.ace-clouds.multiselect .ace_selection.start {\
|
||||
box-shadow: 0 0 3px 0px #FFFFFF;\
|
||||
border-radius: 2px;\
|
||||
}\
|
||||
\
|
||||
.ace-clouds .ace_marker-layer .ace_step {\
|
||||
background: rgb(198, 219, 174);\
|
||||
}\
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
|||
}\
|
||||
\
|
||||
.ace-clouds-midnight .ace_cursor {\
|
||||
border-left: 1px solid #7DA5DC;\
|
||||
border-left: 2px solid #7DA5DC;\
|
||||
}\
|
||||
\
|
||||
.ace-clouds-midnight .ace_cursor.ace_overwrite {\
|
||||
|
|
@ -80,6 +80,11 @@ exports.cssText = "\
|
|||
background: #000000;\
|
||||
}\
|
||||
\
|
||||
.ace-clouds-midnight.multiselect .ace_selection.start {\
|
||||
box-shadow: 0 0 3px 0px #191919;\
|
||||
border-radius: 2px;\
|
||||
}\
|
||||
\
|
||||
.ace-clouds-midnight .ace_marker-layer .ace_step {\
|
||||
background: rgb(198, 219, 174);\
|
||||
}\
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
|||
}\
|
||||
\
|
||||
.ace-cobalt .ace_cursor {\
|
||||
border-left: 1px solid #FFFFFF;\
|
||||
border-left: 2px solid #FFFFFF;\
|
||||
}\
|
||||
\
|
||||
.ace-cobalt .ace_cursor.ace_overwrite {\
|
||||
|
|
@ -80,6 +80,11 @@ exports.cssText = "\
|
|||
background: rgba(179, 101, 57, 0.75);\
|
||||
}\
|
||||
\
|
||||
.ace-cobalt.multiselect .ace_selection.start {\
|
||||
box-shadow: 0 0 3px 0px #002240;\
|
||||
border-radius: 2px;\
|
||||
}\
|
||||
\
|
||||
.ace-cobalt .ace_marker-layer .ace_step {\
|
||||
background: rgb(198, 219, 174);\
|
||||
}\
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
|||
}\
|
||||
\
|
||||
.ace-dawn .ace_cursor {\
|
||||
border-left: 1px solid #000000;\
|
||||
border-left: 2px solid #000000;\
|
||||
}\
|
||||
\
|
||||
.ace-dawn .ace_cursor.ace_overwrite {\
|
||||
|
|
@ -80,6 +80,11 @@ exports.cssText = "\
|
|||
background: rgba(39, 95, 255, 0.30);\
|
||||
}\
|
||||
\
|
||||
.ace-dawn.multiselect .ace_selection.start {\
|
||||
box-shadow: 0 0 3px 0px #F9F9F9;\
|
||||
border-radius: 2px;\
|
||||
}\
|
||||
\
|
||||
.ace-dawn .ace_marker-layer .ace_step {\
|
||||
background: rgb(198, 219, 174);\
|
||||
}\
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ exports.cssText = ".ace-eclipse .ace_editor {\
|
|||
}\
|
||||
\
|
||||
.ace-eclipse .ace_cursor {\
|
||||
border-left: 1px solid black;\
|
||||
border-left: 2px solid black;\
|
||||
}\
|
||||
\
|
||||
.ace-eclipse .ace_line .ace_storage,\
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
|||
}\
|
||||
\
|
||||
.ace-idle-fingers .ace_cursor {\
|
||||
border-left: 1px solid #91FF00;\
|
||||
border-left: 2px solid #91FF00;\
|
||||
}\
|
||||
\
|
||||
.ace-idle-fingers .ace_cursor.ace_overwrite {\
|
||||
|
|
@ -80,6 +80,11 @@ exports.cssText = "\
|
|||
background: rgba(90, 100, 126, 0.88);\
|
||||
}\
|
||||
\
|
||||
.ace-idle-fingers.multiselect .ace_selection.start {\
|
||||
box-shadow: 0 0 3px 0px #323232;\
|
||||
border-radius: 2px;\
|
||||
}\
|
||||
\
|
||||
.ace-idle-fingers .ace_marker-layer .ace_step {\
|
||||
background: rgb(198, 219, 174);\
|
||||
}\
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
|||
}\
|
||||
\
|
||||
.ace-kr-theme .ace_cursor {\
|
||||
border-left: 1px solid #FF9900;\
|
||||
border-left: 2px solid #FF9900;\
|
||||
}\
|
||||
\
|
||||
.ace-kr-theme .ace_cursor.ace_overwrite {\
|
||||
|
|
@ -80,6 +80,11 @@ exports.cssText = "\
|
|||
background: rgba(170, 0, 255, 0.45);\
|
||||
}\
|
||||
\
|
||||
.ace-kr-theme.multiselect .ace_selection.start {\
|
||||
box-shadow: 0 0 3px 0px #0B0A09;\
|
||||
border-radius: 2px;\
|
||||
}\
|
||||
\
|
||||
.ace-kr-theme .ace_marker-layer .ace_step {\
|
||||
background: rgb(198, 219, 174);\
|
||||
}\
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
|||
}\
|
||||
\
|
||||
.ace-merbivore .ace_cursor {\
|
||||
border-left: 1px solid #FFFFFF;\
|
||||
border-left: 2px solid #FFFFFF;\
|
||||
}\
|
||||
\
|
||||
.ace-merbivore .ace_cursor.ace_overwrite {\
|
||||
|
|
@ -80,6 +80,11 @@ exports.cssText = "\
|
|||
background: #454545;\
|
||||
}\
|
||||
\
|
||||
.ace-merbivore.multiselect .ace_selection.start {\
|
||||
box-shadow: 0 0 3px 0px #161616;\
|
||||
border-radius: 2px;\
|
||||
}\
|
||||
\
|
||||
.ace-merbivore .ace_marker-layer .ace_step {\
|
||||
background: rgb(198, 219, 174);\
|
||||
}\
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
|||
}\
|
||||
\
|
||||
.ace-merbivore-soft .ace_cursor {\
|
||||
border-left: 1px solid #FFFFFF;\
|
||||
border-left: 2px solid #FFFFFF;\
|
||||
}\
|
||||
\
|
||||
.ace-merbivore-soft .ace_cursor.ace_overwrite {\
|
||||
|
|
@ -80,6 +80,11 @@ exports.cssText = "\
|
|||
background: #494949;\
|
||||
}\
|
||||
\
|
||||
.ace-merbivore-soft.multiselect .ace_selection.start {\
|
||||
box-shadow: 0 0 3px 0px #1C1C1C;\
|
||||
border-radius: 2px;\
|
||||
}\
|
||||
\
|
||||
.ace-merbivore-soft .ace_marker-layer .ace_step {\
|
||||
background: rgb(198, 219, 174);\
|
||||
}\
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
|||
}\
|
||||
\
|
||||
.ace-mono-industrial .ace_cursor {\
|
||||
border-left: 1px solid #FFFFFF;\
|
||||
border-left: 2px solid #FFFFFF;\
|
||||
}\
|
||||
\
|
||||
.ace-mono-industrial .ace_cursor.ace_overwrite {\
|
||||
|
|
@ -80,6 +80,11 @@ exports.cssText = "\
|
|||
background: rgba(145, 153, 148, 0.40);\
|
||||
}\
|
||||
\
|
||||
.ace-mono-industrial.multiselect .ace_selection.start {\
|
||||
box-shadow: 0 0 3px 0px #222C28;\
|
||||
border-radius: 2px;\
|
||||
}\
|
||||
\
|
||||
.ace-mono-industrial .ace_marker-layer .ace_step {\
|
||||
background: rgb(198, 219, 174);\
|
||||
}\
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
|||
}\
|
||||
\
|
||||
.ace-monokai .ace_cursor {\
|
||||
border-left: 1px solid #F8F8F0;\
|
||||
border-left: 2px solid #F8F8F0;\
|
||||
}\
|
||||
\
|
||||
.ace-monokai .ace_cursor.ace_overwrite {\
|
||||
|
|
@ -80,6 +80,11 @@ exports.cssText = "\
|
|||
background: #49483E;\
|
||||
}\
|
||||
\
|
||||
.ace-monokai.multiselect .ace_selection.start {\
|
||||
box-shadow: 0 0 3px 0px #272822;\
|
||||
border-radius: 2px;\
|
||||
}\
|
||||
\
|
||||
.ace-monokai .ace_marker-layer .ace_step {\
|
||||
background: rgb(198, 219, 174);\
|
||||
}\
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
|||
}\
|
||||
\
|
||||
.ace-pastel-on-dark .ace_cursor {\
|
||||
border-left: 1px solid #A7A7A7;\
|
||||
border-left: 2px solid #A7A7A7;\
|
||||
}\
|
||||
\
|
||||
.ace-pastel-on-dark .ace_cursor.ace_overwrite {\
|
||||
|
|
@ -80,6 +80,11 @@ exports.cssText = "\
|
|||
background: rgba(221, 240, 255, 0.20);\
|
||||
}\
|
||||
\
|
||||
.ace-pastel-on-dark.multiselect .ace_selection.start {\
|
||||
box-shadow: 0 0 3px 0px #2C2828;\
|
||||
border-radius: 2px;\
|
||||
}\
|
||||
\
|
||||
.ace-pastel-on-dark .ace_marker-layer .ace_step {\
|
||||
background: rgb(198, 219, 174);\
|
||||
}\
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
|||
}\
|
||||
\
|
||||
.ace-solarized-dark .ace_cursor {\
|
||||
border-left: 1px solid #D30102;\
|
||||
border-left: 2px solid #D30102;\
|
||||
}\
|
||||
\
|
||||
.ace-solarized-dark .ace_cursor.ace_overwrite {\
|
||||
|
|
@ -80,6 +80,11 @@ exports.cssText = "\
|
|||
background: #073642;\
|
||||
}\
|
||||
\
|
||||
.ace-solarized-dark.multiselect .ace_selection.start {\
|
||||
box-shadow: 0 0 3px 0px #002B36;\
|
||||
border-radius: 2px;\
|
||||
}\
|
||||
\
|
||||
.ace-solarized-dark .ace_marker-layer .ace_step {\
|
||||
background: rgb(198, 219, 174);\
|
||||
}\
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
|||
}\
|
||||
\
|
||||
.ace-solarized-light .ace_cursor {\
|
||||
border-left: 1px solid #000000;\
|
||||
border-left: 2px solid #000000;\
|
||||
}\
|
||||
\
|
||||
.ace-solarized-light .ace_cursor.ace_overwrite {\
|
||||
|
|
@ -80,6 +80,11 @@ exports.cssText = "\
|
|||
background: #073642;\
|
||||
}\
|
||||
\
|
||||
.ace-solarized-light.multiselect .ace_selection.start {\
|
||||
box-shadow: 0 0 3px 0px #FDF6E3;\
|
||||
border-radius: 2px;\
|
||||
}\
|
||||
\
|
||||
.ace-solarized-light .ace_marker-layer .ace_step {\
|
||||
background: rgb(198, 219, 174);\
|
||||
}\
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
|||
}\
|
||||
\
|
||||
.ace-tomorrow .ace_cursor {\
|
||||
border-left: 1px solid #AEAFAD;\
|
||||
border-left: 2px solid #AEAFAD;\
|
||||
}\
|
||||
\
|
||||
.ace-tomorrow .ace_cursor.ace_overwrite {\
|
||||
|
|
@ -80,6 +80,11 @@ exports.cssText = "\
|
|||
background: #D6D6D6;\
|
||||
}\
|
||||
\
|
||||
.ace-tomorrow.multiselect .ace_selection.start {\
|
||||
box-shadow: 0 0 3px 0px #FFFFFF;\
|
||||
border-radius: 2px;\
|
||||
}\
|
||||
\
|
||||
.ace-tomorrow .ace_marker-layer .ace_step {\
|
||||
background: rgb(198, 219, 174);\
|
||||
}\
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
|||
}\
|
||||
\
|
||||
.ace-tomorrow-night .ace_cursor {\
|
||||
border-left: 1px solid #AEAFAD;\
|
||||
border-left: 2px solid #AEAFAD;\
|
||||
}\
|
||||
\
|
||||
.ace-tomorrow-night .ace_cursor.ace_overwrite {\
|
||||
|
|
@ -80,6 +80,11 @@ exports.cssText = "\
|
|||
background: #373B41;\
|
||||
}\
|
||||
\
|
||||
.ace-tomorrow-night.multiselect .ace_selection.start {\
|
||||
box-shadow: 0 0 3px 0px #1D1F21;\
|
||||
border-radius: 2px;\
|
||||
}\
|
||||
\
|
||||
.ace-tomorrow-night .ace_marker-layer .ace_step {\
|
||||
background: rgb(198, 219, 174);\
|
||||
}\
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
|||
}\
|
||||
\
|
||||
.ace-tomorrow-night-blue .ace_cursor {\
|
||||
border-left: 1px solid #FFFFFF;\
|
||||
border-left: 2px solid #FFFFFF;\
|
||||
}\
|
||||
\
|
||||
.ace-tomorrow-night-blue .ace_cursor.ace_overwrite {\
|
||||
|
|
@ -80,6 +80,11 @@ exports.cssText = "\
|
|||
background: #003F8E;\
|
||||
}\
|
||||
\
|
||||
.ace-tomorrow-night-blue.multiselect .ace_selection.start {\
|
||||
box-shadow: 0 0 3px 0px #002451;\
|
||||
border-radius: 2px;\
|
||||
}\
|
||||
\
|
||||
.ace-tomorrow-night-blue .ace_marker-layer .ace_step {\
|
||||
background: rgb(198, 219, 174);\
|
||||
}\
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
|||
}\
|
||||
\
|
||||
.ace-tomorrow-night-bright .ace_cursor {\
|
||||
border-left: 1px solid #9F9F9F;\
|
||||
border-left: 2px solid #9F9F9F;\
|
||||
}\
|
||||
\
|
||||
.ace-tomorrow-night-bright .ace_cursor.ace_overwrite {\
|
||||
|
|
@ -80,6 +80,11 @@ exports.cssText = "\
|
|||
background: #424242;\
|
||||
}\
|
||||
\
|
||||
.ace-tomorrow-night-bright.multiselect .ace_selection.start {\
|
||||
box-shadow: 0 0 3px 0px #000000;\
|
||||
border-radius: 2px;\
|
||||
}\
|
||||
\
|
||||
.ace-tomorrow-night-bright .ace_marker-layer .ace_step {\
|
||||
background: rgb(198, 219, 174);\
|
||||
}\
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
|||
}\
|
||||
\
|
||||
.ace-tomorrow-night-eighties .ace_cursor {\
|
||||
border-left: 1px solid #CCCCCC;\
|
||||
border-left: 2px solid #CCCCCC;\
|
||||
}\
|
||||
\
|
||||
.ace-tomorrow-night-eighties .ace_cursor.ace_overwrite {\
|
||||
|
|
@ -80,6 +80,11 @@ exports.cssText = "\
|
|||
background: #515151;\
|
||||
}\
|
||||
\
|
||||
.ace-tomorrow-night-eighties.multiselect .ace_selection.start {\
|
||||
box-shadow: 0 0 3px 0px #2D2D2D;\
|
||||
border-radius: 2px;\
|
||||
}\
|
||||
\
|
||||
.ace-tomorrow-night-eighties .ace_marker-layer .ace_step {\
|
||||
background: rgb(198, 219, 174);\
|
||||
}\
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
|||
}\
|
||||
\
|
||||
.ace-twilight .ace_cursor {\
|
||||
border-left: 1px solid #A7A7A7;\
|
||||
border-left: 2px solid #A7A7A7;\
|
||||
}\
|
||||
\
|
||||
.ace-twilight .ace_cursor.ace_overwrite {\
|
||||
|
|
@ -80,6 +80,11 @@ exports.cssText = "\
|
|||
background: rgba(221, 240, 255, 0.20);\
|
||||
}\
|
||||
\
|
||||
.ace-twilight.multiselect .ace_selection.start {\
|
||||
box-shadow: 0 0 3px 0px #141414;\
|
||||
border-radius: 2px;\
|
||||
}\
|
||||
\
|
||||
.ace-twilight .ace_marker-layer .ace_step {\
|
||||
background: rgb(198, 219, 174);\
|
||||
}\
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
|||
}\
|
||||
\
|
||||
.ace-vibrant-ink .ace_cursor {\
|
||||
border-left: 1px solid #FFFFFF;\
|
||||
border-left: 2px solid #FFFFFF;\
|
||||
}\
|
||||
\
|
||||
.ace-vibrant-ink .ace_cursor.ace_overwrite {\
|
||||
|
|
@ -80,6 +80,11 @@ exports.cssText = "\
|
|||
background: #6699CC;\
|
||||
}\
|
||||
\
|
||||
.ace-vibrant-ink.multiselect .ace_selection.start {\
|
||||
box-shadow: 0 0 3px 0px #0F0F0F;\
|
||||
border-radius: 2px;\
|
||||
}\
|
||||
\
|
||||
.ace-vibrant-ink .ace_marker-layer .ace_step {\
|
||||
background: rgb(198, 219, 174);\
|
||||
}\
|
||||
|
|
|
|||
|
|
@ -2162,7 +2162,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
|
||||
}
|
||||
|
||||
this.intersectsRange = function(range) {
|
||||
this.intersects = function(range) {
|
||||
var cmp = this.compareRange(range);
|
||||
return (cmp == -1 || cmp == 0 || cmp == 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2136,7 +2136,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
|
||||
}
|
||||
|
||||
this.intersectsRange = function(range) {
|
||||
this.intersects = function(range) {
|
||||
var cmp = this.compareRange(range);
|
||||
return (cmp == -1 || cmp == 0 || cmp == 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2158,7 +2158,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
|
||||
}
|
||||
|
||||
this.intersectsRange = function(range) {
|
||||
this.intersects = function(range) {
|
||||
var cmp = this.compareRange(range);
|
||||
return (cmp == -1 || cmp == 0 || cmp == 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2173,7 +2173,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
|
||||
}
|
||||
|
||||
this.intersectsRange = function(range) {
|
||||
this.intersects = function(range) {
|
||||
var cmp = this.compareRange(range);
|
||||
return (cmp == -1 || cmp == 0 || cmp == 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
Ace
|
||||
version 0.2.0
|
||||
commit 9fc464e78110d6aa80d9f39bd868ca23bc136e57
|
||||
commit 8584581a329ae949529d42717daf5a65ab401d3a
|
||||
|
||||
|
||||
-->
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -3549,11 +3549,12 @@ var Editor = function(renderer, session) {
|
|||
if (!ranges.length)
|
||||
return replaced;
|
||||
|
||||
this.$blockScrolling += 1;
|
||||
|
||||
var selection = this.getSelectionRange();
|
||||
this.clearSelection();
|
||||
this.selection.moveCursorTo(0, 0);
|
||||
|
||||
this.$blockScrolling += 1;
|
||||
for (var i = ranges.length - 1; i >= 0; --i) {
|
||||
if(this.$tryReplace(ranges[i], replacement)) {
|
||||
replaced++;
|
||||
|
|
@ -8155,7 +8156,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
|
||||
}
|
||||
|
||||
this.intersectsRange = function(range) {
|
||||
this.intersects = function(range) {
|
||||
var cmp = this.compareRange(range);
|
||||
return (cmp == -1 || cmp == 0 || cmp == 1);
|
||||
}
|
||||
|
|
@ -8716,9 +8717,8 @@ var Tokenizer = function(rules, flag) {
|
|||
else
|
||||
type = rule.token;
|
||||
|
||||
var next = rule.next;
|
||||
if (next && next !== currentState) {
|
||||
currentState = next;
|
||||
if (rule.next) {
|
||||
currentState = rule.next;
|
||||
state = this.rules[currentState];
|
||||
mapping = this.matchMappings[currentState];
|
||||
lastIndex = re.lastIndex;
|
||||
|
|
@ -8838,8 +8838,6 @@ var TextHighlightRules = function() {
|
|||
var rule = state[i];
|
||||
if (rule.next) {
|
||||
rule.next = prefix + rule.next;
|
||||
} else {
|
||||
rule.next = prefix + key;
|
||||
}
|
||||
}
|
||||
this.$rules[prefix + key] = state;
|
||||
|
|
@ -13257,7 +13255,7 @@ var Marker = function(parentEl) {
|
|||
}
|
||||
else {
|
||||
this.drawSingleLineMarker(
|
||||
html, range, marker.clazz, config,
|
||||
html, range, marker.clazz + " start", config,
|
||||
null, marker.type
|
||||
);
|
||||
}
|
||||
|
|
@ -13280,7 +13278,7 @@ var Marker = function(parentEl) {
|
|||
row, range.start.column,
|
||||
row, this.session.getScreenLastRowColumn(row)
|
||||
);
|
||||
this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 1, "text");
|
||||
this.drawSingleLineMarker(stringBuilder, lineRange, clazz + " start", layerConfig, 1, "text");
|
||||
|
||||
// selection end
|
||||
row = range.end.row;
|
||||
|
|
@ -13310,7 +13308,7 @@ var Marker = function(parentEl) {
|
|||
);
|
||||
|
||||
stringBuilder.push(
|
||||
"<div class='", clazz, "' style='",
|
||||
"<div class='", clazz, " start' style='",
|
||||
"height:", height, "px;",
|
||||
"width:", width, "px;",
|
||||
"top:", top, "px;",
|
||||
|
|
@ -14096,11 +14094,11 @@ var Cursor = function(parentEl) {
|
|||
if (!this.isVisible)
|
||||
return;
|
||||
|
||||
var element = this.element;
|
||||
var element = this.cursors.length == 1 ? this.cursor : this.element;
|
||||
this.blinkId = setInterval(function() {
|
||||
element.style.visibility = "hidden";
|
||||
setTimeout(function() {
|
||||
element.style.visibility = "visible";
|
||||
element.style.visibility = "";
|
||||
}, 400);
|
||||
}, 1000);
|
||||
};
|
||||
|
|
@ -14130,7 +14128,7 @@ var Cursor = function(parentEl) {
|
|||
this.update = function(config) {
|
||||
this.config = config;
|
||||
|
||||
if (this.session.selectionMarkerCount > 1) {
|
||||
if (this.session.selectionMarkerCount > 0) {
|
||||
var selections = this.session.$selectionMarkers;
|
||||
var i = 0, sel, cursorIndex = 0;
|
||||
|
||||
|
|
@ -14508,6 +14506,10 @@ ace.define("text!ace/css/editor.css", [], "@import url(//fonts.googleapis.com/cs
|
|||
" opacity: 0.2;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".ace_editor.multiselect .ace_cursor {\n" +
|
||||
" border-left-width: 1px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".ace_line {\n" +
|
||||
" white-space: nowrap;\n" +
|
||||
"}\n" +
|
||||
|
|
@ -14722,18 +14724,19 @@ var EditSession = require("./edit_session").EditSession;
|
|||
*
|
||||
* adds a range to selection entering multiselect mode if necessary
|
||||
**/
|
||||
this.addRange = function(range) {
|
||||
if (!this.inMultiSelectMode && this.rangeCount == 0) {
|
||||
var oldRange = this.toOrientedRange();
|
||||
if (!range || !range.isEqual(oldRange)) {
|
||||
this.rangeList.add(oldRange);
|
||||
this.$onAddRange(oldRange);
|
||||
}
|
||||
}
|
||||
|
||||
this.addRange = function(range, $blockChangeEvents) {
|
||||
if (!range)
|
||||
return;
|
||||
|
||||
if (!this.inMultiSelectMode && this.rangeCount == 0) {
|
||||
var oldRange = this.toOrientedRange();
|
||||
if (range.intersects(oldRange))
|
||||
return $blockChangeEvents || this.fromOrientedRange(range);
|
||||
|
||||
this.rangeList.add(oldRange);
|
||||
this.$onAddRange(oldRange);
|
||||
}
|
||||
|
||||
if (!range.cursor)
|
||||
range.cursor = range.end;
|
||||
|
||||
|
|
@ -14744,12 +14747,14 @@ var EditSession = require("./edit_session").EditSession;
|
|||
if (removed.length)
|
||||
this.$onRemoveRange(removed);
|
||||
|
||||
if (this.rangeCount > 0 && !this.inMultiSelectMode) {
|
||||
if (this.rangeCount > 1 && !this.inMultiSelectMode) {
|
||||
this._emit("multiSelect");
|
||||
this.inMultiSelectMode = true;
|
||||
this.session.$undoSelect = false;
|
||||
this.rangeList.attach(this.session);
|
||||
}
|
||||
|
||||
return $blockChangeEvents || this.fromOrientedRange(range);
|
||||
};
|
||||
|
||||
this.toSingleRange = function(range) {
|
||||
|
|
@ -14791,7 +14796,6 @@ var EditSession = require("./edit_session").EditSession;
|
|||
this.$onAddRange = function(range) {
|
||||
this.rangeCount = this.rangeList.ranges.length;
|
||||
this.ranges.unshift(range);
|
||||
this.fromOrientedRange(range);
|
||||
this._emit("addRange", {range: range});
|
||||
};
|
||||
|
||||
|
|
@ -14955,17 +14959,34 @@ var Editor = require("./editor").Editor;
|
|||
return orientedRange;
|
||||
};
|
||||
|
||||
/**
|
||||
* Editor.removeSelectionMarker(range) -> Void
|
||||
* - range: selection range added with addSelectionMarker
|
||||
*
|
||||
* removes selection marker
|
||||
**/
|
||||
this.removeSelectionMarker = function(range) {
|
||||
if (!range.marker)
|
||||
return;
|
||||
this.session.removeMarker(range.marker);
|
||||
var index = this.session.$selectionMarkers.indexOf(range);
|
||||
if (index != -1)
|
||||
this.session.$selectionMarkers.splice(index, 1);
|
||||
this.session.selectionMarkerCount = this.session.$selectionMarkers.length;
|
||||
};
|
||||
|
||||
this.removeSelectionMarkers = function(ranges) {
|
||||
var markerList = this.session.$selectionMarkers;
|
||||
for (var i = ranges.length; i--; ) {
|
||||
var range = ranges[i];
|
||||
if (!range.marker)
|
||||
continue;
|
||||
this.session.removeMarker(range.marker);
|
||||
var index = this.session.$selectionMarkers.indexOf(range);
|
||||
var index = markerList.indexOf(range);
|
||||
if (index != -1)
|
||||
this.session.$selectionMarkers.splice(index, 1);
|
||||
markerList.splice(index, 1);
|
||||
}
|
||||
this.session.selectionMarkerCount = this.session.$selectionMarkers.length;
|
||||
this.session.selectionMarkerCount = markerList.length;
|
||||
};
|
||||
|
||||
this.$onAddRange = function(e) {
|
||||
|
|
@ -15088,6 +15109,37 @@ var Editor = require("./editor").Editor;
|
|||
return text;
|
||||
};
|
||||
|
||||
/**
|
||||
* Editor.findAll(dir, options) -> Number
|
||||
* - needle: text to find
|
||||
* - options: search options
|
||||
* - additive: keeps
|
||||
*
|
||||
* finds and selects all the occurencies of needle
|
||||
* returns number of found ranges
|
||||
**/
|
||||
this.findAll = function(needle, options, additive) {
|
||||
options = options || {};
|
||||
options.needle = needle || options.needle;
|
||||
this.$search.set(options);
|
||||
|
||||
var ranges = this.$search.findAll(this.session);
|
||||
if (!ranges.length)
|
||||
return 0;
|
||||
|
||||
this.$blockScrolling += 1;
|
||||
var selection = this.multiSelect;
|
||||
|
||||
if (!additive)
|
||||
selection.toSingleRange(ranges[0]);
|
||||
|
||||
for (var i = ranges.length; i--; )
|
||||
selection.addRange(ranges[i], true);
|
||||
|
||||
this.$blockScrolling -= 1;
|
||||
|
||||
return ranges.length;
|
||||
};
|
||||
|
||||
// commands
|
||||
/**
|
||||
|
|
@ -15269,6 +15321,33 @@ function MultiSelect(editor) {
|
|||
|
||||
editor.on("mousedown", onMouseDown);
|
||||
editor.commands.addCommands(exports.commands.defaultCommands);
|
||||
|
||||
addAltCursorListeners(editor);
|
||||
}
|
||||
|
||||
function addAltCursorListeners(editor){
|
||||
var el = editor.textInput.getElement();
|
||||
var altCursor = false;
|
||||
var contentEl = editor.renderer.content;
|
||||
el.addEventListener("keydown", function(e) {
|
||||
if (e.keyCode == 18 && !(e.ctrlKey || e.shiftKey || e.metaKey)) {
|
||||
if (!altCursor) {
|
||||
contentEl.style.cursor = "crosshair";
|
||||
altCursor = true;
|
||||
}
|
||||
} else if (altCursor) {
|
||||
contentEl.style.cursor = "";
|
||||
}
|
||||
});
|
||||
|
||||
el.addEventListener("keyup", reset);
|
||||
el.addEventListener("blur", reset);
|
||||
function reset() {
|
||||
if (altCursor) {
|
||||
contentEl.style.cursor = "";
|
||||
altCursor = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.MultiSelect = MultiSelect;
|
||||
|
|
@ -15617,9 +15696,10 @@ function onMouseDown(e) {
|
|||
if (!isMultiSelect && inSelection)
|
||||
return; // dragging
|
||||
|
||||
if (!isMultiSelect)
|
||||
selection.addRange(selection.toOrientedRange());
|
||||
|
||||
if (!isMultiSelect) {
|
||||
var range = selection.toOrientedRange();
|
||||
editor.addSelectionMarker(range);
|
||||
}
|
||||
|
||||
var oldRange = selection.rangeList.rangeAtPoint(pos);
|
||||
|
||||
|
|
@ -15628,8 +15708,13 @@ function onMouseDown(e) {
|
|||
|
||||
if (oldRange && tmpSel.isEmpty() && isSamePoint(oldRange.cursor, tmpSel.cursor))
|
||||
selection.substractPoint(tmpSel.cursor);
|
||||
else
|
||||
else {
|
||||
if (range) {
|
||||
editor.removeSelectionMarker(range);
|
||||
selection.addRange(range);
|
||||
}
|
||||
selection.addRange(tmpSel);
|
||||
}
|
||||
});
|
||||
|
||||
} else if (!shift && alt && button == 0) {
|
||||
|
|
@ -16468,7 +16553,7 @@ exports.cssText = ".ace-tm .ace_editor {\
|
|||
}\
|
||||
\
|
||||
.ace-tm .ace_cursor {\
|
||||
border-left: 1px solid black;\
|
||||
border-left: 2px solid black;\
|
||||
}\
|
||||
\
|
||||
.ace-tm .ace_cursor.ace_overwrite {\
|
||||
|
|
@ -16570,7 +16655,10 @@ exports.cssText = ".ace-tm .ace_editor {\
|
|||
.ace-tm .ace_marker-layer .ace_selection {\
|
||||
background: rgb(181, 213, 255);\
|
||||
}\
|
||||
\
|
||||
.ace-tm.multiselect .ace_selection.start {\
|
||||
box-shadow: 0 0 3px 0px white;\
|
||||
border-radius: 2px;\
|
||||
}\
|
||||
.ace-tm .ace_marker-layer .ace_step {\
|
||||
background: rgb(252, 255, 0);\
|
||||
}\
|
||||
|
|
|
|||
|
|
@ -3549,11 +3549,12 @@ var Editor = function(renderer, session) {
|
|||
if (!ranges.length)
|
||||
return replaced;
|
||||
|
||||
this.$blockScrolling += 1;
|
||||
|
||||
var selection = this.getSelectionRange();
|
||||
this.clearSelection();
|
||||
this.selection.moveCursorTo(0, 0);
|
||||
|
||||
this.$blockScrolling += 1;
|
||||
for (var i = ranges.length - 1; i >= 0; --i) {
|
||||
if(this.$tryReplace(ranges[i], replacement)) {
|
||||
replaced++;
|
||||
|
|
@ -8155,7 +8156,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
|
||||
}
|
||||
|
||||
this.intersectsRange = function(range) {
|
||||
this.intersects = function(range) {
|
||||
var cmp = this.compareRange(range);
|
||||
return (cmp == -1 || cmp == 0 || cmp == 1);
|
||||
}
|
||||
|
|
@ -8716,9 +8717,8 @@ var Tokenizer = function(rules, flag) {
|
|||
else
|
||||
type = rule.token;
|
||||
|
||||
var next = rule.next;
|
||||
if (next && next !== currentState) {
|
||||
currentState = next;
|
||||
if (rule.next) {
|
||||
currentState = rule.next;
|
||||
state = this.rules[currentState];
|
||||
mapping = this.matchMappings[currentState];
|
||||
lastIndex = re.lastIndex;
|
||||
|
|
@ -8838,8 +8838,6 @@ var TextHighlightRules = function() {
|
|||
var rule = state[i];
|
||||
if (rule.next) {
|
||||
rule.next = prefix + rule.next;
|
||||
} else {
|
||||
rule.next = prefix + key;
|
||||
}
|
||||
}
|
||||
this.$rules[prefix + key] = state;
|
||||
|
|
@ -13257,7 +13255,7 @@ var Marker = function(parentEl) {
|
|||
}
|
||||
else {
|
||||
this.drawSingleLineMarker(
|
||||
html, range, marker.clazz, config,
|
||||
html, range, marker.clazz + " start", config,
|
||||
null, marker.type
|
||||
);
|
||||
}
|
||||
|
|
@ -13280,7 +13278,7 @@ var Marker = function(parentEl) {
|
|||
row, range.start.column,
|
||||
row, this.session.getScreenLastRowColumn(row)
|
||||
);
|
||||
this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 1, "text");
|
||||
this.drawSingleLineMarker(stringBuilder, lineRange, clazz + " start", layerConfig, 1, "text");
|
||||
|
||||
// selection end
|
||||
row = range.end.row;
|
||||
|
|
@ -13310,7 +13308,7 @@ var Marker = function(parentEl) {
|
|||
);
|
||||
|
||||
stringBuilder.push(
|
||||
"<div class='", clazz, "' style='",
|
||||
"<div class='", clazz, " start' style='",
|
||||
"height:", height, "px;",
|
||||
"width:", width, "px;",
|
||||
"top:", top, "px;",
|
||||
|
|
@ -14096,11 +14094,11 @@ var Cursor = function(parentEl) {
|
|||
if (!this.isVisible)
|
||||
return;
|
||||
|
||||
var element = this.element;
|
||||
var element = this.cursors.length == 1 ? this.cursor : this.element;
|
||||
this.blinkId = setInterval(function() {
|
||||
element.style.visibility = "hidden";
|
||||
setTimeout(function() {
|
||||
element.style.visibility = "visible";
|
||||
element.style.visibility = "";
|
||||
}, 400);
|
||||
}, 1000);
|
||||
};
|
||||
|
|
@ -14130,7 +14128,7 @@ var Cursor = function(parentEl) {
|
|||
this.update = function(config) {
|
||||
this.config = config;
|
||||
|
||||
if (this.session.selectionMarkerCount > 1) {
|
||||
if (this.session.selectionMarkerCount > 0) {
|
||||
var selections = this.session.$selectionMarkers;
|
||||
var i = 0, sel, cursorIndex = 0;
|
||||
|
||||
|
|
@ -14508,6 +14506,10 @@ define("text!ace/css/editor.css", [], "@import url(//fonts.googleapis.com/css?fa
|
|||
" opacity: 0.2;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".ace_editor.multiselect .ace_cursor {\n" +
|
||||
" border-left-width: 1px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".ace_line {\n" +
|
||||
" white-space: nowrap;\n" +
|
||||
"}\n" +
|
||||
|
|
@ -14722,18 +14724,19 @@ var EditSession = require("./edit_session").EditSession;
|
|||
*
|
||||
* adds a range to selection entering multiselect mode if necessary
|
||||
**/
|
||||
this.addRange = function(range) {
|
||||
if (!this.inMultiSelectMode && this.rangeCount == 0) {
|
||||
var oldRange = this.toOrientedRange();
|
||||
if (!range || !range.isEqual(oldRange)) {
|
||||
this.rangeList.add(oldRange);
|
||||
this.$onAddRange(oldRange);
|
||||
}
|
||||
}
|
||||
|
||||
this.addRange = function(range, $blockChangeEvents) {
|
||||
if (!range)
|
||||
return;
|
||||
|
||||
if (!this.inMultiSelectMode && this.rangeCount == 0) {
|
||||
var oldRange = this.toOrientedRange();
|
||||
if (range.intersects(oldRange))
|
||||
return $blockChangeEvents || this.fromOrientedRange(range);
|
||||
|
||||
this.rangeList.add(oldRange);
|
||||
this.$onAddRange(oldRange);
|
||||
}
|
||||
|
||||
if (!range.cursor)
|
||||
range.cursor = range.end;
|
||||
|
||||
|
|
@ -14744,12 +14747,14 @@ var EditSession = require("./edit_session").EditSession;
|
|||
if (removed.length)
|
||||
this.$onRemoveRange(removed);
|
||||
|
||||
if (this.rangeCount > 0 && !this.inMultiSelectMode) {
|
||||
if (this.rangeCount > 1 && !this.inMultiSelectMode) {
|
||||
this._emit("multiSelect");
|
||||
this.inMultiSelectMode = true;
|
||||
this.session.$undoSelect = false;
|
||||
this.rangeList.attach(this.session);
|
||||
}
|
||||
|
||||
return $blockChangeEvents || this.fromOrientedRange(range);
|
||||
};
|
||||
|
||||
this.toSingleRange = function(range) {
|
||||
|
|
@ -14791,7 +14796,6 @@ var EditSession = require("./edit_session").EditSession;
|
|||
this.$onAddRange = function(range) {
|
||||
this.rangeCount = this.rangeList.ranges.length;
|
||||
this.ranges.unshift(range);
|
||||
this.fromOrientedRange(range);
|
||||
this._emit("addRange", {range: range});
|
||||
};
|
||||
|
||||
|
|
@ -14955,17 +14959,34 @@ var Editor = require("./editor").Editor;
|
|||
return orientedRange;
|
||||
};
|
||||
|
||||
/**
|
||||
* Editor.removeSelectionMarker(range) -> Void
|
||||
* - range: selection range added with addSelectionMarker
|
||||
*
|
||||
* removes selection marker
|
||||
**/
|
||||
this.removeSelectionMarker = function(range) {
|
||||
if (!range.marker)
|
||||
return;
|
||||
this.session.removeMarker(range.marker);
|
||||
var index = this.session.$selectionMarkers.indexOf(range);
|
||||
if (index != -1)
|
||||
this.session.$selectionMarkers.splice(index, 1);
|
||||
this.session.selectionMarkerCount = this.session.$selectionMarkers.length;
|
||||
};
|
||||
|
||||
this.removeSelectionMarkers = function(ranges) {
|
||||
var markerList = this.session.$selectionMarkers;
|
||||
for (var i = ranges.length; i--; ) {
|
||||
var range = ranges[i];
|
||||
if (!range.marker)
|
||||
continue;
|
||||
this.session.removeMarker(range.marker);
|
||||
var index = this.session.$selectionMarkers.indexOf(range);
|
||||
var index = markerList.indexOf(range);
|
||||
if (index != -1)
|
||||
this.session.$selectionMarkers.splice(index, 1);
|
||||
markerList.splice(index, 1);
|
||||
}
|
||||
this.session.selectionMarkerCount = this.session.$selectionMarkers.length;
|
||||
this.session.selectionMarkerCount = markerList.length;
|
||||
};
|
||||
|
||||
this.$onAddRange = function(e) {
|
||||
|
|
@ -15088,6 +15109,37 @@ var Editor = require("./editor").Editor;
|
|||
return text;
|
||||
};
|
||||
|
||||
/**
|
||||
* Editor.findAll(dir, options) -> Number
|
||||
* - needle: text to find
|
||||
* - options: search options
|
||||
* - additive: keeps
|
||||
*
|
||||
* finds and selects all the occurencies of needle
|
||||
* returns number of found ranges
|
||||
**/
|
||||
this.findAll = function(needle, options, additive) {
|
||||
options = options || {};
|
||||
options.needle = needle || options.needle;
|
||||
this.$search.set(options);
|
||||
|
||||
var ranges = this.$search.findAll(this.session);
|
||||
if (!ranges.length)
|
||||
return 0;
|
||||
|
||||
this.$blockScrolling += 1;
|
||||
var selection = this.multiSelect;
|
||||
|
||||
if (!additive)
|
||||
selection.toSingleRange(ranges[0]);
|
||||
|
||||
for (var i = ranges.length; i--; )
|
||||
selection.addRange(ranges[i], true);
|
||||
|
||||
this.$blockScrolling -= 1;
|
||||
|
||||
return ranges.length;
|
||||
};
|
||||
|
||||
// commands
|
||||
/**
|
||||
|
|
@ -15269,6 +15321,33 @@ function MultiSelect(editor) {
|
|||
|
||||
editor.on("mousedown", onMouseDown);
|
||||
editor.commands.addCommands(exports.commands.defaultCommands);
|
||||
|
||||
addAltCursorListeners(editor);
|
||||
}
|
||||
|
||||
function addAltCursorListeners(editor){
|
||||
var el = editor.textInput.getElement();
|
||||
var altCursor = false;
|
||||
var contentEl = editor.renderer.content;
|
||||
el.addEventListener("keydown", function(e) {
|
||||
if (e.keyCode == 18 && !(e.ctrlKey || e.shiftKey || e.metaKey)) {
|
||||
if (!altCursor) {
|
||||
contentEl.style.cursor = "crosshair";
|
||||
altCursor = true;
|
||||
}
|
||||
} else if (altCursor) {
|
||||
contentEl.style.cursor = "";
|
||||
}
|
||||
});
|
||||
|
||||
el.addEventListener("keyup", reset);
|
||||
el.addEventListener("blur", reset);
|
||||
function reset() {
|
||||
if (altCursor) {
|
||||
contentEl.style.cursor = "";
|
||||
altCursor = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.MultiSelect = MultiSelect;
|
||||
|
|
@ -15617,9 +15696,10 @@ function onMouseDown(e) {
|
|||
if (!isMultiSelect && inSelection)
|
||||
return; // dragging
|
||||
|
||||
if (!isMultiSelect)
|
||||
selection.addRange(selection.toOrientedRange());
|
||||
|
||||
if (!isMultiSelect) {
|
||||
var range = selection.toOrientedRange();
|
||||
editor.addSelectionMarker(range);
|
||||
}
|
||||
|
||||
var oldRange = selection.rangeList.rangeAtPoint(pos);
|
||||
|
||||
|
|
@ -15628,8 +15708,13 @@ function onMouseDown(e) {
|
|||
|
||||
if (oldRange && tmpSel.isEmpty() && isSamePoint(oldRange.cursor, tmpSel.cursor))
|
||||
selection.substractPoint(tmpSel.cursor);
|
||||
else
|
||||
else {
|
||||
if (range) {
|
||||
editor.removeSelectionMarker(range);
|
||||
selection.addRange(range);
|
||||
}
|
||||
selection.addRange(tmpSel);
|
||||
}
|
||||
});
|
||||
|
||||
} else if (!shift && alt && button == 0) {
|
||||
|
|
@ -16468,7 +16553,7 @@ exports.cssText = ".ace-tm .ace_editor {\
|
|||
}\
|
||||
\
|
||||
.ace-tm .ace_cursor {\
|
||||
border-left: 1px solid black;\
|
||||
border-left: 2px solid black;\
|
||||
}\
|
||||
\
|
||||
.ace-tm .ace_cursor.ace_overwrite {\
|
||||
|
|
@ -16570,7 +16655,10 @@ exports.cssText = ".ace-tm .ace_editor {\
|
|||
.ace-tm .ace_marker-layer .ace_selection {\
|
||||
background: rgb(181, 213, 255);\
|
||||
}\
|
||||
\
|
||||
.ace-tm.multiselect .ace_selection.start {\
|
||||
box-shadow: 0 0 3px 0px white;\
|
||||
border-radius: 2px;\
|
||||
}\
|
||||
.ace-tm .ace_marker-layer .ace_step {\
|
||||
background: rgb(252, 255, 0);\
|
||||
}\
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -204,7 +204,7 @@ var c_cppHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : "\\/\\/.*$"
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -303,7 +303,7 @@ var c_cppHighlightRules = function() {
|
|||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(c_cppHighlightRules, TextHighlightRules);
|
||||
|
|
@ -381,27 +381,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ var c_cppHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : "\\/\\/.*$"
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -303,7 +303,7 @@ var c_cppHighlightRules = function() {
|
|||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(c_cppHighlightRules, TextHighlightRules);
|
||||
|
|
@ -381,27 +381,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1360,7 +1360,7 @@ var JavaScriptHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : /\/\/.*$/
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -1368,11 +1368,11 @@ var JavaScriptHighlightRules = function() {
|
|||
next : "comment"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
regex : "'(?=.)",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
regex : '"(?=.)',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
|
|
@ -1392,11 +1392,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -1408,7 +1407,8 @@ var JavaScriptHighlightRules = function() {
|
|||
"keyword.operator",
|
||||
"text"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.play = function() { }
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -1419,11 +1419,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: play = function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -1432,22 +1431,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match regular function like: function myFunc(arg) { }
|
||||
token : [
|
||||
"storage.type",
|
||||
"text",
|
||||
"entity.name.function",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: foobar: function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -1456,22 +1453,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||
token : [
|
||||
"text",
|
||||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "constant.language.boolean",
|
||||
regex : /(?:true|false)\b/
|
||||
|
|
@ -1541,6 +1536,7 @@ var JavaScriptHighlightRules = function() {
|
|||
// regular expressions are only allowed after certain tokens. This
|
||||
// makes sure we don't mix up regexps with the divison operator
|
||||
"regex_allowed": [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -1568,10 +1564,9 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
// flag
|
||||
// flag
|
||||
token: "string.regexp",
|
||||
regex: "/\\w*",
|
||||
next: "start",
|
||||
|
|
@ -1579,7 +1574,6 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp",
|
||||
regex: "[^\\\\/\\[]+",
|
||||
next: "regex",
|
||||
merge: true
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
|
|
@ -1595,8 +1589,7 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex_character_class"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "]",
|
||||
|
|
@ -1605,7 +1598,24 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "[^\\\\\\]]+",
|
||||
next: "regex_character_class",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "start"
|
||||
}
|
||||
],
|
||||
"function_arguments": [
|
||||
{
|
||||
token: "variable.parameter",
|
||||
regex: identifierRe,
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "[, ]+",
|
||||
merge: true
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "$",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
|
|
@ -1643,11 +1653,18 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]+'
|
||||
regex : '[^"\\\\]+',
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qqstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
|
|
@ -1656,17 +1673,24 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "[^'\\\\]+"
|
||||
regex : "[^'\\\\]+",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||
|
|
@ -1744,27 +1768,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
|
|
@ -1360,7 +1360,7 @@ var JavaScriptHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : /\/\/.*$/
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -1368,11 +1368,11 @@ var JavaScriptHighlightRules = function() {
|
|||
next : "comment"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
regex : "'(?=.)",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
regex : '"(?=.)',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
|
|
@ -1392,11 +1392,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -1408,7 +1407,8 @@ var JavaScriptHighlightRules = function() {
|
|||
"keyword.operator",
|
||||
"text"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.play = function() { }
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -1419,11 +1419,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: play = function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -1432,22 +1431,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match regular function like: function myFunc(arg) { }
|
||||
token : [
|
||||
"storage.type",
|
||||
"text",
|
||||
"entity.name.function",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: foobar: function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -1456,22 +1453,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||
token : [
|
||||
"text",
|
||||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "constant.language.boolean",
|
||||
regex : /(?:true|false)\b/
|
||||
|
|
@ -1541,6 +1536,7 @@ var JavaScriptHighlightRules = function() {
|
|||
// regular expressions are only allowed after certain tokens. This
|
||||
// makes sure we don't mix up regexps with the divison operator
|
||||
"regex_allowed": [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -1568,10 +1564,9 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
// flag
|
||||
// flag
|
||||
token: "string.regexp",
|
||||
regex: "/\\w*",
|
||||
next: "start",
|
||||
|
|
@ -1579,7 +1574,6 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp",
|
||||
regex: "[^\\\\/\\[]+",
|
||||
next: "regex",
|
||||
merge: true
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
|
|
@ -1595,8 +1589,7 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex_character_class"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "]",
|
||||
|
|
@ -1605,7 +1598,24 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "[^\\\\\\]]+",
|
||||
next: "regex_character_class",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "start"
|
||||
}
|
||||
],
|
||||
"function_arguments": [
|
||||
{
|
||||
token: "variable.parameter",
|
||||
regex: identifierRe,
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "[, ]+",
|
||||
merge: true
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "$",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
|
|
@ -1643,11 +1653,18 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]+'
|
||||
regex : '[^"\\\\]+',
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qqstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
|
|
@ -1656,17 +1673,24 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "[^'\\\\]+"
|
||||
regex : "[^'\\\\]+",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||
|
|
@ -1744,27 +1768,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -231,27 +231,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
|
|
@ -231,27 +231,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
1
build/src/mode-golang-noconflict.js
Normal file
1
build/src/mode-golang-noconflict.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
ace.define("ace/mode/golang",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/golang_highlight_rules","ace/mode/matching_brace_outdent"],function(a,b,c){var d=a("../lib/oop"),e=a("./text").Mode,f=a("../tokenizer").Tokenizer,g=a("./golang_highlight_rules").GolangHighlightRules,h=a("./matching_brace_outdent").MatchingBraceOutdent,i=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(i,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)\/\//;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var i=new Range(0,0,0,0);for(var h=c;h<=d;h++){var j=b.getLine(h),k=j.match(g);i.start.row=h,i.end.row=h,i.end.column=k[0].length,b.replace(i,k[1])}}else b.indentRows(c,d,"//")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[]\s*$/);h&&(d+=c)}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(i.prototype),b.Mode=i}),ace.define("ace/mode/golang_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("../lib/oop"),e=a("../lib/lang"),f=a("./doc_comment_highlight_rules").DocCommentHighlightRules,g=a("./text_highlight_rules").TextHighlightRules,h=function(){var a=e.arrayToMap("true|else|false|break|case|return|goto|if|const|continue|struct|default|switch|for|func|import|package|chan|defer|fallthrough|go|interface|map|rangeselect|type|var".split("|")),b=e.arrayToMap("nit|true|false|iota".split("|"));this.$rules={start:[{token:"comment",regex:"\\/\\/.*$"},f.getStartRule("doc-start"),{token:"comment",merge:!0,regex:"\\/\\*",next:"comment"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",merge:!0,regex:'["].*\\\\$',next:"qqstring"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"string",merge:!0,regex:"['].*\\\\$",next:"qstring"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant",regex:"<[a-zA-Z0-9.]+>"},{token:"keyword",regex:"(?:#include|#pragma|#line|#define|#undef|#ifdef|#else|#elif|#endif|#ifndef)"},{token:function(c){return c=="this"?"variable.language":a.hasOwnProperty(c)?"keyword":b.hasOwnProperty(c)?"constant.language":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)"},{token:"punctuation.operator",regex:"\\?|\\:|\\,|\\;|\\."},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:".*?\\*\\/",next:"start"},{token:"comment",merge:!0,regex:".+"}],qqstring:[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",merge:!0,regex:".+"}],qstring:[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",merge:!0,regex:".+"}]}};d.inherits(h,g),b.GolangHighlightRules=h}),ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("./text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:"comment.doc.tag",regex:"@[\\w\\d_]+"},{token:"comment.doc",merge:!0,regex:"\\s+"},{token:"comment.doc",merge:!0,regex:"TODO"},{token:"comment.doc",merge:!0,regex:"[^@\\*]+"},{token:"comment.doc",merge:!0,regex:"."}]}};d.inherits(f,e),f.getStartRule=function(a){return{token:"comment.doc",merge:!0,regex:"\\/\\*(?=\\*)",next:a}},f.getEndRule=function(a){return{token:"comment.doc",merge:!0,regex:"\\*\\/",next:a}},b.DocCommentHighlightRules=f}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(a,b,c){"use strict";var d=a("../range").Range,e=function(){};(function(){this.checkOutdent=function(a,b){return/^\s+$/.test(a)?/^\s*\}/.test(b):!1},this.autoOutdent=function(a,b){var c=a.getLine(b),e=c.match(/^(\s*\})/);if(!e)return 0;var f=e[1].length,g=a.findMatchingBracket({row:b,column:f});if(!g||g.row==b)return 0;var h=this.$getIndent(a.getLine(g.row));a.replace(new d(b,0,b,f-1),h)},this.$getIndent=function(a){var b=a.match(/^(\s+)/);return b?b[1]:""}}).call(e.prototype),b.MatchingBraceOutdent=e})
|
||||
378
build/src/mode-golang-uncompressed-noconflict.js
Normal file
378
build/src/mode-golang-uncompressed-noconflict.js
Normal file
|
|
@ -0,0 +1,378 @@
|
|||
ace.define('ace/mode/golang', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/golang_highlight_rules', 'ace/mode/matching_brace_outdent'], function(require, exports, module) {
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var GolangHighlightRules = require("./golang_highlight_rules").GolangHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new GolangHighlightRules().getRules());
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.toggleCommentLines = function(state, doc, startRow, endRow) {
|
||||
var outdent = true;
|
||||
var outentedRows = [];
|
||||
var re = /^(\s*)\/\//;
|
||||
|
||||
for (var i=startRow; i<= endRow; i++) {
|
||||
if (!re.test(doc.getLine(i))) {
|
||||
outdent = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (outdent) {
|
||||
var deleteRange = new Range(0, 0, 0, 0);
|
||||
for (var i=startRow; i<= endRow; i++)
|
||||
{
|
||||
var line = doc.getLine(i);
|
||||
var m = line.match(re);
|
||||
deleteRange.start.row = i;
|
||||
deleteRange.end.row = i;
|
||||
deleteRange.end.column = m[0].length;
|
||||
doc.replace(deleteRange, m[1]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
doc.indentRows(startRow, endRow, "//");
|
||||
}
|
||||
};
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
var indent = this.$getIndent(line);
|
||||
|
||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
||||
var tokens = tokenizedLine.tokens;
|
||||
var endState = tokenizedLine.state;
|
||||
|
||||
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;
|
||||
};//end getNextLineIndent
|
||||
|
||||
this.checkOutdent = function(state, line, input) {
|
||||
return this.$outdent.checkOutdent(line, input);
|
||||
};
|
||||
|
||||
this.autoOutdent = function(state, doc, row) {
|
||||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
ace.define('ace/mode/golang_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||
var oop = require("../lib/oop");
|
||||
var lang = require("../lib/lang");
|
||||
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var GolangHighlightRules = function() {
|
||||
var keywords = lang.arrayToMap(
|
||||
("true|else|false|break|case|return|goto|if|const|" +
|
||||
"continue|struct|default|switch|for|" +
|
||||
"func|import|package|chan|defer|fallthrough|go|interface|map|range" +
|
||||
"select|type|var").split("|")
|
||||
);
|
||||
|
||||
var buildinConstants = lang.arrayToMap(
|
||||
("nit|true|false|iota").split("|")
|
||||
);
|
||||
|
||||
this.$rules = {
|
||||
"start" : [
|
||||
{
|
||||
token : "comment",
|
||||
regex : "\\/\\/.*$"
|
||||
},
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
regex : "\\/\\*",
|
||||
next : "comment"
|
||||
}, {
|
||||
token : "string", // single line
|
||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||
}, {
|
||||
token : "string", // multi line string start
|
||||
merge : true,
|
||||
regex : '["].*\\\\$',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "string", // single line
|
||||
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||
}, {
|
||||
token : "string", // multi line string start
|
||||
merge : true,
|
||||
regex : "['].*\\\\$",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
||||
}, {
|
||||
token : "constant.numeric", // float
|
||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||
}, {
|
||||
token : "constant", // <CONSTANT>
|
||||
regex : "<[a-zA-Z0-9.]+>"
|
||||
}, {
|
||||
token : "keyword", // pre-compiler directivs
|
||||
regex : "(?:#include|#pragma|#line|#define|#undef|#ifdef|#else|#elif|#endif|#ifndef)"
|
||||
}, {
|
||||
token : function(value) {
|
||||
if (value == "this")
|
||||
return "variable.language";
|
||||
else if (keywords.hasOwnProperty(value))
|
||||
return "keyword";
|
||||
else if (buildinConstants.hasOwnProperty(value))
|
||||
return "constant.language";
|
||||
else
|
||||
return "identifier";
|
||||
},
|
||||
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||
}, {
|
||||
token : "keyword.operator",
|
||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)"
|
||||
}, {
|
||||
token : "punctuation.operator",
|
||||
regex : "\\?|\\:|\\,|\\;|\\."
|
||||
}, {
|
||||
token : "paren.lparen",
|
||||
regex : "[[({]"
|
||||
}, {
|
||||
token : "paren.rparen",
|
||||
regex : "[\\])}]"
|
||||
}, {
|
||||
token : "text",
|
||||
regex : "\\s+"
|
||||
}
|
||||
],
|
||||
"comment" : [
|
||||
{
|
||||
token : "comment", // closing comment
|
||||
regex : ".*?\\*\\/",
|
||||
next : "start"
|
||||
}, {
|
||||
token : "comment", // comment spanning whole line
|
||||
merge : true,
|
||||
regex : ".+"
|
||||
}
|
||||
],
|
||||
"qqstring" : [
|
||||
{
|
||||
token : "string",
|
||||
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
|
||||
next : "start"
|
||||
}, {
|
||||
token : "string",
|
||||
merge : true,
|
||||
regex : '.+'
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
{
|
||||
token : "string",
|
||||
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
|
||||
next : "start"
|
||||
}, {
|
||||
token : "string",
|
||||
merge : true,
|
||||
regex : '.+'
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
oop.inherits(GolangHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.GolangHighlightRules = GolangHighlightRules;
|
||||
});
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
ace.define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var DocCommentHighlightRules = function() {
|
||||
|
||||
this.$rules = {
|
||||
"start" : [ {
|
||||
token : "comment.doc.tag",
|
||||
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
||||
}, {
|
||||
token : "comment.doc",
|
||||
merge : true,
|
||||
regex : "\\s+"
|
||||
}, {
|
||||
token : "comment.doc",
|
||||
merge : true,
|
||||
regex : "TODO"
|
||||
}, {
|
||||
token : "comment.doc",
|
||||
merge : true,
|
||||
regex : "[^@\\*]+"
|
||||
}, {
|
||||
token : "comment.doc",
|
||||
merge : true,
|
||||
regex : "."
|
||||
}]
|
||||
};
|
||||
};
|
||||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
});
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
ace.define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var MatchingBraceOutdent = function() {};
|
||||
|
||||
(function() {
|
||||
|
||||
this.checkOutdent = function(line, input) {
|
||||
if (! /^\s+$/.test(line))
|
||||
return false;
|
||||
|
||||
return /^\s*\}/.test(input);
|
||||
};
|
||||
|
||||
this.autoOutdent = function(doc, row) {
|
||||
var line = doc.getLine(row);
|
||||
var match = line.match(/^(\s*\})/);
|
||||
|
||||
if (!match) return 0;
|
||||
|
||||
var column = match[1].length;
|
||||
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||
|
||||
if (!openBracePos || openBracePos.row == row) return 0;
|
||||
|
||||
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||
};
|
||||
|
||||
this.$getIndent = function(line) {
|
||||
var match = line.match(/^(\s+)/);
|
||||
if (match) {
|
||||
return match[1];
|
||||
}
|
||||
|
||||
return "";
|
||||
};
|
||||
|
||||
}).call(MatchingBraceOutdent.prototype);
|
||||
|
||||
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||
});
|
||||
378
build/src/mode-golang-uncompressed.js
Normal file
378
build/src/mode-golang-uncompressed.js
Normal file
|
|
@ -0,0 +1,378 @@
|
|||
define('ace/mode/golang', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/golang_highlight_rules', 'ace/mode/matching_brace_outdent'], function(require, exports, module) {
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var GolangHighlightRules = require("./golang_highlight_rules").GolangHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new GolangHighlightRules().getRules());
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.toggleCommentLines = function(state, doc, startRow, endRow) {
|
||||
var outdent = true;
|
||||
var outentedRows = [];
|
||||
var re = /^(\s*)\/\//;
|
||||
|
||||
for (var i=startRow; i<= endRow; i++) {
|
||||
if (!re.test(doc.getLine(i))) {
|
||||
outdent = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (outdent) {
|
||||
var deleteRange = new Range(0, 0, 0, 0);
|
||||
for (var i=startRow; i<= endRow; i++)
|
||||
{
|
||||
var line = doc.getLine(i);
|
||||
var m = line.match(re);
|
||||
deleteRange.start.row = i;
|
||||
deleteRange.end.row = i;
|
||||
deleteRange.end.column = m[0].length;
|
||||
doc.replace(deleteRange, m[1]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
doc.indentRows(startRow, endRow, "//");
|
||||
}
|
||||
};
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
var indent = this.$getIndent(line);
|
||||
|
||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
||||
var tokens = tokenizedLine.tokens;
|
||||
var endState = tokenizedLine.state;
|
||||
|
||||
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;
|
||||
};//end getNextLineIndent
|
||||
|
||||
this.checkOutdent = function(state, line, input) {
|
||||
return this.$outdent.checkOutdent(line, input);
|
||||
};
|
||||
|
||||
this.autoOutdent = function(state, doc, row) {
|
||||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
define('ace/mode/golang_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||
var oop = require("../lib/oop");
|
||||
var lang = require("../lib/lang");
|
||||
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var GolangHighlightRules = function() {
|
||||
var keywords = lang.arrayToMap(
|
||||
("true|else|false|break|case|return|goto|if|const|" +
|
||||
"continue|struct|default|switch|for|" +
|
||||
"func|import|package|chan|defer|fallthrough|go|interface|map|range" +
|
||||
"select|type|var").split("|")
|
||||
);
|
||||
|
||||
var buildinConstants = lang.arrayToMap(
|
||||
("nit|true|false|iota").split("|")
|
||||
);
|
||||
|
||||
this.$rules = {
|
||||
"start" : [
|
||||
{
|
||||
token : "comment",
|
||||
regex : "\\/\\/.*$"
|
||||
},
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
regex : "\\/\\*",
|
||||
next : "comment"
|
||||
}, {
|
||||
token : "string", // single line
|
||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||
}, {
|
||||
token : "string", // multi line string start
|
||||
merge : true,
|
||||
regex : '["].*\\\\$',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "string", // single line
|
||||
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||
}, {
|
||||
token : "string", // multi line string start
|
||||
merge : true,
|
||||
regex : "['].*\\\\$",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
||||
}, {
|
||||
token : "constant.numeric", // float
|
||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||
}, {
|
||||
token : "constant", // <CONSTANT>
|
||||
regex : "<[a-zA-Z0-9.]+>"
|
||||
}, {
|
||||
token : "keyword", // pre-compiler directivs
|
||||
regex : "(?:#include|#pragma|#line|#define|#undef|#ifdef|#else|#elif|#endif|#ifndef)"
|
||||
}, {
|
||||
token : function(value) {
|
||||
if (value == "this")
|
||||
return "variable.language";
|
||||
else if (keywords.hasOwnProperty(value))
|
||||
return "keyword";
|
||||
else if (buildinConstants.hasOwnProperty(value))
|
||||
return "constant.language";
|
||||
else
|
||||
return "identifier";
|
||||
},
|
||||
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||
}, {
|
||||
token : "keyword.operator",
|
||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)"
|
||||
}, {
|
||||
token : "punctuation.operator",
|
||||
regex : "\\?|\\:|\\,|\\;|\\."
|
||||
}, {
|
||||
token : "paren.lparen",
|
||||
regex : "[[({]"
|
||||
}, {
|
||||
token : "paren.rparen",
|
||||
regex : "[\\])}]"
|
||||
}, {
|
||||
token : "text",
|
||||
regex : "\\s+"
|
||||
}
|
||||
],
|
||||
"comment" : [
|
||||
{
|
||||
token : "comment", // closing comment
|
||||
regex : ".*?\\*\\/",
|
||||
next : "start"
|
||||
}, {
|
||||
token : "comment", // comment spanning whole line
|
||||
merge : true,
|
||||
regex : ".+"
|
||||
}
|
||||
],
|
||||
"qqstring" : [
|
||||
{
|
||||
token : "string",
|
||||
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
|
||||
next : "start"
|
||||
}, {
|
||||
token : "string",
|
||||
merge : true,
|
||||
regex : '.+'
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
{
|
||||
token : "string",
|
||||
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
|
||||
next : "start"
|
||||
}, {
|
||||
token : "string",
|
||||
merge : true,
|
||||
regex : '.+'
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
oop.inherits(GolangHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.GolangHighlightRules = GolangHighlightRules;
|
||||
});
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var DocCommentHighlightRules = function() {
|
||||
|
||||
this.$rules = {
|
||||
"start" : [ {
|
||||
token : "comment.doc.tag",
|
||||
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
||||
}, {
|
||||
token : "comment.doc",
|
||||
merge : true,
|
||||
regex : "\\s+"
|
||||
}, {
|
||||
token : "comment.doc",
|
||||
merge : true,
|
||||
regex : "TODO"
|
||||
}, {
|
||||
token : "comment.doc",
|
||||
merge : true,
|
||||
regex : "[^@\\*]+"
|
||||
}, {
|
||||
token : "comment.doc",
|
||||
merge : true,
|
||||
regex : "."
|
||||
}]
|
||||
};
|
||||
};
|
||||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
});
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var MatchingBraceOutdent = function() {};
|
||||
|
||||
(function() {
|
||||
|
||||
this.checkOutdent = function(line, input) {
|
||||
if (! /^\s+$/.test(line))
|
||||
return false;
|
||||
|
||||
return /^\s*\}/.test(input);
|
||||
};
|
||||
|
||||
this.autoOutdent = function(doc, row) {
|
||||
var line = doc.getLine(row);
|
||||
var match = line.match(/^(\s*\})/);
|
||||
|
||||
if (!match) return 0;
|
||||
|
||||
var column = match[1].length;
|
||||
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||
|
||||
if (!openBracePos || openBracePos.row == row) return 0;
|
||||
|
||||
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||
};
|
||||
|
||||
this.$getIndent = function(line) {
|
||||
var match = line.match(/^(\s+)/);
|
||||
if (match) {
|
||||
return match[1];
|
||||
}
|
||||
|
||||
return "";
|
||||
};
|
||||
|
||||
}).call(MatchingBraceOutdent.prototype);
|
||||
|
||||
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||
});
|
||||
1
build/src/mode-golang.js
Normal file
1
build/src/mode-golang.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/mode/golang",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/golang_highlight_rules","ace/mode/matching_brace_outdent"],function(a,b,c){var d=a("../lib/oop"),e=a("./text").Mode,f=a("../tokenizer").Tokenizer,g=a("./golang_highlight_rules").GolangHighlightRules,h=a("./matching_brace_outdent").MatchingBraceOutdent,i=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(i,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)\/\//;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var i=new Range(0,0,0,0);for(var h=c;h<=d;h++){var j=b.getLine(h),k=j.match(g);i.start.row=h,i.end.row=h,i.end.column=k[0].length,b.replace(i,k[1])}}else b.indentRows(c,d,"//")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[]\s*$/);h&&(d+=c)}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(i.prototype),b.Mode=i}),define("ace/mode/golang_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("../lib/oop"),e=a("../lib/lang"),f=a("./doc_comment_highlight_rules").DocCommentHighlightRules,g=a("./text_highlight_rules").TextHighlightRules,h=function(){var a=e.arrayToMap("true|else|false|break|case|return|goto|if|const|continue|struct|default|switch|for|func|import|package|chan|defer|fallthrough|go|interface|map|rangeselect|type|var".split("|")),b=e.arrayToMap("nit|true|false|iota".split("|"));this.$rules={start:[{token:"comment",regex:"\\/\\/.*$"},f.getStartRule("doc-start"),{token:"comment",merge:!0,regex:"\\/\\*",next:"comment"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",merge:!0,regex:'["].*\\\\$',next:"qqstring"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"string",merge:!0,regex:"['].*\\\\$",next:"qstring"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant",regex:"<[a-zA-Z0-9.]+>"},{token:"keyword",regex:"(?:#include|#pragma|#line|#define|#undef|#ifdef|#else|#elif|#endif|#ifndef)"},{token:function(c){return c=="this"?"variable.language":a.hasOwnProperty(c)?"keyword":b.hasOwnProperty(c)?"constant.language":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)"},{token:"punctuation.operator",regex:"\\?|\\:|\\,|\\;|\\."},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:".*?\\*\\/",next:"start"},{token:"comment",merge:!0,regex:".+"}],qqstring:[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",merge:!0,regex:".+"}],qstring:[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",merge:!0,regex:".+"}]}};d.inherits(h,g),b.GolangHighlightRules=h}),define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(a,b,c){"use strict";var d=a("../lib/oop"),e=a("./text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:"comment.doc.tag",regex:"@[\\w\\d_]+"},{token:"comment.doc",merge:!0,regex:"\\s+"},{token:"comment.doc",merge:!0,regex:"TODO"},{token:"comment.doc",merge:!0,regex:"[^@\\*]+"},{token:"comment.doc",merge:!0,regex:"."}]}};d.inherits(f,e),f.getStartRule=function(a){return{token:"comment.doc",merge:!0,regex:"\\/\\*(?=\\*)",next:a}},f.getEndRule=function(a){return{token:"comment.doc",merge:!0,regex:"\\*\\/",next:a}},b.DocCommentHighlightRules=f}),define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(a,b,c){"use strict";var d=a("../range").Range,e=function(){};(function(){this.checkOutdent=function(a,b){return/^\s+$/.test(a)?/^\s*\}/.test(b):!1},this.autoOutdent=function(a,b){var c=a.getLine(b),e=c.match(/^(\s*\})/);if(!e)return 0;var f=e[1].length,g=a.findMatchingBracket({row:b,column:f});if(!g||g.row==b)return 0;var h=this.$getIndent(a.getLine(g.row));a.replace(new d(b,0,b,f-1),h)},this.$getIndent=function(a){var b=a.match(/^(\s+)/);return b?b[1]:""}}).call(e.prototype),b.MatchingBraceOutdent=e})
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -304,7 +304,7 @@ var JavaScriptHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : /\/\/.*$/
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -312,11 +312,11 @@ var JavaScriptHighlightRules = function() {
|
|||
next : "comment"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
regex : "'(?=.)",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
regex : '"(?=.)',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
|
|
@ -336,11 +336,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -352,7 +351,8 @@ var JavaScriptHighlightRules = function() {
|
|||
"keyword.operator",
|
||||
"text"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.play = function() { }
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -363,11 +363,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: play = function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -376,22 +375,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match regular function like: function myFunc(arg) { }
|
||||
token : [
|
||||
"storage.type",
|
||||
"text",
|
||||
"entity.name.function",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: foobar: function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -400,22 +397,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||
token : [
|
||||
"text",
|
||||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "constant.language.boolean",
|
||||
regex : /(?:true|false)\b/
|
||||
|
|
@ -485,6 +480,7 @@ var JavaScriptHighlightRules = function() {
|
|||
// regular expressions are only allowed after certain tokens. This
|
||||
// makes sure we don't mix up regexps with the divison operator
|
||||
"regex_allowed": [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -512,10 +508,9 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
// flag
|
||||
// flag
|
||||
token: "string.regexp",
|
||||
regex: "/\\w*",
|
||||
next: "start",
|
||||
|
|
@ -523,7 +518,6 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp",
|
||||
regex: "[^\\\\/\\[]+",
|
||||
next: "regex",
|
||||
merge: true
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
|
|
@ -539,8 +533,7 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex_character_class"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "]",
|
||||
|
|
@ -549,7 +542,24 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "[^\\\\\\]]+",
|
||||
next: "regex_character_class",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "start"
|
||||
}
|
||||
],
|
||||
"function_arguments": [
|
||||
{
|
||||
token: "variable.parameter",
|
||||
regex: identifierRe,
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "[, ]+",
|
||||
merge: true
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "$",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
|
|
@ -587,11 +597,18 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]+'
|
||||
regex : '[^"\\\\]+',
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qqstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
|
|
@ -600,17 +617,24 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "[^'\\\\]+"
|
||||
regex : "[^'\\\\]+",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||
|
|
@ -688,27 +712,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
@ -1291,7 +1312,7 @@ var GroovyHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : "\\/\\/.*$"
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -1361,7 +1382,7 @@ var GroovyHighlightRules = function() {
|
|||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(GroovyHighlightRules, TextHighlightRules);
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ var JavaScriptHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : /\/\/.*$/
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -312,11 +312,11 @@ var JavaScriptHighlightRules = function() {
|
|||
next : "comment"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
regex : "'(?=.)",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
regex : '"(?=.)',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
|
|
@ -336,11 +336,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -352,7 +351,8 @@ var JavaScriptHighlightRules = function() {
|
|||
"keyword.operator",
|
||||
"text"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.play = function() { }
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -363,11 +363,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: play = function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -376,22 +375,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match regular function like: function myFunc(arg) { }
|
||||
token : [
|
||||
"storage.type",
|
||||
"text",
|
||||
"entity.name.function",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: foobar: function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -400,22 +397,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||
token : [
|
||||
"text",
|
||||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "constant.language.boolean",
|
||||
regex : /(?:true|false)\b/
|
||||
|
|
@ -485,6 +480,7 @@ var JavaScriptHighlightRules = function() {
|
|||
// regular expressions are only allowed after certain tokens. This
|
||||
// makes sure we don't mix up regexps with the divison operator
|
||||
"regex_allowed": [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -512,10 +508,9 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
// flag
|
||||
// flag
|
||||
token: "string.regexp",
|
||||
regex: "/\\w*",
|
||||
next: "start",
|
||||
|
|
@ -523,7 +518,6 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp",
|
||||
regex: "[^\\\\/\\[]+",
|
||||
next: "regex",
|
||||
merge: true
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
|
|
@ -539,8 +533,7 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex_character_class"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "]",
|
||||
|
|
@ -549,7 +542,24 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "[^\\\\\\]]+",
|
||||
next: "regex_character_class",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "start"
|
||||
}
|
||||
],
|
||||
"function_arguments": [
|
||||
{
|
||||
token: "variable.parameter",
|
||||
regex: identifierRe,
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "[, ]+",
|
||||
merge: true
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "$",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
|
|
@ -587,11 +597,18 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]+'
|
||||
regex : '[^"\\\\]+',
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qqstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
|
|
@ -600,17 +617,24 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "[^'\\\\]+"
|
||||
regex : "[^'\\\\]+",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||
|
|
@ -688,27 +712,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
@ -1291,7 +1312,7 @@ var GroovyHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : "\\/\\/.*$"
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -1361,7 +1382,7 @@ var GroovyHighlightRules = function() {
|
|||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(GroovyHighlightRules, TextHighlightRules);
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -84,7 +84,7 @@ var HaxeHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : "\\/\\/.*$"
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
regex : "\\/\\*",
|
||||
|
|
@ -153,7 +153,7 @@ var HaxeHighlightRules = function() {
|
|||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(HaxeHighlightRules, TextHighlightRules);
|
||||
|
|
@ -231,27 +231,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ var HaxeHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : "\\/\\/.*$"
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
regex : "\\/\\*",
|
||||
|
|
@ -153,7 +153,7 @@ var HaxeHighlightRules = function() {
|
|||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(HaxeHighlightRules, TextHighlightRules);
|
||||
|
|
@ -231,27 +231,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -363,7 +363,7 @@ var JavaScriptHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : /\/\/.*$/
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -371,11 +371,11 @@ var JavaScriptHighlightRules = function() {
|
|||
next : "comment"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
regex : "'(?=.)",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
regex : '"(?=.)',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
|
|
@ -395,11 +395,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -411,7 +410,8 @@ var JavaScriptHighlightRules = function() {
|
|||
"keyword.operator",
|
||||
"text"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.play = function() { }
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -422,11 +422,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: play = function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -435,22 +434,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match regular function like: function myFunc(arg) { }
|
||||
token : [
|
||||
"storage.type",
|
||||
"text",
|
||||
"entity.name.function",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: foobar: function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -459,22 +456,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||
token : [
|
||||
"text",
|
||||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "constant.language.boolean",
|
||||
regex : /(?:true|false)\b/
|
||||
|
|
@ -544,6 +539,7 @@ var JavaScriptHighlightRules = function() {
|
|||
// regular expressions are only allowed after certain tokens. This
|
||||
// makes sure we don't mix up regexps with the divison operator
|
||||
"regex_allowed": [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -571,10 +567,9 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
// flag
|
||||
// flag
|
||||
token: "string.regexp",
|
||||
regex: "/\\w*",
|
||||
next: "start",
|
||||
|
|
@ -582,7 +577,6 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp",
|
||||
regex: "[^\\\\/\\[]+",
|
||||
next: "regex",
|
||||
merge: true
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
|
|
@ -598,8 +592,7 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex_character_class"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "]",
|
||||
|
|
@ -608,7 +601,24 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "[^\\\\\\]]+",
|
||||
next: "regex_character_class",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "start"
|
||||
}
|
||||
],
|
||||
"function_arguments": [
|
||||
{
|
||||
token: "variable.parameter",
|
||||
regex: identifierRe,
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "[, ]+",
|
||||
merge: true
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "$",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
|
|
@ -646,11 +656,18 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]+'
|
||||
regex : '[^"\\\\]+',
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qqstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
|
|
@ -659,17 +676,24 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "[^'\\\\]+"
|
||||
regex : "[^'\\\\]+",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||
|
|
@ -747,27 +771,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
|
|
@ -363,7 +363,7 @@ var JavaScriptHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : /\/\/.*$/
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -371,11 +371,11 @@ var JavaScriptHighlightRules = function() {
|
|||
next : "comment"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
regex : "'(?=.)",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
regex : '"(?=.)',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
|
|
@ -395,11 +395,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -411,7 +410,8 @@ var JavaScriptHighlightRules = function() {
|
|||
"keyword.operator",
|
||||
"text"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.play = function() { }
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -422,11 +422,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: play = function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -435,22 +434,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match regular function like: function myFunc(arg) { }
|
||||
token : [
|
||||
"storage.type",
|
||||
"text",
|
||||
"entity.name.function",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: foobar: function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -459,22 +456,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||
token : [
|
||||
"text",
|
||||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "constant.language.boolean",
|
||||
regex : /(?:true|false)\b/
|
||||
|
|
@ -544,6 +539,7 @@ var JavaScriptHighlightRules = function() {
|
|||
// regular expressions are only allowed after certain tokens. This
|
||||
// makes sure we don't mix up regexps with the divison operator
|
||||
"regex_allowed": [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -571,10 +567,9 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
// flag
|
||||
// flag
|
||||
token: "string.regexp",
|
||||
regex: "/\\w*",
|
||||
next: "start",
|
||||
|
|
@ -582,7 +577,6 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp",
|
||||
regex: "[^\\\\/\\[]+",
|
||||
next: "regex",
|
||||
merge: true
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
|
|
@ -598,8 +592,7 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex_character_class"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "]",
|
||||
|
|
@ -608,7 +601,24 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "[^\\\\\\]]+",
|
||||
next: "regex_character_class",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "start"
|
||||
}
|
||||
],
|
||||
"function_arguments": [
|
||||
{
|
||||
token: "variable.parameter",
|
||||
regex: identifierRe,
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "[, ]+",
|
||||
merge: true
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "$",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
|
|
@ -646,11 +656,18 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]+'
|
||||
regex : '[^"\\\\]+',
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qqstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
|
|
@ -659,17 +676,24 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "[^'\\\\]+"
|
||||
regex : "[^'\\\\]+",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||
|
|
@ -747,27 +771,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -305,7 +305,7 @@ var JavaScriptHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : /\/\/.*$/
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -313,11 +313,11 @@ var JavaScriptHighlightRules = function() {
|
|||
next : "comment"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
regex : "'(?=.)",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
regex : '"(?=.)',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
|
|
@ -337,11 +337,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -353,7 +352,8 @@ var JavaScriptHighlightRules = function() {
|
|||
"keyword.operator",
|
||||
"text"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.play = function() { }
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -364,11 +364,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: play = function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -377,22 +376,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match regular function like: function myFunc(arg) { }
|
||||
token : [
|
||||
"storage.type",
|
||||
"text",
|
||||
"entity.name.function",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: foobar: function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -401,22 +398,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||
token : [
|
||||
"text",
|
||||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "constant.language.boolean",
|
||||
regex : /(?:true|false)\b/
|
||||
|
|
@ -486,6 +481,7 @@ var JavaScriptHighlightRules = function() {
|
|||
// regular expressions are only allowed after certain tokens. This
|
||||
// makes sure we don't mix up regexps with the divison operator
|
||||
"regex_allowed": [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -513,10 +509,9 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
// flag
|
||||
// flag
|
||||
token: "string.regexp",
|
||||
regex: "/\\w*",
|
||||
next: "start",
|
||||
|
|
@ -524,7 +519,6 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp",
|
||||
regex: "[^\\\\/\\[]+",
|
||||
next: "regex",
|
||||
merge: true
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
|
|
@ -540,8 +534,7 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex_character_class"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "]",
|
||||
|
|
@ -550,7 +543,24 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "[^\\\\\\]]+",
|
||||
next: "regex_character_class",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "start"
|
||||
}
|
||||
],
|
||||
"function_arguments": [
|
||||
{
|
||||
token: "variable.parameter",
|
||||
regex: identifierRe,
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "[, ]+",
|
||||
merge: true
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "$",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
|
|
@ -588,11 +598,18 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]+'
|
||||
regex : '[^"\\\\]+',
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qqstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
|
|
@ -601,17 +618,24 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "[^'\\\\]+"
|
||||
regex : "[^'\\\\]+",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||
|
|
@ -689,27 +713,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
@ -1293,7 +1314,7 @@ var JavaHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : "\\/\\/.*$"
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -1363,7 +1384,7 @@ var JavaHighlightRules = function() {
|
|||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(JavaHighlightRules, TextHighlightRules);
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ var JavaScriptHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : /\/\/.*$/
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -313,11 +313,11 @@ var JavaScriptHighlightRules = function() {
|
|||
next : "comment"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
regex : "'(?=.)",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
regex : '"(?=.)',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
|
|
@ -337,11 +337,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -353,7 +352,8 @@ var JavaScriptHighlightRules = function() {
|
|||
"keyword.operator",
|
||||
"text"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.play = function() { }
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -364,11 +364,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: play = function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -377,22 +376,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match regular function like: function myFunc(arg) { }
|
||||
token : [
|
||||
"storage.type",
|
||||
"text",
|
||||
"entity.name.function",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: foobar: function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -401,22 +398,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||
token : [
|
||||
"text",
|
||||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "constant.language.boolean",
|
||||
regex : /(?:true|false)\b/
|
||||
|
|
@ -486,6 +481,7 @@ var JavaScriptHighlightRules = function() {
|
|||
// regular expressions are only allowed after certain tokens. This
|
||||
// makes sure we don't mix up regexps with the divison operator
|
||||
"regex_allowed": [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -513,10 +509,9 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
// flag
|
||||
// flag
|
||||
token: "string.regexp",
|
||||
regex: "/\\w*",
|
||||
next: "start",
|
||||
|
|
@ -524,7 +519,6 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp",
|
||||
regex: "[^\\\\/\\[]+",
|
||||
next: "regex",
|
||||
merge: true
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
|
|
@ -540,8 +534,7 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex_character_class"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "]",
|
||||
|
|
@ -550,7 +543,24 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "[^\\\\\\]]+",
|
||||
next: "regex_character_class",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "start"
|
||||
}
|
||||
],
|
||||
"function_arguments": [
|
||||
{
|
||||
token: "variable.parameter",
|
||||
regex: identifierRe,
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "[, ]+",
|
||||
merge: true
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "$",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
|
|
@ -588,11 +598,18 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]+'
|
||||
regex : '[^"\\\\]+',
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qqstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
|
|
@ -601,17 +618,24 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "[^'\\\\]+"
|
||||
regex : "[^'\\\\]+",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||
|
|
@ -689,27 +713,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
@ -1293,7 +1314,7 @@ var JavaHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : "\\/\\/.*$"
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -1363,7 +1384,7 @@ var JavaHighlightRules = function() {
|
|||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(JavaHighlightRules, TextHighlightRules);
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -280,7 +280,7 @@ var JavaScriptHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : /\/\/.*$/
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -288,11 +288,11 @@ var JavaScriptHighlightRules = function() {
|
|||
next : "comment"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
regex : "'(?=.)",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
regex : '"(?=.)',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
|
|
@ -312,11 +312,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -328,7 +327,8 @@ var JavaScriptHighlightRules = function() {
|
|||
"keyword.operator",
|
||||
"text"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.play = function() { }
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -339,11 +339,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: play = function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -352,22 +351,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match regular function like: function myFunc(arg) { }
|
||||
token : [
|
||||
"storage.type",
|
||||
"text",
|
||||
"entity.name.function",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: foobar: function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -376,22 +373,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||
token : [
|
||||
"text",
|
||||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "constant.language.boolean",
|
||||
regex : /(?:true|false)\b/
|
||||
|
|
@ -461,6 +456,7 @@ var JavaScriptHighlightRules = function() {
|
|||
// regular expressions are only allowed after certain tokens. This
|
||||
// makes sure we don't mix up regexps with the divison operator
|
||||
"regex_allowed": [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -488,10 +484,9 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
// flag
|
||||
// flag
|
||||
token: "string.regexp",
|
||||
regex: "/\\w*",
|
||||
next: "start",
|
||||
|
|
@ -499,7 +494,6 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp",
|
||||
regex: "[^\\\\/\\[]+",
|
||||
next: "regex",
|
||||
merge: true
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
|
|
@ -515,8 +509,7 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex_character_class"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "]",
|
||||
|
|
@ -525,7 +518,24 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "[^\\\\\\]]+",
|
||||
next: "regex_character_class",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "start"
|
||||
}
|
||||
],
|
||||
"function_arguments": [
|
||||
{
|
||||
token: "variable.parameter",
|
||||
regex: identifierRe,
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "[, ]+",
|
||||
merge: true
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "$",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
|
|
@ -563,11 +573,18 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]+'
|
||||
regex : '[^"\\\\]+',
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qqstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
|
|
@ -576,17 +593,24 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "[^'\\\\]+"
|
||||
regex : "[^'\\\\]+",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||
|
|
@ -664,27 +688,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@ var JavaScriptHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : /\/\/.*$/
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -288,11 +288,11 @@ var JavaScriptHighlightRules = function() {
|
|||
next : "comment"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
regex : "'(?=.)",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
regex : '"(?=.)',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
|
|
@ -312,11 +312,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -328,7 +327,8 @@ var JavaScriptHighlightRules = function() {
|
|||
"keyword.operator",
|
||||
"text"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.play = function() { }
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -339,11 +339,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: play = function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -352,22 +351,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match regular function like: function myFunc(arg) { }
|
||||
token : [
|
||||
"storage.type",
|
||||
"text",
|
||||
"entity.name.function",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: foobar: function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -376,22 +373,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||
token : [
|
||||
"text",
|
||||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "constant.language.boolean",
|
||||
regex : /(?:true|false)\b/
|
||||
|
|
@ -461,6 +456,7 @@ var JavaScriptHighlightRules = function() {
|
|||
// regular expressions are only allowed after certain tokens. This
|
||||
// makes sure we don't mix up regexps with the divison operator
|
||||
"regex_allowed": [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -488,10 +484,9 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
// flag
|
||||
// flag
|
||||
token: "string.regexp",
|
||||
regex: "/\\w*",
|
||||
next: "start",
|
||||
|
|
@ -499,7 +494,6 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp",
|
||||
regex: "[^\\\\/\\[]+",
|
||||
next: "regex",
|
||||
merge: true
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
|
|
@ -515,8 +509,7 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex_character_class"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "]",
|
||||
|
|
@ -525,7 +518,24 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "[^\\\\\\]]+",
|
||||
next: "regex_character_class",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "start"
|
||||
}
|
||||
],
|
||||
"function_arguments": [
|
||||
{
|
||||
token: "variable.parameter",
|
||||
regex: identifierRe,
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "[, ]+",
|
||||
merge: true
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "$",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
|
|
@ -563,11 +573,18 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]+'
|
||||
regex : '[^"\\\\]+',
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qqstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
|
|
@ -576,17 +593,24 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "[^'\\\\]+"
|
||||
regex : "[^'\\\\]+",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||
|
|
@ -664,27 +688,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -694,7 +694,7 @@ var JavaScriptHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : /\/\/.*$/
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -702,11 +702,11 @@ var JavaScriptHighlightRules = function() {
|
|||
next : "comment"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
regex : "'(?=.)",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
regex : '"(?=.)',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
|
|
@ -726,11 +726,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -742,7 +741,8 @@ var JavaScriptHighlightRules = function() {
|
|||
"keyword.operator",
|
||||
"text"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.play = function() { }
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -753,11 +753,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: play = function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -766,22 +765,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match regular function like: function myFunc(arg) { }
|
||||
token : [
|
||||
"storage.type",
|
||||
"text",
|
||||
"entity.name.function",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: foobar: function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -790,22 +787,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||
token : [
|
||||
"text",
|
||||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "constant.language.boolean",
|
||||
regex : /(?:true|false)\b/
|
||||
|
|
@ -875,6 +870,7 @@ var JavaScriptHighlightRules = function() {
|
|||
// regular expressions are only allowed after certain tokens. This
|
||||
// makes sure we don't mix up regexps with the divison operator
|
||||
"regex_allowed": [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -902,10 +898,9 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
// flag
|
||||
// flag
|
||||
token: "string.regexp",
|
||||
regex: "/\\w*",
|
||||
next: "start",
|
||||
|
|
@ -913,7 +908,6 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp",
|
||||
regex: "[^\\\\/\\[]+",
|
||||
next: "regex",
|
||||
merge: true
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
|
|
@ -929,8 +923,7 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex_character_class"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "]",
|
||||
|
|
@ -939,7 +932,24 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "[^\\\\\\]]+",
|
||||
next: "regex_character_class",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "start"
|
||||
}
|
||||
],
|
||||
"function_arguments": [
|
||||
{
|
||||
token: "variable.parameter",
|
||||
regex: identifierRe,
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "[, ]+",
|
||||
merge: true
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "$",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
|
|
@ -977,11 +987,18 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]+'
|
||||
regex : '[^"\\\\]+',
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qqstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
|
|
@ -990,17 +1007,24 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "[^'\\\\]+"
|
||||
regex : "[^'\\\\]+",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||
|
|
@ -1078,27 +1102,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
|
|
@ -694,7 +694,7 @@ var JavaScriptHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : /\/\/.*$/
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -702,11 +702,11 @@ var JavaScriptHighlightRules = function() {
|
|||
next : "comment"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
regex : "'(?=.)",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
regex : '"(?=.)',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
|
|
@ -726,11 +726,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -742,7 +741,8 @@ var JavaScriptHighlightRules = function() {
|
|||
"keyword.operator",
|
||||
"text"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.play = function() { }
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -753,11 +753,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: play = function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -766,22 +765,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match regular function like: function myFunc(arg) { }
|
||||
token : [
|
||||
"storage.type",
|
||||
"text",
|
||||
"entity.name.function",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: foobar: function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -790,22 +787,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||
token : [
|
||||
"text",
|
||||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "constant.language.boolean",
|
||||
regex : /(?:true|false)\b/
|
||||
|
|
@ -875,6 +870,7 @@ var JavaScriptHighlightRules = function() {
|
|||
// regular expressions are only allowed after certain tokens. This
|
||||
// makes sure we don't mix up regexps with the divison operator
|
||||
"regex_allowed": [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -902,10 +898,9 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
// flag
|
||||
// flag
|
||||
token: "string.regexp",
|
||||
regex: "/\\w*",
|
||||
next: "start",
|
||||
|
|
@ -913,7 +908,6 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp",
|
||||
regex: "[^\\\\/\\[]+",
|
||||
next: "regex",
|
||||
merge: true
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
|
|
@ -929,8 +923,7 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex_character_class"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "]",
|
||||
|
|
@ -939,7 +932,24 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "[^\\\\\\]]+",
|
||||
next: "regex_character_class",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "start"
|
||||
}
|
||||
],
|
||||
"function_arguments": [
|
||||
{
|
||||
token: "variable.parameter",
|
||||
regex: identifierRe,
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "[, ]+",
|
||||
merge: true
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "$",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
|
|
@ -977,11 +987,18 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]+'
|
||||
regex : '[^"\\\\]+',
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qqstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
|
|
@ -990,17 +1007,24 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "[^'\\\\]+"
|
||||
regex : "[^'\\\\]+",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||
|
|
@ -1078,27 +1102,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -360,7 +360,7 @@ var JavaScriptHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : /\/\/.*$/
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -368,11 +368,11 @@ var JavaScriptHighlightRules = function() {
|
|||
next : "comment"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
regex : "'(?=.)",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
regex : '"(?=.)',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
|
|
@ -392,11 +392,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -408,7 +407,8 @@ var JavaScriptHighlightRules = function() {
|
|||
"keyword.operator",
|
||||
"text"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.play = function() { }
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -419,11 +419,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: play = function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -432,22 +431,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match regular function like: function myFunc(arg) { }
|
||||
token : [
|
||||
"storage.type",
|
||||
"text",
|
||||
"entity.name.function",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: foobar: function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -456,22 +453,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||
token : [
|
||||
"text",
|
||||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "constant.language.boolean",
|
||||
regex : /(?:true|false)\b/
|
||||
|
|
@ -541,6 +536,7 @@ var JavaScriptHighlightRules = function() {
|
|||
// regular expressions are only allowed after certain tokens. This
|
||||
// makes sure we don't mix up regexps with the divison operator
|
||||
"regex_allowed": [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -568,10 +564,9 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
// flag
|
||||
// flag
|
||||
token: "string.regexp",
|
||||
regex: "/\\w*",
|
||||
next: "start",
|
||||
|
|
@ -579,7 +574,6 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp",
|
||||
regex: "[^\\\\/\\[]+",
|
||||
next: "regex",
|
||||
merge: true
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
|
|
@ -595,8 +589,7 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex_character_class"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "]",
|
||||
|
|
@ -605,7 +598,24 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "[^\\\\\\]]+",
|
||||
next: "regex_character_class",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "start"
|
||||
}
|
||||
],
|
||||
"function_arguments": [
|
||||
{
|
||||
token: "variable.parameter",
|
||||
regex: identifierRe,
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "[, ]+",
|
||||
merge: true
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "$",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
|
|
@ -643,11 +653,18 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]+'
|
||||
regex : '[^"\\\\]+',
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qqstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
|
|
@ -656,17 +673,24 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "[^'\\\\]+"
|
||||
regex : "[^'\\\\]+",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||
|
|
@ -744,27 +768,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
|
|
@ -360,7 +360,7 @@ var JavaScriptHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : /\/\/.*$/
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -368,11 +368,11 @@ var JavaScriptHighlightRules = function() {
|
|||
next : "comment"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
regex : "'(?=.)",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
regex : '"(?=.)',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
|
|
@ -392,11 +392,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -408,7 +407,8 @@ var JavaScriptHighlightRules = function() {
|
|||
"keyword.operator",
|
||||
"text"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: Sound.play = function() { }
|
||||
token : [
|
||||
"storage.type",
|
||||
|
|
@ -419,11 +419,10 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: play = function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -432,22 +431,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match regular function like: function myFunc(arg) { }
|
||||
token : [
|
||||
"storage.type",
|
||||
"text",
|
||||
"entity.name.function",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // match stuff like: foobar: function() { }
|
||||
token : [
|
||||
"entity.name.function",
|
||||
|
|
@ -456,22 +453,20 @@ var JavaScriptHighlightRules = function() {
|
|||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||
token : [
|
||||
"text",
|
||||
"text",
|
||||
"storage.type",
|
||||
"text",
|
||||
"paren.lparen",
|
||||
"variable.parameter",
|
||||
"paren.rparen"
|
||||
"paren.lparen"
|
||||
],
|
||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "constant.language.boolean",
|
||||
regex : /(?:true|false)\b/
|
||||
|
|
@ -541,6 +536,7 @@ var JavaScriptHighlightRules = function() {
|
|||
// regular expressions are only allowed after certain tokens. This
|
||||
// makes sure we don't mix up regexps with the divison operator
|
||||
"regex_allowed": [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
merge : true,
|
||||
|
|
@ -568,10 +564,9 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
// flag
|
||||
// flag
|
||||
token: "string.regexp",
|
||||
regex: "/\\w*",
|
||||
next: "start",
|
||||
|
|
@ -579,7 +574,6 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp",
|
||||
regex: "[^\\\\/\\[]+",
|
||||
next: "regex",
|
||||
merge: true
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
|
|
@ -595,8 +589,7 @@ var JavaScriptHighlightRules = function() {
|
|||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)",
|
||||
next: "regex_character_class"
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "]",
|
||||
|
|
@ -605,7 +598,24 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token: "string.regexp.charachterclass",
|
||||
regex: "[^\\\\\\]]+",
|
||||
next: "regex_character_class",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "start"
|
||||
}
|
||||
],
|
||||
"function_arguments": [
|
||||
{
|
||||
token: "variable.parameter",
|
||||
regex: identifierRe,
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "[, ]+",
|
||||
merge: true
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "$",
|
||||
merge: true
|
||||
}, {
|
||||
token: "empty",
|
||||
|
|
@ -643,11 +653,18 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]+'
|
||||
regex : '[^"\\\\]+',
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qqstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
|
|
@ -656,17 +673,24 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "[^'\\\\]+"
|
||||
regex : "[^'\\\\]+",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'",
|
||||
next : "start"
|
||||
regex : "\\\\$",
|
||||
next : "qstring",
|
||||
merge : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start",
|
||||
merge : true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||
|
|
@ -744,27 +768,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -520,7 +520,7 @@ var PgsqlHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : "--.*$"
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi-line comment
|
||||
merge : true,
|
||||
|
|
@ -649,7 +649,7 @@ var PgsqlHighlightRules = function() {
|
|||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-", [ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
this.embedRules(PerlHighlightRules, "perl-", [{token : "string", regex : "\\$perl\\$", next : "statement"}]);
|
||||
this.embedRules(PythonHighlightRules, "python-", [{token : "string", regex : "\\$python\\$", next : "statement"}]);
|
||||
};
|
||||
|
|
@ -730,27 +730,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
|
|
@ -520,7 +520,7 @@ var PgsqlHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : "--.*$"
|
||||
},
|
||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi-line comment
|
||||
merge : true,
|
||||
|
|
@ -649,7 +649,7 @@ var PgsqlHighlightRules = function() {
|
|||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-", [ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
this.embedRules(PerlHighlightRules, "perl-", [{token : "string", regex : "\\$perl\\$", next : "statement"}]);
|
||||
this.embedRules(PythonHighlightRules, "python-", [{token : "string", regex : "\\$python\\$", next : "statement"}]);
|
||||
};
|
||||
|
|
@ -730,27 +730,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -164,7 +164,7 @@ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocComme
|
|||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var PhpHighlightRules = function() {
|
||||
var docComment = new DocCommentHighlightRules();
|
||||
var docComment = DocCommentHighlightRules;
|
||||
// http://php.net/quickref.php
|
||||
var builtinFunctions = lang.arrayToMap(
|
||||
('abs|acos|acosh|addcslashes|addslashes|aggregate|aggregate_info|aggregate_methods|aggregate_methods_by_list|aggregate_methods_by_regexp|' +
|
||||
|
|
@ -1269,7 +1269,7 @@ var PhpHighlightRules = function() {
|
|||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(PhpHighlightRules, TextHighlightRules);
|
||||
|
|
@ -1347,27 +1347,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocComme
|
|||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var PhpHighlightRules = function() {
|
||||
var docComment = new DocCommentHighlightRules();
|
||||
var docComment = DocCommentHighlightRules;
|
||||
// http://php.net/quickref.php
|
||||
var builtinFunctions = lang.arrayToMap(
|
||||
('abs|acos|acosh|addcslashes|addslashes|aggregate|aggregate_info|aggregate_methods|aggregate_methods_by_list|aggregate_methods_by_regexp|' +
|
||||
|
|
@ -1269,7 +1269,7 @@ var PhpHighlightRules = function() {
|
|||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(PhpHighlightRules, TextHighlightRules);
|
||||
|
|
@ -1347,27 +1347,24 @@ var DocCommentHighlightRules = function() {
|
|||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
(function() {
|
||||
|
||||
this.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
this.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
merge : true,
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
merge : true,
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
}).call(DocCommentHighlightRules.prototype);
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue