coffee-script-redux
Advanced tools
Comparing version 2.0.0-beta5 to 2.0.0-beta6
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.0-beta4 | ||
// Generated by CoffeeScript 2.0.0-beta6 | ||
var CoffeeScript, runScripts; | ||
@@ -3,0 +3,0 @@ module.exports = CoffeeScript = require('./module'); |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.0-beta4 | ||
// Generated by CoffeeScript 2.0.0-beta6 | ||
var $0, $0, additionalArgs, CoffeeScript, concat, cscodegen, escodegen, esmangle, foldl, fs, humanReadable, input, input, inputName, inputSource, inspect, Jedediah, numberLines, Optimiser, optionParser, options, output, path, pkg, positionalArgs, Preprocessor, processInput, Repl, runMain; | ||
@@ -46,2 +46,3 @@ fs = require('fs'); | ||
optionParser.addOption('debug', false, 'output intermediate representations on stderr for debug'); | ||
optionParser.addOption('literate', 'l', false, 'treat the input as literate CoffeeScript code'); | ||
optionParser.addOption('raw', false, 'preserve source position and raw parse information'); | ||
@@ -53,3 +54,3 @@ optionParser.addOption('version', 'v', false, 'display the version number'); | ||
optionParser.addParameter('nodejs', 'OPTS', 'pass options through to the node binary'); | ||
optionParser.addParameter('output', 'o', 'FILE', 'file to be used as output instead of STDIN'); | ||
optionParser.addParameter('output', 'o', 'FILE', 'file to be used as output instead of STDOUT'); | ||
optionParser.addParameter('watch', 'w', 'FILE', 'watch the given file/directory for changes'); | ||
@@ -138,3 +139,3 @@ if (null != escodegen) { | ||
processInput = function (err) { | ||
var cache$4, e, js, jsAST, result, sourceMap; | ||
var cache$4, e, js, jsAST, preprocessed, result, sourceMap; | ||
if (null != err) | ||
@@ -149,3 +150,4 @@ throw err; | ||
console.error('### PREPROCESSED CS ###'); | ||
console.error(numberLines(humanReadable(Preprocessor.processSync(input)))); | ||
preprocessed = Preprocessor.process(input, { literate: options.literate }); | ||
console.error(numberLines(humanReadable(preprocessed))); | ||
} catch (e$) { | ||
@@ -157,3 +159,4 @@ } | ||
raw: options.raw || options['source-map'] || options['source-map-file'] || options['eval'], | ||
inputSource: inputSource | ||
inputSource: inputSource, | ||
literate: options.literate | ||
}); | ||
@@ -160,0 +163,0 @@ } catch (e$1) { |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.0-beta4 | ||
// Generated by CoffeeScript 2.0.0-beta6 | ||
var concat, foldl, map, nub, span; | ||
@@ -3,0 +3,0 @@ this.any = function (list, fn) { |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.0-beta4 | ||
// Generated by CoffeeScript 2.0.0-beta6 | ||
var beingDeclared, cleanMarkers, concat, concatMap, CS, difference, envEnrichments, envEnrichments_, foldl, humanReadable, map, nub, numberLines, pointToErrorLocation, usedAsExpression, usedAsExpression_; | ||
@@ -3,0 +3,0 @@ cache$ = require('./functional-helpers'); |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.0-beta4 | ||
// Generated by CoffeeScript 2.0.0-beta6 | ||
var ArrayExpression, AssignmentExpression, BinaryExpression, BlockStatement, CallExpression, createNode, ctor, difference, exports, FunctionDeclaration, FunctionExpression, GenSym, handleLists, handlePrimitives, Identifier, isStatement, Literal, LogicalExpression, MemberExpression, NewExpression, node, nodeData, Nodes, ObjectExpression, params, Program, SequenceExpression, SwitchCase, SwitchStatement, TryStatement, UnaryExpression, UpdateExpression, VariableDeclaration, VariableDeclaration; | ||
@@ -3,0 +3,0 @@ difference = require('./functional-helpers').difference; |
@@ -1,3 +0,3 @@ | ||
// Generated by CoffeeScript 2.0.0-beta4 | ||
var CoffeeScript, Compiler, cscodegen, escodegen, escodegenCompactDefaults, escodegenFormatDefaults, formatParserError, Nodes, Optimiser, Parser, pkg, Preprocessor; | ||
// Generated by CoffeeScript 2.0.0-beta6 | ||
var CoffeeScript, Compiler, cscodegen, escodegen, escodegenFormat, formatParserError, Nodes, Optimiser, Parser, pkg, Preprocessor; | ||
formatParserError = require('./helpers').formatParserError; | ||
@@ -24,3 +24,3 @@ Nodes = require('./nodes'); | ||
pkg = require('./../package.json'); | ||
escodegenFormatDefaults = { | ||
escodegenFormat = { | ||
indent: { | ||
@@ -35,15 +35,2 @@ style: ' ', | ||
}; | ||
escodegenCompactDefaults = { | ||
indent: { | ||
style: '', | ||
base: 0 | ||
}, | ||
renumber: true, | ||
hexadecimal: true, | ||
quotes: 'auto', | ||
escapeless: true, | ||
compact: true, | ||
parentheses: false, | ||
semicolons: false | ||
}; | ||
CoffeeScript = { | ||
@@ -62,3 +49,3 @@ CoffeeScript: CoffeeScript, | ||
try { | ||
preprocessed = Preprocessor.processSync(coffee); | ||
preprocessed = Preprocessor.process(coffee, { literate: options.literate }); | ||
parsed = Parser.parse(preprocessed, { | ||
@@ -86,2 +73,3 @@ raw: options.raw, | ||
jsWithSourceMap: function (jsAst, name, options) { | ||
var targetName; | ||
if (null == name) | ||
@@ -95,2 +83,3 @@ name = 'unknown'; | ||
jsAst = jsAst.toBasicObject(); | ||
targetName = options['source-map-file'] || options['source-map'] && options.output.match(/^.*[\\\/]([^\\\/]+)$/)[1]; | ||
return escodegen.generate(jsAst, { | ||
@@ -100,3 +89,4 @@ comment: !options.compact, | ||
sourceMap: name, | ||
format: options.compact ? escodegenCompactDefaults : null != options.format ? options.format : escodegenFormatDefaults | ||
file: targetName || 'unknown', | ||
format: options.compact ? escodegen.FORMAT_MINIFY : null != options.format ? options.format : escodegenFormat | ||
}); | ||
@@ -124,5 +114,5 @@ }, | ||
module.exports = CoffeeScript; | ||
if (process.title === 'node') | ||
if (null != (null != require.extensions ? require.extensions['.node'] : void 0)) | ||
CoffeeScript.register = function () { | ||
return require('./register'); | ||
}; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.0-beta4 | ||
// Generated by CoffeeScript 2.0.0-beta6 | ||
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; | ||
@@ -3,0 +3,0 @@ cache$ = require('./functional-helpers'); |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.0-beta4 | ||
// Generated by CoffeeScript 2.0.0-beta6 | ||
var all, any, beingDeclared, concat, concatMap, CS, declarationsFor, difference, envEnrichments, exports, foldl, foldl1, isFalsey, isTruthy, makeDispatcher, mayHaveSideEffects, union, usedAsExpression; | ||
@@ -425,3 +425,3 @@ cache$ = require('./functional-helpers'); | ||
function (param$) { | ||
var ancestry, cache$2, canDropLast, decls, inScope; | ||
var ancestry, cache$2, canDropLast, inScope; | ||
{ | ||
@@ -433,3 +433,7 @@ cache$2 = param$; | ||
canDropLast = !usedAsExpression(this, ancestry); | ||
if (mayHaveSideEffects(this.left, inScope)) { | ||
if (this.left['instanceof'](CS.Undefined)) { | ||
return this.right; | ||
} else if (this.left['instanceof'](CS.Return, CS.Throw)) { | ||
return this.left; | ||
} else if (mayHaveSideEffects(this.left, inScope)) { | ||
if (mayHaveSideEffects(this.right, inScope)) { | ||
@@ -453,8 +457,3 @@ return this; | ||
} else if (mayHaveSideEffects(this.right, inScope)) { | ||
decls = declarationsFor(this.left, inScope); | ||
if (decls['instanceof'](CS.Undefined)) { | ||
return this.right; | ||
} else { | ||
return this; | ||
} | ||
return new CS.SeqOp(declarationsFor(this.left, inScope), this.right); | ||
} else if (canDropLast) { | ||
@@ -735,3 +734,3 @@ return declarationsFor(this, inScope); | ||
walk = function (fn, inScope, ancestry) { | ||
var childName, jsNode, member, n, p; | ||
var childName, member, n, p, replacementNode; | ||
if (null == inScope) | ||
@@ -741,6 +740,2 @@ inScope = []; | ||
ancestry = []; | ||
if (!(null != this) || this === global) | ||
throw new Error('Optimiser rules must produce a node. `null` is not a node.'); | ||
if (in$(this, ancestry)) | ||
return this; | ||
ancestry.unshift(this); | ||
@@ -772,16 +767,23 @@ for (var i$ = 0, length$ = this.childNodes.length; i$ < length$; ++i$) { | ||
ancestry.shift(); | ||
jsNode = fn.call(this, { | ||
replacementNode = fn.call(this, { | ||
inScope: inScope, | ||
ancestry: ancestry | ||
}); | ||
for (var cache$2 = [ | ||
'raw', | ||
'line', | ||
'column', | ||
'offset' | ||
], i$2 = 0, length$2 = cache$2.length; i$2 < length$2; ++i$2) { | ||
p = cache$2[i$2]; | ||
jsNode[p] = this[p]; | ||
if (this !== replacementNode) { | ||
while (replacementNode !== walk.call(replacementNode = fn.call(replacementNode, { | ||
inScope: inScope, | ||
ancestry: ancestry | ||
}), fn, inScope, ancestry)) { | ||
} | ||
for (var cache$2 = [ | ||
'raw', | ||
'line', | ||
'column', | ||
'offset' | ||
], i$2 = 0, length$2 = cache$2.length; i$2 < length$2; ++i$2) { | ||
p = cache$2[i$2]; | ||
replacementNode[p] = this[p]; | ||
} | ||
} | ||
return jsNode; | ||
return replacementNode; | ||
}; | ||
@@ -791,13 +793,15 @@ return function (ast) { | ||
rules = this.rules; | ||
return walk.call(ast, function () { | ||
var cache$3, memo, oldClassName, rule; | ||
return walk.call(ast, function (param$) { | ||
var ancestry, memo, rule; | ||
ancestry = param$.ancestry; | ||
if (!(null != this) || this === global) | ||
throw new Error('Optimiser rules must produce a node. `null` is not a node.'); | ||
if (in$(this, ancestry)) | ||
return this; | ||
memo = this; | ||
oldClassName = null; | ||
while (oldClassName !== memo.className) { | ||
for (var cache$2 = (cache$3 = rules[oldClassName = memo.className], null != cache$3 ? cache$3 : []), i$ = 0, length$ = cache$2.length; i$ < length$; ++i$) { | ||
rule = cache$2[i$]; | ||
memo = rule.apply(memo, arguments); | ||
if (!(oldClassName === memo.className)) | ||
break; | ||
} | ||
for (var cache$2 = null != rules[memo.className] ? rules[memo.className] : [], i$ = 0, length$ = cache$2.length; i$ < length$; ++i$) { | ||
rule = cache$2[i$]; | ||
memo = rule.apply(memo, arguments); | ||
if (memo !== this) | ||
break; | ||
} | ||
@@ -804,0 +808,0 @@ return memo; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.0-beta4 | ||
// Generated by CoffeeScript 2.0.0-beta6 | ||
var EventEmitter, pointToErrorLocation, Preprocessor, StringScanner; | ||
@@ -7,3 +7,3 @@ EventEmitter = require('events').EventEmitter; | ||
this.Preprocessor = Preprocessor = function (super$) { | ||
var DEDENT, INDENT, processInput, TERM, ws; | ||
var DEDENT, INDENT, TERM, ws; | ||
extends$(Preprocessor, super$); | ||
@@ -14,8 +14,16 @@ ws = '\\t\\x0B\\f\\r \\xA0\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000\\uFEFF'; | ||
TERM = '\uefff'; | ||
function Preprocessor() { | ||
function Preprocessor(param$) { | ||
this.options = param$; | ||
if (null == this.options) | ||
this.options = {}; | ||
this.preprocessed = ''; | ||
this.base = null; | ||
this.indents = []; | ||
this.context = []; | ||
this.ss = new StringScanner(''); | ||
} | ||
Preprocessor.process = function (input, options) { | ||
if (null == options) | ||
options = {}; | ||
return new Preprocessor(options).process(input); | ||
}; | ||
Preprocessor.prototype.err = function (c) { | ||
@@ -118,3 +126,3 @@ var columns, context, lines, token; | ||
if (null != s) | ||
this.emit('data', s); | ||
this.preprocessed = '' + this.preprocessed + s; | ||
return s; | ||
@@ -125,202 +133,183 @@ }; | ||
}; | ||
processInput = function (isEnd) { | ||
return function (data) { | ||
var context, indent, indentIndex, lastChar, lineLen, lines, message, nonIdentifierBefore, pos, spaceBefore, tok; | ||
if (!isEnd) | ||
this.ss.concat(data); | ||
while (!this.ss.eos()) { | ||
switch (this.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 + ']*')) + ''); | ||
Preprocessor.prototype.process = function (input) { | ||
var context, indent, indentIndex, lastChar, lineLen, lines, message, nonIdentifierBefore, pos, spaceBefore, tok; | ||
if (this.options.literate) | ||
input = input.replace(/^( {0,3}\S)/gm, ' #$1'); | ||
this.ss = new StringScanner(input); | ||
while (!this.ss.eos()) { | ||
switch (this.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 (null != this.base) { | ||
if (!(this.ss.eos() || null != this.scan(this.base))) { | ||
throw new Error('inconsistent base indentation'); | ||
} | ||
indentIndex = 0; | ||
while (indentIndex < this.indents.length) { | ||
indent = this.indents[indentIndex]; | ||
if (this.ss.check(new RegExp('' + indent + ''))) { | ||
this.scan(new RegExp('' + indent + '')); | ||
} else if (this.ss.check(new RegExp('[^' + ws + ']'))) { | ||
this.indents.splice(indentIndex, 1); | ||
--indentIndex; | ||
this.observe(DEDENT); | ||
this.p('' + DEDENT + TERM); | ||
} else { | ||
lines = this.ss.str.substr(0, this.ss.pos).split(/\n/) || ['']; | ||
message = 'Syntax error on line ' + lines.length + ': indention is ambiguous'; | ||
lineLen = this.indents.reduce(function (l, r) { | ||
return l + r.length; | ||
}, 0); | ||
context = pointToErrorLocation(this.ss.str, lines.length, lineLen); | ||
throw new Error('' + message + '\n' + context); | ||
} | ||
++indentIndex; | ||
} | ||
if (this.ss.check(new RegExp('[' + ws + ']+[^' + ws + '#]'))) { | ||
this.indents.push(this.scan(new RegExp('[' + ws + ']+'))); | ||
this.observe(INDENT); | ||
this.p(INDENT); | ||
} | ||
} else { | ||
this.base = new RegExp('' + this.scan(new RegExp('[' + ws + ']*')) + ''); | ||
} | ||
tok = function () { | ||
switch (this.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; | ||
} | ||
indentIndex = 0; | ||
while (indentIndex < this.indents.length) { | ||
indent = this.indents[indentIndex]; | ||
if (this.ss.check(new RegExp('' + indent + ''))) { | ||
this.scan(new RegExp('' + indent + '')); | ||
} else if (this.ss.eos() || this.ss.check(new RegExp('[^' + ws + ']'))) { | ||
this.indents.splice(indentIndex, 1); | ||
--indentIndex; | ||
this.observe(DEDENT); | ||
this.p('' + DEDENT + TERM); | ||
} else { | ||
lines = this.ss.str.substr(0, this.ss.pos).split(/\n/) || ['']; | ||
message = 'Syntax error on line ' + lines.length + ': indentation is ambiguous'; | ||
lineLen = this.indents.reduce(function (l, r) { | ||
return l + r.length; | ||
}, 0); | ||
context = pointToErrorLocation(this.ss.str, lines.length, lineLen); | ||
throw new Error('' + message + '\n' + context); | ||
} | ||
}.call(this); | ||
if (tok) { | ||
this.observe(tok); | ||
continue; | ||
++indentIndex; | ||
} | ||
if (tok = this.scan(/"""|'''|\/\/\/|###|["'`#[({\\]/)) { | ||
this.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.observe('/'); | ||
if (this.ss.check(new RegExp('[' + ws + ']+[^' + ws + '#]'))) { | ||
this.indents.push(this.scan(new RegExp('[' + ws + ']+'))); | ||
this.observe(INDENT); | ||
this.p(INDENT); | ||
} | ||
break; | ||
case '\\': | ||
if (this.scan(/[\s\S]/)) | ||
this.observe('end-\\'); | ||
break; | ||
case '"""': | ||
this.scan(/(?:[^"#\\]+|""?(?!")|#(?!{)|\\.)+/); | ||
this.ss.scan(/\\\n/); | ||
if (tok = this.scan(/#{|"""/)) { | ||
this.observe(tok); | ||
} else if (tok = this.scan(/#{|"""/)) { | ||
this.observe(tok); | ||
} | ||
break; | ||
case '"': | ||
this.scan(/(?:[^"#\\]+|#(?!{)|\\.)+/); | ||
this.ss.scan(/\\\n/); | ||
if (tok = this.scan(/#{|"/)) | ||
this.observe(tok); | ||
break; | ||
case "'''": | ||
this.scan(/(?:[^'\\]+|''?(?!')|\\.)+/); | ||
this.ss.scan(/\\\n/); | ||
if (tok = this.scan(/'''/)) | ||
this.observe(tok); | ||
break; | ||
case "'": | ||
this.scan(/(?:[^'\\]+|\\.)+/); | ||
this.ss.scan(/\\\n/); | ||
if (tok = this.scan(/'/)) | ||
this.observe(tok); | ||
break; | ||
case '###': | ||
this.scan(/(?:[^#]+|##?(?!#))+/); | ||
if (tok = this.scan(/###/)) | ||
this.observe(tok); | ||
break; | ||
case '#': | ||
this.scan(/[^\n]+/); | ||
if (tok = this.scan(/\n/)) | ||
this.observe(tok); | ||
break; | ||
case '`': | ||
this.scan(/[^`]+/); | ||
if (tok = this.scan(/`/)) | ||
this.observe(tok); | ||
break; | ||
case '///': | ||
this.scan(/(?:[^[/#\\]+|\/\/?(?!\/)|\\.)+/); | ||
if (tok = this.scan(/#{|\/\/\/|\\/)) { | ||
this.observe(tok); | ||
} else if (this.ss.scan(/#/)) { | ||
this.observe('heregexp-#'); | ||
} else if (tok = this.scan(/[\[]/)) { | ||
this.observe('heregexp-' + tok); | ||
} | ||
break; | ||
case 'heregexp-[': | ||
this.scan(/(?:[^\]\/\\]+|\/\/?(?!\/))+/); | ||
if (tok = this.scan(/[\]\\]|#{|\/\/\//)) | ||
this.observe(tok); | ||
break; | ||
case 'heregexp-#': | ||
this.ss.scan(/(?:[^\n/]+|\/\/?(?!\/))+/); | ||
if (tok = this.scan(/\n|\/\/\//)) | ||
this.observe(tok); | ||
break; | ||
case '/': | ||
this.scan(/[^[/\\]+/); | ||
if (tok = this.scan(/[\/\\]/)) { | ||
this.observe(tok); | ||
} else if (tok = this.scan(/\[/)) { | ||
this.observe('regexp-' + tok); | ||
} | ||
break; | ||
case 'regexp-[': | ||
this.scan(/[^\]\\]+/); | ||
if (tok = this.scan(/[\]\\]/)) | ||
this.observe(tok); | ||
} | ||
} | ||
if (isEnd) { | ||
this.scan(new RegExp('[' + ws + '\\n]*$')); | ||
while (this.context.length) { | ||
tok = function () { | ||
switch (this.peek()) { | ||
case INDENT: | ||
this.observe(DEDENT); | ||
this.p('' + DEDENT + TERM); | ||
break; | ||
case '#': | ||
this.observe('\n'); | ||
this.p('\n'); | ||
break; | ||
default: | ||
throw new Error('Unclosed "' + this.peek().replace(/"/g, '\\"') + '" at EOF'); | ||
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.observe(tok); | ||
continue; | ||
} | ||
this.emit('end'); | ||
return; | ||
if (tok = this.scan(/"""|'''|\/\/\/|###|["'`#[({\\]/)) { | ||
this.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.observe('/'); | ||
} | ||
break; | ||
case '\\': | ||
if (this.scan(/[\s\S]/)) | ||
this.observe('end-\\'); | ||
break; | ||
case '"""': | ||
this.scan(/(?:[^"#\\]+|""?(?!")|#(?!{)|\\.)+/); | ||
this.ss.scan(/\\\n/); | ||
if (tok = this.scan(/#{|"""/)) { | ||
this.observe(tok); | ||
} else if (tok = this.scan(/#{|"""/)) { | ||
this.observe(tok); | ||
} | ||
break; | ||
case '"': | ||
this.scan(/(?:[^"#\\]+|#(?!{)|\\.)+/); | ||
this.ss.scan(/\\\n/); | ||
if (tok = this.scan(/#{|"/)) | ||
this.observe(tok); | ||
break; | ||
case "'''": | ||
this.scan(/(?:[^'\\]+|''?(?!')|\\.)+/); | ||
this.ss.scan(/\\\n/); | ||
if (tok = this.scan(/'''/)) | ||
this.observe(tok); | ||
break; | ||
case "'": | ||
this.scan(/(?:[^'\\]+|\\.)+/); | ||
this.ss.scan(/\\\n/); | ||
if (tok = this.scan(/'/)) | ||
this.observe(tok); | ||
break; | ||
case '###': | ||
this.scan(/(?:[^#]+|##?(?!#))+/); | ||
if (tok = this.scan(/###/)) | ||
this.observe(tok); | ||
break; | ||
case '#': | ||
this.scan(/[^\n]+/); | ||
if (tok = this.scan(/\n/)) | ||
this.observe(tok); | ||
break; | ||
case '`': | ||
this.scan(/[^`]+/); | ||
if (tok = this.scan(/`/)) | ||
this.observe(tok); | ||
break; | ||
case '///': | ||
this.scan(/(?:[^[/#\\]+|\/\/?(?!\/)|\\.)+/); | ||
if (tok = this.scan(/#{|\/\/\/|\\/)) { | ||
this.observe(tok); | ||
} else if (this.ss.scan(/#/)) { | ||
this.observe('heregexp-#'); | ||
} else if (tok = this.scan(/[\[]/)) { | ||
this.observe('heregexp-' + tok); | ||
} | ||
break; | ||
case 'heregexp-[': | ||
this.scan(/(?:[^\]\/\\]+|\/\/?(?!\/))+/); | ||
if (tok = this.scan(/[\]\\]|#{|\/\/\//)) | ||
this.observe(tok); | ||
break; | ||
case 'heregexp-#': | ||
this.ss.scan(/(?:[^\n/]+|\/\/?(?!\/))+/); | ||
if (tok = this.scan(/\n|\/\/\//)) | ||
this.observe(tok); | ||
break; | ||
case '/': | ||
this.scan(/[^[/\\]+/); | ||
if (tok = this.scan(/[\/\\]/)) { | ||
this.observe(tok); | ||
} else if (tok = this.scan(/\[/)) { | ||
this.observe('regexp-' + tok); | ||
} | ||
break; | ||
case 'regexp-[': | ||
this.scan(/[^\]\\]+/); | ||
if (tok = this.scan(/[\]\\]/)) | ||
this.observe(tok); | ||
} | ||
}; | ||
} | ||
this.scan(new RegExp('[' + ws + '\\n]*$')); | ||
while (this.context.length) { | ||
switch (this.peek()) { | ||
case INDENT: | ||
this.observe(DEDENT); | ||
this.p('' + DEDENT + TERM); | ||
break; | ||
case '#': | ||
this.observe('\n'); | ||
this.p('\n'); | ||
break; | ||
default: | ||
throw new Error('Unclosed "' + this.peek().replace(/"/g, '\\"') + '" at EOF'); | ||
} | ||
} | ||
return this.preprocessed; | ||
}; | ||
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; | ||
@@ -327,0 +316,0 @@ }(EventEmitter); |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.0-beta4 | ||
// Generated by CoffeeScript 2.0.0-beta6 | ||
var CoffeeScript, fs, runModule; | ||
@@ -18,1 +18,15 @@ fs = require('fs'); | ||
}; | ||
if (null != require.extensions['.litcoffee']) | ||
require.extensions['.litcoffee']; | ||
else | ||
require.extensions['.litcoffee'] = function (module, filename) { | ||
var csAst, input, js, jsAst; | ||
input = fs.readFileSync(filename, 'utf8'); | ||
csAst = CoffeeScript.parse(input, { | ||
raw: true, | ||
literate: true | ||
}); | ||
jsAst = CoffeeScript.compile(csAst); | ||
js = CoffeeScript.js(jsAst); | ||
return runModule(module, js, jsAst, filename); | ||
}; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.0-beta4 | ||
// Generated by CoffeeScript 2.0.0-beta6 | ||
var addHistory, addMultilineHandler, CoffeeScript, CS, fs, merge, nodeREPL, path, vm; | ||
@@ -3,0 +3,0 @@ fs = require('fs'); |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.0-beta4 | ||
// Generated by CoffeeScript 2.0.0-beta6 | ||
var CoffeeScript, formatSourcePosition, Module, patched, patchStackTrace, path, runMain, runModule, SourceMapConsumer; | ||
@@ -12,3 +12,6 @@ path = require('path'); | ||
patched = true; | ||
Module._sourceMaps = {}; | ||
if (null != Module._sourceMaps) | ||
Module._sourceMaps; | ||
else | ||
Module._sourceMaps = {}; | ||
return Error.prepareStackTrace = function (err, stack) { | ||
@@ -15,0 +18,0 @@ var frames, getSourceMapping, sourceFiles; |
{ | ||
"name": "coffee-script-redux", | ||
"author": "Michael Ficarra", | ||
"version": "2.0.0-beta5", | ||
"version": "2.0.0-beta6", | ||
"homepage": "https://github.com/michaelficarra/CoffeeScriptRedux", | ||
@@ -27,3 +27,3 @@ "bugs": "https://github.com/michaelficarra/CoffeeScriptRedux/issues", | ||
"devDependencies": { | ||
"mocha": "~1.6.0", | ||
"mocha": "~1.12.0", | ||
"pegjs": "git://github.com/dmajda/pegjs.git#bea6b1fde74c8aebf802f9bcc3380c65b241e1b7", | ||
@@ -38,4 +38,4 @@ "commonjs-everywhere": "~0.6.0" | ||
"esmangle": "~0.0.8", | ||
"source-map": "~0.1.7", | ||
"escodegen": "~0.0.21", | ||
"source-map": "0.1.11", | ||
"escodegen": "~0.0.24", | ||
"cscodegen": "git://github.com/michaelficarra/cscodegen.git#73fd7202ac086c26f18c9d56f025b18b3c6f5383" | ||
@@ -42,0 +42,0 @@ }, |
@@ -27,18 +27,21 @@ CoffeeScript II: The Wrath of Khan | ||
``` | ||
If you haven't seen [the funded Kickstarter project](http://www.kickstarter.com/projects/michaelficarra/make-a-better-coffeescript-compiler) | ||
yet, you should check that out to find out more about this. | ||
### Status | ||
See the [roadmap to 2.0](https://github.com/michaelficarra/CoffeeScriptRedux/wiki/Roadmap). | ||
Complete enough to use for nearly every project. See the [roadmap to 2.0](https://github.com/michaelficarra/CoffeeScriptRedux/wiki/Roadmap). | ||
### Getting Started | ||
npm install | ||
make -j test | ||
bin/coffee --help | ||
npm install -g coffee-script-redux | ||
coffee --help | ||
coffee --js <input.coffee >output.js | ||
Before transitioning from Jeremy's compiler, see the | ||
[intentional deviations from jashkenas/coffee-script](https://github.com/michaelficarra/CoffeeScriptRedux/wiki/Intentional-Deviations-From-jashkenas-coffee-script) | ||
wiki page. | ||
### Development | ||
make -j build test | ||
git clone git://github.com/michaelficarra/CoffeeScriptRedux.git | ||
make clean && git co lib && make -j build && make test | ||
@@ -48,4 +51,5 @@ ### Notable Contributors | ||
I'd like to thank the following financial contributors for their large | ||
donations to the Kickstarter project. Together, you donated over $10,000 toward | ||
the project. Without you, I wouldn't be able to do this. | ||
donations to [the Kickstarter project](http://www.kickstarter.com/projects/michaelficarra/make-a-better-coffeescript-compiler) | ||
that funded the initial work on this compiler. | ||
Together, you donated over $10,000. Without you, I wouldn't have been able to do this. | ||
@@ -52,0 +56,0 @@ * [Groupon](http://groupon.com/), who is generously allowing me to work in their offices |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
809723
22
24725
81
2