mirror of https://github.com/sbt/sbt.git
fix argument parsing, which unintentionally required two characters. ref #396
This commit is contained in:
parent
4e4937e706
commit
cf19af27dc
|
|
@ -43,6 +43,7 @@ trait Parsers
|
||||||
lazy val NotSpaceClass = charClass(!_.isWhitespace, "non-whitespace character")
|
lazy val NotSpaceClass = charClass(!_.isWhitespace, "non-whitespace character")
|
||||||
lazy val SpaceClass = charClass(_.isWhitespace, "whitespace character")
|
lazy val SpaceClass = charClass(_.isWhitespace, "whitespace character")
|
||||||
lazy val NotSpace = NotSpaceClass.+.string
|
lazy val NotSpace = NotSpaceClass.+.string
|
||||||
|
lazy val OptNotSpace = NotSpaceClass.*.string
|
||||||
lazy val Space = SpaceClass.+.examples(" ")
|
lazy val Space = SpaceClass.+.examples(" ")
|
||||||
lazy val OptSpace = SpaceClass.*.examples(" ")
|
lazy val OptSpace = SpaceClass.*.examples(" ")
|
||||||
lazy val URIClass = URIChar.+.string !!! "Invalid URI"
|
lazy val URIClass = URIChar.+.string !!! "Invalid URI"
|
||||||
|
|
@ -79,7 +80,7 @@ trait Parsers
|
||||||
'\"' ^^^ '\"' | '\'' ^^^ '\'' | '\\' ^^^ '\\' | UnicodeEscape)
|
'\"' ^^^ '\"' | '\'' ^^^ '\'' | '\\' ^^^ '\\' | UnicodeEscape)
|
||||||
lazy val UnicodeEscape: Parser[Char] =
|
lazy val UnicodeEscape: Parser[Char] =
|
||||||
("u" ~> repeat(HexDigit, 4, 4)) map { seq => Integer.parseInt(seq.mkString, 16).toChar }
|
("u" ~> repeat(HexDigit, 4, 4)) map { seq => Integer.parseInt(seq.mkString, 16).toChar }
|
||||||
lazy val NotQuoted = (NotDQuoteSpaceClass ~ NotSpace) map { case (c, s) => c.toString + s }
|
lazy val NotQuoted = (NotDQuoteSpaceClass ~ OptNotSpace) map { case (c, s) => c.toString + s }
|
||||||
|
|
||||||
def repsep[T](rep: Parser[T], sep: Parser[_]): Parser[Seq[T]] =
|
def repsep[T](rep: Parser[T], sep: Parser[_]): Parser[Seq[T]] =
|
||||||
rep1sep(rep, sep) ?? Nil
|
rep1sep(rep, sep) ?? Nil
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue