Removing {@prop: value} from the grammar.

This commit is contained in:
Tim Jones 2010-04-04 04:18:29 +12:00
parent 4a85f3d499
commit 89debc87b2
3 changed files with 217 additions and 183 deletions

View File

@ -127,8 +127,6 @@
return new AssignNode(new ValueNode($1), $3, 'object');
}), o("AlphaNumeric ASSIGN Expression", function() {
return new AssignNode(new ValueNode($1), $3, 'object');
}), o("ThisProperty ASSIGN Expression", function() {
return new AssignNode(new ValueNode($1), $3, 'this');
}), o("Comment")
],
// A return statement from a function body.
@ -249,18 +247,6 @@
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
// comma, as in JavaScript, or simply by newline.
AssignList: [o("", function() {
@ -282,6 +268,34 @@
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`,
// and calling `super()`
Call: [o("Invocation"), o("NEW Invocation", function() {

File diff suppressed because one or more lines are too long

View File

@ -140,7 +140,6 @@ grammar: {
AssignObj: [
o "Identifier 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"
]
@ -246,16 +245,7 @@ grammar: {
o "{ AssignList , }", -> 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
# comma, as in JavaScript, or simply by newline.
AssignList: [
@ -272,6 +262,28 @@ grammar: {
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`,
# and calling `super()`
Call: [