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.
1
#include <
arkanjo/parser/feature_extractor.hpp
>
2
3
bool
FeatureExtractor::is_lexical_node
(std::string_view type) {
4
for
(
auto
& n : NODES)
5
if
(n == type)
return
true
;
6
return
false
;
7
}
8
9
bool
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
15
bool
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
21
std::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
}
FeatureExtractor::get_node_text
static std::string get_node_text(TSNode node, const std::string &source)
Definition
feature_extractor.cpp:21
FeatureExtractor::is_lexical_node
static bool is_lexical_node(std::string_view type)
Definition
feature_extractor.cpp:3
FeatureExtractor::is_block_node
static bool is_block_node(std::string_view type)
Definition
feature_extractor.cpp:9
FeatureExtractor::is_function_node
static bool is_function_node(std::string_view type)
Definition
feature_extractor.cpp:15
feature_extractor.hpp
src
parser
feature_extractor.cpp
Generated by
1.12.0