1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

grammar: refactored Param

This commit is contained in:
satyr 2010-10-26 19:08:01 +09:00
parent 4eeab947dd
commit 96f74f9da8
3 changed files with 148 additions and 153 deletions

View file

@ -124,20 +124,15 @@
})
],
Param: [
o('Identifier', function() {
o('ParamVar', function() {
return new Param($1);
}), o('Identifier ...', function() {
}), o('ParamVar ...', function() {
return new Param($1, null, true);
}), o('Identifier = Expression', function() {
return new Param($1, $3);
}), o('ThisProperty', function() {
return new Param($1, null);
}), o('ThisProperty ...', function() {
return new Param($1, null, true);
}), o('ThisProperty = Expression', function() {
}), o('ParamVar = Expression', function() {
return new Param($1, $3);
})
],
ParamVar: [o('Identifier'), o('ThisProperty')],
Splat: [
o('Expression ...', function() {
return new Splat($1);

File diff suppressed because one or more lines are too long

View file

@ -199,12 +199,14 @@ grammar =
# A single parameter in a function definition can be ordinary, or a splat
# that hoovers up the remaining arguments.
Param: [
o 'Identifier', -> new Param $1
o 'Identifier ...', -> new Param $1, null, on
o 'Identifier = Expression', -> new Param $1, $3
o 'ThisProperty', -> new Param $1, null
o 'ThisProperty ...', -> new Param $1, null, on
o 'ThisProperty = Expression', -> new Param $1, $3
o 'ParamVar', -> new Param $1
o 'ParamVar ...', -> new Param $1, null, on
o 'ParamVar = Expression', -> new Param $1, $3
]
ParamVar: [
o 'Identifier'
o 'ThisProperty'
]
# A splat that occurs outside of a parameter list.