mirror of
https://github.com/github/semantic.git
synced 2024-12-24 23:42:31 +03:00
Map over the named child collection.
This commit is contained in:
parent
5532001d94
commit
156fb463f9
@ -80,11 +80,10 @@ func termWithInput(string: String) -> Term? {
|
||||
guard count > 0 else { return Syntax.Leaf(category.rawValue) }
|
||||
switch category {
|
||||
default:
|
||||
return try .Indexed((0..<count).map { index in
|
||||
let child = ts_node_named_child(node, index)
|
||||
guard let name = String.fromCString(ts_node_name(child, document)) else { throw E() }
|
||||
return try .Indexed(node.namedChildren.map {
|
||||
guard let name = String.fromCString(ts_node_name($0, document)) else { throw E() }
|
||||
guard let category = Info.Category(rawValue: name) else { throw E() }
|
||||
return (child, category)
|
||||
return ($0, category)
|
||||
})
|
||||
}
|
||||
} (root, Info.Category.Program)
|
||||
|
Loading…
Reference in New Issue
Block a user