mirror of
https://github.com/boostorg/regex.git
synced 2025-07-15 05:16:37 +02:00
updated regex directory structure
[SVN r9765]
This commit is contained in:
439
include/boost/regex/detail/fileiter.hpp
Normal file
439
include/boost/regex/detail/fileiter.hpp
Normal file
@ -0,0 +1,439 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE fileiter.hpp
|
||||
* VERSION 3.04
|
||||
* DESCRIPTION: Declares various platform independent file and
|
||||
* directory iterators, plus binary file input in
|
||||
* the form of class map_file.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_RE_FILEITER_HPP
|
||||
#define BOOST_RE_FILEITER_HPP
|
||||
|
||||
#include <boost/regex/detail/regex_config.hpp>
|
||||
|
||||
#if (defined(__CYGWIN__) || defined(__CYGWIN32__)) && !defined(BOOST_RE_NO_W32)
|
||||
#error "Sorry, can't mix <windows.h> with STL code and gcc compiler: if you ran configure, try again with configure --disable-ms-windows"
|
||||
#define FI_WIN32_MAP
|
||||
#define FI_POSIX_DIR
|
||||
#elif (defined(__WIN32__) || defined(_WIN32) || defined(WIN32)) && !defined(BOOST_RE_NO_W32)
|
||||
#define FI_WIN32_MAP
|
||||
#define FI_WIN32_DIR
|
||||
#else
|
||||
#define FI_POSIX_MAP
|
||||
#define FI_POSIX_DIR
|
||||
#endif
|
||||
|
||||
#if defined(FI_WIN32_MAP)||defined(FI_WIN32_DIR)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if defined(FI_WIN32_DIR)
|
||||
|
||||
namespace boost{
|
||||
namespace re_detail{
|
||||
|
||||
typedef WIN32_FIND_DATA _fi_find_data;
|
||||
typedef HANDLE _fi_find_handle;
|
||||
|
||||
} // namespace re_detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#define _fi_invalid_handle INVALID_HANDLE_VALUE
|
||||
#define _fi_dir FILE_ATTRIBUTE_DIRECTORY
|
||||
|
||||
#elif defined(FI_POSIX_DIR)
|
||||
|
||||
#include <cstdio>
|
||||
#include <cctype>
|
||||
#include <iterator>
|
||||
#include <list>
|
||||
#include <cassert>
|
||||
#include <dirent.h>
|
||||
|
||||
#if defined(__SUNPRO_CC)
|
||||
using std::list;
|
||||
#endif
|
||||
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH 256
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
namespace re_detail{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ == 0x530
|
||||
#pragma option push -a4 -b -Ve
|
||||
#elif __BORLANDC__ > 0x530
|
||||
#pragma option push -a8 -b -Ve
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct _fi_find_data
|
||||
{
|
||||
unsigned dwFileAttributes;
|
||||
char cFileName[MAX_PATH];
|
||||
};
|
||||
|
||||
struct _fi_priv_data;
|
||||
|
||||
typedef _fi_priv_data* _fi_find_handle;
|
||||
#define _fi_invalid_handle 0
|
||||
#define _fi_dir 1
|
||||
|
||||
_fi_find_handle _fi_FindFirstFile(const char* lpFileName, _fi_find_data* lpFindFileData);
|
||||
bool _fi_FindNextFile(_fi_find_handle hFindFile, _fi_find_data* lpFindFileData);
|
||||
bool _fi_FindClose(_fi_find_handle hFindFile);
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ > 0x520
|
||||
#pragma option pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // namespace re_detail
|
||||
} // namespace boost
|
||||
|
||||
#ifdef FindFirstFile
|
||||
#undef FindFirstFile
|
||||
#endif
|
||||
#ifdef FindNextFile
|
||||
#undef FindNextFile
|
||||
#endif
|
||||
#ifdef FindClose
|
||||
#undef FindClose
|
||||
#endif
|
||||
|
||||
#define FindFirstFile _fi_FindFirstFile
|
||||
#define FindNextFile _fi_FindNextFile
|
||||
#define FindClose _fi_FindClose
|
||||
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
namespace re_detail{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ == 0x530
|
||||
#pragma option push -a4 -b
|
||||
#elif __BORLANDC__ > 0x530
|
||||
#pragma option push -a8 -b
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef FI_WIN32_MAP // win32 mapfile
|
||||
|
||||
class BOOST_RE_IX_DECL mapfile
|
||||
{
|
||||
HANDLE hfile;
|
||||
HANDLE hmap;
|
||||
const char* _first;
|
||||
const char* _last;
|
||||
public:
|
||||
|
||||
typedef const char* iterator;
|
||||
|
||||
mapfile(){ hfile = hmap = 0; _first = _last = 0; }
|
||||
mapfile(const char* file){ hfile = hmap = 0; _first = _last = 0; open(file); }
|
||||
~mapfile(){ close(); }
|
||||
void open(const char* file);
|
||||
void close();
|
||||
const char* begin(){ return _first; }
|
||||
const char* end(){ return _last; }
|
||||
size_t size(){ return _last - _first; }
|
||||
bool valid(){ return (hfile != 0) && (hfile != INVALID_HANDLE_VALUE); }
|
||||
};
|
||||
|
||||
|
||||
#elif !defined(BOOST_RE_NO_STL) // use C API to emulate the memory map:
|
||||
|
||||
class BOOST_RE_IX_DECL mapfile_iterator;
|
||||
|
||||
class BOOST_RE_IX_DECL mapfile
|
||||
{
|
||||
typedef char* pointer;
|
||||
std::FILE* hfile;
|
||||
long int _size;
|
||||
pointer* _first;
|
||||
pointer* _last;
|
||||
mutable std::list<pointer*> condemed;
|
||||
enum sizes
|
||||
{
|
||||
buf_size = 4096
|
||||
};
|
||||
void lock(pointer* node)const;
|
||||
void unlock(pointer* node)const;
|
||||
public:
|
||||
|
||||
typedef mapfile_iterator iterator;
|
||||
|
||||
mapfile(){ hfile = 0; _size = 0; _first = _last = 0; }
|
||||
mapfile(const char* file){ hfile = 0; _size = 0; _first = _last = 0; open(file); }
|
||||
~mapfile(){ close(); }
|
||||
void open(const char* file);
|
||||
void close();
|
||||
iterator begin()const;
|
||||
iterator end()const;
|
||||
unsigned long size()const{ return _size; }
|
||||
bool valid()const{ return hfile != 0; }
|
||||
friend class mapfile_iterator;
|
||||
};
|
||||
|
||||
class BOOST_RE_IX_DECL mapfile_iterator : public BOOST_RE_RA_ITERATOR(char, long)
|
||||
{
|
||||
typedef mapfile::pointer internal_pointer;
|
||||
internal_pointer* node;
|
||||
const mapfile* file;
|
||||
unsigned long offset;
|
||||
long position()const
|
||||
{
|
||||
return file ? ((node - file->_first) * mapfile::buf_size + offset) : 0;
|
||||
}
|
||||
void position(long pos)
|
||||
{
|
||||
if(file)
|
||||
{
|
||||
node = file->_first + (pos / mapfile::buf_size);
|
||||
offset = pos % mapfile::buf_size;
|
||||
}
|
||||
}
|
||||
public:
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef char value_type;
|
||||
typedef const char* pointer;
|
||||
typedef const char& reference;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
|
||||
mapfile_iterator() { node = 0; file = 0; offset = 0; }
|
||||
mapfile_iterator(const mapfile* f, long position)
|
||||
{
|
||||
file = f;
|
||||
node = f->_first + position / mapfile::buf_size;
|
||||
offset = position % mapfile::buf_size;
|
||||
if(file)
|
||||
file->lock(node);
|
||||
}
|
||||
mapfile_iterator(const mapfile_iterator& i)
|
||||
{
|
||||
file = i.file;
|
||||
node = i.node;
|
||||
offset = i.offset;
|
||||
if(file)
|
||||
file->lock(node);
|
||||
}
|
||||
~mapfile_iterator()
|
||||
{
|
||||
if(file && node)
|
||||
file->unlock(node);
|
||||
}
|
||||
mapfile_iterator& operator = (const mapfile_iterator& i);
|
||||
char operator* ()const
|
||||
{
|
||||
assert(node >= file->_first);
|
||||
assert(node < file->_last);
|
||||
return file ? *(*node + sizeof(int) + offset) : char(0);
|
||||
}
|
||||
char operator[] (long off)const
|
||||
{
|
||||
mapfile_iterator tmp(*this);
|
||||
tmp += off;
|
||||
return *tmp;
|
||||
}
|
||||
mapfile_iterator& operator++ ();
|
||||
mapfile_iterator operator++ (int);
|
||||
mapfile_iterator& operator-- ();
|
||||
mapfile_iterator operator-- (int);
|
||||
|
||||
mapfile_iterator& operator += (long off)
|
||||
{
|
||||
position(position() + off);
|
||||
return *this;
|
||||
}
|
||||
mapfile_iterator& operator -= (long off)
|
||||
{
|
||||
position(position() - off);
|
||||
return *this;
|
||||
}
|
||||
|
||||
friend inline bool operator==(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return (i.file == j.file) && (i.node == j.node) && (i.offset == j.offset);
|
||||
}
|
||||
#ifndef BOOST_RE_NO_NOT_EQUAL
|
||||
friend inline bool operator!=(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return !(i == j);
|
||||
}
|
||||
#endif
|
||||
friend inline bool operator<(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() < j.position();
|
||||
}
|
||||
friend inline bool operator>(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() > j.position();
|
||||
}
|
||||
friend inline bool operator<=(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() <= j.position();
|
||||
}
|
||||
friend inline bool operator>=(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() >= j.position();
|
||||
}
|
||||
|
||||
friend mapfile_iterator operator + (const mapfile_iterator& i, long off);
|
||||
friend mapfile_iterator operator + (long off, const mapfile_iterator& i)
|
||||
{
|
||||
mapfile_iterator tmp(i);
|
||||
return tmp += off;
|
||||
}
|
||||
friend mapfile_iterator operator - (const mapfile_iterator& i, long off);
|
||||
friend inline long operator - (const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() - j.position();
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// _fi_sep determines the directory separator, either '\\' or '/'
|
||||
BOOST_RE_IX_DECL extern const char* _fi_sep;
|
||||
|
||||
struct file_iterator_ref
|
||||
{
|
||||
_fi_find_handle hf;
|
||||
_fi_find_data _data;
|
||||
long count;
|
||||
};
|
||||
|
||||
|
||||
class BOOST_RE_IX_DECL file_iterator : public BOOST_RE_INPUT_ITERATOR(const char*, std::ptrdiff_t)
|
||||
{
|
||||
char* _root;
|
||||
char* _path;
|
||||
char* ptr;
|
||||
file_iterator_ref* ref;
|
||||
|
||||
public:
|
||||
file_iterator();
|
||||
file_iterator(const char* wild);
|
||||
~file_iterator();
|
||||
file_iterator(const file_iterator&);
|
||||
file_iterator& operator=(const file_iterator&);
|
||||
const char* root()const { return _root; }
|
||||
const char* path()const { return _path; }
|
||||
const char* name()const { return ptr; }
|
||||
_fi_find_data* data() { return &(ref->_data); }
|
||||
void next();
|
||||
file_iterator& operator++() { next(); return *this; }
|
||||
file_iterator operator++(int);
|
||||
const char* operator*() { return path(); }
|
||||
|
||||
friend inline bool operator == (const file_iterator& f1, const file_iterator& f2)
|
||||
{
|
||||
return ((f1.ref->hf == _fi_invalid_handle) && (f2.ref->hf == _fi_invalid_handle));
|
||||
}
|
||||
#ifndef BOOST_RE_NO_NOT_EQUAL
|
||||
friend inline bool operator != (const file_iterator& f1, const file_iterator& f2)
|
||||
{
|
||||
return !(f1 == f2);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
// dwa 9/13/00 - suppress unused parameter warning
|
||||
inline bool operator < (const file_iterator&, const file_iterator&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
class BOOST_RE_IX_DECL directory_iterator : public BOOST_RE_INPUT_ITERATOR(const char*, std::ptrdiff_t)
|
||||
{
|
||||
char* _root;
|
||||
char* _path;
|
||||
char* ptr;
|
||||
file_iterator_ref* ref;
|
||||
|
||||
public:
|
||||
directory_iterator();
|
||||
directory_iterator(const char* wild);
|
||||
~directory_iterator();
|
||||
directory_iterator(const directory_iterator& other);
|
||||
directory_iterator& operator=(const directory_iterator& other);
|
||||
|
||||
const char* root()const { return _root; }
|
||||
const char* path()const { return _path; }
|
||||
const char* name()const { return ptr; }
|
||||
_fi_find_data* data() { return &(ref->_data); }
|
||||
void next();
|
||||
directory_iterator& operator++() { next(); return *this; }
|
||||
directory_iterator operator++(int);
|
||||
const char* operator*() { return path(); }
|
||||
|
||||
static const char* separator() { return _fi_sep; }
|
||||
|
||||
friend inline bool operator == (const directory_iterator& f1, const directory_iterator& f2)
|
||||
{
|
||||
return ((f1.ref->hf == _fi_invalid_handle) && (f2.ref->hf == _fi_invalid_handle));
|
||||
}
|
||||
|
||||
#ifndef BOOST_RE_NO_NOT_EQUAL
|
||||
friend inline bool operator != (const directory_iterator& f1, const directory_iterator& f2)
|
||||
{
|
||||
return !(f1 == f2);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
inline bool operator < (const directory_iterator&, const directory_iterator&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ > 0x520
|
||||
#pragma option pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
} // namespace re_detail
|
||||
using boost::re_detail::directory_iterator;
|
||||
using boost::re_detail::file_iterator;
|
||||
using boost::re_detail::mapfile;
|
||||
} // namespace boost
|
||||
|
||||
#endif // _FILEITER_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
2044
include/boost/regex/detail/regex_compile.hpp
Normal file
2044
include/boost/regex/detail/regex_compile.hpp
Normal file
File diff suppressed because it is too large
Load Diff
1277
include/boost/regex/detail/regex_config.hpp
Normal file
1277
include/boost/regex/detail/regex_config.hpp
Normal file
File diff suppressed because it is too large
Load Diff
139
include/boost/regex/detail/regex_cstring.hpp
Normal file
139
include/boost/regex/detail/regex_cstring.hpp
Normal file
@ -0,0 +1,139 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_cstring.hpp
|
||||
* VERSION 3.04
|
||||
* DESCRIPTION: This is an internal header file, do not include directly.
|
||||
* String support and helper functions, for regular
|
||||
* expression library.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_REGEX_CSTRING_HPP
|
||||
#define BOOST_REGEX_CSTRING_HPP
|
||||
|
||||
#ifndef BOOST_REGEX_CONFIG_HPP
|
||||
#include <boost/regex/detail/regex_config.hpp>
|
||||
#endif
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace boost{
|
||||
namespace re_detail{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ == 0x530
|
||||
#pragma option push -a4 -b -Ve
|
||||
#elif __BORLANDC__ > 0x530
|
||||
#pragma option push -a8 -b -Ve
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//
|
||||
// start by defining some template function aliases for C API functions:
|
||||
//
|
||||
|
||||
template <class charT>
|
||||
std::size_t BOOST_RE_CALL re_strlen(const charT *s)
|
||||
{
|
||||
std::size_t len = 0;
|
||||
while(*s)
|
||||
{
|
||||
++s;
|
||||
++len;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
inline std::size_t BOOST_RE_CALL re_strlen(const char *s)
|
||||
{
|
||||
return std::strlen(s);
|
||||
}
|
||||
|
||||
#ifndef BOOST_RE_NO_WCSTRING
|
||||
|
||||
inline std::size_t BOOST_RE_CALL re_strlen(const wchar_t *s)
|
||||
{
|
||||
return std::wcslen(s);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_RE_NO_WCSTRING
|
||||
BOOST_RE_IX_DECL void BOOST_RE_CALL re_transform(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
|
||||
#endif
|
||||
BOOST_RE_IX_DECL void BOOST_RE_CALL re_transform(std::string& out, const std::string& in);
|
||||
|
||||
template <class charT>
|
||||
void BOOST_RE_CALL re_trunc_primary(std::basic_string<charT>& s)
|
||||
{
|
||||
for(unsigned int i = 0; i < s.size(); ++i)
|
||||
{
|
||||
if(s[i] <= 1)
|
||||
{
|
||||
s.erase(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline char* BOOST_RE_CALL re_strcpy(char *s1, const char *s2)
|
||||
{
|
||||
#if defined(__BORLANDC__) && defined(strcpy)
|
||||
return ::strcpy(s1, s2);
|
||||
#else
|
||||
return std::strcpy(s1, s2);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef BOOST_RE_NO_WCSTRING
|
||||
|
||||
inline wchar_t* BOOST_RE_CALL re_strcpy(wchar_t *s1, const wchar_t *s2)
|
||||
{
|
||||
return std::wcscpy(s1, s2);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
template <class charT>
|
||||
charT* BOOST_RE_CALL re_strdup(const charT* p)
|
||||
{
|
||||
charT* buf = new charT[re_strlen(p) + 1];
|
||||
re_strcpy(buf, p);
|
||||
return buf;
|
||||
}
|
||||
|
||||
template <class charT>
|
||||
inline void BOOST_RE_CALL re_strfree(charT* p)
|
||||
{
|
||||
delete[] p;
|
||||
}
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ > 0x520
|
||||
#pragma option pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // namespace re_detail
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_REGEX_CSTRING_HPP
|
||||
|
||||
|
||||
|
||||
|
583
include/boost/regex/detail/regex_format.hpp
Normal file
583
include/boost/regex/detail/regex_format.hpp
Normal file
@ -0,0 +1,583 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_format.hpp
|
||||
* VERSION 3.04
|
||||
* DESCRIPTION: Provides formatting output routines for search and replace
|
||||
* operations. Note this is an internal header file included
|
||||
* by regex.hpp, do not include on its own.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_REGEX_FORMAT_HPP
|
||||
#define BOOST_REGEX_FORMAT_HPP
|
||||
|
||||
|
||||
namespace boost{
|
||||
|
||||
enum format_flags_t{
|
||||
format_all = 0, // enable all extentions to sytax
|
||||
format_sed = match_max << 1, // sed style replacement.
|
||||
format_perl = format_sed << 1, // perl style replacement.
|
||||
format_no_copy = format_perl << 1, // don't copy non-matching segments.
|
||||
format_is_if = format_no_copy << 1 // internal use only.
|
||||
};
|
||||
|
||||
namespace re_detail{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ == 0x530
|
||||
#pragma option push -a4 -b -Ve
|
||||
#elif __BORLANDC__ > 0x530
|
||||
#pragma option push -a8 -b -Ve -w-8037
|
||||
#endif
|
||||
#endif
|
||||
|
||||
template <class O, class I>
|
||||
O BOOST_RE_CALL re_copy_out(O out, I first, I last)
|
||||
{
|
||||
while(first != last)
|
||||
{
|
||||
*out = *first;
|
||||
++out;
|
||||
++first;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
template <class charT, class traits_type>
|
||||
void BOOST_RE_CALL re_skip_format(const charT*& fmt, const traits_type& traits_inst)
|
||||
{
|
||||
// dwa 9/13/00 - suppress incorrect unused parameter warning for MSVC
|
||||
(void)traits_inst;
|
||||
|
||||
typedef typename traits_type::size_type traits_size_type;
|
||||
typedef typename traits_type::uchar_type traits_uchar_type;
|
||||
typedef typename traits_type::string_type traits_string_type;
|
||||
|
||||
unsigned int parens = 0;
|
||||
unsigned int c;
|
||||
while(*fmt)
|
||||
{
|
||||
c = traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt));
|
||||
if((c == traits_type::syntax_colon) && (parens == 0))
|
||||
{
|
||||
++fmt;
|
||||
return;
|
||||
}
|
||||
else if(c == traits_type::syntax_close_bracket)
|
||||
{
|
||||
if(parens == 0)
|
||||
{
|
||||
++fmt;
|
||||
return;
|
||||
}
|
||||
--parens;
|
||||
}
|
||||
else if(c == traits_type::syntax_open_bracket)
|
||||
++parens;
|
||||
else if(c == traits_type::syntax_slash)
|
||||
{
|
||||
++fmt;
|
||||
if(*fmt == 0)
|
||||
return;
|
||||
}
|
||||
++fmt;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BOOST_RE_NO_OI_ASSIGN
|
||||
|
||||
//
|
||||
// ugly hack for buggy output iterators
|
||||
|
||||
template <class T>
|
||||
inline void oi_assign(T* p, T v)
|
||||
{
|
||||
jm_destroy(p);
|
||||
jm_construct(p, v);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
template <class T>
|
||||
inline void oi_assign(T* p, T v)
|
||||
{
|
||||
//
|
||||
// if you get a compile time error in here then you either
|
||||
// need to rewrite your output iterator to make it assignable
|
||||
// (as is required by the standard), or define BOOST_RE_NO_OI_ASSIGN
|
||||
// to use the ugly hack above
|
||||
*p = v;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES)
|
||||
//
|
||||
// Ugly ugly hack,
|
||||
// template don't merge if they contain switch statements so declare these
|
||||
// templates in unnamed namespace (ie with internal linkage), each translation
|
||||
// unit then gets its own local copy, it works seemlessly but bloats the app.
|
||||
namespace{
|
||||
#endif
|
||||
|
||||
//
|
||||
// algorithm reg_format:
|
||||
// takes the result of a match and a format string
|
||||
// and merges them to produce a new string which
|
||||
// is sent to an OutputIterator,
|
||||
// _reg_format_aux does the actual work:
|
||||
//
|
||||
template <class OutputIterator, class iterator, class Allocator, class charT, class traits_type>
|
||||
OutputIterator BOOST_RE_CALL _reg_format_aux(OutputIterator out,
|
||||
const match_results<iterator, Allocator>& m,
|
||||
const charT*& fmt,
|
||||
unsigned flags, const traits_type& traits_inst)
|
||||
{
|
||||
const charT* fmt_end = fmt;
|
||||
while(*fmt_end) ++ fmt_end;
|
||||
|
||||
typedef typename traits_type::size_type traits_size_type;
|
||||
typedef typename traits_type::uchar_type traits_uchar_type;
|
||||
typedef typename traits_type::string_type traits_string_type;
|
||||
|
||||
while(*fmt)
|
||||
{
|
||||
switch(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt)))
|
||||
{
|
||||
case traits_type::syntax_dollar:
|
||||
if(flags & format_sed)
|
||||
{
|
||||
// no perl style replacement,
|
||||
// $ is an ordinary character:
|
||||
goto default_opt;
|
||||
}
|
||||
++fmt;
|
||||
if(*fmt == 0) // oops trailing $
|
||||
{
|
||||
--fmt;
|
||||
*out = *fmt;
|
||||
++out;
|
||||
return out;
|
||||
}
|
||||
switch(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt)))
|
||||
{
|
||||
case traits_type::syntax_start_buffer:
|
||||
oi_assign(&out, re_copy_out(out, iterator(m[-1].first), iterator(m[-1].second)));
|
||||
++fmt;
|
||||
continue;
|
||||
case traits_type::syntax_end_buffer:
|
||||
oi_assign(&out, re_copy_out(out, iterator(m[-2].first), iterator(m[-2].second)));
|
||||
++fmt;
|
||||
continue;
|
||||
case traits_type::syntax_digit:
|
||||
{
|
||||
expand_sub:
|
||||
unsigned int index = traits_inst.toi(fmt, fmt_end, 10);
|
||||
oi_assign(&out, re_copy_out(out, iterator(m[index].first), iterator(m[index].second)));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// anything else:
|
||||
if(*fmt == '&')
|
||||
{
|
||||
oi_assign(&out, re_copy_out(out, iterator(m[0].first), iterator(m[0].second)));
|
||||
++fmt;
|
||||
}
|
||||
else
|
||||
{
|
||||
// probably an error, treat as a literal '$'
|
||||
--fmt;
|
||||
*out = *fmt;
|
||||
++out;
|
||||
++fmt;
|
||||
}
|
||||
continue;
|
||||
case traits_type::syntax_slash:
|
||||
{
|
||||
// escape sequence:
|
||||
++fmt;
|
||||
charT c(*fmt);
|
||||
if(*fmt == 0)
|
||||
{
|
||||
--fmt;
|
||||
*out = *fmt;
|
||||
++out;
|
||||
++fmt;
|
||||
return out;
|
||||
}
|
||||
switch(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt)))
|
||||
{
|
||||
case traits_type::syntax_a:
|
||||
c = '\a';
|
||||
++fmt;
|
||||
break;
|
||||
case traits_type::syntax_f:
|
||||
c = '\f';
|
||||
++fmt;
|
||||
break;
|
||||
case traits_type::syntax_n:
|
||||
c = '\n';
|
||||
++fmt;
|
||||
break;
|
||||
case traits_type::syntax_r:
|
||||
c = '\r';
|
||||
++fmt;
|
||||
break;
|
||||
case traits_type::syntax_t:
|
||||
c = '\t';
|
||||
++fmt;
|
||||
break;
|
||||
case traits_type::syntax_v:
|
||||
c = '\v';
|
||||
++fmt;
|
||||
break;
|
||||
case traits_type::syntax_x:
|
||||
++fmt;
|
||||
if(fmt == fmt_end)
|
||||
{
|
||||
*out = *--fmt;
|
||||
++out;
|
||||
return out;
|
||||
}
|
||||
// maybe have \x{ddd}
|
||||
if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt)) == traits_type::syntax_open_brace)
|
||||
{
|
||||
++fmt;
|
||||
if(fmt == fmt_end)
|
||||
{
|
||||
fmt -= 2;
|
||||
*out = *fmt;
|
||||
++out;
|
||||
++fmt;
|
||||
continue;
|
||||
}
|
||||
if(traits_inst.is_class(*fmt, traits_type::char_class_xdigit) == false)
|
||||
{
|
||||
fmt -= 2;
|
||||
*out = *fmt;
|
||||
++out;
|
||||
++fmt;
|
||||
continue;
|
||||
}
|
||||
c = (charT)traits_inst.toi(fmt, fmt_end, -16);
|
||||
if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt)) != traits_type::syntax_close_brace)
|
||||
{
|
||||
while(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt)) != traits_type::syntax_slash)
|
||||
--fmt;
|
||||
++fmt;
|
||||
*out = *fmt;
|
||||
++out;
|
||||
++fmt;
|
||||
continue;
|
||||
}
|
||||
++fmt;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(traits_inst.is_class(*fmt, traits_type::char_class_xdigit) == false)
|
||||
{
|
||||
--fmt;
|
||||
*out = *fmt;
|
||||
++out;
|
||||
++fmt;
|
||||
continue;
|
||||
}
|
||||
c = (charT)traits_inst.toi(fmt, fmt_end, -16);
|
||||
}
|
||||
break;
|
||||
case traits_type::syntax_c:
|
||||
++fmt;
|
||||
if(fmt == fmt_end)
|
||||
{
|
||||
--fmt;
|
||||
*out = *fmt;
|
||||
++out;
|
||||
return out;
|
||||
}
|
||||
if(((typename traits_type::uchar_type)(*fmt) < (typename traits_type::uchar_type)'@')
|
||||
|| ((typename traits_type::uchar_type)(*fmt) > (typename traits_type::uchar_type)127) )
|
||||
{
|
||||
--fmt;
|
||||
*out = *fmt;
|
||||
++out;
|
||||
++fmt;
|
||||
break;
|
||||
}
|
||||
c = (charT)((typename traits_type::uchar_type)(*fmt) - (typename traits_type::uchar_type)'@');
|
||||
++fmt;
|
||||
break;
|
||||
case traits_type::syntax_e:
|
||||
c = (charT)27;
|
||||
++fmt;
|
||||
break;
|
||||
case traits_type::syntax_digit:
|
||||
if(flags & format_sed)
|
||||
goto expand_sub;
|
||||
else
|
||||
c = (charT)traits_inst.toi(fmt, fmt_end, -8);
|
||||
break;
|
||||
default:
|
||||
//c = *fmt;
|
||||
++fmt;
|
||||
}
|
||||
*out = c;
|
||||
++out;
|
||||
continue;
|
||||
}
|
||||
case traits_type::syntax_open_bracket:
|
||||
if(flags & (format_sed|format_perl))
|
||||
{
|
||||
*out = *fmt;
|
||||
++out;
|
||||
++fmt;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
++fmt; // recurse
|
||||
oi_assign(&out, _reg_format_aux(out, m, fmt, flags, traits_inst));
|
||||
continue;
|
||||
}
|
||||
case traits_type::syntax_close_bracket:
|
||||
if(flags & (format_sed|format_perl))
|
||||
{
|
||||
*out = *fmt;
|
||||
++out;
|
||||
++fmt;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
++fmt; // return from recursion
|
||||
return out;
|
||||
}
|
||||
case traits_type::syntax_colon:
|
||||
if(flags & format_is_if)
|
||||
{
|
||||
++fmt;
|
||||
return out;
|
||||
}
|
||||
*out = *fmt;
|
||||
++out;
|
||||
++fmt;
|
||||
continue;
|
||||
case traits_type::syntax_question:
|
||||
{
|
||||
if(flags & (format_sed|format_perl))
|
||||
{
|
||||
*out = *fmt;
|
||||
++out;
|
||||
++fmt;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
++fmt;
|
||||
if(*fmt == 0)
|
||||
{
|
||||
--fmt;
|
||||
*out = *fmt;
|
||||
++out;
|
||||
++fmt;
|
||||
return out;
|
||||
}
|
||||
unsigned int id = traits_inst.toi(fmt, fmt_end, 10);
|
||||
if(m[id].matched)
|
||||
{
|
||||
oi_assign(&out, _reg_format_aux(out, m, fmt, flags | format_is_if, traits_inst));
|
||||
if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*(fmt-1))) == traits_type::syntax_colon)
|
||||
re_skip_format(fmt, traits_inst);
|
||||
}
|
||||
else
|
||||
{
|
||||
re_skip_format(fmt, traits_inst);
|
||||
if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*(fmt-1))) == traits_type::syntax_colon)
|
||||
oi_assign(&out, _reg_format_aux(out, m, fmt, flags | format_is_if, traits_inst));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
}
|
||||
default:
|
||||
default_opt:
|
||||
if((flags & format_sed) && (*fmt == '&'))
|
||||
{
|
||||
oi_assign(&out, re_copy_out(out, iterator(m[0].first), iterator(m[0].second)));
|
||||
++fmt;
|
||||
continue;
|
||||
}
|
||||
*out = *fmt;
|
||||
++out;
|
||||
++fmt;
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES)
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
template <class S>
|
||||
class string_out_iterator
|
||||
{
|
||||
S* out;
|
||||
public:
|
||||
string_out_iterator(S& s) : out(&s) {}
|
||||
string_out_iterator& operator++() { return *this; }
|
||||
string_out_iterator& operator++(int) { return *this; }
|
||||
string_out_iterator& operator*() { return *this; }
|
||||
string_out_iterator& operator=(typename S::value_type v)
|
||||
{
|
||||
out->append(1, v);
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
template <class OutputIterator, class iterator, class charT, class Allocator, class traits_type>
|
||||
class merge_out_predicate
|
||||
{
|
||||
OutputIterator* out;
|
||||
iterator* last;
|
||||
const charT* fmt;
|
||||
unsigned flags;
|
||||
const traits_type* pt;
|
||||
|
||||
public:
|
||||
merge_out_predicate(OutputIterator& o, iterator& pi, const charT* f, unsigned format_flags, const traits_type& p)
|
||||
: out(&o), last(&pi), fmt(f), flags(format_flags), pt(&p){}
|
||||
|
||||
~merge_out_predicate() {}
|
||||
bool BOOST_RE_CALL operator()(const boost::match_results<iterator, Allocator>& m)
|
||||
{
|
||||
const charT* f = fmt;
|
||||
if(0 == (flags & format_no_copy))
|
||||
oi_assign(out, re_copy_out(*out, iterator(m[-1].first), iterator(m[-1].second)));
|
||||
oi_assign(out, _reg_format_aux(*out, m, f, flags, *pt));
|
||||
*last = m[-2].first;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace re_detail
|
||||
|
||||
template <class OutputIterator, class iterator, class Allocator, class charT>
|
||||
OutputIterator regex_format(OutputIterator out,
|
||||
const match_results<iterator, Allocator>& m,
|
||||
const charT* fmt,
|
||||
unsigned flags = 0
|
||||
)
|
||||
{
|
||||
regex_traits<charT> t;
|
||||
return re_detail::_reg_format_aux(out, m, fmt, flags, t);
|
||||
}
|
||||
|
||||
template <class OutputIterator, class iterator, class Allocator, class charT>
|
||||
OutputIterator regex_format(OutputIterator out,
|
||||
const match_results<iterator, Allocator>& m,
|
||||
const std::basic_string<charT>& fmt,
|
||||
unsigned flags = 0
|
||||
)
|
||||
{
|
||||
regex_traits<charT> t;
|
||||
const charT* start = fmt.c_str();
|
||||
return re_detail::_reg_format_aux(out, m, start, flags, t);
|
||||
}
|
||||
|
||||
template <class iterator, class Allocator, class charT>
|
||||
std::basic_string<charT> regex_format(const match_results<iterator, Allocator>& m, const charT* fmt, unsigned flags = 0)
|
||||
{
|
||||
std::basic_string<charT> result;
|
||||
re_detail::string_out_iterator<std::basic_string<charT> > i(result);
|
||||
regex_format(i, m, fmt, flags);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class iterator, class Allocator, class charT>
|
||||
std::basic_string<charT> regex_format(const match_results<iterator, Allocator>& m, const std::basic_string<charT>& fmt, unsigned flags = 0)
|
||||
{
|
||||
std::basic_string<charT> result;
|
||||
re_detail::string_out_iterator<std::basic_string<charT> > i(result);
|
||||
regex_format(i, m, fmt.c_str(), flags);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class OutputIterator, class iterator, class traits, class Allocator, class charT>
|
||||
OutputIterator regex_merge(OutputIterator out,
|
||||
iterator first,
|
||||
iterator last,
|
||||
const reg_expression<charT, traits, Allocator>& e,
|
||||
const charT* fmt,
|
||||
unsigned int flags = match_default)
|
||||
{
|
||||
iterator l = first;
|
||||
re_detail::merge_out_predicate<OutputIterator, iterator, charT, Allocator, traits> oi(out, l, fmt, flags, e.get_traits());
|
||||
regex_grep(oi, first, last, e, flags);
|
||||
return (flags & format_no_copy) ? out : re_detail::re_copy_out(out, l, last);
|
||||
}
|
||||
|
||||
template <class OutputIterator, class iterator, class traits, class Allocator, class charT>
|
||||
inline OutputIterator regex_merge(OutputIterator out,
|
||||
iterator first,
|
||||
iterator last,
|
||||
const reg_expression<charT, traits, Allocator>& e,
|
||||
const std::basic_string<charT>& fmt,
|
||||
unsigned int flags = match_default)
|
||||
{
|
||||
return regex_merge(out, first, last, e, fmt.c_str(), flags);
|
||||
}
|
||||
|
||||
template <class traits, class Allocator, class charT>
|
||||
std::basic_string<charT> regex_merge(const std::basic_string<charT>& s,
|
||||
const reg_expression<charT, traits, Allocator>& e,
|
||||
const charT* fmt,
|
||||
unsigned int flags = match_default)
|
||||
{
|
||||
std::basic_string<charT> result;
|
||||
re_detail::string_out_iterator<std::basic_string<charT> > i(result);
|
||||
regex_merge(i, s.begin(), s.end(), e, fmt, flags);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class traits, class Allocator, class charT>
|
||||
std::basic_string<charT> regex_merge(const std::basic_string<charT>& s,
|
||||
const reg_expression<charT, traits, Allocator>& e,
|
||||
const std::basic_string<charT>& fmt,
|
||||
unsigned int flags = match_default)
|
||||
{
|
||||
std::basic_string<charT> result;
|
||||
re_detail::string_out_iterator<std::basic_string<charT> > i(result);
|
||||
regex_merge(i, s.begin(), s.end(), e, fmt.c_str(), flags);
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ > 0x520
|
||||
#pragma option pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_REGEX_FORMAT_HPP
|
||||
|
||||
|
||||
|
||||
|
118
include/boost/regex/detail/regex_kmp.hpp
Normal file
118
include/boost/regex/detail/regex_kmp.hpp
Normal file
@ -0,0 +1,118 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_kmp.hpp
|
||||
* VERSION 3.04
|
||||
* DESCRIPTION: Provides Knuth Morris Pratt search operations.
|
||||
* Note this is an internal header file included
|
||||
* by regex.hpp, do not include on its own.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_REGEX_KMP_HPP
|
||||
#define BOOST_REGEX_KMP_HPP
|
||||
|
||||
#ifdef BOOST_REGEX_CONFIG_HPP
|
||||
#include <boost/regex/detail/regex_config.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
namespace boost{
|
||||
namespace re_detail{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ == 0x530
|
||||
#pragma option push -a4 -b -Ve
|
||||
#elif __BORLANDC__ > 0x530
|
||||
#pragma option push -a8 -b -Ve
|
||||
#endif
|
||||
#endif
|
||||
|
||||
template <class charT>
|
||||
struct kmp_info
|
||||
{
|
||||
unsigned int size;
|
||||
unsigned int len;
|
||||
const charT* pstr;
|
||||
int kmp_next[1];
|
||||
};
|
||||
|
||||
template <class charT, class Allocator>
|
||||
void kmp_free(kmp_info<charT>* pinfo, const Allocator& a)
|
||||
{
|
||||
typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(char, Allocator) atype;
|
||||
atype(a).deallocate((char*)pinfo, pinfo->size);
|
||||
}
|
||||
|
||||
template <class iterator, class charT, class Trans, class Allocator>
|
||||
kmp_info<charT>* kmp_compile(iterator first, iterator last, charT, Trans translate, const Allocator& a)
|
||||
{
|
||||
typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(char, Allocator) atype;
|
||||
int i, j, m;
|
||||
i = 0;
|
||||
BOOST_RE_DISTANCE(first, last, m);
|
||||
++m;
|
||||
unsigned int size = sizeof(kmp_info<charT>) + sizeof(int)*m + sizeof(charT)*m;
|
||||
--m;
|
||||
//
|
||||
// allocate struct and fill it in:
|
||||
//
|
||||
kmp_info<charT>* pinfo = (kmp_info<charT>*)atype(a).allocate(size);
|
||||
pinfo->size = size;
|
||||
pinfo->len = m;
|
||||
charT* p = (charT*)((char*)pinfo + sizeof(kmp_info<charT>) + sizeof(int)*(m+1));
|
||||
pinfo->pstr = p;
|
||||
while(first != last)
|
||||
{
|
||||
*p = translate(*first);
|
||||
++first;
|
||||
++p;
|
||||
}
|
||||
*p = 0;
|
||||
//
|
||||
// finally do regular kmp compile:
|
||||
//
|
||||
j = pinfo->kmp_next[0] = -1;
|
||||
while (i < m)
|
||||
{
|
||||
while ((j > -1) && (pinfo->pstr[i] != pinfo->pstr[j]))
|
||||
j = pinfo->kmp_next[j];
|
||||
++i;
|
||||
++j;
|
||||
if (pinfo->pstr[i] == pinfo->pstr[j])
|
||||
pinfo->kmp_next[i] = pinfo->kmp_next[j];
|
||||
else
|
||||
pinfo->kmp_next[i] = j;
|
||||
}
|
||||
|
||||
return pinfo;
|
||||
}
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ > 0x520
|
||||
#pragma option pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // namepsace re_detail
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_REGEX_KMP_HPP
|
||||
|
||||
|
||||
|
||||
|
||||
|
156
include/boost/regex/detail/regex_library_include.hpp
Normal file
156
include/boost/regex/detail/regex_library_include.hpp
Normal file
@ -0,0 +1,156 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_libary_include.hpp
|
||||
* VERSION 3.04
|
||||
* DESCRIPTION: Automatic library inclusion for Borland/Microsoft compilers.
|
||||
* Note this is an internal header file included
|
||||
* by regex.hpp, do not include on its own.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOOST_REGEX_LIBRARY_INCLUDE_HPP
|
||||
#define BOOST_REGEX_LIBRARY_INCLUDE_HPP
|
||||
#ifndef BOOST_RE_NO_LIB
|
||||
|
||||
#if defined(BOOST_MSVC) && !defined(BOOST_RE_BUILD_DLL)
|
||||
#ifdef __SGI_STL_PORT
|
||||
#ifdef _DLL
|
||||
// All these are multithreaded:
|
||||
#if defined(_DEBUG) && defined(__STL_DEBUG)
|
||||
#pragma comment(lib, "vc6-stlport-re300ddl.lib")
|
||||
#elif defined(_DEBUG)
|
||||
#pragma comment(lib, "vc6-stlport-re300dl.lib")
|
||||
#elif defined(BOOST_RE_STATIC_LIB)
|
||||
// static regex lib, dll runtime
|
||||
#pragma comment(lib, "vc6-stlport-re300ls.lib")
|
||||
#else // DEBUG
|
||||
#pragma comment(lib, "vc6-stlport-re300l.lib")
|
||||
#endif // _DEBUG
|
||||
#else // _DLL
|
||||
#ifdef _MT
|
||||
#if defined(_DEBUG) && defined(__STL_DEBUG)
|
||||
#pragma comment(lib, "vc6-stlport-re300ddm.lib")
|
||||
#elif defined(_DEBUG)
|
||||
#pragma comment(lib, "vc6-stlport-re300dm.lib")
|
||||
#else //_DEBUG
|
||||
#pragma comment(lib, "vc6-stlport-re300m.lib")
|
||||
#endif //_DEBUG
|
||||
#else //_MT
|
||||
// STLPort does not support single threaded builds:
|
||||
#error STLPort does not support single threaded builds
|
||||
#endif //_MT
|
||||
#endif //_DLL
|
||||
#else
|
||||
#ifdef _DLL
|
||||
// All these are multithreaded:
|
||||
#ifdef _DEBUG
|
||||
#pragma comment(lib, "vc6-re300dl.lib")
|
||||
#elif defined(BOOST_RE_STATIC_LIB)
|
||||
// static regex lib, dll runtime
|
||||
#pragma comment(lib, "vc6-re300ls.lib")
|
||||
#else // DEBUG
|
||||
#pragma comment(lib, "vc6-re300l.lib")
|
||||
#endif // _DEBUG
|
||||
#else // _DLL
|
||||
#ifdef _MT
|
||||
#ifdef _DEBUG
|
||||
#pragma comment(lib, "vc6-re300dm.lib")
|
||||
#else //_DEBUG
|
||||
#pragma comment(lib, "vc6-re300m.lib")
|
||||
#endif //_DEBUG
|
||||
#else //_MT
|
||||
#ifdef _DEBUG
|
||||
#pragma comment(lib, "vc6-re300d.lib")
|
||||
#else //_DEBUG
|
||||
#pragma comment(lib, "vc6-re300.lib")
|
||||
#endif //_DEBUG
|
||||
#endif //_MT
|
||||
#endif //_DLL
|
||||
#endif // __SGI_STL_PORT
|
||||
#endif //BOOST_MSVC
|
||||
|
||||
|
||||
#if defined(__BORLANDC__) && !defined(BOOST_RE_BUILD_DLL)
|
||||
|
||||
#if __BORLANDC__ < 0x550
|
||||
|
||||
#ifdef BOOST_RE_USE_VCL
|
||||
|
||||
#ifdef _RTLDLL
|
||||
#pragma comment(lib, "bcb4re300lv.lib")
|
||||
#else
|
||||
#pragma comment(lib, "bcb4re300v.lib")
|
||||
#endif
|
||||
|
||||
#else // VCL
|
||||
|
||||
#ifdef _RTLDLL
|
||||
#ifdef __MT__
|
||||
#pragma comment(lib, "bcb4re300lm.lib")
|
||||
#else // __MT__
|
||||
#pragma comment(lib, "bcb4re300l.lib")
|
||||
#endif // __MT__
|
||||
#else //_RTLDLL
|
||||
#ifdef __MT__
|
||||
#pragma comment(lib, "bcb4re300m.lib")
|
||||
#else // __MT__
|
||||
#pragma comment(lib, "bcb4re300.lib")
|
||||
#endif // __MT__
|
||||
#endif // _RTLDLL
|
||||
|
||||
#endif // VCL
|
||||
|
||||
#else // C++ Builder 5:
|
||||
|
||||
#ifdef BOOST_RE_USE_VCL
|
||||
|
||||
#ifdef _RTLDLL
|
||||
#pragma comment(lib, "bcb5re300lv.lib")
|
||||
#else
|
||||
#pragma comment(lib, "bcb5re300v.lib")
|
||||
#endif
|
||||
|
||||
#else // VCL
|
||||
|
||||
#ifdef _RTLDLL
|
||||
#ifdef __MT__
|
||||
#pragma comment(lib, "bcb5re300lm.lib")
|
||||
#else // __MT__
|
||||
#pragma comment(lib, "bcb5re300l.lib")
|
||||
#endif // __MT__
|
||||
#else //_RTLDLL
|
||||
#ifdef __MT__
|
||||
#pragma comment(lib, "bcb5re300m.lib")
|
||||
#else // __MT__
|
||||
#pragma comment(lib, "bcb5re300.lib")
|
||||
#endif // __MT__
|
||||
#endif // _RTLDLL
|
||||
|
||||
#endif // VCL
|
||||
|
||||
#endif
|
||||
|
||||
#endif //__BORLANDC__
|
||||
|
||||
#endif //BOOST_RE_NO_LIB
|
||||
|
||||
#endif // BOOST_REGEX_LIBRARY_INCLUDE_HPP
|
||||
|
||||
|
||||
|
||||
|
1834
include/boost/regex/detail/regex_match.hpp
Normal file
1834
include/boost/regex/detail/regex_match.hpp
Normal file
File diff suppressed because it is too large
Load Diff
463
include/boost/regex/detail/regex_options.hpp
Normal file
463
include/boost/regex/detail/regex_options.hpp
Normal file
@ -0,0 +1,463 @@
|
||||
|
||||
#ifndef BOOST_RE_OPT_H
|
||||
#define BOOST_RE_OPT_H
|
||||
|
||||
/* #define BOOST_RE_AUTO_CONFIGURE */
|
||||
#ifdef BOOST_RE_AUTO_CONFIGURE
|
||||
|
||||
/* Compiler options: */
|
||||
|
||||
/* BOOST_NO_STDC_NAMESPACE C library not in namespace std */
|
||||
/* #define BOOST_NO_STDC_NAMESPACE */
|
||||
|
||||
/* BOOST_RE_NO_MUTABLE Disables use of mutable keyword. */
|
||||
/* #define BOOST_RE_NO_MUTABLE */
|
||||
|
||||
/* BOOST_RE_INT32_LONG If 32-bit integers are long */
|
||||
/* #define BOOST_RE_INT32_LONG */
|
||||
|
||||
/* BOOST_RE_NO_TEMPLATE_FRIEND If template friend declarations are not supported */
|
||||
/* #define BOOST_RE_NO_TEMPLATE_FRIEND */
|
||||
|
||||
/* BOOST_RE_PLATFORM_WINDOWS Platform is MS Windows. */
|
||||
/* #define BOOST_RE_PLATFORM_WINDOWS */
|
||||
|
||||
/* BOOST_RE_PLATFORM_DOS Platform if MSDOS. */
|
||||
/* #define BOOST_RE_PLATFORM_DOS */
|
||||
|
||||
/* BOOST_RE_PLATFORM_W32 Platform is MS Win32 */
|
||||
/* #define BOOST_RE_PLATFORM_W32 */
|
||||
|
||||
/* BOOST_RE_NO_W32 Disable Win32 support even when present */
|
||||
/* #define BOOST_RE_NO_W32 */
|
||||
|
||||
/* BOOST_RE_NO_BOOL If bool is not a distict type. */
|
||||
/* #define BOOST_RE_NO_BOOL */
|
||||
|
||||
/* BOOST_RE_NO_WCHAR_H If there is no <wchar.h> */
|
||||
/* #define BOOST_RE_NO_WCHAR_H */
|
||||
|
||||
/* BOOST_RE_NO_WCTYPE_H If there is no <wctype.h> */
|
||||
/* #define BOOST_RE_NO_WCTYPE_H */
|
||||
|
||||
/* BOOST_RE_NO_WCSTRING If there are no wcslen and wcsncmp functions available. */
|
||||
/* #define BOOST_RE_NO_WCSTRING */
|
||||
|
||||
/* BOOST_RE_NO_SWPRINTF If there is no swprintf available. */
|
||||
/* #define BOOST_RE_NO_SWPRINTF */
|
||||
|
||||
/* BOOST_RE_NO_WSPRINTF If there is no wsprintf available. */
|
||||
/* #define BOOST_RE_NO_WSPRINTF */
|
||||
|
||||
/* BOOST_RE_NO_MEMBER_TEMPLATES If member function templates or nested template classes are not allowed. */
|
||||
/* #define BOOST_RE_NO_MEMBER_TEMPLATES */
|
||||
|
||||
/* BOOST_RE_NO_TEMPLATE_RETURNS If template functions based on return type are not supported. */
|
||||
/* #define BOOST_RE_NO_TEMPLATE_RETURNS */
|
||||
|
||||
/* BOOST_RE_NO_PARTIAL_FUNC_SPEC If partial template function specialisation is not supported */
|
||||
/* #define BOOST_RE_NO_PARTIAL_FUNC_SPEC */
|
||||
|
||||
/* BOOST_RE_NO_INT64 If 64bit integers are not supported. */
|
||||
/* BOOST_RE_INT64t The type of a 64-bit signed integer if available. */
|
||||
/* BOOST_RE_IMM64(val) Declares a 64-bit immediate value by appending any
|
||||
necessary suffix to val. */
|
||||
/* BOOST_RE_INT64_T 0 = NA
|
||||
1 = short
|
||||
2 = int
|
||||
3 = long
|
||||
4 = int64_t
|
||||
5 = long long
|
||||
6 = __int64 */
|
||||
/* #define BOOST_RE_INT64_T_0 */
|
||||
/* #define BOOST_RE_INT64_T_1 */
|
||||
/* #define BOOST_RE_INT64_T_2 */
|
||||
/* #define BOOST_RE_INT64_T_3 */
|
||||
/* #define BOOST_RE_INT64_T_4 */
|
||||
/* #define BOOST_RE_INT64_T_5 */
|
||||
/* #define BOOST_RE_INT64_T_6 */
|
||||
|
||||
/* BOOST_RE_NO_CAT Define if the compiler does not support POSIX style
|
||||
message categories (catopen catgets catclose). */
|
||||
/* #define BOOST_RE_NO_CAT */
|
||||
|
||||
/* BOOST_RE_THREADS Define if the compiler supports multiple threads in
|
||||
the current translation mode. */
|
||||
/* #define BOOST_RE_THREADS */
|
||||
|
||||
/* BOOST_RE_NESTED_TEMPLATE_DECL Defaults to template, the standard prefix when accessing
|
||||
nested template classes, can be redefined to nothing if
|
||||
the compiler does not support this. */
|
||||
/* #define BOOST_RE_NESTED_TEMPLATE_DECL */
|
||||
|
||||
/* BOOST_RE_NO_TEMPLATE_INST If explicit template instantiation with the "template class X<T>"
|
||||
syntax is not supported */
|
||||
/* #define BOOST_RE_NO_TEMPLATE_INST */
|
||||
|
||||
/* BOOST_RE_NO_TEMPLATE_MERGE If template in separate translation units don't merge at link time */
|
||||
/* #define BOOST_RE_NO_TEMPLATE_MERGE */
|
||||
|
||||
/* BOOST_RE_NO_TEMPLATE_MERGE_A If template merging from library archives is not supported */
|
||||
/* #define BOOST_RE_NO_TEMPLATE_MERGE_A */
|
||||
|
||||
/* BOOST_RE_NO_TEMPLATE_SWITCH_MERGE If merging of templates containing switch statements is not supported */
|
||||
/* #define BOOST_RE_NO_TEMPLATE_SWITCH_MERGE */
|
||||
|
||||
/* BOOST_RE_CALL Optionally define a calling convention for C++ functions */
|
||||
/* #define BOOST_RE_CALL */
|
||||
|
||||
/* BOOST_RE_CCALL Optionally define a calling convention for C functions */
|
||||
/* #define BOOST_RE_CCALL */
|
||||
|
||||
/* BOOST_RE_SIZEOF_SHORT sizeof(short) */
|
||||
/* #define BOOST_RE_SIZEOF_SHORT */
|
||||
|
||||
/* BOOST_RE_SIZEOF_INT sizeof(int) */
|
||||
/* #define BOOST_RE_SIZEOF_INT */
|
||||
|
||||
/* BOOST_RE_SIZEOF_LONG sizeof(long) */
|
||||
/* #define BOOST_RE_SIZEOF_LONG */
|
||||
|
||||
/* BOOST_RE_SIZEOF_WCHAR_T sizeof(wchar_t) */
|
||||
/* #define BOOST_RE_SIZEOF_WCHAR_T */
|
||||
|
||||
|
||||
/* STL options: */
|
||||
|
||||
/* BOOST_RE_NO_ITERATOR_H Define if you do not have a version of <iterator>. */
|
||||
/* #define BOOST_RE_NO_ITERATOR_H */
|
||||
|
||||
/* BOOST_RE_NO_MEMORY_H Define if <memory> does not fully comply with the
|
||||
latest standard, and is not auto-recognised,
|
||||
that means nested template classes
|
||||
which hardly any compilers support at present. */
|
||||
/* #define BOOST_RE_NO_MEMORY_H */
|
||||
|
||||
/* BOOST_RE_NO_LOCALE_H Define if there is no verion of the standard
|
||||
<locale> header available. */
|
||||
/* #define BOOST_RE_NO_LOCALE_H */
|
||||
|
||||
/* BOOST_RE_NO_STL Disables the use of any supporting STL code. */
|
||||
/* #define BOOST_RE_NO_STL */
|
||||
|
||||
/* BOOST_RE_NO_NOT_EQUAL Disables the generation of operator!= if this
|
||||
clashes with the STL version. */
|
||||
|
||||
/* BOOST_RE_NO_STRING_DEF_ARGS Define if std::basic_string<charT> not allowed - in
|
||||
other words if the template is missing its required
|
||||
default arguments. */
|
||||
/* #define BOOST_RE_NO_STRING_DEF_ARGS */
|
||||
|
||||
/* BOOST_RE_USE_ALGO If <algo.h> not <algorithm> is present */
|
||||
/* #define BOOST_RE_USE_ALGO */
|
||||
|
||||
/* BOOST_RE_OLD_IOSTREAM If the new iostreamm classes are not available */
|
||||
/* #define BOOST_RE_OLD_IOSTREAM */
|
||||
|
||||
/* BOOST_RE_DISTANCE_T For std::distance:
|
||||
0 = NA
|
||||
1 = std::distance(i, j, n)
|
||||
2 = n = std::distance(i, j) */
|
||||
/* #define BOOST_RE_DISTANCE_T_0 */
|
||||
/* #define BOOST_RE_DISTANCE_T_1 */
|
||||
/* #define BOOST_RE_DISTANCE_T_2 */
|
||||
|
||||
/* BOOST_RE_ITERATOR_T Defines generic standard iterator type if available, use this as
|
||||
a shortcut to define all the other iterator types.
|
||||
1 = std::iterator<std::tag_type, T, D, T*, T&>
|
||||
2 = std::iterator<std::tag_type, T, D> */
|
||||
/* #define BOOST_RE_ITERATOR_T_0 */
|
||||
/* #define BOOST_RE_ITERATOR_T_1 */
|
||||
/* #define BOOST_RE_ITERATOR_T_2 */
|
||||
|
||||
/* BOOST_RE_OI_T For output iterators:
|
||||
0 = NA
|
||||
1 = std::iterator<std::output_iterator_tag, T, D, T*, T&>
|
||||
2 = std::iterator<std::output_iterator_tag, T, D>
|
||||
3 = std::output_iterator */
|
||||
/* #define BOOST_RE_OI_T_0 */
|
||||
/* #define BOOST_RE_OI_T_1 */
|
||||
/* #define BOOST_RE_OI_T_2 */
|
||||
/* #define BOOST_RE_OI_T_3 */
|
||||
|
||||
/* BOOST_RE_II_T For input iterators:
|
||||
0 = NA
|
||||
1 = std::iterator<std::input_iterator_tag, T, D, T*, T&>
|
||||
2 = std::iterator<std::input_iterator_tag, T, D>
|
||||
3 = std::input_iterator<T, D>
|
||||
4 = std::input_iterator<T> */
|
||||
/* #define BOOST_RE_II_T_0 */
|
||||
/* #define BOOST_RE_II_T_1 */
|
||||
/* #define BOOST_RE_II_T_2 */
|
||||
/* #define BOOST_RE_II_T_3 */
|
||||
/* #define BOOST_RE_II_T_4 */
|
||||
|
||||
|
||||
/* BOOST_RE_FI_T For forward iterators:
|
||||
0 = NA
|
||||
1 = std::iterator<std::forward_iterator_tag, T, D, T*, T&>
|
||||
2 = std::iterator<std::forward_iterator_tag, T, D>
|
||||
3 = std::forward_iterator<T, D> */
|
||||
/* #define BOOST_RE_FI_T_0 */
|
||||
/* #define BOOST_RE_FI_T_1 */
|
||||
/* #define BOOST_RE_FI_T_2 */
|
||||
/* #define BOOST_RE_FI_T_3 */
|
||||
|
||||
/* BOOST_RE_BI_T For bidirectional iterators:
|
||||
0 = NA
|
||||
1 = std::iterator<std::bidirectional_iterator_tag, T, D, T*, T&>
|
||||
2 = std::iterator<std::bidirectional_iterator_tag, T, D>
|
||||
3 = std::bidirectional_iterator<T, D> */
|
||||
/* #define BOOST_RE_BI_T_0 */
|
||||
/* #define BOOST_RE_BI_T_1 */
|
||||
/* #define BOOST_RE_BI_T_2 */
|
||||
/* #define BOOST_RE_BI_T_3 */
|
||||
|
||||
/* BOOST_RE_RI_T For random access iterators:
|
||||
0 = NA
|
||||
1 = std::iterator<std::random_access_iterator_tag, T, D, T*, T&>
|
||||
2 = std::iterator<std::random_access_iterator_tag, T, D>
|
||||
3 = std::random_access_iterator<T, D> */
|
||||
/* #define BOOST_RE_RI_T_0 */
|
||||
/* #define BOOST_RE_RI_T_1 */
|
||||
/* #define BOOST_RE_RI_T_2 */
|
||||
/* #define BOOST_RE_RI_T_3 */
|
||||
|
||||
/* BOOST_RE_NO_OI_ASSIGN If output iterators ostream_iterator<>, back_insert_iterator<> and
|
||||
front_insert_iterator<> do not have assignment operators */
|
||||
/* #define BOOST_RE_NO_OI_ASSIGN */
|
||||
|
||||
|
||||
#ifdef BOOST_RE_INT64_T_0
|
||||
#define BOOST_RE_NO_INT64
|
||||
#elif defined(BOOST_RE_INT64_T_1)
|
||||
#define BOOST_RE_INT64t short
|
||||
#define BOOST_RE_IMM64(val) val
|
||||
#elif defined(BOOST_RE_INT64_T_2)
|
||||
#define BOOST_RE_INT64t int
|
||||
#define BOOST_RE_IMM64(val) val
|
||||
#elif defined(BOOST_RE_INT64_T_3)
|
||||
#define BOOST_RE_INT64t long
|
||||
#define BOOST_RE_IMM64(val) val##L
|
||||
#elif defined(BOOST_RE_INT64_T_4)
|
||||
#define BOOST_RE_INT64t int64_t
|
||||
#define BOOST_RE_IMM64(val) INT64_C(val)
|
||||
#elif defined(BOOST_RE_INT64_T_5)
|
||||
#define BOOST_RE_INT64t long long
|
||||
#define BOOST_RE_IMM64(val) val##LL
|
||||
#elif defined(BOOST_RE_INT64_T_6)
|
||||
#define BOOST_RE_INT64t __int64
|
||||
#define BOOST_RE_IMM64(val) val##i64
|
||||
#else
|
||||
syntax error: unknown value for BOOST_RE_INT64_T
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_RE_DISTANCE_T_0
|
||||
# define BOOST_RE_DISTANCE(i, j, n) n = j - i
|
||||
#elif defined(BOOST_RE_DISTANCE_T_1)
|
||||
# define BOOST_RE_DISTANCE(i, j, n) n = std::distance(i, j)
|
||||
#elif defined(BOOST_RE_DISTANCE_T_2)
|
||||
# define BOOST_RE_DISTANCE(i, j, n) (n = 0, std::distance(i, j, n))
|
||||
#else
|
||||
syntax erorr
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_RE_ITERATOR_T_0
|
||||
#ifndef BOOST_RE_OI_T_0
|
||||
#define BOOST_RE_OI_T_0 BOOST_RE_ITERATOR_T_0
|
||||
#endif
|
||||
#ifndef BOOST_RE_II_T_0
|
||||
#define BOOST_RE_II_T_0 BOOST_RE_ITERATOR_T_0
|
||||
#endif
|
||||
#ifndef BOOST_RE_FI_T_0
|
||||
#define BOOST_RE_FI_T_0 BOOST_RE_ITERATOR_T_0
|
||||
#endif
|
||||
#ifndef BOOST_RE_BI_T_0
|
||||
#define BOOST_RE_BI_T_0 BOOST_RE_ITERATOR_T_0
|
||||
#endif
|
||||
#ifndef BOOST_RE_RI_T_0
|
||||
#define BOOST_RE_RI_T_0 BOOST_RE_ITERATOR_T_0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_RE_ITERATOR_T_1
|
||||
#ifndef BOOST_RE_OI_T_1
|
||||
#define BOOST_RE_OI_T_1 BOOST_RE_ITERATOR_T_1
|
||||
#endif
|
||||
#ifndef BOOST_RE_II_T_1
|
||||
#define BOOST_RE_II_T_1 BOOST_RE_ITERATOR_T_1
|
||||
#endif
|
||||
#ifndef BOOST_RE_FI_T_1
|
||||
#define BOOST_RE_FI_T_1 BOOST_RE_ITERATOR_T_1
|
||||
#endif
|
||||
#ifndef BOOST_RE_BI_T_1
|
||||
#define BOOST_RE_BI_T_1 BOOST_RE_ITERATOR_T_1
|
||||
#endif
|
||||
#ifndef BOOST_RE_RI_T_1
|
||||
#define BOOST_RE_RI_T_1 BOOST_RE_ITERATOR_T_1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_RE_ITERATOR_T_2
|
||||
#ifndef BOOST_RE_OI_T_2
|
||||
#define BOOST_RE_OI_T_2 BOOST_RE_ITERATOR_T_2
|
||||
#endif
|
||||
#ifndef BOOST_RE_II_T_2
|
||||
#define BOOST_RE_II_T_2 BOOST_RE_ITERATOR_T_2
|
||||
#endif
|
||||
#ifndef BOOST_RE_FI_T_2
|
||||
#define BOOST_RE_FI_T_2 BOOST_RE_ITERATOR_T_2
|
||||
#endif
|
||||
#ifndef BOOST_RE_BI_T_2
|
||||
#define BOOST_RE_BI_T_2 BOOST_RE_ITERATOR_T_2
|
||||
#endif
|
||||
#ifndef BOOST_RE_RI_T_2
|
||||
#define BOOST_RE_RI_T_2 BOOST_RE_ITERATOR_T_2
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_RE_ITERATOR_T_3
|
||||
#ifndef BOOST_RE_OI_T_3
|
||||
#define BOOST_RE_OI_T_3 BOOST_RE_ITERATOR_T_3
|
||||
#endif
|
||||
#ifndef BOOST_RE_II_T_3
|
||||
#define BOOST_RE_II_T_3 BOOST_RE_ITERATOR_T_3
|
||||
#endif
|
||||
#ifndef BOOST_RE_FI_T_3
|
||||
#define BOOST_RE_FI_T_3 BOOST_RE_ITERATOR_T_3
|
||||
#endif
|
||||
#ifndef BOOST_RE_BI_T_3
|
||||
#define BOOST_RE_BI_T_3 BOOST_RE_ITERATOR_T_3
|
||||
#endif
|
||||
#ifndef BOOST_RE_RI_T_3
|
||||
#define BOOST_RE_RI_T_3 BOOST_RE_ITERATOR_T_3
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_RE_ITERATOR_T_4
|
||||
#ifndef BOOST_RE_OI_T_4
|
||||
#define BOOST_RE_OI_T_4 BOOST_RE_ITERATOR_T_4
|
||||
#endif
|
||||
#ifndef BOOST_RE_II_T_4
|
||||
#define BOOST_RE_II_T_4 BOOST_RE_ITERATOR_T_4
|
||||
#endif
|
||||
#ifndef BOOST_RE_FI_T_4
|
||||
#define BOOST_RE_FI_T_4 BOOST_RE_ITERATOR_T_4
|
||||
#endif
|
||||
#ifndef BOOST_RE_BI_T_4
|
||||
#define BOOST_RE_BI_T_4 BOOST_RE_ITERATOR_T_4
|
||||
#endif
|
||||
#ifndef BOOST_RE_RI_T_4
|
||||
#define BOOST_RE_RI_T_4 BOOST_RE_ITERATOR_T_4
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_RE_OI_T_0
|
||||
# define BOOST_RE_OUTPUT_ITERATOR(T, D) boost::re_detail::dummy_iterator_base<T>
|
||||
#elif defined(BOOST_RE_OI_T_1)
|
||||
# define BOOST_RE_OUTPUT_ITERATOR(T, D) std::iterator<std::output_iterator_tag, T, D, T*, T&>
|
||||
#elif defined(BOOST_RE_OI_T_2)
|
||||
# define BOOST_RE_OUTPUT_ITERATOR(T, D) std::iterator<std::output_iterator_tag, T, D>
|
||||
#elif defined(BOOST_RE_OI_T_3)
|
||||
# define BOOST_RE_OUTPUT_ITERATOR(T, D) std::output_iterator
|
||||
#else
|
||||
syntax error
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_RE_II_T_0
|
||||
# define BOOST_RE_INPUT_ITERATOR(T, D) boost::re_detail::dummy_iterator_base<T>
|
||||
#elif defined(BOOST_RE_II_T_1)
|
||||
#define BOOST_RE_INPUT_ITERATOR(T, D) std::iterator<std::input_iterator_tag, T, D, T*, T&>
|
||||
#elif defined(BOOST_RE_II_T_2)
|
||||
#define BOOST_RE_INPUT_ITERATOR(T, D) std::iterator<std::input_iterator_tag, T, D>
|
||||
#elif defined(BOOST_RE_II_T_3)
|
||||
# define BOOST_RE_INPUT_ITERATOR(T, D) std::input_iterator<T, D>
|
||||
#elif defined(BOOST_RE_II_T_4)
|
||||
# define BOOST_RE_INPUT_ITERATOR(T, D) std::input_iterator<T>
|
||||
#else
|
||||
syntax error
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_RE_FI_T_0
|
||||
# define BOOST_RE_FWD_ITERATOR(T, D) boost::re_detail::dummy_iterator_base<T>
|
||||
#elif defined(BOOST_RE_FI_T_1)
|
||||
# define BOOST_RE_FWD_ITERATOR(T, D) std::iterator<std::forward_iterator_tag, T, D, T*, T&>
|
||||
#elif defined(BOOST_RE_FI_T_2)
|
||||
# define BOOST_RE_FWD_ITERATOR(T, D) std::iterator<std::forward_iterator_tag, T, D>
|
||||
#elif defined(BOOST_RE_FI_T_3)
|
||||
# define BOOST_RE_FWD_ITERATOR(T, D) std::forward_iterator<T, D>
|
||||
#else
|
||||
syntax error
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_RE_BI_T_0
|
||||
# define BOOST_RE_BIDI_ITERATOR(T, D) boost::re_detail::dummy_iterator_base<T>
|
||||
#elif defined(BOOST_RE_BI_T_1)
|
||||
# define BOOST_RE_BIDI_ITERATOR(T, D) std::iterator<std::bidirectional_iterator_tag, T, D, T*, T&>
|
||||
#elif defined(BOOST_RE_BI_T_2)
|
||||
# define BOOST_RE_BIDI_ITERATOR(T, D) std::iterator<std::bidirectional_iterator_tag, T, D>
|
||||
#elif defined(BOOST_RE_BI_T_3)
|
||||
# define BOOST_RE_BIDI_ITERATOR(T, D) std::bidirectional_iterator<T, D>
|
||||
#else
|
||||
syntax error
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_RE_RI_T_0
|
||||
# define BOOST_RE_RA_ITERATOR(T, D) boost::re_detail::dummy_iterator_base<T>
|
||||
#elif defined(BOOST_RE_RI_T_1)
|
||||
# define BOOST_RE_RA_ITERATOR(T, D) std::iterator<std::random_access_iterator_tag, T, D, T*, T&>
|
||||
#elif defined(BOOST_RE_RI_T_2)
|
||||
# define BOOST_RE_RA_ITERATOR(T, D) std::iterator<std::random_access_iterator_tag, T, D>
|
||||
#elif defined(BOOST_RE_RI_T_3)
|
||||
# define BOOST_RE_RA_ITERATOR(T, D) std::random_access_iterator<T, D>
|
||||
#else
|
||||
syntax error
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef BOOST_RE_NO_EXCEPTION_H
|
||||
#include <exception>
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_RE_NO_ITERATOR_H
|
||||
#include <iterator>
|
||||
#ifdef BOOST_RE_USE_ALGO
|
||||
#include <algo.h>
|
||||
#else
|
||||
#include <algorithm>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_RE_NO_MEMORY_H) || defined(__GNUC__)
|
||||
#define BOOST_RE_OLD_ALLOCATORS
|
||||
#define REBIND_INSTANCE(x, y, inst) re_alloc_binder<x, y>(inst)
|
||||
#define REBIND_TYPE(x, y) re_alloc_binder<x, y>
|
||||
#define BOOST_RE_DEF_ALLOC_PARAM(x) BOOST_RE_DEFAULT_PARAM( boost::re_detail::jm_def_alloc )
|
||||
#define BOOST_RE_DEF_ALLOC(x) boost::re_detail::jm_def_alloc
|
||||
|
||||
#define BOOST_RE_NEED_BINDER
|
||||
#define BOOST_RE_NEED_ALLOC
|
||||
#else
|
||||
#include <memory>
|
||||
#define REBIND_INSTANCE(x, y, inst) y::BOOST_RE_NESTED_TEMPLATE_DECL rebind<x>::other(inst)
|
||||
#define REBIND_TYPE(x, y) y::BOOST_RE_NESTED_TEMPLATE_DECL rebind<x>::other
|
||||
#define BOOST_RE_DEF_ALLOC_PARAM(x) BOOST_RE_TRICKY_DEFAULT_PARAM( std::allocator<x> )
|
||||
#define BOOST_RE_DEF_ALLOC(x) std::allocator<x>
|
||||
#endif
|
||||
|
||||
|
||||
#endif // BOOST_RE_AUTO_CONFIGURE
|
||||
|
||||
|
||||
#endif /* BOOST_RE_OPT_H */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
251
include/boost/regex/detail/regex_raw_buffer.hpp
Normal file
251
include/boost/regex/detail/regex_raw_buffer.hpp
Normal file
@ -0,0 +1,251 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_raw_buffer.hpp
|
||||
* VERSION 3.04
|
||||
* DESCRIPTION: Raw character buffer for regex code.
|
||||
* Note this is an internal header file included
|
||||
* by regex.hpp, do not include on its own.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_REGEX_RAW_BUFFER_HPP
|
||||
#define BOOST_REGEX_RAW_BUFFER_HPP
|
||||
|
||||
#ifndef BOOST_REGEX_CONFIG_HPP
|
||||
#include <boost/regex/detail/regex_config.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
namespace re_detail{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ == 0x530
|
||||
#pragma option push -a4 -b -Ve
|
||||
#elif __BORLANDC__ > 0x530
|
||||
#pragma option push -a8 -b -Ve
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct empty_padding{};
|
||||
|
||||
union padding
|
||||
{
|
||||
void* p;
|
||||
unsigned int i;
|
||||
};
|
||||
|
||||
template <int N>
|
||||
struct padding3
|
||||
{
|
||||
enum{
|
||||
padding_size = 8,
|
||||
padding_mask = 7
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct padding3<2>
|
||||
{
|
||||
enum{
|
||||
padding_size = 2,
|
||||
padding_mask = 1
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct padding3<4>
|
||||
{
|
||||
enum{
|
||||
padding_size = 4,
|
||||
padding_mask = 3
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct padding3<8>
|
||||
{
|
||||
enum{
|
||||
padding_size = 8,
|
||||
padding_mask = 7
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct padding3<16>
|
||||
{
|
||||
enum{
|
||||
padding_size = 16,
|
||||
padding_mask = 15
|
||||
};
|
||||
};
|
||||
|
||||
enum{
|
||||
padding_size = padding3<sizeof(padding)>::padding_size,
|
||||
padding_mask = padding3<sizeof(padding)>::padding_mask
|
||||
};
|
||||
|
||||
//
|
||||
// class raw_storage
|
||||
// basically this is a simplified vector<unsigned char>
|
||||
// this is used by reg_expression for expression storage
|
||||
//
|
||||
|
||||
template <class Allocator>
|
||||
class raw_storage
|
||||
{
|
||||
public:
|
||||
typedef Allocator allocator_type;
|
||||
typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(unsigned char, allocator_type) alloc_inst_type;
|
||||
typedef typename alloc_inst_type::size_type size_type;
|
||||
typedef typename alloc_inst_type::pointer pointer;
|
||||
private:
|
||||
//
|
||||
// empty member optimisation:
|
||||
struct alloc_data : public alloc_inst_type
|
||||
{
|
||||
typename alloc_inst_type::pointer last;
|
||||
alloc_data(const Allocator& a) : alloc_inst_type(a){}
|
||||
} alloc_inst;
|
||||
pointer start, end;
|
||||
public:
|
||||
|
||||
raw_storage(const Allocator& a = Allocator());
|
||||
raw_storage(size_type n, const Allocator& a = Allocator());
|
||||
|
||||
~raw_storage()
|
||||
{
|
||||
alloc_inst.deallocate(start, (alloc_inst.last - start));
|
||||
}
|
||||
|
||||
void BOOST_RE_CALL resize(size_type n);
|
||||
|
||||
void* BOOST_RE_CALL extend(size_type n)
|
||||
{
|
||||
if(size_type(alloc_inst.last - end) < n)
|
||||
resize(n + (end - start));
|
||||
register void* result = end;
|
||||
end += n;
|
||||
return result;
|
||||
}
|
||||
|
||||
void* BOOST_RE_CALL insert(size_type pos, size_type n);
|
||||
|
||||
size_type BOOST_RE_CALL size()
|
||||
{
|
||||
return end - start;
|
||||
}
|
||||
|
||||
size_type BOOST_RE_CALL capacity()
|
||||
{
|
||||
return alloc_inst.last - start;
|
||||
}
|
||||
|
||||
void* BOOST_RE_CALL data()const
|
||||
{
|
||||
return start;
|
||||
}
|
||||
|
||||
size_type BOOST_RE_CALL index(void* ptr)
|
||||
{
|
||||
return (unsigned char*)ptr - (unsigned char*)data();
|
||||
}
|
||||
|
||||
void BOOST_RE_CALL clear()
|
||||
{
|
||||
end = start;
|
||||
}
|
||||
|
||||
void BOOST_RE_CALL align()
|
||||
{
|
||||
// move end up to a boundary:
|
||||
end = (unsigned char*)start + ((((unsigned char*)end - (unsigned char*)start) + padding_mask) & ~padding_mask);
|
||||
}
|
||||
|
||||
Allocator BOOST_RE_CALL allocator()const;
|
||||
};
|
||||
|
||||
template <class Allocator>
|
||||
CONSTRUCTOR_INLINE raw_storage<Allocator>::raw_storage(const Allocator& a)
|
||||
: alloc_inst(a)
|
||||
{
|
||||
start = end = alloc_inst.allocate(1024);
|
||||
alloc_inst.last = start + 1024;
|
||||
}
|
||||
|
||||
template <class Allocator>
|
||||
CONSTRUCTOR_INLINE raw_storage<Allocator>::raw_storage(size_type n, const Allocator& a)
|
||||
: alloc_inst(a)
|
||||
{
|
||||
start = end = alloc_inst.allocate(n);
|
||||
alloc_inst.last = start + n;
|
||||
}
|
||||
|
||||
template <class Allocator>
|
||||
Allocator BOOST_RE_CALL raw_storage<Allocator>::allocator()const
|
||||
{
|
||||
return alloc_inst;
|
||||
}
|
||||
|
||||
template <class Allocator>
|
||||
void BOOST_RE_CALL raw_storage<Allocator>::resize(size_type n)
|
||||
{
|
||||
register size_type newsize = (alloc_inst.last - start) * 2;
|
||||
register size_type datasize = end - start;
|
||||
if(newsize < n)
|
||||
newsize = n;
|
||||
// extend newsize to WORD/DWORD boundary:
|
||||
newsize = (newsize + padding_mask) & ~(padding_mask);
|
||||
|
||||
// allocate and copy data:
|
||||
register unsigned char* ptr = alloc_inst.allocate(newsize);
|
||||
std::memcpy(ptr, start, datasize);
|
||||
|
||||
// get rid of old buffer:
|
||||
alloc_inst.deallocate(start, (alloc_inst.last - start));
|
||||
|
||||
// and set up pointers:
|
||||
start = ptr;
|
||||
end = ptr + datasize;
|
||||
alloc_inst.last = ptr + newsize;
|
||||
}
|
||||
|
||||
template <class Allocator>
|
||||
void* BOOST_RE_CALL raw_storage<Allocator>::insert(size_type pos, size_type n)
|
||||
{
|
||||
jm_assert(pos <= size_type(end - start));
|
||||
if(size_type(alloc_inst.last - end) < n)
|
||||
resize(n + (end - start));
|
||||
register void* result = start + pos;
|
||||
std::memmove(start + pos + n, start + pos, (end - start) - pos);
|
||||
end += n;
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ > 0x520
|
||||
#pragma option pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // namespace re_detail
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
155
include/boost/regex/detail/regex_split.hpp
Normal file
155
include/boost/regex/detail/regex_split.hpp
Normal file
@ -0,0 +1,155 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_split.hpp
|
||||
* VERSION 3.04
|
||||
* DESCRIPTION: Implements regex_split and associated functions.
|
||||
* Note this is an internal header file included
|
||||
* by regex.hpp, do not include on its own.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_REGEX_SPLIT_HPP
|
||||
#define BOOST_REGEX_SPLIT_HPP
|
||||
|
||||
namespace boost{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ == 0x530
|
||||
#pragma option push -a4 -b -Ve
|
||||
#elif __BORLANDC__ > 0x530
|
||||
#pragma option push -a8 -b -Ve
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace re_detail{
|
||||
|
||||
template <class charT>
|
||||
const reg_expression<charT>& get_default_expression(charT)
|
||||
{
|
||||
static const charT expression_text[] = { '\\', 's', '+', '\00', };
|
||||
static const reg_expression<charT> e(expression_text);
|
||||
return e;
|
||||
}
|
||||
|
||||
template <class OutputIterator, class charT, class Traits1, class Alloc1, class Alloc2>
|
||||
class split_pred
|
||||
{
|
||||
typedef std::basic_string<charT, Traits1, Alloc1> string_type;
|
||||
typedef typename string_type::const_iterator iterator_type;
|
||||
iterator_type* p_last;
|
||||
OutputIterator* p_out;
|
||||
std::size_t* p_max;
|
||||
std::size_t initial_max;
|
||||
public:
|
||||
split_pred(iterator_type* a, OutputIterator* b, std::size_t* c)
|
||||
: p_last(a), p_out(b), p_max(c), initial_max(*c) {}
|
||||
|
||||
bool operator()(const match_results<iterator_type, Alloc2>& what);
|
||||
};
|
||||
|
||||
template <class OutputIterator, class charT, class Traits1, class Alloc1, class Alloc2>
|
||||
bool split_pred<OutputIterator, charT, Traits1, Alloc1, Alloc2>::operator()
|
||||
(const match_results<iterator_type, Alloc2>& what)
|
||||
{
|
||||
*p_last = what[0].second;
|
||||
if(what.size() > 1)
|
||||
{
|
||||
// output sub-expressions only:
|
||||
for(unsigned i = 1; i < what.size(); ++i)
|
||||
{
|
||||
*(*p_out) = static_cast<string_type>(what[i]);
|
||||
++(*p_out);
|
||||
return --*p_max;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// output $` only if it's not-null or not at the start of the input:
|
||||
const sub_match<iterator_type>& sub = what[-1];
|
||||
if((sub.first != sub.second) || (*p_max != initial_max))
|
||||
{
|
||||
*(*p_out) = static_cast<string_type>(sub);
|
||||
++(*p_out);
|
||||
return --*p_max;
|
||||
}
|
||||
}
|
||||
//
|
||||
// initial null, do nothing:
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace re_detail
|
||||
|
||||
template <class OutputIterator, class charT, class Traits1, class Alloc1, class Traits2, class Alloc2>
|
||||
std::size_t regex_split(OutputIterator out,
|
||||
std::basic_string<charT, Traits1, Alloc1>& s,
|
||||
const reg_expression<charT, Traits2, Alloc2>& e,
|
||||
unsigned flags,
|
||||
std::size_t max_split)
|
||||
{
|
||||
typedef typename std::basic_string<charT, Traits1, Alloc1>::const_iterator ci_t;
|
||||
ci_t last = s.begin();
|
||||
std::size_t init_size = max_split;
|
||||
re_detail::split_pred<OutputIterator, charT, Traits1, Alloc1, Alloc2> pred(&last, &out, &max_split);
|
||||
ci_t i, j;
|
||||
i = s.begin();
|
||||
j = s.end();
|
||||
regex_grep(pred, i, j, e, flags);
|
||||
//
|
||||
// if there is still input left, do a final push as long as max_split
|
||||
// is not exhausted, and we're not splitting sub-expressions rather
|
||||
// than whitespace:
|
||||
if(max_split && (last != s.end()) && (e.mark_count() == 1))
|
||||
{
|
||||
*out = std::basic_string<charT, Traits1, Alloc1>((ci_t)last, (ci_t)s.end());
|
||||
++out;
|
||||
last = s.end();
|
||||
--max_split;
|
||||
}
|
||||
//
|
||||
// delete from the string everything that has been processed so far:
|
||||
s.erase(0, last - s.begin());
|
||||
//
|
||||
// return the number of new records pushed:
|
||||
return init_size - max_split;
|
||||
}
|
||||
|
||||
template <class OutputIterator, class charT, class Traits1, class Alloc1, class Traits2, class Alloc2>
|
||||
inline std::size_t regex_split(OutputIterator out,
|
||||
std::basic_string<charT, Traits1, Alloc1>& s,
|
||||
const reg_expression<charT, Traits2, Alloc2>& e,
|
||||
unsigned flags = match_default)
|
||||
{
|
||||
return regex_split(out, s, e, flags, UINT_MAX);
|
||||
}
|
||||
|
||||
template <class OutputIterator, class charT, class Traits1, class Alloc1>
|
||||
inline std::size_t regex_split(OutputIterator out,
|
||||
std::basic_string<charT, Traits1, Alloc1>& s)
|
||||
{
|
||||
return regex_split(out, s, re_detail::get_default_expression(charT(0)), match_default, UINT_MAX);
|
||||
}
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ > 0x520
|
||||
#pragma option pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
230
include/boost/regex/detail/regex_stack.hpp
Normal file
230
include/boost/regex/detail/regex_stack.hpp
Normal file
@ -0,0 +1,230 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_stack.hpp
|
||||
* VERSION 3.04
|
||||
* DESCRIPTION: Implements customised internal regex stacks.
|
||||
* Note this is an internal header file included
|
||||
* by regex.hpp, do not include on its own.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_REGEX_STACK_HPP
|
||||
#define BOOST_REGEX_STACK_HPP
|
||||
|
||||
#ifndef BOOST_REGEX_CONFIG_HPP
|
||||
#include <boost/regex/detail/regex_config.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_RAW_BUFFER_HPP
|
||||
#include <boost/regex/detail/regex_raw_buffer.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
namespace re_detail{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ == 0x530
|
||||
#pragma option push -a4 -b -Ve
|
||||
#elif __BORLANDC__ > 0x530
|
||||
#pragma option push -a8 -b -Ve
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//
|
||||
// class jstack
|
||||
// simplified stack optimised for push/peek/pop
|
||||
// operations, we could use std::stack<std::vector<T>> instead...
|
||||
//
|
||||
template <class T, class Allocator BOOST_RE_DEF_ALLOC_PARAM(T) >
|
||||
class jstack
|
||||
{
|
||||
private:
|
||||
typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(unsigned char, Allocator) allocator_type;
|
||||
typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(T, Allocator) T_alloc_type;
|
||||
typedef typename T_alloc_type::size_type size_type;
|
||||
typedef T value_type;
|
||||
struct node
|
||||
{
|
||||
node* next;
|
||||
T* start; // first item
|
||||
T* end; // last item
|
||||
T* last; // end of storage
|
||||
};
|
||||
|
||||
//
|
||||
// empty base member optimisation:
|
||||
struct data : public allocator_type
|
||||
{
|
||||
padding buf[(sizeof(T) * 16 + sizeof(padding) - 1) / sizeof(padding)];
|
||||
data(const Allocator& a) : allocator_type(a){}
|
||||
};
|
||||
|
||||
data alloc_inst;
|
||||
mutable node* m_stack;
|
||||
mutable node* unused;
|
||||
node base;
|
||||
size_type block_size;
|
||||
|
||||
void BOOST_RE_CALL pop_aux()const;
|
||||
void BOOST_RE_CALL push_aux();
|
||||
|
||||
public:
|
||||
jstack(size_type n = 64, const Allocator& a = Allocator());
|
||||
|
||||
~jstack();
|
||||
|
||||
node* BOOST_RE_CALL get_node()
|
||||
{
|
||||
node* new_stack = (node*)alloc_inst.allocate(sizeof(node) + sizeof(T) * block_size);
|
||||
new_stack->last = (T*)(new_stack+1);
|
||||
new_stack->start = new_stack->end = new_stack->last + block_size;
|
||||
new_stack->next = 0;
|
||||
return new_stack;
|
||||
}
|
||||
|
||||
bool BOOST_RE_CALL empty()
|
||||
{
|
||||
return (m_stack->start == m_stack->end) && (m_stack->next == 0);
|
||||
}
|
||||
|
||||
bool BOOST_RE_CALL good()
|
||||
{
|
||||
return (m_stack->start != m_stack->end) || (m_stack->next != 0);
|
||||
}
|
||||
|
||||
T& BOOST_RE_CALL peek()
|
||||
{
|
||||
if(m_stack->start == m_stack->end)
|
||||
pop_aux();
|
||||
return *m_stack->end;
|
||||
}
|
||||
|
||||
const T& BOOST_RE_CALL peek()const
|
||||
{
|
||||
if(m_stack->start == m_stack->end)
|
||||
pop_aux();
|
||||
return *m_stack->end;
|
||||
}
|
||||
|
||||
void BOOST_RE_CALL pop()
|
||||
{
|
||||
if(m_stack->start == m_stack->end)
|
||||
pop_aux();
|
||||
jm_destroy(m_stack->end);
|
||||
++(m_stack->end);
|
||||
}
|
||||
|
||||
void BOOST_RE_CALL pop(T& t)
|
||||
{
|
||||
if(m_stack->start == m_stack->end)
|
||||
pop_aux();
|
||||
t = *m_stack->end;
|
||||
jm_destroy(m_stack->end);
|
||||
++(m_stack->end);
|
||||
}
|
||||
|
||||
void BOOST_RE_CALL push(const T& t)
|
||||
{
|
||||
if(m_stack->end == m_stack->last)
|
||||
push_aux();
|
||||
--(m_stack->end);
|
||||
jm_construct(m_stack->end, t);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <class T, class Allocator>
|
||||
jstack<T, Allocator>::jstack(size_type n, const Allocator& a)
|
||||
: alloc_inst(a)
|
||||
{
|
||||
unused = 0;
|
||||
block_size = n;
|
||||
m_stack = &base;
|
||||
base.last = reinterpret_cast<T*>(alloc_inst.buf);
|
||||
base.end = base.start = base.last + 16;
|
||||
base.next = 0;
|
||||
}
|
||||
|
||||
template <class T, class Allocator>
|
||||
void BOOST_RE_CALL jstack<T, Allocator>::push_aux()
|
||||
{
|
||||
// make sure we have spare space on TOS:
|
||||
register node* new_node;
|
||||
if(unused)
|
||||
{
|
||||
new_node = unused;
|
||||
unused = new_node->next;
|
||||
new_node->next = m_stack;
|
||||
m_stack = new_node;
|
||||
}
|
||||
else
|
||||
{
|
||||
new_node = get_node();
|
||||
new_node->next = m_stack;
|
||||
m_stack = new_node;
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class Allocator>
|
||||
void BOOST_RE_CALL jstack<T, Allocator>::pop_aux()const
|
||||
{
|
||||
// make sure that we have a valid item
|
||||
// on TOS:
|
||||
jm_assert(m_stack->next);
|
||||
register node* p = m_stack;
|
||||
m_stack = p->next;
|
||||
p->next = unused;
|
||||
unused = p;
|
||||
}
|
||||
|
||||
template <class T, class Allocator>
|
||||
jstack<T, Allocator>::~jstack()
|
||||
{
|
||||
node* condemned;
|
||||
while(good())
|
||||
pop();
|
||||
while(unused)
|
||||
{
|
||||
condemned = unused;
|
||||
unused = unused->next;
|
||||
alloc_inst.deallocate((unsigned char*)condemned, sizeof(node) + sizeof(T) * block_size);
|
||||
}
|
||||
while(m_stack != &base)
|
||||
{
|
||||
condemned = m_stack;
|
||||
m_stack = m_stack->next;
|
||||
alloc_inst.deallocate((unsigned char*)condemned, sizeof(node) + sizeof(T) * block_size);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ > 0x520
|
||||
#pragma option pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // namespace re_detail
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
183
include/boost/regex/detail/regex_synch.hpp
Normal file
183
include/boost/regex/detail/regex_synch.hpp
Normal file
@ -0,0 +1,183 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_synch.hpp
|
||||
* VERSION 3.04
|
||||
* DESCRIPTION: Thread synchronisation for regex code.
|
||||
* Note this is an internal header file included
|
||||
* by regex.hpp, do not include on its own.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_REGEX_SYNCH_HPP
|
||||
#define BOOST_REGEX_SYNCH_HPP
|
||||
|
||||
#ifndef BOOST_REGEX_CONFIG_HPP
|
||||
#include <boost/regex/detail/regex_config.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_RE_PLATFORM_W32) && defined(BOOST_RE_THREADS)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_RE_PLATFORM_W32) && defined(BOOST_RE_THREADS)
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
|
||||
namespace boost{
|
||||
namespace re_detail{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ == 0x530
|
||||
#pragma option push -a4 -b -Ve
|
||||
#elif __BORLANDC__ > 0x530
|
||||
#pragma option push -a8 -b -Ve
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void BOOST_RE_CALL re_init_threads();
|
||||
void BOOST_RE_CALL re_free_threads();
|
||||
|
||||
#ifdef BOOST_RE_THREADS
|
||||
|
||||
#ifndef BOOST_RE_PLATFORM_W32
|
||||
|
||||
typedef pthread_mutex_t CRITICAL_SECTION;
|
||||
|
||||
inline void BOOST_RE_CALL InitializeCriticalSection(CRITICAL_SECTION* ps)
|
||||
{
|
||||
pthread_mutex_init(ps, 0);
|
||||
}
|
||||
|
||||
inline void BOOST_RE_CALL DeleteCriticalSection(CRITICAL_SECTION* ps)
|
||||
{
|
||||
pthread_mutex_destroy(ps);
|
||||
}
|
||||
|
||||
inline void BOOST_RE_CALL EnterCriticalSection(CRITICAL_SECTION* ps)
|
||||
{
|
||||
pthread_mutex_lock(ps);
|
||||
}
|
||||
|
||||
inline void BOOST_RE_CALL LeaveCriticalSection(CRITICAL_SECTION* ps)
|
||||
{
|
||||
pthread_mutex_unlock(ps);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template <class Lock>
|
||||
class lock_guard
|
||||
{
|
||||
typedef Lock lock_type;
|
||||
public:
|
||||
lock_guard(lock_type& m, bool aq = true)
|
||||
: mut(m), owned(false){ acquire(aq); }
|
||||
|
||||
~lock_guard()
|
||||
{ acquire(false); }
|
||||
|
||||
void BOOST_RE_CALL acquire(bool aq = true)
|
||||
{
|
||||
if(aq && !owned)
|
||||
{
|
||||
mut.acquire(true);
|
||||
owned = true;
|
||||
}
|
||||
else if(!aq && owned)
|
||||
{
|
||||
mut.acquire(false);
|
||||
owned = false;
|
||||
}
|
||||
}
|
||||
private:
|
||||
lock_type& mut;
|
||||
bool owned;
|
||||
// VC6 warning suppression:
|
||||
lock_guard& operator=(const lock_guard&);
|
||||
};
|
||||
|
||||
|
||||
class critical_section
|
||||
{
|
||||
public:
|
||||
critical_section()
|
||||
{ InitializeCriticalSection(&hmutex);}
|
||||
|
||||
critical_section(const critical_section&)
|
||||
{ InitializeCriticalSection(&hmutex);}
|
||||
|
||||
const critical_section& BOOST_RE_CALL operator=(const critical_section&)
|
||||
{return *this;}
|
||||
|
||||
~critical_section()
|
||||
{DeleteCriticalSection(&hmutex);}
|
||||
|
||||
private:
|
||||
|
||||
void BOOST_RE_CALL acquire(bool aq)
|
||||
{ if(aq) EnterCriticalSection(&hmutex);
|
||||
else LeaveCriticalSection(&hmutex);
|
||||
}
|
||||
|
||||
CRITICAL_SECTION hmutex;
|
||||
|
||||
public:
|
||||
typedef lock_guard<critical_section> ro_guard;
|
||||
typedef lock_guard<critical_section> rw_guard;
|
||||
|
||||
friend lock_guard<critical_section>;
|
||||
};
|
||||
|
||||
inline bool BOOST_RE_CALL operator==(const critical_section&, const critical_section&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool BOOST_RE_CALL operator<(const critical_section&, const critical_section&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
typedef lock_guard<critical_section> cs_guard;
|
||||
|
||||
BOOST_RE_IX_DECL extern critical_section* p_re_lock;
|
||||
BOOST_RE_IX_DECL extern unsigned int re_lock_count;
|
||||
|
||||
#define BOOST_RE_GUARD(inst) boost::re_detail::critical_section::rw_guard g(inst);
|
||||
|
||||
#else // BOOST_RE_THREADS
|
||||
|
||||
#define BOOST_RE_GUARD(inst)
|
||||
|
||||
#endif // BOOST_RE_THREADS
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ > 0x520
|
||||
#pragma option pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // namespace re_detail
|
||||
} // namespace boost
|
||||
|
||||
#endif // sentry
|
||||
|
||||
|
||||
|
||||
|
||||
|
61
include/boost/regex/pattern_except.hpp
Normal file
61
include/boost/regex/pattern_except.hpp
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE pattern_except.cpp
|
||||
* VERSION 3.01
|
||||
* DESCRIPTION: Declares pattern-matching exception classes.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_RE_PAT_EXCEPT_HPP
|
||||
#define BOOST_RE_PAT_EXCEPT_HPP
|
||||
|
||||
#include <boost/regex/detail/regex_config.hpp>
|
||||
|
||||
namespace boost{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ == 0x530
|
||||
#pragma option push -a4 -b -Ve
|
||||
#elif __BORLANDC__ > 0x530
|
||||
#pragma option push -a8 -b -Ve
|
||||
#endif
|
||||
#endif
|
||||
|
||||
class BOOST_RE_IX_DECL bad_pattern : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
explicit bad_pattern(const std::string& s) : std::runtime_error(s){};
|
||||
~bad_pattern() throw();
|
||||
};
|
||||
|
||||
class BOOST_RE_IX_DECL bad_expression : public bad_pattern
|
||||
{
|
||||
public:
|
||||
explicit bad_expression(const std::string& s) : bad_pattern(s) {}
|
||||
~bad_expression() throw();
|
||||
};
|
||||
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ > 0x520
|
||||
#pragma option pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
797
include/boost/regex/regex_traits.hpp
Normal file
797
include/boost/regex/regex_traits.hpp
Normal file
@ -0,0 +1,797 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex.cpp
|
||||
* VERSION 3.04
|
||||
* DESCRIPTION: Declares regular expression traits classes.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_REGEX_TRAITS_HPP
|
||||
#define BOOST_REGEX_TRAITS_HPP
|
||||
|
||||
#include <boost/cregex.hpp>
|
||||
#include <boost/regex/detail/regex_cstring.hpp>
|
||||
|
||||
namespace boost{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ == 0x530
|
||||
#pragma option push -a4 -b -Ve
|
||||
#elif __BORLANDC__ > 0x530
|
||||
#pragma option push -a8 -b -Ve
|
||||
#endif
|
||||
#endif
|
||||
|
||||
template <class charT>
|
||||
class c_regex_traits;
|
||||
|
||||
namespace re_detail{
|
||||
|
||||
struct mss
|
||||
{
|
||||
unsigned int id;
|
||||
const char* what;
|
||||
};
|
||||
|
||||
BOOST_RE_IX_DECL bool BOOST_RE_CALL re_lookup_def_collate_name(std::string& buf, const char* name);
|
||||
BOOST_RE_IX_DECL unsigned int BOOST_RE_CALL re_get_default_message(char* buf, unsigned int len, unsigned int id);
|
||||
extern BOOST_RE_IX_DECL const char *re_default_error_messages[];
|
||||
BOOST_RE_IX_DECL bool BOOST_RE_CALL re_lookup_def_collate_name(std::string& buf, const char* name);
|
||||
BOOST_RE_IX_DECL bool BOOST_RE_CALL is_combining(wchar_t c);
|
||||
//extern BOOST_RE_IX_DECL const wchar_t combining_ranges[];
|
||||
|
||||
#ifndef BOOST_RE_NO_WCSTRING
|
||||
extern BOOST_RE_IX_DECL wchar_t wide_lower_case_map[];
|
||||
extern BOOST_RE_IX_DECL unsigned short wide_unicode_classes[];
|
||||
#endif
|
||||
|
||||
|
||||
struct BOOST_RE_IX_DECL regex_traits_base
|
||||
{
|
||||
enum char_syntax_type
|
||||
{
|
||||
syntax_char = 0,
|
||||
syntax_open_bracket = 1, // (
|
||||
syntax_close_bracket = 2, // )
|
||||
syntax_dollar = 3, // $
|
||||
syntax_caret = 4, // ^
|
||||
syntax_dot = 5, // .
|
||||
syntax_star = 6, // *
|
||||
syntax_plus = 7, // +
|
||||
syntax_question = 8, // ?
|
||||
syntax_open_set = 9, // [
|
||||
syntax_close_set = 10, // ]
|
||||
syntax_or = 11, // |
|
||||
syntax_slash = 12, //
|
||||
syntax_hash = 13, // #
|
||||
syntax_dash = 14, // -
|
||||
syntax_open_brace = 15, // {
|
||||
syntax_close_brace = 16, // }
|
||||
syntax_digit = 17, // 0-9
|
||||
syntax_b = 18, // for \b
|
||||
syntax_B = 19, // for \B
|
||||
syntax_left_word = 20, // for \<
|
||||
syntax_right_word = 21, // for \>
|
||||
syntax_w = 22, // for \w
|
||||
syntax_W = 23, // for \W
|
||||
syntax_start_buffer = 24, // for \`
|
||||
syntax_end_buffer = 25, // for \'
|
||||
syntax_newline = 26, // for newline alt
|
||||
syntax_comma = 27, // for {x,y}
|
||||
|
||||
syntax_a = 28, // for \a
|
||||
syntax_f = 29, // for \f
|
||||
syntax_n = 30, // for \n
|
||||
syntax_r = 31, // for \r
|
||||
syntax_t = 32, // for \t
|
||||
syntax_v = 33, // for \v
|
||||
syntax_x = 34, // for \xdd
|
||||
syntax_c = 35, // for \cx
|
||||
syntax_colon = 36, // for [:...:]
|
||||
syntax_equal = 37, // for [=...=]
|
||||
|
||||
// perl ops:
|
||||
syntax_e = 38, // for \e
|
||||
syntax_l = 39, // for \l
|
||||
syntax_L = 40, // for \L
|
||||
syntax_u = 41, // for \u
|
||||
syntax_U = 42, // for \U
|
||||
syntax_s = 43, // for \s
|
||||
syntax_S = 44, // for \S
|
||||
syntax_d = 45, // for \d
|
||||
syntax_D = 46, // for \D
|
||||
syntax_E = 47, // for \Q\E
|
||||
syntax_Q = 48, // for \Q\E
|
||||
syntax_X = 49, // for \X
|
||||
syntax_C = 50, // for \C
|
||||
syntax_Z = 51, // for \Z
|
||||
syntax_G = 52, // for \G
|
||||
|
||||
syntax_max = 53
|
||||
};
|
||||
};
|
||||
|
||||
struct BOOST_RE_IX_DECL c_traits_base : public regex_traits_base
|
||||
{
|
||||
public:
|
||||
enum{
|
||||
char_class_none = 0,
|
||||
char_class_alpha = 1,
|
||||
char_class_cntrl = char_class_alpha << 1,
|
||||
char_class_digit = char_class_cntrl << 1,
|
||||
char_class_lower = char_class_digit << 1,
|
||||
char_class_punct = char_class_lower << 1,
|
||||
char_class_space = char_class_punct << 1,
|
||||
char_class_upper = char_class_space << 1,
|
||||
char_class_xdigit = char_class_upper << 1,
|
||||
char_class_blank = char_class_xdigit << 1,
|
||||
char_class_unicode = char_class_blank << 1,
|
||||
char_class_underscore = char_class_unicode << 1,
|
||||
|
||||
char_class_alnum = char_class_alpha | char_class_digit,
|
||||
char_class_graph = char_class_alpha | char_class_digit | char_class_punct | char_class_underscore,
|
||||
char_class_print = char_class_alpha | char_class_digit | char_class_punct | char_class_underscore | char_class_blank,
|
||||
char_class_word = char_class_alpha | char_class_digit | char_class_underscore
|
||||
};
|
||||
static std::string set_message_catalogue(const std::string& s);
|
||||
protected:
|
||||
#if defined(__MWERKS__) && __MWERKS__ <= 0x6000
|
||||
friend class c_regex_traits<char>;
|
||||
friend class c_regex_traits<wchar_t>;
|
||||
#endif
|
||||
|
||||
static char regex_message_catalogue[200];
|
||||
enum syntax_map_size
|
||||
{
|
||||
map_size = UCHAR_MAX + 1
|
||||
};
|
||||
|
||||
static unsigned char syntax_map[map_size];
|
||||
static unsigned short class_map[map_size];
|
||||
static char lower_case_map[map_size];
|
||||
|
||||
static jm_uintfast32_t BOOST_RE_CALL do_lookup_class(const char* p);
|
||||
static bool BOOST_RE_CALL do_lookup_collate(std::string& buf, const char* p);
|
||||
static void BOOST_RE_CALL do_update_ctype();
|
||||
static void BOOST_RE_CALL do_update_collate();
|
||||
public:
|
||||
static std::string error_string(unsigned id);
|
||||
static char* get_catalogue() { return regex_message_catalogue; }
|
||||
};
|
||||
|
||||
} // namespace re_detail
|
||||
|
||||
|
||||
template<>
|
||||
class BOOST_RE_IX_DECL c_regex_traits<char> : public re_detail::c_traits_base
|
||||
{
|
||||
typedef re_detail::c_traits_base base_type;
|
||||
public:
|
||||
typedef char char_type;
|
||||
typedef unsigned char uchar_type;
|
||||
typedef unsigned int size_type;
|
||||
typedef std::string string_type;
|
||||
typedef int locale_type;
|
||||
|
||||
static size_t BOOST_RE_CALL length(const char_type* p)
|
||||
{
|
||||
return std::strlen(p);
|
||||
}
|
||||
static unsigned int BOOST_RE_CALL syntax_type(size_type c)
|
||||
{
|
||||
return syntax_map[c];
|
||||
}
|
||||
static char BOOST_RE_CALL translate(char c, bool icase)
|
||||
{
|
||||
return icase ? lower_case_map[(size_type)(uchar_type)c] : c;
|
||||
}
|
||||
static void BOOST_RE_CALL transform(std::string& out, const std::string& in);
|
||||
|
||||
static void BOOST_RE_CALL transform_primary(std::string& out, const std::string& in);
|
||||
|
||||
static bool BOOST_RE_CALL is_separator(char c)
|
||||
{
|
||||
return BOOST_RE_MAKE_BOOL((c == '\n') || (c == '\r'));
|
||||
}
|
||||
|
||||
static bool BOOST_RE_CALL is_combining(char)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool BOOST_RE_CALL is_class(char c, jm_uintfast32_t f)
|
||||
{
|
||||
return BOOST_RE_MAKE_BOOL(class_map[(size_type)(uchar_type)c] & f);
|
||||
}
|
||||
|
||||
static int BOOST_RE_CALL toi(char c);
|
||||
static int BOOST_RE_CALL toi(const char*& first, const char* last, int radix);
|
||||
|
||||
static jm_uintfast32_t BOOST_RE_CALL lookup_classname(const char* first, const char* last)
|
||||
{
|
||||
std::string s(first, last);
|
||||
return do_lookup_class(s.c_str());
|
||||
}
|
||||
|
||||
static bool BOOST_RE_CALL lookup_collatename(std::string& buf, const char* first, const char* last)
|
||||
{
|
||||
std::string s(first, last);
|
||||
return do_lookup_collate(buf, s.c_str());
|
||||
}
|
||||
|
||||
static locale_type imbue(locale_type l){ return l; }
|
||||
locale_type BOOST_RE_CALL getloc()const{ return locale_type(); }
|
||||
|
||||
c_regex_traits()
|
||||
{
|
||||
init();
|
||||
}
|
||||
~c_regex_traits()
|
||||
{
|
||||
free();
|
||||
}
|
||||
struct sentry
|
||||
{
|
||||
sentry(const c_regex_traits<char>&)
|
||||
{ c_regex_traits<char>::update(); }
|
||||
operator void*() { return this; }
|
||||
};
|
||||
static void update();
|
||||
private:
|
||||
static void init();
|
||||
static void free();
|
||||
static c_regex_traits<char> i;
|
||||
|
||||
static unsigned sort_type;
|
||||
static char sort_delim;
|
||||
};
|
||||
|
||||
#ifndef BOOST_RE_NO_WCSTRING
|
||||
template<>
|
||||
class BOOST_RE_IX_DECL c_regex_traits<wchar_t> : public re_detail::c_traits_base
|
||||
{
|
||||
typedef re_detail::c_traits_base base_type;
|
||||
public:
|
||||
typedef wchar_t char_type;
|
||||
typedef unsigned short uchar_type;
|
||||
typedef unsigned int size_type;
|
||||
typedef std::basic_string<wchar_t> string_type;
|
||||
typedef int locale_type;
|
||||
static size_t BOOST_RE_CALL length(const char_type* p)
|
||||
{
|
||||
return std::wcslen(p);
|
||||
}
|
||||
static unsigned int BOOST_RE_CALL syntax_type(size_type c);
|
||||
static wchar_t BOOST_RE_CALL translate(wchar_t c, bool icase)
|
||||
{
|
||||
return icase ? ((c < 256) ? re_detail::wide_lower_case_map[(uchar_type)c] : std::towlower(c)) : c;
|
||||
}
|
||||
|
||||
static void BOOST_RE_CALL transform(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
|
||||
|
||||
static void BOOST_RE_CALL transform_primary(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
|
||||
|
||||
static bool BOOST_RE_CALL is_separator(wchar_t c)
|
||||
{
|
||||
return BOOST_RE_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (wchar_t)0x2028) || (c == (wchar_t)0x2029));
|
||||
}
|
||||
|
||||
static bool BOOST_RE_CALL is_combining(wchar_t c)
|
||||
{ return re_detail::is_combining(c); }
|
||||
|
||||
static bool BOOST_RE_CALL is_class(wchar_t c, jm_uintfast32_t f)
|
||||
{
|
||||
return BOOST_RE_MAKE_BOOL(((uchar_type)c < 256) ? (re_detail::wide_unicode_classes[(size_type)(uchar_type)c] & f) : do_iswclass(c, f));
|
||||
}
|
||||
|
||||
static int BOOST_RE_CALL toi(wchar_t c);
|
||||
static int BOOST_RE_CALL toi(const wchar_t*& first, const wchar_t* last, int radix);
|
||||
|
||||
static jm_uintfast32_t BOOST_RE_CALL lookup_classname(const wchar_t* first, const wchar_t* last);
|
||||
|
||||
static bool BOOST_RE_CALL lookup_collatename(std::basic_string<wchar_t>& s, const wchar_t* first, const wchar_t* last);
|
||||
|
||||
static locale_type imbue(locale_type l){ return l; }
|
||||
locale_type BOOST_RE_CALL getloc()const{ return locale_type(); }
|
||||
c_regex_traits<wchar_t>()
|
||||
{ init(); }
|
||||
~c_regex_traits<wchar_t>()
|
||||
{ free(); }
|
||||
struct sentry
|
||||
{
|
||||
sentry(const c_regex_traits<wchar_t>&)
|
||||
{ c_regex_traits<wchar_t>::update(); }
|
||||
operator void*() { return this; }
|
||||
};
|
||||
static void BOOST_RE_CALL update();
|
||||
static unsigned int BOOST_RE_CALL strnarrow(char *s1, unsigned int len, const wchar_t *s2);
|
||||
static unsigned int BOOST_RE_CALL strwiden(wchar_t *s1, unsigned int len, const char *s2);
|
||||
private:
|
||||
static bool BOOST_RE_CALL do_iswclass(wchar_t c, jm_uintfast32_t f);
|
||||
static void BOOST_RE_CALL free();
|
||||
static void BOOST_RE_CALL init();
|
||||
static bool BOOST_RE_CALL do_lookup_collate(std::basic_string<wchar_t>& out, const wchar_t* first, const wchar_t* last);
|
||||
static c_regex_traits<wchar_t> init_;
|
||||
|
||||
static unsigned sort_type;
|
||||
static wchar_t sort_delim;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && !defined(BOOST_RE_NO_W32)
|
||||
|
||||
namespace re_detail{
|
||||
|
||||
struct BOOST_RE_IX_DECL w32_traits_base : public regex_traits_base
|
||||
{
|
||||
enum{
|
||||
char_class_none = 0,
|
||||
char_class_alnum = C1_ALPHA | C1_DIGIT,
|
||||
char_class_alpha = C1_ALPHA,
|
||||
char_class_cntrl = C1_CNTRL,
|
||||
char_class_digit = C1_DIGIT,
|
||||
char_class_graph = C1_UPPER | C1_LOWER | C1_DIGIT | C1_PUNCT | C1_ALPHA,
|
||||
char_class_lower = C1_LOWER,
|
||||
char_class_print = C1_UPPER | C1_LOWER | C1_DIGIT | C1_PUNCT | C1_BLANK | C1_ALPHA,
|
||||
char_class_punct = C1_PUNCT,
|
||||
char_class_space = C1_SPACE,
|
||||
char_class_upper = C1_UPPER,
|
||||
char_class_xdigit = C1_XDIGIT,
|
||||
char_class_blank = C1_BLANK,
|
||||
char_class_underscore = 0x0200,
|
||||
char_class_word = C1_ALPHA | C1_DIGIT | char_class_underscore,
|
||||
char_class_unicode = 0x0400
|
||||
};
|
||||
public:
|
||||
static std::string set_message_catalogue(const std::string& s);
|
||||
protected:
|
||||
static char regex_message_catalogue[200];
|
||||
enum syntax_map_size
|
||||
{
|
||||
map_size = UCHAR_MAX + 1
|
||||
};
|
||||
|
||||
static unsigned char syntax_map[map_size];
|
||||
static unsigned short class_map[map_size];
|
||||
static char lower_case_map[map_size];
|
||||
|
||||
static jm_uintfast32_t BOOST_RE_CALL do_lookup_class(const char* p);
|
||||
static bool BOOST_RE_CALL do_lookup_collate(std::string& buf, const char* p);
|
||||
static void BOOST_RE_CALL do_free();
|
||||
static void BOOST_RE_CALL do_init();
|
||||
public:
|
||||
static std::string error_string(unsigned id);
|
||||
static char* get_catalogue() { return regex_message_catalogue; }
|
||||
};
|
||||
|
||||
} // namespace re_detail
|
||||
|
||||
template<class charT>
|
||||
class w32_regex_traits;
|
||||
|
||||
template<>
|
||||
class BOOST_RE_IX_DECL w32_regex_traits<char> : public re_detail::w32_traits_base
|
||||
{
|
||||
typedef re_detail::w32_traits_base base_type;
|
||||
public:
|
||||
typedef char char_type;
|
||||
typedef unsigned char uchar_type;
|
||||
typedef unsigned int size_type;
|
||||
typedef std::string string_type;
|
||||
typedef int locale_type;
|
||||
|
||||
static size_t BOOST_RE_CALL length(const char_type* p)
|
||||
{
|
||||
return std::strlen(p);
|
||||
}
|
||||
static unsigned int BOOST_RE_CALL syntax_type(size_type c)
|
||||
{
|
||||
return syntax_map[c];
|
||||
}
|
||||
static char BOOST_RE_CALL translate(char c, bool icase)
|
||||
{
|
||||
return icase ? lower_case_map[(size_type)(uchar_type)c] : c;
|
||||
}
|
||||
static void BOOST_RE_CALL transform(std::string& out, const std::string& in);
|
||||
|
||||
static void BOOST_RE_CALL transform_primary(std::string& out, const std::string& in);
|
||||
|
||||
static bool BOOST_RE_CALL is_separator(char c)
|
||||
{
|
||||
return BOOST_RE_MAKE_BOOL((c == '\n') || (c == '\r'));
|
||||
}
|
||||
|
||||
static bool BOOST_RE_CALL is_combining(char)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool BOOST_RE_CALL is_class(char c, jm_uintfast32_t f)
|
||||
{
|
||||
return BOOST_RE_MAKE_BOOL(class_map[(size_type)(uchar_type)c] & f);
|
||||
}
|
||||
|
||||
static int BOOST_RE_CALL toi(char c);
|
||||
static int BOOST_RE_CALL toi(const char*& first, const char* last, int radix);
|
||||
|
||||
static jm_uintfast32_t BOOST_RE_CALL lookup_classname(const char* first, const char* last)
|
||||
{
|
||||
std::string s(first, last);
|
||||
return do_lookup_class(s.c_str());
|
||||
}
|
||||
|
||||
static bool BOOST_RE_CALL lookup_collatename(std::string& buf, const char* first, const char* last)
|
||||
{
|
||||
std::string s(first, last);
|
||||
return do_lookup_collate(buf, s.c_str());
|
||||
}
|
||||
|
||||
static locale_type imbue(locale_type l){ return l; }
|
||||
locale_type BOOST_RE_CALL getloc()const{ return locale_type(); }
|
||||
|
||||
struct sentry
|
||||
{
|
||||
sentry(const w32_regex_traits<char>&)
|
||||
{ w32_regex_traits<char>::update(); }
|
||||
~sentry(){}
|
||||
operator void*() { return this; }
|
||||
};
|
||||
static void update();
|
||||
w32_regex_traits();
|
||||
~w32_regex_traits();
|
||||
private:
|
||||
static w32_regex_traits<char> i;
|
||||
};
|
||||
|
||||
#ifndef BOOST_RE_NO_WCSTRING
|
||||
template<>
|
||||
class BOOST_RE_IX_DECL w32_regex_traits<wchar_t> : public re_detail::w32_traits_base
|
||||
{
|
||||
typedef re_detail::w32_traits_base base_type;
|
||||
public:
|
||||
typedef wchar_t char_type;
|
||||
typedef unsigned short uchar_type;
|
||||
typedef unsigned int size_type;
|
||||
typedef std::basic_string<wchar_t> string_type;
|
||||
typedef int locale_type;
|
||||
static size_t BOOST_RE_CALL length(const char_type* p)
|
||||
{
|
||||
return std::wcslen(p);
|
||||
}
|
||||
static unsigned int BOOST_RE_CALL syntax_type(size_type c);
|
||||
static wchar_t BOOST_RE_CALL translate(wchar_t c, bool icase)
|
||||
{
|
||||
return icase ? ((c < 256) ? re_detail::wide_lower_case_map[(uchar_type)c] : wtolower(c)) : c;
|
||||
}
|
||||
|
||||
static void BOOST_RE_CALL transform(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
|
||||
|
||||
static void BOOST_RE_CALL transform_primary(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
|
||||
|
||||
static bool BOOST_RE_CALL is_separator(wchar_t c)
|
||||
{
|
||||
return BOOST_RE_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (wchar_t)0x2028) || (c == (wchar_t)0x2029));
|
||||
}
|
||||
|
||||
static bool BOOST_RE_CALL is_combining(wchar_t c)
|
||||
{ return re_detail::is_combining(c); }
|
||||
|
||||
static bool BOOST_RE_CALL is_class(wchar_t c, jm_uintfast32_t f)
|
||||
{
|
||||
return BOOST_RE_MAKE_BOOL(((uchar_type)c < 256) ? (wide_unicode_classes[(size_type)(uchar_type)c] & f) : do_iswclass(c, f));
|
||||
}
|
||||
|
||||
static int BOOST_RE_CALL toi(wchar_t c);
|
||||
static int BOOST_RE_CALL toi(const wchar_t*& first, const wchar_t* last, int radix);
|
||||
|
||||
static jm_uintfast32_t BOOST_RE_CALL lookup_classname(const wchar_t* first, const wchar_t* last);
|
||||
|
||||
static bool BOOST_RE_CALL lookup_collatename(std::basic_string<wchar_t>& s, const wchar_t* first, const wchar_t* last);
|
||||
|
||||
static locale_type imbue(locale_type l){ return l; }
|
||||
locale_type BOOST_RE_CALL getloc()const{ return locale_type(); }
|
||||
|
||||
struct sentry
|
||||
{
|
||||
sentry(const w32_regex_traits<wchar_t>&)
|
||||
{ w32_regex_traits<wchar_t>::update(); }
|
||||
~sentry(){}
|
||||
operator void*() { return this; }
|
||||
};
|
||||
static void BOOST_RE_CALL update();
|
||||
w32_regex_traits();
|
||||
~w32_regex_traits();
|
||||
static unsigned int BOOST_RE_CALL strnarrow(char *s1, unsigned int len, const wchar_t *s2);
|
||||
static unsigned int BOOST_RE_CALL strwiden(wchar_t *s1, unsigned int len, const char *s2);
|
||||
|
||||
private:
|
||||
static bool BOOST_RE_CALL do_iswclass(wchar_t c, jm_uintfast32_t f);
|
||||
static bool BOOST_RE_CALL do_lookup_collate(std::basic_string<wchar_t>& out, const wchar_t* first, const wchar_t* last);
|
||||
static w32_regex_traits<wchar_t> init_;
|
||||
static wchar_t BOOST_RE_CALL wtolower(wchar_t c);
|
||||
static unsigned short wide_unicode_classes[];
|
||||
};
|
||||
#endif // Wide strings
|
||||
#endif // Win32
|
||||
|
||||
#ifndef BOOST_RE_NO_LOCALE_H
|
||||
|
||||
} // namspace boost
|
||||
|
||||
#include <locale>
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace re_detail
|
||||
{
|
||||
|
||||
template <class charT>
|
||||
struct message_data;
|
||||
|
||||
template <>
|
||||
struct message_data<char>;
|
||||
|
||||
template <>
|
||||
struct message_data<wchar_t>;
|
||||
|
||||
struct BOOST_RE_IX_DECL cpp_regex_traits_base : public regex_traits_base
|
||||
{
|
||||
enum char_class_type
|
||||
{
|
||||
char_class_none = 0,
|
||||
char_class_alnum = std::ctype_base::alnum,
|
||||
char_class_alpha = std::ctype_base::alpha,
|
||||
char_class_cntrl = std::ctype_base::cntrl,
|
||||
char_class_digit = std::ctype_base::digit,
|
||||
char_class_graph = std::ctype_base::graph,
|
||||
char_class_lower = std::ctype_base::lower,
|
||||
char_class_print = std::ctype_base::print,
|
||||
char_class_punct = std::ctype_base::punct,
|
||||
char_class_space = std::ctype_base::space,
|
||||
char_class_upper = std::ctype_base::upper,
|
||||
char_class_xdigit = std::ctype_base::xdigit,
|
||||
char_class_blank = 1<<12,
|
||||
char_class_underscore = 1<<13,
|
||||
char_class_word = std::ctype_base::alnum | char_class_underscore,
|
||||
char_class_unicode = 1<<14,
|
||||
char_class_all_base = char_class_alnum | char_class_alpha | char_class_cntrl
|
||||
| char_class_digit | char_class_graph | char_class_lower
|
||||
| char_class_print | char_class_punct | char_class_space
|
||||
| char_class_upper | char_class_xdigit
|
||||
};
|
||||
|
||||
static std::string set_message_catalogue(const std::string& s);
|
||||
protected:
|
||||
static char regex_message_cat[200];
|
||||
};
|
||||
|
||||
} // namespace re_detail
|
||||
|
||||
template <class charT>
|
||||
class cpp_regex_traits;
|
||||
|
||||
template<>
|
||||
class BOOST_RE_IX_DECL cpp_regex_traits<char> : public re_detail::cpp_regex_traits_base
|
||||
{
|
||||
typedef re_detail::cpp_regex_traits_base base_type;
|
||||
private:
|
||||
re_detail::message_data<char>* pmd;
|
||||
const unsigned char* psyntax;
|
||||
char* lower_map;
|
||||
const std::ctype<char>* pctype;
|
||||
const std::collate<char>* pcollate;
|
||||
std::locale locale_inst;
|
||||
unsigned sort_type;
|
||||
char sort_delim;
|
||||
|
||||
cpp_regex_traits(const cpp_regex_traits&);
|
||||
cpp_regex_traits& operator=(const cpp_regex_traits&);
|
||||
|
||||
public:
|
||||
typedef char char_type;
|
||||
typedef unsigned char uchar_type;
|
||||
typedef unsigned int size_type;
|
||||
typedef std::string string_type;
|
||||
typedef std::locale locale_type;
|
||||
|
||||
cpp_regex_traits();
|
||||
~cpp_regex_traits();
|
||||
|
||||
static size_t BOOST_RE_CALL length(const char_type* p)
|
||||
{
|
||||
return std::strlen(p);
|
||||
}
|
||||
unsigned int BOOST_RE_CALL syntax_type(size_type c)const
|
||||
{
|
||||
return psyntax[c];
|
||||
}
|
||||
char BOOST_RE_CALL translate(char c, bool icase)const
|
||||
{
|
||||
return icase ? lower_map[(size_type)(uchar_type)c] : c;
|
||||
}
|
||||
void BOOST_RE_CALL transform(std::string& out, const std::string& in)const
|
||||
{
|
||||
out = pcollate->transform(in.c_str(), in.c_str() + in.size()).c_str();
|
||||
}
|
||||
|
||||
void BOOST_RE_CALL transform_primary(std::string& out, const std::string& in)const;
|
||||
|
||||
static bool BOOST_RE_CALL is_separator(char c)
|
||||
{
|
||||
return BOOST_RE_MAKE_BOOL((c == '\n') || (c == '\r'));
|
||||
}
|
||||
|
||||
static bool BOOST_RE_CALL is_combining(char)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool BOOST_RE_CALL is_class(char c, jm_uintfast32_t f)const
|
||||
{
|
||||
if(pctype->is((std::ctype<char>::mask)(f & char_class_all_base), c))
|
||||
return true;
|
||||
if((f & char_class_underscore) && (c == '_'))
|
||||
return true;
|
||||
if((f & char_class_blank) && ((c == ' ') || (c == '\t')))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
int BOOST_RE_CALL toi(char c)const;
|
||||
int BOOST_RE_CALL toi(const char*& first, const char* last, int radix)const;
|
||||
|
||||
jm_uintfast32_t BOOST_RE_CALL lookup_classname(const char* first, const char* last)const;
|
||||
bool BOOST_RE_CALL lookup_collatename(std::string& s, const char* first, const char* last)const;
|
||||
|
||||
std::string BOOST_RE_CALL error_string(unsigned id)const;
|
||||
locale_type BOOST_RE_CALL imbue(locale_type l);
|
||||
locale_type BOOST_RE_CALL BOOST_RE_CALL getloc()const{ return locale_inst; }
|
||||
|
||||
struct sentry
|
||||
{
|
||||
sentry(const cpp_regex_traits<char>&){}
|
||||
operator void*() { return this; }
|
||||
};
|
||||
};
|
||||
|
||||
#ifndef BOOST_RE_NO_WCSTRING
|
||||
template<>
|
||||
class BOOST_RE_IX_DECL cpp_regex_traits<wchar_t> : public re_detail::cpp_regex_traits_base
|
||||
{
|
||||
typedef re_detail::cpp_regex_traits_base base_type;
|
||||
public:
|
||||
typedef wchar_t char_type;
|
||||
typedef unsigned short uchar_type;
|
||||
typedef unsigned int size_type;
|
||||
typedef std::basic_string<wchar_t> string_type;
|
||||
typedef std::locale locale_type;
|
||||
|
||||
private:
|
||||
re_detail::message_data<wchar_t>* pmd;
|
||||
const unsigned char* psyntax;
|
||||
wchar_t* lower_map;
|
||||
const std::ctype<wchar_t>* pctype;
|
||||
const std::collate<wchar_t>* pcollate;
|
||||
const std::codecvt<wchar_t, char, std::mbstate_t>* pcdv;
|
||||
std::locale locale_inst;
|
||||
unsigned int BOOST_RE_CALL do_syntax_type(size_type c)const;
|
||||
unsigned sort_type;
|
||||
wchar_t sort_delim;
|
||||
|
||||
cpp_regex_traits(const cpp_regex_traits&);
|
||||
cpp_regex_traits& operator=(const cpp_regex_traits&);
|
||||
|
||||
public:
|
||||
|
||||
static size_t BOOST_RE_CALL length(const char_type* p)
|
||||
{
|
||||
return std::wcslen(p);
|
||||
}
|
||||
unsigned int BOOST_RE_CALL syntax_type(size_type c)const
|
||||
{
|
||||
return (c < UCHAR_MAX) ? psyntax[c] : do_syntax_type(c);
|
||||
}
|
||||
wchar_t BOOST_RE_CALL translate(wchar_t c, bool icase)const
|
||||
{
|
||||
return icase ? (((uchar_type)c) <= UCHAR_MAX) ? lower_map[c] : pctype->tolower(c) : c;
|
||||
}
|
||||
void BOOST_RE_CALL transform(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in)const
|
||||
{
|
||||
out = pcollate->transform(in.c_str(), in.c_str() + in.size());
|
||||
}
|
||||
|
||||
void BOOST_RE_CALL transform_primary(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in)const;
|
||||
|
||||
static bool BOOST_RE_CALL is_separator(wchar_t c)
|
||||
{
|
||||
return BOOST_RE_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (wchar_t)0x2028) || (c == (wchar_t)0x2029));
|
||||
}
|
||||
|
||||
static bool BOOST_RE_CALL is_combining(wchar_t c)
|
||||
{ return re_detail::is_combining(c); }
|
||||
|
||||
bool BOOST_RE_CALL is_class(wchar_t c, jm_uintfast32_t f)const
|
||||
{
|
||||
if(pctype->is((std::ctype<wchar_t>::mask)(f & char_class_all_base), c))
|
||||
return true;
|
||||
if((f & char_class_underscore) && (c == '_'))
|
||||
return true;
|
||||
if((f & char_class_blank) && ((c == ' ') || (c == '\t')))
|
||||
return true;
|
||||
if((f & char_class_unicode) && (c > (size_type)(uchar_type)255))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
int BOOST_RE_CALL toi(wchar_t c)const;
|
||||
int BOOST_RE_CALL toi(const wchar_t*& first, const wchar_t* last, int radix)const;
|
||||
|
||||
jm_uintfast32_t BOOST_RE_CALL lookup_classname(const wchar_t* first, const wchar_t* last)const;
|
||||
bool BOOST_RE_CALL lookup_collatename(std::basic_string<wchar_t>& s, const wchar_t* first, const wchar_t* last)const;
|
||||
|
||||
std::string BOOST_RE_CALL error_string(unsigned id)const;
|
||||
cpp_regex_traits();
|
||||
~cpp_regex_traits();
|
||||
locale_type BOOST_RE_CALL imbue(locale_type l);
|
||||
locale_type BOOST_RE_CALL BOOST_RE_CALL getloc()const{ return locale_inst; }
|
||||
unsigned int BOOST_RE_CALL strwiden(wchar_t *s1, unsigned int len, const char *s2)const;
|
||||
|
||||
struct sentry
|
||||
{
|
||||
sentry(const cpp_regex_traits<wchar_t>&){}
|
||||
operator void*() { return this; }
|
||||
};
|
||||
};
|
||||
#endif // BOOST_RE_NO_WCSTRING
|
||||
|
||||
#endif // BOOST_RE_NO_LOCALE_H
|
||||
|
||||
#ifdef BOOST_RE_LOCALE_W32
|
||||
|
||||
template <class charT>
|
||||
class regex_traits : public w32_regex_traits<charT>
|
||||
{
|
||||
};
|
||||
|
||||
#elif defined(BOOST_RE_LOCALE_C)
|
||||
|
||||
template <class charT>
|
||||
class regex_traits : public c_regex_traits<charT>
|
||||
{
|
||||
};
|
||||
|
||||
#elif defined(BOOST_RE_LOCALE_CPP)
|
||||
|
||||
template <class charT>
|
||||
class regex_traits : public cpp_regex_traits<charT>
|
||||
{
|
||||
};
|
||||
|
||||
#else
|
||||
#error No default localisation model defined
|
||||
#endif
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ > 0x520
|
||||
#pragma option pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // include
|
||||
|
Reference in New Issue
Block a user