summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-03-16 10:00:17 -0700
committerPaul Phillips <paulp@improving.org>2012-03-16 10:00:17 -0700
commit87992a842e8c7bd1ee0e5acadefaf3e84848e835 (patch)
treeb4449c96378ad6a3f48ec7d59fc7f7aee31d4da2 /src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
parentf553ebb2dd0284805d8e49d48969ebde48ae2e25 (diff)
downloadscala-87992a842e8c7bd1ee0e5acadefaf3e84848e835.tar.gz
scala-87992a842e8c7bd1ee0e5acadefaf3e84848e835.tar.bz2
scala-87992a842e8c7bd1ee0e5acadefaf3e84848e835.zip
Revert "More uniformity for the parser."
This reverts commit f987afe55e6d4f71c7e9ad10d1ca9f6120dc1132. Looks like somebody misread the grammar. Look for it to return in one of paulp's exclusive branches for today's discriminating hacker.
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/parser/Parsers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala33
1 files changed, 9 insertions, 24 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index cd64c49b47..ccebcfa54d 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -126,7 +126,7 @@ self =>
val global: Global
import global._
- case class OpInfo(operand: Tree, operator: Name, targs: List[Tree], offset: Offset)
+ case class OpInfo(operand: Tree, operator: Name, offset: Offset)
class SourceFileParser(val source: SourceFile) extends Parser {
@@ -789,7 +789,7 @@ self =>
val rPos = top.pos
val end = if (rPos.isDefined) rPos.endOrPoint else opPos.endOrPoint
top = atPos(start, opinfo.offset, end) {
- makeBinop(isExpr, opinfo.operand, opinfo.operator, top, opPos, opinfo.targs)
+ makeBinop(isExpr, opinfo.operand, opinfo.operator, top, opPos)
}
}
top
@@ -1440,17 +1440,6 @@ self =>
}
}
- def advanceStack(base: List[OpInfo], top: Tree): Tree = {
- val newTop = reduceStack(true, base, top, precedence(in.name), treeInfo.isLeftAssoc(in.name))
- val op = in.name
- val pos = in.offset
- ident()
- val targs = if (in.token == LBRACKET) exprTypeArgs() else Nil
- opstack ::= OpInfo(newTop, op, targs, pos)
-
- newTop
- }
-
/** {{{
* PostfixExpr ::= InfixExpr [Id [nl]]
* InfixExpr ::= PrefixExpr
@@ -1462,21 +1451,22 @@ self =>
var top = prefixExpr()
while (isIdent) {
- top = advanceStack(base, top)
+ top = reduceStack(true, base, top, precedence(in.name), treeInfo.isLeftAssoc(in.name))
+ val op = in.name
+ opstack = OpInfo(top, op, in.offset) :: opstack
+ ident()
newLineOptWhenFollowing(isExprIntroToken)
-
if (isExprIntro) {
val next = prefixExpr()
if (next == EmptyTree)
return reduceStack(true, base, top, 0, true)
top = next
- }
- else {
+ } else {
val topinfo = opstack.head
opstack = opstack.tail
val od = stripParens(reduceStack(true, base, topinfo.operand, 0, true))
return atPos(od.pos.startOrPoint, topinfo.offset) {
- applyTypeArgs(Select(od, topinfo.operator.encode), topinfo.targs)
+ Select(od, topinfo.operator.encode)
}
}
}
@@ -1816,7 +1806,7 @@ self =>
top = reduceStack(
false, base, top, precedence(in.name), treeInfo.isLeftAssoc(in.name))
val op = in.name
- opstack = OpInfo(top, op, Nil, in.offset) :: opstack
+ opstack = OpInfo(top, op, in.offset) :: opstack
ident()
top = simplePattern()
}
@@ -1906,11 +1896,6 @@ self =>
def exprTypeArgs() = outPattern.typeArgs()
def exprSimpleType() = outPattern.simpleType()
- def applyTypeArgs(sel: Tree, targs: List[Tree]): Tree = (
- if (targs.isEmpty) sel
- else atPos(sel.pos)(TypeApply(sel, targs))
- )
-
/** Default entry points into some pattern contexts. */
def pattern(): Tree = noSeq.pattern()
def patterns(): List[Tree] = noSeq.patterns()