aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/parsing/Parsers.scala
diff options
context:
space:
mode:
authorodersky <odersky@gmail.com>2016-03-22 14:08:43 +0100
committerodersky <odersky@gmail.com>2016-03-22 14:08:43 +0100
commit552a56ae8573f1c08175b3211afa7e414bee681b (patch)
tree8313a79ea1244780aea013836bef029e23973296 /src/dotty/tools/dotc/parsing/Parsers.scala
parentfadcf44be1a8db931f86a28bcdd54e49bd8741da (diff)
parent7e7058a22fcf8806e718bbba94080935a44ece0c (diff)
downloaddotty-552a56ae8573f1c08175b3211afa7e414bee681b.tar.gz
dotty-552a56ae8573f1c08175b3211afa7e414bee681b.tar.bz2
dotty-552a56ae8573f1c08175b3211afa7e414bee681b.zip
Merge pull request #1184 from liufengyun/error-pos
better positioning of `_*` not last argument error
Diffstat (limited to 'src/dotty/tools/dotc/parsing/Parsers.scala')
-rw-r--r--src/dotty/tools/dotc/parsing/Parsers.scala6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/parsing/Parsers.scala b/src/dotty/tools/dotc/parsing/Parsers.scala
index ea9da8db9..44a70886e 100644
--- a/src/dotty/tools/dotc/parsing/Parsers.scala
+++ b/src/dotty/tools/dotc/parsing/Parsers.scala
@@ -227,6 +227,8 @@ object Parsers {
/** Consume one token of the specified type, or
* signal an error if it is not there.
+ *
+ * @return The offset at the start of the token to accept
*/
def accept(token: Int): Int = {
val offset = in.offset
@@ -234,7 +236,7 @@ object Parsers {
syntaxErrorOrIncomplete(expectedMsg(token))
}
if (in.token == token) in.nextToken()
- in.offset
+ offset
}
/** semi = nl {nl} | `;'
@@ -1019,7 +1021,7 @@ object Parsers {
val uscoreStart = in.skipToken()
if (isIdent(nme.raw.STAR)) {
in.nextToken()
- if (in.token != RPAREN) syntaxError("`_*' can be used only for last argument")
+ if (in.token != RPAREN) syntaxError("`_*' can be used only for last argument", uscoreStart)
Typed(t, atPos(uscoreStart) { Ident(tpnme.WILDCARD_STAR) })
} else {
syntaxErrorOrIncomplete("`*' expected"); t