mirror of
https://github.com/github/semantic.git
synced 2024-11-24 17:04:47 +03:00
Construct a leaf term.
This commit is contained in:
parent
5883a4bc8a
commit
ac2a12a03f
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user