updating rewrite rules for jots multiline function case

This commit is contained in:
Jeremy Ashkenas 2010-02-16 14:56:17 -05:00
parent 51e80484e2
commit 561a02c35f
3 changed files with 5 additions and 4 deletions

View File

@ -249,7 +249,7 @@
while (true) {
idx += 1;
tok = this.tokens[idx];
if ((!tok || SINGLE_CLOSERS.indexOf(tok[0]) >= 0 || (tok[0] === ')' && parens === 0)) && !(starter === 'ELSE' && tok[0] === 'ELSE')) {
if ((!tok || (SINGLE_CLOSERS.indexOf(tok[0]) >= 0 && tok[1] !== ';') || (tok[0] === ')' && parens === 0)) && !(starter === 'ELSE' && tok[0] === 'ELSE')) {
insertion = this.tokens[idx - 1][0] === "," ? idx - 1 : idx;
this.tokens.splice(insertion, 0, ['OUTDENT', 2, token[2]]);
break;

View File

@ -176,7 +176,8 @@ re::add_implicit_indentation: ->
while true
idx += 1
tok: @tokens[idx]
if (not tok or SINGLE_CLOSERS.indexOf(tok[0]) >= 0 or
if (not tok or
(SINGLE_CLOSERS.indexOf(tok[0]) >= 0 and tok[1] isnt ';') or
(tok[0] is ')' && parens is 0)) and
not (starter is 'ELSE' and tok[0] is 'ELSE')
insertion: if @tokens[idx - 1][0] is "," then idx - 1 else idx

View File

@ -312,8 +312,8 @@
_.range: (start, stop, step) ->
a: arguments
solo: a.length <= 1
i: start: if solo then 0 else a[0];
stop: if solo then a[0] else a[1];
i: start: if solo then 0 else a[0]
stop: if solo then a[0] else a[1]
step: a[2] or 1
len: Math.ceil((stop - start) / step)
return [] if len <= 0