commit
c612dac355
22 changed files with 3407 additions and 1006 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
/** vim: et:ts=4:sw=4:sts=4
|
/** vim: et:ts=4:sw=4:sts=4
|
||||||
* @license RequireJS 2.1.8+ Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
|
* @license RequireJS 2.1.9+ Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
|
||||||
* Available via the MIT or new BSD license.
|
* Available via the MIT or new BSD license.
|
||||||
* see: http://github.com/jrburke/requirejs for details
|
* see: http://github.com/jrburke/requirejs for details
|
||||||
*/
|
*/
|
||||||
|
|
@ -12,7 +12,7 @@ var requirejs, require, define;
|
||||||
(function (global) {
|
(function (global) {
|
||||||
var req, s, head, baseElement, dataMain, src,
|
var req, s, head, baseElement, dataMain, src,
|
||||||
interactiveScript, currentlyAddingScript, mainScript, subPath,
|
interactiveScript, currentlyAddingScript, mainScript, subPath,
|
||||||
version = '2.1.8+',
|
version = '2.1.9+',
|
||||||
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
|
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
|
||||||
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
|
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
|
||||||
jsSuffixRegExp = /\.js$/,
|
jsSuffixRegExp = /\.js$/,
|
||||||
|
|
@ -22,7 +22,7 @@ var requirejs, require, define;
|
||||||
hasOwn = op.hasOwnProperty,
|
hasOwn = op.hasOwnProperty,
|
||||||
ap = Array.prototype,
|
ap = Array.prototype,
|
||||||
apsp = ap.splice,
|
apsp = ap.splice,
|
||||||
isBrowser = !!(typeof window !== 'undefined' && navigator && window.document),
|
isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document),
|
||||||
isWebWorker = !isBrowser && typeof importScripts !== 'undefined',
|
isWebWorker = !isBrowser && typeof importScripts !== 'undefined',
|
||||||
//PS3 indicates loaded and complete, but need to wait for complete
|
//PS3 indicates loaded and complete, but need to wait for complete
|
||||||
//specifically. Sequence is 'loading', 'loaded', execution,
|
//specifically. Sequence is 'loading', 'loaded', execution,
|
||||||
|
|
@ -373,7 +373,6 @@ var requirejs, require, define;
|
||||||
function hasPathFallback(id) {
|
function hasPathFallback(id) {
|
||||||
var pathConfig = getOwn(config.paths, id);
|
var pathConfig = getOwn(config.paths, id);
|
||||||
if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) {
|
if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) {
|
||||||
removeScript(id);
|
|
||||||
//Pop off the first array value, since it failed, and
|
//Pop off the first array value, since it failed, and
|
||||||
//retry
|
//retry
|
||||||
pathConfig.shift();
|
pathConfig.shift();
|
||||||
|
|
@ -549,7 +548,7 @@ var requirejs, require, define;
|
||||||
//local var ref to defQueue, so cannot just reassign the one
|
//local var ref to defQueue, so cannot just reassign the one
|
||||||
//on context.
|
//on context.
|
||||||
apsp.apply(defQueue,
|
apsp.apply(defQueue,
|
||||||
[defQueue.length - 1, 0].concat(globalDefQueue));
|
[defQueue.length, 0].concat(globalDefQueue));
|
||||||
globalDefQueue = [];
|
globalDefQueue = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -629,7 +628,7 @@ var requirejs, require, define;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkLoaded() {
|
function checkLoaded() {
|
||||||
var map, modId, err, usingPathFallback,
|
var err, usingPathFallback,
|
||||||
waitInterval = config.waitSeconds * 1000,
|
waitInterval = config.waitSeconds * 1000,
|
||||||
//It is possible to disable the wait interval by using waitSeconds of 0.
|
//It is possible to disable the wait interval by using waitSeconds of 0.
|
||||||
expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
|
expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
|
||||||
|
|
@ -647,8 +646,8 @@ var requirejs, require, define;
|
||||||
|
|
||||||
//Figure out the state of all the modules.
|
//Figure out the state of all the modules.
|
||||||
eachProp(enabledRegistry, function (mod) {
|
eachProp(enabledRegistry, function (mod) {
|
||||||
map = mod.map;
|
var map = mod.map,
|
||||||
modId = map.id;
|
modId = map.id;
|
||||||
|
|
||||||
//Skip things that are not enabled or in error state.
|
//Skip things that are not enabled or in error state.
|
||||||
if (!mod.enabled) {
|
if (!mod.enabled) {
|
||||||
|
|
@ -1464,10 +1463,21 @@ var requirejs, require, define;
|
||||||
var map = makeModuleMap(id, relMap, true),
|
var map = makeModuleMap(id, relMap, true),
|
||||||
mod = getOwn(registry, id);
|
mod = getOwn(registry, id);
|
||||||
|
|
||||||
|
removeScript(id);
|
||||||
|
|
||||||
delete defined[id];
|
delete defined[id];
|
||||||
delete urlFetched[map.url];
|
delete urlFetched[map.url];
|
||||||
delete undefEvents[id];
|
delete undefEvents[id];
|
||||||
|
|
||||||
|
//Clean queued defines too. Go backwards
|
||||||
|
//in array so that the splices do not
|
||||||
|
//mess up the iteration.
|
||||||
|
eachReverse(defQueue, function(args, i) {
|
||||||
|
if(args[0] === id) {
|
||||||
|
defQueue.splice(i, 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (mod) {
|
if (mod) {
|
||||||
//Hold on to listeners in case the
|
//Hold on to listeners in case the
|
||||||
//module will be attempted to be reloaded
|
//module will be attempted to be reloaded
|
||||||
|
|
@ -1918,7 +1928,7 @@ var requirejs, require, define;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Look for a data-main script attribute, which could also adjust the baseUrl.
|
//Look for a data-main script attribute, which could also adjust the baseUrl.
|
||||||
if (isBrowser) {
|
if (isBrowser && !cfg.skipDataMain) {
|
||||||
//Figure out baseUrl. Get it from the script tag with require.js in it.
|
//Figure out baseUrl. Get it from the script tag with require.js in it.
|
||||||
eachReverse(scripts(), function (script) {
|
eachReverse(scripts(), function (script) {
|
||||||
//Set the 'head' where we can append children by
|
//Set the 'head' where we can append children by
|
||||||
|
|
|
||||||
|
|
@ -2534,6 +2534,10 @@ config.defineOptions(EditSession.prototype, "session", {
|
||||||
set: function(val) {this.doc.setNewLineMode(val)},
|
set: function(val) {this.doc.setNewLineMode(val)},
|
||||||
get: function() {return this.doc.getNewLineMode()},
|
get: function() {return this.doc.getNewLineMode()},
|
||||||
handlesSet: true
|
handlesSet: true
|
||||||
|
},
|
||||||
|
mode: {
|
||||||
|
set: function(val) { this.setMode(val) },
|
||||||
|
get: function() { return this.$modeId }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -747,8 +747,11 @@ function Folding() {
|
||||||
};
|
};
|
||||||
|
|
||||||
var range = this.$toggleFoldWidget(row, options);
|
var range = this.$toggleFoldWidget(row, options);
|
||||||
if (!range)
|
if (!range) {
|
||||||
(e.target || e.srcElement).className += " ace_invalid";
|
var el = (e.target || e.srcElement)
|
||||||
|
if (el && /ace_fold-widget/.test(el.className))
|
||||||
|
el.className += " ace_invalid";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$toggleFoldWidget = function(row, options) {
|
this.$toggleFoldWidget = function(row, options) {
|
||||||
|
|
|
||||||
|
|
@ -248,7 +248,7 @@ var Editor = function(renderer, session) {
|
||||||
this.setKeyboardHandler = function(keyboardHandler) {
|
this.setKeyboardHandler = function(keyboardHandler) {
|
||||||
if (!keyboardHandler) {
|
if (!keyboardHandler) {
|
||||||
this.keyBinding.setKeyboardHandler(null);
|
this.keyBinding.setKeyboardHandler(null);
|
||||||
} else if (typeof keyboardHandler == "string") {
|
} else if (typeof keyboardHandler === "string") {
|
||||||
this.$keybindingId = keyboardHandler;
|
this.$keybindingId = keyboardHandler;
|
||||||
var _self = this;
|
var _self = this;
|
||||||
config.loadModule(["keybinding", keyboardHandler], function(module) {
|
config.loadModule(["keybinding", keyboardHandler], function(module) {
|
||||||
|
|
@ -2424,6 +2424,7 @@ config.defineOptions(Editor.prototype, "editor", {
|
||||||
minLines: "renderer",
|
minLines: "renderer",
|
||||||
scrollPastEnd: "renderer",
|
scrollPastEnd: "renderer",
|
||||||
fixedWidthGutter: "renderer",
|
fixedWidthGutter: "renderer",
|
||||||
|
theme: "renderer",
|
||||||
|
|
||||||
scrollSpeed: "$mouseHandler",
|
scrollSpeed: "$mouseHandler",
|
||||||
dragDelay: "$mouseHandler",
|
dragDelay: "$mouseHandler",
|
||||||
|
|
@ -2437,7 +2438,8 @@ config.defineOptions(Editor.prototype, "editor", {
|
||||||
useSoftTabs: "session",
|
useSoftTabs: "session",
|
||||||
tabSize: "session",
|
tabSize: "session",
|
||||||
wrap: "session",
|
wrap: "session",
|
||||||
foldStyle: "session"
|
foldStyle: "session",
|
||||||
|
mode: "session"
|
||||||
});
|
});
|
||||||
|
|
||||||
exports.Editor = Editor;
|
exports.Editor = Editor;
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,7 @@ var Gutter = function(parentEl) {
|
||||||
this.element.style.height = config.minHeight + "px";
|
this.element.style.height = config.minHeight + "px";
|
||||||
|
|
||||||
if (this.$fixedWidth || session.$useWrapMode)
|
if (this.$fixedWidth || session.$useWrapMode)
|
||||||
lastLineNumber = session.getLength();
|
lastLineNumber = session.getLength() + firstLineNumber;
|
||||||
|
|
||||||
var gutterWidth = gutterRenderer
|
var gutterWidth = gutterRenderer
|
||||||
? gutterRenderer.getWidth(session, lastLineNumber, config)
|
? gutterRenderer.getWidth(session, lastLineNumber, config)
|
||||||
|
|
|
||||||
39
lib/ace/mode/_test/tokens_ada.json
Normal file
39
lib/ace/mode/_test/tokens_ada.json
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
[[
|
||||||
|
"start",
|
||||||
|
["keyword","with"],
|
||||||
|
["text"," "],
|
||||||
|
["identifier","Ada"],
|
||||||
|
["text","."],
|
||||||
|
["identifier","Text_IO"],
|
||||||
|
["text","; "],
|
||||||
|
["keyword","use"],
|
||||||
|
["text"," "],
|
||||||
|
["identifier","Ada"],
|
||||||
|
["text","."],
|
||||||
|
["identifier","Text_IO"],
|
||||||
|
["text",";"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["keyword","procedure"],
|
||||||
|
["text"," "],
|
||||||
|
["identifier","Hello"],
|
||||||
|
["text"," "],
|
||||||
|
["keyword","is"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["keyword","begin"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["identifier","Put_Line"],
|
||||||
|
["paren.lparen","("],
|
||||||
|
["string","\"Hello, world!\""],
|
||||||
|
["paren.rparen",")"],
|
||||||
|
["text",";"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["keyword","end"],
|
||||||
|
["text"," "],
|
||||||
|
["identifier","Hello"],
|
||||||
|
["text",";"]
|
||||||
|
]]
|
||||||
4
lib/ace/mode/_test/tokens_cobol.json
Normal file
4
lib/ace/mode/_test/tokens_cobol.json
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
[[
|
||||||
|
"start",
|
||||||
|
["identifier","TODO"]
|
||||||
|
]]
|
||||||
111
lib/ace/mode/_test/tokens_d.json
Normal file
111
lib/ace/mode/_test/tokens_d.json
Normal file
|
|
@ -0,0 +1,111 @@
|
||||||
|
[[
|
||||||
|
"start",
|
||||||
|
["comment.shebang","#!/usr/bin/env rdmd"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["comment","// Computes average line length for standard input."]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["keyword","import"],
|
||||||
|
["text"," "],
|
||||||
|
["variable.module","std.stdio"],
|
||||||
|
["punctuation.operator",";"]
|
||||||
|
],[
|
||||||
|
"start"
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["keyword.type","void"],
|
||||||
|
["text"," "],
|
||||||
|
["identifier","main"],
|
||||||
|
["paren.lparen","("],
|
||||||
|
["paren.rparen",")"],
|
||||||
|
["text"," "],
|
||||||
|
["paren.lparen","{"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["keyword.type","ulong"],
|
||||||
|
["text"," "],
|
||||||
|
["identifier","lines"],
|
||||||
|
["text"," "],
|
||||||
|
["keyword.operator","="],
|
||||||
|
["text"," "],
|
||||||
|
["constant.numeric","0"],
|
||||||
|
["punctuation.operator",";"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["keyword.type","double"],
|
||||||
|
["text"," "],
|
||||||
|
["identifier","sumLength"],
|
||||||
|
["text"," "],
|
||||||
|
["keyword.operator","="],
|
||||||
|
["text"," "],
|
||||||
|
["constant.numeric","0"],
|
||||||
|
["punctuation.operator",";"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["keyword.control","foreach"],
|
||||||
|
["text"," "],
|
||||||
|
["paren.lparen","("],
|
||||||
|
["identifier","line"],
|
||||||
|
["punctuation.operator",";"],
|
||||||
|
["text"," "],
|
||||||
|
["identifier","stdin"],
|
||||||
|
["punctuation.operator","."],
|
||||||
|
["identifier","byLine"],
|
||||||
|
["paren.lparen","("],
|
||||||
|
["paren.rparen","))"],
|
||||||
|
["text"," "],
|
||||||
|
["paren.lparen","{"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["keyword.operator","++"],
|
||||||
|
["identifier","lines"],
|
||||||
|
["punctuation.operator",";"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["identifier","sumLength"],
|
||||||
|
["text"," "],
|
||||||
|
["keyword.operator","+="],
|
||||||
|
["text"," "],
|
||||||
|
["identifier","line"],
|
||||||
|
["punctuation.operator","."],
|
||||||
|
["identifier","length"],
|
||||||
|
["punctuation.operator",";"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["paren.rparen","}"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["identifier","writeln"],
|
||||||
|
["paren.lparen","("],
|
||||||
|
["string","\"Average line length: \""],
|
||||||
|
["punctuation.operator",","]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["identifier","lines"],
|
||||||
|
["text"," "],
|
||||||
|
["keyword.operator","?"],
|
||||||
|
["text"," "],
|
||||||
|
["identifier","sumLength"],
|
||||||
|
["text"," "],
|
||||||
|
["keyword.operator","/"],
|
||||||
|
["text"," "],
|
||||||
|
["identifier","lines"],
|
||||||
|
["text"," "],
|
||||||
|
["punctuation.operator",":"],
|
||||||
|
["text"," "],
|
||||||
|
["constant.numeric","0"],
|
||||||
|
["paren.rparen",")"],
|
||||||
|
["punctuation.operator",";"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["paren.rparen","}"]
|
||||||
|
]]
|
||||||
81
lib/ace/mode/_test/tokens_handlebars.json
Normal file
81
lib/ace/mode/_test/tokens_handlebars.json
Normal file
|
|
@ -0,0 +1,81 @@
|
||||||
|
[[
|
||||||
|
"start",
|
||||||
|
["comment.start","{{!--"],
|
||||||
|
["comment"," Ace + :-}} "],
|
||||||
|
["comment.end","--}}"]
|
||||||
|
],[
|
||||||
|
"start"
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["meta.tag.punctuation.begin","<"],
|
||||||
|
["meta.tag.name","div"],
|
||||||
|
["text"," "],
|
||||||
|
["entity.other.attribute-name","id"],
|
||||||
|
["keyword.operator.separator","="],
|
||||||
|
["string","\"comments\""],
|
||||||
|
["meta.tag.punctuation.end",">"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["storage.type.start","{{#"],
|
||||||
|
["variable.parameter","each"],
|
||||||
|
["text"," "],
|
||||||
|
["variable.parameter","comments"],
|
||||||
|
["storage.type.end","}}"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["meta.tag.punctuation.begin","<"],
|
||||||
|
["meta.tag.name","h2"],
|
||||||
|
["meta.tag.punctuation.end",">"],
|
||||||
|
["meta.tag.punctuation.begin","<"],
|
||||||
|
["meta.tag.name.anchor","a"],
|
||||||
|
["text"," "],
|
||||||
|
["entity.other.attribute-name","href"],
|
||||||
|
["keyword.operator.separator","="],
|
||||||
|
["string","\"/posts/"],
|
||||||
|
["storage.type.start","{{"],
|
||||||
|
["text","../"],
|
||||||
|
["variable.parameter","permalink"],
|
||||||
|
["storage.type.end","}}"],
|
||||||
|
["string","#"],
|
||||||
|
["storage.type.start","{{"],
|
||||||
|
["variable.parameter","id"],
|
||||||
|
["storage.type.end","}}"],
|
||||||
|
["string","\""],
|
||||||
|
["meta.tag.punctuation.end",">"],
|
||||||
|
["storage.type.start","{{"],
|
||||||
|
["variable.parameter","title"],
|
||||||
|
["storage.type.end","}}"],
|
||||||
|
["meta.tag.punctuation.begin","</"],
|
||||||
|
["meta.tag.name.anchor","a"],
|
||||||
|
["meta.tag.punctuation.end",">"],
|
||||||
|
["meta.tag.punctuation.begin","</"],
|
||||||
|
["meta.tag.name","h2"],
|
||||||
|
["meta.tag.punctuation.end",">"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["meta.tag.punctuation.begin","<"],
|
||||||
|
["meta.tag.name","div"],
|
||||||
|
["meta.tag.punctuation.end",">"],
|
||||||
|
["storage.type.start","{{"],
|
||||||
|
["variable.parameter","body"],
|
||||||
|
["storage.type.end","}}"],
|
||||||
|
["meta.tag.punctuation.begin","</"],
|
||||||
|
["meta.tag.name","div"],
|
||||||
|
["meta.tag.punctuation.end",">"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["storage.type.start","{{/"],
|
||||||
|
["variable.parameter","each"],
|
||||||
|
["storage.type.end","}}"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["meta.tag.punctuation.begin","</"],
|
||||||
|
["meta.tag.name","div"],
|
||||||
|
["meta.tag.punctuation.end",">"]
|
||||||
|
],[
|
||||||
|
"start"
|
||||||
|
]]
|
||||||
1786
lib/ace/mode/_test/tokens_jack.json
Normal file
1786
lib/ace/mode/_test/tokens_jack.json
Normal file
File diff suppressed because it is too large
Load diff
257
lib/ace/mode/_test/tokens_mel.json
Normal file
257
lib/ace/mode/_test/tokens_mel.json
Normal file
|
|
@ -0,0 +1,257 @@
|
||||||
|
[[
|
||||||
|
"start",
|
||||||
|
["comment.line.double-slash.mel","//"],
|
||||||
|
["punctuation.definition.comment.mel"," animated duplicates, instances script"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["meta.function.mel","proc"],
|
||||||
|
["keyword.other.mel"," "],
|
||||||
|
["storage.type.mel","animatedDuplication"],
|
||||||
|
["entity.name.function.mel"," ("],
|
||||||
|
["punctuation.section.function.mel","("],
|
||||||
|
["meta.function.mel","int $rangeStart, int $rangeEnd, int $numOfDuplicates, int $duplicateOrInstance"],
|
||||||
|
["punctuation.section.function.mel",")"],
|
||||||
|
"proc animatedDuplication (int $rangeStart, int $rangeEnd, int $numOfDuplicates, int $duplicateOrInstance)"
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text","{"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["storage.type.mel","int"],
|
||||||
|
["text"," "],
|
||||||
|
["variable.other.mel","$"],
|
||||||
|
["punctuation.definition.variable.mel","range_start"],
|
||||||
|
["text"," "],
|
||||||
|
["keyword.operator.symbolic.mel","="],
|
||||||
|
["text"," "],
|
||||||
|
["variable.other.mel","$"],
|
||||||
|
["punctuation.definition.variable.mel","rangeStart"],
|
||||||
|
["text",";"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["storage.type.mel","int"],
|
||||||
|
["text"," "],
|
||||||
|
["variable.other.mel","$"],
|
||||||
|
["punctuation.definition.variable.mel","range_end"],
|
||||||
|
["text"," "],
|
||||||
|
["keyword.operator.symbolic.mel","="],
|
||||||
|
["text"," "],
|
||||||
|
["variable.other.mel","$"],
|
||||||
|
["punctuation.definition.variable.mel","rangeEnd"],
|
||||||
|
["text",";"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["storage.type.mel","int"],
|
||||||
|
["text"," "],
|
||||||
|
["variable.other.mel","$"],
|
||||||
|
["punctuation.definition.variable.mel","num_of_duplicates"],
|
||||||
|
["text"," "],
|
||||||
|
["keyword.operator.symbolic.mel","="],
|
||||||
|
["text"," "],
|
||||||
|
["variable.other.mel","$"],
|
||||||
|
["punctuation.definition.variable.mel","numOfDuplicates"],
|
||||||
|
["text",";"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["storage.type.mel","int"],
|
||||||
|
["text"," "],
|
||||||
|
["variable.other.mel","$"],
|
||||||
|
["punctuation.definition.variable.mel","step_size"],
|
||||||
|
["text"," "],
|
||||||
|
["keyword.operator.symbolic.mel","="],
|
||||||
|
["text"," ("],
|
||||||
|
["variable.other.mel","$"],
|
||||||
|
["punctuation.definition.variable.mel","range_end"],
|
||||||
|
["text"," "],
|
||||||
|
["keyword.operator.symbolic.mel","-"],
|
||||||
|
["text"," "],
|
||||||
|
["variable.other.mel","$"],
|
||||||
|
["punctuation.definition.variable.mel","range_start"],
|
||||||
|
["text",") "],
|
||||||
|
["keyword.operator.symbolic.mel","/"],
|
||||||
|
["text"," "],
|
||||||
|
["variable.other.mel","$"],
|
||||||
|
["punctuation.definition.variable.mel","num_of_duplicates"],
|
||||||
|
["text",";"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["storage.type.mel","int"],
|
||||||
|
["text"," "],
|
||||||
|
["variable.other.mel","$"],
|
||||||
|
["punctuation.definition.variable.mel","i"],
|
||||||
|
["text"," "],
|
||||||
|
["keyword.operator.symbolic.mel","="],
|
||||||
|
["text"," "],
|
||||||
|
["constant.numeric.mel","0"],
|
||||||
|
["text",";"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["storage.type.mel","int"],
|
||||||
|
["text"," "],
|
||||||
|
["variable.other.mel","$"],
|
||||||
|
["punctuation.definition.variable.mel","temp"],
|
||||||
|
["text",";"]
|
||||||
|
],[
|
||||||
|
"start"
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["support.function.mel","currentTime"],
|
||||||
|
["text"," "],
|
||||||
|
["variable.other.mel","$"],
|
||||||
|
["punctuation.definition.variable.mel","range_start"],
|
||||||
|
["text","; "],
|
||||||
|
["comment.line.double-slash.mel","//"],
|
||||||
|
["punctuation.definition.comment.mel"," set to range start"]
|
||||||
|
],[
|
||||||
|
"start"
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["storage.type.mel","string"],
|
||||||
|
["text"," "],
|
||||||
|
["variable.other.mel","$"],
|
||||||
|
["punctuation.definition.variable.mel","selectedObjects"],
|
||||||
|
["text","[]; "],
|
||||||
|
["comment.line.double-slash.mel","//"],
|
||||||
|
["punctuation.definition.comment.mel"," to store selected objects"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["variable.other.mel","$"],
|
||||||
|
["punctuation.definition.variable.mel","selectedObjects"],
|
||||||
|
["text"," "],
|
||||||
|
["keyword.operator.symbolic.mel","="],
|
||||||
|
["text"," `"],
|
||||||
|
["support.function.mel","ls"],
|
||||||
|
["text"," "],
|
||||||
|
["keyword.operator.symbolic.mel","-"],
|
||||||
|
["text","sl`; "],
|
||||||
|
["comment.line.double-slash.mel","//"],
|
||||||
|
["punctuation.definition.comment.mel"," store selected objects"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["support.function.mel","select"],
|
||||||
|
["text"," "],
|
||||||
|
["variable.other.mel","$"],
|
||||||
|
["punctuation.definition.variable.mel","selectedObjects"],
|
||||||
|
["text",";"]
|
||||||
|
],[
|
||||||
|
"start"
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["keyword.control.mel","while"],
|
||||||
|
["text"," ("],
|
||||||
|
["variable.other.mel","$"],
|
||||||
|
["punctuation.definition.variable.mel","i"],
|
||||||
|
["text"," <"],
|
||||||
|
["keyword.operator.symbolic.mel","="],
|
||||||
|
["text"," "],
|
||||||
|
["variable.other.mel","$"],
|
||||||
|
["punctuation.definition.variable.mel","num_of_duplicates"],
|
||||||
|
["text",")"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," {"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["variable.other.mel","$"],
|
||||||
|
["punctuation.definition.variable.mel","temp"],
|
||||||
|
["text"," "],
|
||||||
|
["keyword.operator.symbolic.mel","="],
|
||||||
|
["text"," "],
|
||||||
|
["variable.other.mel","$"],
|
||||||
|
["punctuation.definition.variable.mel","range_start"],
|
||||||
|
["text"," "],
|
||||||
|
["keyword.operator.symbolic.mel","+"],
|
||||||
|
["text"," ("],
|
||||||
|
["variable.other.mel","$"],
|
||||||
|
["punctuation.definition.variable.mel","step_size"],
|
||||||
|
["text"," "],
|
||||||
|
["keyword.operator.symbolic.mel","*"],
|
||||||
|
["text"," "],
|
||||||
|
["variable.other.mel","$"],
|
||||||
|
["punctuation.definition.variable.mel","i"],
|
||||||
|
["text",");"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["support.function.mel","currentTime"],
|
||||||
|
["text"," ("],
|
||||||
|
["variable.other.mel","$"],
|
||||||
|
["punctuation.definition.variable.mel","temp"],
|
||||||
|
["text",");"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["comment.line.double-slash.mel","//"],
|
||||||
|
["punctuation.definition.comment.mel"," seleced the objects to duplicate or instance"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["support.function.mel","select"],
|
||||||
|
["text"," "],
|
||||||
|
["variable.other.mel","$"],
|
||||||
|
["punctuation.definition.variable.mel","selectedObjects"],
|
||||||
|
["text",";"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["keyword.control.mel","if"],
|
||||||
|
["text","("],
|
||||||
|
["variable.other.mel","$"],
|
||||||
|
["punctuation.definition.variable.mel","duplicateOrInstance"],
|
||||||
|
["text"," "],
|
||||||
|
["keyword.operator.symbolic.mel","=="],
|
||||||
|
["text"," "],
|
||||||
|
["constant.numeric.mel","0"],
|
||||||
|
["text",")"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," {"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["support.function.mel","duplicate"],
|
||||||
|
["text",";"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," }"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["keyword.control.mel","else"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," {"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["support.function.mel","instance"],
|
||||||
|
["text",";"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," }"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," "],
|
||||||
|
["variable.other.mel","$"],
|
||||||
|
["punctuation.definition.variable.mel","i"],
|
||||||
|
["keyword.operator.symbolic.mel","++"],
|
||||||
|
["text",";"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text"," }"]
|
||||||
|
],[
|
||||||
|
"start",
|
||||||
|
["text","}"]
|
||||||
|
]]
|
||||||
|
|
@ -194,7 +194,7 @@ define(function(require, exports, module) {
|
||||||
pathSep = useWinPathSep ? /\\|\// : /\//;
|
pathSep = useWinPathSep ? /\\|\// : /\//;
|
||||||
parts = file.split(pathSep);
|
parts = file.split(pathSep);
|
||||||
file = parts[parts.length - 1];
|
file = parts[parts.length - 1];
|
||||||
if (!stripExt) {
|
if (!(stripExt && file.indexOf('.') >= 0)) {
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
parts = file.split('.');
|
parts = file.split('.');
|
||||||
|
|
|
||||||
|
|
@ -193,30 +193,25 @@ define(function(require, exports, module) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Lexer.prototype.stringToken = function() {
|
Lexer.prototype.stringToken = function() {
|
||||||
var match, octalEsc, string;
|
var octalEsc, quote, string, trimmed;
|
||||||
switch (this.chunk.charAt(0)) {
|
switch (quote = this.chunk.charAt(0)) {
|
||||||
case "'":
|
case "'":
|
||||||
if (!(match = SIMPLESTR.exec(this.chunk))) {
|
string = SIMPLESTR.exec(this.chunk)[0];
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
string = match[0];
|
|
||||||
this.token('STRING', string.replace(MULTILINER, '\\\n'), 0, string.length);
|
|
||||||
break;
|
break;
|
||||||
case '"':
|
case '"':
|
||||||
if (!(string = this.balancedString(this.chunk, '"'))) {
|
string = this.balancedString(this.chunk, '"');
|
||||||
return 0;
|
}
|
||||||
}
|
if (!string) {
|
||||||
if (0 < string.indexOf('#{', 1)) {
|
return 0;
|
||||||
this.interpolateString(string.slice(1, -1), {
|
}
|
||||||
strOffset: 1,
|
trimmed = this.removeNewlines(string.slice(1, -1));
|
||||||
lexedLength: string.length
|
if (quote === '"' && 0 < string.indexOf('#{', 1)) {
|
||||||
});
|
this.interpolateString(trimmed, {
|
||||||
} else {
|
strOffset: 1,
|
||||||
this.token('STRING', this.escapeLines(string, 0, string.length));
|
lexedLength: string.length
|
||||||
}
|
});
|
||||||
break;
|
} else {
|
||||||
default:
|
this.token('STRING', quote + this.escapeLines(trimmed) + quote, 0, string.length);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
if (octalEsc = /^(?:\\.|[^\\])*\\(?:0[0-7]|[1-7])/.test(string)) {
|
if (octalEsc = /^(?:\\.|[^\\])*\\(?:0[0-7]|[1-7])/.test(string)) {
|
||||||
this.error("octal escape sequences " + string + " are not allowed");
|
this.error("octal escape sequences " + string + " are not allowed");
|
||||||
|
|
@ -302,7 +297,7 @@ define(function(require, exports, module) {
|
||||||
var body, flags, flagsOffset, heregex, plusToken, prev, re, tag, token, tokens, value, _i, _len, _ref2, _ref3, _ref4;
|
var body, flags, flagsOffset, heregex, plusToken, prev, re, tag, token, tokens, value, _i, _len, _ref2, _ref3, _ref4;
|
||||||
heregex = match[0], body = match[1], flags = match[2];
|
heregex = match[0], body = match[1], flags = match[2];
|
||||||
if (0 > body.indexOf('#{')) {
|
if (0 > body.indexOf('#{')) {
|
||||||
re = body.replace(HEREGEX_OMIT, '').replace(/\//g, '\\/');
|
re = this.escapeLines(body.replace(HEREGEX_OMIT, '$1$2').replace(/\//g, '\\/'), true);
|
||||||
if (re.match(/^\*/)) {
|
if (re.match(/^\*/)) {
|
||||||
this.error('regular expressions cannot begin with `*`');
|
this.error('regular expressions cannot begin with `*`');
|
||||||
}
|
}
|
||||||
|
|
@ -321,7 +316,7 @@ define(function(require, exports, module) {
|
||||||
if (tag === 'TOKENS') {
|
if (tag === 'TOKENS') {
|
||||||
tokens.push.apply(tokens, value);
|
tokens.push.apply(tokens, value);
|
||||||
} else if (tag === 'NEOSTRING') {
|
} else if (tag === 'NEOSTRING') {
|
||||||
if (!(value = value.replace(HEREGEX_OMIT, ''))) {
|
if (!(value = value.replace(HEREGEX_OMIT, '$1$2'))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
value = value.replace(/\\/g, '\\\\');
|
value = value.replace(/\\/g, '\\\\');
|
||||||
|
|
@ -628,10 +623,6 @@ define(function(require, exports, module) {
|
||||||
offsetInChunk = offsetInChunk || 0;
|
offsetInChunk = offsetInChunk || 0;
|
||||||
strOffset = strOffset || 0;
|
strOffset = strOffset || 0;
|
||||||
lexedLength = lexedLength || str.length;
|
lexedLength = lexedLength || str.length;
|
||||||
if (heredoc && str.length > 0 && str[0] === '\n') {
|
|
||||||
str = str.slice(1);
|
|
||||||
strOffset++;
|
|
||||||
}
|
|
||||||
tokens = [];
|
tokens = [];
|
||||||
pi = 0;
|
pi = 0;
|
||||||
i = -1;
|
i = -1;
|
||||||
|
|
@ -789,16 +780,31 @@ define(function(require, exports, module) {
|
||||||
return LINE_CONTINUER.test(this.chunk) || ((_ref2 = this.tag()) === '\\' || _ref2 === '.' || _ref2 === '?.' || _ref2 === '?::' || _ref2 === 'UNARY' || _ref2 === 'MATH' || _ref2 === '+' || _ref2 === '-' || _ref2 === 'SHIFT' || _ref2 === 'RELATION' || _ref2 === 'COMPARE' || _ref2 === 'LOGIC' || _ref2 === 'THROW' || _ref2 === 'EXTENDS');
|
return LINE_CONTINUER.test(this.chunk) || ((_ref2 = this.tag()) === '\\' || _ref2 === '.' || _ref2 === '?.' || _ref2 === '?::' || _ref2 === 'UNARY' || _ref2 === 'MATH' || _ref2 === '+' || _ref2 === '-' || _ref2 === 'SHIFT' || _ref2 === 'RELATION' || _ref2 === 'COMPARE' || _ref2 === 'LOGIC' || _ref2 === 'THROW' || _ref2 === 'EXTENDS');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Lexer.prototype.removeNewlines = function(str) {
|
||||||
|
return str.replace(/^\s*\n\s*/, '').replace(/([^\\]|\\\\)\s*\n\s*$/, '$1');
|
||||||
|
};
|
||||||
|
|
||||||
Lexer.prototype.escapeLines = function(str, heredoc) {
|
Lexer.prototype.escapeLines = function(str, heredoc) {
|
||||||
return str.replace(MULTILINER, heredoc ? '\\n' : '');
|
str = str.replace(/\\[^\S\n]*(\n|\\)\s*/g, function(escaped, character) {
|
||||||
|
if (character === '\n') {
|
||||||
|
return '';
|
||||||
|
} else {
|
||||||
|
return escaped;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (heredoc) {
|
||||||
|
return str.replace(MULTILINER, '\\n');
|
||||||
|
} else {
|
||||||
|
return str.replace(/\s*\n\s*/g, ' ');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Lexer.prototype.makeString = function(body, quote, heredoc) {
|
Lexer.prototype.makeString = function(body, quote, heredoc) {
|
||||||
if (!body) {
|
if (!body) {
|
||||||
return quote + quote;
|
return quote + quote;
|
||||||
}
|
}
|
||||||
body = body.replace(/\\([\s\S])/g, function(match, contents) {
|
body = body.replace(RegExp("\\\\(" + quote + "|\\\\)", "g"), function(match, contents) {
|
||||||
if (contents === '\n' || contents === quote) {
|
if (contents === quote) {
|
||||||
return contents;
|
return contents;
|
||||||
} else {
|
} else {
|
||||||
return match;
|
return match;
|
||||||
|
|
@ -867,27 +873,27 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
NUMBER = /^0b[01]+|^0o[0-7]+|^0x[\da-f]+|^\d*\.?\d+(?:e[+-]?\d+)?/i;
|
NUMBER = /^0b[01]+|^0o[0-7]+|^0x[\da-f]+|^\d*\.?\d+(?:e[+-]?\d+)?/i;
|
||||||
|
|
||||||
HEREDOC = /^("""|''')([\s\S]*?)(?:\n[^\n\S]*)?\1/;
|
HEREDOC = /^("""|''')((?:\\[\s\S]|[^\\])*?)(?:\n[^\n\S]*)?\1/;
|
||||||
|
|
||||||
OPERATOR = /^(?:[-=]>|[-+*\/%<>&|^!?=]=|>>>=?|([-+:])\1|([&|<>])\2=?|\?(\.|::)|\.{2,3})/;
|
OPERATOR = /^(?:[-=]>|[-+*\/%<>&|^!?=]=|>>>=?|([-+:])\1|([&|<>])\2=?|\?(\.|::)|\.{2,3})/;
|
||||||
|
|
||||||
WHITESPACE = /^[^\n\S]+/;
|
WHITESPACE = /^[^\n\S]+/;
|
||||||
|
|
||||||
COMMENT = /^###([^#][\s\S]*?)(?:###[^\n\S]*|(?:###)$)|^(?:\s*#(?!##[^#]).*)+/;
|
COMMENT = /^###([^#][\s\S]*?)(?:###[^\n\S]*|###$)|^(?:\s*#(?!##[^#]).*)+/;
|
||||||
|
|
||||||
CODE = /^[-=]>/;
|
CODE = /^[-=]>/;
|
||||||
|
|
||||||
MULTI_DENT = /^(?:\n[^\n\S]*)+/;
|
MULTI_DENT = /^(?:\n[^\n\S]*)+/;
|
||||||
|
|
||||||
SIMPLESTR = /^'[^\\']*(?:\\.[^\\']*)*'/;
|
SIMPLESTR = /^'[^\\']*(?:\\[\s\S][^\\']*)*'/;
|
||||||
|
|
||||||
JSTOKEN = /^`[^\\`]*(?:\\.[^\\`]*)*`/;
|
JSTOKEN = /^`[^\\`]*(?:\\.[^\\`]*)*`/;
|
||||||
|
|
||||||
REGEX = /^(\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)([imgy]{0,4})(?!\w)/;
|
REGEX = /^(\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)([imgy]{0,4})(?!\w)/;
|
||||||
|
|
||||||
HEREGEX = /^\/{3}([\s\S]+?)\/{3}([imgy]{0,4})(?!\w)/;
|
HEREGEX = /^\/{3}((?:\\?[\s\S])+?)\/{3}([imgy]{0,4})(?!\w)/;
|
||||||
|
|
||||||
HEREGEX_OMIT = /\s+(?:#.*)?/g;
|
HEREGEX_OMIT = /((?:\\\\)+)|\\(\s|\/)|\s+(?:#.*)?/g;
|
||||||
|
|
||||||
MULTILINER = /\n/g;
|
MULTILINER = /\n/g;
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -27,7 +27,7 @@
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
// Generated by CoffeeScript 1.6.3
|
// Generated by CoffeeScript 1.6.3
|
||||||
|
|
||||||
var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, generate, left, rite, _i, _len, _ref,
|
var BALANCED_PAIRS, CALL_CLOSERS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, generate, left, rite, _i, _len, _ref,
|
||||||
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
|
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
|
||||||
__slice = [].slice;
|
__slice = [].slice;
|
||||||
|
|
||||||
|
|
@ -44,10 +44,9 @@ define(function(require, exports, module) {
|
||||||
Rewriter.prototype.rewrite = function(tokens) {
|
Rewriter.prototype.rewrite = function(tokens) {
|
||||||
this.tokens = tokens;
|
this.tokens = tokens;
|
||||||
this.removeLeadingNewlines();
|
this.removeLeadingNewlines();
|
||||||
this.removeMidExpressionNewlines();
|
|
||||||
this.closeOpenCalls();
|
this.closeOpenCalls();
|
||||||
this.closeOpenIndexes();
|
this.closeOpenIndexes();
|
||||||
this.addImplicitIndentation();
|
this.normalizeLines();
|
||||||
this.tagPostfixConditionals();
|
this.tagPostfixConditionals();
|
||||||
this.addImplicitBracesAndParens();
|
this.addImplicitBracesAndParens();
|
||||||
this.addLocationDataToGeneratedTokens();
|
this.addLocationDataToGeneratedTokens();
|
||||||
|
|
@ -99,17 +98,6 @@ define(function(require, exports, module) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Rewriter.prototype.removeMidExpressionNewlines = function() {
|
|
||||||
return this.scanTokens(function(token, i, tokens) {
|
|
||||||
var _ref;
|
|
||||||
if (!(token[0] === 'TERMINATOR' && (_ref = this.tag(i + 1), __indexOf.call(EXPRESSION_CLOSE, _ref) >= 0))) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
tokens.splice(i, 1);
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
Rewriter.prototype.closeOpenCalls = function() {
|
Rewriter.prototype.closeOpenCalls = function() {
|
||||||
var action, condition;
|
var action, condition;
|
||||||
condition = function(token, i) {
|
condition = function(token, i) {
|
||||||
|
|
@ -188,9 +176,9 @@ define(function(require, exports, module) {
|
||||||
var stack;
|
var stack;
|
||||||
stack = [];
|
stack = [];
|
||||||
return this.scanTokens(function(token, i, tokens) {
|
return this.scanTokens(function(token, i, tokens) {
|
||||||
var endImplicitCall, endImplicitObject, forward, inImplicit, inImplicitCall, inImplicitControl, inImplicitObject, nextTag, offset, prevTag, s, sameLine, stackIdx, stackTag, stackTop, startIdx, startImplicitCall, startImplicitObject, startsLine, tag, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
|
var endAllImplicitCalls, endImplicitCall, endImplicitObject, forward, inImplicit, inImplicitCall, inImplicitControl, inImplicitObject, nextTag, offset, prevTag, prevToken, s, sameLine, stackIdx, stackTag, stackTop, startIdx, startImplicitCall, startImplicitObject, startsLine, tag, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
|
||||||
tag = token[0];
|
tag = token[0];
|
||||||
prevTag = (i > 0 ? tokens[i - 1] : [])[0];
|
prevTag = (prevToken = i > 0 ? tokens[i - 1] : [])[0];
|
||||||
nextTag = (i < tokens.length - 1 ? tokens[i + 1] : [])[0];
|
nextTag = (i < tokens.length - 1 ? tokens[i + 1] : [])[0];
|
||||||
stackTop = function() {
|
stackTop = function() {
|
||||||
return stack[stack.length - 1];
|
return stack[stack.length - 1];
|
||||||
|
|
@ -233,6 +221,11 @@ define(function(require, exports, module) {
|
||||||
tokens.splice(i, 0, generate('CALL_END', ')'));
|
tokens.splice(i, 0, generate('CALL_END', ')'));
|
||||||
return i += 1;
|
return i += 1;
|
||||||
};
|
};
|
||||||
|
endAllImplicitCalls = function() {
|
||||||
|
while (inImplicitCall()) {
|
||||||
|
endImplicitCall();
|
||||||
|
}
|
||||||
|
};
|
||||||
startImplicitObject = function(j, startsLine) {
|
startImplicitObject = function(j, startsLine) {
|
||||||
var idx;
|
var idx;
|
||||||
if (startsLine == null) {
|
if (startsLine == null) {
|
||||||
|
|
@ -324,9 +317,15 @@ define(function(require, exports, module) {
|
||||||
startImplicitObject(s, !!startsLine);
|
startImplicitObject(s, !!startsLine);
|
||||||
return forward(2);
|
return forward(2);
|
||||||
}
|
}
|
||||||
if (prevTag === 'OUTDENT' && inImplicitCall() && (tag === '.' || tag === '?.' || tag === '::' || tag === '?::')) {
|
if (inImplicitCall() && __indexOf.call(CALL_CLOSERS, tag) >= 0) {
|
||||||
endImplicitCall();
|
if (prevTag === 'OUTDENT') {
|
||||||
return forward(1);
|
endImplicitCall();
|
||||||
|
return forward(1);
|
||||||
|
}
|
||||||
|
if (prevToken.newLine) {
|
||||||
|
endAllImplicitCalls();
|
||||||
|
return forward(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (inImplicitObject() && __indexOf.call(LINEBREAKS, tag) >= 0) {
|
if (inImplicitObject() && __indexOf.call(LINEBREAKS, tag) >= 0) {
|
||||||
stackTop()[2].sameLine = false;
|
stackTop()[2].sameLine = false;
|
||||||
|
|
@ -381,30 +380,32 @@ define(function(require, exports, module) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Rewriter.prototype.addImplicitIndentation = function() {
|
Rewriter.prototype.normalizeLines = function() {
|
||||||
var action, condition, indent, outdent, starter;
|
var action, condition, indent, outdent, starter;
|
||||||
starter = indent = outdent = null;
|
starter = indent = outdent = null;
|
||||||
condition = function(token, i) {
|
condition = function(token, i) {
|
||||||
var _ref, _ref1;
|
var _ref, _ref1, _ref2, _ref3;
|
||||||
return token[1] !== ';' && (_ref = token[0], __indexOf.call(SINGLE_CLOSERS, _ref) >= 0) && !(token[0] === 'ELSE' && starter !== 'THEN') && !(((_ref1 = token[0]) === 'CATCH' || _ref1 === 'FINALLY') && (starter === '->' || starter === '=>'));
|
return token[1] !== ';' && (_ref = token[0], __indexOf.call(SINGLE_CLOSERS, _ref) >= 0) && !(token[0] === 'TERMINATOR' && (_ref1 = this.tag(i + 1), __indexOf.call(EXPRESSION_CLOSE, _ref1) >= 0)) && !(token[0] === 'ELSE' && starter !== 'THEN') && !(((_ref2 = token[0]) === 'CATCH' || _ref2 === 'FINALLY') && (starter === '->' || starter === '=>')) || (_ref3 = token[0], __indexOf.call(CALL_CLOSERS, _ref3) >= 0) && this.tokens[i - 1].newLine;
|
||||||
};
|
};
|
||||||
action = function(token, i) {
|
action = function(token, i) {
|
||||||
return this.tokens.splice((this.tag(i - 1) === ',' ? i - 1 : i), 0, outdent);
|
return this.tokens.splice((this.tag(i - 1) === ',' ? i - 1 : i), 0, outdent);
|
||||||
};
|
};
|
||||||
return this.scanTokens(function(token, i, tokens) {
|
return this.scanTokens(function(token, i, tokens) {
|
||||||
var j, tag, _i, _ref, _ref1;
|
var j, tag, _i, _ref, _ref1, _ref2;
|
||||||
tag = token[0];
|
tag = token[0];
|
||||||
if (tag === 'TERMINATOR' && this.tag(i + 1) === 'THEN') {
|
if (tag === 'TERMINATOR') {
|
||||||
tokens.splice(i, 1);
|
if (this.tag(i + 1) === 'ELSE' && this.tag(i - 1) !== 'OUTDENT') {
|
||||||
return 0;
|
tokens.splice.apply(tokens, [i, 1].concat(__slice.call(this.indentation())));
|
||||||
}
|
return 1;
|
||||||
if (tag === 'ELSE' && this.tag(i - 1) !== 'OUTDENT') {
|
}
|
||||||
tokens.splice.apply(tokens, [i, 0].concat(__slice.call(this.indentation())));
|
if (_ref = this.tag(i + 1), __indexOf.call(EXPRESSION_CLOSE, _ref) >= 0) {
|
||||||
return 2;
|
tokens.splice(i, 1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (tag === 'CATCH') {
|
if (tag === 'CATCH') {
|
||||||
for (j = _i = 1; _i <= 2; j = ++_i) {
|
for (j = _i = 1; _i <= 2; j = ++_i) {
|
||||||
if (!((_ref = this.tag(i + j)) === 'OUTDENT' || _ref === 'TERMINATOR' || _ref === 'FINALLY')) {
|
if (!((_ref1 = this.tag(i + j)) === 'OUTDENT' || _ref1 === 'TERMINATOR' || _ref1 === 'FINALLY')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
tokens.splice.apply(tokens, [i + j, 0].concat(__slice.call(this.indentation())));
|
tokens.splice.apply(tokens, [i + j, 0].concat(__slice.call(this.indentation())));
|
||||||
|
|
@ -413,7 +414,7 @@ define(function(require, exports, module) {
|
||||||
}
|
}
|
||||||
if (__indexOf.call(SINGLE_LINERS, tag) >= 0 && this.tag(i + 1) !== 'INDENT' && !(tag === 'ELSE' && this.tag(i + 1) === 'IF')) {
|
if (__indexOf.call(SINGLE_LINERS, tag) >= 0 && this.tag(i + 1) !== 'INDENT' && !(tag === 'ELSE' && this.tag(i + 1) === 'IF')) {
|
||||||
starter = tag;
|
starter = tag;
|
||||||
_ref1 = this.indentation(true), indent = _ref1[0], outdent = _ref1[1];
|
_ref2 = this.indentation(true), indent = _ref2[0], outdent = _ref2[1];
|
||||||
if (starter === 'THEN') {
|
if (starter === 'THEN') {
|
||||||
indent.fromThen = true;
|
indent.fromThen = true;
|
||||||
}
|
}
|
||||||
|
|
@ -493,7 +494,7 @@ define(function(require, exports, module) {
|
||||||
EXPRESSION_END.push(INVERSES[left] = rite);
|
EXPRESSION_END.push(INVERSES[left] = rite);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPRESSION_CLOSE = ['CATCH', 'WHEN', 'ELSE', 'FINALLY'].concat(EXPRESSION_END);
|
EXPRESSION_CLOSE = ['CATCH', 'THEN', 'ELSE', 'FINALLY'].concat(EXPRESSION_END);
|
||||||
|
|
||||||
IMPLICIT_FUNC = ['IDENTIFIER', 'SUPER', ')', 'CALL_END', ']', 'INDEX_END', '@', 'THIS'];
|
IMPLICIT_FUNC = ['IDENTIFIER', 'SUPER', ')', 'CALL_END', ']', 'INDEX_END', '@', 'THIS'];
|
||||||
|
|
||||||
|
|
@ -509,5 +510,7 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
LINEBREAKS = ['TERMINATOR', 'INDENT', 'OUTDENT'];
|
LINEBREAKS = ['TERMINATOR', 'INDENT', 'OUTDENT'];
|
||||||
|
|
||||||
|
CALL_CLOSERS = ['.', '?.', '::', '?::'];
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -191,7 +191,7 @@ var DHighlightRules = function() {
|
||||||
"star-comment" : [
|
"star-comment" : [
|
||||||
{
|
{
|
||||||
token : "comment", // closing comment
|
token : "comment", // closing comment
|
||||||
regex : ".*?\\*\\/",
|
regex : "\\*\\/",
|
||||||
next : "start"
|
next : "start"
|
||||||
}, {
|
}, {
|
||||||
defaultToken: 'comment'
|
defaultToken: 'comment'
|
||||||
|
|
@ -200,7 +200,7 @@ var DHighlightRules = function() {
|
||||||
"plus-comment" : [
|
"plus-comment" : [
|
||||||
{
|
{
|
||||||
token : "comment", // closing comment
|
token : "comment", // closing comment
|
||||||
regex : ".*?\\+\\/",
|
regex : "\\+\\/",
|
||||||
next : "start"
|
next : "start"
|
||||||
}, {
|
}, {
|
||||||
defaultToken: 'comment'
|
defaultToken: 'comment'
|
||||||
|
|
@ -211,7 +211,7 @@ var DHighlightRules = function() {
|
||||||
stringEscapesSeq,
|
stringEscapesSeq,
|
||||||
{
|
{
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"[cdw]?',
|
regex : '"[cdw]?',
|
||||||
next : "start"
|
next : "start"
|
||||||
}, {
|
}, {
|
||||||
defaultToken: 'string'
|
defaultToken: 'string'
|
||||||
|
|
@ -222,7 +222,7 @@ var DHighlightRules = function() {
|
||||||
stringEscapesSeq,
|
stringEscapesSeq,
|
||||||
{
|
{
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : '(?:(?:\\\\.)|(?:[^`\\\\]))*?`[cdw]?',
|
regex : '`[cdw]?',
|
||||||
next : "start"
|
next : "start"
|
||||||
}, {
|
}, {
|
||||||
defaultToken: 'string'
|
defaultToken: 'string'
|
||||||
|
|
@ -234,7 +234,7 @@ var DHighlightRules = function() {
|
||||||
onMatch: function(value, currentState, state) {
|
onMatch: function(value, currentState, state) {
|
||||||
value = value.substring(value.length-2, value.length-1);
|
value = value.substring(value.length-2, value.length-1);
|
||||||
var map = {'>':'<',']':'[',')':'(','}':'{'};
|
var map = {'>':'<',']':'[',')':'(','}':'{'};
|
||||||
if(Object.keys(map).indexOf(value) != -1)
|
if(Object.keys(map).indexOf(value) != -1)
|
||||||
value = map[value];
|
value = map[value];
|
||||||
if(value != state[1]) return "string";
|
if(value != state[1]) return "string";
|
||||||
state.shift();
|
state.shift();
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,8 @@ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||||
var unicode = require("../unicode");
|
var unicode = require("../unicode");
|
||||||
|
|
||||||
var Mode = function(opts) {
|
var Mode = function(opts) {
|
||||||
var inline = opts && opts.inline;
|
this.inlinePhp = opts && opts.inline;
|
||||||
var HighlightRules = inline ? PhpLangHighlightRules : PhpHighlightRules;
|
var HighlightRules = this.inlinePhp ? PhpLangHighlightRules : PhpHighlightRules;
|
||||||
this.HighlightRules = HighlightRules;
|
this.HighlightRules = HighlightRules;
|
||||||
this.$outdent = new MatchingBraceOutdent();
|
this.$outdent = new MatchingBraceOutdent();
|
||||||
this.$behaviour = new CstyleBehaviour();
|
this.$behaviour = new CstyleBehaviour();
|
||||||
|
|
@ -117,6 +117,9 @@ oop.inherits(Mode, TextMode);
|
||||||
this.createWorker = function(session) {
|
this.createWorker = function(session) {
|
||||||
var worker = new WorkerClient(["ace"], "ace/mode/php_worker", "PhpWorker");
|
var worker = new WorkerClient(["ace"], "ace/mode/php_worker", "PhpWorker");
|
||||||
worker.attachToDocument(session.getDocument());
|
worker.attachToDocument(session.getDocument());
|
||||||
|
|
||||||
|
if (this.inlinePhp)
|
||||||
|
worker.call("setOptions", [{inline: true}]);
|
||||||
|
|
||||||
worker.on("error", function(e) {
|
worker.on("error", function(e) {
|
||||||
session.setAnnotations(e.data);
|
session.setAnnotations(e.data);
|
||||||
|
|
|
||||||
|
|
@ -43,12 +43,17 @@ var PhpWorker = exports.PhpWorker = function(sender) {
|
||||||
oop.inherits(PhpWorker, Mirror);
|
oop.inherits(PhpWorker, Mirror);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
this.setOptions = function(opts) {
|
||||||
|
this.inlinePhp = opts && opts.inline;
|
||||||
|
};
|
||||||
|
|
||||||
this.onUpdate = function() {
|
this.onUpdate = function() {
|
||||||
var value = this.doc.getValue();
|
var value = this.doc.getValue();
|
||||||
var errors = [];
|
var errors = [];
|
||||||
|
|
||||||
// var start = new Date();
|
// var start = new Date();
|
||||||
|
if (this.inlinePhp)
|
||||||
|
value = "<?" + value + "?>";
|
||||||
|
|
||||||
var tokens = PHP.Lexer(value, {short_open_tag: 1});
|
var tokens = PHP.Lexer(value, {short_open_tag: 1});
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ var XmlHighlightRules = function(normalize) {
|
||||||
token : "constant.language.escape",
|
token : "constant.language.escape",
|
||||||
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
|
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
|
||||||
}, {
|
}, {
|
||||||
token : "invalid.illegal", regex : "&"
|
token : "text", regex : "&"
|
||||||
}],
|
}],
|
||||||
|
|
||||||
string: [{
|
string: [{
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ dom.importCssString(editorCss, "ace_editor");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The class that is responsible for drawing everything you see on the screen!
|
* The class that is responsible for drawing everything you see on the screen!
|
||||||
|
* @related editor.renderer
|
||||||
* @class VirtualRenderer
|
* @class VirtualRenderer
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
@ -1469,18 +1470,18 @@ var VirtualRenderer = function(container, theme) {
|
||||||
**/
|
**/
|
||||||
this.setTheme = function(theme, cb) {
|
this.setTheme = function(theme, cb) {
|
||||||
var _self = this;
|
var _self = this;
|
||||||
this.$themeValue = theme;
|
this.$themeId = theme;
|
||||||
_self._dispatchEvent('themeChange',{theme:theme});
|
_self._dispatchEvent('themeChange',{theme:theme});
|
||||||
|
|
||||||
if (!theme || typeof theme == "string") {
|
if (!theme || typeof theme == "string") {
|
||||||
var moduleName = theme || "ace/theme/textmate";
|
var moduleName = theme || this.$options.theme.initialValue;
|
||||||
config.loadModule(["theme", moduleName], afterLoad);
|
config.loadModule(["theme", moduleName], afterLoad);
|
||||||
} else {
|
} else {
|
||||||
afterLoad(theme);
|
afterLoad(theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
function afterLoad(module) {
|
function afterLoad(module) {
|
||||||
if (_self.$themeValue != theme)
|
if (_self.$themeId != theme)
|
||||||
return cb && cb();
|
return cb && cb();
|
||||||
if (!module.cssClass)
|
if (!module.cssClass)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1507,7 +1508,7 @@ var VirtualRenderer = function(container, theme) {
|
||||||
// force re-measure of the gutter width
|
// force re-measure of the gutter width
|
||||||
if (_self.$size) {
|
if (_self.$size) {
|
||||||
_self.$size.width = 0;
|
_self.$size.width = 0;
|
||||||
_self.onResize();
|
_self.$updateSizeAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
_self._dispatchEvent('themeLoaded', {theme:module});
|
_self._dispatchEvent('themeLoaded', {theme:module});
|
||||||
|
|
@ -1520,7 +1521,7 @@ var VirtualRenderer = function(container, theme) {
|
||||||
* @returns {String}
|
* @returns {String}
|
||||||
**/
|
**/
|
||||||
this.getTheme = function() {
|
this.getTheme = function() {
|
||||||
return this.$themeValue;
|
return this.$themeId;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Methods allows to add / remove CSS classnames to the editor element.
|
// Methods allows to add / remove CSS classnames to the editor element.
|
||||||
|
|
@ -1688,6 +1689,12 @@ config.defineOptions(VirtualRenderer.prototype, "renderer", {
|
||||||
this.$gutterLayer.$fixedWidth = !!val;
|
this.$gutterLayer.$fixedWidth = !!val;
|
||||||
this.$loop.schedule(this.CHANGE_GUTTER);
|
this.$loop.schedule(this.CHANGE_GUTTER);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
theme: {
|
||||||
|
set: function(val) { this.setTheme(val) },
|
||||||
|
get: function() { return this.$themeId || this.theme; },
|
||||||
|
initialValue: "./theme/textmate",
|
||||||
|
handlesSet: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ var rootDir = __dirname + "/../lib/ace/";
|
||||||
var deps = {
|
var deps = {
|
||||||
csslint: {
|
csslint: {
|
||||||
path: "mode/css/csslint.js",
|
path: "mode/css/csslint.js",
|
||||||
url: "https://raw.github.com/stubbornella/csslint/master/release/csslint-node.js",
|
url: "https://raw.github.com/stubbornella/csslint/master/release/csslint.js",
|
||||||
needsFixup: true
|
needsFixup: true
|
||||||
},
|
},
|
||||||
requirejs: {
|
requirejs: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue