mirror of
https://github.com/github/semantic.git
synced 2024-12-26 16:33:03 +03:00
Extract the key/term parser.
This commit is contained in:
parent
c366e379a0
commit
3c203e8f43
@ -47,10 +47,11 @@ typealias MembersParser = Parser<String, [(String, CofreeJSON)]>.Function;
|
||||
|
||||
// Parses an array of (String, CofreeJSON) object members
|
||||
func members(json: JSONParser) -> MembersParser {
|
||||
let keyAndKeyTerm: Parser<String, (String, CofreeJSON)>.Function = quoted --> { (_, range, key) in
|
||||
(key, Cofree(range, .Leaf(.String(key))))
|
||||
}
|
||||
let pairs: Parser<String, (String, CofreeJSON)>.Function = (curry(pair) <^>
|
||||
(quoted --> { (_, range, key) -> (String, CofreeJSON) in
|
||||
return (key, Cofree(range, .Leaf(.String(key))))
|
||||
})
|
||||
keyAndKeyTerm
|
||||
<* whitespace
|
||||
<* %":"
|
||||
<* whitespace
|
||||
|
Loading…
Reference in New Issue
Block a user