Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Browser-compatible single-file CoffeeScriptRedux
This file has been truncated, but you can view the full file.
(function(){var require = function (file, cwd) {
var resolved = require.resolve(file, cwd || '/');
var mod = require.modules[resolved];
if (!mod) throw new Error(
'Failed to resolve module ' + file + ', tried ' + resolved
);
var cached = require.cache[resolved];
var res = cached? cached.exports : mod();
return res;
};
require.paths = [];
require.modules = {};
require.cache = {};
require.extensions = [".js",".coffee",".json"];
require._core = {
'assert': true,
'events': true,
'fs': true,
'path': true,
'vm': true
};
require.resolve = (function () {
return function (x, cwd) {
if (!cwd) cwd = '/';
if (require._core[x]) return x;
var path = require.modules.path();
cwd = path.resolve('/', cwd);
var y = cwd || '/';
if (x.match(/^(?:\.\.?\/|\/)/)) {
var m = loadAsFileSync(path.resolve(y, x))
|| loadAsDirectorySync(path.resolve(y, x));
if (m) return m;
}
var n = loadNodeModulesSync(x, y);
if (n) return n;
throw new Error("Cannot find module '" + x + "'");
function loadAsFileSync (x) {
x = path.normalize(x);
if (require.modules[x]) {
return x;
}
for (var i = 0; i < require.extensions.length; i++) {
var ext = require.extensions[i];
if (require.modules[x + ext]) return x + ext;
}
}
function loadAsDirectorySync (x) {
x = x.replace(/\/+$/, '');
var pkgfile = path.normalize(x + '/package.json');
if (require.modules[pkgfile]) {
var pkg = require.modules[pkgfile]();
var b = pkg.browserify;
if (typeof b === 'object' && b.main) {
var m = loadAsFileSync(path.resolve(x, b.main));
if (m) return m;
}
else if (typeof b === 'string') {
var m = loadAsFileSync(path.resolve(x, b));
if (m) return m;
}
else if (pkg.main) {
var m = loadAsFileSync(path.resolve(x, pkg.main));
if (m) return m;
}
}
return loadAsFileSync(x + '/index');
}
function loadNodeModulesSync (x, start) {
var dirs = nodeModulesPathsSync(start);
for (var i = 0; i < dirs.length; i++) {
var dir = dirs[i];
var m = loadAsFileSync(dir + '/' + x);
if (m) return m;
var n = loadAsDirectorySync(dir + '/' + x);
if (n) return n;
}
var m = loadAsFileSync(x);
if (m) return m;
}
function nodeModulesPathsSync (start) {
var parts;
if (start === '/') parts = [ '' ];
else parts = path.normalize(start).split('/');
var dirs = [];
for (var i = parts.length - 1; i >= 0; i--) {
if (parts[i] === 'node_modules') continue;
var dir = parts.slice(0, i + 1).join('/') + '/node_modules';
dirs.push(dir);
}
return dirs;
}
};
})();
require.alias = function (from, to) {
var path = require.modules.path();
var res = null;
try {
res = require.resolve(from + '/package.json', '/');
}
catch (err) {
res = require.resolve(from, '/');
}
var basedir = path.dirname(res);
var keys = (Object.keys || function (obj) {
var res = [];
for (var key in obj) res.push(key);
return res;
})(require.modules);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (key.slice(0, basedir.length + 1) === basedir + '/') {
var f = key.slice(basedir.length);
require.modules[to + f] = require.modules[basedir + f];
}
else if (key === basedir) {
require.modules[to] = require.modules[basedir];
}
}
};
(function () {
var process = {};
var global = typeof window !== 'undefined' ? window : {};
var definedProcess = false;
require.define = function (filename, fn) {
if (!definedProcess && require.modules.__browserify_process) {
process = require.modules.__browserify_process();
definedProcess = true;
}
var dirname = require._core[filename]
? ''
: require.modules.path().dirname(filename)
;
var require_ = function (file) {
var requiredModule = require(file, dirname);
var cached = require.cache[require.resolve(file, dirname)];
if (cached && cached.parent === null) {
cached.parent = module_;
}
return requiredModule;
};
require_.resolve = function (name) {
return require.resolve(name, dirname);
};
require_.modules = require.modules;
require_.define = require.define;
require_.cache = require.cache;
var module_ = {
id : filename,
filename: filename,
exports : {},
loaded : false,
parent: null
};
require.modules[filename] = function () {
require.cache[filename] = module_;
fn.call(
module_.exports,
require_,
module_,
module_.exports,
dirname,
filename,
process,
global
);
module_.loaded = true;
return module_.exports;
};
};
})();
require.define("path",function(require,module,exports,__dirname,__filename,process,global){function filter (xs, fn) {
var res = [];
for (var i = 0; i < xs.length; i++) {
if (fn(xs[i], i, xs)) res.push(xs[i]);
}
return res;
}
// resolves . and .. elements in a path array with directory names there
// must be no slashes, empty elements, or device names (c:\) in the array
// (so also no leading and trailing slashes - it does not distinguish
// relative and absolute paths)
function normalizeArray(parts, allowAboveRoot) {
// if the path tries to go above the root, `up` ends up > 0
var up = 0;
for (var i = parts.length; i >= 0; i--) {
var last = parts[i];
if (last == '.') {
parts.splice(i, 1);
} else if (last === '..') {
parts.splice(i, 1);
up++;
} else if (up) {
parts.splice(i, 1);
up--;
}
}
// if the path is allowed to go above the root, restore leading ..s
if (allowAboveRoot) {
for (; up--; up) {
parts.unshift('..');
}
}
return parts;
}
// Regex to split a filename into [*, dir, basename, ext]
// posix version
var splitPathRe = /^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;
// path.resolve([from ...], to)
// posix version
exports.resolve = function() {
var resolvedPath = '',
resolvedAbsolute = false;
for (var i = arguments.length; i >= -1 && !resolvedAbsolute; i--) {
var path = (i >= 0)
? arguments[i]
: process.cwd();
// Skip empty and invalid entries
if (typeof path !== 'string' || !path) {
continue;
}
resolvedPath = path + '/' + resolvedPath;
resolvedAbsolute = path.charAt(0) === '/';
}
// At this point the path should be resolved to a full absolute path, but
// handle relative paths to be safe (might happen when process.cwd() fails)
// Normalize the path
resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
return !!p;
}), !resolvedAbsolute).join('/');
return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
};
// path.normalize(path)
// posix version
exports.normalize = function(path) {
var isAbsolute = path.charAt(0) === '/',
trailingSlash = path.slice(-1) === '/';
// Normalize the path
path = normalizeArray(filter(path.split('/'), function(p) {
return !!p;
}), !isAbsolute).join('/');
if (!path && !isAbsolute) {
path = '.';
}
if (path && trailingSlash) {
path += '/';
}
return (isAbsolute ? '/' : '') + path;
};
// posix version
exports.join = function() {
var paths = Array.prototype.slice.call(arguments, 0);
return exports.normalize(filter(paths, function(p, index) {
return p && typeof p === 'string';
}).join('/'));
};
exports.dirname = function(path) {
var dir = splitPathRe.exec(path)[1] || '';
var isWindows = false;
if (!dir) {
// No dirname
return '.';
} else if (dir.length === 1 ||
(isWindows && dir.length <= 3 && dir.charAt(1) === ':')) {
// It is just a slash or a drive letter with a slash
return dir;
} else {
// It is a full dirname, strip trailing slash
return dir.substring(0, dir.length - 1);
}
};
exports.basename = function(path, ext) {
var f = splitPathRe.exec(path)[2] || '';
// TODO: make this comparison case-insensitive on windows?
if (ext && f.substr(-1 * ext.length) === ext) {
f = f.substr(0, f.length - ext.length);
}
return f;
};
exports.extname = function(path) {
return splitPathRe.exec(path)[3] || '';
};
});
require.define("__browserify_process",function(require,module,exports,__dirname,__filename,process,global){var process = module.exports = {};
process.nextTick = (function () {
var canSetImmediate = typeof window !== 'undefined'
&& window.setImmediate;
var canPost = typeof window !== 'undefined'
&& window.postMessage && window.addEventListener
;
if (canSetImmediate) {
return window.setImmediate;
}
if (canPost) {
var queue = [];
window.addEventListener('message', function (ev) {
if (ev.source === window && ev.data === 'browserify-tick') {
ev.stopPropagation();
if (queue.length > 0) {
var fn = queue.shift();
fn();
}
}
}, true);
return function nextTick(fn) {
queue.push(fn);
window.postMessage('browserify-tick', '*');
};
}
return function nextTick(fn) {
setTimeout(fn, 0);
};
})();
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.binding = function (name) {
if (name === 'evals') return (require)('vm')
else throw new Error('No such module. (Possibly not yet loaded)')
};
(function () {
var cwd = '/';
var path;
process.cwd = function () { return cwd };
process.chdir = function (dir) {
if (!path) path = require('path');
cwd = path.resolve(dir, cwd);
};
})();
});
require.define("/lib/coffee-script/helpers.js",function(require,module,exports,__dirname,__filename,process,global){// Generated by CoffeeScript 2.0.0-dev
var beingDeclared, cleanMarkers, concat, concatMap, CS, difference, envEnrichments, envEnrichments_, foldl, humanReadable, map, nub, numberLines, pointToErrorLocation, usedAsExpression, usedAsExpression_;
cache$ = require('./functional-helpers');
concat = cache$.concat;
concatMap = cache$.concatMap;
difference = cache$.difference;
foldl = cache$.foldl;
map = cache$.map;
nub = cache$.nub;
CS = require('./nodes');
this.numberLines = numberLines = function (input, startLine) {
var lines, numbered, padSize;
if (null == startLine)
startLine = 1;
lines = input.split('\n');
padSize = ('' + (lines.length + startLine - 1)).length;
numbered = function (accum$) {
var currLine, i, line, pad;
for (var i$ = 0, length$ = lines.length; i$ < length$; ++i$) {
line = lines[i$];
i = i$;
currLine = '' + (i + startLine);
pad = Array(padSize + 1).join('0').slice(currLine.length);
accum$.push('' + pad + currLine + ' : ' + lines[i]);
}
return accum$;
}.call(this, []);
return numbered.join('\n');
};
cleanMarkers = function (str) {
return str.replace(/[\uEFEF\uEFFE\uEFFF]/g, '');
};
this.humanReadable = humanReadable = function (str) {
return str.replace(/\uEFEF/g, '(INDENT)').replace(/\uEFFE/g, '(DEDENT)').replace(/\uEFFF/g, '(TERM)');
};
this.formatParserError = function (input, e) {
var found, message, realColumn, unicode;
realColumn = cleanMarkers(('' + input.split('\n')[e.line - 1] + '\n').slice(0, e.column)).length;
if (!(null != e.found))
return 'Syntax error on line ' + e.line + ', column ' + realColumn + ': unexpected end of input';
found = JSON.stringify(humanReadable(e.found));
found = found.replace(/^"|"$/g, '').replace(/'/g, "\\'").replace(/\\"/g, '"');
unicode = e.found.charCodeAt(0).toString(16).toUpperCase();
unicode = '\\u' + '0000'.slice(unicode.length) + unicode;
message = 'Syntax error on line ' + e.line + ', column ' + realColumn + ": unexpected '" + found + "' (" + unicode + ')';
return '' + message + '\n' + pointToErrorLocation(input, e.line, realColumn);
};
this.pointToErrorLocation = pointToErrorLocation = function (source, line, column, numLinesOfContext) {
var currentLineOffset, lines, numberedLines, padSize, postLines, preLines, startLine;
if (null == numLinesOfContext)
numLinesOfContext = 3;
lines = source.split('\n');
currentLineOffset = line - 1;
startLine = currentLineOffset - numLinesOfContext;
if (startLine < 0)
startLine = 0;
preLines = lines.slice(startLine, +currentLineOffset + 1);
postLines = lines.slice(currentLineOffset + 1, +(currentLineOffset + numLinesOfContext) + 1);
numberedLines = numberLines(cleanMarkers([].slice.call(preLines).concat([].slice.call(postLines)).join('\n')), startLine + 1).split('\n');
preLines = numberedLines.slice(0, preLines.length);
postLines = numberedLines.slice(preLines.length);
column = cleanMarkers(('' + lines[currentLineOffset] + '\n').slice(0, column)).length;
padSize = (currentLineOffset + 1 + postLines.length).toString(10).length;
return [].slice.call(preLines).concat(['' + Array(padSize + 1).join('^') + ' :~' + Array(column).join('~') + '^'], [].slice.call(postLines)).join('\n');
};
this.beingDeclared = beingDeclared = function (assignment) {
switch (false) {
case !!(null != assignment):
return [];
case !assignment['instanceof'](CS.Identifiers):
return [assignment.data];
case !assignment['instanceof'](CS.Rest):
return beingDeclared(assignment.expression);
case !assignment['instanceof'](CS.MemberAccessOps):
return [];
case !assignment['instanceof'](CS.DefaultParam):
return beingDeclared(assignment.param);
case !assignment['instanceof'](CS.ArrayInitialiser):
return concatMap(assignment.members, beingDeclared);
case !assignment['instanceof'](CS.ObjectInitialiser):
return concatMap(assignment.vals(), beingDeclared);
default:
throw new Error('beingDeclared: Non-exhaustive patterns in case: ' + assignment.className);
}
};
this.declarationsFor = function (node, inScope) {
var vars;
vars = envEnrichments(node, inScope);
return foldl(new CS.Undefined().g(), vars, function (expr, v) {
return new CS.AssignOp(new CS.Identifier(v).g(), expr).g();
});
};
usedAsExpression_ = function (ancestors) {
var grandparent, parent;
parent = ancestors[0];
grandparent = ancestors[1];
switch (false) {
case !!(null != parent):
return true;
case !parent['instanceof'](CS.Program, CS.Class):
return false;
case !parent['instanceof'](CS.SeqOp):
return this === parent.right && usedAsExpression(parent, ancestors.slice(1));
case !(parent['instanceof'](CS.Block) && parent.statements.indexOf(this) !== parent.statements.length - 1):
return false;
case !(parent['instanceof'](CS.Functions) && parent.body === this && null != grandparent && grandparent['instanceof'](CS.Constructor)):
return false;
default:
return true;
}
};
this.usedAsExpression = usedAsExpression = function (node, ancestors) {
return usedAsExpression_.call(node, ancestors);
};
envEnrichments_ = function (inScope) {
var possibilities;
if (null == inScope)
inScope = [];
possibilities = function () {
var this$, this$1;
switch (false) {
case !this['instanceof'](CS.AssignOp):
return nub(beingDeclared(this.assignee));
case !this['instanceof'](CS.Class):
return nub(concat([
beingDeclared(this.nameAssignee),
envEnrichments(this.parent),
'undefined' !== typeof name && null != name ? [name] : []
]));
case !this['instanceof'](CS.ForIn, CS.ForOf):
return nub(concat([
concatMap(this.childNodes, (this$ = this, function (child) {
if (in$(child, this$.listMembers)) {
return concatMap(this$[child], function (m) {
return envEnrichments(m, inScope);
});
} else {
return envEnrichments(this$[child], inScope);
}
})),
beingDeclared(this.keyAssignee),
beingDeclared(this.valAssignee)
]));
case !this['instanceof'](CS.Functions):
return [];
default:
return nub(concatMap(this.childNodes, (this$1 = this, function (child) {
if (in$(child, this$1.listMembers)) {
return concatMap(this$1[child], function (m) {
return envEnrichments(m, inScope);
});
} else {
return envEnrichments(this$1[child], inScope);
}
})));
}
}.call(this);
return difference(possibilities, inScope);
};
this.envEnrichments = envEnrichments = function (node, args) {
args = 2 <= arguments.length ? [].slice.call(arguments, 1) : [];
if (null != node) {
return envEnrichments_.apply(node, args);
} else {
return [];
}
};
function in$(member, list) {
for (var i = 0, length = list.length; i < length; ++i)
if (i in list && list[i] === member)
return true;
return false;
}
});
require.define("/lib/coffee-script/functional-helpers.js",function(require,module,exports,__dirname,__filename,process,global){// Generated by CoffeeScript 2.0.0-dev
var concat, foldl, map, nub, span;
this.any = function (list, fn) {
var e;
for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) {
e = list[i$];
if (fn(e))
return true;
}
return false;
};
this.all = function (list, fn) {
var e;
for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) {
e = list[i$];
if (!fn(e))
return false;
}
return true;
};
this.foldl = foldl = function (memo, list, fn) {
var i;
for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) {
i = list[i$];
memo = fn(memo, i);
}
return memo;
};
this.foldl1 = function (list, fn) {
return foldl(list[0], list.slice(1), fn);
};
this.map = map = function (list, fn) {
return function (accum$) {
var e;
for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) {
e = list[i$];
accum$.push(fn(e));
}
return accum$;
}.call(this, []);
};
this.concat = concat = function (list) {
var cache$;
return (cache$ = []).concat.apply(cache$, [].slice.call(list).concat());
};
this.concatMap = function (list, fn) {
return concat(map(list, fn));
};
this.intersect = function (listA, listB) {
return function (accum$) {
var a;
for (var i$ = 0, length$ = listA.length; i$ < length$; ++i$) {
a = listA[i$];
if (!in$(a, listB))
continue;
accum$.push(a);
}
return accum$;
}.call(this, []);
};
this.difference = function (listA, listB) {
return function (accum$) {
var a;
for (var i$ = 0, length$ = listA.length; i$ < length$; ++i$) {
a = listA[i$];
if (!!in$(a, listB))
continue;
accum$.push(a);
}
return accum$;
}.call(this, []);
};
this.nub = nub = function (list) {
var i, result;
result = [];
for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) {
i = list[i$];
if (!!in$(i, result))
continue;
result.push(i);
}
return result;
};
this.union = function (listA, listB) {
return listA.concat(function (accum$) {
var b;
for (var cache$ = nub(listB), i$ = 0, length$ = cache$.length; i$ < length$; ++i$) {
b = cache$[i$];
if (!!in$(b, listA))
continue;
accum$.push(b);
}
return accum$;
}.call(this, []));
};
this.flip = function (fn) {
return function (b, a) {
return fn.call(this, a, b);
};
};
this.owns = function (hop) {
return function (a, b) {
return hop.call(a, b);
};
}({}.hasOwnProperty);
this.span = span = function (list, f) {
var cache$, ys, zs;
if (list.length === 0) {
return [
[],
[]
];
} else if (f(list[0])) {
cache$ = span(list.slice(1), f);
ys = cache$[0];
zs = cache$[1];
return [
[list[0]].concat([].slice.call(ys)),
zs
];
} else {
return [
[],
list
];
}
};
this.divMod = function (a, b) {
var c, div, mod;
c = a % b;
mod = c < 0 ? c + b : c;
div = Math.floor(a / b);
return [
div,
mod
];
};
function in$(member, list) {
for (var i = 0, length = list.length; i < length; ++i)
if (i in list && list[i] === member)
return true;
return false;
}
});
require.define("/lib/coffee-script/nodes.js",function(require,module,exports,__dirname,__filename,process,global){// Generated by CoffeeScript 2.0.0-dev
var ArrayInitialiser, Block, Bool, Class, CompoundAssignOp, concat, concatMap, Conditional, createNodes, difference, exports, ForOf, FunctionApplications, Functions, GenSym, handleLists, handlePrimitives, HeregExp, Identifier, Identifiers, map, NegatedConditional, NewOp, Nodes, nub, ObjectInitialiser, Primitives, Range, RegExp, RegExps, Slice, StaticMemberAccessOps, Super, Switch, SwitchCase, union, While;
cache$ = require('./functional-helpers');
map = cache$.map;
concat = cache$.concat;
concatMap = cache$.concatMap;
difference = cache$.difference;
nub = cache$.nub;
union = cache$.union;
exports = null != ('undefined' !== typeof module && null != module ? module.exports : void 0) ? 'undefined' !== typeof module && null != module ? module.exports : void 0 : this;
createNodes = function (subclasses, superclasses) {
var className, specs;
if (null == superclasses)
superclasses = [];
for (className in subclasses) {
if (!isOwn$(subclasses, className))
continue;
specs = subclasses[className];
(function (className) {
var isCategory, klass, params, superclass;
superclass = null != superclasses[0] ? superclasses[0] : function () {
};
isCategory = 'undefined' !== typeof specs && null != specs && specs.length === 2;
params = 'undefined' !== typeof specs && null != specs ? function () {
switch (specs.length) {
case 0:
return [];
case 1:
case 2:
return specs[0];
}
}.call(this) : null;
if (null != params)
params;
else
params = null != superclass.prototype.childNodes ? superclass.prototype.childNodes : [];
klass = function (super$) {
var externalCtor$;
extends$(class$, super$);
externalCtor$ = isCategory ? function () {
} : function () {
var i, param;
for (var i$ = 0, length$ = params.length; i$ < length$; ++i$) {
param = params[i$];
i = i$;
this[param] = arguments[i];
}
if (null != this.initialise)
this.initialise.apply(this, arguments);
return this;
};
function class$() {
return externalCtor$.apply(this, arguments);
}
class$.prototype.className = className;
class$.superclasses = superclasses;
return class$;
}(superclass);
if (null != ('undefined' !== typeof specs && null != specs ? specs[0] : void 0))
klass.prototype.childNodes = specs[0];
if (isCategory)
createNodes(specs[1], [klass].concat([].slice.call(superclasses)));
return exports[className] = klass;
}(className));
}
};
createNodes({Nodes: [
[],
{
BinOps: [
[
'left',
'right'
],
{
AssignOps: [
[
'assignee',
'expression'
],
{
AssignOp: null,
ClassProtoAssignOp: null,
CompoundAssignOp: [[
'op',
'assignee',
'expression'
]],
ExistsAssignOp: null
}
],
BitOps: [
null,
{
BitAndOp: null,
BitOrOp: null,
BitXorOp: null,
LeftShiftOp: null,
SignedRightShiftOp: null,
UnsignedRightShiftOp: null
}
],
ComparisonOps: [
null,
{
EQOp: null,
GTEOp: null,
GTOp: null,
LTEOp: null,
LTOp: null,
NEQOp: null
}
],
ConcatOp: null,
ExistsOp: null,
ExtendsOp: null,
InOp: null,
InstanceofOp: null,
LogicalOps: [
null,
{
LogicalAndOp: null,
LogicalOrOp: null
}
],
MathsOps: [
null,
{
ExpOp: null,
DivideOp: null,
MultiplyOp: null,
RemOp: null,
SubtractOp: null
}
],
OfOp: null,
PlusOp: null,
Range: [[
'isInclusive',
'left',
'right'
]],
SeqOp: null
}
],
Statements: [
[],
{
Break: null,
Continue: null,
Return: [['expression']],
Throw: [['expression']]
}
],
UnaryOps: [
['expression'],
{
BitNotOp: null,
DeleteOp: null,
DoOp: null,
LogicalNotOp: null,
NewOp: [[
'ctor',
'arguments'
]],
PreDecrementOp: null,
PreIncrementOp: null,
PostDecrementOp: null,
PostIncrementOp: null,
TypeofOp: null,
UnaryExistsOp: null,
UnaryNegateOp: null,
UnaryPlusOp: null
}
],
MemberAccessOps: [
null,
{
StaticMemberAccessOps: [
[
'expression',
'memberName'
],
{
MemberAccessOp: null,
ProtoMemberAccessOp: null,
SoakedMemberAccessOp: null,
SoakedProtoMemberAccessOp: null
}
],
DynamicMemberAccessOps: [
[
'expression',
'indexingExpr'
],
{
DynamicMemberAccessOp: null,
DynamicProtoMemberAccessOp: null,
SoakedDynamicMemberAccessOp: null,
SoakedDynamicProtoMemberAccessOp: null
}
]
}
],
ChainedComparisonOp: [['expression']],
FunctionApplications: [
[
'function',
'arguments'
],
{
FunctionApplication: null,
SoakedFunctionApplication: null
}
],
Super: [['arguments']],
Program: [['body']],
Block: [['statements']],
Conditional: [[
'condition',
'consequent',
'alternate'
]],
ForIn: [[
'valAssignee',
'keyAssignee',
'target',
'step',
'filter',
'body'
]],
ForOf: [[
'isOwn',
'keyAssignee',
'valAssignee',
'target',
'filter',
'body'
]],
Switch: [[
'expression',
'cases',
'alternate'
]],
SwitchCase: [[
'conditions',
'consequent'
]],
Try: [[
'body',
'catchAssignee',
'catchBody',
'finallyBody'
]],
While: [[
'condition',
'body'
]],
ArrayInitialiser: [['members']],
ObjectInitialiser: [['members']],
ObjectInitialiserMember: [[
'key',
'expression'
]],
Class: [[
'nameAssignee',
'parent',
'ctor',
'body',
'boundMembers'
]],
Constructor: [['expression']],
Functions: [
[
'parameters',
'body'
],
{
Function: null,
BoundFunction: null
}
],
DefaultParam: [[
'param',
'default'
]],
Identifiers: [
['data'],
{
Identifier: null,
GenSym: null
}
],
Null: null,
Primitives: [
['data'],
{
Bool: null,
JavaScript: null,
Numbers: [
null,
{
Int: null,
Float: null
}
],
String: null
}
],
RegExps: [
null,
{
RegExp: [[
'data',
'flags'
]],
HeregExp: [[
'expression',
'flags'
]]
}
],
This: null,
Undefined: null,
Slice: [[
'expression',
'isInclusive',
'left',
'right'
]],
Rest: [['expression']],
Spread: [['expression']]
}
]});
cache$1 = exports;
Nodes = cache$1.Nodes;
Primitives = cache$1.Primitives;
CompoundAssignOp = cache$1.CompoundAssignOp;
StaticMemberAccessOps = cache$1.StaticMemberAccessOps;
Range = cache$1.Range;
ArrayInitialiser = cache$1.ArrayInitialiser;
ObjectInitialiser = cache$1.ObjectInitialiser;
NegatedConditional = cache$1.NegatedConditional;
Conditional = cache$1.Conditional;
Identifier = cache$1.Identifier;
ForOf = cache$1.ForOf;
Functions = cache$1.Functions;
While = cache$1.While;
Class = cache$1.Class;
Block = cache$1.Block;
NewOp = cache$1.NewOp;
Bool = cache$1.Bool;
FunctionApplications = cache$1.FunctionApplications;
RegExps = cache$1.RegExps;
RegExp = cache$1.RegExp;
HeregExp = cache$1.HeregExp;
Super = cache$1.Super;
Slice = cache$1.Slice;
Switch = cache$1.Switch;
Identifiers = cache$1.Identifiers;
SwitchCase = cache$1.SwitchCase;
GenSym = cache$1.GenSym;
Nodes.fromJSON = function (json) {
return exports[json.type].fromJSON(json);
};
Nodes.prototype.listMembers = [];
Nodes.prototype.toJSON = function () {
var child, json;
json = {
type: this.className,
'line': this.line,
'column': this.column,
range: [
this.offset,
null != this.raw ? this.offset + this.raw.length : void 0
],
'raw': this.raw
};
for (var i$ = 0, length$ = this.childNodes.length; i$ < length$; ++i$) {
child = this.childNodes[i$];
if (in$(child, this.listMembers)) {
json[child] = function (accum$) {
var p;
for (var i$1 = 0, length$1 = this[child].length; i$1 < length$1; ++i$1) {
p = this[child][i$1];
accum$.push(p.toJSON());
}
return accum$;
}.call(this, []);
} else {
json[child] = null != this[child] ? this[child].toJSON() : void 0;
}
}
return json;
};
Nodes.prototype.fold = function (memo, fn) {
var child;
for (var i$ = 0, length$ = this.childNodes.length; i$ < length$; ++i$) {
child = this.childNodes[i$];
if (in$(child, this.listMembers)) {
memo = function (accum$) {
var p;
for (var i$1 = 0, length$1 = this[child].length; i$1 < length$1; ++i$1) {
p = this[child][i$1];
accum$.push(p.fold(memo, fn));
}
return accum$;
}.call(this, []);
} else {
memo = this[child].fold(memo, fn);
}
}
return fn(memo, this);
};
Nodes.prototype.clone = function () {
var ctor, k, n, v;
ctor = function () {
};
ctor.prototype = this.constructor.prototype;
n = new ctor;
for (k in this) {
if (!isOwn$(this, k))
continue;
v = this[k];
n[k] = v;
}
return n;
};
Nodes.prototype['instanceof'] = function (ctors) {
var ctor, superclasses;
ctors = 1 <= arguments.length ? [].slice.call(arguments, 0) : [];
superclasses = map(this.constructor.superclasses, function (c) {
return c.prototype.className;
});
for (var i$ = 0, length$ = ctors.length; i$ < length$; ++i$) {
ctor = ctors[i$];
if (!in$(ctor.prototype.className, [this.className].concat([].slice.call(superclasses))))
continue;
return true;
}
return false;
};
Nodes.prototype.r = function (param$) {
this.raw = param$;
return this;
};
Nodes.prototype.p = function (param$, param$1, param$2) {
this.line = param$;
this.column = param$1;
this.offset = param$2;
return this;
};
Nodes.prototype.generated = false;
Nodes.prototype.g = function () {
this.generated = true;
return this;
};
handlePrimitives = function (ctor, primitives) {
ctor.prototype.childNodes = difference(ctor.prototype.childNodes, primitives);
return ctor.prototype.toJSON = function () {
var json, primitive;
json = Nodes.prototype.toJSON.call(this);
for (var i$ = 0, length$ = primitives.length; i$ < length$; ++i$) {
primitive = primitives[i$];
json[primitive] = this[primitive];
}
return json;
};
};
handlePrimitives(Class, ['boundMembers']);
handlePrimitives(CompoundAssignOp, ['op']);
handlePrimitives(ForOf, ['isOwn']);
handlePrimitives(HeregExp, ['flags']);
handlePrimitives(Identifiers, ['data']);
handlePrimitives(Primitives, ['data']);
handlePrimitives(Range, ['isInclusive']);
handlePrimitives(RegExp, [
'data',
'flags'
]);
handlePrimitives(Slice, ['isInclusive']);
handlePrimitives(StaticMemberAccessOps, ['memberName']);
handleLists = function (ctor, listProps) {
return ctor.prototype.listMembers = listProps;
};
handleLists(ArrayInitialiser, ['members']);
handleLists(Block, ['statements']);
handleLists(Functions, ['parameters']);
handleLists(FunctionApplications, ['arguments']);
handleLists(NewOp, ['arguments']);
handleLists(ObjectInitialiser, ['members']);
handleLists(Super, ['arguments']);
handleLists(Switch, ['cases']);
handleLists(SwitchCase, ['conditions']);
Block.wrap = function (s) {
return new Block(null != s ? [s] : []).r(s.raw).p(s.line, s.column);
};
Class.prototype.initialise = function () {
if (null != this.boundMembers)
this.boundMembers;
else
this.boundMembers = [];
this.name = new GenSym('class');
if (null != this.nameAssignee)
return this.name = function () {
switch (false) {
case !this.nameAssignee['instanceof'](Identifier):
return new Identifier(this.nameAssignee.data);
case !this.nameAssignee['instanceof'](StaticMemberAccessOps):
return new Identifier(this.nameAssignee.memberName);
default:
return this.name;
}
}.call(this);
};
Class.prototype.childNodes.push('name');
ObjectInitialiser.prototype.keys = function () {
return map(this.members, function (m) {
return m.key;
});
};
ObjectInitialiser.prototype.vals = function () {
return map(this.members, function (m) {
return m.expression;
});
};
RegExps.prototype.initialise = function (_, flags) {
var flag;
this.flags = {};
for (var cache$2 = [
'g',
'i',
'm',
'y'
], i$ = 0, length$ = cache$2.length; i$ < length$; ++i$) {
flag = cache$2[i$];
this.flags[flag] = in$(flag, flags);
}
};
exports.NegatedConditional = function (super$) {
extends$(NegatedConditional, super$);
function NegatedConditional() {
Conditional.apply(this, arguments);
}
return NegatedConditional;
}(Conditional);
exports.NegatedWhile = function (super$) {
extends$(NegatedWhile, super$);
function NegatedWhile() {
While.apply(this, arguments);
}
return NegatedWhile;
}(While);
exports.Loop = function (super$) {
extends$(Loop, super$);
function Loop(body) {
While.call(this, new Bool(true).g(), body);
}
return Loop;
}(While);
function isOwn$(o, p) {
return {}.hasOwnProperty.call(o, p);
}
function extends$(child, parent) {
var key;
for (key in parent)
if (isOwn$(parent, key))
child[key] = parent[key];
function ctor() {
this.constructor = child;
}
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
}
function in$(member, list) {
for (var i = 0, length = list.length; i < length; ++i)
if (i in list && list[i] === member)
return true;
return false;
}
});
require.define("/lib/coffee-script/preprocessor.js",function(require,module,exports,__dirname,__filename,process,global){// Generated by CoffeeScript 2.0.0-dev
var EventEmitter, fs, inspect, pointToErrorLocation, Preprocessor, StringScanner;
fs = require('fs');
EventEmitter = require('events').EventEmitter;
pointToErrorLocation = require('./helpers').pointToErrorLocation;
StringScanner = require('StringScanner');
inspect = function (o) {
return require('util').inspect(o, false, 9e9, true);
};
this.Preprocessor = Preprocessor = function (super$) {
var DEDENT, INDENT, processInput, TERM, ws;
extends$(Preprocessor, super$);
ws = '\\t\\x0B\\f \\xA0\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000\\uFEFF';
INDENT = '\uefef';
DEDENT = '\ueffe';
TERM = '\uefff';
function Preprocessor() {
this.base = this.indent = null;
this.context = [];
this.context.peek = function () {
if (this.length) {
return this[this.length - 1];
} else {
return null;
}
};
this.context.err = function (c) {
throw new Error('Unexpected ' + inspect(c));
};
this.context.observe = function (c) {
var top;
top = this.peek();
switch (c) {
case '"""':
case "'''":
case '"':
case "'":
case '###':
case '`':
case '///':
case '/':
if (top === c) {
this.pop();
} else {
this.push(c);
}
break;
case INDENT:
case '#':
case '#{':
case '[':
case '(':
case '{':
case '\\':
case 'regexp-[':
case 'regexp-(':
case 'regexp-{':
case 'heregexp-#':
case 'heregexp-[':
case 'heregexp-(':
case 'heregexp-{':
this.push(c);
break;
case DEDENT:
if (!(top === INDENT))
this.err(c);
this.pop();
break;
case '\n':
if (!(top === '#' || top === 'heregexp-#'))
this.err(c);
this.pop();
break;
case ']':
if (!(top === '[' || top === 'regexp-[' || top === 'heregexp-['))
this.err(c);
this.pop();
break;
case ')':
if (!(top === '(' || top === 'regexp-(' || top === 'heregexp-('))
this.err(c);
this.pop();
break;
case '}':
if (!(top === '#{' || top === '{' || top === 'regexp-{' || top === 'heregexp-{'))
this.err(c);
this.pop();
break;
case 'end-\\':
if (!(top === '\\'))
this.err(c);
this.pop();
break;
default:
throw new Error('undefined token observed: ' + c);
}
return this;
};
this.ss = new StringScanner('');
}
Preprocessor.prototype.p = function (s) {
if (null != s)
this.emit('data', s);
return s;
};
Preprocessor.prototype.scan = function (r) {
return this.p(this.ss.scan(r));
};
processInput = function (isEnd) {
return function (data) {
var context, delta, lastChar, level, lines, message, newLevel, nonIdentifierBefore, pos, spaceBefore, tok;
if (!isEnd)
this.ss.concat(data);
while (!this.ss.eos()) {
switch (this.context.peek()) {
case null:
case INDENT:
case '#{':
case '[':
case '(':
case '{':
if (this.ss.bol() || this.scan(new RegExp('(?:[' + ws + ']*\\n)+'))) {
this.scan(new RegExp('(?:[' + ws + ']*(\\#\\#?(?!\\#)[^\\n]*)?\\n)+'));
if (!isEnd && null != this.ss.check(new RegExp('[' + ws + '\\n]*$')))
return;
if (null != this.base) {
if (!(null != this.scan(this.base))) {
throw new Error('inconsistent base indentation');
}
} else {
this.base = new RegExp('' + this.scan(new RegExp('[' + ws + ']*')) + '');
}
if (null != this.indent) {
level = function (accum$) {
var c;
for (var i$ = 0, length$ = this.context.length; i$ < length$; ++i$) {
c = this.context[i$];
if (!(c === INDENT))
continue;
accum$.push(0);
}
return accum$;
}.call(this, []).length;
if (this.ss.check(new RegExp('(?:' + this.indent + '){' + (level + 1) + '}[^' + ws + '#]'))) {
this.scan(new RegExp('(?:' + this.indent + '){' + (level + 1) + '}'));
this.context.observe(INDENT);
this.p(INDENT);
} else if (level > 0 && this.ss.check(new RegExp('(?:' + this.indent + '){0,' + (level - 1) + '}[^' + ws + ']'))) {
newLevel = 0;
while (this.scan(new RegExp('' + this.indent + ''))) {
++newLevel;
}
delta = level - newLevel;
while (delta--) {
this.context.observe(DEDENT);
this.p('' + DEDENT + TERM);
}
} else if (this.ss.check(new RegExp('(?:' + this.indent + '){' + level + '}[^' + ws + ']'))) {
this.scan(new RegExp('(?:' + this.indent + '){' + level + '}'));
} else {
lines = this.ss.str.substr(0, this.ss.pos).split(/\n/) || [''];
message = 'Syntax error on line ' + lines.length + ': invalid indentation';
context = pointToErrorLocation(this.ss.str, lines.length, 1 + (level + 1) * this.indent.length);
throw new Error('' + message + '\n' + context);
}
} else if (this.ss.check(new RegExp('[' + ws + ']+[^' + ws + '#]'))) {
this.indent = this.scan(new RegExp('[' + ws + ']+'));
this.context.observe(INDENT);
this.p(INDENT);
}
}
tok = function () {
switch (this.context.peek()) {
case '[':
this.scan(/[^\n'"\\\/#`[({\]]+/);
return this.scan(/\]/);
case '(':
this.scan(/[^\n'"\\\/#`[({)]+/);
return this.scan(/\)/);
case '#{':
case '{':
this.scan(/[^\n'"\\\/#`[({}]+/);
return this.scan(/\}/);
default: {
this.scan(/[^\n'"\\\/#`[({]+/);
return null;
}
}
}.call(this);
if (tok) {
this.context.observe(tok);
continue;
}
if (tok = this.scan(/"""|'''|\/\/\/|###|["'`#[({\\]/)) {
this.context.observe(tok);
} else if (tok = this.scan(/\//)) {
pos = this.ss.position();
if (pos > 1) {
lastChar = this.ss.string()[pos - 2];
spaceBefore = new RegExp('[' + ws + ']').test(lastChar);
nonIdentifierBefore = /[\W_$]/.test(lastChar);
}
if (pos === 1 || (spaceBefore ? !this.ss.check(new RegExp('[' + ws + '=]')) : nonIdentifierBefore))
this.context.observe('/');
}
break;
case '\\':
if (this.scan(/[\s\S]/))
this.context.observe('end-\\');
break;
case '"""':
this.scan(/(?:[^"#\\]+|""?(?!")|#(?!{)|\\.)+/);
this.ss.scan(/\\\n/);
if (tok = this.scan(/#{|"""/)) {
this.context.observe(tok);
} else if (tok = this.scan(/#{|"""/)) {
this.context.observe(tok);
}
break;
case '"':
this.scan(/(?:[^"#\\]+|#(?!{)|\\.)+/);
this.ss.scan(/\\\n/);
if (tok = this.scan(/#{|"/))
this.context.observe(tok);
break;
case "'''":
this.scan(/(?:[^'\\]+|''?(?!')|\\.)+/);
this.ss.scan(/\\\n/);
if (tok = this.scan(/'''/))
this.context.observe(tok);
break;
case "'":
this.scan(/(?:[^'\\]+|\\.)+/);
this.ss.scan(/\\\n/);
if (tok = this.scan(/'/))
this.context.observe(tok);
break;
case '###':
this.scan(/(?:[^#]+|##?(?!#))+/);
if (tok = this.scan(/###/))
this.context.observe(tok);
break;
case '#':
this.scan(/[^\n]+/);
if (tok = this.scan(/\n/))
this.context.observe(tok);
break;
case '`':
this.scan(/[^`]+/);
if (tok = this.scan(/`/))
this.context.observe(tok);
break;
case '///':
this.scan(/(?:[^[/#\\]+|\/\/?(?!\/)|\\.)+/);
if (tok = this.scan(/#{|\/\/\/|\\/)) {
this.context.observe(tok);
} else if (this.ss.scan(/#/)) {
this.context.observe('heregexp-#');
} else if (tok = this.scan(/[\[]/)) {
this.context.observe('heregexp-' + tok);
}
break;
case 'heregexp-[':
this.scan(/(?:[^\]\/\\]+|\/\/?(?!\/))+/);
if (tok = this.scan(/[\]\\]|#{|\/\/\//))
this.context.observe(tok);
break;
case 'heregexp-#':
this.ss.scan(/(?:[^\n/]+|\/\/?(?!\/))+/);
if (tok = this.scan(/\n|\/\/\//))
this.context.observe(tok);
break;
case '/':
this.scan(/[^[/\\]+/);
if (tok = this.scan(/[\/\\]/)) {
this.context.observe(tok);
} else if (tok = this.scan(/\[/)) {
this.context.observe('regexp-' + tok);
}
break;
case 'regexp-[':
this.scan(/[^\]\\]+/);
if (tok = this.scan(/[\]\\]/))
this.context.observe(tok);
}
}
if (isEnd) {
this.scan(new RegExp('[' + ws + '\\n]*$'));
while (this.context.length && INDENT === this.context.peek()) {
this.context.observe(DEDENT);
this.p('' + DEDENT + TERM);
}
if (this.context.length)
throw new Error('Unclosed ' + inspect(this.context.peek()) + ' at EOF');
this.emit('end');
return;
}
};
};
Preprocessor.prototype.processData = processInput(false);
Preprocessor.prototype.processEnd = processInput(true);
Preprocessor.processSync = function (input) {
var output, pre;
pre = new Preprocessor;
output = '';
pre.emit = function (type, data) {
if (type === 'data')
return output += data;
};
pre.processData(input);
pre.processEnd();
return output;
};
return Preprocessor;
}(EventEmitter);
function isOwn$(o, p) {
return {}.hasOwnProperty.call(o, p);
}
function extends$(child, parent) {
var key;
for (key in parent)
if (isOwn$(parent, key))
child[key] = parent[key];
function ctor() {
this.constructor = child;
}
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
}
});
require.define("fs",function(require,module,exports,__dirname,__filename,process,global){// nothing to see here... no file methods for the browser
});
require.define("events",function(require,module,exports,__dirname,__filename,process,global){if (!process.EventEmitter) process.EventEmitter = function () {};
var EventEmitter = exports.EventEmitter = process.EventEmitter;
var isArray = typeof Array.isArray === 'function'
? Array.isArray
: function (xs) {
return Object.prototype.toString.call(xs) === '[object Array]'
}
;
// By default EventEmitters will print a warning if more than
// 10 listeners are added to it. This is a useful default which
// helps finding memory leaks.
//
// Obviously not all Emitters should be limited to 10. This function allows
// that to be increased. Set to zero for unlimited.
var defaultMaxListeners = 10;
EventEmitter.prototype.setMaxListeners = function(n) {
if (!this._events) this._events = {};
this._events.maxListeners = n;
};
EventEmitter.prototype.emit = function(type) {
// If there is no 'error' event listener then throw.
if (type === 'error') {
if (!this._events || !this._events.error ||
(isArray(this._events.error) && !this._events.error.length))
{
if (arguments[1] instanceof Error) {
throw arguments[1]; // Unhandled 'error' event
} else {
throw new Error("Uncaught, unspecified 'error' event.");
}
return false;
}
}
if (!this._events) return false;
var handler = this._events[type];
if (!handler) return false;
if (typeof handler == 'function') {
switch (arguments.length) {
// fast cases
case 1:
handler.call(this);
break;
case 2:
handler.call(this, arguments[1]);
break;
case 3:
handler.call(this, arguments[1], arguments[2]);
break;
// slower
default:
var args = Array.prototype.slice.call(arguments, 1);
handler.apply(this, args);
}
return true;
} else if (isArray(handler)) {
var args = Array.prototype.slice.call(arguments, 1);
var listeners = handler.slice();
for (var i = 0, l = listeners.length; i < l; i++) {
listeners[i].apply(this, args);
}
return true;
} else {
return false;
}
};
// EventEmitter is defined in src/node_events.cc
// EventEmitter.prototype.emit() is also defined there.
EventEmitter.prototype.addListener = function(type, listener) {
if ('function' !== typeof listener) {
throw new Error('addListener only takes instances of Function');
}
if (!this._events) this._events = {};
// To avoid recursion in the case that type == "newListeners"! Before
// adding it to the listeners, first emit "newListeners".
this.emit('newListener', type, listener);
if (!this._events[type]) {
// Optimize the case of one listener. Don't need the extra array object.
this._events[type] = listener;
} else if (isArray(this._events[type])) {
// Check for listener leak
if (!this._events[type].warned) {
var m;
if (this._events.maxListeners !== undefined) {
m = this._events.maxListeners;
} else {
m = defaultMaxListeners;
}
if (m && m > 0 && this._events[type].length > m) {
this._events[type].warned = true;
console.error('(node) warning: possible EventEmitter memory ' +
'leak detected. %d listeners added. ' +
'Use emitter.setMaxListeners() to increase limit.',
this._events[type].length);
console.trace();
}
}
// If we've already got an array, just append.
this._events[type].push(listener);
} else {
// Adding the second element, need to change to array.
this._events[type] = [this._events[type], listener];
}
return this;
};
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
EventEmitter.prototype.once = function(type, listener) {
var self = this;
self.on(type, function g() {
self.removeListener(type, g);
listener.apply(this, arguments);
});
return this;
};
EventEmitter.prototype.removeListener = function(type, listener) {
if ('function' !== typeof listener) {
throw new Error('removeListener only takes instances of Function');
}
// does not use listeners(), so no side effect of creating _events[type]
if (!this._events || !this._events[type]) return this;
var list = this._events[type];
if (isArray(list)) {
var i = list.indexOf(listener);
if (i < 0) return this;
list.splice(i, 1);
if (list.length == 0)
delete this._events[type];
} else if (this._events[type] === listener) {
delete this._events[type];
}
return this;
};
EventEmitter.prototype.removeAllListeners = function(type) {
// does not use listeners(), so no side effect of creating _events[type]
if (type && this._events && this._events[type]) this._events[type] = null;
return this;
};
EventEmitter.prototype.listeners = function(type) {
if (!this._events) this._events = {};
if (!this._events[type]) this._events[type] = [];
if (!isArray(this._events[type])) {
this._events[type] = [this._events[type]];
}
return this._events[type];
};
});
require.define("/node_modules/StringScanner/package.json",function(require,module,exports,__dirname,__filename,process,global){module.exports = {"main":"./lib/StringScanner"}
});
require.define("/node_modules/StringScanner/lib/StringScanner.js",function(require,module,exports,__dirname,__filename,process,global){(function() {
var StringScanner;
StringScanner = (function() {
function StringScanner(str) {
this.str = str != null ? str : '';
this.str = '' + this.str;
this.pos = 0;
this.lastMatch = {
reset: function() {
this.str = null;
this.captures = [];
return this;
}
}.reset();
this;
}
StringScanner.prototype.bol = function() {
return this.pos <= 0 || (this.str[this.pos - 1] === "\n");
};
StringScanner.prototype.captures = function() {
return this.lastMatch.captures;
};
StringScanner.prototype.check = function(pattern) {
var matches;
if (this.str.substr(this.pos).search(pattern) !== 0) {
this.lastMatch.reset();
return null;
}
matches = this.str.substr(this.pos).match(pattern);
this.lastMatch.str = matches[0];
this.lastMatch.captures = matches.slice(1);
return this.lastMatch.str;
};
StringScanner.prototype.checkUntil = function(pattern) {
var matches, patternPos;
patternPos = this.str.substr(this.pos).search(pattern);
if (patternPos < 0) {
this.lastMatch.reset();
return null;
}
matches = this.str.substr(this.pos + patternPos).match(pattern);
this.lastMatch.captures = matches.slice(1);
return this.lastMatch.str = this.str.substr(this.pos, patternPos) + matches[0];
};
StringScanner.prototype.clone = function() {
var clone, prop, value, _ref;
clone = new this.constructor(this.str);
clone.pos = this.pos;
clone.lastMatch = {};
_ref = this.lastMatch;
for (prop in _ref) {
value = _ref[prop];
clone.lastMatch[prop] = value;
}
return clone;
};
StringScanner.prototype.concat = function(str) {
this.str += str;
return this;
};
StringScanner.prototype.eos = function() {
return this.pos === this.str.length;
};
StringScanner.prototype.exists = function(pattern) {
var matches, patternPos;
patternPos = this.str.substr(this.pos).search(pattern);
if (patternPos < 0) {
this.lastMatch.reset();
return null;
}
matches = this.str.substr(this.pos + patternPos).match(pattern);
this.lastMatch.str = matches[0];
this.lastMatch.captures = matches.slice(1);
return patternPos;
};
StringScanner.prototype.getch = function() {
return this.scan(/./);
};
StringScanner.prototype.match = function() {
return this.lastMatch.str;
};
StringScanner.prototype.matches = function(pattern) {
this.check(pattern);
return this.matchSize();
};
StringScanner.prototype.matched = function() {
return this.lastMatch.str != null;
};
StringScanner.prototype.matchSize = function() {
if (this.matched()) {
return this.match().length;
} else {
return null;
}
};
StringScanner.prototype.peek = function(len) {
return this.str.substr(this.pos, len);
};
StringScanner.prototype.pointer = function() {
return this.pos;
};
StringScanner.prototype.setPointer = function(pos) {
pos = +pos;
if (pos < 0) {
pos = 0;
}
if (pos > this.str.length) {
pos = this.str.length;
}
return this.pos = pos;
};
StringScanner.prototype.reset = function() {
this.lastMatch.reset();
this.pos = 0;
return this;
};
StringScanner.prototype.rest = function() {
return this.str.substr(this.pos);
};
StringScanner.prototype.scan = function(pattern) {
var chk;
chk = this.check(pattern);
if (chk != null) {
this.pos += chk.length;
}
return chk;
};
StringScanner.prototype.scanUntil = function(pattern) {
var chk;
chk = this.checkUntil(pattern);
if (chk != null) {
this.pos += chk.length;
}
return chk;
};
StringScanner.prototype.skip = function(pattern) {
this.scan(pattern);
return this.matchSize();
};
StringScanner.prototype.skipUntil = function(pattern) {
this.scanUntil(pattern);
return this.matchSize();
};
StringScanner.prototype.string = function() {
return this.str;
};
StringScanner.prototype.terminate = function() {
this.pos = this.str.length;
this.lastMatch.reset();
return this;
};
StringScanner.prototype.toString = function() {
return "#<StringScanner " + (this.eos() ? 'fin' : "" + this.pos + "/" + this.str.length + " @ " + (this.str.length > 8 ? "" + (this.str.substr(0, 5)) + "..." : this.str)) + ">";
};
return StringScanner;
})();
StringScanner.prototype.beginningOfLine = StringScanner.prototype.bol;
StringScanner.prototype.clear = StringScanner.prototype.terminate;
StringScanner.prototype.dup = StringScanner.prototype.clone;
StringScanner.prototype.endOfString = StringScanner.prototype.eos;
StringScanner.prototype.exist = StringScanner.prototype.exists;
StringScanner.prototype.getChar = StringScanner.prototype.getch;
StringScanner.prototype.position = StringScanner.prototype.pointer;
StringScanner.StringScanner = StringScanner;
module.exports = StringScanner;
}).call(this);
});
require.define("util",function(require,module,exports,__dirname,__filename,process,global){var events = require('events');
exports.print = function () {};
exports.puts = function () {};
exports.debug = function() {};
exports.inspect = function(obj, showHidden, depth, colors) {
var seen = [];
var stylize = function(str, styleType) {
// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
var styles =
{ 'bold' : [1, 22],
'italic' : [3, 23],
'underline' : [4, 24],
'inverse' : [7, 27],
'white' : [37, 39],
'grey' : [90, 39],
'black' : [30, 39],
'blue' : [34, 39],
'cyan' : [36, 39],
'green' : [32, 39],
'magenta' : [35, 39],
'red' : [31, 39],
'yellow' : [33, 39] };
var style =
{ 'special': 'cyan',
'number': 'blue',
'boolean': 'yellow',
'undefined': 'grey',
'null': 'bold',
'string': 'green',
'date': 'magenta',
// "name": intentionally not styling
'regexp': 'red' }[styleType];
if (style) {
return '\033[' + styles[style][0] + 'm' + str +
'\033[' + styles[style][1] + 'm';
} else {
return str;
}
};
if (! colors) {
stylize = function(str, styleType) { return str; };
}
function format(value, recurseTimes) {
// Provide a hook for user-specified inspect functions.
// Check that value is an object with an inspect function on it
if (value && typeof value.inspect === 'function' &&
// Filter out the util module, it's inspect function is special
value !== exports &&
// Also filter out any prototype objects using the circular check.
!(value.constructor && value.constructor.prototype === value)) {
return value.inspect(recurseTimes);
}
// Primitive types cannot have properties
switch (typeof value) {
case 'undefined':
return stylize('undefined', 'undefined');
case 'string':
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
.replace(/'/g, "\\'")
.replace(/\\"/g, '"') + '\'';
return stylize(simple, 'string');
case 'number':
return stylize('' + value, 'number');
case 'boolean':
return stylize('' + value, 'boolean');
}
// For some reason typeof null is "object", so special case here.
if (value === null) {
return stylize('null', 'null');
}
// Look up the keys of the object.
var visible_keys = Object_keys(value);
var keys = showHidden ? Object_getOwnPropertyNames(value) : visible_keys;
// Functions without properties can be shortcutted.
if (typeof value === 'function' && keys.length === 0) {
if (isRegExp(value)) {
return stylize('' + value, 'regexp');
} else {
var name = value.name ? ': ' + value.name : '';
return stylize('[Function' + name + ']', 'special');
}
}
// Dates without properties can be shortcutted
if (isDate(value) && keys.length === 0) {
return stylize(value.toUTCString(), 'date');
}
var base, type, braces;
// Determine the object type
if (isArray(value)) {
type = 'Array';
braces = ['[', ']'];
} else {
type = 'Object';
braces = ['{', '}'];
}
// Make functions say that they are functions
if (typeof value === 'function') {
var n = value.name ? ': ' + value.name : '';
base = (isRegExp(value)) ? ' ' + value : ' [Function' + n + ']';
} else {
base = '';
}
// Make dates with properties first say the date
if (isDate(value)) {
base = ' ' + value.toUTCString();
}
if (keys.length === 0) {
return braces[0] + base + braces[1];
}
if (recurseTimes < 0) {
if (isRegExp(value)) {
return stylize('' + value, 'regexp');
} else {
return stylize('[Object]', 'special');
}
}
seen.push(value);
var output = keys.map(function(key) {
var name, str;
if (value.__lookupGetter__) {
if (value.__lookupGetter__(key)) {
if (value.__lookupSetter__(key)) {
str = stylize('[Getter/Setter]', 'special');
} else {
str = stylize('[Getter]', 'special');
}
} else {
if (value.__lookupSetter__(key)) {
str = stylize('[Setter]', 'special');
}
}
}
if (visible_keys.indexOf(key) < 0) {
name = '[' + key + ']';
}
if (!str) {
if (seen.indexOf(value[key]) < 0) {
if (recurseTimes === null) {
str = format(value[key]);
} else {
str = format(value[key], recurseTimes - 1);
}
if (str.indexOf('\n') > -1) {
if (isArray(value)) {
str = str.split('\n').map(function(line) {
return ' ' + line;
}).join('\n').substr(2);
} else {
str = '\n' + str.split('\n').map(function(line) {
return ' ' + line;
}).join('\n');
}
}
} else {
str = stylize('[Circular]', 'special');
}
}
if (typeof name === 'undefined') {
if (type === 'Array' && key.match(/^\d+$/)) {
return str;
}
name = JSON.stringify('' + key);
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
name = name.substr(1, name.length - 2);
name = stylize(name, 'name');
} else {
name = name.replace(/'/g, "\\'")
.replace(/\\"/g, '"')
.replace(/(^"|"$)/g, "'");
name = stylize(name, 'string');
}
}
return name + ': ' + str;
});
seen.pop();
var numLinesEst = 0;
var length = output.reduce(function(prev, cur) {
numLinesEst++;
if (cur.indexOf('\n') >= 0) numLinesEst++;
return prev + cur.length + 1;
}, 0);
if (length > 50) {
output = braces[0] +
(base === '' ? '' : base + '\n ') +
' ' +
output.join(',\n ') +
' ' +
braces[1];
} else {
output = braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
}
return output;
}
return format(obj, (typeof depth === 'undefined' ? 2 : depth));
};
function isArray(ar) {
return ar instanceof Array ||
Array.isArray(ar) ||
(ar && ar !== Object.prototype && isArray(ar.__proto__));
}
function isRegExp(re) {
return re instanceof RegExp ||
(typeof re === 'object' && Object.prototype.toString.call(re) === '[object RegExp]');
}
function isDate(d) {
if (d instanceof Date) return true;
if (typeof d !== 'object') return false;
var properties = Date.prototype && Object_getOwnPropertyNames(Date.prototype);
var proto = d.__proto__ && Object_getOwnPropertyNames(d.__proto__);
return JSON.stringify(proto) === JSON.stringify(properties);
}
function pad(n) {
return n < 10 ? '0' + n.toString(10) : n.toString(10);
}
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
'Oct', 'Nov', 'Dec'];
// 26 Feb 16:19:34
function timestamp() {
var d = new Date();
var time = [pad(d.getHours()),
pad(d.getMinutes()),
pad(d.getSeconds())].join(':');
return [d.getDate(), months[d.getMonth()], time].join(' ');
}
exports.log = function (msg) {};
exports.pump = null;
var Object_keys = Object.keys || function (obj) {
var res = [];
for (var key in obj) res.push(key);
return res;
};
var Object_getOwnPropertyNames = Object.getOwnPropertyNames || function (obj) {
var res = [];
for (var key in obj) {
if (Object.hasOwnProperty.call(obj, key)) res.push(key);
}
return res;
};
var Object_create = Object.create || function (prototype, properties) {
// from es5-shim
var object;
if (prototype === null) {
object = { '__proto__' : null };
}
else {
if (typeof prototype !== 'object') {
throw new TypeError(
'typeof prototype[' + (typeof prototype) + '] != \'object\''
);
}
var Type = function () {};
Type.prototype = prototype;
object = new Type();
object.__proto__ = prototype;
}
if (typeof properties !== 'undefined' && Object.defineProperties) {
Object.defineProperties(object, properties);
}
return object;
};
exports.inherits = function(ctor, superCtor) {
ctor.super_ = superCtor;
ctor.prototype = Object_create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
});
};
var formatRegExp = /%[sdj%]/g;
exports.format = function(f) {
if (typeof f !== 'string') {
var objects = [];
for (var i = 0; i < arguments.length; i++) {
objects.push(exports.inspect(arguments[i]));
}
return objects.join(' ');
}
var i = 1;
var args = arguments;
var len = args.length;
var str = String(f).replace(formatRegExp, function(x) {
if (x === '%') return '%';
if (i >= len) return x;
switch (x) {
case '%s': return String(args[i++]);
case '%d': return Number(args[i++]);
case '%j': return JSON.stringify(args[i++]);
default:
return x;
}
});
for(var x = args[i]; i < len; x = args[++i]){
if (x === null || typeof x !== 'object') {
str += ' ' + x;
} else {
str += ' ' + exports.inspect(x);
}
}
return str;
};
});
require.define("/lib/coffee-script/parser.js",function(require,module,exports,__dirname,__filename,process,global){module.exports = module.exports = (function(){
/*
* Generated by PEG.js 0.7.0.
*
* http://pegjs.majda.cz/
*/
function quote(s) {
/*
* ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a
* string literal except for the closing quote character, backslash,
* carriage return, line separator, paragraph separator, and line feed.
* Any character may appear in the form of an escape sequence.
*
* For portability, we also escape escape all control and non-ASCII
* characters. Note that "\0" and "\v" escape sequences are not used
* because JSHint does not like the first and IE the second.
*/
return '"' + s
.replace(/\\/g, '\\\\') // backslash
.replace(/"/g, '\\"') // closing quote character
.replace(/\x08/g, '\\b') // backspace
.replace(/\t/g, '\\t') // horizontal tab
.replace(/\n/g, '\\n') // line feed
.replace(/\f/g, '\\f') // form feed
.replace(/\r/g, '\\r') // carriage return
.replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g, escape)
+ '"';
}
var result = {
/*
* Parses the input with a generated parser. If the parsing is successfull,
* returns a value explicitly or implicitly specified by the grammar from
* which the parser was generated (see |PEG.buildParser|). If the parsing is
* unsuccessful, throws |PEG.parser.SyntaxError| describing the error.
*/
parse: function(input, startRule) {
var parseFunctions = {
"program": parse_program,
"toplevelBlock": parse_toplevelBlock,
"toplevelStatement": parse_toplevelStatement