Lines Matching refs:Regexp
10 #include "re2/regexp.h"
24 Regexp* re = Regexp::Parse("(\\d+)-(\\d+)-(\\d+)", Regexp::LikePerl, NULL);
42 const char* regexp = "(\\d+)-(\\d+)-(\\d+)";
46 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
50 fprintf(stderr, "Regexp: %7lld bytes (peak=%lld)\n", mc.HeapGrowth(), mc.PeakHeapGrowth());
69 PCRE re(regexp, PCRE::UTF8);
78 PCRE* re = new PCRE(regexp, PCRE::UTF8);
88 RE2 re(regexp);
105 typedef void SearchImpl(int iters, const char* regexp, const StringPiece& text,
113 typedef void ParseImpl(int iters, const char* regexp, const StringPiece& text);
133 // Benchmark: failed search for regexp in random text.
149 // the text for regexp iters times.
150 void Search(int iters, int nbytes, const char* regexp, SearchImpl* search) {
156 search(iters, regexp, s, Prog::kUnanchored, false);
243 string regexp = "^" + s + ".*$";
249 search(iters, regexp.c_str(), s, Prog::kUnanchored, true);
286 void SearchSuccess(int iters, int nbytes, const char* regexp, SearchImpl* search) {
290 search(iters, regexp, s, Prog::kAnchored, true);
344 // Benchmark: use regexp to find phone number.
371 // Benchmark: use regexp to parse digit fields in phone number.
488 // Benchmark: splitting off leading number field but harder (ambiguous regexp).
566 void ParseRegexp(int iters, const string& regexp) {
568 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
574 void SimplifyRegexp(int iters, const string& regexp) {
576 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
578 Regexp* sre = re->Simplify();
585 void NullWalkRegexp(int iters, const string& regexp) {
586 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
594 void SimplifyCompileRegexp(int iters, const string& regexp) {
596 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
598 Regexp* sre = re->Simplify();
608 void CompileRegexp(int iters, const string& regexp) {
610 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
619 void CompileToProg(int iters, const string& regexp) {
620 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
630 void CompileByteMap(int iters, const string& regexp) {
631 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
642 void CompilePCRE(int iters, const string& regexp) {
644 PCRE re(regexp, PCRE::UTF8);
649 void CompileRE2(int iters, const string& regexp) {
651 RE2 re(regexp);
656 void RunBuild(int iters, const string& regexp, void (*run)(int, const string&)) {
657 run(iters, regexp);
663 DEFINE_string(compile_regexp, "(.*)-(\\d+)-of-(\\d+)", "regexp for compile benchmarks");
691 // the text for regexp iters times.
797 // Runs implementation to search for regexp in text, iters times.
798 // Expect_match says whether the regexp should be found.
801 void SearchDFA(int iters, const char* regexp, const StringPiece& text,
804 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
818 void SearchNFA(int iters, const char* regexp, const StringPiece& text,
821 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
832 void SearchOnePass(int iters, const char* regexp, const StringPiece& text,
835 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
847 void SearchBitState(int iters, const char* regexp, const StringPiece& text,
850 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
861 void SearchPCRE(int iters, const char* regexp, const StringPiece& text,
864 PCRE re(regexp, PCRE::UTF8);
873 void SearchRE2(int iters, const char* regexp, const StringPiece& text,
876 RE2 re(regexp);
886 // regexp parsing and compiling once. This lets us measure
887 // search time without the per-regexp overhead.
889 void SearchCachedDFA(int iters, const char* regexp, const StringPiece& text,
891 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
906 void SearchCachedNFA(int iters, const char* regexp, const StringPiece& text,
908 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
920 void SearchCachedOnePass(int iters, const char* regexp, const StringPiece& text,
922 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
934 void SearchCachedBitState(int iters, const char* regexp, const StringPiece& text,
936 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
947 void SearchCachedPCRE(int iters, const char* regexp, const StringPiece& text,
949 PCRE re(regexp, PCRE::UTF8);
959 void SearchCachedRE2(int iters, const char* regexp, const StringPiece& text,
961 RE2 re(regexp);
972 // Runs implementation to full match regexp against text,
975 void Parse3NFA(int iters, const char* regexp, const StringPiece& text) {
977 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
988 void Parse3OnePass(int iters, const char* regexp, const StringPiece& text) {
990 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
1002 void Parse3BitState(int iters, const char* regexp, const StringPiece& text) {
1004 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
1015 void Parse3Backtrack(int iters, const char* regexp, const StringPiece& text) {
1017 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
1028 void Parse3PCRE(int iters, const char* regexp, const StringPiece& text) {
1030 PCRE re(regexp, PCRE::UTF8);
1037 void Parse3RE2(int iters, const char* regexp, const StringPiece& text) {
1039 RE2 re(regexp);
1046 void Parse3CachedNFA(int iters, const char* regexp, const StringPiece& text) {
1047 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
1059 void Parse3CachedOnePass(int iters, const char* regexp, const StringPiece& text) {
1060 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
1072 void Parse3CachedBitState(int iters, const char* regexp, const StringPiece& text) {
1073 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
1084 void Parse3CachedBacktrack(int iters, const char* regexp, const StringPiece& text) {
1085 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
1096 void Parse3CachedPCRE(int iters, const char* regexp, const StringPiece& text) {
1097 PCRE re(regexp, PCRE::UTF8);
1105 void Parse3CachedRE2(int iters, const char* regexp, const StringPiece& text) {
1106 RE2 re(regexp);
1115 // Runs implementation to full match regexp against text,
1118 void Parse1NFA(int iters, const char* regexp, const StringPiece& text) {
1120 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
1131 void Parse1OnePass(int iters, const char* regexp, const StringPiece& text) {
1133 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
1145 void Parse1BitState(int iters, const char* regexp, const StringPiece& text) {
1147 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
1158 void Parse1PCRE(int iters, const char* regexp, const StringPiece& text) {
1160 PCRE re(regexp, PCRE::UTF8);
1167 void Parse1RE2(int iters, const char* regexp, const StringPiece& text) {
1169 RE2 re(regexp);
1176 void Parse1CachedNFA(int iters, const char* regexp, const StringPiece& text) {
1177 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
1189 void Parse1CachedOnePass(int iters, const char* regexp, const StringPiece& text) {
1190 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
1202 void Parse1CachedBitState(int iters, const char* regexp, const StringPiece& text) {
1203 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
1214 void Parse1CachedBacktrack(int iters, const char* regexp, const StringPiece& text) {
1215 Regexp* re = Regexp::Parse(regexp, Regexp::LikePerl, NULL);
1226 void Parse1CachedPCRE(int iters, const char* regexp, const StringPiece& text) {
1227 PCRE re(regexp, PCRE::UTF8);
1235 void Parse1CachedRE2(int iters, const char* regexp, const StringPiece& text) {
1236 RE2 re(regexp);
1244 void SearchParse2CachedPCRE(int iters, const char* regexp,
1246 PCRE re(regexp, PCRE::UTF8);
1254 void SearchParse2CachedRE2(int iters, const char* regexp,
1256 RE2 re(regexp);
1264 void SearchParse1CachedPCRE(int iters, const char* regexp,
1266 PCRE re(regexp, PCRE::UTF8);
1274 void SearchParse1CachedRE2(int iters, const char* regexp,
1276 RE2 re(regexp);
1411 void FullMatchPCRE(int iter, int n, const char *regexp) {
1417 PCRE re(regexp);
1424 void FullMatchRE2(int iter, int n, const char *regexp) {
1430 RE2 re(regexp, RE2::Latin1);