comparison include/llvm/Support/Regex.h @ 148:63bd29f05246

merged
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 14 Aug 2019 19:46:37 +0900
parents c2174574ed3a
children
comparison
equal deleted inserted replaced
146:3fc4d5c3e21e 148:63bd29f05246
1 //===-- Regex.h - Regular Expression matcher implementation -*- C++ -*-----===// 1 //===-- Regex.h - Regular Expression matcher implementation -*- C++ -*-----===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // 4 // See https://llvm.org/LICENSE.txt for license information.
5 // This file is distributed under the University of Illinois Open Source 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 // License. See LICENSE.TXT for details.
7 // 6 //
8 //===----------------------------------------------------------------------===// 7 //===----------------------------------------------------------------------===//
9 // 8 //
10 // This file implements a POSIX regular expression matcher. Both Basic and 9 // This file implements a POSIX regular expression matcher. Both Basic and
11 // Extended POSIX regular expressions (ERE) are supported. EREs were extended 10 // Extended POSIX regular expressions (ERE) are supported. EREs were extended
84 /// backreferences, trailing backslashes) will be recorded as a non-empty 83 /// backreferences, trailing backslashes) will be recorded as a non-empty
85 /// string. 84 /// string.
86 std::string sub(StringRef Repl, StringRef String, 85 std::string sub(StringRef Repl, StringRef String,
87 std::string *Error = nullptr); 86 std::string *Error = nullptr);
88 87
89 /// \brief If this function returns true, ^Str$ is an extended regular 88 /// If this function returns true, ^Str$ is an extended regular
90 /// expression that matches Str and only Str. 89 /// expression that matches Str and only Str.
91 static bool isLiteralERE(StringRef Str); 90 static bool isLiteralERE(StringRef Str);
92 91
93 /// \brief Turn String into a regex by escaping its special characters. 92 /// Turn String into a regex by escaping its special characters.
94 static std::string escape(StringRef String); 93 static std::string escape(StringRef String);
95 94
96 private: 95 private:
97 struct llvm_regex *preg; 96 struct llvm_regex *preg;
98 int error; 97 int error;