summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorburaq <buraq@epfl.ch>2003-07-16 12:22:37 +0000
committerburaq <buraq@epfl.ch>2003-07-16 12:22:37 +0000
commit316f425492d319fe7c4769c35bee6702f43adba5 (patch)
treee6c1d92c1bd2caed059ad192b68e9796a7c44062
parenta5fdf3ec18bcbbe0fbc521e1820c2d7be49d4a6c (diff)
downloadscala-316f425492d319fe7c4769c35bee6702f43adba5.tar.gz
scala-316f425492d319fe7c4769c35bee6702f43adba5.tar.bz2
scala-316f425492d319fe7c4769c35bee6702f43adba5.zip
fixed overly permissive parsing of TreePattern ...
fixed overly permissive parsing of TreePattern ( SimplePat Id SimplePat, op2 must not be empty sequence )
-rw-r--r--sources/scalac/ast/parser/Parser.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/sources/scalac/ast/parser/Parser.java b/sources/scalac/ast/parser/Parser.java
index b5aa598f23..d5b3522367 100644
--- a/sources/scalac/ast/parser/Parser.java
+++ b/sources/scalac/ast/parser/Parser.java
@@ -1123,7 +1123,7 @@ public class Parser implements Tokens {
/** TreePattern ::= varid `:' Type1
* | `_' `:' Type1
* | SimplePattern [ '*' | '?' | '+' ]
- * | SimplePattern {Id SimplePattern}
+ * | SimplePattern {Id SimplePattern} // op2 must not be empty
*/
Tree treePattern() {
int base = sp;
@@ -1175,6 +1175,9 @@ public class Parser implements Tokens {
push(top, s.pos, s.name);
ident();
top = simplePattern();
+ if( TreeInfo.isEmptySequence( top ) ) {
+ syntaxError( top.pos, "empty sequence not allowed here", false);
+ }
}
return reduceStack(false, base, top, 0, true);
}