Applied second patch by asloane. closes #3969. no review

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@24457 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
plocinic 2011-03-14 20:24:57 +00:00
parent 3a5035f677
commit 8c49e09c04
1 changed files with 6 additions and 3 deletions

View File

@ -45,8 +45,10 @@ trait RegexParsers extends Parsers {
}
if (i == s.length)
Success(source.subSequence(start, j).toString, in.drop(j - offset))
else
Failure("`"+s+"' expected but `"+in.first+"' found", in.drop(start - offset))
else {
val found = if (start == source.length()) "end of source" else "`"+source.charAt(start)+"'"
Failure("`"+s+"' expected but "+found+" found", in.drop(start - offset))
}
}
}
@ -61,7 +63,8 @@ trait RegexParsers extends Parsers {
Success(source.subSequence(start, start + matched.end).toString,
in.drop(start + matched.end - offset))
case None =>
Failure("string matching regex `"+r+"' expected but `"+in.first+"' found", in.drop(start - offset))
val found = if (start == source.length()) "end of source" else "`"+source.charAt(start)+"'"
Failure("string matching regex `"+r+"' expected but "+found+" found", in.drop(start - offset))
}
}
}