forked from boostorg/regex
merged changes in regex5 branch
[SVN r26692]
This commit is contained in:
@ -24,6 +24,13 @@
|
||||
#include <boost/regex/config.hpp>
|
||||
#endif
|
||||
#include <boost/regex/v4/match_flags.hpp>
|
||||
#include <boost/regex/v4/error_type.hpp>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <cstddef>
|
||||
#else
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_PREFIX
|
||||
@ -46,8 +53,12 @@ typedef size_t regsize_t;
|
||||
typedef struct
|
||||
{
|
||||
unsigned int re_magic;
|
||||
unsigned int re_nsub; /* number of parenthesized subexpressions */
|
||||
const char* re_endp; /* end pointer for REG_PEND */
|
||||
#ifdef __cplusplus
|
||||
std::size_t re_nsub; /* number of parenthesized subexpressions */
|
||||
#else
|
||||
size_t re_nsub;
|
||||
#endif
|
||||
const char* re_endp; /* end pointer for REG_PEND */
|
||||
void* guts; /* none of your business :-) */
|
||||
match_flag_type eflags; /* none of your business :-) */
|
||||
} regex_tA;
|
||||
@ -56,7 +67,11 @@ typedef struct
|
||||
typedef struct
|
||||
{
|
||||
unsigned int re_magic;
|
||||
unsigned int re_nsub; /* number of parenthesized subexpressions */
|
||||
#ifdef __cplusplus
|
||||
std::size_t re_nsub; /* number of parenthesized subexpressions */
|
||||
#else
|
||||
size_t re_nsub;
|
||||
#endif
|
||||
const wchar_t* re_endp; /* end pointer for REG_PEND */
|
||||
void* guts; /* none of your business :-) */
|
||||
match_flag_type eflags; /* none of your business :-) */
|
||||
@ -102,6 +117,39 @@ typedef enum{
|
||||
REG_STARTEND = 00004
|
||||
} reg_exec_flags;
|
||||
|
||||
//
|
||||
// POSIX error codes:
|
||||
//
|
||||
typedef unsigned reg_error_t;
|
||||
typedef reg_error_t reg_errcode_t; // backwards compatibility
|
||||
|
||||
static const reg_error_t REG_NOERROR = 0; /* Success. */
|
||||
static const reg_error_t REG_NOMATCH = 1; /* Didn't find a match (for regexec). */
|
||||
|
||||
/* POSIX regcomp return error codes. (In the order listed in the
|
||||
standard.) */
|
||||
static const reg_error_t REG_BADPAT = 2; /* Invalid pattern. */
|
||||
static const reg_error_t REG_ECOLLATE = 3; /* Undefined collating element. */
|
||||
static const reg_error_t REG_ECTYPE = 4; /* Invalid character class name. */
|
||||
static const reg_error_t REG_EESCAPE = 5; /* Trailing backslash. */
|
||||
static const reg_error_t REG_ESUBREG = 6; /* Invalid back reference. */
|
||||
static const reg_error_t REG_EBRACK = 7; /* Unmatched left bracket. */
|
||||
static const reg_error_t REG_EPAREN = 8; /* Parenthesis imbalance. */
|
||||
static const reg_error_t REG_EBRACE = 9; /* Unmatched \{. */
|
||||
static const reg_error_t REG_BADBR = 10; /* Invalid contents of \{\}. */
|
||||
static const reg_error_t REG_ERANGE = 11; /* Invalid range end. */
|
||||
static const reg_error_t REG_ESPACE = 12; /* Ran out of memory. */
|
||||
static const reg_error_t REG_BADRPT = 13; /* No preceding re for repetition op. */
|
||||
static const reg_error_t REG_EEND = 14; /* unexpected end of expression */
|
||||
static const reg_error_t REG_ESIZE = 15; /* expression too big */
|
||||
static const reg_error_t REG_ERPAREN = 8; /* = REG_EPAREN : unmatched right parenthesis */
|
||||
static const reg_error_t REG_EMPTY = 17; /* empty expression */
|
||||
static const reg_error_t REG_E_MEMORY = 15; /* = REG_ESIZE : out of memory */
|
||||
static const reg_error_t REG_ECOMPLEXITY = 18; /* complexity too high */
|
||||
static const reg_error_t REG_ESTACK = 19; /* out of stack space */
|
||||
static const reg_error_t REG_E_UNKNOWN = 20; /* unknown error */
|
||||
static const reg_error_t REG_ENOSYS = 20; /* = REG_E_UNKNOWN : Reserved. */
|
||||
|
||||
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA*, const char*, int);
|
||||
BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int, const regex_tA*, char*, regsize_t);
|
||||
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecA(const regex_tA*, const char*, regsize_t, regmatch_t*, int);
|
||||
@ -128,34 +176,6 @@ BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeW(regex_tW*);
|
||||
#define regex_t regex_tA
|
||||
#endif
|
||||
|
||||
/* regerror() flags */
|
||||
typedef enum
|
||||
{
|
||||
REG_NOERROR = 0, /* Success. */
|
||||
REG_NOMATCH = 1, /* Didn't find a match (for regexec). */
|
||||
|
||||
/* POSIX regcomp return error codes. (In the order listed in the
|
||||
standard.) */
|
||||
REG_BADPAT = 2, /* Invalid pattern. */
|
||||
REG_ECOLLATE = 3, /* Undefined collating element. */
|
||||
REG_ECTYPE = 4, /* Invalid character class name. */
|
||||
REG_EESCAPE = 5, /* Trailing backslash. */
|
||||
REG_ESUBREG = 6, /* Invalid back reference. */
|
||||
REG_EBRACK = 7, /* Unmatched left bracket. */
|
||||
REG_EPAREN = 8, /* Parenthesis imbalance. */
|
||||
REG_EBRACE = 9, /* Unmatched \{. */
|
||||
REG_BADBR = 10, /* Invalid contents of \{\}. */
|
||||
REG_ERANGE = 11, /* Invalid range end. */
|
||||
REG_ESPACE = 12, /* Ran out of memory. */
|
||||
REG_BADRPT = 13, /* No preceding re for repetition op. */
|
||||
REG_EEND = 14, /* unexpected end of expression */
|
||||
REG_ESIZE = 15, /* expression too big */
|
||||
REG_ERPAREN = 16, /* unmatched right parenthesis */
|
||||
REG_EMPTY = 17, /* empty expression */
|
||||
REG_E_MEMORY = REG_ESIZE, /* out of memory */
|
||||
REG_E_UNKNOWN = 18 /* unknown error */
|
||||
} reg_errcode_t;
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_SUFFIX
|
||||
#endif
|
||||
@ -165,10 +185,10 @@ typedef enum
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
//
|
||||
// C++ high level wrapper goes here:
|
||||
//
|
||||
#if defined(__cplusplus)
|
||||
#include <string>
|
||||
#include <vector>
|
||||
namespace boost{
|
||||
@ -248,15 +268,12 @@ public:
|
||||
std::size_t Position(int i = 0)const;
|
||||
std::size_t Length(int i = 0)const;
|
||||
bool Matched(int i = 0)const;
|
||||
unsigned int Marks()const;
|
||||
std::size_t Marks()const;
|
||||
std::string What(int i = 0)const;
|
||||
std::string operator[](int i)const { return What(i); }
|
||||
|
||||
#ifdef __MINGW32__
|
||||
static const std::size_t npos = ~0u;
|
||||
#else
|
||||
static const std::size_t npos;
|
||||
#endif
|
||||
|
||||
friend struct re_detail::pred1;
|
||||
friend struct re_detail::pred2;
|
||||
friend struct re_detail::pred3;
|
||||
@ -271,7 +288,7 @@ public:
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* include guard */
|
||||
#endif // include guard
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user