Merge branch 'master' of git://github.com/Tesco/coffee-script

This commit is contained in:
Jeremy Ashkenas 2010-04-26 23:31:18 -04:00
commit e17567866a
7 changed files with 9 additions and 7 deletions

View File

@ -1,5 +1,5 @@
fs: require 'fs'
helpers: require('./lib/helpers').helpers
{helpers}: require('./lib/helpers')
CoffeeScript: require './lib/coffee-script'
{spawn, exec}: require('child_process')

2
README
View File

@ -50,7 +50,7 @@
Mathieu D'Amours (matehat)
Chris Hoffman (cehoffman)
Jason Huggins (hugs)
Tim Jones (Tesco)
Timothy Jones (Tesco)
Chris Lloyd (chrislloyd)
Matt Lyon (mattly)
Jeff Olson (olsonjeffery)

View File

@ -129,9 +129,7 @@
// the ordinary **Assign** is that these allow numbers and strings as keys.
AssignObj: [o("Identifier", function() {
return new ValueNode($1);
}), o("AlphaNumeric", function() {
return new ValueNode($1);
}), o("Identifier ASSIGN Expression", function() {
}), o("AlphaNumeric"), o("Identifier ASSIGN Expression", function() {
return new AssignNode(new ValueNode($1), $3, 'object');
}), o("AlphaNumeric ASSIGN Expression", function() {
return new AssignNode(new ValueNode($1), $3, 'object');

View File

@ -752,6 +752,9 @@
join = '';
}
indent = prop instanceof CommentNode ? '' : this.idt(1);
if (!(prop instanceof AssignNode || prop instanceof CommentNode)) {
prop = new AssignNode(prop, prop, 'object');
}
return indent + prop.compile(o) + join;
}).call(this));
}

View File

@ -103,7 +103,7 @@ case 46:this.$ = new AssignNode($$[$0-3+1-1], $$[$0-3+3-1]);
break;
case 47:this.$ = new ValueNode($$[$0-1+1-1]);
break;
case 48:this.$ = new ValueNode($$[$0-1+1-1]);
case 48:this.$ = $$[$0-1+1-1];
break;
case 49:this.$ = new AssignNode(new ValueNode($$[$0-3+1-1]), $$[$0-3+3-1], 'object');
break;

View File

@ -148,7 +148,7 @@ grammar: {
# the ordinary **Assign** is that these allow numbers and strings as keys.
AssignObj: [
o "Identifier", -> new ValueNode $1
o "AlphaNumeric", -> new ValueNode $1
o "AlphaNumeric"
o "Identifier ASSIGN Expression", -> new AssignNode new ValueNode($1), $3, 'object'
o "AlphaNumeric ASSIGN Expression", -> new AssignNode new ValueNode($1), $3, 'object'
o "Comment"

View File

@ -542,6 +542,7 @@ exports.ObjectNode: class ObjectNode extends BaseNode
join: "\n" if (prop is last_noncom) or (prop instanceof CommentNode)
join: '' if i is @properties.length - 1
indent: if prop instanceof CommentNode then '' else @idt 1
prop: new AssignNode prop, prop, 'object' unless prop instanceof AssignNode or prop instanceof CommentNode
indent + prop.compile(o) + join
props: props.join('')
inner: if props then '\n' + props + '\n' + @idt() else ''