mirror of
https://github.com/github/semantic.git
synced 2024-11-25 11:04:00 +03:00
use sepBy
This commit is contained in:
parent
7f5d5d354d
commit
91c6ad085b
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user