-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParser.hpp
More file actions
54 lines (38 loc) · 1.36 KB
/
Parser.hpp
File metadata and controls
54 lines (38 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef CMT_PARSER_PARSER_HPP
#define CMT_PARSER_PARSER_HPP
#include <string>
#include <vector>
#include <unordered_map>
#include <optional>
/* İleride kullanılabilir
enum class ParseResult {
IssueFound,
NoIssue,
ParseError
};
*/
struct Issue {
std::string function_name;
std::string issue_value;
};
class Parser {
public:
std::vector<Issue> parse_file(const std::string& file_path, const std::string& requirements_path);
private:
struct Function {
std::string name;
std::string return_type;
std::vector<std::string> parameters;
};
using CommentInfo = std::unordered_map<std::string, std::string>;
std::unordered_map<std::string, std::string> m_requirements_cache;
void cache_requirements(const std::string& requirements_path);
CommentInfo extract_comments(const std::vector<std::string>& comment_lines);
std::optional<Function> parse_function_signature(const std::string& signature);
std::vector<std::string> extract_parameters(const std::string& signature);
bool is_function_signature(const std::string& line);
bool is_keyword(const std::string& word);
bool requirements_match(const std::string& function_name, const std::string& requirement);
std::vector<Issue> compare_with_function(const CommentInfo& information, const Function& function);
};
#endif