Update Ace to 1.1.6

This commit is contained in:
Thomas Wilburn 2014-08-17 09:17:59 -07:00
parent 5c7f638610
commit 2c0645bd86
58 changed files with 2377 additions and 599 deletions

File diff suppressed because it is too large Load diff

View file

@ -454,6 +454,10 @@ var SnippetManager = function() {
var snippetMap = this.snippetMap;
var snippetNameMap = this.snippetNameMap;
var self = this;
if (!snippets)
snippets = [];
function wrapRegexp(src) {
if (src && !/^\^?\(.*\)\$?$|^\\b$/.test(src))
src = "(?:" + src + ")";
@ -506,7 +510,7 @@ var SnippetManager = function() {
s.endTriggerRe = new RegExp(s.endTrigger, "", true);
}
if (snippets.content)
if (snippets && snippets.content)
addSnippet(snippets);
else if (Array.isArray(snippets))
snippets.forEach(addSnippet);

View file

@ -454,6 +454,10 @@ var SnippetManager = function() {
var snippetMap = this.snippetMap;
var snippetNameMap = this.snippetNameMap;
var self = this;
if (!snippets)
snippets = [];
function wrapRegexp(src) {
if (src && !/^\^?\(.*\)\$?$|^\\b$/.test(src))
src = "(?:" + src + ")";
@ -506,7 +510,7 @@ var SnippetManager = function() {
s.endTriggerRe = new RegExp(s.endTrigger, "", true);
}
if (snippets.content)
if (snippets && snippets.content)
addSnippet(snippets);
else if (Array.isArray(snippets))
snippets.forEach(addSnippet);
@ -921,6 +925,7 @@ var $singleLineEditor = function(el) {
editor.renderer.setHighlightGutterLine(false);
editor.$mouseHandler.$focusWaitTimout = 0;
editor.$highlightTagPending = true;
return editor;
};
@ -971,7 +976,7 @@ var AcePopup = function(parentNode) {
popup.session.removeMarker(hoverMarker.id);
hoverMarker.id = null;
}
}
};
popup.setSelectOnHover(false);
popup.on("mousemove", function(e) {
if (!lastMouseEvent) {
@ -1039,8 +1044,8 @@ var AcePopup = function(parentNode) {
};
var bgTokenizer = popup.session.bgTokenizer;
bgTokenizer.$tokenizeRow = function(i) {
var data = popup.data[i];
bgTokenizer.$tokenizeRow = function(row) {
var data = popup.data[row];
var tokens = [];
if (!data)
return tokens;
@ -1074,7 +1079,7 @@ var AcePopup = function(parentNode) {
popup.session.$computeWidth = function() {
return this.screenWidth = 0;
}
};
popup.isOpen = false;
popup.isTopdown = false;

View file

@ -57,10 +57,12 @@ var supportedModes = {
Diff: ["diff|patch"],
Dockerfile: ["^Dockerfile"],
Dot: ["dot"],
Eiffel: ["e"],
Erlang: ["erl|hrl"],
EJS: ["ejs"],
Forth: ["frt|fs|ldr"],
FTL: ["ftl"],
Gcode: ["gcode"],
Gherkin: ["feature"],
Gitignore: ["^.gitignore"],
Glsl: ["glsl|frag|vert"],
@ -106,6 +108,7 @@ var supportedModes = {
pgSQL: ["pgsql"],
PHP: ["php|phtml"],
Powershell: ["ps1"],
Praat: ["praat|praatscript|psc|proc"],
Prolog: ["plg|prolog"],
Properties: ["properties"],
Protobuf: ["proto"],
@ -137,7 +140,7 @@ var supportedModes = {
Twig: ["twig"],
Typescript: ["ts|typescript|str"],
Vala: ["vala"],
VBScript: ["vbs"],
VBScript: ["vbs|vb"],
Velocity: ["vm"],
Verilog: ["v|vh|sv|svh"],
XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"],
@ -149,7 +152,7 @@ var nameOverrides = {
ObjectiveC: "Objective-C",
CSharp: "C#",
golang: "Go",
C_Cpp: "C/C++",
C_Cpp: "C and C++",
coffee: "CoffeeScript",
HTML_Ruby: "HTML (Ruby)",
FTL: "FreeMarker"

View file

@ -113,10 +113,12 @@ var supportedModes = {
Diff: ["diff|patch"],
Dockerfile: ["^Dockerfile"],
Dot: ["dot"],
Eiffel: ["e"],
Erlang: ["erl|hrl"],
EJS: ["ejs"],
Forth: ["frt|fs|ldr"],
FTL: ["ftl"],
Gcode: ["gcode"],
Gherkin: ["feature"],
Gitignore: ["^.gitignore"],
Glsl: ["glsl|frag|vert"],
@ -162,6 +164,7 @@ var supportedModes = {
pgSQL: ["pgsql"],
PHP: ["php|phtml"],
Powershell: ["ps1"],
Praat: ["praat|praatscript|psc|proc"],
Prolog: ["plg|prolog"],
Properties: ["properties"],
Protobuf: ["proto"],
@ -193,7 +196,7 @@ var supportedModes = {
Twig: ["twig"],
Typescript: ["ts|typescript|str"],
Vala: ["vala"],
VBScript: ["vbs"],
VBScript: ["vbs|vb"],
Velocity: ["vm"],
Verilog: ["v|vh|sv|svh"],
XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"],
@ -205,7 +208,7 @@ var nameOverrides = {
ObjectiveC: "Objective-C",
CSharp: "C#",
golang: "Go",
C_Cpp: "C/C++",
C_Cpp: "C and C++",
coffee: "CoffeeScript",
HTML_Ruby: "HTML (Ruby)",
FTL: "FreeMarker"

View file

@ -75,7 +75,6 @@ var highlight = function(el, opts, callback) {
callback && callback();
});
};
highlight.render = function(input, mode, theme, lineStart, disableGutter, callback) {
var waiting = 1;
var modeCache = EditSession.prototype.$modes;
@ -86,11 +85,16 @@ highlight.render = function(input, mode, theme, lineStart, disableGutter, callba
--waiting || done();
});
}
var modeOptions;
if (mode && typeof mode === "object" && !mode.getTokenizer) {
modeOptions = mode;
mode = modeOptions.path;
}
if (typeof mode == "string") {
waiting++;
config.loadModule(['mode', mode], function(m) {
if (!modeCache[mode]) modeCache[mode] = new m.Mode();
if (!modeCache[mode] || modeOptions)
modeCache[mode] = new m.Mode(modeOptions);
mode = modeCache[mode];
--waiting || done();
});
@ -101,7 +105,6 @@ highlight.render = function(input, mode, theme, lineStart, disableGutter, callba
}
return --waiting || done();
};
highlight.renderSync = function(input, mode, theme, lineStart, disableGutter) {
lineStart = parseInt(lineStart || 1, 10);

View file

@ -159,11 +159,21 @@ exports.edit = function(el) {
throw new Error("ace.edit can't find div #" + _id);
}
if (el.env && el.env.editor instanceof Editor)
if (el && el.env && el.env.editor instanceof Editor)
return el.env.editor;
var doc = exports.createEditSession(dom.getInnerText(el));
el.innerHTML = '';
var value = "";
if (el && /input|textarea/i.test(el.tagName)) {
var oldNode = el;
value = oldNode.value;
el = dom.createElement("pre");
oldNode.parentNode.replaceChild(el, oldNode);
} else {
value = dom.getInnerText(el);
el.innerHTML = '';
}
var doc = exports.createEditSession(value);
var editor = new Editor(new Renderer(el));
editor.setSession(doc);
@ -173,11 +183,13 @@ exports.edit = function(el) {
editor: editor,
onResize: editor.resize.bind(editor, null)
};
if (oldNode) env.textarea = oldNode;
event.addListener(window, "resize", env.onResize);
editor.on("destroy", function() {
event.removeListener(window, "resize", env.onResize);
env.editor.container.env = null; // prevent memory leak on old ie
});
el.env = editor.env = env;
editor.container.env = editor.env = env;
return editor;
};
exports.createEditSession = function(text, mode) {

View file

@ -41,11 +41,14 @@ exports.$detectIndentation = function(lines, fallback) {
var first = {score: 0, length: 0};
var spaceIndents = 0;
for (var i = 1; i < 12; i++) {
var score = getScore(i);
if (i == 1) {
spaceIndents = getScore(i);
var score = stats.length && 1;
spaceIndents = score;
score = stats[1] ? 0.9 : 0.8;
if (!stats.length)
score = 0
} else
var score = getScore(i) / spaceIndents;
score /= spaceIndents;
if (changes[i])
score += changes[i] / changesTotal;

View file

@ -531,7 +531,7 @@ module.exports = {
var column = util.getRightNthChar(editor, cursor, param, count || 1);
if (isRepeat && column == 0 && !(count > 1))
var column = util.getRightNthChar(editor, cursor, param, 2);
column = util.getRightNthChar(editor, cursor, param, 2);
if (typeof column === "number") {
cursor.column += column + (isSel ? 1 : 0);
@ -549,8 +549,8 @@ module.exports = {
var cursor = editor.getCursorPosition();
var column = util.getLeftNthChar(editor, cursor, param, count || 1);
if (isRepeat && column == 0 && !(count > 1))
var column = util.getLeftNthChar(editor, cursor, param, 2);
if (isRepeat && column === 0 && !(count > 1))
column = util.getLeftNthChar(editor, cursor, param, 2);
if (typeof column === "number") {
cursor.column -= column;
@ -663,7 +663,7 @@ module.exports = {
content += "\n";
if (content.length) {
editor.navigateLineEnd()
editor.navigateLineEnd();
editor.insert(content);
util.insertMode(editor);
}
@ -680,7 +680,7 @@ module.exports = {
if (content.length) {
if(row > 0) {
editor.navigateUp();
editor.navigateLineEnd()
editor.navigateLineEnd();
editor.insert(content);
} else {
editor.session.insert({row: 0, column: 0}, content);

View file

@ -64,8 +64,9 @@ var c_cppHighlightRules = function() {
);
var storageModifiers = (
"const|extern|register|restrict|static|volatile|inline|private:|" +
"protected:|public:|friend|explicit|virtual|export|mutable|typename"
"const|extern|register|restrict|static|volatile|inline|private|" +
"protected|public|friend|explicit|virtual|export|mutable|typename|" +
"constexpr|new|delete"
);
var keywordOperators = (

View file

@ -262,7 +262,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",
@ -1716,7 +1716,11 @@ var TokenIterator = require("../../token_iterator").TokenIterator;
var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
BaseFoldMode.call(this);
this.voidElements = oop.mixin(voidElements || {}, optionalEndTags || {});
this.voidElements = voidElements || {};
this.optionalEndTags = oop.mixin({}, this.voidElements);
if (optionalEndTags)
oop.mixin(this.optionalEndTags, optionalEndTags);
};
oop.inherits(FoldMode, BaseFoldMode);
@ -1857,10 +1861,10 @@ function is(token, type) {
if (!tag || top.tagName == tag.tagName) {
return stack.pop();
}
else if (this.voidElements.hasOwnProperty(tag.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(tag.tagName)) {
return;
}
else if (this.voidElements.hasOwnProperty(top.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
stack.pop();
continue;
} else {

View file

@ -262,7 +262,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",
@ -1716,7 +1716,11 @@ var TokenIterator = require("../../token_iterator").TokenIterator;
var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
BaseFoldMode.call(this);
this.voidElements = oop.mixin(voidElements || {}, optionalEndTags || {});
this.voidElements = voidElements || {};
this.optionalEndTags = oop.mixin({}, this.voidElements);
if (optionalEndTags)
oop.mixin(this.optionalEndTags, optionalEndTags);
};
oop.inherits(FoldMode, BaseFoldMode);
@ -1857,10 +1861,10 @@ function is(token, type) {
if (!tag || top.tagName == tag.tagName) {
return stack.pop();
}
else if (this.voidElements.hasOwnProperty(tag.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(tag.tagName)) {
return;
}
else if (this.voidElements.hasOwnProperty(top.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
stack.pop();
continue;
} else {

View file

@ -64,8 +64,9 @@ var c_cppHighlightRules = function() {
);
var storageModifiers = (
"const|extern|register|restrict|static|volatile|inline|private:|" +
"protected:|public:|friend|explicit|virtual|export|mutable|typename"
"const|extern|register|restrict|static|volatile|inline|private|" +
"protected|public|friend|explicit|virtual|export|mutable|typename|" +
"constexpr|new|delete"
);
var keywordOperators = (
@ -834,7 +835,7 @@ var DartHighlightRules = function() {
},
{
token: "keyword.other.import.dart",
regex: "(?:\\b)(?:library|import|export|part|of)(?:\\b)"
regex: "(?:\\b)(?:library|import|export|part|of|show|hide)(?:\\b)"
},
{
token : ["keyword.other.import.dart", "text"],

View file

@ -262,7 +262,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",
@ -1716,7 +1716,11 @@ var TokenIterator = require("../../token_iterator").TokenIterator;
var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
BaseFoldMode.call(this);
this.voidElements = oop.mixin(voidElements || {}, optionalEndTags || {});
this.voidElements = voidElements || {};
this.optionalEndTags = oop.mixin({}, this.voidElements);
if (optionalEndTags)
oop.mixin(this.optionalEndTags, optionalEndTags);
};
oop.inherits(FoldMode, BaseFoldMode);
@ -1857,10 +1861,10 @@ function is(token, type) {
if (!tag || top.tagName == tag.tagName) {
return stack.pop();
}
else if (this.voidElements.hasOwnProperty(tag.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(tag.tagName)) {
return;
}
else if (this.voidElements.hasOwnProperty(top.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
stack.pop();
continue;
} else {

View file

@ -68,6 +68,62 @@ var ShHighlightRules = function() {
}, {
defaultToken: "string"
}]
}, {
stateName: "heredoc",
onMatch : function(value, currentState, stack) {
var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
var tokens = value.split(this.splitRegex);
stack.push(next, tokens[4]);
return [
{type:"constant", value: tokens[1]},
{type:"text", value: tokens[2]},
{type:"string", value: tokens[3]},
{type:"support.class", value: tokens[4]},
{type:"string", value: tokens[5]}
];
},
regex : "(<<-?)(\\s*)(['\"`]?)([\\w\-]+)(['\"`]?)",
rules: {
heredoc: [{
onMatch: function(value, currentState, stack) {
if (value === stack[1]) {
stack.shift();
stack.shift();
this.next = stack[0] || "start";
return "support.class";
}
this.next = "";
return "string";
},
regex: ".*$",
next: "start"
}],
indentedHeredoc: [{
token: "string",
regex: "^ +"
}, {
onMatch: function(value, currentState, stack) {
if (value === stack[1]) {
stack.shift();
stack.shift();
this.next = stack[0] || "start";
return "support.class";
}
this.next = "";
return "string";
},
regex: ".*$",
next: "start"
}]
}
}, {
regex : "$",
token : "empty",
next : function(currentState, stack) {
if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc")
return stack[0];
return currentState;
}
}, {
token : "variable.language",
regex : builtinVariable
@ -661,7 +717,7 @@ var DockerfileHighlightRules = function() {
for (var i = 0; i < startRules.length; i++) {
if (startRules[i].token == "variable.language") {
startRules.splice(i, 0, {
token: "variable.language",
token: "constant.language",
regex: "(?:^(?:FROM|MAINTAINER|RUN|CMD|EXPOSE|ENV|ADD|ENTRYPOINT|VOLUME|USER|WORKDIR|ONBUILD)\\b)",
caseInsensitive: true
});

135
js/ace/mode-eiffel.js Normal file
View file

@ -0,0 +1,135 @@
ace.define("ace/mode/eiffel_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 EiffelHighlightRules = function() {
var keywords = "across|agent|alias|all|attached|as|assign|attribute|check|" +
"class|convert|create|debug|deferred|detachable|do|else|elseif|end|" +
"ensure|expanded|export|external|feature|from|frozen|if|inherit|" +
"inspect|invariant|like|local|loop|not|note|obsolete|old|once|" +
"Precursor|redefine|rename|require|rescue|retry|select|separate|" +
"some|then|undefine|until|variant|when";
var operatorKeywords = "and|implies|or|xor";
var languageConstants = "Void";
var booleanConstants = "True|False";
var languageVariables = "Current|Result";
var keywordMapper = this.createKeywordMapper({
"constant.language": languageConstants,
"constant.language.boolean": booleanConstants,
"variable.language": languageVariables,
"keyword.operator": operatorKeywords,
"keyword": keywords
}, "identifier", true);
this.$rules = {
"start": [{
token : "comment.line.double-dash",
regex : /--.*$/
}, {
token : "string.quoted.double",
regex : /"(?:%"|[^%])*?"/
}, {
token : "string.quoted.other", // "[ ]" aligned verbatim string
regex : /"\[/,
next: "aligned_verbatim_string"
}, {
token : "string.quoted.other", // "{ }" non-aligned verbatim string
regex : /"\{/,
next: "non-aligned_verbatim_string"
}, {
token : "constant.character",
regex : /'(?:%%|%T|%R|%N|%F|%'|[^%])'/
}, {
token : "constant.numeric", // real
regex : /(?:\d(?:_?\d)*\.|\.\d)(?:\d*[eE][+-]?\d+)?\b/
}, {
token : "constant.numeric", // integer
regex : /\d(?:_?\d)*\b/
}, {
token : "constant.numeric", // hex
regex : /0[xX][a-fA-F\d](?:_?[a-fA-F\d])*\b/
}, {
token : "constant.numeric", // octal
regex : /0[cC][0-7](?:_?[0-7])*\b/
},{
token : "constant.numeric", // bin
regex : /0[bB][01](?:_?[01])*\b/
}, {
token : "keyword.operator",
regex : /\+|\-|\*|\/|\\\\|\/\/|\^|~|\/~|<|>|<=|>=|\/=|=|:=|\|\.\.\||\.\./
}, {
token : "keyword.operator", // punctuation
regex : /\.|:|,|;\b/
}, {
token : function (v) {
var result = keywordMapper (v);
if (result === "identifier" && v === v.toUpperCase ()) {
result = "entity.name.type";
}
return result;
},
regex : /[a-zA-Z][a-zA-Z\d_]*\b/
}, {
token : "paren.lparen",
regex : /[\[({]/
}, {
token : "paren.rparen",
regex : /[\])}]/
}, {
token : "text",
regex : /\s+/
}
],
"aligned_verbatim_string" : [{
token : "string", // closing multi-line comment
regex : /]"/,
next : "start"
}, {
token : "string", // comment spanning whole line
regex : /[^(?:\]")]+/
}
],
"non-aligned_verbatim_string" : [{
token : "string.quoted.other", // closing multi-line comment
regex : /}"/,
next : "start"
}, {
token : "string.quoted.other", // comment spanning whole line
regex : /[^(?:\}")]+/
}
]};
};
oop.inherits(EiffelHighlightRules, TextHighlightRules);
exports.EiffelHighlightRules = EiffelHighlightRules;
});
ace.define("ace/mode/eiffel",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/eiffel_highlight_rules","ace/range"], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var EiffelHighlightRules = require("./eiffel_highlight_rules").EiffelHighlightRules;
var Range = require("../range").Range;
var Mode = function() {
this.HighlightRules = EiffelHighlightRules;
};
oop.inherits(Mode, TextMode);
(function() {
this.lineCommentStart = "--";
this.$id = "ace/mode/eiffel";
}).call(Mode.prototype);
exports.Mode = Mode;
});

View file

@ -406,7 +406,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",
@ -1716,7 +1716,11 @@ var TokenIterator = require("../../token_iterator").TokenIterator;
var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
BaseFoldMode.call(this);
this.voidElements = oop.mixin(voidElements || {}, optionalEndTags || {});
this.voidElements = voidElements || {};
this.optionalEndTags = oop.mixin({}, this.voidElements);
if (optionalEndTags)
oop.mixin(this.optionalEndTags, optionalEndTags);
};
oop.inherits(FoldMode, BaseFoldMode);
@ -1857,10 +1861,10 @@ function is(token, type) {
if (!tag || top.tagName == tag.tagName) {
return stack.pop();
}
else if (this.voidElements.hasOwnProperty(tag.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(tag.tagName)) {
return;
}
else if (this.voidElements.hasOwnProperty(top.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
stack.pop();
continue;
} else {
@ -2619,7 +2623,7 @@ oop.inherits(FoldMode, BaseFoldMode);
});
ace.define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/folding/coffee"], function(require, exports, module) {
ace.define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/coffee"], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
@ -2627,11 +2631,13 @@ var TextMode = require("./text").Mode;
var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var Range = require("../range").Range;
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
var FoldMode = require("./folding/coffee").FoldMode;
var Mode = function() {
this.HighlightRules = RubyHighlightRules;
this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CstyleBehaviour();
this.foldingRules = new FoldMode();
};
oop.inherits(Mode, TextMode);

View file

@ -406,7 +406,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",

85
js/ace/mode-gcode.js Normal file
View file

@ -0,0 +1,85 @@
ace.define("ace/mode/gcode_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 GcodeHighlightRules = function() {
var keywords = (
"IF|DO|WHILE|ENDWHILE|CALL|ENDIF|SUB|ENDSUB|GOTO|REPEAT|ENDREPEAT|CALL"
);
var builtinConstants = (
"PI"
);
var builtinFunctions = (
"ATAN|ABS|ACOS|ASIN|SIN|COS|EXP|FIX|FUP|ROUND|LN|TAN"
);
var keywordMapper = this.createKeywordMapper({
"support.function": builtinFunctions,
"keyword": keywords,
"constant.language": builtinConstants
}, "identifier", true);
this.$rules = {
"start" : [ {
token : "comment",
regex : "\\(.*\\)"
}, {
token : "comment", // block number
regex : "([N])([0-9]+)"
}, {
token : "string", // " string
regex : "([G])([0-9]+\\.?[0-9]?)"
}, {
token : "string", // ' string
regex : "([M])([0-9]+\\.?[0-9]?)"
}, {
token : "constant.numeric", // float
regex : "([-+]?([0-9]*\\.?[0-9]+\\.?))|(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)"
}, {
token : keywordMapper,
regex : "[A-Z]"
}, {
token : "keyword.operator",
regex : "EQ|LT|GT|NE|GE|LE|OR|XOR"
}, {
token : "paren.lparen",
regex : "[\\[]"
}, {
token : "paren.rparen",
regex : "[\\]]"
}, {
token : "text",
regex : "\\s+"
} ]
};
};
oop.inherits(GcodeHighlightRules, TextHighlightRules);
exports.GcodeHighlightRules = GcodeHighlightRules;
});
ace.define("ace/mode/gcode",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/gcode_highlight_rules","ace/range"], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var GcodeHighlightRules = require("./gcode_highlight_rules").GcodeHighlightRules;
var Range = require("../range").Range;
var Mode = function() {
this.HighlightRules = GcodeHighlightRules;
};
oop.inherits(Mode, TextMode);
(function() {
this.$id = "ace/mode/gcode";
}).call(Mode.prototype);
exports.Mode = Mode;
});

View file

@ -64,8 +64,9 @@ var c_cppHighlightRules = function() {
);
var storageModifiers = (
"const|extern|register|restrict|static|volatile|inline|private:|" +
"protected:|public:|friend|explicit|virtual|export|mutable|typename"
"const|extern|register|restrict|static|volatile|inline|private|" +
"protected|public|friend|explicit|virtual|export|mutable|typename|" +
"constexpr|new|delete"
);
var keywordOperators = (

View file

@ -262,7 +262,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",

View file

@ -262,7 +262,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",
@ -1716,7 +1716,11 @@ var TokenIterator = require("../../token_iterator").TokenIterator;
var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
BaseFoldMode.call(this);
this.voidElements = oop.mixin(voidElements || {}, optionalEndTags || {});
this.voidElements = voidElements || {};
this.optionalEndTags = oop.mixin({}, this.voidElements);
if (optionalEndTags)
oop.mixin(this.optionalEndTags, optionalEndTags);
};
oop.inherits(FoldMode, BaseFoldMode);
@ -1857,10 +1861,10 @@ function is(token, type) {
if (!tag || top.tagName == tag.tagName) {
return stack.pop();
}
else if (this.voidElements.hasOwnProperty(tag.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(tag.tagName)) {
return;
}
else if (this.voidElements.hasOwnProperty(top.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
stack.pop();
continue;
} else {

View file

@ -262,7 +262,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",
@ -1716,7 +1716,11 @@ var TokenIterator = require("../../token_iterator").TokenIterator;
var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
BaseFoldMode.call(this);
this.voidElements = oop.mixin(voidElements || {}, optionalEndTags || {});
this.voidElements = voidElements || {};
this.optionalEndTags = oop.mixin({}, this.voidElements);
if (optionalEndTags)
oop.mixin(this.optionalEndTags, optionalEndTags);
};
oop.inherits(FoldMode, BaseFoldMode);
@ -1857,10 +1861,10 @@ function is(token, type) {
if (!tag || top.tagName == tag.tagName) {
return stack.pop();
}
else if (this.voidElements.hasOwnProperty(tag.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(tag.tagName)) {
return;
}
else if (this.voidElements.hasOwnProperty(top.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
stack.pop();
continue;
} else {

View file

@ -406,7 +406,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",
@ -1996,7 +1996,11 @@ var TokenIterator = require("../../token_iterator").TokenIterator;
var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
BaseFoldMode.call(this);
this.voidElements = oop.mixin(voidElements || {}, optionalEndTags || {});
this.voidElements = voidElements || {};
this.optionalEndTags = oop.mixin({}, this.voidElements);
if (optionalEndTags)
oop.mixin(this.optionalEndTags, optionalEndTags);
};
oop.inherits(FoldMode, BaseFoldMode);
@ -2137,10 +2141,10 @@ function is(token, type) {
if (!tag || top.tagName == tag.tagName) {
return stack.pop();
}
else if (this.voidElements.hasOwnProperty(tag.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(tag.tagName)) {
return;
}
else if (this.voidElements.hasOwnProperty(top.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
stack.pop();
continue;
} else {
@ -2674,7 +2678,7 @@ oop.inherits(FoldMode, BaseFoldMode);
});
ace.define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/folding/coffee"], function(require, exports, module) {
ace.define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/coffee"], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
@ -2682,11 +2686,13 @@ var TextMode = require("./text").Mode;
var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var Range = require("../range").Range;
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
var FoldMode = require("./folding/coffee").FoldMode;
var Mode = function() {
this.HighlightRules = RubyHighlightRules;
this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CstyleBehaviour();
this.foldingRules = new FoldMode();
};
oop.inherits(Mode, TextMode);

View file

@ -262,7 +262,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",

View file

@ -262,7 +262,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",

View file

@ -262,7 +262,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",

View file

@ -406,7 +406,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",

View file

@ -4,11 +4,24 @@ ace.define("ace/mode/latex_highlight_rules",["require","exports","module","ace/l
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var LatexHighlightRules = function() {
var LatexHighlightRules = function() {
this.$rules = {
"start" : [{
token : "keyword",
regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)"
token : "comment",
regex : "%.*$"
}, {
token : ["keyword", "lparen", "variable.parameter", "rparen", "lparen", "storage.type", "rparen"],
regex : "(\\\\(?:documentclass|usepackage|input))(?:(\\[)([^\\]]*)(\\]))?({)([^}]*)(})"
}, {
token : ["keyword","lparen", "variable.parameter", "rparen"],
regex : "(\\\\label)(?:({)([^}]*)(}))?"
}, {
token : ["storage.type", "lparen", "variable.parameter", "rparen"],
regex : "(\\\\(?:begin|end))({)(\\w*)(})"
}, {
token : "storage.type",
regex : "\\\\[a-zA-Z]+"
}, {
token : "lparen",
regex : "[[({]"
@ -16,15 +29,33 @@ var LatexHighlightRules = function() {
token : "rparen",
regex : "[\\])}]"
}, {
token : "string",
regex : "\\$(?:(?:\\\\.)|(?:[^\\$\\\\]))*?\\$"
token : "constant.character.escape",
regex : "\\\\[^a-zA-Z]?"
}, {
token : "string",
regex : "\\${1,2}",
next : "equation"
}],
"equation" : [{
token : "comment",
regex : "%.*$"
}, {
token : "string",
regex : "\\${1,2}",
next : "start"
}, {
token : "constant.character.escape",
regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)"
}, {
token : "error",
regex : "^\\s*$",
next : "start"
}, {
defaultToken : "string"
}]
};
};
oop.inherits(LatexHighlightRules, TextHighlightRules);
exports.LatexHighlightRules = LatexHighlightRules;
@ -45,7 +76,7 @@ oop.inherits(FoldMode, BaseFoldMode);
(function() {
this.foldingStartMarker = /^\s*\\(begin)|(section|subsection)\b|{\s*$/;
this.foldingStartMarker = /^\s*\\(begin)|(section|subsection|paragraph)\b|{\s*$/;
this.foldingStopMarker = /^\s*\\(end)\b|^\s*}/;
this.getFoldWidgetRange = function(session, foldStyle, row) {
@ -77,7 +108,7 @@ oop.inherits(FoldMode, BaseFoldMode);
var stream = new TokenIterator(session, row, column);
var token = stream.getCurrentToken();
if (!token || token.type !== "keyword")
if (!token || !(token.type == "storage.type" || token.type == "constant.character.escape"))
return;
var val = token.value;
@ -99,7 +130,7 @@ oop.inherits(FoldMode, BaseFoldMode);
stream.step = dir === -1 ? stream.stepBackward : stream.stepForward;
while(token = stream.step()) {
if (token.type !== "keyword")
if (!token || !(token.type == "storage.type" || token.type == "constant.character.escape"))
continue;
var level = keywords[token.value];
if (!level)
@ -122,11 +153,11 @@ oop.inherits(FoldMode, BaseFoldMode);
};
this.latexSection = function(session, row, column) {
var keywords = ["\\subsection", "\\section", "\\begin", "\\end"];
var keywords = ["\\subsection", "\\section", "\\begin", "\\end", "\\paragraph"];
var stream = new TokenIterator(session, row, column);
var token = stream.getCurrentToken();
if (!token || token.type != "keyword")
if (!token || token.type != "storage.type")
return;
var startLevel = keywords.indexOf(token.value);
@ -134,7 +165,7 @@ oop.inherits(FoldMode, BaseFoldMode);
var endRow = row;
while(token = stream.stepForward()) {
if (token.type !== "keyword")
if (token.type !== "storage.type")
continue;
var level = keywords.indexOf(token.value);
@ -180,6 +211,8 @@ var Mode = function() {
oop.inherits(Mode, TextMode);
(function() {
this.type = "text";
this.lineCommentStart = "%";
this.$id = "ace/mode/latex";

View file

@ -406,7 +406,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",

File diff suppressed because one or more lines are too long

View file

@ -262,7 +262,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",
@ -1716,7 +1716,11 @@ var TokenIterator = require("../../token_iterator").TokenIterator;
var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
BaseFoldMode.call(this);
this.voidElements = oop.mixin(voidElements || {}, optionalEndTags || {});
this.voidElements = voidElements || {};
this.optionalEndTags = oop.mixin({}, this.voidElements);
if (optionalEndTags)
oop.mixin(this.optionalEndTags, optionalEndTags);
};
oop.inherits(FoldMode, BaseFoldMode);
@ -1857,10 +1861,10 @@ function is(token, type) {
if (!tag || top.tagName == tag.tagName) {
return stack.pop();
}
else if (this.voidElements.hasOwnProperty(tag.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(tag.tagName)) {
return;
}
else if (this.voidElements.hasOwnProperty(top.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
stack.pop();
continue;
} else {

View file

@ -68,6 +68,62 @@ var ShHighlightRules = function() {
}, {
defaultToken: "string"
}]
}, {
stateName: "heredoc",
onMatch : function(value, currentState, stack) {
var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
var tokens = value.split(this.splitRegex);
stack.push(next, tokens[4]);
return [
{type:"constant", value: tokens[1]},
{type:"text", value: tokens[2]},
{type:"string", value: tokens[3]},
{type:"support.class", value: tokens[4]},
{type:"string", value: tokens[5]}
];
},
regex : "(<<-?)(\\s*)(['\"`]?)([\\w\-]+)(['\"`]?)",
rules: {
heredoc: [{
onMatch: function(value, currentState, stack) {
if (value === stack[1]) {
stack.shift();
stack.shift();
this.next = stack[0] || "start";
return "support.class";
}
this.next = "";
return "string";
},
regex: ".*$",
next: "start"
}],
indentedHeredoc: [{
token: "string",
regex: "^ +"
}, {
onMatch: function(value, currentState, stack) {
if (value === stack[1]) {
stack.shift();
stack.shift();
this.next = stack[0] || "start";
return "support.class";
}
this.next = "";
return "string";
},
regex: ".*$",
next: "start"
}]
}
}, {
regex : "$",
token : "empty",
next : function(currentState, stack) {
if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc")
return stack[0];
return currentState;
}
}, {
token : "variable.language",
regex : builtinVariable

View file

@ -262,7 +262,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",
@ -1288,7 +1288,11 @@ var TokenIterator = require("../../token_iterator").TokenIterator;
var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
BaseFoldMode.call(this);
this.voidElements = oop.mixin(voidElements || {}, optionalEndTags || {});
this.voidElements = voidElements || {};
this.optionalEndTags = oop.mixin({}, this.voidElements);
if (optionalEndTags)
oop.mixin(this.optionalEndTags, optionalEndTags);
};
oop.inherits(FoldMode, BaseFoldMode);
@ -1429,10 +1433,10 @@ function is(token, type) {
if (!tag || top.tagName == tag.tagName) {
return stack.pop();
}
else if (this.voidElements.hasOwnProperty(tag.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(tag.tagName)) {
return;
}
else if (this.voidElements.hasOwnProperty(top.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
stack.pop();
continue;
} else {

View file

@ -64,8 +64,9 @@ var c_cppHighlightRules = function() {
);
var storageModifiers = (
"const|extern|register|restrict|static|volatile|inline|private:|" +
"protected:|public:|friend|explicit|virtual|export|mutable|typename"
"const|extern|register|restrict|static|volatile|inline|private|" +
"protected|public|friend|explicit|virtual|export|mutable|typename|" +
"constexpr|new|delete"
);
var keywordOperators = (

View file

@ -64,8 +64,9 @@ var c_cppHighlightRules = function() {
);
var storageModifiers = (
"const|extern|register|restrict|static|volatile|inline|private:|" +
"protected:|public:|friend|explicit|virtual|export|mutable|typename"
"const|extern|register|restrict|static|volatile|inline|private|" +
"protected|public|friend|explicit|virtual|export|mutable|typename|" +
"constexpr|new|delete"
);
var keywordOperators = (

View file

@ -619,7 +619,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",

View file

@ -406,7 +406,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",
@ -1756,7 +1756,7 @@ var PhpLangHighlightRules = function() {
return "string";
stack.shift();
stack.shift();
return "markup.list"
return "markup.list";
},
regex : "^\\w+(?=;?$)",
next: "start"
@ -1767,12 +1767,11 @@ var PhpLangHighlightRules = function() {
],
"comment" : [
{
token : "comment", // closing comment
regex : ".*?\\*\\/",
token : "comment",
regex : "\\*\\/",
next : "start"
}, {
token : "comment", // comment spanning whole line
regex : ".+"
defaultToken : "comment"
}
],
"qqstring" : [
@ -1780,10 +1779,10 @@ var PhpLangHighlightRules = function() {
token : "constant.language.escape",
regex : '\\\\(?:[nrtvef\\\\"$]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2})'
}, {
token : "constant.language.escape",
regex : /\$[\w]+(?:\[[\w\]+]|=>\w+)?/
token : "variable",
regex : /\$[\w]+(?:\[[\w\]+]|[=\-]>\w+)?/
}, {
token : "constant.language.escape",
token : "variable",
regex : /\$\{[^"\}]+\}?/ // this is wrong but ok for now
},
{token : "string", regex : '"', next : "start"},

418
js/ace/mode-praat.js Normal file
View file

@ -0,0 +1,418 @@
ace.define("ace/mode/praat_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 PraatHighlightRules = function() {
var keywords = (
"if|then|else|elsif|elif|endif|fi|" +
"endfor|endproc|" + // related keywords specified below
"while|endwhile|" +
"repeat|until|" +
"select|plus|minus|" +
"assert"
);
var predefinedVariables = (
"macintosh|windows|unix|" +
"praatVersion|praatVersion\\$" +
"pi|undefined|" +
"newline\\$|tab\\$|" +
"shellDirectory\\$|homeDirectory\\$|preferencesDirectory\\$|" +
"temporaryDirectory\\$|defaultDirectory\\$"
);
var directives = (
"clearinfo|endSendPraat"
);
var functions = (
"writeInfo|writeInfoLine|appendInfo|appendInfoLine|" +
"writeFile|writeFileLine|appendFile|appendFileLine|" +
"abs|round|floor|ceiling|min|max|imin|imax|" +
"sqrt|sin|cos|tan|arcsin|arccos|arctan|arctan2|sinc|sincpi|" +
"exp|ln|log10|log2|" +
"sinh|cosh|tanh|arcsinh|arccosh|actanh|" +
"sigmoid|invSigmoid|erf|erfc|" +
"randomUniform|randomInteger|randomGauss|randomPoisson|" +
"lnGamma|gaussP|gaussQ|invGaussQ|" +
"chiSquareP|chiSquareQ|invChiSquareQ|studentP|studentQ|invStudentQ|" +
"fisherP|fisherQ|invFisherQ|" +
"binomialP|binomialQ|invBinomialP|invBinomialQ|" +
"hertzToBark|barkToHerz|" +
"hertzToMel|melToHertz|" +
"hertzToSemitones|semitonesToHerz|" +
"erb|hertzToErb|erbToHertz|" +
"phonToDifferenceLimens|differenceLimensToPhon|" +
"beta|besselI|besselK|" +
"selected|selected\\$|numberOfSelected|variableExists|"+
"index|rindex|startsWith|endsWith|"+
"index_regex|rindex_regex|replace_regex\\$|"+
"length|extractWord\\$|extractLine\\$|extractNumber|" +
"left\\$|right\\$|mid\\$|replace\\$|" +
"beginPause|endPause|" +
"demoShow|demoWindowTitle|demoInput|demoWaitForInput|" +
"demoClicked|demoClickedIn|demoX|demoY|" +
"demoKeyPressed|demoKey\\$|" +
"demoExtraControlKeyPressed|demoShiftKeyPressed|"+
"demoCommandKeyPressed|demoOptionKeyPressed|" +
"environment\\$|chooseReadFile\\$|" +
"chooseDirectory\\$|createDirectory|fileReadable|deleteFile|" +
"selectObject|removeObject|plusObject|minusObject|" +
"runScript|exitScript|" +
"beginSendPraat|endSendPraat"
);
var objectTypes = (
"Activation|AffineTransform|AmplitudeTier|Art|Artword|Autosegment|" +
"BarkFilter|CCA|Categories|Cepstrum|Cepstrumc|ChebyshevSeries|" +
"ClassificationTable|Cochleagram|Collection|Configuration|" +
"Confusion|ContingencyTable|Corpus|Correlation|Covariance|" +
"CrossCorrelationTable|CrossCorrelationTables|DTW|Diagonalizer|" +
"Discriminant|Dissimilarity|Distance|Distributions|DurationTier|" +
"EEG|ERP|ERPTier|Eigen|Excitation|Excitations|ExperimentMFC|FFNet|" +
"FeatureWeights|Formant|FormantFilter|FormantGrid|FormantPoint|" +
"FormantTier|GaussianMixture|HMM|HMM_Observation|" +
"HMM_ObservationSequence|HMM_State|HMM_StateSequence|Harmonicity|" +
"ISpline|Index|Intensity|IntensityTier|IntervalTier|KNN|KlattGrid|" +
"KlattTable|LFCC|LPC|Label|LegendreSeries|LinearRegression|" +
"LogisticRegression|LongSound|Ltas|MFCC|MSpline|ManPages|" +
"Manipulation|Matrix|MelFilter|MixingMatrix|Movie|Network|" +
"OTGrammar|OTHistory|OTMulti|PCA|PairDistribution|ParamCurve|" +
"Pattern|Permutation|Pitch|PitchTier|PointProcess|Polygon|" +
"Polynomial|Procrustes|RealPoint|RealTier|ResultsMFC|Roots|SPINET|" +
"SSCP|SVD|Salience|ScalarProduct|Similarity|SimpleString|" +
"SortedSetOfString|Sound|Speaker|Spectrogram|Spectrum|SpectrumTier|" +
"SpeechSynthesizer|SpellingChecker|Strings|StringsIndex|Table|" +
"TableOfReal|TextGrid|TextInterval|TextPoint|TextTier|Tier|" +
"Transition|VocalTract|Weight|WordList"
);
this.$rules = {
"start" : [
{
token : "string.interpolated",
regex : /'((?:[a-z][a-zA-Z0-9_]*)(?:\$|#|:[0-9]+)?)'/
}, {
token : ["text", "text", "keyword.operator", "text", "keyword"],
regex : /(^\s*)(?:([a-z][a-zA-Z0-9_]*\$?\s+)(=)(\s+))?(stopwatch)/
}, {
token : ["text", "keyword", "text", "string"],
regex : /(^\s*)(print(?:line)?|echo|exit|pause|sendpraat|include|execute)(\s+)(.*)/
}, {
token : ["text", "keyword"],
regex : "(^\\s*)(" + directives + ")$"
}, {
token : ["text", "keyword.operator", "text"],
regex : /(\s+)((?:\+|-|\/|\*|<|>)=?|==?|!=|%|\^|\||and|or|not)(\s+)/
}, {
token : ["text", "text", "keyword.operator", "text", "keyword", "text", "keyword"],
regex : /(^\s*)(?:([a-z][a-zA-Z0-9_]*\$?\s+)(=)(\s+))?(?:((?:no)?warn|nocheck|noprogress)(\s+))?((?:[A-Z][^.:"]+)(?:$|(?:\.{3}|:)))/
}, {
token : ["text", "keyword", "text", "keyword"],
regex : /(^\s*)(?:(demo)?(\s+))((?:[A-Z][^.:"]+)(?:$|(?:\.{3}|:)))/
}, {
token : ["text", "keyword", "text", "keyword"],
regex : /^(\s*)(?:(demo)(\s+))?(10|12|14|16|24)$/
}, {
token : ["text", "support.function", "text"],
regex : /(\s*)(do\$?)(\s*:\s*|\s*\(\s*)/
}, {
token : "entity.name.type",
regex : "(" + objectTypes + ")"
}, {
token : "variable.language",
regex : "(" + predefinedVariables + ")"
}, {
token : ["support.function", "text"],
regex : "((?:" + functions + ")\\$?)(\\s*(?::|\\())"
}, {
token : "keyword",
regex : /(\bfor\b)/,
next : "for"
}, {
token : "keyword",
regex : "(\\b(?:" + keywords + ")\\b)"
}, {
token : "string",
regex : /"[^"]*"/
}, {
token : "string",
regex : /"[^"]*$/,
next : "brokenstring"
}, {
token : ["text", "keyword", "text", "entity.name.section"],
regex : /(^\s*)(\bform\b)(\s+)(.*)/,
next : "form"
}, {
token : "constant.numeric",
regex : /\b[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
}, {
token : ["keyword", "text", "entity.name.function"],
regex : /(procedure)(\s+)(\S+)/
}, {
token : ["entity.name.function", "text"],
regex : /(@\S+)(:|\s*\()/
}, {
token : ["text", "keyword", "text", "entity.name.function"],
regex : /(^\s*)(call)(\s+)(\S+)/
}, {
token : "comment",
regex : /(^\s*#|;).*$/
}, {
token : "text",
regex : /\s+/
}
],
"form" : [
{
token : ["keyword", "text", "constant.numeric"],
regex : /((?:optionmenu|choice)\s+)(\S+:\s+)([0-9]+)/
}, {
token : ["keyword", "constant.numeric"],
regex : /((?:option|button)\s+)([+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b)/
}, {
token : ["keyword", "string"],
regex : /((?:option|button)\s+)(.*)/
}, {
token : ["keyword", "text", "string"],
regex : /((?:sentence|text)\s+)(\S+\s*)(.*)/
}, {
token : ["keyword", "text", "string", "invalid.illegal"],
regex : /(word\s+)(\S+\s*)(\S+)?(\s.*)?/
}, {
token : ["keyword", "text", "constant.language"],
regex : /(boolean\s+)(\S+\s*)(0|1|"?(?:yes|no)"?)/
}, {
token : ["keyword", "text", "constant.numeric"],
regex : /((?:real|natural|positive|integer)\s+)(\S+\s*)([+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b)/
}, {
token : ["keyword", "string"],
regex : /(comment\s+)(.*)/
}, {
token : "keyword",
regex : 'endform',
next : "start"
}
],
"for" : [
{
token : ["keyword", "text", "constant.numeric", "text"],
regex : /(from|to)(\s+)([+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?)(\s*)/
}, {
token : ["keyword", "text"],
regex : /(from|to)(\s+\S+\s*)/
}, {
token : "text",
regex : /$/,
next : "start"
}
],
"brokenstring" : [
{
token : ["text", "string"],
regex : /(\s*\.{3})([^"]*)/
}, {
token : "string",
regex : /"/,
next : "start"
}
],
};
};
oop.inherits(PraatHighlightRules, TextHighlightRules);
exports.PraatHighlightRules = PraatHighlightRules;
});
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) {
return line.match(/^\s*/)[0];
};
}).call(MatchingBraceOutdent.prototype);
exports.MatchingBraceOutdent = MatchingBraceOutdent;
});
ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
"use strict";
var oop = require("../../lib/oop");
var Range = require("../../range").Range;
var BaseFoldMode = require("./fold_mode").FoldMode;
var FoldMode = exports.FoldMode = function(commentRegex) {
if (commentRegex) {
this.foldingStartMarker = new RegExp(
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
);
this.foldingStopMarker = new RegExp(
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
);
}
};
oop.inherits(FoldMode, BaseFoldMode);
(function() {
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
var line = session.getLine(row);
var match = line.match(this.foldingStartMarker);
if (match) {
var i = match.index;
if (match[1])
return this.openingBracketBlock(session, match[1], row, i);
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
if (range && !range.isMultiLine()) {
if (forceMultiline) {
range = this.getSectionRange(session, row);
} else if (foldStyle != "all")
range = null;
}
return range;
}
if (foldStyle === "markbegin")
return;
var match = line.match(this.foldingStopMarker);
if (match) {
var i = match.index + match[0].length;
if (match[1])
return this.closingBracketBlock(session, match[1], row, i);
return session.getCommentFoldRange(row, i, -1);
}
};
this.getSectionRange = function(session, row) {
var line = session.getLine(row);
var startIndent = line.search(/\S/);
var startRow = row;
var startColumn = line.length;
row = row + 1;
var endRow = row;
var maxRow = session.getLength();
while (++row < maxRow) {
line = session.getLine(row);
var indent = line.search(/\S/);
if (indent === -1)
continue;
if (startIndent > indent)
break;
var subRange = this.getFoldWidgetRange(session, "all", row);
if (subRange) {
if (subRange.start.row <= startRow) {
break;
} else if (subRange.isMultiLine()) {
row = subRange.end.row;
} else if (startIndent == indent) {
break;
}
}
endRow = row;
}
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
};
}).call(FoldMode.prototype);
});
ace.define("ace/mode/praat",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/praat_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/folding/cstyle"], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var PraatHighlightRules = require("./praat_highlight_rules").PraatHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var Range = require("../range").Range;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
this.HighlightRules = PraatHighlightRules;
this.$outdent = new MatchingBraceOutdent();
};
oop.inherits(Mode, TextMode);
(function() {
this.lineCommentStart = "#";
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
if (tokens.length && tokens[tokens.length-1].type == "comment") {
return indent;
}
if (state == "start") {
var match = line.match(/^.*[\{\(\[\:]\s*$/);
if (match) {
indent += tab;
}
}
return indent;
};
this.checkOutdent = function(state, line, input) {
return this.$outdent.checkOutdent(line, input);
};
this.autoOutdent = function(state, doc, row) {
this.$outdent.autoOutdent(doc, row);
};
this.$id = "ace/mode/praat";
}).call(Mode.prototype);
exports.Mode = Mode;
});

View file

@ -64,8 +64,9 @@ var c_cppHighlightRules = function() {
);
var storageModifiers = (
"const|extern|register|restrict|static|volatile|inline|private:|" +
"protected:|public:|friend|explicit|virtual|export|mutable|typename"
"const|extern|register|restrict|static|volatile|inline|private|" +
"protected|public|friend|explicit|virtual|export|mutable|typename|" +
"constexpr|new|delete"
);
var keywordOperators = (

View file

@ -4,11 +4,24 @@ ace.define("ace/mode/latex_highlight_rules",["require","exports","module","ace/l
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var LatexHighlightRules = function() {
var LatexHighlightRules = function() {
this.$rules = {
"start" : [{
token : "keyword",
regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)"
token : "comment",
regex : "%.*$"
}, {
token : ["keyword", "lparen", "variable.parameter", "rparen", "lparen", "storage.type", "rparen"],
regex : "(\\\\(?:documentclass|usepackage|input))(?:(\\[)([^\\]]*)(\\]))?({)([^}]*)(})"
}, {
token : ["keyword","lparen", "variable.parameter", "rparen"],
regex : "(\\\\label)(?:({)([^}]*)(}))?"
}, {
token : ["storage.type", "lparen", "variable.parameter", "rparen"],
regex : "(\\\\(?:begin|end))({)(\\w*)(})"
}, {
token : "storage.type",
regex : "\\\\[a-zA-Z]+"
}, {
token : "lparen",
regex : "[[({]"
@ -16,15 +29,33 @@ var LatexHighlightRules = function() {
token : "rparen",
regex : "[\\])}]"
}, {
token : "string",
regex : "\\$(?:(?:\\\\.)|(?:[^\\$\\\\]))*?\\$"
token : "constant.character.escape",
regex : "\\\\[^a-zA-Z]?"
}, {
token : "string",
regex : "\\${1,2}",
next : "equation"
}],
"equation" : [{
token : "comment",
regex : "%.*$"
}, {
token : "string",
regex : "\\${1,2}",
next : "start"
}, {
token : "constant.character.escape",
regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)"
}, {
token : "error",
regex : "^\\s*$",
next : "start"
}, {
defaultToken : "string"
}]
};
};
oop.inherits(LatexHighlightRules, TextHighlightRules);
exports.LatexHighlightRules = LatexHighlightRules;

View file

@ -262,7 +262,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",
@ -1716,7 +1716,11 @@ var TokenIterator = require("../../token_iterator").TokenIterator;
var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
BaseFoldMode.call(this);
this.voidElements = oop.mixin(voidElements || {}, optionalEndTags || {});
this.voidElements = voidElements || {};
this.optionalEndTags = oop.mixin({}, this.voidElements);
if (optionalEndTags)
oop.mixin(this.optionalEndTags, optionalEndTags);
};
oop.inherits(FoldMode, BaseFoldMode);
@ -1857,10 +1861,10 @@ function is(token, type) {
if (!tag || top.tagName == tag.tagName) {
return stack.pop();
}
else if (this.voidElements.hasOwnProperty(tag.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(tag.tagName)) {
return;
}
else if (this.voidElements.hasOwnProperty(top.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
stack.pop();
continue;
} else {

View file

@ -263,6 +263,364 @@ var MatchingBraceOutdent = function() {};
exports.MatchingBraceOutdent = MatchingBraceOutdent;
});
ace.define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
"use strict";
var oop = require("../../lib/oop");
var Behaviour = require("../behaviour").Behaviour;
var TokenIterator = require("../../token_iterator").TokenIterator;
var lang = require("../../lib/lang");
var SAFE_INSERT_IN_TOKENS =
["text", "paren.rparen", "punctuation.operator"];
var SAFE_INSERT_BEFORE_TOKENS =
["text", "paren.rparen", "punctuation.operator", "comment"];
var context;
var contextCache = {}
var initContext = function(editor) {
var id = -1;
if (editor.multiSelect) {
id = editor.selection.id;
if (contextCache.rangeCount != editor.multiSelect.rangeCount)
contextCache = {rangeCount: editor.multiSelect.rangeCount};
}
if (contextCache[id])
return context = contextCache[id];
context = contextCache[id] = {
autoInsertedBrackets: 0,
autoInsertedRow: -1,
autoInsertedLineEnd: "",
maybeInsertedBrackets: 0,
maybeInsertedRow: -1,
maybeInsertedLineStart: "",
maybeInsertedLineEnd: ""
};
};
var CstyleBehaviour = function() {
this.add("braces", "insertion", function(state, action, editor, session, text) {
var cursor = editor.getCursorPosition();
var line = session.doc.getLine(cursor.row);
if (text == '{') {
initContext(editor);
var selection = editor.getSelectionRange();
var selected = session.doc.getTextRange(selection);
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
return {
text: '{' + selected + '}',
selection: false
};
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
CstyleBehaviour.recordAutoInsert(editor, session, "}");
return {
text: '{}',
selection: [1, 1]
};
} else {
CstyleBehaviour.recordMaybeInsert(editor, session, "{");
return {
text: '{',
selection: [1, 1]
};
}
}
} else if (text == '}') {
initContext(editor);
var rightChar = line.substring(cursor.column, cursor.column + 1);
if (rightChar == '}') {
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
CstyleBehaviour.popAutoInsertedClosing();
return {
text: '',
selection: [1, 1]
};
}
}
} else if (text == "\n" || text == "\r\n") {
initContext(editor);
var closing = "";
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
CstyleBehaviour.clearMaybeInsertedClosing();
}
var rightChar = line.substring(cursor.column, cursor.column + 1);
if (rightChar === '}') {
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
if (!openBracePos)
return null;
var next_indent = this.$getIndent(session.getLine(openBracePos.row));
} else if (closing) {
var next_indent = this.$getIndent(line);
} else {
CstyleBehaviour.clearMaybeInsertedClosing();
return;
}
var indent = next_indent + session.getTabString();
return {
text: '\n' + indent + '\n' + next_indent + closing,
selection: [1, indent.length, 1, indent.length]
};
} else {
CstyleBehaviour.clearMaybeInsertedClosing();
}
});
this.add("braces", "deletion", function(state, action, editor, session, range) {
var selected = session.doc.getTextRange(range);
if (!range.isMultiLine() && selected == '{') {
initContext(editor);
var line = session.doc.getLine(range.start.row);
var rightChar = line.substring(range.end.column, range.end.column + 1);
if (rightChar == '}') {
range.end.column++;
return range;
} else {
context.maybeInsertedBrackets--;
}
}
});
this.add("parens", "insertion", function(state, action, editor, session, text) {
if (text == '(') {
initContext(editor);
var selection = editor.getSelectionRange();
var selected = session.doc.getTextRange(selection);
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
return {
text: '(' + selected + ')',
selection: false
};
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
CstyleBehaviour.recordAutoInsert(editor, session, ")");
return {
text: '()',
selection: [1, 1]
};
}
} else if (text == ')') {
initContext(editor);
var cursor = editor.getCursorPosition();
var line = session.doc.getLine(cursor.row);
var rightChar = line.substring(cursor.column, cursor.column + 1);
if (rightChar == ')') {
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
CstyleBehaviour.popAutoInsertedClosing();
return {
text: '',
selection: [1, 1]
};
}
}
}
});
this.add("parens", "deletion", function(state, action, editor, session, range) {
var selected = session.doc.getTextRange(range);
if (!range.isMultiLine() && selected == '(') {
initContext(editor);
var line = session.doc.getLine(range.start.row);
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
if (rightChar == ')') {
range.end.column++;
return range;
}
}
});
this.add("brackets", "insertion", function(state, action, editor, session, text) {
if (text == '[') {
initContext(editor);
var selection = editor.getSelectionRange();
var selected = session.doc.getTextRange(selection);
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
return {
text: '[' + selected + ']',
selection: false
};
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
CstyleBehaviour.recordAutoInsert(editor, session, "]");
return {
text: '[]',
selection: [1, 1]
};
}
} else if (text == ']') {
initContext(editor);
var cursor = editor.getCursorPosition();
var line = session.doc.getLine(cursor.row);
var rightChar = line.substring(cursor.column, cursor.column + 1);
if (rightChar == ']') {
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
CstyleBehaviour.popAutoInsertedClosing();
return {
text: '',
selection: [1, 1]
};
}
}
}
});
this.add("brackets", "deletion", function(state, action, editor, session, range) {
var selected = session.doc.getTextRange(range);
if (!range.isMultiLine() && selected == '[') {
initContext(editor);
var line = session.doc.getLine(range.start.row);
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
if (rightChar == ']') {
range.end.column++;
return range;
}
}
});
this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
if (text == '"' || text == "'") {
initContext(editor);
var quote = text;
var selection = editor.getSelectionRange();
var selected = session.doc.getTextRange(selection);
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
return {
text: quote + selected + quote,
selection: false
};
} else {
var cursor = editor.getCursorPosition();
var line = session.doc.getLine(cursor.row);
var leftChar = line.substring(cursor.column-1, cursor.column);
if (leftChar == '\\') {
return null;
}
var tokens = session.getTokens(selection.start.row);
var col = 0, token;
var quotepos = -1; // Track whether we're inside an open quote.
for (var x = 0; x < tokens.length; x++) {
token = tokens[x];
if (token.type == "string") {
quotepos = -1;
} else if (quotepos < 0) {
quotepos = token.value.indexOf(quote);
}
if ((token.value.length + col) > selection.start.column) {
break;
}
col += tokens[x].value.length;
}
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
if (!CstyleBehaviour.isSaneInsertion(editor, session))
return;
return {
text: quote + quote,
selection: [1,1]
};
} else if (token && token.type === "string") {
var rightChar = line.substring(cursor.column, cursor.column + 1);
if (rightChar == quote) {
return {
text: '',
selection: [1, 1]
};
}
}
}
}
});
this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
var selected = session.doc.getTextRange(range);
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
initContext(editor);
var line = session.doc.getLine(range.start.row);
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
if (rightChar == selected) {
range.end.column++;
return range;
}
}
});
};
CstyleBehaviour.isSaneInsertion = function(editor, session) {
var cursor = editor.getCursorPosition();
var iterator = new TokenIterator(session, cursor.row, cursor.column);
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
return false;
}
iterator.stepForward();
return iterator.getCurrentTokenRow() !== cursor.row ||
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
};
CstyleBehaviour.$matchTokenType = function(token, types) {
return types.indexOf(token.type || token) > -1;
};
CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
var cursor = editor.getCursorPosition();
var line = session.doc.getLine(cursor.row);
if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
context.autoInsertedBrackets = 0;
context.autoInsertedRow = cursor.row;
context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
context.autoInsertedBrackets++;
};
CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
var cursor = editor.getCursorPosition();
var line = session.doc.getLine(cursor.row);
if (!this.isMaybeInsertedClosing(cursor, line))
context.maybeInsertedBrackets = 0;
context.maybeInsertedRow = cursor.row;
context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
context.maybeInsertedLineEnd = line.substr(cursor.column);
context.maybeInsertedBrackets++;
};
CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
return context.autoInsertedBrackets > 0 &&
cursor.row === context.autoInsertedRow &&
bracket === context.autoInsertedLineEnd[0] &&
line.substr(cursor.column) === context.autoInsertedLineEnd;
};
CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
return context.maybeInsertedBrackets > 0 &&
cursor.row === context.maybeInsertedRow &&
line.substr(cursor.column) === context.maybeInsertedLineEnd &&
line.substr(0, cursor.column) == context.maybeInsertedLineStart;
};
CstyleBehaviour.popAutoInsertedClosing = function() {
context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
context.autoInsertedBrackets--;
};
CstyleBehaviour.clearMaybeInsertedClosing = function() {
if (context) {
context.maybeInsertedBrackets = 0;
context.maybeInsertedRow = -1;
}
};
oop.inherits(CstyleBehaviour, Behaviour);
exports.CstyleBehaviour = CstyleBehaviour;
});
ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) {
"use strict";
@ -350,7 +708,7 @@ oop.inherits(FoldMode, BaseFoldMode);
});
ace.define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/folding/coffee"], function(require, exports, module) {
ace.define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/coffee"], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
@ -358,11 +716,13 @@ var TextMode = require("./text").Mode;
var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var Range = require("../range").Range;
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
var FoldMode = require("./folding/coffee").FoldMode;
var Mode = function() {
this.HighlightRules = RubyHighlightRules;
this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CstyleBehaviour();
this.foldingRules = new FoldMode();
};
oop.inherits(Mode, TextMode);

View file

@ -262,7 +262,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",

View file

@ -68,6 +68,62 @@ var ShHighlightRules = function() {
}, {
defaultToken: "string"
}]
}, {
stateName: "heredoc",
onMatch : function(value, currentState, stack) {
var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
var tokens = value.split(this.splitRegex);
stack.push(next, tokens[4]);
return [
{type:"constant", value: tokens[1]},
{type:"text", value: tokens[2]},
{type:"string", value: tokens[3]},
{type:"support.class", value: tokens[4]},
{type:"string", value: tokens[5]}
];
},
regex : "(<<-?)(\\s*)(['\"`]?)([\\w\-]+)(['\"`]?)",
rules: {
heredoc: [{
onMatch: function(value, currentState, stack) {
if (value === stack[1]) {
stack.shift();
stack.shift();
this.next = stack[0] || "start";
return "support.class";
}
this.next = "";
return "string";
},
regex: ".*$",
next: "start"
}],
indentedHeredoc: [{
token: "string",
regex: "^ +"
}, {
onMatch: function(value, currentState, stack) {
if (value === stack[1]) {
stack.shift();
stack.shift();
this.next = stack[0] || "start";
return "support.class";
}
this.next = "";
return "string";
},
regex: ".*$",
next: "start"
}]
}
}, {
regex : "$",
token : "empty",
next : function(currentState, stack) {
if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc")
return stack[0];
return currentState;
}
}, {
token : "variable.language",
regex : builtinVariable

View file

@ -262,7 +262,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",

View file

@ -262,7 +262,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",
@ -1716,7 +1716,11 @@ var TokenIterator = require("../../token_iterator").TokenIterator;
var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
BaseFoldMode.call(this);
this.voidElements = oop.mixin(voidElements || {}, optionalEndTags || {});
this.voidElements = voidElements || {};
this.optionalEndTags = oop.mixin({}, this.voidElements);
if (optionalEndTags)
oop.mixin(this.optionalEndTags, optionalEndTags);
};
oop.inherits(FoldMode, BaseFoldMode);
@ -1857,10 +1861,10 @@ function is(token, type) {
if (!tag || top.tagName == tag.tagName) {
return stack.pop();
}
else if (this.voidElements.hasOwnProperty(tag.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(tag.tagName)) {
return;
}
else if (this.voidElements.hasOwnProperty(top.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
stack.pop();
continue;
} else {

View file

@ -189,6 +189,7 @@ oop.inherits(Mode, TextMode);
(function() {
this.$indentWithTabs = true;
this.lineCommentStart = "#";
this.$id = "ace/mode/snippets";
}).call(Mode.prototype);
exports.Mode = Mode;

View file

@ -262,7 +262,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",
@ -1716,7 +1716,11 @@ var TokenIterator = require("../../token_iterator").TokenIterator;
var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
BaseFoldMode.call(this);
this.voidElements = oop.mixin(voidElements || {}, optionalEndTags || {});
this.voidElements = voidElements || {};
this.optionalEndTags = oop.mixin({}, this.voidElements);
if (optionalEndTags)
oop.mixin(this.optionalEndTags, optionalEndTags);
};
oop.inherits(FoldMode, BaseFoldMode);
@ -1857,10 +1861,10 @@ function is(token, type) {
if (!tag || top.tagName == tag.tagName) {
return stack.pop();
}
else if (this.voidElements.hasOwnProperty(tag.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(tag.tagName)) {
return;
}
else if (this.voidElements.hasOwnProperty(top.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
stack.pop();
continue;
} else {

View file

@ -352,7 +352,11 @@ var TokenIterator = require("../../token_iterator").TokenIterator;
var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
BaseFoldMode.call(this);
this.voidElements = oop.mixin(voidElements || {}, optionalEndTags || {});
this.voidElements = voidElements || {};
this.optionalEndTags = oop.mixin({}, this.voidElements);
if (optionalEndTags)
oop.mixin(this.optionalEndTags, optionalEndTags);
};
oop.inherits(FoldMode, BaseFoldMode);
@ -493,10 +497,10 @@ function is(token, type) {
if (!tag || top.tagName == tag.tagName) {
return stack.pop();
}
else if (this.voidElements.hasOwnProperty(tag.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(tag.tagName)) {
return;
}
else if (this.voidElements.hasOwnProperty(top.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
stack.pop();
continue;
} else {
@ -871,7 +875,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",

View file

@ -262,7 +262,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",
@ -1716,7 +1716,11 @@ var TokenIterator = require("../../token_iterator").TokenIterator;
var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
BaseFoldMode.call(this);
this.voidElements = oop.mixin(voidElements || {}, optionalEndTags || {});
this.voidElements = voidElements || {};
this.optionalEndTags = oop.mixin({}, this.voidElements);
if (optionalEndTags)
oop.mixin(this.optionalEndTags, optionalEndTags);
};
oop.inherits(FoldMode, BaseFoldMode);
@ -1857,10 +1861,10 @@ function is(token, type) {
if (!tag || top.tagName == tag.tagName) {
return stack.pop();
}
else if (this.voidElements.hasOwnProperty(tag.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(tag.tagName)) {
return;
}
else if (this.voidElements.hasOwnProperty(top.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
stack.pop();
continue;
} else {

View file

@ -262,7 +262,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",

View file

@ -98,7 +98,7 @@ var ValaHighlightRules = function() {
[ { token: 'meta.class.vala',
regex: '(?=\\w?[\\w\\s]*(?:class|(?:@)?interface|enum|struct|namespace)\\s+\\w+)',
push:
[ { token: 'punctuation.section.class.end.vala',
[ { token: 'paren.vala',
regex: '}',
next: 'pop' },
{ include: '#storage-modifiers' },
@ -128,10 +128,10 @@ var ValaHighlightRules = function() {
{ include: '#object-types-inherited' },
{ include: '#comments' },
{ defaultToken: 'meta.definition.class.implemented.interfaces.vala' } ] },
{ token: 'meta.class.body.vala',
{ token: 'paren.vala',
regex: '{',
push:
[ { token: 'meta.class.body.vala', regex: '(?=})', next: 'pop' },
[ { token: 'paren.vala', regex: '(?=})', next: 'pop' },
{ include: '#class-body' },
{ defaultToken: 'meta.class.body.vala' } ] },
{ defaultToken: 'meta.class.vala' } ],
@ -228,7 +228,7 @@ var ValaHighlightRules = function() {
[ { token: 'meta.method.vala',
regex: '(?!new)(?=\\w.*\\s+)(?=[^=]+\\()',
push:
[ { token: 'meta.method.vala', regex: '}|(?=;)', next: 'pop' },
[ { token: 'paren.vala', regex: '}|(?=;)', next: 'pop' },
{ include: '#storage-modifiers' },
{ token: [ 'entity.name.function.vala', 'meta.method.identifier.vala' ],
regex: '([\\~\\w\\.]+)(\\s*\\()',
@ -247,10 +247,10 @@ var ValaHighlightRules = function() {
{ include: '#all-types' },
{ defaultToken: 'meta.method.return-type.vala' } ] },
{ include: '#throws' },
{ token: 'meta.method.body.vala',
{ token: 'paren.vala',
regex: '{',
push:
[ { token: 'meta.method.body.vala', regex: '(?=})', next: 'pop' },
[ { token: 'paren.vala', regex: '(?=})', next: 'pop' },
{ include: '#code' },
{ defaultToken: 'meta.method.body.vala' } ] },
{ defaultToken: 'meta.method.vala' } ] } ],

View file

@ -262,7 +262,7 @@ var JavaScriptHighlightRules = function() {
],
"regex_character_class": [
{
token: "regexp.keyword.operator",
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",
@ -1716,7 +1716,11 @@ var TokenIterator = require("../../token_iterator").TokenIterator;
var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
BaseFoldMode.call(this);
this.voidElements = oop.mixin(voidElements || {}, optionalEndTags || {});
this.voidElements = voidElements || {};
this.optionalEndTags = oop.mixin({}, this.voidElements);
if (optionalEndTags)
oop.mixin(this.optionalEndTags, optionalEndTags);
};
oop.inherits(FoldMode, BaseFoldMode);
@ -1857,10 +1861,10 @@ function is(token, type) {
if (!tag || top.tagName == tag.tagName) {
return stack.pop();
}
else if (this.voidElements.hasOwnProperty(tag.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(tag.tagName)) {
return;
}
else if (this.voidElements.hasOwnProperty(top.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
stack.pop();
continue;
} else {

View file

@ -352,7 +352,11 @@ var TokenIterator = require("../../token_iterator").TokenIterator;
var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
BaseFoldMode.call(this);
this.voidElements = oop.mixin(voidElements || {}, optionalEndTags || {});
this.voidElements = voidElements || {};
this.optionalEndTags = oop.mixin({}, this.voidElements);
if (optionalEndTags)
oop.mixin(this.optionalEndTags, optionalEndTags);
};
oop.inherits(FoldMode, BaseFoldMode);
@ -493,10 +497,10 @@ function is(token, type) {
if (!tag || top.tagName == tag.tagName) {
return stack.pop();
}
else if (this.voidElements.hasOwnProperty(tag.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(tag.tagName)) {
return;
}
else if (this.voidElements.hasOwnProperty(top.tagName)) {
else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
stack.pop();
continue;
} else {

105
js/ace/theme-kr_theme.js Normal file
View file

@ -0,0 +1,105 @@
ace.define("ace/theme/kr_theme",["require","exports","module","ace/lib/dom"], function(require, exports, module) {
exports.isDark = true;
exports.cssClass = "ace-kr-theme";
exports.cssText = ".ace-kr-theme .ace_gutter {\
background: #1c1917;\
color: #FCFFE0\
}\
.ace-kr-theme .ace_print-margin {\
width: 1px;\
background: #1c1917\
}\
.ace-kr-theme {\
background-color: #0B0A09;\
color: #FCFFE0\
}\
.ace-kr-theme .ace_cursor {\
color: #FF9900\
}\
.ace-kr-theme .ace_marker-layer .ace_selection {\
background: rgba(170, 0, 255, 0.45)\
}\
.ace-kr-theme.ace_multiselect .ace_selection.ace_start {\
box-shadow: 0 0 3px 0px #0B0A09;\
border-radius: 2px\
}\
.ace-kr-theme .ace_marker-layer .ace_step {\
background: rgb(102, 82, 0)\
}\
.ace-kr-theme .ace_marker-layer .ace_bracket {\
margin: -1px 0 0 -1px;\
border: 1px solid rgba(255, 177, 111, 0.32)\
}\
.ace-kr-theme .ace_marker-layer .ace_active-line {\
background: #38403D\
}\
.ace-kr-theme .ace_gutter-active-line {\
background-color : #38403D\
}\
.ace-kr-theme .ace_marker-layer .ace_selected-word {\
border: 1px solid rgba(170, 0, 255, 0.45)\
}\
.ace-kr-theme .ace_invisible {\
color: rgba(255, 177, 111, 0.32)\
}\
.ace-kr-theme .ace_keyword,\
.ace-kr-theme .ace_meta {\
color: #949C8B\
}\
.ace-kr-theme .ace_constant,\
.ace-kr-theme .ace_constant.ace_character,\
.ace-kr-theme .ace_constant.ace_character.ace_escape,\
.ace-kr-theme .ace_constant.ace_other {\
color: rgba(210, 117, 24, 0.76)\
}\
.ace-kr-theme .ace_invalid {\
color: #F8F8F8;\
background-color: #A41300\
}\
.ace-kr-theme .ace_support {\
color: #9FC28A\
}\
.ace-kr-theme .ace_support.ace_constant {\
color: #C27E66\
}\
.ace-kr-theme .ace_fold {\
background-color: #949C8B;\
border-color: #FCFFE0\
}\
.ace-kr-theme .ace_support.ace_function {\
color: #85873A\
}\
.ace-kr-theme .ace_storage {\
color: #FFEE80\
}\
.ace-kr-theme .ace_string {\
color: rgba(164, 161, 181, 0.8)\
}\
.ace-kr-theme .ace_string.ace_regexp {\
color: rgba(125, 255, 192, 0.65)\
}\
.ace-kr-theme .ace_comment {\
font-style: italic;\
color: #706D5B\
}\
.ace-kr-theme .ace_variable {\
color: #D1A796\
}\
.ace-kr-theme .ace_list,\
.ace-kr-theme .ace_markup.ace_list {\
background-color: #0F0040\
}\
.ace-kr-theme .ace_variable.ace_language {\
color: #FF80E1\
}\
.ace-kr-theme .ace_meta.ace_tag {\
color: #BABD9C\
}\
.ace-kr-theme .ace_indent-guide {\
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYFBXV/8PAAJoAXX4kT2EAAAAAElFTkSuQmCC) right repeat-y\
}";
var dom = require("../lib/dom");
dom.importCssString(exports.cssText, exports.cssClass);
});

File diff suppressed because it is too large Load diff

View file

@ -2809,7 +2809,7 @@ var JSHINT = (function () {
function doOption() {
var nt = state.tokens.next;
var body = nt.body.match(/(-\s+)?[^\s,:]+(?:\s*:\s*(-\s+)?[^\s,]+)?/g);
var body = nt.body.match(/(-\s+)?[^\s,:]+(?:\s*:\s*(-\s+)?[^\s,]+)?/g) || [];
var predef = {};
if (nt.type === "globals") {