forked from boostorg/regex
First cut at new v5 regex version, doesn't really work yet, but all the infrastructure is in place...
[SVN r22489]
This commit is contained in:
+6
-14
@@ -35,7 +35,6 @@ const char* names[] = {"REG_NOERROR", "REG_NOMATCH", "REG_BADPAT", "REG_ECOLLATE
|
||||
|
||||
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA* expression, const char* ptr, int f)
|
||||
{
|
||||
BOOST_RE_GUARD_STACK
|
||||
if(expression->re_magic != magic_value)
|
||||
{
|
||||
expression->guts = 0;
|
||||
@@ -54,7 +53,7 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA* expression, const char
|
||||
#endif
|
||||
}
|
||||
// set default flags:
|
||||
boost::uint_fast32_t flags = (f & REG_EXTENDED) ? regex::extended : regex::basic;
|
||||
boost::uint_fast32_t flags = (f & REG_PERLEX) ? 0 : ((f & REG_EXTENDED) ? regex::extended : regex::basic);
|
||||
expression->eflags = (f & REG_NEWLINE) ? match_not_dot_newline : match_default;
|
||||
// and translate those that are actually set:
|
||||
|
||||
@@ -74,13 +73,9 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA* expression, const char
|
||||
if(f & REG_ICASE)
|
||||
flags |= regex::icase;
|
||||
if(f & REG_ESCAPE_IN_LISTS)
|
||||
flags |= regex::escape_in_lists;
|
||||
flags &= ~regex::no_escape_in_lists;
|
||||
if(f & REG_NEWLINE_ALT)
|
||||
flags |= regex::newline_alt;
|
||||
#ifndef BOOST_REGEX_V3
|
||||
if(f & REG_PERLEX)
|
||||
flags |= regex::perlex;
|
||||
#endif
|
||||
|
||||
const char* p2;
|
||||
if(f & REG_PEND)
|
||||
@@ -110,12 +105,11 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA* expression, const char
|
||||
|
||||
BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int code, const regex_tA* e, char* buf, regsize_t buf_size)
|
||||
{
|
||||
BOOST_RE_GUARD_STACK
|
||||
std::size_t result = 0;
|
||||
if(code & REG_ITOA)
|
||||
{
|
||||
code &= ~REG_ITOA;
|
||||
if(code <= REG_E_UNKNOWN)
|
||||
if(code <= (int)REG_E_UNKNOWN)
|
||||
{
|
||||
result = std::strlen(names[code]) + 1;
|
||||
if(buf_size >= result)
|
||||
@@ -129,7 +123,7 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int code, const regex_tA*
|
||||
char localbuf[5];
|
||||
if(e == 0)
|
||||
return 0;
|
||||
for(int i = 0; i <= REG_E_UNKNOWN; ++i)
|
||||
for(int i = 0; i <= (int)REG_E_UNKNOWN; ++i)
|
||||
{
|
||||
if(std::strcmp(e->re_endp, names[i]) == 0)
|
||||
{
|
||||
@@ -144,7 +138,7 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int code, const regex_tA*
|
||||
std::strcpy(buf, localbuf);
|
||||
return std::strlen(localbuf) + 1;
|
||||
}
|
||||
if(code <= REG_E_UNKNOWN)
|
||||
if(code <= (int)REG_E_UNKNOWN)
|
||||
{
|
||||
std::string p;
|
||||
if((e) && (e->re_magic == magic_value))
|
||||
@@ -168,7 +162,6 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int code, const regex_tA*
|
||||
|
||||
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecA(const regex_tA* expression, const char* buf, regsize_t n, regmatch_t* array, int eflags)
|
||||
{
|
||||
BOOST_RE_GUARD_STACK
|
||||
bool result = false;
|
||||
match_flag_type flags = match_default | expression->eflags;
|
||||
const char* end;
|
||||
@@ -209,7 +202,7 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecA(const regex_tA* expression, cons
|
||||
if(result)
|
||||
{
|
||||
// extract what matched:
|
||||
unsigned int i;
|
||||
std::size_t i;
|
||||
for(i = 0; (i < n) && (i < expression->re_nsub + 1); ++i)
|
||||
{
|
||||
array[i].rm_so = (m[i].matched == false) ? -1 : (m[i].first - buf);
|
||||
@@ -228,7 +221,6 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecA(const regex_tA* expression, cons
|
||||
|
||||
BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeA(regex_tA* expression)
|
||||
{
|
||||
BOOST_RE_GUARD_STACK
|
||||
if(expression->re_magic == magic_value)
|
||||
{
|
||||
delete static_cast<regex*>(expression->guts);
|
||||
|
||||
Reference in New Issue
Block a user