Skip to content
This repository has been archived by the owner on Mar 26, 2020. It is now read-only.

Commit

Permalink
Minor modifications to the grammar to allow a single trailing comma f…
Browse files Browse the repository at this point in the history
…or function call arguments, array literal and object literals. Adjusted tests accordingly
  • Loading branch information
matehat committed Mar 26, 2010
1 parent c8f969b commit b9b87f7
Show file tree
Hide file tree
Showing 5 changed files with 152 additions and 112 deletions.
10 changes: 10 additions & 0 deletions lib/grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@
return new ObjectNode($2);
}), o("{ IndentedAssignList }", function() {
return new ObjectNode($2);
}), o("{ AssignList , }", function() {
return new ObjectNode($2);
}), o("{ IndentedAssignList , }", function() {
return new ObjectNode($2);
})
],
// Class definitions have optional bodies of prototype property assignments,
Expand Down Expand Up @@ -292,11 +296,15 @@
// The list of arguments to a function call.
Arguments: [o("CALL_START ArgList CALL_END", function() {
return $2;
}), o("CALL_START ArgList , CALL_END", function() {
return $2;
})
],
// Calling super.
Super: [o("SUPER CALL_START ArgList CALL_END", function() {
return new CallNode('super', $3);
}), o("SUPER CALL_START ArgList , CALL_END", function() {
return new CallNode('super', $3);
})
],
// A reference to the *this* current object, either naked or to a property.
Expand All @@ -323,6 +331,8 @@
// The array literal.
Array: [o("[ ArgList ]", function() {
return new ArrayNode($2);
}), o("[ ArgList , ]", function() {
return new ArrayNode($2);
})
],
// The **ArgList** is both the list of objects passed into a function call,
Expand Down
Loading

0 comments on commit b9b87f7

Please sign in to comment.