adding a block test and using PARAM_SPLAT to remove the last shift/reduce conflict

This commit is contained in:
Jeremy Ashkenas
2010-01-03 10:46:37 -05:00
parent 21a0cc83ae
commit ba3c5298f7
3 changed files with 9 additions and 7 deletions

View File

@@ -5,7 +5,7 @@ token IF ELSE UNLESS
token NUMBER STRING REGEX
token TRUE FALSE YES NO ON OFF
token IDENTIFIER PROPERTY_ACCESS
token CODE PARAM NEW RETURN
token CODE PARAM PARAM_SPLAT NEW RETURN
token TRY CATCH FINALLY THROW
token BREAK CONTINUE
token FOR IN BY WHILE
@@ -17,12 +17,9 @@ token COMMENT
token JS
token INDENT OUTDENT
# We expect one shift-reduce conflict. Because of the lexer, it will never occur.
expect 1
# Declare order of operations.
prechigh
nonassoc UMINUS SPLAT NOT '!' '!!' '~' '++' '--' '?'
nonassoc UMINUS PARAM_SPLAT SPLAT NOT '!' '!!' '~' '++' '--' '?'
left '*' '/' '%'
left '+' '-'
left '<<' '>>' '>>>'
@@ -203,7 +200,7 @@ rule
Param:
PARAM
| '*' PARAM = SPLAT { result = ParamSplatNode.new(val[1]) }
| PARAM_SPLAT PARAM { result = ParamSplatNode.new(val[1]) }
;
Splat: