Allowing more flexible linebreaks/indentation within object literals.
This commit is contained in:
parent
9d09bee6fb
commit
7e3c71ed19
|
@ -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,
|
||||
|
|
254
lib/parser.js
254
lib/parser.js
File diff suppressed because one or more lines are too long
|
@ -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,
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Reference in New Issue