mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Removing {@prop: value} from the grammar.
This commit is contained in:
parent
4a85f3d499
commit
89debc87b2
3 changed files with 217 additions and 183 deletions
|
@ -127,8 +127,6 @@
|
||||||
return new AssignNode(new ValueNode($1), $3, 'object');
|
return new AssignNode(new ValueNode($1), $3, 'object');
|
||||||
}), o("AlphaNumeric ASSIGN Expression", function() {
|
}), o("AlphaNumeric ASSIGN Expression", function() {
|
||||||
return new AssignNode(new ValueNode($1), $3, 'object');
|
return new AssignNode(new ValueNode($1), $3, 'object');
|
||||||
}), o("ThisProperty ASSIGN Expression", function() {
|
|
||||||
return new AssignNode(new ValueNode($1), $3, 'this');
|
|
||||||
}), o("Comment")
|
}), o("Comment")
|
||||||
],
|
],
|
||||||
// A return statement from a function body.
|
// A return statement from a function body.
|
||||||
|
@ -249,18 +247,6 @@
|
||||||
return new ObjectNode($2);
|
return new ObjectNode($2);
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
// Class definitions have optional bodies of prototype property assignments,
|
|
||||||
// and optional references to the superclass.
|
|
||||||
Class: [o("CLASS SimpleAssignable", function() {
|
|
||||||
return new ClassNode($2);
|
|
||||||
}), o("CLASS SimpleAssignable EXTENDS Value", function() {
|
|
||||||
return new ClassNode($2, $4);
|
|
||||||
}), o("CLASS SimpleAssignable IndentedAssignList", function() {
|
|
||||||
return new ClassNode($2, null, $3);
|
|
||||||
}), o("CLASS SimpleAssignable EXTENDS Value IndentedAssignList", function() {
|
|
||||||
return new ClassNode($2, $4, $5);
|
|
||||||
})
|
|
||||||
],
|
|
||||||
// Assignment of properties within an object literal can be separated by
|
// Assignment of properties within an object literal can be separated by
|
||||||
// comma, as in JavaScript, or simply by newline.
|
// comma, as in JavaScript, or simply by newline.
|
||||||
AssignList: [o("", function() {
|
AssignList: [o("", function() {
|
||||||
|
@ -282,6 +268,34 @@
|
||||||
return $2;
|
return $2;
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
|
// Class definitions have optional bodies of prototype property assignments,
|
||||||
|
// and optional references to the superclass.
|
||||||
|
Class: [o("CLASS SimpleAssignable", function() {
|
||||||
|
return new ClassNode($2);
|
||||||
|
}), o("CLASS SimpleAssignable EXTENDS Value", function() {
|
||||||
|
return new ClassNode($2, $4);
|
||||||
|
}), o("CLASS SimpleAssignable INDENT ClassBody OUTDENT", function() {
|
||||||
|
return new ClassNode($2, null, $4);
|
||||||
|
}), o("CLASS SimpleAssignable EXTENDS Value INDENT ClassBody OUTDENT", function() {
|
||||||
|
return new ClassNode($2, $4, $6);
|
||||||
|
})
|
||||||
|
],
|
||||||
|
// Assignments that can happen directly inside a class declaration.
|
||||||
|
ClassAssign: [o("AssignObj", function() {
|
||||||
|
return $1;
|
||||||
|
}), o("ThisProperty ASSIGN Expression", function() {
|
||||||
|
return new AssignNode(new ValueNode($1), $3, 'this');
|
||||||
|
})
|
||||||
|
],
|
||||||
|
// A list of assignments to a class.
|
||||||
|
ClassBody: [o("", function() {
|
||||||
|
return [];
|
||||||
|
}), o("ClassAssign", function() {
|
||||||
|
return [$1];
|
||||||
|
}), o("ClassBody TERMINATOR ClassAssign", function() {
|
||||||
|
return $1.concat($3);
|
||||||
|
})
|
||||||
|
],
|
||||||
// The three flavors of function call: normal, object instantiation with `new`,
|
// The three flavors of function call: normal, object instantiation with `new`,
|
||||||
// and calling `super()`
|
// and calling `super()`
|
||||||
Call: [o("Invocation"), o("NEW Invocation", function() {
|
Call: [o("Invocation"), o("NEW Invocation", function() {
|
||||||
|
|
324
lib/parser.js
324
lib/parser.js
File diff suppressed because one or more lines are too long
|
@ -140,7 +140,6 @@ grammar: {
|
||||||
AssignObj: [
|
AssignObj: [
|
||||||
o "Identifier ASSIGN Expression", -> new AssignNode new ValueNode($1), $3, 'object'
|
o "Identifier ASSIGN Expression", -> new AssignNode new ValueNode($1), $3, 'object'
|
||||||
o "AlphaNumeric ASSIGN Expression", -> new AssignNode new ValueNode($1), $3, 'object'
|
o "AlphaNumeric ASSIGN Expression", -> new AssignNode new ValueNode($1), $3, 'object'
|
||||||
o "ThisProperty ASSIGN Expression", -> new AssignNode new ValueNode($1), $3, 'this'
|
|
||||||
o "Comment"
|
o "Comment"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -247,15 +246,6 @@ grammar: {
|
||||||
o "{ IndentedAssignList , }", -> new ObjectNode $2
|
o "{ IndentedAssignList , }", -> new ObjectNode $2
|
||||||
]
|
]
|
||||||
|
|
||||||
# Class definitions have optional bodies of prototype property assignments,
|
|
||||||
# and optional references to the superclass.
|
|
||||||
Class: [
|
|
||||||
o "CLASS SimpleAssignable", -> new ClassNode $2
|
|
||||||
o "CLASS SimpleAssignable EXTENDS Value", -> new ClassNode $2, $4
|
|
||||||
o "CLASS SimpleAssignable IndentedAssignList", -> new ClassNode $2, null, $3
|
|
||||||
o "CLASS SimpleAssignable EXTENDS Value IndentedAssignList", -> new ClassNode $2, $4, $5
|
|
||||||
]
|
|
||||||
|
|
||||||
# Assignment of properties within an object literal can be separated by
|
# Assignment of properties within an object literal can be separated by
|
||||||
# comma, as in JavaScript, or simply by newline.
|
# comma, as in JavaScript, or simply by newline.
|
||||||
AssignList: [
|
AssignList: [
|
||||||
|
@ -272,6 +262,28 @@ grammar: {
|
||||||
o "INDENT AssignList , OUTDENT", -> $2
|
o "INDENT AssignList , OUTDENT", -> $2
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Class definitions have optional bodies of prototype property assignments,
|
||||||
|
# and optional references to the superclass.
|
||||||
|
Class: [
|
||||||
|
o "CLASS SimpleAssignable", -> new ClassNode $2
|
||||||
|
o "CLASS SimpleAssignable EXTENDS Value", -> new ClassNode $2, $4
|
||||||
|
o "CLASS SimpleAssignable INDENT ClassBody OUTDENT", -> new ClassNode $2, null, $4
|
||||||
|
o "CLASS SimpleAssignable EXTENDS Value INDENT ClassBody OUTDENT", -> new ClassNode $2, $4, $6
|
||||||
|
]
|
||||||
|
|
||||||
|
# Assignments that can happen directly inside a class declaration.
|
||||||
|
ClassAssign: [
|
||||||
|
o "AssignObj", -> $1
|
||||||
|
o "ThisProperty ASSIGN Expression", -> new AssignNode new ValueNode($1), $3, 'this'
|
||||||
|
]
|
||||||
|
|
||||||
|
# A list of assignments to a class.
|
||||||
|
ClassBody: [
|
||||||
|
o "", -> []
|
||||||
|
o "ClassAssign", -> [$1]
|
||||||
|
o "ClassBody TERMINATOR ClassAssign", -> $1.concat $3
|
||||||
|
]
|
||||||
|
|
||||||
# The three flavors of function call: normal, object instantiation with `new`,
|
# The three flavors of function call: normal, object instantiation with `new`,
|
||||||
# and calling `super()`
|
# and calling `super()`
|
||||||
Call: [
|
Call: [
|
||||||
|
|
Loading…
Reference in a new issue