forked from csutils/csdiff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparser-common.hh
56 lines (45 loc) · 1.88 KB
/
parser-common.hh
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
55
56
/*
* Copyright (C) 2011-2020 Red Hat, Inc.
*
* This file is part of csdiff.
*
* csdiff is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* csdiff is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with csdiff. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef H_GUARD_PARSER_COMMON_H
#define H_GUARD_PARSER_COMMON_H
#include "defect.hh"
#include <string>
#define RE_CHECKER_NAME_SA "(?:[A-Za-z][0-9A-Za-z_.]+)"
#define RE_CHECKER_NAME_CERT "(?:CERT [0-9A-Z-]+-C)"
#define RE_CHECKER_NAME_MISRA "(?:MISRA C(?:\\+\\+)?-[0-9]+ (?:Directive|Rule) [0-9.-]+)"
#define RE_CHECKER_NAME RE_CHECKER_NAME_SA "|" RE_CHECKER_NAME_CERT "|" RE_CHECKER_NAME_MISRA
#define RE_PATH_LOCAL "[^:]+"
#define RE_PATH_URL "http(?:s)?://[^:]+(?::[0-9]+)?[^:]+"
#define RE_PATH RE_PATH_LOCAL "|" RE_PATH_URL
#define RE_EVENT_GCC "(?:(?:(?:fatal|internal|runtime) )?[A-Za-z][A-Za-z0-9_-]+)(?:\\[[^ \\]]+\\])?"
#define RE_EVENT_PROSPECTOR "(?:[A-Z]+[0-9]+\\[[a-z0-9-]+\\])"
#define RE_EVENT_SIGMA "(?:Sigma (?:main )?event)"
#define RE_EVENT RE_EVENT_GCC "|" RE_EVENT_PROSPECTOR "|" RE_EVENT_SIGMA
int parseInt(const std::string &, int fallback = 0);
class ImpliedAttrDigger {
public:
ImpliedAttrDigger();
~ImpliedAttrDigger();
void inferLangFromChecker(Defect *, bool onlyIfMissing = true) const;
void inferToolFromChecker(Defect *, bool onlyIfMissing = true) const;
private:
struct Private;
Private *d;
};
#endif /* H_GUARD_PARSER_COMMON_H */