12 #ifndef REGEXPREPROCESSOR_H
13 #define REGEXPREPROCESSOR_H
19 #include <boost/regex.hpp>
28 const static std::string ERR_OUTER_UNMARKED;
29 const static std::string ERR_NESTED_SUBEXP;
30 const static std::string ERR_UNBALANCED_PAREN;
31 const static std::string ERR_OUTSIDE_SUBEXP;
78 static const std::string
preprocess(
const std::string &s);
109 const std::string &s,
bool allow_outer_char =
false,
110 bool allow_outer_nonmarked =
false);
122 const std::string &s);
165 const std::string &original,
166 const backreference_replacements &replace);
182 const std::string &original,
const regex_match_results &results);
194 const std::string &original,
195 const backreference_replacements &replace);
209 const std::string &original,
const regex_match_results &results);
std::pair< int, int > backreference_info
Information about backreferences; the first elem contains the number of backreferences and the second...
Definition: regexpreprocessor.h:53
Definition: regexpreprocessor.h:27
preprocess a regular expression, e.g., transform "()" into "(?:)"
Definition: regexpreprocessor.h:68
static const std::string replace_references(const std::string &original, const backreference_replacements &replace)
Replace into the original string occurrences of backreferences with the corresponding string in the r...
Definition: regexpreprocessor.cpp:373
C++ class: doctemplate.h.
Definition: bufferedoutput.cpp:13
static bool contains_backreferences(const std::string &s)
Checks whether the passed regular expression string contains a backreference (e.g., either \1 or a conditional with a backreference (?(1)...)
Definition: regexpreprocessor.cpp:255
boost::match_results< std::string::const_iterator > regex_match_results
The result of boost::regex_search.
Definition: regexpreprocessor.h:63
static subexpressions_info num_of_marked_subexpressions(const std::string &s, bool allow_outer_char=false, bool allow_outer_nonmarked=false)
check that the expressions is made up of marked subexpressions (...) and no nested subexpressions and...
Definition: regexpreprocessor.cpp:166
static const std::string preprocess(const std::string &s)
translates marked subexpressions (...) into non marked subexpressions (?: )
Definition: regexpreprocessor.cpp:82
unsigned int marked
num of marked subexpressions
Definition: regexpreprocessor.h:34
std::vector< std::string > backreference_replacements
What to replace to backreferences in a regular expression.
Definition: regexpreprocessor.h:58
std::string errors
error specifications, if any
Definition: regexpreprocessor.h:36
static const std::string make_nonsensitive(const std::string &s)
translates the expression into a case nonsensitive expression, i.e., foo is translated into [Ff][Oo][...
Definition: regexpreprocessor.cpp:100
std::list< std::string > subexpressions_strings
all the marked subexpressions in a list
Definition: regexpreprocessor.h:46
static const subexpressions_strings * split_marked_subexpressions(const std::string &s)
Splits the marked subexpressions of a regular expression made up of only marked subexpressions and no...
Definition: regexpreprocessor.cpp:142
static backreference_info num_of_backreferences(const std::string &s)
counts the number of backreferences (also in conditionals)
Definition: regexpreprocessor.cpp:259
static unsigned int num_of_subexpressions(const std::string &s)
counts the number of marked subexpressions (...)
Definition: regexpreprocessor.cpp:129
static backreference_info num_of_references(const std::string &s)
counts the number of references (i.e., reference to a matched subexpression of another regular expres...
Definition: regexpreprocessor.cpp:288
static const std::string replace_backreferences(const std::string &original, const backreference_replacements &replace)
Replace into the original string occurrences of backreferences with the corresponding string in the r...
Definition: regexpreprocessor.cpp:314