summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2007-02-14 13:37:19 +0000
committerMartin Odersky <odersky@gmail.com>2007-02-14 13:37:19 +0000
commit979180ca5f30752d94d64b083b6dbca57dab0c4b (patch)
tree5566e84f9803ef46fd9a24fb1e451babec53190c /src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
parente5b3a8a6b49dd4ab333781e3e7ce595ba14b06eb (diff)
downloadscala-979180ca5f30752d94d64b083b6dbca57dab0c4b.tar.gz
scala-979180ca5f30752d94d64b083b6dbca57dab0c4b.tar.bz2
scala-979180ca5f30752d94d64b083b6dbca57dab0c4b.zip
more changes to make tuples (...)
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/parser/Parsers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index dfbc330145..18980a9437 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -801,7 +801,7 @@ trait Parsers requires SyntaxAnalyzer {
* | throw Expr
* | return [Expr]
* | [SimpleExpr `.'] Id `=' Expr
- * | SimpleExpr ArgumentExprs `=' Expr
+ * | SimpleExpr1 ArgumentExprs `=' Expr
* | `.' SimpleExpr
* | PostfixExpr [`:' (CompoundType | `_' `*')]
* | PostfixExpr match [`!'] `{' CaseClauses `}'
@@ -1006,21 +1006,20 @@ trait Parsers requires SyntaxAnalyzer {
}
/* SimpleExpr ::= new SimpleType {`(' [Exprs] `)'} {`with' SimpleType} [TemplateBody]
+ * | BlockExpr
* | SimpleExpr1
* SimpleExpr1 ::= literal
* | xLiteral
* | Path
* | StableId `.' class
* | `(' [Expr] `)'
- * | BlockExpr
- * | new Template
* | SimpleExpr `.' Id
* | SimpleExpr TypeArgs
* | SimpleExpr1 ArgumentExprs
*/
def simpleExpr(): Tree = {
var t: Tree = null
- var isNew = false
+ var canApply = true
in.token match {
case CHARLIT | INTLIT | LONGLIT | FLOATLIT | DOUBLELIT | STRINGLIT |
SYMBOLLIT | TRUE | FALSE | NULL =>
@@ -1036,6 +1035,7 @@ trait Parsers requires SyntaxAnalyzer {
t = Parens(ts)
case LBRACE =>
t = blockExpr()
+ canApply = false
case NEW =>
t = atPos(in.skipToken()) {
val parents = new ListBuffer[Tree] + simpleType(false)
@@ -1050,7 +1050,7 @@ trait Parsers requires SyntaxAnalyzer {
val stats = if (in.token == LBRACE) templateBody() else List()
makeNew(parents.toList, stats, argss.toList)
}
- isNew = true
+ canApply = false
case _ =>
if (settings.migrate.value) {
if (in.token == MATCH)
@@ -1061,21 +1061,21 @@ trait Parsers requires SyntaxAnalyzer {
syntaxErrorOrIncomplete("illegal start of simple expression", true)
t = errorTermTree
}
- simpleExprRest(t, isNew)
+ simpleExprRest(t, canApply)
}
- def simpleExprRest(t: Tree, isNew: boolean): Tree = in.token match {
+ def simpleExprRest(t: Tree, canApply: boolean): Tree = in.token match {
case DOT =>
- simpleExprRest(atPos(in.skipToken()) { selector(stripParens(t)) }, false)
+ simpleExprRest(atPos(in.skipToken()) { selector(stripParens(t)) }, true)
case LBRACKET =>
t match {
case Ident(_) | Select(_, _) =>
- simpleExprRest(atPos(in.currentPos) { TypeApply(t, typeArgs(false)) }, false)
+ simpleExprRest(atPos(in.currentPos) { TypeApply(t, typeArgs(false)) }, true)
case _ =>
t
}
- case LPAREN | LBRACE if (!isNew) =>
- simpleExprRest(atPos(in.currentPos) { Apply(stripParens(t), argumentExprs()) }, false)
+ case LPAREN | LBRACE if (canApply) =>
+ simpleExprRest(atPos(in.currentPos) { Apply(stripParens(t), argumentExprs()) }, true)
case _ =>
t
}