1
我在讀sbt documentation on Commands,想知道^^^
和~>
是什麼意思?`^^^`和`〜>`是什麼意思?
我試圖谷歌,但沒有發現,這些字符是由谷歌躲過我猜......非常感謝
// Demonstration of a custom parser.
// The command changes the foreground or background terminal color
// according to the input.
lazy val change = Space ~> (reset | setColor)
lazy val reset = token("reset" ^^^ "\033[0m")
lazy val color = token(Space ~> ("blue" ^^^ "4" | "green" ^^^ "2"))
lazy val select = token("fg" ^^^ "3" | "bg" ^^^ "4")
lazy val setColor = (select ~ color) map { case (g, c) => "\033[" + g + c + "m" }
def changeColor = Command("color")(_ => change) { (state, ansicode) =>
print(ansicode)
state
}
完整的代碼爲例project/CommandExample.scala
在http://www.scala-sbt.org/0.13/docs/Commands.html
謝謝,正是我在找的:) – keypoint