diff options
author | Martin Odersky <odersky@gmail.com> | 2007-02-16 12:02:06 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2007-02-16 12:02:06 +0000 |
commit | 6e23c62953e97277b3e912b81da37fd64556221b (patch) | |
tree | 092ff3ea3b46da7dd3aafb3aed9837b213cec520 /src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | |
parent | 5c8c46664d780041be192f6bba7ce44875d8e9e1 (diff) | |
download | scala-6e23c62953e97277b3e912b81da37fd64556221b.tar.gz scala-6e23c62953e97277b3e912b81da37fd64556221b.tar.bz2 scala-6e23c62953e97277b3e912b81da37fd64556221b.zip |
fixed unary_ops
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/parser/Parsers.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | 8 |
1 files changed, 5 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 4f6b9cec26..716e71a907 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -986,16 +986,17 @@ trait Parsers requires SyntaxAnalyzer { /** PrefixExpr ::= [`-' | `+' | `~' | `!' | `&'] SimpleExpr */ - def prefixExpr(): Tree = + def prefixExpr(): Tree = { + def unaryOp(): Name = "unary_" + ident() if (isIdent && in.name == MINUS) { - val name = ident() + val name = unaryOp() in.token match { case INTLIT | LONGLIT | FLOATLIT | DOUBLELIT => literal(false, true) case _ => atPos(in.currentPos) { Select(stripParens(simpleExpr()), name) } } } else if (isIdent && (in.name == PLUS || in.name == TILDE || in.name == BANG)) { val pos = in.currentPos - val name = ident() + val name = unaryOp() atPos(pos) { Select(stripParens(simpleExpr()), name) } } else if (isIdent && in.name == AMP) { val pos = in.currentPos @@ -1011,6 +1012,7 @@ trait Parsers requires SyntaxAnalyzer { } else { simpleExpr() } + } /* SimpleExpr ::= new AnnotType {`(' [Exprs [`,']] `)'} {`with' AnnotType} [TemplateBody] * | BlockExpr |