mirror of https://github.com/sbt/sbt.git
fix 'not' parser combinator, add EOF
This commit is contained in:
parent
0ff6b65376
commit
a9ccd74eb8
|
|
@ -345,7 +345,10 @@ trait ParserMain
|
|||
else
|
||||
b
|
||||
|
||||
def not(p: Parser[_]): Parser[Unit] = new Not(p)
|
||||
def not(p: Parser[_]): Parser[Unit] = p.result match {
|
||||
case None => new Not(p)
|
||||
case Some(_) => failure("Excluded.")
|
||||
}
|
||||
|
||||
def oneOf[T](p: Seq[Parser[T]]): Parser[T] = p.reduceLeft(_ | _)
|
||||
def seq[T](p: Seq[Parser[T]]): Parser[Seq[T]] = seq0(p, Nil)
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ package sbt.complete
|
|||
// Some predefined parsers
|
||||
trait Parsers
|
||||
{
|
||||
lazy val EOF = not(any)
|
||||
|
||||
lazy val any: Parser[Char] = charClass(_ => true, "any character")
|
||||
|
||||
lazy val DigitSet = Set("0","1","2","3","4","5","6","7","8","9")
|
||||
|
|
|
|||
Loading…
Reference in New Issue