Issue #587 ... Removing the Attempted Removal of Erroneous Double Parens.

This commit is contained in:
Jeremy Ashkenas 2010-08-07 08:13:36 -04:00
parent cc10641f38
commit 0ada5a7734
8 changed files with 12 additions and 18 deletions

View File

@ -1,6 +1,6 @@
(function() {
var Lexer, compile, helpers, lexer, parser, path, processScripts;
if (typeof process !== "undefined" && process !== null) {
if ((typeof process !== "undefined" && process !== null)) {
path = require('path');
Lexer = require('./lexer').Lexer;
parser = require('./parser').parser;

View File

@ -1,6 +1,6 @@
(function() {
var compact, count, del, ends, extend, flatten, helpers, include, indexOf, merge, starts;
if (!(typeof process !== "undefined" && process !== null)) {
if (!((typeof process !== "undefined" && process !== null))) {
this.exports = this;
}
helpers = (exports.helpers = {});
@ -70,7 +70,7 @@
_a = []; _b = properties;
for (key in _b) {
val = _b[key];
_a.push(object[key] = val);
_a.push((object[key] = val));
}
return _a;
});

View File

@ -1,7 +1,7 @@
(function() {
var ASSIGNED, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_KEYWORDS, COMMENT, CONVERSIONS, HEREDOC, HEREDOC_INDENT, IDENTIFIER, JS_CLEANER, JS_FORBIDDEN, JS_KEYWORDS, LAST_DENT, LAST_DENTS, LINE_BREAK, Lexer, MULTILINER, MULTI_DENT, NEXT_CHARACTER, NOT_REGEX, NO_NEWLINE, NUMBER, OPERATOR, REGEX_END, REGEX_ESCAPE, REGEX_INTERPOLATION, REGEX_START, RESERVED, Rewriter, STRING_NEWLINES, WHITESPACE, _a, _b, _c, compact, count, helpers, include, starts;
var __slice = Array.prototype.slice;
if (typeof process !== "undefined" && process !== null) {
if ((typeof process !== "undefined" && process !== null)) {
_a = require('./rewriter');
Rewriter = _a.Rewriter;
_b = require('./helpers');
@ -537,7 +537,7 @@
if (!(tok = this.prev(index))) {
return null;
}
if (typeof newTag !== "undefined" && newTag !== null) {
if ((typeof newTag !== "undefined" && newTag !== null)) {
return (tok[0] = newTag);
}
return tok[0];
@ -547,7 +547,7 @@
if (!(tok = this.prev(index))) {
return null;
}
if (typeof val !== "undefined" && val !== null) {
if ((typeof val !== "undefined" && val !== null)) {
return (tok[1] = val);
}
return tok[1];

View File

@ -1,5 +1,5 @@
(function() {
var AccessorNode, ArrayNode, AssignNode, BaseNode, CallNode, ClassNode, ClosureNode, CodeNode, CommentNode, DOUBLE_PARENS, ExistenceNode, Expressions, ExtendsNode, ForNode, IDENTIFIER, IS_STRING, IfNode, InNode, IndexNode, LiteralNode, NUMBER, ObjectNode, OpNode, ParamNode, ParentheticalNode, PushNode, RangeNode, ReturnNode, SIMPLENUM, Scope, SliceNode, SplatNode, TAB, TRAILING_WHITESPACE, ThrowNode, TryNode, UTILITIES, ValueNode, WhileNode, _a, compact, del, ends, flatten, helpers, include, indexOf, literal, merge, starts, utility;
var AccessorNode, ArrayNode, AssignNode, BaseNode, CallNode, ClassNode, ClosureNode, CodeNode, CommentNode, ExistenceNode, Expressions, ExtendsNode, ForNode, IDENTIFIER, IS_STRING, IfNode, InNode, IndexNode, LiteralNode, NUMBER, ObjectNode, OpNode, ParamNode, ParentheticalNode, PushNode, RangeNode, ReturnNode, SIMPLENUM, Scope, SliceNode, SplatNode, TAB, TRAILING_WHITESPACE, ThrowNode, TryNode, UTILITIES, ValueNode, WhileNode, _a, compact, del, ends, flatten, helpers, include, indexOf, literal, merge, starts, utility;
var __extends = function(child, parent) {
var ctor = function(){};
ctor.prototype = parent.prototype;
@ -8,7 +8,7 @@
if (typeof parent.extended === "function") parent.extended(child);
child.__superClass__ = parent.prototype;
};
if (typeof process !== "undefined" && process !== null) {
if ((typeof process !== "undefined" && process !== null)) {
Scope = require('./scope').Scope;
helpers = require('./helpers').helpers;
} else {
@ -227,7 +227,6 @@
o.scope = new Scope(null, this, null);
code = this.compileWithDeclarations(o);
code = code.replace(TRAILING_WHITESPACE, '');
code = code.replace(DOUBLE_PARENS, '($1)');
return o.noWrap ? code : ("(function() {\n" + (code) + "\n})();\n");
};
Expressions.prototype.compileWithDeclarations = function(o) {
@ -1776,7 +1775,6 @@
};
TAB = ' ';
TRAILING_WHITESPACE = /[ \t]+$/gm;
DOUBLE_PARENS = /\(\(([^\(\)\n]*)\)\)/g;
IDENTIFIER = /^[a-zA-Z\$_](\w|\$)*$/;
NUMBER = /^(((\b0(x|X)[0-9a-fA-F]+)|((\b[0-9]+(\.[0-9]+)?|\.[0-9]+)(e[+\-]?[0-9]+)?)))\b$/i;
SIMPLENUM = /^-?\d+/;

View File

@ -3,7 +3,7 @@
var __bind = function(func, context) {
return function(){ return func.apply(context, arguments); };
}, __hasProp = Object.prototype.hasOwnProperty;
if (typeof process !== "undefined" && process !== null) {
if ((typeof process !== "undefined" && process !== null)) {
_a = require('./helpers');
helpers = _a.helpers;
} else {

View File

@ -1,7 +1,7 @@
(function() {
var Scope;
var __hasProp = Object.prototype.hasOwnProperty;
if (!(typeof process !== "undefined" && process !== null)) {
if (!((typeof process !== "undefined" && process !== null))) {
this.exports = this;
}
exports.Scope = (function() {

View File

@ -205,7 +205,6 @@ exports.Expressions = class Expressions extends BaseNode
o.scope = new Scope(null, this, null)
code = @compileWithDeclarations(o)
code = code.replace(TRAILING_WHITESPACE, '')
code = code.replace(DOUBLE_PARENS, '($1)')
if o.noWrap then code else "(function() {\n#{code}\n})();\n"
# Compile the expressions body for the contents of a function, with
@ -1539,9 +1538,6 @@ TAB = ' '
# with Git.
TRAILING_WHITESPACE = /[ \t]+$/gm
# Obvious redundant parentheses should be removed.
DOUBLE_PARENS = /\(\(([^\(\)\n]*)\)\)/g
# Keep these identifier regexes in sync with the Lexer.
IDENTIFIER = /^[a-zA-Z\$_](\w|\$)*$/
NUMBER = /^(((\b0(x|X)[0-9a-fA-F]+)|((\b[0-9]+(\.[0-9]+)?|\.[0-9]+)(e[+\-]?[0-9]+)?)))\b$/i

View File

@ -54,9 +54,9 @@ trailingComma = {k1: "v1", k2: 4, k3: (-> true),}
ok trailingComma.k3() and (trailingComma.k2 is 4) and (trailingComma.k1 is "v1")
money$ = 'dollars'
money$ = '(((dollars)))'
ok money$ is 'dollars'
ok money$ is '\(\(\(dollars\)\)\)'
multiline = "one