summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2007-07-23 18:22:29 +0000
committerMartin Odersky <odersky@gmail.com>2007-07-23 18:22:29 +0000
commit16d3cf1f8f22c04559145b35bb5f6c0aacfb0d8c (patch)
tree75b5420467e9dae2ef88d6a4aca220b0f907fa2f /src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
parent2d3a640e0bff8c79f99c070cf33f9ef921642a18 (diff)
downloadscala-16d3cf1f8f22c04559145b35bb5f6c0aacfb0d8c.tar.gz
scala-16d3cf1f8f22c04559145b35bb5f6c0aacfb0d8c.tar.bz2
scala-16d3cf1f8f22c04559145b35bb5f6c0aacfb0d8c.zip
many bug fixes; short syntax for structural types.
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/parser/Parsers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index c0cefd5347..68a34def62 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -722,7 +722,10 @@ trait Parsers {
/** InfixType ::= CompoundType {id [nl] CompoundType}
*/
def infixType(isPattern: Boolean, mode: Int): Tree =
- infixTypeRest(inCurrentPos, annotType(isPattern), isPattern, mode)
+ infixTypeRest(inCurrentPos, infixTypeFirst(isPattern), isPattern, mode)
+
+ def infixTypeFirst(isPattern: boolean) =
+ if (inToken == LBRACE) scalaAnyRefConstr else annotType(isPattern)
def infixTypeRest(pos: ScanPosition, t0: Tree, isPattern: Boolean, mode: Int): Tree = {
val t = compoundTypeRest(pos, t0, isPattern)
@@ -742,9 +745,10 @@ trait Parsers {
}
/** CompoundType ::= AnnotType {with AnnotType} [Refinement]
+ * | Refinement
*/
def compoundType(isPattern: Boolean): Tree =
- compoundTypeRest(inCurrentPos, annotType(isPattern), isPattern)
+ compoundTypeRest(inCurrentPos, infixTypeFirst(isPattern), isPattern)
def compoundTypeRest(pos: ScanPosition, t: Tree, isPattern: Boolean): Tree = {
var ts = new ListBuffer[Tree] + t
@@ -1129,7 +1133,7 @@ trait Parsers {
}
}
- /* SimpleExpr ::= new ClassTemplate
+ /* SimpleExpr ::= new (ClassTemplate | TemplateBody)
* | BlockExpr
* | SimpleExpr1 [`_']
* SimpleExpr1 ::= literal