ArKanjo 0.2
A tool for find code duplicated functions in codebases
Loading...
Searching...
No Matches
feature_extractor.cpp
Go to the documentation of this file.
2
3bool FeatureExtractor::is_lexical_node(std::string_view type) {
4 for (auto& n : NODES)
5 if (n == type) return true;
6 return false;
7}
8
9bool FeatureExtractor::is_block_node(std::string_view type) {
10 for (auto& n : BLOCK_NODES)
11 if (n == type) return true;
12 return false;
13}
14
15bool FeatureExtractor::is_function_node(std::string_view type) {
16 for (auto& n : FUNCTION_NODES)
17 if (n == type) return true;
18 return false;
19}
20
21std::string FeatureExtractor::get_node_text(TSNode node, const std::string& source) {
22 uint32_t start = ts_node_start_byte(node);
23 uint32_t end = ts_node_end_byte(node);
24
25 return source.substr(start, end - start);
26}
static std::string get_node_text(TSNode node, const std::string &source)
static bool is_lexical_node(std::string_view type)
static bool is_block_node(std::string_view type)
static bool is_function_node(std::string_view type)