adding class methods to class definition syntax, using '@'

This commit is contained in:
Jeremy Ashkenas
2010-03-29 21:43:12 -04:00
parent 711dacae5f
commit 177ec92c39
7 changed files with 180 additions and 167 deletions

View File

@@ -140,6 +140,7 @@ 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"
]
@@ -194,7 +195,7 @@ grammar: {
Splat: [
o "Expression . . .", -> new SplatNode $1
]
# Variables and properties that can be assigned to.
SimpleAssignable: [
o "Identifier", -> new ValueNode $1
@@ -202,7 +203,7 @@ grammar: {
o "Invocation Accessor", -> new ValueNode $1, [$2]
o "ThisProperty"
]
# Everything that can be assigned to.
Assignable: [
o "SimpleAssignable"
@@ -313,7 +314,7 @@ grammar: {
o "THIS", -> new ValueNode new LiteralNode 'this'
o "@", -> new ValueNode new LiteralNode 'this'
]
# A reference to a property on *this*.
ThisProperty: [
o "@ Identifier", -> new ValueNode new LiteralNode('this'), [new AccessorNode($2)]