tree-sitter/spec/runtime/helpers/tree_helpers.cc
Max Brunsfeld 63cde3967c Add unit test for stack
- Also, fix bug where trees pushed onto the stack were not retained
2014-06-03 13:19:49 -07:00

8 lines
263 B
C++

#include "helpers/tree_helpers.h"
ts_tree ** tree_array(std::vector<ts_tree *> trees) {
ts_tree ** result = (ts_tree **)calloc(trees.size(), sizeof(ts_tree *));
for (size_t i = 0; i < trees.size(); i++)
result[i] = trees[i];
return result;
}