Allowing more flexible linebreaks/indentation within object literals.

This commit is contained in:
Jeremy Ashkenas 2010-05-12 18:28:40 -04:00
parent 9d09bee6fb
commit 7e3c71ed19
4 changed files with 137 additions and 136 deletions

View File

@ -281,12 +281,10 @@
return [$1];
}), o("AssignList , AssignObj", function() {
return $1.concat([$3]);
}), o("AssignList TERMINATOR AssignObj", function() {
return $1.concat([$3]);
}), o("AssignList , TERMINATOR AssignObj", function() {
}), o("AssignList OptComma TERMINATOR AssignObj", function() {
return $1.concat([$4]);
}), o("INDENT AssignList OptComma OUTDENT", function() {
return $2;
}), o("AssignList OptComma INDENT AssignList OptComma OUTDENT", function() {
return $1.concat($4);
})
],
// Class definitions have optional bodies of prototype property assignments,

File diff suppressed because one or more lines are too long

View File

@ -266,9 +266,8 @@ grammar: {
o "", -> []
o "AssignObj", -> [$1]
o "AssignList , AssignObj", -> $1.concat [$3]
o "AssignList TERMINATOR AssignObj", -> $1.concat [$3]
o "AssignList , TERMINATOR AssignObj", -> $1.concat [$4]
o "INDENT AssignList OptComma OUTDENT", -> $2
o "AssignList OptComma TERMINATOR AssignObj", -> $1.concat [$4]
o "AssignList OptComma INDENT AssignList OptComma OUTDENT", -> $1.concat $4
]
# Class definitions have optional bodies of prototype property assignments,

View File

@ -38,6 +38,12 @@ trailing_comma: [
trailing_comma: {k1: "v1", k2: 4, k3: (-> true),}
ok trailing_comma.k3() and (trailing_comma.k2 is 4) and (trailing_comma.k1 is "v1")
multiline: {a: 15,
b: 26}
ok multiline.b is 26
money$: 'dollars'
ok money$ is 'dollars'