Socket
Socket
Sign inDemoInstall

coffeescript

Package Overview
Dependencies
Maintainers
3
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coffeescript - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

2

lib/coffee-script/browser.js

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.5.0
(function() {

@@ -3,0 +3,0 @@ var CoffeeScript, runScripts;

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.5.0
(function() {

@@ -3,0 +3,0 @@ var CoffeeScript, cakefileDirectory, existsSync, fatalError, fs, helpers, missingTask, oparse, options, optparse, path, printTasks, switches, tasks;

@@ -1,4 +0,5 @@

// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.5.0
(function() {
var Lexer, RESERVED, compile, fs, lexer, parser, path, stripBOM, vm, _ref,
var Lexer, compile, ext, extensions, fs, lexer, loadFile, parser, path, vm, _i, _len,
__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; },
__hasProp = {}.hasOwnProperty;

@@ -10,3 +11,3 @@

_ref = require('./lexer'), Lexer = _ref.Lexer, RESERVED = _ref.RESERVED;
Lexer = require('./lexer').Lexer;

@@ -17,24 +18,22 @@ parser = require('./parser').parser;

stripBOM = function(content) {
if (content.charCodeAt(0) === 0xFEFF) {
return content.substring(1);
} else {
return content;
}
extensions = ['.coffee', '.litcoffee'];
loadFile = function(module, filename) {
var raw, stripped;
raw = fs.readFileSync(filename, 'utf8');
stripped = raw.charCodeAt(0) === 0xFEFF ? raw.substring(1) : raw;
return module._compile(compile(stripped, {
filename: filename
}), filename);
};
if (require.extensions) {
require.extensions['.coffee'] = function(module, filename) {
var content;
content = compile(stripBOM(fs.readFileSync(filename, 'utf8')), {
filename: filename
});
return module._compile(content, filename);
};
for (_i = 0, _len = extensions.length; _i < _len; _i++) {
ext = extensions[_i];
require.extensions[ext] = loadFile;
}
}
exports.VERSION = '1.4.0';
exports.VERSION = '1.5.0';
exports.RESERVED = RESERVED;
exports.helpers = require('./helpers');

@@ -49,3 +48,3 @@

try {
js = (parser.parse(lexer.tokenize(code))).compile(options);
js = (parser.parse(lexer.tokenize(code, options))).compile(options);
if (!options.header) {

@@ -77,3 +76,3 @@ return js;

exports.run = function(code, options) {
var mainModule;
var mainModule, _ref;
if (options == null) {

@@ -86,3 +85,3 @@ options = {};

mainModule.paths = require('module')._nodeModulePaths(path.dirname(fs.realpathSync(options.filename)));
if (path.extname(mainModule.filename) !== '.coffee' || require.extensions) {
if ((_ref = path.extname(mainModule.filename), __indexOf.call(extensions, _ref) < 0) || require.extensions) {
return mainModule._compile(compile(code, options), mainModule.filename);

@@ -95,3 +94,3 @@ } else {

exports["eval"] = function(code, options) {
var Module, Script, js, k, o, r, sandbox, v, _i, _len, _module, _ref1, _ref2, _require;
var Module, Script, js, k, o, r, sandbox, v, _j, _len1, _module, _ref, _ref1, _require;
if (options == null) {

@@ -110,6 +109,6 @@ options = {};

sandbox = Script.createContext();
_ref1 = options.sandbox;
for (k in _ref1) {
if (!__hasProp.call(_ref1, k)) continue;
v = _ref1[k];
_ref = options.sandbox;
for (k in _ref) {
if (!__hasProp.call(_ref, k)) continue;
v = _ref[k];
sandbox[k] = v;

@@ -131,5 +130,5 @@ }

_module.filename = sandbox.__filename;
_ref2 = Object.getOwnPropertyNames(require);
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
r = _ref2[_i];
_ref1 = Object.getOwnPropertyNames(require);
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
r = _ref1[_j];
if (r !== 'paths') {

@@ -164,4 +163,10 @@ _require[r] = require[r];

lex: function() {
var tag, _ref1;
_ref1 = this.tokens[this.pos++] || [''], tag = _ref1[0], this.yytext = _ref1[1], this.yylineno = _ref1[2];
var tag, token;
token = this.tokens[this.pos++];
if (token) {
tag = token[0], this.yytext = token[1], this.yylloc = token[2];
this.yylineno = this.yylloc.first_line;
} else {
tag = '';
}
return tag;

@@ -168,0 +173,0 @@ },

@@ -1,4 +0,5 @@

// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.5.0
(function() {
var BANNER, CoffeeScript, EventEmitter, SWITCHES, compileJoin, compileOptions, compilePath, compileScript, compileStdio, exec, exists, forkNode, fs, helpers, hidden, joinTimeout, lint, loadRequires, notSources, optionParser, optparse, opts, outputPath, parseOptions, path, printLine, printTokens, printWarn, removeSource, sourceCode, sources, spawn, timeLog, unwatchDir, usage, version, wait, watch, watchDir, watchers, writeJs, _ref;
var BANNER, CoffeeScript, EventEmitter, SWITCHES, coffee_exts, compileJoin, compileOptions, compilePath, compileScript, compileStdio, exec, exists, forkNode, fs, helpers, hidden, joinTimeout, lint, notSources, optionParser, optparse, opts, outputPath, parseOptions, path, printLine, printTokens, printWarn, removeSource, sourceCode, sources, spawn, timeLog, unwatchDir, usage, version, wait, watch, watchDir, watchers, writeJs, _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; };

@@ -37,3 +38,3 @@ fs = require('fs');

SWITCHES = [['-b', '--bare', 'compile without a top-level function wrapper'], ['-c', '--compile', 'compile to JavaScript and save as .js files'], ['-e', '--eval', 'pass a string from the command line as input'], ['-h', '--help', 'display this help message'], ['-i', '--interactive', 'run an interactive CoffeeScript REPL'], ['-j', '--join [FILE]', 'concatenate the source CoffeeScript before compiling'], ['-l', '--lint', 'pipe the compiled JavaScript through JavaScript Lint'], ['-n', '--nodes', 'print out the parse tree that the parser produces'], ['--nodejs [ARGS]', 'pass options directly to the "node" binary'], ['-o', '--output [DIR]', 'set the output directory for compiled JavaScript'], ['-p', '--print', 'print out the compiled JavaScript'], ['-r', '--require [FILE*]', 'require a library before executing your script'], ['-s', '--stdio', 'listen for and compile scripts over stdio'], ['-t', '--tokens', 'print out the tokens that the lexer/rewriter produce'], ['-v', '--version', 'display the version number'], ['-w', '--watch', 'watch scripts for changes and rerun commands']];
SWITCHES = [['-b', '--bare', 'compile without a top-level function wrapper'], ['-c', '--compile', 'compile to JavaScript and save as .js files'], ['-e', '--eval', 'pass a string from the command line as input'], ['-h', '--help', 'display this help message'], ['-i', '--interactive', 'run an interactive CoffeeScript REPL'], ['-j', '--join [FILE]', 'concatenate the source CoffeeScript before compiling'], ['-l', '--lint', 'pipe the compiled JavaScript through JavaScript Lint'], ['-n', '--nodes', 'print out the parse tree that the parser produces'], ['--nodejs [ARGS]', 'pass options directly to the "node" binary'], ['-o', '--output [DIR]', 'set the output directory for compiled JavaScript'], ['-p', '--print', 'print out the compiled JavaScript'], ['-s', '--stdio', 'listen for and compile scripts over stdio'], ['-t', '--tokens', 'print out the tokens that the lexer/rewriter produce'], ['-v', '--version', 'display the version number'], ['-w', '--watch', 'watch scripts for changes and rerun commands']];

@@ -52,2 +53,4 @@ opts = {};

coffee_exts = ['.coffee', '.litcoffee'];
exports.run = function() {

@@ -65,7 +68,4 @@ var literals, source, _i, _len, _results;

}
if (opts.require) {
loadRequires();
}
if (opts.interactive) {
return require('./repl');
return require('./repl').start();
}

@@ -82,3 +82,3 @@ if (opts.watch && !fs.watch) {

if (!sources.length) {
return require('./repl');
return require('./repl').start();
}

@@ -88,3 +88,2 @@ literals = opts.run ? sources.splice(1) : [];

process.argv[0] = 'coffee';
process.execPath = require.main.filename;
_results = [];

@@ -100,2 +99,3 @@ for (_i = 0, _len = sources.length; _i < _len; _i++) {

return fs.stat(source, function(err, stats) {
var _ref1, _ref2;
if (err && err.code !== 'ENOENT') {

@@ -105,3 +105,3 @@ throw err;

if ((err != null ? err.code : void 0) === 'ENOENT') {
if (topLevel && source.slice(-7) !== '.coffee') {
if (topLevel && source && (_ref1 = path.extname(source), __indexOf.call(coffee_exts, _ref1) < 0)) {
source = sources[sources.indexOf(source)] = "" + source + ".coffee";

@@ -116,3 +116,3 @@ return compilePath(source, topLevel, base);

}
if (stats.isDirectory()) {
if (stats.isDirectory() && path.dirname(source) !== 'node_modules') {
if (opts.watch) {

@@ -122,3 +122,3 @@ watchDir(source, base);

return fs.readdir(source, function(err, files) {
var file, index, _ref1, _ref2;
var file, index, _ref2, _ref3;
if (err && err.code !== 'ENOENT') {

@@ -134,3 +134,3 @@ throw err;

});
[].splice.apply(sources, [index, index - index + 1].concat(_ref1 = (function() {
[].splice.apply(sources, [index, index - index + 1].concat(_ref2 = (function() {
var _i, _len, _results;

@@ -143,6 +143,6 @@ _results = [];

return _results;
})())), _ref1;
[].splice.apply(sourceCode, [index, index - index + 1].concat(_ref2 = files.map(function() {
})())), _ref2;
[].splice.apply(sourceCode, [index, index - index + 1].concat(_ref3 = files.map(function() {
return null;
}))), _ref2;
}))), _ref3;
return files.forEach(function(file) {

@@ -152,3 +152,3 @@ return compilePath(path.join(source, file), false, base);

});
} else if (topLevel || path.extname(source) === '.coffee') {
} else if (topLevel || (_ref2 = path.extname(source), __indexOf.call(coffee_exts, _ref2) >= 0)) {
if (opts.watch) {

@@ -185,5 +185,5 @@ watch(source, base);

if (o.tokens) {
return printTokens(CoffeeScript.tokens(t.input));
return printTokens(CoffeeScript.tokens(t.input, t.options));
} else if (o.nodes) {
return printLine(CoffeeScript.nodes(t.input).toString().trim());
return printLine(CoffeeScript.nodes(t.input, t.options).toString().trim());
} else if (o.run) {

@@ -248,14 +248,2 @@ return CoffeeScript.run(t.input, t.options);

loadRequires = function() {
var realFilename, req, _i, _len, _ref1;
realFilename = module.filename;
module.filename = '.';
_ref1 = opts.require;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
req = _ref1[_i];
require(req);
}
return module.filename = realFilename;
};
watch = function(source, base) {

@@ -460,10 +448,12 @@ var compile, compileTimeout, prevStats, rewatch, watchErr, watcher;

printTokens = function(tokens) {
var strings, tag, token, value;
var locationData, strings, tag, token, value;
strings = (function() {
var _i, _len, _ref1, _results;
var _i, _len, _results;
_results = [];
for (_i = 0, _len = tokens.length; _i < _len; _i++) {
token = tokens[_i];
_ref1 = [token[0], token[1].toString().replace(/\n/, '\\n')], tag = _ref1[0], value = _ref1[1];
_results.push("[" + tag + " " + value + "]");
tag = token[0];
value = token[1].toString().replace(/\n/, '\\n');
locationData = helpers.locationDataToString(token[2]);
_results.push("[" + tag + " " + value + " " + locationData + "]");
}

@@ -490,4 +480,7 @@ return _results;

compileOptions = function(filename) {
var literate;
literate = path.extname(filename) === '.litcoffee';
return {
filename: filename,
literate: literate,
bare: opts.bare,

@@ -494,0 +487,0 @@ header: opts.compile

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.5.0
(function() {

@@ -10,4 +10,5 @@ var Parser, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap;

o = function(patternString, action, options) {
var match;
var addLocationDataFn, match, patternCount;
patternString = patternString.replace(/\s{2,}/g, ' ');
patternCount = patternString.split(' ').length;
if (!action) {

@@ -19,3 +20,13 @@ return [patternString, '$$ = $1;', options];

action = action.replace(/\b(?:Block\.wrap|extend)\b/g, 'yy.$&');
return [patternString, "$$ = " + action + ";", options];
action = action.replace(/\b(Op|Value\.(create|wrap))\b/g, 'yy.$&');
addLocationDataFn = function(first, last) {
if (!last) {
return "yy.addLocationDataFn(@" + first + ")";
} else {
return "yy.addLocationDataFn(@" + first + ", @" + last + ")";
}
};
action = action.replace(/LOC\(([0-9]*)\)/g, addLocationDataFn('$1'));
action = action.replace(/LOC\(([0-9]*),\s*([0-9]*)\)/g, addLocationDataFn('$1', '$2'));
return [patternString, "$$ = " + (addLocationDataFn(1, patternCount)) + "(" + action + ");", options];
};

@@ -88,8 +99,8 @@

o('ObjAssignable', function() {
return new Value($1);
return Value.wrap($1);
}), o('ObjAssignable : Expression', function() {
return new Assign(new Value($1), $3, 'object');
return new Assign(LOC(1)(Value.wrap($1)), $3, 'object');
}), o('ObjAssignable :\
INDENT Expression OUTDENT', function() {
return new Assign(new Value($1), $4, 'object');
return new Assign(LOC(1)(Value.wrap($1)), $4, 'object');
}), o('Comment')

@@ -155,7 +166,7 @@ ],

o('Identifier', function() {
return new Value($1);
return Value.wrap($1);
}), o('Value Accessor', function() {
return $1.add($2);
}), o('Invocation Accessor', function() {
return new Value($1, [].concat($2));
return Value.wrap($1, [].concat($2));
}), o('ThisProperty')

@@ -165,5 +176,5 @@ ],

o('SimpleAssignable'), o('Array', function() {
return new Value($1);
return Value.wrap($1);
}), o('Object', function() {
return new Value($1);
return Value.wrap($1);
})

@@ -173,7 +184,7 @@ ],

o('Assignable'), o('Literal', function() {
return new Value($1);
return Value.wrap($1);
}), o('Parenthetical', function() {
return new Value($1);
return Value.wrap($1);
}), o('Range', function() {
return new Value($1);
return Value.wrap($1);
}), o('This')

@@ -187,3 +198,3 @@ ],

}), o(':: Identifier', function() {
return [new Access(new Literal('prototype')), new Access($2)];
return [LOC(1)(new Access(new Literal('prototype'))), LOC(2)(new Access($2))];
}), o('::', function() {

@@ -273,5 +284,5 @@ return new Access(new Literal('prototype'));

o('THIS', function() {
return new Value(new Literal('this'));
return Value.wrap(new Literal('this'));
}), o('@', function() {
return new Value(new Literal('this'));
return Value.wrap(new Literal('this'));
})

@@ -281,3 +292,3 @@ ],

o('@ Identifier', function() {
return new Value(new Literal('this'), [new Access($2)], 'this');
return Value.wrap(LOC(1)(new Literal('this')), [LOC(2)(new Access($2))], 'this');
})

@@ -348,2 +359,4 @@ ],

return [$2, $3];
}), o('CATCH Object Block', function() {
return [LOC(2)(Value.wrap($2)), $3];
})

@@ -385,5 +398,5 @@ ],

}), o('Statement WhileSource', function() {
return $2.addBody(Block.wrap([$1]));
return $2.addBody(LOC(1)(Block.wrap([$1])));
}), o('Expression WhileSource', function() {
return $2.addBody(Block.wrap([$1]));
return $2.addBody(LOC(1)(Block.wrap([$1])));
}), o('Loop', function() {

@@ -395,5 +408,5 @@ return $1;

o('LOOP Block', function() {
return new While(new Literal('true')).addBody($2);
return new While(LOC(1)(new Literal('true'))).addBody($2);
}), o('LOOP Expression', function() {
return new While(new Literal('true')).addBody(Block.wrap([$2]));
return new While(LOC(1)(new Literal('true'))).addBody(LOC(2)(Block.wrap([$2])));
})

@@ -413,3 +426,3 @@ ],

return {
source: new Value($2)
source: LOC(2)(Value.wrap($2))
};

@@ -433,5 +446,5 @@ }), o('ForStart ForSource', function() {

o('Identifier'), o('ThisProperty'), o('Array', function() {
return new Value($1);
return Value.wrap($1);
}), o('Object', function() {
return new Value($1);
return Value.wrap($1);
})

@@ -524,3 +537,3 @@ ],

}), o('Statement POST_IF Expression', function() {
return new If($3, Block.wrap([$1]), {
return new If($3, LOC(1)(Block.wrap([$1])), {
type: $2,

@@ -530,3 +543,3 @@ statement: true

}), o('Expression POST_IF Expression', function() {
return new If($3, Block.wrap([$1]), {
return new If($3, LOC(1)(Block.wrap([$1])), {
type: $2,

@@ -539,38 +552,38 @@ statement: true

o('UNARY Expression', function() {
return new Op($1, $2);
return Op.create($1, $2);
}), o('- Expression', (function() {
return new Op('-', $2);
return Op.create('-', $2);
}), {
prec: 'UNARY'
}), o('+ Expression', (function() {
return new Op('+', $2);
return Op.create('+', $2);
}), {
prec: 'UNARY'
}), o('-- SimpleAssignable', function() {
return new Op('--', $2);
return Op.create('--', $2);
}), o('++ SimpleAssignable', function() {
return new Op('++', $2);
return Op.create('++', $2);
}), o('SimpleAssignable --', function() {
return new Op('--', $1, null, true);
return Op.create('--', $1, null, true);
}), o('SimpleAssignable ++', function() {
return new Op('++', $1, null, true);
return Op.create('++', $1, null, true);
}), o('Expression ?', function() {
return new Existence($1);
}), o('Expression + Expression', function() {
return new Op('+', $1, $3);
return Op.create('+', $1, $3);
}), o('Expression - Expression', function() {
return new Op('-', $1, $3);
return Op.create('-', $1, $3);
}), o('Expression MATH Expression', function() {
return new Op($2, $1, $3);
return Op.create($2, $1, $3);
}), o('Expression SHIFT Expression', function() {
return new Op($2, $1, $3);
return Op.create($2, $1, $3);
}), o('Expression COMPARE Expression', function() {
return new Op($2, $1, $3);
return Op.create($2, $1, $3);
}), o('Expression LOGIC Expression', function() {
return new Op($2, $1, $3);
return Op.create($2, $1, $3);
}), o('Expression RELATION Expression', function() {
if ($2.charAt(0) === '!') {
return new Op($2.slice(1), $1, $3).invert();
return Op.create($2.slice(1), $1, $3).invert();
} else {
return new Op($2, $1, $3);
return Op.create($2, $1, $3);
}

@@ -583,2 +596,5 @@ }), o('SimpleAssignable COMPOUND_ASSIGN\

return new Assign($1, $4, $2);
}), o('SimpleAssignable COMPOUND_ASSIGN TERMINATOR\
Expression', function() {
return new Assign($1, $4, $2);
}), o('SimpleAssignable EXTENDS Expression', function() {

@@ -585,0 +601,0 @@ return new Extends($1, $3);

@@ -1,4 +0,4 @@

// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.5.0
(function() {
var extend, flatten, _ref;
var buildLocationData, extend, flatten, _ref;

@@ -88,2 +88,38 @@ exports.starts = function(string, literal, start) {

buildLocationData = function(first, last) {
if (!last) {
return first;
} else {
return {
first_line: first.first_line,
first_column: first.first_column,
last_line: last.last_line,
last_column: last.last_column
};
}
};
exports.addLocationDataFn = function(first, last) {
return function(obj) {
if (((typeof obj) === 'object') && (!!obj['updateLocationDataIfMissing'])) {
obj.updateLocationDataIfMissing(buildLocationData(first, last));
}
return obj;
};
};
exports.locationDataToString = function(obj) {
var locationData;
if (("2" in obj) && ("first_line" in obj[2])) {
locationData = obj[2];
} else if ("first_line" in obj) {
locationData = obj;
}
if (locationData) {
return ("" + (locationData.first_line + 1) + ":" + (locationData.first_column + 1) + "-") + ("" + (locationData.last_line + 1) + ":" + (locationData.last_column + 1));
} else {
return "No location data";
}
};
}).call(this);

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.5.0
(function() {

@@ -3,0 +3,0 @@ var key, val, _ref;

@@ -1,4 +0,4 @@

// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.5.0
(function() {
var 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, key, last, starts, _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, LITERATE, 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, key, last, locationDataToString, starts, _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; };

@@ -8,3 +8,3 @@

_ref1 = require('./helpers'), count = _ref1.count, starts = _ref1.starts, compact = _ref1.compact, last = _ref1.last;
_ref1 = require('./helpers'), count = _ref1.count, starts = _ref1.starts, compact = _ref1.compact, last = _ref1.last, locationDataToString = _ref1.locationDataToString;

@@ -16,12 +16,8 @@ exports.Lexer = Lexer = (function() {

Lexer.prototype.tokenize = function(code, opts) {
var i, tag;
var consumed, i, tag, _ref2;
if (opts == null) {
opts = {};
}
if (WHITESPACE.test(code)) {
code = "\n" + code;
}
code = code.replace(/\r/g, '').replace(TRAILING_SPACES, '');
this.code = code;
this.line = opts.line || 0;
this.literate = opts.literate;
code = this.clean(code);
this.indent = 0;

@@ -33,5 +29,9 @@ this.indebt = 0;

this.tokens = [];
this.chunkLine = opts.line || 0;
this.chunkColumn = opts.column || 0;
i = 0;
while (this.chunk = code.slice(i)) {
i += this.identifierToken() || this.commentToken() || this.whitespaceToken() || this.lineToken() || this.heredocToken() || this.stringToken() || this.numberToken() || this.regexToken() || this.jsToken() || this.literalToken();
consumed = this.identifierToken() || this.commentToken() || this.whitespaceToken() || this.lineToken() || this.heredocToken() || this.stringToken() || this.numberToken() || this.regexToken() || this.jsToken() || this.literalToken();
_ref2 = this.getLineAndColumnFromChunk(consumed), this.chunkLine = _ref2[0], this.chunkColumn = _ref2[1];
i += consumed;
}

@@ -48,4 +48,33 @@ this.closeIndentation();

Lexer.prototype.clean = function(code) {
var line, lines, match;
if (code.charCodeAt(0) === BOM) {
code = code.slice(1);
}
if (WHITESPACE.test(code)) {
code = "\n" + code;
}
code = code.replace(/\r/g, '').replace(TRAILING_SPACES, '');
if (this.literate) {
lines = (function() {
var _i, _len, _ref2, _results;
_ref2 = code.split('\n');
_results = [];
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
line = _ref2[_i];
if (match = LITERATE.exec(line)) {
_results.push(line.slice(match[0].length));
} else {
_results.push('# ' + line);
}
}
return _results;
})();
code = lines.join('\n');
}
return code;
};
Lexer.prototype.identifierToken = function() {
var colon, forcedIdentifier, id, input, match, prev, tag, _ref2, _ref3;
var colon, colonOffset, forcedIdentifier, id, idLength, input, match, poppedToken, prev, tag, tagToken, _ref2, _ref3, _ref4;
if (!(match = IDENTIFIER.exec(this.chunk))) {

@@ -55,2 +84,4 @@ return 0;

input = match[0], id = match[1], colon = match[2];
idLength = id.length;
poppedToken = void 0;
if (id === 'own' && this.tag() === 'FOR') {

@@ -79,3 +110,3 @@ this.token('OWN', id);

if (this.value() === '!') {
this.tokens.pop();
poppedToken = this.tokens.pop();
id = '!' + id;

@@ -120,5 +151,9 @@ }

}
this.token(tag, id);
tagToken = this.token(tag, id, 0, idLength);
if (poppedToken) {
_ref4 = [poppedToken[2].first_line, poppedToken[2].first_column], tagToken[2].first_line = _ref4[0], tagToken[2].first_column = _ref4[1];
}
if (colon) {
this.token(':', ':');
colonOffset = input.lastIndexOf(':');
this.token(':', ':', colonOffset, colon.length);
}

@@ -150,3 +185,3 @@ return input.length;

}
this.token('NUMBER', number);
this.token('NUMBER', number, 0, lexedLength);
return lexedLength;

@@ -162,3 +197,4 @@ };

}
this.token('STRING', (string = match[0]).replace(MULTILINER, '\\\n'));
string = match[0];
this.token('STRING', string.replace(MULTILINER, '\\\n'), 0, string.length);
break;

@@ -170,5 +206,8 @@ case '"':

if (0 < string.indexOf('#{', 1)) {
this.interpolateString(string.slice(1, -1));
this.interpolateString(string.slice(1, -1), {
strOffset: 1,
lexedLength: string.length
});
} else {
this.token('STRING', this.escapeLines(string));
this.token('STRING', this.escapeLines(string, 0, string.length));
}

@@ -182,3 +221,2 @@ break;

}
this.line += count(string, '\n');
return string.length;

@@ -200,8 +238,9 @@ };

this.interpolateString(doc, {
heredoc: true
heredoc: true,
strOffset: 3,
lexedLength: heredoc.length
});
} else {
this.token('STRING', this.makeString(doc, quote, true));
this.token('STRING', this.makeString(doc, quote, true), 0, heredoc.length);
}
this.line += count(heredoc, '\n');
return heredoc.length;

@@ -220,5 +259,4 @@ };

indent: Array(this.indent + 1).join(' ')
}));
}), 0, comment.length);
}
this.line += count(comment, '\n');
return comment.length;

@@ -232,4 +270,3 @@ };

}
this.token('JS', (script = match[0]).slice(1, -1));
this.line += count(script, '\n');
this.token('JS', (script = match[0]).slice(1, -1), 0, script.length);
return script.length;

@@ -245,3 +282,2 @@ };

length = this.heregexToken(match);
this.line += count(match[0], '\n');
return length;

@@ -263,3 +299,3 @@ }

}
this.token('REGEX', "" + regex + flags);
this.token('REGEX', "" + regex + flags, 0, match.length);
return match.length;

@@ -269,3 +305,3 @@ };

Lexer.prototype.heregexToken = function(match) {
var body, flags, heregex, re, tag, tokens, value, _i, _len, _ref2, _ref3, _ref4, _ref5;
var body, flags, flagsOffset, heregex, plusToken, prev, re, tag, token, tokens, value, _i, _len, _ref2, _ref3, _ref4;
heregex = match[0], body = match[1], flags = match[2];

@@ -277,7 +313,7 @@ if (0 > body.indexOf('#{')) {

}
this.token('REGEX', "/" + (re || '(?:)') + "/" + flags);
this.token('REGEX', "/" + (re || '(?:)') + "/" + flags, 0, heregex.length);
return heregex.length;
}
this.token('IDENTIFIER', 'RegExp');
this.tokens.push(['CALL_START', '(']);
this.token('IDENTIFIER', 'RegExp', 0, 0);
this.token('CALL_START', '(', 0, 0);
tokens = [];

@@ -288,6 +324,7 @@ _ref2 = this.interpolateString(body, {

for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
_ref3 = _ref2[_i], tag = _ref3[0], value = _ref3[1];
token = _ref2[_i];
tag = token[0], value = token[1];
if (tag === 'TOKENS') {
tokens.push.apply(tokens, value);
} else {
} else if (tag === 'NEOSTRING') {
if (!(value = value.replace(HEREGEX_OMIT, ''))) {

@@ -297,15 +334,25 @@ continue;

value = value.replace(/\\/g, '\\\\');
tokens.push(['STRING', this.makeString(value, '"', true)]);
token[0] = 'STRING';
token[1] = this.makeString(value, '"', true);
tokens.push(token);
} else {
this.error("Unexpected " + tag);
}
tokens.push(['+', '+']);
prev = last(this.tokens);
plusToken = ['+', '+'];
plusToken[2] = prev[2];
tokens.push(plusToken);
}
tokens.pop();
if (((_ref4 = tokens[0]) != null ? _ref4[0] : void 0) !== 'STRING') {
this.tokens.push(['STRING', '""'], ['+', '+']);
if (((_ref3 = tokens[0]) != null ? _ref3[0] : void 0) !== 'STRING') {
this.token('STRING', '""', 0, 0);
this.token('+', '+', 0, 0);
}
(_ref5 = this.tokens).push.apply(_ref5, tokens);
(_ref4 = this.tokens).push.apply(_ref4, tokens);
if (flags) {
this.tokens.push([',', ','], ['STRING', '"' + flags + '"']);
flagsOffset = heregex.lastIndexOf(flags);
this.token(',', ',', flagsOffset, 0);
this.token('STRING', '"' + flags + '"', flagsOffset, flags.length);
}
this.token(')', ')');
this.token(')', ')', heregex.length - 1, 0);
return heregex.length;

@@ -320,3 +367,2 @@ };

indent = match[0];
this.line += count(indent, '\n');
this.seenFor = false;

@@ -329,3 +375,3 @@ size = indent.length - 1 - indent.lastIndexOf('\n');

} else {
this.newlineToken();
this.newlineToken(0);
}

@@ -341,3 +387,3 @@ return indent.length;

diff = size - this.indent + this.outdebt;
this.token('INDENT', diff);
this.token('INDENT', diff, 0, indent.length);
this.indents.push(diff);

@@ -348,3 +394,3 @@ this.ends.push('OUTDENT');

this.indebt = 0;
this.outdentToken(this.indent - size, noNewlines);
this.outdentToken(this.indent - size, noNewlines, indent.length);
}

@@ -355,3 +401,3 @@ this.indent = size;

Lexer.prototype.outdentToken = function(moveOut, noNewlines) {
Lexer.prototype.outdentToken = function(moveOut, noNewlines, outdentLength) {
var dent, len;

@@ -369,7 +415,7 @@ while (moveOut > 0) {

} else {
dent = this.indents.pop() - this.outdebt;
dent = this.indents.pop() + this.outdebt;
moveOut -= dent;
this.outdebt = 0;
this.pair('OUTDENT');
this.token('OUTDENT', dent);
this.token('OUTDENT', dent, 0, outdentLength);
}

@@ -384,3 +430,3 @@ }

if (!(this.tag() === 'TERMINATOR' || noNewlines)) {
this.token('TERMINATOR', '\n');
this.token('TERMINATOR', '\n', outdentLength, 0);
}

@@ -406,3 +452,3 @@ return this;

Lexer.prototype.newlineToken = function() {
Lexer.prototype.newlineToken = function(offset) {
while (this.value() === ';') {

@@ -412,3 +458,3 @@ this.tokens.pop();

if (this.tag() !== 'TERMINATOR') {
this.token('TERMINATOR', '\n');
this.token('TERMINATOR', '\n', offset, 0);
}

@@ -498,3 +544,3 @@ return this;

}
if (doc.indexOf('\n') <= 0) {
if (doc.indexOf('\n') < 0) {
return doc;

@@ -588,7 +634,14 @@ }

Lexer.prototype.interpolateString = function(str, options) {
var expr, heredoc, i, inner, interpolated, len, letter, nested, pi, regex, tag, tokens, value, _i, _len, _ref2, _ref3, _ref4;
var column, expr, heredoc, i, inner, interpolated, len, letter, lexedLength, line, locationToken, nested, offsetInChunk, pi, plusToken, popped, regex, strOffset, tag, token, tokens, value, _i, _len, _ref2, _ref3, _ref4;
if (options == null) {
options = {};
}
heredoc = options.heredoc, regex = options.regex;
heredoc = options.heredoc, regex = options.regex, offsetInChunk = options.offsetInChunk, strOffset = options.strOffset, lexedLength = options.lexedLength;
offsetInChunk = offsetInChunk || 0;
strOffset = strOffset || 0;
lexedLength = lexedLength || str.length;
if (heredoc && str.length > 0 && str[0] === '\n') {
str = str.slice(1);
strOffset++;
}
tokens = [];

@@ -606,18 +659,20 @@ pi = 0;

if (pi < i) {
tokens.push(['NEOSTRING', str.slice(pi, i)]);
tokens.push(this.makeToken('NEOSTRING', str.slice(pi, i), strOffset + pi));
}
inner = expr.slice(1, -1);
if (inner.length) {
_ref2 = this.getLineAndColumnFromChunk(strOffset + i + 1), line = _ref2[0], column = _ref2[1];
nested = new Lexer().tokenize(inner, {
line: this.line,
line: line,
column: column,
rewrite: false
});
nested.pop();
if (((_ref2 = nested[0]) != null ? _ref2[0] : void 0) === 'TERMINATOR') {
nested.shift();
popped = nested.pop();
if (((_ref3 = nested[0]) != null ? _ref3[0] : void 0) === 'TERMINATOR') {
popped = nested.shift();
}
if (len = nested.length) {
if (len > 1) {
nested.unshift(['(', '(', this.line]);
nested.push([')', ')', this.line]);
nested.unshift(this.makeToken('(', '(', strOffset + i + 1, 0));
nested.push(this.makeToken(')', ')', strOffset + i + 1 + inner.length, 0));
}

@@ -631,3 +686,3 @@ tokens.push(['TOKENS', nested]);

if ((i > pi && pi < str.length)) {
tokens.push(['NEOSTRING', str.slice(pi)]);
tokens.push(this.makeToken('NEOSTRING', str.slice(pi), strOffset + pi));
}

@@ -638,23 +693,37 @@ if (regex) {

if (!tokens.length) {
return this.token('STRING', '""');
return this.token('STRING', '""', offsetInChunk, lexedLength);
}
if (tokens[0][0] !== 'NEOSTRING') {
tokens.unshift(['', '']);
tokens.unshift(this.makeToken('NEOSTRING', '', offsetInChunk));
}
if (interpolated = tokens.length > 1) {
this.token('(', '(');
this.token('(', '(', offsetInChunk, 0);
}
for (i = _i = 0, _len = tokens.length; _i < _len; i = ++_i) {
_ref3 = tokens[i], tag = _ref3[0], value = _ref3[1];
token = tokens[i];
tag = token[0], value = token[1];
if (i) {
this.token('+', '+');
if (i) {
plusToken = this.token('+', '+');
}
locationToken = tag === 'TOKENS' ? value[0] : token;
plusToken[2] = {
first_line: locationToken[2].first_line,
first_column: locationToken[2].first_column,
last_line: locationToken[2].first_line,
last_column: locationToken[2].first_column
};
}
if (tag === 'TOKENS') {
(_ref4 = this.tokens).push.apply(_ref4, value);
} else if (tag === 'NEOSTRING') {
token[0] = 'STRING';
token[1] = this.makeString(value, '"', heredoc);
this.tokens.push(token);
} else {
this.token('STRING', this.makeString(value, '"', heredoc));
this.error("Unexpected " + tag);
}
}
if (interpolated) {
this.token(')', ')');
this.token(')', ')', offsetInChunk + lexedLength, 0);
}

@@ -677,6 +746,44 @@ return tokens;

Lexer.prototype.token = function(tag, value) {
return this.tokens.push([tag, value, this.line]);
Lexer.prototype.getLineAndColumnFromChunk = function(offset) {
var column, lineCount, lines, string;
if (offset === 0) {
return [this.chunkLine, this.chunkColumn];
}
if (offset >= this.chunk.length) {
string = this.chunk;
} else {
string = this.chunk.slice(0, +(offset - 1) + 1 || 9e9);
}
lineCount = count(string, '\n');
column = this.chunkColumn;
if (lineCount > 0) {
lines = string.split('\n');
column = (last(lines)).length;
} else {
column += string.length;
}
return [this.chunkLine + lineCount, column];
};
Lexer.prototype.makeToken = function(tag, value, offsetInChunk, length) {
var lastCharacter, locationData, token, _ref2, _ref3;
offsetInChunk = offsetInChunk || 0;
if (length === void 0) {
length = value.length;
}
locationData = {};
_ref2 = this.getLineAndColumnFromChunk(offsetInChunk), locationData.first_line = _ref2[0], locationData.first_column = _ref2[1];
lastCharacter = length > 0 ? length - 1 : 0;
_ref3 = this.getLineAndColumnFromChunk(offsetInChunk + (length - 1)), locationData.last_line = _ref3[0], locationData.last_column = _ref3[1];
token = [tag, value, locationData];
return token;
};
Lexer.prototype.token = function(tag, value, offsetInChunk, length) {
var token;
token = this.makeToken(tag, value, offsetInChunk, length);
this.tokens.push(token);
return token;
};
Lexer.prototype.tag = function(index, tag) {

@@ -717,3 +824,3 @@ var tok;

Lexer.prototype.error = function(message) {
throw SyntaxError("" + message + " on line " + (this.line + 1));
throw SyntaxError("" + message + " on line " + (this.chunkLine + 1));
};

@@ -762,2 +869,4 @@

BOM = 65279;
IDENTIFIER = /^([$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)([^\n\S]*:(?!:))?/;

@@ -773,4 +882,6 @@

COMMENT = /^###([^#][\s\S]*?)(?:###[^\n\S]*|(?:###)?$)|^(?:\s*#(?!##[^#]).*)+/;
COMMENT = /^###([^#][\s\S]*?)(?:###[^\n\S]*|(?:###)$)|^(?:\s*#(?!##[^#]).*)+/;
LITERATE = /^([ ]{4}|\t)/;
CODE = /^[-=]>/;

@@ -777,0 +888,0 @@

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.5.0
(function() {

@@ -3,0 +3,0 @@ var LONG_FLAG, MULTI_FLAG, OPTIONAL, OptionParser, SHORT_FLAG, buildRule, buildRules, normalizeArguments;

@@ -1,276 +0,104 @@

// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.5.0
(function() {
var ACCESSOR, CoffeeScript, Module, REPL_PROMPT, REPL_PROMPT_CONTINUATION, REPL_PROMPT_MULTILINE, SIMPLEVAR, Script, autocomplete, backlog, completeAttribute, completeVariable, enableColours, error, getCompletions, inspect, multilineMode, pipedInput, readline, repl, run, stdin, stdout,
__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; };
var CoffeeScript, addMultilineHandler, merge, nodeREPL, replDefaults, vm;
stdin = process.openStdin();
vm = require('vm');
stdout = process.stdout;
nodeREPL = require('repl');
CoffeeScript = require('./coffee-script');
readline = require('readline');
merge = require('./helpers').merge;
inspect = require('util').inspect;
Script = require('vm').Script;
Module = require('module');
REPL_PROMPT = 'coffee> ';
REPL_PROMPT_MULTILINE = '------> ';
REPL_PROMPT_CONTINUATION = '......> ';
enableColours = false;
if (process.platform !== 'win32') {
enableColours = !process.env.NODE_DISABLE_COLORS;
}
error = function(err) {
return stdout.write((err.stack || err.toString()) + '\n');
replDefaults = {
prompt: 'coffee> ',
"eval": function(input, context, filename, cb) {
var js;
input = input.replace(/\uFF00/g, '\n');
input = input.replace(/(^|[\r\n]+)(\s*)##?(?:[^#\r\n][^\r\n]*|)($|[\r\n])/, '$1$2$3');
if (/^\s*$/.test(input)) {
return cb(null);
}
try {
js = CoffeeScript.compile("_=(" + input + "\n)", {
filename: filename,
bare: true
});
} catch (err) {
cb(err);
}
return cb(null, vm.runInContext(js, context, filename));
}
};
ACCESSOR = /\s*([\w\.]+)(?:\.(\w*))$/;
SIMPLEVAR = /(\w+)$/i;
autocomplete = function(text) {
return completeAttribute(text) || completeVariable(text) || [[], text];
};
completeAttribute = function(text) {
var all, candidates, completions, key, match, obj, prefix, _i, _len, _ref;
if (match = text.match(ACCESSOR)) {
all = match[0], obj = match[1], prefix = match[2];
try {
obj = Script.runInThisContext(obj);
} catch (e) {
return;
addMultilineHandler = function(repl) {
var inputStream, multiline, nodeLineListener, outputStream, rli;
rli = repl.rli, inputStream = repl.inputStream, outputStream = repl.outputStream;
multiline = {
enabled: false,
initialPrompt: repl.prompt.replace(/^[^> ]*/, function(x) {
return x.replace(/./g, '-');
}),
prompt: repl.prompt.replace(/^[^> ]*>?/, function(x) {
return x.replace(/./g, '.');
}),
buffer: ''
};
nodeLineListener = rli.listeners('line')[0];
rli.removeListener('line', nodeLineListener);
rli.on('line', function(cmd) {
if (multiline.enabled) {
multiline.buffer += "" + cmd + "\n";
rli.setPrompt(multiline.prompt);
rli.prompt(true);
} else {
nodeLineListener(cmd);
}
if (obj == null) {
});
return inputStream.on('keypress', function(char, key) {
if (!(key && key.ctrl && !key.meta && !key.shift && key.name === 'v')) {
return;
}
obj = Object(obj);
candidates = Object.getOwnPropertyNames(obj);
while (obj = Object.getPrototypeOf(obj)) {
_ref = Object.getOwnPropertyNames(obj);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
key = _ref[_i];
if (__indexOf.call(candidates, key) < 0) {
candidates.push(key);
}
if (multiline.enabled) {
if (!multiline.buffer.match(/\n/)) {
multiline.enabled = !multiline.enabled;
rli.setPrompt(repl.prompt);
rli.prompt(true);
return;
}
}
completions = getCompletions(prefix, candidates);
return [completions, prefix];
}
};
completeVariable = function(text) {
var candidates, completions, free, key, keywords, r, vars, _i, _len, _ref;
free = (_ref = text.match(SIMPLEVAR)) != null ? _ref[1] : void 0;
if (text === "") {
free = "";
}
if (free != null) {
vars = Script.runInThisContext('Object.getOwnPropertyNames(Object(this))');
keywords = (function() {
var _i, _len, _ref1, _results;
_ref1 = CoffeeScript.RESERVED;
_results = [];
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
r = _ref1[_i];
if (r.slice(0, 2) !== '__') {
_results.push(r);
}
if ((rli.line != null) && !rli.line.match(/^\s*$/)) {
return;
}
return _results;
})();
candidates = vars;
for (_i = 0, _len = keywords.length; _i < _len; _i++) {
key = keywords[_i];
if (__indexOf.call(candidates, key) < 0) {
candidates.push(key);
}
multiline.enabled = !multiline.enabled;
rli.line = '';
rli.cursor = 0;
rli.output.cursorTo(0);
rli.output.clearLine(1);
multiline.buffer = multiline.buffer.replace(/\n/g, '\uFF00');
rli.emit('line', multiline.buffer);
multiline.buffer = '';
} else {
multiline.enabled = !multiline.enabled;
rli.setPrompt(multiline.initialPrompt);
rli.prompt(true);
}
completions = getCompletions(free, candidates);
return [completions, free];
}
});
};
getCompletions = function(prefix, candidates) {
var el, _i, _len, _results;
_results = [];
for (_i = 0, _len = candidates.length; _i < _len; _i++) {
el = candidates[_i];
if (0 === el.indexOf(prefix)) {
_results.push(el);
module.exports = {
start: function(opts) {
var repl;
if (opts == null) {
opts = {};
}
}
return _results;
};
process.on('uncaughtException', error);
backlog = '';
run = function(buffer) {
var code, returnValue, _;
buffer = buffer.replace(/(^|[\r\n]+)(\s*)##?(?:[^#\r\n][^\r\n]*|)($|[\r\n])/, "$1$2$3");
buffer = buffer.replace(/[\r\n]+$/, "");
if (multilineMode) {
backlog += "" + buffer + "\n";
repl.setPrompt(REPL_PROMPT_CONTINUATION);
repl.prompt();
return;
}
if (!buffer.toString().trim() && !backlog) {
repl.prompt();
return;
}
code = backlog += buffer;
if (code[code.length - 1] === '\\') {
backlog = "" + backlog.slice(0, -1) + "\n";
repl.setPrompt(REPL_PROMPT_CONTINUATION);
repl.prompt();
return;
}
repl.setPrompt(REPL_PROMPT);
backlog = '';
try {
_ = global._;
returnValue = CoffeeScript["eval"]("_=(" + code + "\n)", {
filename: 'repl',
modulename: 'repl'
opts = merge(replDefaults, opts);
repl = nodeREPL.start(opts);
repl.on('exit', function() {
return repl.outputStream.write('\n');
});
if (returnValue === void 0) {
global._ = _;
}
repl.output.write("" + (inspect(returnValue, false, 2, enableColours)) + "\n");
} catch (err) {
error(err);
addMultilineHandler(repl);
return repl;
}
return repl.prompt();
};
if (stdin.readable && stdin.isRaw) {
pipedInput = '';
repl = {
prompt: function() {
return stdout.write(this._prompt);
},
setPrompt: function(p) {
return this._prompt = p;
},
input: stdin,
output: stdout,
on: function() {}
};
stdin.on('data', function(chunk) {
var line, lines, _i, _len, _ref;
pipedInput += chunk;
if (!/\n/.test(pipedInput)) {
return;
}
lines = pipedInput.split("\n");
pipedInput = lines[lines.length - 1];
_ref = lines.slice(0, -1);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
line = _ref[_i];
if (!(line)) {
continue;
}
stdout.write("" + line + "\n");
run(line);
}
});
stdin.on('end', function() {
var line, _i, _len, _ref;
_ref = pipedInput.trim().split("\n");
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
line = _ref[_i];
if (!(line)) {
continue;
}
stdout.write("" + line + "\n");
run(line);
}
stdout.write('\n');
return process.exit(0);
});
} else {
if (readline.createInterface.length < 3) {
repl = readline.createInterface(stdin, autocomplete);
stdin.on('data', function(buffer) {
return repl.write(buffer);
});
} else {
repl = readline.createInterface(stdin, stdout, autocomplete);
}
}
multilineMode = false;
repl.input.on('keypress', function(char, key) {
var cursorPos, newPrompt;
if (!(key && key.ctrl && !key.meta && !key.shift && key.name === 'v')) {
return;
}
cursorPos = repl.cursor;
repl.output.cursorTo(0);
repl.output.clearLine(1);
multilineMode = !multilineMode;
if (!multilineMode && backlog) {
repl._line();
}
backlog = '';
repl.setPrompt((newPrompt = multilineMode ? REPL_PROMPT_MULTILINE : REPL_PROMPT));
repl.prompt();
return repl.output.cursorTo(newPrompt.length + (repl.cursor = cursorPos));
});
repl.input.on('keypress', function(char, key) {
if (!(multilineMode && repl.line)) {
return;
}
if (!(key && key.ctrl && !key.meta && !key.shift && key.name === 'd')) {
return;
}
multilineMode = false;
return repl._line();
});
repl.on('attemptClose', function() {
if (multilineMode) {
multilineMode = false;
repl.output.cursorTo(0);
repl.output.clearLine(1);
repl._onLine(repl.line);
return;
}
if (backlog || repl.line) {
backlog = '';
repl.historyIndex = -1;
repl.setPrompt(REPL_PROMPT);
repl.output.write('\n(^C again to quit)');
return repl._line((repl.line = ''));
} else {
return repl.close();
}
});
repl.on('close', function() {
repl.output.write('\n');
return repl.input.destroy();
});
repl.on('line', run);
repl.setPrompt(REPL_PROMPT);
repl.prompt();
}).call(this);

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.5.0
(function() {

@@ -21,2 +21,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, left, rite, _i, _len, _ref,

this.addImplicitParentheses();
this.addLocationDataToGeneratedTokens();
return this.tokens;

@@ -137,3 +138,3 @@ };

var tok;
tok = this.generate('}', '}', token[2]);
tok = this.generate('}', '}');
return this.tokens.splice(i, 0, tok);

@@ -165,3 +166,3 @@ };

value.generated = true;
tok = this.generate('{', value, token[2]);
tok = this.generate('{', value);
tokens.splice(idx, 0, tok);

@@ -174,4 +175,5 @@ this.detectEnd(i + 2, condition, action);

Rewriter.prototype.addImplicitParentheses = function() {
var action, condition, noCall, seenControl, seenSingle;
var action, callIndex, condition, noCall, seenControl, seenSingle;
noCall = seenSingle = seenControl = false;
callIndex = null;
condition = function(token, i) {

@@ -192,6 +194,6 @@ var post, tag, _ref, _ref1;

}
return !token.generated && this.tag(i - 1) !== ',' && (__indexOf.call(IMPLICIT_END, tag) >= 0 || (tag === 'INDENT' && !seenControl)) && (tag !== 'INDENT' || (((_ref = this.tag(i - 2)) !== 'CLASS' && _ref !== 'EXTENDS') && (_ref1 = this.tag(i - 1), __indexOf.call(IMPLICIT_BLOCK, _ref1) < 0) && !((post = this.tokens[i + 1]) && post.generated && post[0] === '{')));
return !token.generated && this.tag(i - 1) !== ',' && (__indexOf.call(IMPLICIT_END, tag) >= 0 || (tag === 'INDENT' && !seenControl)) && (tag !== 'INDENT' || (((_ref = this.tag(i - 2)) !== 'CLASS' && _ref !== 'EXTENDS') && (_ref1 = this.tag(i - 1), __indexOf.call(IMPLICIT_BLOCK, _ref1) < 0) && !(callIndex === i - 1 && (post = this.tokens[i + 1]) && post.generated && post[0] === '{')));
};
action = function(token, i) {
return this.tokens.splice(i, 0, this.generate('CALL_END', ')', token[2]));
return this.tokens.splice(i, 0, this.generate('CALL_END', ')'));
};

@@ -220,2 +222,3 @@ return this.scanTokens(function(token, i, tokens) {

}
callIndex = i;
tokens.splice(i, 0, this.generate('CALL_START', '(', token[2]));

@@ -230,2 +233,28 @@ this.detectEnd(i + 1, condition, action);

Rewriter.prototype.addLocationDataToGeneratedTokens = function() {
return this.scanTokens(function(token, i, tokens) {
var prevToken, tag;
tag = token[0];
if ((token.generated || token.explicit) && (!token[2])) {
if (i > 0) {
prevToken = tokens[i - 1];
token[2] = {
first_line: prevToken[2].last_line,
first_column: prevToken[2].last_column,
last_line: prevToken[2].last_line,
last_column: prevToken[2].last_column
};
} else {
token[2] = {
first_line: 0,
first_column: 0,
last_line: 0,
last_column: 0
};
}
}
return 1;
});
};
Rewriter.prototype.addImplicitIndentation = function() {

@@ -300,13 +329,16 @@ var action, condition, indent, outdent, starter;

}
indent = ['INDENT', 2, token[2]];
outdent = ['OUTDENT', 2, token[2]];
indent = ['INDENT', 2];
outdent = ['OUTDENT', 2];
if (implicit) {
indent.generated = outdent.generated = true;
}
if (!implicit) {
indent.explicit = outdent.explicit = true;
}
return [indent, outdent];
};
Rewriter.prototype.generate = function(tag, value, line) {
Rewriter.prototype.generate = function(tag, value) {
var tok;
tok = [tag, value, line];
tok = [tag, value];
tok.generated = true;

@@ -313,0 +345,0 @@ return tok;

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.5.0
(function() {

@@ -3,0 +3,0 @@ var Scope, extend, last, _ref;

@@ -6,3 +6,3 @@ {

"author": "Jeremy Ashkenas",
"version": "1.4.0",
"version": "1.5.0",
"licenses": [{

@@ -33,5 +33,5 @@ "type": "MIT",

"devDependencies": {
"uglify-js": ">=1.0.0",
"uglify-js": "~2.2",
"jison": ">=0.2.0"
}
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc