OLD | NEW |
1 // Copyright 2008 The RE2 Authors. All Rights Reserved. | 1 // Copyright 2008 The RE2 Authors. All Rights Reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // Regular expression generator: generates all possible | 5 // Regular expression generator: generates all possible |
6 // regular expressions within given parameters (see below for details). | 6 // regular expressions within given parameters (see below for details). |
7 | 7 |
8 #ifndef RE2_TESTING_REGEXP_GENERATOR_H__ | 8 #ifndef RE2_TESTING_REGEXP_GENERATOR_H__ |
9 #define RE2_TESTING_REGEXP_GENERATOR_H__ | 9 #define RE2_TESTING_REGEXP_GENERATOR_H__ |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 private: | 46 private: |
47 void RunPostfix(const vector<string>& post); | 47 void RunPostfix(const vector<string>& post); |
48 void GeneratePostfix(vector<string>* post, int nstk, int ops, int lits); | 48 void GeneratePostfix(vector<string>* post, int nstk, int ops, int lits); |
49 bool GenerateRandomPostfix(vector<string>* post, int nstk, int ops, int lits); | 49 bool GenerateRandomPostfix(vector<string>* post, int nstk, int ops, int lits); |
50 | 50 |
51 int maxatoms_; // Maximum number of atoms allowed in expr. | 51 int maxatoms_; // Maximum number of atoms allowed in expr. |
52 int maxops_; // Maximum number of ops allowed in expr. | 52 int maxops_; // Maximum number of ops allowed in expr. |
53 vector<string> atoms_; // Possible atoms. | 53 vector<string> atoms_; // Possible atoms. |
54 vector<string> ops_; // Possible ops. | 54 vector<string> ops_; // Possible ops. |
55 ACMRandom* acm_; // Random generator. | 55 ACMRandom* acm_; // Random generator. |
56 DISALLOW_EVIL_CONSTRUCTORS(RegexpGenerator); | 56 DISALLOW_COPY_AND_ASSIGN(RegexpGenerator); |
57 }; | 57 }; |
58 | 58 |
59 // Helpers for preparing arguments to RegexpGenerator constructor. | 59 // Helpers for preparing arguments to RegexpGenerator constructor. |
60 | 60 |
61 // Returns one string for each character in s. | 61 // Returns one string for each character in s. |
62 vector<string> Explode(const StringPiece& s); | 62 vector<string> Explode(const StringPiece& s); |
63 | 63 |
64 // Splits string everywhere sep is found, returning | 64 // Splits string everywhere sep is found, returning |
65 // vector of pieces. | 65 // vector of pieces. |
66 vector<string> Split(const StringPiece& sep, const StringPiece& s); | 66 vector<string> Split(const StringPiece& sep, const StringPiece& s); |
67 | 67 |
68 } // namespace re2 | 68 } // namespace re2 |
69 | 69 |
70 #endif // RE2_TESTING_REGEXP_GENERATOR_H__ | 70 #endif // RE2_TESTING_REGEXP_GENERATOR_H__ |
OLD | NEW |