mirror of https://github.com/sbt/sbt.git
session manipulation commands
save, clear, list, and remove session settings
This commit is contained in:
parent
536e95cca5
commit
8183b717dd
|
|
@ -39,9 +39,13 @@ trait Parsers
|
|||
|
||||
lazy val Port = token(IntBasic, "<port>")
|
||||
lazy val IntBasic = mapOrFail( '-'.? ~ Digit.+ )( Function.tupled(toInt) )
|
||||
lazy val NatBasic = mapOrFail( Digit.+ )( _.mkString.toInt )
|
||||
private[this] def toInt(neg: Option[Char], digits: Seq[Char]): Int =
|
||||
(neg.toSeq ++ digits).mkString.toInt
|
||||
|
||||
def rep1sep[T](rep: Parser[T], sep: Parser[_]): Parser[Seq[T]] =
|
||||
(rep ~ (sep ~> rep).*).map { case (x ~ xs) => x +: xs }
|
||||
|
||||
def mapOrFail[S,T](p: Parser[S])(f: S => T): Parser[T] =
|
||||
p flatMap { s => try { success(f(s)) } catch { case e: Exception => failure(e.toString) } }
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue