2015-11-25 00:39:20 +03:00
|
|
|
#include "bridge.h"
|
2015-11-25 23:01:27 +03:00
|
|
|
#include <assert.h>
|
2015-11-26 02:30:21 +03:00
|
|
|
#include <stdio.h>
|
2015-11-25 00:39:20 +03:00
|
|
|
|
|
|
|
void ts_document_root_node_p(TSDocument *document, TSNode *outNode) {
|
2015-11-25 23:01:27 +03:00
|
|
|
assert(document != NULL);
|
|
|
|
assert(outNode != NULL);
|
2015-11-25 00:39:20 +03:00
|
|
|
*outNode = ts_document_root_node(document);
|
|
|
|
}
|
2015-11-25 18:08:16 +03:00
|
|
|
|
2015-11-26 02:38:29 +03:00
|
|
|
TSLanguage *ts_language_c_use() {
|
|
|
|
return ts_language_c();
|
|
|
|
}
|
2015-11-25 20:21:47 +03:00
|
|
|
|
2015-11-25 18:08:16 +03:00
|
|
|
const char *ts_node_p_name(const TSNode *node, const TSDocument *document) {
|
2015-11-25 23:01:27 +03:00
|
|
|
assert(node != NULL);
|
2015-11-26 01:02:06 +03:00
|
|
|
assert(node->data != NULL);
|
2015-11-25 23:01:27 +03:00
|
|
|
assert(document != NULL);
|
2015-11-25 18:08:16 +03:00
|
|
|
return ts_node_name(*node, document);
|
|
|
|
}
|
2015-11-25 19:42:31 +03:00
|
|
|
|
2015-11-25 20:21:47 +03:00
|
|
|
|
2015-11-25 19:42:31 +03:00
|
|
|
size_t ts_node_p_named_child_count(const TSNode *node) {
|
2015-11-25 23:01:27 +03:00
|
|
|
assert(node != NULL);
|
2015-11-26 01:02:06 +03:00
|
|
|
assert(node->data != NULL);
|
2015-11-25 19:42:31 +03:00
|
|
|
return ts_node_named_child_count(*node);
|
|
|
|
}
|
2015-11-25 19:46:34 +03:00
|
|
|
|
|
|
|
void ts_node_p_named_child(const TSNode *node, size_t index, TSNode *outNode) {
|
2015-11-25 23:01:27 +03:00
|
|
|
assert(node != NULL);
|
2015-11-26 01:02:06 +03:00
|
|
|
assert(node->data != NULL);
|
2015-11-25 23:01:27 +03:00
|
|
|
assert(outNode != NULL);
|
2015-11-26 02:30:21 +03:00
|
|
|
TSNode temp = ts_node_named_child(*node, index);
|
|
|
|
if (temp.data == NULL) {
|
|
|
|
printf("got broken child for index %ld\n", index);
|
|
|
|
}
|
|
|
|
assert(temp.data != NULL);
|
|
|
|
*outNode = temp;
|
2015-11-25 19:46:34 +03:00
|
|
|
}
|
2015-11-25 20:21:47 +03:00
|
|
|
|
|
|
|
|
2015-11-25 20:50:22 +03:00
|
|
|
size_t ts_node_p_pos_chars(const TSNode *node) {
|
2015-11-25 23:01:27 +03:00
|
|
|
assert(node != NULL);
|
2015-11-26 01:02:06 +03:00
|
|
|
assert(node->data != NULL);
|
2015-11-25 20:50:22 +03:00
|
|
|
return ts_node_pos(*node).chars;
|
2015-11-25 20:21:47 +03:00
|
|
|
}
|
2015-11-25 20:22:21 +03:00
|
|
|
|
2015-11-25 20:50:22 +03:00
|
|
|
size_t ts_node_p_size_chars(const TSNode *node) {
|
2015-11-25 23:01:27 +03:00
|
|
|
assert(node != NULL);
|
2015-11-26 01:02:06 +03:00
|
|
|
assert(node->data != NULL);
|
2015-11-25 20:50:22 +03:00
|
|
|
return ts_node_size(*node).chars;
|
2015-11-25 20:22:21 +03:00
|
|
|
}
|
2015-12-01 22:59:29 +03:00
|
|
|
|
|
|
|
size_t ts_node_p_start_point(const TSNode *node) {
|
|
|
|
assert(node != NULL);
|
|
|
|
assert(node->data != NULL);
|
|
|
|
return ts_node_start_point(*node).row;
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t ts_node_p_end_point(const TSNode *node) {
|
|
|
|
assert(node != NULL);
|
|
|
|
assert(node->data != NULL);
|
|
|
|
return ts_node_end_point(*node).row;
|
|
|
|
}
|