mirror of https://github.com/sbt/sbt.git
return position at which parsing fails
This commit is contained in:
parent
a6df926d41
commit
5d74d2d985
|
|
@ -214,19 +214,18 @@ trait ParserMain
|
||||||
// intended to be temporary pending proper error feedback
|
// intended to be temporary pending proper error feedback
|
||||||
def result[T](p: Parser[T], s: String): Either[(String,Int), T] =
|
def result[T](p: Parser[T], s: String): Either[(String,Int), T] =
|
||||||
{
|
{
|
||||||
/* def loop(i: Int, a: Parser[T]): Either[(String,Int), T] =
|
def loop(i: Int, a: Parser[T]): Either[(String,Int), T] =
|
||||||
a.err match
|
if(a.valid)
|
||||||
{
|
{
|
||||||
case Some(msg) => Left((msg, i))
|
val ci = i+1
|
||||||
case None =>
|
if(ci >= s.length)
|
||||||
val ci = i+1
|
a.resultEmpty.toRight(("Unexpected end of input", ci))
|
||||||
if(ci >= s.length)
|
else
|
||||||
a.resultEmpty.toRight(("", i))
|
loop(ci, a derive s(ci) )
|
||||||
else
|
|
||||||
loop(ci, a derive s(ci))
|
|
||||||
}
|
}
|
||||||
loop(-1, p)*/
|
else
|
||||||
apply(p)(s).resultEmpty.toRight(("Parse error", 0))
|
Left(("Parse error",i))
|
||||||
|
loop(-1, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
def apply[T](p: Parser[T])(s: String): Parser[T] =
|
def apply[T](p: Parser[T])(s: String): Parser[T] =
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue