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

Construct a leaf term.

This commit is contained in:
Rob Rix 2015-10-27 18:07:00 -04:00
parent 5883a4bc8a
commit ac2a12a03f

View File

@ -39,6 +39,14 @@ if let a = arguments[1] {
ts_document_set_input(document, a)
ts_document_parse(document)
let root = ts_document_root_node(document)
print(String.fromCString(ts_node_name(root, document)))
print(Cofree<String, TSNode>.ana { node in
let count = ts_node_child_count(node)
if count == 0 {
return String.fromCString(ts_node_string(node, document)).map(Syntax.Leaf)!
}
return String.fromCString(ts_node_string(node, document)).map(Syntax.Leaf)!
} (root))
ts_document_free(document)
}