1
1
mirror of https://github.com/github/semantic.git synced 2024-11-25 11:04:00 +03:00

use sepBy

This commit is contained in:
joshvera 2015-10-21 11:25:37 -04:00
parent 7f5d5d354d
commit 91c6ad085b

View File

@ -67,12 +67,7 @@ typealias ValuesParser = Parser<String, [CofreeJSON]>.Function;
func elements(json: JSONParser) -> ValuesParser {
let value: Parser<String, CofreeJSON>.Function = whitespace *> json <* whitespace
let separatedValues: ValuesParser = (%"," *> value)*
let oneOrMore: ValuesParser = curry { [$0] + $1 } <^>
value
<*> separatedValues
return oneOrMore <|> pure([])
return sepBy(value, %",")
}
let json: JSONParser = fix { json in