commit
95e0f2fffd
12 changed files with 5860 additions and 2701 deletions
|
|
@ -69,6 +69,12 @@ var ElasticTabstopsLite = require("ace/ext/elastic_tabstops_lite").ElasticTabsto
|
||||||
|
|
||||||
var IncrementalSearch = require("ace/incremental_search").IncrementalSearch;
|
var IncrementalSearch = require("ace/incremental_search").IncrementalSearch;
|
||||||
|
|
||||||
|
|
||||||
|
var workerModule = require("ace/worker/worker_client");
|
||||||
|
if (location.href.indexOf("noworker" !== -1)) {
|
||||||
|
workerModule.WorkerClient = workerModule.UIWorkerClient;
|
||||||
|
}
|
||||||
|
|
||||||
/*********** create editor ***************************/
|
/*********** create editor ***************************/
|
||||||
var container = document.getElementById("editor-container");
|
var container = document.getElementById("editor-container");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/** vim: et:ts=4:sw=4:sts=4
|
/** vim: et:ts=4:sw=4:sts=4
|
||||||
* @license RequireJS 2.1.5 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
|
* @license RequireJS 2.1.6 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.5',
|
version = '2.1.6',
|
||||||
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 && document),
|
isBrowser = !!(typeof window !== 'undefined' && navigator && 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,
|
||||||
|
|
@ -134,6 +134,10 @@ var requirejs, require, define;
|
||||||
return document.getElementsByTagName('script');
|
return document.getElementsByTagName('script');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function defaultOnError(err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
|
||||||
//Allow getting a global that expressed in
|
//Allow getting a global that expressed in
|
||||||
//dot notation, like 'a.b.c'.
|
//dot notation, like 'a.b.c'.
|
||||||
function getGlobal(value) {
|
function getGlobal(value) {
|
||||||
|
|
@ -500,7 +504,12 @@ var requirejs, require, define;
|
||||||
fn(defined[id]);
|
fn(defined[id]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
getModule(depMap).on(name, fn);
|
mod = getModule(depMap);
|
||||||
|
if (mod.error && name === 'error') {
|
||||||
|
fn(mod.error);
|
||||||
|
} else {
|
||||||
|
mod.on(name, fn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -571,7 +580,13 @@ var requirejs, require, define;
|
||||||
id: mod.map.id,
|
id: mod.map.id,
|
||||||
uri: mod.map.url,
|
uri: mod.map.url,
|
||||||
config: function () {
|
config: function () {
|
||||||
return (config.config && getOwn(config.config, mod.map.id)) || {};
|
var c,
|
||||||
|
pkg = getOwn(config.pkgs, mod.map.id);
|
||||||
|
// For packages, only support config targeted
|
||||||
|
// at the main module.
|
||||||
|
c = pkg ? getOwn(config.config, mod.map.id + '/' + pkg.main) :
|
||||||
|
getOwn(config.config, mod.map.id);
|
||||||
|
return c || {};
|
||||||
},
|
},
|
||||||
exports: defined[mod.map.id]
|
exports: defined[mod.map.id]
|
||||||
});
|
});
|
||||||
|
|
@ -840,8 +855,13 @@ var requirejs, require, define;
|
||||||
if (this.depCount < 1 && !this.defined) {
|
if (this.depCount < 1 && !this.defined) {
|
||||||
if (isFunction(factory)) {
|
if (isFunction(factory)) {
|
||||||
//If there is an error listener, favor passing
|
//If there is an error listener, favor passing
|
||||||
//to that instead of throwing an error.
|
//to that instead of throwing an error. However,
|
||||||
if (this.events.error) {
|
//only do it for define()'d modules. require
|
||||||
|
//errbacks should not be called for failures in
|
||||||
|
//their callbacks (#699). However if a global
|
||||||
|
//onError is set, use that.
|
||||||
|
if ((this.events.error && this.map.isDefine) ||
|
||||||
|
req.onError !== defaultOnError) {
|
||||||
try {
|
try {
|
||||||
exports = context.execCb(id, factory, depExports, exports);
|
exports = context.execCb(id, factory, depExports, exports);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
@ -869,8 +889,8 @@ var requirejs, require, define;
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
err.requireMap = this.map;
|
err.requireMap = this.map;
|
||||||
err.requireModules = [this.map.id];
|
err.requireModules = this.map.isDefine ? [this.map.id] : null;
|
||||||
err.requireType = 'define';
|
err.requireType = this.map.isDefine ? 'define' : 'require';
|
||||||
return onError((this.error = err));
|
return onError((this.error = err));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1093,7 +1113,7 @@ var requirejs, require, define;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (this.errback) {
|
if (this.errback) {
|
||||||
on(depMap, 'error', this.errback);
|
on(depMap, 'error', bind(this, this.errback));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1605,7 +1625,7 @@ var requirejs, require, define;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes a module callack function. Broken out as a separate function
|
* Executes a module callback function. Broken out as a separate function
|
||||||
* solely to allow the build system to sequence the files in the built
|
* solely to allow the build system to sequence the files in the built
|
||||||
* layer in the right sequence.
|
* layer in the right sequence.
|
||||||
*
|
*
|
||||||
|
|
@ -1643,7 +1663,7 @@ var requirejs, require, define;
|
||||||
onScriptError: function (evt) {
|
onScriptError: function (evt) {
|
||||||
var data = getScriptData(evt);
|
var data = getScriptData(evt);
|
||||||
if (!hasPathFallback(data.id)) {
|
if (!hasPathFallback(data.id)) {
|
||||||
return onError(makeError('scripterror', 'Script error', evt, [data.id]));
|
return onError(makeError('scripterror', 'Script error for: ' + data.id, evt, [data.id]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -1772,9 +1792,7 @@ var requirejs, require, define;
|
||||||
* function. Intercept/override it if you want custom error handling.
|
* function. Intercept/override it if you want custom error handling.
|
||||||
* @param {Error} err the error object.
|
* @param {Error} err the error object.
|
||||||
*/
|
*/
|
||||||
req.onError = function (err) {
|
req.onError = defaultOnError;
|
||||||
throw err;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does the request to load a module for the browser case.
|
* Does the request to load a module for the browser case.
|
||||||
|
|
@ -1906,24 +1924,31 @@ var requirejs, require, define;
|
||||||
//baseUrl, if it is not already set.
|
//baseUrl, if it is not already set.
|
||||||
dataMain = script.getAttribute('data-main');
|
dataMain = script.getAttribute('data-main');
|
||||||
if (dataMain) {
|
if (dataMain) {
|
||||||
|
//Preserve dataMain in case it is a path (i.e. contains '?')
|
||||||
|
mainScript = dataMain;
|
||||||
|
|
||||||
//Set final baseUrl if there is not already an explicit one.
|
//Set final baseUrl if there is not already an explicit one.
|
||||||
if (!cfg.baseUrl) {
|
if (!cfg.baseUrl) {
|
||||||
//Pull off the directory of data-main for use as the
|
//Pull off the directory of data-main for use as the
|
||||||
//baseUrl.
|
//baseUrl.
|
||||||
src = dataMain.split('/');
|
src = mainScript.split('/');
|
||||||
mainScript = src.pop();
|
mainScript = src.pop();
|
||||||
subPath = src.length ? src.join('/') + '/' : './';
|
subPath = src.length ? src.join('/') + '/' : './';
|
||||||
|
|
||||||
cfg.baseUrl = subPath;
|
cfg.baseUrl = subPath;
|
||||||
dataMain = mainScript;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Strip off any trailing .js since dataMain is now
|
//Strip off any trailing .js since mainScript is now
|
||||||
//like a module name.
|
//like a module name.
|
||||||
dataMain = dataMain.replace(jsSuffixRegExp, '');
|
mainScript = mainScript.replace(jsSuffixRegExp, '');
|
||||||
|
|
||||||
|
//If mainScript is still a path, fall back to dataMain
|
||||||
|
if (req.jsExtRegExp.test(mainScript)) {
|
||||||
|
mainScript = dataMain;
|
||||||
|
}
|
||||||
|
|
||||||
//Put the data-main script in the files to load.
|
//Put the data-main script in the files to load.
|
||||||
cfg.deps = cfg.deps ? cfg.deps.concat(dataMain) : [dataMain];
|
cfg.deps = cfg.deps ? cfg.deps.concat(mainScript) : [mainScript];
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
// Generated by CoffeeScript 1.6.2
|
// Generated by CoffeeScript 1.6.3
|
||||||
|
|
||||||
var buildLocationData, extend, flatten, last, repeat, _ref;
|
var buildLocationData, extend, flatten, last, repeat, _ref;
|
||||||
|
|
||||||
|
|
@ -214,11 +214,11 @@ define(function(require, exports, module) {
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.throwSyntaxError = function(message, location) {
|
exports.throwSyntaxError = function(message, location) {
|
||||||
var error, _ref1, _ref2;
|
var error;
|
||||||
if ((_ref1 = location.last_line) == null) {
|
if (location.last_line == null) {
|
||||||
location.last_line = location.first_line;
|
location.last_line = location.first_line;
|
||||||
}
|
}
|
||||||
if ((_ref2 = location.last_column) == null) {
|
if (location.last_column == null) {
|
||||||
location.last_column = location.first_column;
|
location.last_column = location.first_column;
|
||||||
}
|
}
|
||||||
error = new SyntaxError(message);
|
error = new SyntaxError(message);
|
||||||
|
|
@ -226,11 +226,13 @@ define(function(require, exports, module) {
|
||||||
throw error;
|
throw error;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.prettyErrorMessage = function(error, fileName, code, useColors) {
|
exports.prettyErrorMessage = function(error, filename, code, useColors) {
|
||||||
var codeLine, colorize, end, first_column, first_line, last_column, last_line, marker, message, start, _ref1;
|
var codeLine, colorize, end, first_column, first_line, last_column, last_line, marker, message, start, _ref1;
|
||||||
if (!error.location) {
|
if (!error.location) {
|
||||||
return error.stack || ("" + error);
|
return error.stack || ("" + error);
|
||||||
}
|
}
|
||||||
|
filename = error.filename || filename;
|
||||||
|
code = error.code || code;
|
||||||
_ref1 = error.location, first_line = _ref1.first_line, first_column = _ref1.first_column, last_line = _ref1.last_line, last_column = _ref1.last_column;
|
_ref1 = error.location, first_line = _ref1.first_line, first_column = _ref1.first_column, last_line = _ref1.last_line, last_column = _ref1.last_column;
|
||||||
codeLine = code.split('\n')[first_line];
|
codeLine = code.split('\n')[first_line];
|
||||||
start = first_column;
|
start = first_column;
|
||||||
|
|
@ -243,7 +245,7 @@ define(function(require, exports, module) {
|
||||||
codeLine = codeLine.slice(0, start) + colorize(codeLine.slice(start, end)) + codeLine.slice(end);
|
codeLine = codeLine.slice(0, start) + colorize(codeLine.slice(start, end)) + codeLine.slice(end);
|
||||||
marker = colorize(marker);
|
marker = colorize(marker);
|
||||||
}
|
}
|
||||||
message = "" + fileName + ":" + (first_line + 1) + ":" + (first_column + 1) + ": error: " + error.message + "\n" + codeLine + "\n" + marker;
|
message = "" + filename + ":" + (first_line + 1) + ":" + (first_column + 1) + ": error: " + error.message + "\n" + codeLine + "\n" + marker;
|
||||||
return message;
|
return message;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,14 +25,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
// Generated by CoffeeScript 1.6.2
|
// Generated by CoffeeScript 1.6.3
|
||||||
|
|
||||||
var BOM, BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_ALIAS_MAP, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HEREDOC, HEREDOC_ILLEGAL, HEREDOC_INDENT, HEREGEX, HEREGEX_OMIT, IDENTIFIER, INDEXABLE, INVERSES, JSTOKEN, JS_FORBIDDEN, JS_KEYWORDS, LINE_BREAK, LINE_CONTINUER, LOGIC, Lexer, MATH, MULTILINER, MULTI_DENT, NOT_REGEX, NOT_SPACED_REGEX, NUMBER, OPERATOR, REGEX, RELATION, RESERVED, Rewriter, SHIFT, SIMPLESTR, STRICT_PROSCRIBED, TRAILING_SPACES, UNARY, WHITESPACE, compact, count, invertLiterate, key, last, locationDataToString, starts, throwSyntaxError, _ref, _ref1,
|
var BOM, BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_ALIAS_MAP, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HEREDOC, HEREDOC_ILLEGAL, HEREDOC_INDENT, HEREGEX, HEREGEX_OMIT, IDENTIFIER, INDEXABLE, INVERSES, JSTOKEN, JS_FORBIDDEN, JS_KEYWORDS, LINE_BREAK, LINE_CONTINUER, LOGIC, Lexer, MATH, MULTILINER, MULTI_DENT, NOT_REGEX, NOT_SPACED_REGEX, NUMBER, OPERATOR, REGEX, RELATION, RESERVED, Rewriter, SHIFT, SIMPLESTR, STRICT_PROSCRIBED, TRAILING_SPACES, UNARY, WHITESPACE, compact, count, invertLiterate, key, last, locationDataToString, repeat, starts, throwSyntaxError, _ref, _ref1,
|
||||||
__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; };
|
||||||
|
|
||||||
_ref = require('./rewriter'), Rewriter = _ref.Rewriter, INVERSES = _ref.INVERSES;
|
_ref = require('./rewriter'), Rewriter = _ref.Rewriter, INVERSES = _ref.INVERSES;
|
||||||
|
|
||||||
_ref1 = require('./helpers'), count = _ref1.count, starts = _ref1.starts, compact = _ref1.compact, last = _ref1.last, invertLiterate = _ref1.invertLiterate, locationDataToString = _ref1.locationDataToString, throwSyntaxError = _ref1.throwSyntaxError;
|
_ref1 = require('./helpers'), count = _ref1.count, starts = _ref1.starts, compact = _ref1.compact, last = _ref1.last, repeat = _ref1.repeat, invertLiterate = _ref1.invertLiterate, locationDataToString = _ref1.locationDataToString, throwSyntaxError = _ref1.throwSyntaxError;
|
||||||
|
|
||||||
exports.Lexer = Lexer = (function() {
|
exports.Lexer = Lexer = (function() {
|
||||||
function Lexer() {}
|
function Lexer() {}
|
||||||
|
|
@ -182,10 +182,10 @@ define(function(require, exports, module) {
|
||||||
}
|
}
|
||||||
lexedLength = number.length;
|
lexedLength = number.length;
|
||||||
if (octalLiteral = /^0o([0-7]+)/.exec(number)) {
|
if (octalLiteral = /^0o([0-7]+)/.exec(number)) {
|
||||||
number = '0x' + (parseInt(octalLiteral[1], 8)).toString(16);
|
number = '0x' + parseInt(octalLiteral[1], 8).toString(16);
|
||||||
}
|
}
|
||||||
if (binaryLiteral = /^0b([01]+)/.exec(number)) {
|
if (binaryLiteral = /^0b([01]+)/.exec(number)) {
|
||||||
number = '0x' + (parseInt(binaryLiteral[1], 2)).toString(16);
|
number = '0x' + parseInt(binaryLiteral[1], 2).toString(16);
|
||||||
}
|
}
|
||||||
this.token('NUMBER', number, 0, lexedLength);
|
this.token('NUMBER', number, 0, lexedLength);
|
||||||
return lexedLength;
|
return lexedLength;
|
||||||
|
|
@ -255,7 +255,7 @@ define(function(require, exports, module) {
|
||||||
if (here) {
|
if (here) {
|
||||||
this.token('HERECOMMENT', this.sanitizeHeredoc(here, {
|
this.token('HERECOMMENT', this.sanitizeHeredoc(here, {
|
||||||
herecomment: true,
|
herecomment: true,
|
||||||
indent: Array(this.indent + 1).join(' ')
|
indent: repeat(' ', this.indent)
|
||||||
}), 0, comment.length);
|
}), 0, comment.length);
|
||||||
}
|
}
|
||||||
return comment.length;
|
return comment.length;
|
||||||
|
|
@ -737,7 +737,7 @@ define(function(require, exports, module) {
|
||||||
column = this.chunkColumn;
|
column = this.chunkColumn;
|
||||||
if (lineCount > 0) {
|
if (lineCount > 0) {
|
||||||
lines = string.split('\n');
|
lines = string.split('\n');
|
||||||
column = (last(lines)).length;
|
column = last(lines).length;
|
||||||
} else {
|
} else {
|
||||||
column += string.length;
|
column += string.length;
|
||||||
}
|
}
|
||||||
|
|
@ -903,9 +903,9 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
BOOL = ['TRUE', 'FALSE'];
|
BOOL = ['TRUE', 'FALSE'];
|
||||||
|
|
||||||
NOT_REGEX = ['NUMBER', 'REGEX', 'BOOL', 'NULL', 'UNDEFINED', '++', '--', ']'];
|
NOT_REGEX = ['NUMBER', 'REGEX', 'BOOL', 'NULL', 'UNDEFINED', '++', '--'];
|
||||||
|
|
||||||
NOT_SPACED_REGEX = NOT_REGEX.concat(')', '}', 'THIS', 'IDENTIFIER', 'STRING');
|
NOT_SPACED_REGEX = NOT_REGEX.concat(')', '}', 'THIS', 'IDENTIFIER', 'STRING', ']');
|
||||||
|
|
||||||
CALLABLE = ['IDENTIFIER', 'STRING', 'REGEX', ')', ']', '}', '?', '::', '@', 'THIS', 'SUPER'];
|
CALLABLE = ['IDENTIFIER', 'STRING', 'REGEX', ')', ']', '}', '?', '::', '@', 'THIS', 'SUPER'];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
// Generated by CoffeeScript 1.6.2
|
// Generated by CoffeeScript 1.6.3
|
||||||
|
|
||||||
var Access, Arr, Assign, Base, Block, Call, Class, Closure, Code, CodeFragment, Comment, Existence, Extends, For, IDENTIFIER, IDENTIFIER_STR, IS_STRING, If, In, Index, LEVEL_ACCESS, LEVEL_COND, LEVEL_LIST, LEVEL_OP, LEVEL_PAREN, LEVEL_TOP, Literal, METHOD_DEF, NEGATE, NO, Obj, Op, Param, Parens, RESERVED, Range, Return, SIMPLENUM, STRICT_PROSCRIBED, Scope, Slice, Splat, Switch, TAB, THIS, Throw, Try, UTILITIES, Value, While, YES, addLocationDataFn, compact, del, ends, extend, flatten, fragmentsToText, last, locationDataToString, merge, multident, some, starts, throwSyntaxError, unfoldSoak, utility, _ref, _ref1, _ref2, _ref3,
|
var Access, Arr, Assign, Base, Block, Call, Class, Closure, Code, CodeFragment, Comment, Existence, Extends, For, IDENTIFIER, IDENTIFIER_STR, IS_STRING, If, In, Index, LEVEL_ACCESS, LEVEL_COND, LEVEL_LIST, LEVEL_OP, LEVEL_PAREN, LEVEL_TOP, Literal, METHOD_DEF, NEGATE, NO, Obj, Op, Param, Parens, RESERVED, Range, Return, SIMPLENUM, STRICT_PROSCRIBED, Scope, Slice, Splat, Switch, TAB, THIS, Throw, Try, UTILITIES, Value, While, YES, addLocationDataFn, compact, del, ends, extend, flatten, fragmentsToText, last, locationDataToString, merge, multident, some, starts, throwSyntaxError, unfoldSoak, utility, _ref, _ref1, _ref2, _ref3,
|
||||||
__hasProp = {}.hasOwnProperty,
|
__hasProp = {}.hasOwnProperty,
|
||||||
|
|
@ -71,7 +71,7 @@ define(function(require, exports, module) {
|
||||||
}
|
}
|
||||||
|
|
||||||
CodeFragment.prototype.toString = function() {
|
CodeFragment.prototype.toString = function() {
|
||||||
return "" + this.code + [this.locationData ? ": " + locationDataToString(this.locationData) : void 0];
|
return "" + this.code + (this.locationData ? ": " + locationDataToString(this.locationData) : '');
|
||||||
};
|
};
|
||||||
|
|
||||||
return CodeFragment;
|
return CodeFragment;
|
||||||
|
|
@ -503,6 +503,8 @@ define(function(require, exports, module) {
|
||||||
fragments.push(this.makeCode(scope.assignedVariables().join(",\n" + (this.tab + TAB))));
|
fragments.push(this.makeCode(scope.assignedVariables().join(",\n" + (this.tab + TAB))));
|
||||||
}
|
}
|
||||||
fragments.push(this.makeCode(";\n" + (this.spaced ? '\n' : '')));
|
fragments.push(this.makeCode(";\n" + (this.spaced ? '\n' : '')));
|
||||||
|
} else if (fragments.length && post.length) {
|
||||||
|
fragments.push(this.makeCode("\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fragments.concat(post);
|
return fragments.concat(post);
|
||||||
|
|
@ -662,7 +664,7 @@ define(function(require, exports, module) {
|
||||||
Return.prototype.compileNode = function(o) {
|
Return.prototype.compileNode = function(o) {
|
||||||
var answer;
|
var answer;
|
||||||
answer = [];
|
answer = [];
|
||||||
answer.push(this.makeCode(this.tab + ("return" + [this.expression ? " " : void 0])));
|
answer.push(this.makeCode(this.tab + ("return" + (this.expression ? " " : ""))));
|
||||||
if (this.expression) {
|
if (this.expression) {
|
||||||
answer = answer.concat(this.expression.compileToFragments(o, LEVEL_PAREN));
|
answer = answer.concat(this.expression.compileToFragments(o, LEVEL_PAREN));
|
||||||
}
|
}
|
||||||
|
|
@ -801,17 +803,16 @@ define(function(require, exports, module) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Value.prototype.unfoldSoak = function(o) {
|
Value.prototype.unfoldSoak = function(o) {
|
||||||
var _ref4,
|
var _this = this;
|
||||||
_this = this;
|
return this.unfoldedSoak != null ? this.unfoldedSoak : this.unfoldedSoak = (function() {
|
||||||
return (_ref4 = this.unfoldedSoak) != null ? _ref4 : this.unfoldedSoak = (function() {
|
var fst, i, ifn, prop, ref, snd, _i, _len, _ref4, _ref5;
|
||||||
var fst, i, ifn, prop, ref, snd, _i, _len, _ref5, _ref6;
|
|
||||||
if (ifn = _this.base.unfoldSoak(o)) {
|
if (ifn = _this.base.unfoldSoak(o)) {
|
||||||
(_ref5 = ifn.body.properties).push.apply(_ref5, _this.properties);
|
(_ref4 = ifn.body.properties).push.apply(_ref4, _this.properties);
|
||||||
return ifn;
|
return ifn;
|
||||||
}
|
}
|
||||||
_ref6 = _this.properties;
|
_ref5 = _this.properties;
|
||||||
for (i = _i = 0, _len = _ref6.length; _i < _len; i = ++_i) {
|
for (i = _i = 0, _len = _ref5.length; _i < _len; i = ++_i) {
|
||||||
prop = _ref6[i];
|
prop = _ref5[i];
|
||||||
if (!prop.soak) {
|
if (!prop.soak) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -1336,7 +1337,7 @@ define(function(require, exports, module) {
|
||||||
}
|
}
|
||||||
answer.push.apply(answer, fragments);
|
answer.push.apply(answer, fragments);
|
||||||
}
|
}
|
||||||
if ((fragmentsToText(answer)).indexOf('\n') >= 0) {
|
if (fragmentsToText(answer).indexOf('\n') >= 0) {
|
||||||
answer.unshift(this.makeCode("[\n" + o.indent));
|
answer.unshift(this.makeCode("[\n" + o.indent));
|
||||||
answer.push(this.makeCode("\n" + this.tab + "]"));
|
answer.push(this.makeCode("\n" + this.tab + "]"));
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2334,7 +2335,7 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
Op.prototype.compileExistence = function(o) {
|
Op.prototype.compileExistence = function(o) {
|
||||||
var fst, ref;
|
var fst, ref;
|
||||||
if (this.first.isComplex()) {
|
if (!o.isExistentialEquals && this.first.isComplex()) {
|
||||||
ref = new Literal(o.scope.freeVariable('ref'));
|
ref = new Literal(o.scope.freeVariable('ref'));
|
||||||
fst = new Parens(new Assign(ref, this.first));
|
fst = new Parens(new Assign(ref, this.first));
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2438,7 +2439,7 @@ define(function(require, exports, module) {
|
||||||
var fragments, ref, sub, _ref4;
|
var fragments, ref, sub, _ref4;
|
||||||
_ref4 = this.object.cache(o, LEVEL_LIST), sub = _ref4[0], ref = _ref4[1];
|
_ref4 = this.object.cache(o, LEVEL_LIST), sub = _ref4[0], ref = _ref4[1];
|
||||||
fragments = [].concat(this.makeCode(utility('indexOf') + ".call("), this.array.compileToFragments(o, LEVEL_LIST), this.makeCode(", "), ref, this.makeCode(") " + (this.negated ? '< 0' : '>= 0')));
|
fragments = [].concat(this.makeCode(utility('indexOf') + ".call("), this.array.compileToFragments(o, LEVEL_LIST), this.makeCode(", "), ref, this.makeCode(") " + (this.negated ? '< 0' : '>= 0')));
|
||||||
if ((fragmentsToText(sub)) === (fragmentsToText(ref))) {
|
if (fragmentsToText(sub) === fragmentsToText(ref)) {
|
||||||
return fragments;
|
return fragments;
|
||||||
}
|
}
|
||||||
fragments = sub.concat(this.makeCode(', '), fragments);
|
fragments = sub.concat(this.makeCode(', '), fragments);
|
||||||
|
|
@ -2610,6 +2611,9 @@ define(function(require, exports, module) {
|
||||||
if (this.range && this.pattern) {
|
if (this.range && this.pattern) {
|
||||||
this.name.error('cannot pattern match over range loops');
|
this.name.error('cannot pattern match over range loops');
|
||||||
}
|
}
|
||||||
|
if (this.own && !this.object) {
|
||||||
|
this.index.error('cannot use own with for-in');
|
||||||
|
}
|
||||||
this.returns = false;
|
this.returns = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
// Generated by CoffeeScript 1.6.2
|
// Generated by CoffeeScript 1.6.3
|
||||||
|
|
||||||
var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_BLOCK, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, generate, left, rite, _i, _len, _ref,
|
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,
|
||||||
__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;
|
||||||
|
|
||||||
|
|
@ -300,7 +300,7 @@ define(function(require, exports, module) {
|
||||||
startImplicitCall(i + 1);
|
startImplicitCall(i + 1);
|
||||||
return forward(2);
|
return forward(2);
|
||||||
}
|
}
|
||||||
if (this.matchTags(i, IMPLICIT_FUNC, 'INDENT', null, ':') && !this.findTagsBackwards(i, ['CLASS', 'EXTENDS', 'IF', 'CATCH', 'SWITCH', 'LEADING_WHEN', 'FOR', 'WHILE', 'UNTIL'])) {
|
if (__indexOf.call(IMPLICIT_FUNC, tag) >= 0 && this.matchTags(i + 1, 'INDENT', null, ':') && !this.findTagsBackwards(i, ['CLASS', 'EXTENDS', 'IF', 'CATCH', 'SWITCH', 'LEADING_WHEN', 'FOR', 'WHILE', 'UNTIL'])) {
|
||||||
startImplicitCall(i + 1);
|
startImplicitCall(i + 1);
|
||||||
stack.push(['INDENT', i + 2]);
|
stack.push(['INDENT', i + 2]);
|
||||||
return forward(3);
|
return forward(3);
|
||||||
|
|
@ -385,8 +385,8 @@ define(function(require, exports, module) {
|
||||||
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;
|
var _ref, _ref1;
|
||||||
return token[1] !== ';' && (_ref = token[0], __indexOf.call(SINGLE_CLOSERS, _ref) >= 0) && !(token[0] === 'ELSE' && (starter !== 'IF' && starter !== 'THEN'));
|
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 === '=>'));
|
||||||
};
|
};
|
||||||
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);
|
||||||
|
|
@ -501,8 +501,6 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
IMPLICIT_UNSPACED_CALL = ['+', '-'];
|
IMPLICIT_UNSPACED_CALL = ['+', '-'];
|
||||||
|
|
||||||
IMPLICIT_BLOCK = ['->', '=>', '{', '[', ','];
|
|
||||||
|
|
||||||
IMPLICIT_END = ['POST_IF', 'FOR', 'WHILE', 'UNTIL', 'WHEN', 'BY', 'LOOP', 'TERMINATOR'];
|
IMPLICIT_END = ['POST_IF', 'FOR', 'WHILE', 'UNTIL', 'WHEN', 'BY', 'LOOP', 'TERMINATOR'];
|
||||||
|
|
||||||
SINGLE_LINERS = ['ELSE', '->', '=>', 'TRY', 'FINALLY', 'THEN'];
|
SINGLE_LINERS = ['ELSE', '->', '=>', 'TRY', 'FINALLY', 'THEN'];
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
// Generated by CoffeeScript 1.6.2
|
// Generated by CoffeeScript 1.6.3
|
||||||
|
|
||||||
var Scope, extend, last, _ref;
|
var Scope, extend, last, _ref;
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -74,7 +74,7 @@ module.exports = {
|
||||||
assert.equal(error.text, "Unclosed string.");
|
assert.equal(error.text, "Unclosed string.");
|
||||||
assert.equal(error.type, "error");
|
assert.equal(error.type, "error");
|
||||||
assert.equal(error.row, 0);
|
assert.equal(error.row, 0);
|
||||||
assert.equal(error.column, 0);
|
assert.equal(error.column, 2);
|
||||||
},
|
},
|
||||||
|
|
||||||
"test another invalid string": function() {
|
"test another invalid string": function() {
|
||||||
|
|
@ -86,7 +86,7 @@ module.exports = {
|
||||||
assert.equal(error.text, "Unclosed string.");
|
assert.equal(error.text, "Unclosed string.");
|
||||||
assert.equal(error.type, "error");
|
assert.equal(error.type, "error");
|
||||||
assert.equal(error.row, 0);
|
assert.equal(error.row, 0);
|
||||||
assert.equal(error.column, 3);
|
assert.equal(error.column, 4);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,42 @@
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
/*global exports:true require:true define:true console:true */
|
/*global exports:true module:true require:true define:true global:true */
|
||||||
|
|
||||||
(function (root, name, factory) {
|
(function (root, name, factory) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
if (typeof exports !== 'undefined') {
|
var freeExports = typeof exports === 'object' && exports
|
||||||
factory(exports);
|
// While CommonJS defines `module` as an object, component define it as a
|
||||||
} else if (typeof define === 'function' && define.amd) {
|
// function
|
||||||
|
, freeModule = (typeof module === 'object' || typeof module === 'function') &&
|
||||||
|
module && module.exports === freeExports && module;
|
||||||
|
|
||||||
|
// Detect free variable `global`, from Node.js or Browserified code, and use
|
||||||
|
// it as `root`
|
||||||
|
var freeGlobal = typeof global === 'object' && global;
|
||||||
|
if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)
|
||||||
|
root = freeGlobal;
|
||||||
|
|
||||||
|
// Some AMD build optimizers, like r.js, check for specific condition
|
||||||
|
// patterns like the following:
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
define(['exports'], factory);
|
define(['exports'], factory);
|
||||||
} else {
|
}
|
||||||
|
// check for `exports` after `define` in case a build optimizer adds an
|
||||||
|
// `exports` object
|
||||||
|
else if (freeExports && !freeExports.nodeType) {
|
||||||
|
// in Node.js or RingoJS v0.8.0+
|
||||||
|
if (freeModule) factory(freeModule.exports);
|
||||||
|
// in Narwhal or RingoJS v0.7.0-
|
||||||
|
else factory(freeExports);
|
||||||
|
}
|
||||||
|
// in a browser or Rhino
|
||||||
|
else {
|
||||||
factory((root[name] = {}));
|
factory((root[name] = {}));
|
||||||
}
|
}
|
||||||
}(this, 'luaparse', function (exports) {
|
}(this, 'luaparse', function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
exports.version = '0.0.11';
|
exports.version = '0.0.14';
|
||||||
|
|
||||||
var input, options, length;
|
var input, options, length;
|
||||||
|
|
||||||
|
|
@ -306,10 +328,9 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
var slice = Array.prototype.slice
|
var slice = Array.prototype.slice
|
||||||
, toString = Object.prototype.toString
|
, toString = Object.prototype.toString
|
||||||
// Simple indexOf implementation which only provides what's required.
|
, indexOf = function indexOf(array, element) {
|
||||||
, indexOf = Array.prototype.indexOf || function indexOf(element) {
|
for (var i = 0, length = array.length; i < length; i++) {
|
||||||
for (var i = 0, length = this.length; i < length; i++) {
|
if (array[i] === element) return i;
|
||||||
if (this[i] === element) return i;
|
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
};
|
};
|
||||||
|
|
@ -446,7 +467,7 @@ define(function(require, exports, module) {
|
||||||
// containing its value and as well as its position in the input string (this
|
// containing its value and as well as its position in the input string (this
|
||||||
// is always enabled to provide proper debug messages).
|
// is always enabled to provide proper debug messages).
|
||||||
//
|
//
|
||||||
// `readToken()` starts lexing and returns the following token in the stream.
|
// `lex()` starts lexing and returns the following token in the stream.
|
||||||
|
|
||||||
var index
|
var index
|
||||||
, token
|
, token
|
||||||
|
|
@ -456,7 +477,9 @@ define(function(require, exports, module) {
|
||||||
, line
|
, line
|
||||||
, lineStart;
|
, lineStart;
|
||||||
|
|
||||||
function readToken() {
|
exports.lex = lex;
|
||||||
|
|
||||||
|
function lex() {
|
||||||
skipWhiteSpace();
|
skipWhiteSpace();
|
||||||
|
|
||||||
// Skip comments beginning with --
|
// Skip comments beginning with --
|
||||||
|
|
@ -887,7 +910,6 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
// Once the delimiter is found, iterate through the depth count and see
|
// Once the delimiter is found, iterate through the depth count and see
|
||||||
// if it matches.
|
// if it matches.
|
||||||
|
|
||||||
if (']' === character) {
|
if (']' === character) {
|
||||||
terminator = true;
|
terminator = true;
|
||||||
for (var i = 0; i < level; i++) {
|
for (var i = 0; i < level; i++) {
|
||||||
|
|
@ -914,7 +936,7 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
function next() {
|
function next() {
|
||||||
token = lookahead;
|
token = lookahead;
|
||||||
lookahead = readToken();
|
lookahead = lex();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Consume a token if its value matches. Once consumed or not, return the
|
// Consume a token if its value matches. Once consumed or not, return the
|
||||||
|
|
@ -1045,7 +1067,7 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
// Add identifier name to the current scope if it doesnt already exist.
|
// Add identifier name to the current scope if it doesnt already exist.
|
||||||
function scopeIdentifierName(name) {
|
function scopeIdentifierName(name) {
|
||||||
if (-1 !== indexOf.call(scopes[scopeDepth], name)) return;
|
if (-1 !== indexOf(scopes[scopeDepth], name)) return;
|
||||||
scopes[scopeDepth].push(name);
|
scopes[scopeDepth].push(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1058,7 +1080,7 @@ define(function(require, exports, module) {
|
||||||
// Attach scope information to node. If the node is global, store it in the
|
// Attach scope information to node. If the node is global, store it in the
|
||||||
// globals array so we can return the information to the user.
|
// globals array so we can return the information to the user.
|
||||||
function attachScope(node, isLocal) {
|
function attachScope(node, isLocal) {
|
||||||
if (!isLocal && -1 === indexOf.call(globalNames, node.name)) {
|
if (!isLocal && -1 === indexOf(globalNames, node.name)) {
|
||||||
globalNames.push(node.name);
|
globalNames.push(node.name);
|
||||||
globals.push(node);
|
globals.push(node);
|
||||||
}
|
}
|
||||||
|
|
@ -1068,7 +1090,7 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
// Is the identifier name available in this scope.
|
// Is the identifier name available in this scope.
|
||||||
function scopeHasName(name) {
|
function scopeHasName(name) {
|
||||||
return (-1 !== indexOf.call(scopes[scopeDepth], name));
|
return (-1 !== indexOf(scopes[scopeDepth], name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1285,9 +1307,9 @@ define(function(require, exports, module) {
|
||||||
expect('end');
|
expect('end');
|
||||||
|
|
||||||
return ast.forNumericStatement(variable, start, end, step, body);
|
return ast.forNumericStatement(variable, start, end, step, body);
|
||||||
|
}
|
||||||
// If not, it's a Generic For Statement
|
// If not, it's a Generic For Statement
|
||||||
} else {
|
else {
|
||||||
// The namelist can contain one or more identifiers.
|
// The namelist can contain one or more identifiers.
|
||||||
var variables = [variable];
|
var variables = [variable];
|
||||||
while (consume(',')) {
|
while (consume(',')) {
|
||||||
|
|
@ -1446,8 +1468,9 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
if (consume(',')) continue;
|
if (consume(',')) continue;
|
||||||
else if (consume(')')) break;
|
else if (consume(')')) break;
|
||||||
|
}
|
||||||
// No arguments are allowed after a vararg.
|
// No arguments are allowed after a vararg.
|
||||||
} else if (VarargLiteral === token.type) {
|
else if (VarargLiteral === token.type) {
|
||||||
parameters.push(parsePrimaryExpression());
|
parameters.push(parsePrimaryExpression());
|
||||||
expect(')');
|
expect(')');
|
||||||
break;
|
break;
|
||||||
|
|
@ -1729,7 +1752,6 @@ define(function(require, exports, module) {
|
||||||
var table = parseTableConstructor();
|
var table = parseTableConstructor();
|
||||||
return ast.tableCallExpression(base, table);
|
return ast.tableCallExpression(base, table);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (StringLiteral === token.type) {
|
} else if (StringLiteral === token.type) {
|
||||||
return ast.stringCallExpression(base, parsePrimaryExpression());
|
return ast.stringCallExpression(base, parsePrimaryExpression());
|
||||||
}
|
}
|
||||||
|
|
@ -1815,7 +1837,7 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
length = input.length;
|
length = input.length;
|
||||||
// Initialize with a lookahead token.
|
// Initialize with a lookahead token.
|
||||||
lookahead = readToken();
|
lookahead = lex();
|
||||||
|
|
||||||
var chunk = parseChunk();
|
var chunk = parseChunk();
|
||||||
if (options.comments) chunk.comments = comments;
|
if (options.comments) chunk.comments = comments;
|
||||||
|
|
@ -1823,9 +1845,6 @@ define(function(require, exports, module) {
|
||||||
return chunk;
|
return chunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expose the lex function
|
|
||||||
exports.lex = readToken;
|
|
||||||
|
|
||||||
}));
|
}));
|
||||||
/* vim: set sw=2 ts=2 et tw=79 : */
|
/* vim: set sw=2 ts=2 et tw=79 : */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,7 @@ var WorkerClient = function(topLevelNamespaces, mod, classname) {
|
||||||
|
|
||||||
this.terminate = function() {
|
this.terminate = function() {
|
||||||
this._emit("terminate", {});
|
this._emit("terminate", {});
|
||||||
|
this.deltaQueue = null;
|
||||||
this.$worker.terminate();
|
this.$worker.terminate();
|
||||||
this.$worker = null;
|
this.$worker = null;
|
||||||
this.$doc.removeEventListener("change", this.changeListener);
|
this.$doc.removeEventListener("change", this.changeListener);
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,11 @@
|
||||||
var https = require("https")
|
var https = require("https")
|
||||||
, http = require("http")
|
, http = require("http")
|
||||||
, url = require("url")
|
, url = require("url")
|
||||||
, fs = require("fs")
|
, fs = require("fs");
|
||||||
|
|
||||||
var rootDir = __dirname + "/../lib/ace/"
|
var rootDir = __dirname + "/../lib/ace/";
|
||||||
|
|
||||||
var deps = [{
|
var deps = [{
|
||||||
path: "mode/javascript/jshint.js",
|
|
||||||
url: "https://raw.github.com/jshint/jshint/master/src/stable/jshint.js",
|
|
||||||
needsFixup: true,
|
|
||||||
postProcess: function(t) {
|
|
||||||
return t.replace(
|
|
||||||
/"Expected a conditional expression and instead saw an assignment."/g,
|
|
||||||
'"Assignment in conditional expression"'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
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-node.js",
|
||||||
needsFixup: true
|
needsFixup: true
|
||||||
|
|
@ -25,52 +15,52 @@ var deps = [{
|
||||||
needsFixup: false
|
needsFixup: false
|
||||||
}, {
|
}, {
|
||||||
path: "mode/lua/luaparse.js",
|
path: "mode/lua/luaparse.js",
|
||||||
url: "https://raw.github.com/oxyc/luaparse/master/lib/luaparse.js",
|
url: "https://raw.github.com/oxyc/luaparse/master/luaparse.js",
|
||||||
needsFixup: true
|
needsFixup: true
|
||||||
}]
|
}];
|
||||||
|
|
||||||
var download = function(href, callback) {
|
var download = function(href, callback) {
|
||||||
var options = url.parse(href);
|
var options = url.parse(href);
|
||||||
protocol = options.protocol === "https:" ? https : http;
|
var protocol = options.protocol === "https:" ? https : http;
|
||||||
console.log("connecting to " + options.host + " " + options.path)
|
console.log("connecting to " + options.host + " " + options.path);
|
||||||
var request = protocol.get(options, function(res) {
|
protocol.get(options, function(res) {
|
||||||
var data = ""
|
var data = "";
|
||||||
res.setEncoding("utf-8")
|
res.setEncoding("utf-8");
|
||||||
|
|
||||||
res.on("data", function(chunk){
|
res.on("data", function(chunk){
|
||||||
data += chunk
|
data += chunk;
|
||||||
})
|
});
|
||||||
|
|
||||||
res.on("end", function(){
|
res.on("end", function(){
|
||||||
callback(data)
|
callback(data);
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
var getDep = function(dep) {
|
var getDep = function(dep) {
|
||||||
download(dep.url, function(data) {
|
download(dep.url, function(data) {
|
||||||
if (dep.needsFixup)
|
if (dep.needsFixup)
|
||||||
data = "define(function(require, exports, module) {\n"
|
data = "define(function(require, exports, module) {\n"
|
||||||
+ data
|
+ data
|
||||||
+ "\n});"
|
+ "\n});";
|
||||||
if (dep.postProcess)
|
if (dep.postProcess)
|
||||||
data = dep.postProcess(data)
|
data = dep.postProcess(data);
|
||||||
|
|
||||||
fs.writeFile(rootDir + dep.path, data, "utf-8", function(err){
|
fs.writeFile(rootDir + dep.path, data, "utf-8", function(err){
|
||||||
if (err) throw err
|
if (err) throw err;
|
||||||
console.log("File " + dep.path + " saved.")
|
console.log("File " + dep.path + " saved.");
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
deps.forEach(getDep)
|
deps.forEach(getDep);
|
||||||
|
|
||||||
// coffee-script
|
// coffee-script
|
||||||
void function(){
|
void function(){
|
||||||
var rootHref = "https://raw.github.com/jashkenas/coffee-script/master/"
|
var rootHref = "https://raw.github.com/jashkenas/coffee-script/master/";
|
||||||
var path = "mode/coffee/"
|
var path = "mode/coffee/";
|
||||||
|
|
||||||
var subDir = "lib/coffee-script/"
|
var subDir = "lib/coffee-script/";
|
||||||
var deps = [
|
var deps = [
|
||||||
"helpers.js",
|
"helpers.js",
|
||||||
"lexer.js",
|
"lexer.js",
|
||||||
|
|
@ -83,50 +73,110 @@ void function(){
|
||||||
name: x,
|
name: x,
|
||||||
href: rootHref + subDir + x,
|
href: rootHref + subDir + x,
|
||||||
path: rootDir + path + x
|
path: rootDir + path + x
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
deps.push({name:"LICENSE", href: rootHref + "LICENSE"})
|
deps.push({name:"LICENSE", href: rootHref + "LICENSE"});
|
||||||
|
|
||||||
var downloads = {}, counter = 0
|
var downloads = {}, counter = 0;
|
||||||
|
|
||||||
deps.forEach(function(x) {
|
deps.forEach(function(x) {
|
||||||
download(x.href, function(data) {
|
download(x.href, function(data) {
|
||||||
counter++
|
counter++;
|
||||||
downloads[x.name] = data
|
downloads[x.name] = data;
|
||||||
if (counter == deps.length)
|
if (counter == deps.length)
|
||||||
allDone()
|
allDone();
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
function allDone() {
|
function allDone() {
|
||||||
deps.pop()
|
deps.pop();
|
||||||
var license = downloads["LICENSE"].split('\n')
|
var license = downloads.LICENSE.split('\n');
|
||||||
license = "/**\n * " + license.join("\n * ") + "\n */"
|
license = "/**\n * " + license.join("\n * ") + "\n */";
|
||||||
|
|
||||||
deps.forEach(function(x) {
|
deps.forEach(function(x) {
|
||||||
var data = downloads[x.name]
|
var data = downloads[x.name];
|
||||||
console.log(x.name)
|
console.log(x.name);
|
||||||
console.log(!data)
|
console.log(!data);
|
||||||
if (!data)
|
if (!data)
|
||||||
return
|
return;
|
||||||
if (x.name == "parser.js") {
|
if (x.name == "parser.js") {
|
||||||
data = data.replace("var parser = (function(){", "")
|
data = data.replace("var parser = (function(){", "")
|
||||||
.replace(/\nreturn (new Parser)[\s\S]*$/, "\n\nmodule.exports = $1;\n\n")
|
.replace(/\nreturn (new Parser)[\s\S]*$/, "\n\nmodule.exports = $1;\n\n");
|
||||||
} else {
|
} else {
|
||||||
data = data.replace("(function() {", "")
|
data = data.replace("(function() {", "")
|
||||||
.replace(/}\).call\(this\);\s*$/, "")
|
.replace(/\}\).call\(this\);\s*$/, "");
|
||||||
}
|
}
|
||||||
data = license
|
data = license
|
||||||
+ "\n\n"
|
+ "\n\n"
|
||||||
+ "define(function(require, exports, module) {\n"
|
+ "define(function(require, exports, module) {\n"
|
||||||
+ data
|
+ data
|
||||||
+ "\n});"
|
+ "\n});";
|
||||||
|
|
||||||
fs.writeFile(x.path, data, "utf-8", function(err){
|
fs.writeFile(x.path, data, "utf-8", function(err){
|
||||||
if (err) throw err
|
if (err) throw err;
|
||||||
console.log("File " + x.name + " saved.")
|
console.log("File " + x.name + " saved.");
|
||||||
console.warn("mode/coffee/coffee-script file needs to updated manually")
|
console.warn("mode/coffee/coffee-script file needs to updated manually");
|
||||||
console.warn("mode/coffee/parser.js: parseError function needs to be modified")
|
console.warn("mode/coffee/parser.js: parseError function needs to be modified");
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}()
|
}();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var spawn = require("child_process").spawn;
|
||||||
|
|
||||||
|
var run = function(cmd, cb) {
|
||||||
|
var proc = spawn("cmd", ["/c " + cmd]);
|
||||||
|
|
||||||
|
proc.stderr.setEncoding("utf8");
|
||||||
|
proc.stderr.on('data', function (data) {
|
||||||
|
// console.error(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
proc.stdout.setEncoding("utf8");
|
||||||
|
proc.stdout.on('data', function (data) {
|
||||||
|
//console.log(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
proc.on('exit', done);
|
||||||
|
proc.on('close', done);
|
||||||
|
function done(code) {
|
||||||
|
if (code !== 0) {
|
||||||
|
console.error(cmd + '::: process exited with code :::' + code);
|
||||||
|
}
|
||||||
|
cb()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function unquote(str) {
|
||||||
|
return str.replace(/\\(.)/g, function(x, a) {
|
||||||
|
return a == "n" ? "\n"
|
||||||
|
: a == "t" ? "\t"
|
||||||
|
: a == "r" ? "\r"
|
||||||
|
: a
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
run("npm install jshint", function() {
|
||||||
|
var jshintDist = fs.readFileSync("node_modules/jshint/dist/jshint.js", "utf8");
|
||||||
|
|
||||||
|
jshintDist = jshintDist.replace(
|
||||||
|
/(require.define.*)Function\(\[([^\]]*?)\],\s*"(.*)"\s*\)/g,
|
||||||
|
function(a, def, args, content) {
|
||||||
|
return def + "function("+args.replace(/["']/g, "") + ") {\n"
|
||||||
|
+ unquote(content)
|
||||||
|
+ "\n}";
|
||||||
|
}
|
||||||
|
);
|
||||||
|
jshintDist = jshintDist.replace(
|
||||||
|
/"Expected a conditional expression and instead saw an assignment."/g,
|
||||||
|
'"Assignment in conditional expression"'
|
||||||
|
);
|
||||||
|
jshintDist = 'define(function() {\n'
|
||||||
|
+ jshintDist + '\n'
|
||||||
|
+ 'var jsHint = require("/src/stable/jshint.js");\n'
|
||||||
|
+ 'return function(require, exports, module) {module.exports = jsHint;}\n'
|
||||||
|
+'}())';
|
||||||
|
fs.writeFileSync(rootDir + "mode/javascript/jshint.js", jshintDist);
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue