fixed the broken try/catch grammar

This commit is contained in:
Jeremy Ashkenas
2009-12-24 00:45:16 -08:00
parent fb13a303f2
commit 47928ca952

View File

@@ -279,13 +279,13 @@ rule
Try: Try:
TRY Expressions Catch "." { result = TryNode.new(val[1], val[2][0], val[2][1]) } TRY Expressions Catch "." { result = TryNode.new(val[1], val[2][0], val[2][1]) }
| TRY Expressions Catch | TRY Expressions Catch
FINALLY Then Expressions "." { result = TryNode.new(val[1], val[2][0], val[2][1], val[5]) } FINALLY Expressions "." { result = TryNode.new(val[1], val[2][0], val[2][1], val[4]) }
; ;
# A catch clause. # A catch clause.
Catch: Catch:
/* nothing */ { result = [nil, nil] } /* nothing */ { result = [nil, nil] }
| CATCH IDENTIFIER Then Expressions { result = [val[1], val[3]] } | CATCH IDENTIFIER Expressions { result = [val[1], val[2]] }
; ;
# Throw an exception. # Throw an exception.