forked from include-what-you-use/include-what-you-use
-
Notifications
You must be signed in to change notification settings - Fork 6
/
iwyu_regex.h
34 lines (25 loc) · 1.16 KB
/
iwyu_regex.h
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
//===--- iwyu_regex.h - iwyu regex implementation -------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef INCLUDE_WHAT_YOU_USE_IWYU_REGEX_H_
#define INCLUDE_WHAT_YOU_USE_IWYU_REGEX_H_
#include <string>
namespace include_what_you_use {
enum class RegexDialect { LLVM = 0, ECMAScript = 1 };
// Parse dialect string to enum.
bool ParseRegexDialect(const char* str, RegexDialect* dialect);
// Returns true if str matches regular expression pattern for the given dialect.
bool RegexMatch(RegexDialect dialect, const std::string& str,
const std::string& pattern);
// Returns input string with the first match of pattern replaced, for the given
// regex dialect.
std::string RegexReplace(RegexDialect dialect, const std::string& str,
const std::string& pattern,
const std::string& replacement);
} // namespace include_what_you_use
#endif // INCLUDE_WHAT_YOU_USE_IWYU_REGEX_H_