summaryrefslogtreecommitdiff
path: root/sources/scalac/ast/parser/Parser.java
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2003-08-28 15:04:01 +0000
committerMartin Odersky <odersky@gmail.com>2003-08-28 15:04:01 +0000
commitcef4819a2034134b26db1f6eb85c8999421af5c1 (patch)
treeb57925ad96c33df8e69a75b917fa147e8495ad8a /sources/scalac/ast/parser/Parser.java
parent1ba1b5f0d6f3fea116ea5858842bb539257f511b (diff)
downloadscala-cef4819a2034134b26db1f6eb85c8999421af5c1.tar.gz
scala-cef4819a2034134b26db1f6eb85c8999421af5c1.tar.bz2
scala-cef4819a2034134b26db1f6eb85c8999421af5c1.zip
*** empty log message ***
Diffstat (limited to 'sources/scalac/ast/parser/Parser.java')
-rw-r--r--sources/scalac/ast/parser/Parser.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/sources/scalac/ast/parser/Parser.java b/sources/scalac/ast/parser/Parser.java
index af165b22ea..7a6cd2b3db 100644
--- a/sources/scalac/ast/parser/Parser.java
+++ b/sources/scalac/ast/parser/Parser.java
@@ -159,7 +159,7 @@ public class Parser implements Tokens {
case SYMBOLLIT: case TRUE: case FALSE: case NULL: case IDENTIFIER:
case THIS: case SUPER: case IF:
case FOR: case NEW: case USCORE:
- case TRY: case WHILE: case DO:
+ case TRY: case WHILE: case DO: case RETURN: case THROW:
case LPAREN: case LBRACE:
return true;
default:
@@ -812,6 +812,8 @@ public class Parser implements Tokens {
* | while `(' Expr `)' Expr
* | do Expr [`;'] while `(' Expr `)'
* | for `(' Enumerators `)' (do | yield) Expr
+ * | throw Expr
+ * | return [Expr]
* | [SimpleExpr `.'] Id `=' Expr
* | SimpleExpr ArgumentExprs `=' Expr
* | PostfixExpr [`:' Type1 | as Type1 | is Type1]
@@ -885,6 +887,14 @@ public class Parser implements Tokens {
} else {
return syntaxError("`do' or `yield' expected", true);
}
+ } else if (s.token == RETURN) {
+ int pos = s.skipToken();
+ Tree e = (isExprIntro()) ? expr()
+ : make.Block(pos, Tree.EMPTY_ARRAY);
+ return make.Return(pos, e);
+ } else if (s.token == THROW) {
+ int pos = s.skipToken();
+ return make.Throw(pos, expr());
// } else if (s.token == ARROW) {
// return make.Function(s.skipToken(), new ValDef[]{}, expr());
} else {