Weitere ähnliche Inhalte
Ähnlich wie 轻量级文本工具集 (20)
Kürzlich hochgeladen (20)
轻量级文本工具集
- 5. do {
$ <- try <|> try <|> try <|> return
$ <- try <|> try <|> try <|> return
$ <- (Levenshtein Distance )
}
- 6. def order(content):
st = BasicState(content)
recipe = choices(attempt(string(" ")).then(pack((" ", today()))),
attempt(string(" ")).then(pack((" ", tommorrow()))),
attempt(string(" ")).then(pack((" ", after_tommorrow()))),
pack((" ", today())))
time = choices(attempt(string(" ")), attempt(string(" ")),
attempt(string(" ")), pack(" "))
order_one = many(one).over(eof)
…
- 7. …
@Parsec
def helper(state):
day, rcp = recipe(state)
skip(space)(state)
t = time(state)
skip(space)(state)
word = "".join(order_one(state)).rstrip()
item = request(rcp, word)
return day, t, item
return helper(st)