1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 23:42:31 +03:00

Handle pairs as Fixed.

This commit is contained in:
Rob Rix 2015-10-28 16:20:39 -04:00
parent 9d52d02214
commit cdca67f8eb

View File

@ -79,6 +79,12 @@ func termWithInput(string: String) -> Term? {
let count = node.namedChildren.count
guard count > 0 else { return Syntax.Leaf(category.rawValue) }
switch category {
case .Pair:
return try .Fixed(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 ($0, category)
})
case .Object:
return try .Keyed(Dictionary(elements: node.namedChildren.map {
guard let name = String.fromCString(ts_node_name($0, document)) else { throw E() }