mirror of
https://github.com/boostorg/regex.git
synced 2025-07-14 21:06:38 +02:00
Remove dead files.
Strip tabs from files. [SVN r30003]
This commit is contained in:
@ -1,3 +0,0 @@
|
||||
#include <cregex.h>
|
||||
|
||||
|
@ -1,126 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* FILE cregex.h
|
||||
* VERSION see <boost/version.hpp>
|
||||
* deprecated regular expression matching algorithms
|
||||
*/
|
||||
|
||||
#ifndef BOOST_OLD_CREGEX_H
|
||||
#define BOOST_OLD_CREGEX_H
|
||||
|
||||
#include <boost/cregex.hpp>
|
||||
|
||||
//
|
||||
// macro defs:
|
||||
#define JM_STD std
|
||||
#define JM_CSTD std
|
||||
#define JM jm
|
||||
|
||||
#ifdef BOOST_RE_OLD_IOSTREAM
|
||||
#define JM_OLD_IOSTREAM
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace jm = boost;
|
||||
|
||||
#if !defined(BOOST_RE_NO_USING)
|
||||
using boost::regex_tA;
|
||||
using boost::regex_t;
|
||||
using boost::regoff_t;
|
||||
using boost::regmatch_t;
|
||||
using boost::regcompA;
|
||||
using boost::regerrorA;
|
||||
using boost::regexecA;
|
||||
using boost::regfreeA;
|
||||
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
using boost::regex_tW;
|
||||
using boost::regcompW;
|
||||
using boost::regerrorW;
|
||||
using boost::regexecW;
|
||||
using boost::regfreeW;
|
||||
#endif
|
||||
|
||||
using boost::RegEx;
|
||||
using boost::GrepCallback;
|
||||
using boost::GrepFileCallback;
|
||||
using boost::FindFilesCallback;
|
||||
|
||||
using boost::match_flags;
|
||||
using boost::reg_errcode_t;
|
||||
|
||||
using boost::REG_NOERROR;
|
||||
using boost::REG_NOMATCH;
|
||||
using boost::REG_BADPAT;
|
||||
using boost::REG_ECOLLATE;
|
||||
using boost::REG_ECTYPE;
|
||||
using boost::REG_EESCAPE;
|
||||
using boost::REG_ESUBREG;
|
||||
using boost::REG_EBRACK;
|
||||
using boost::REG_EPAREN;
|
||||
using boost::REG_EBRACE;
|
||||
using boost::REG_BADBR;
|
||||
using boost::REG_ERANGE;
|
||||
using boost::REG_ESPACE;
|
||||
using boost::REG_BADRPT;
|
||||
using boost::REG_EEND;
|
||||
using boost::REG_ESIZE;
|
||||
using boost::REG_ERPAREN;
|
||||
using boost::REG_EMPTY;
|
||||
using boost::REG_E_MEMORY;
|
||||
using boost::REG_E_UNKNOWN;
|
||||
using boost::match_default;
|
||||
using boost::match_not_bol;
|
||||
using boost::match_not_eol;
|
||||
using boost::match_not_bob;
|
||||
using boost::match_not_eob;
|
||||
using boost::match_not_bow;
|
||||
using boost::match_not_eow;
|
||||
using boost::match_not_dot_newline;
|
||||
using boost::match_not_dot_null;
|
||||
using boost::match_prev_avail;
|
||||
using boost::match_init;
|
||||
using boost::match_any;
|
||||
using boost::match_not_null;
|
||||
using boost::match_continuous;
|
||||
using boost::match_stop;
|
||||
|
||||
using boost::REG_BASIC;
|
||||
using boost::REG_EXTENDED;
|
||||
using boost::REG_ICASE;
|
||||
using boost::REG_NOSUB;
|
||||
using boost::REG_NEWLINE;
|
||||
using boost::REG_NOSPEC;
|
||||
using boost::REG_PEND;
|
||||
using boost::REG_DUMP;
|
||||
using boost::REG_NOCOLLATE;
|
||||
|
||||
using boost::REG_ASSERT;
|
||||
using boost::REG_INVARG;
|
||||
using boost::REG_ATOI;
|
||||
using boost::REG_ITOA;
|
||||
|
||||
using boost::REG_NOTBOL;
|
||||
using boost::REG_NOTEOL;
|
||||
using boost::REG_STARTEND;
|
||||
|
||||
#endif // BOOST_RE_NO_USING
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifdef BOOST_RE_USING_HACK
|
||||
using namespace boost;
|
||||
#endif
|
||||
|
||||
#endif // include guard
|
||||
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BOOST_FILEITER_H
|
||||
#define BOOST_FILEITER_H
|
||||
|
||||
#include <boost/regex/v3/fileiter.hpp>
|
||||
|
||||
using boost::re_detail::directory_iterator;
|
||||
using boost::re_detail::file_iterator;
|
||||
using boost::re_detail::mapfile;
|
||||
|
||||
#endif
|
||||
|
@ -1,3 +0,0 @@
|
||||
#include <regex.h>
|
||||
|
||||
|
@ -1,436 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* FILE regex.h
|
||||
* VERSION see <boost/version.hpp>
|
||||
* deprecated regular expression matching algorithms
|
||||
*/
|
||||
|
||||
#ifndef BOOST_OLD_REGEX_H
|
||||
#define BOOST_OLD_REGEX_H
|
||||
|
||||
#include <cregex.h>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace deprecated{
|
||||
//
|
||||
// class reg_match:
|
||||
// old name for match_results, this ones just a thin wrapper:
|
||||
//
|
||||
template <class iterator, class Allocator = BOOST_DEFAULT_ALLOCATOR(typename boost::re_detail::def_alloc_param_traits<iterator>::type)>
|
||||
class reg_match : public boost::match_results<iterator, Allocator>
|
||||
{
|
||||
typedef boost::match_results<iterator, Allocator> base_type;
|
||||
typedef boost::re_detail::match_results_base<iterator, Allocator> ancestor;
|
||||
public:
|
||||
reg_match(const Allocator& a = Allocator())
|
||||
: base_type(a){}
|
||||
|
||||
reg_match(const ancestor& m)
|
||||
: base_type(m){}
|
||||
|
||||
reg_match& operator=(const ancestor& m)
|
||||
{
|
||||
// shallow copy
|
||||
ancestor::operator=(m);
|
||||
return *this;
|
||||
}
|
||||
|
||||
reg_match(const base_type& m)
|
||||
: base_type(m){}
|
||||
reg_match& operator=(const base_type& m)
|
||||
{
|
||||
// deep copy
|
||||
base_type::operator=(m);
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
//
|
||||
// proc query_match
|
||||
// returns true if the specified regular expression matches
|
||||
// at position first. Fills in what matched in m.
|
||||
//
|
||||
template <class iterator, class Allocator, class charT, class traits, class Allocator2>
|
||||
bool query_match(iterator first, iterator last, boost::match_results<iterator, Allocator>& m, const reg_expression<charT, traits, Allocator2>& e, unsigned flags = match_default)
|
||||
{
|
||||
return regex_search(first, last, m, e, flags | match_continuous);
|
||||
}
|
||||
|
||||
//
|
||||
// query_match convenience interfaces:
|
||||
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
//
|
||||
// this isn't really a partial specialisation, but template function
|
||||
// overloading - if the compiler doesn't support partial specialisation
|
||||
// then it really won't support this either:
|
||||
template <class charT, class Allocator, class traits, class Allocator2>
|
||||
inline bool query_match(const charT* str,
|
||||
boost::match_results<const charT*, Allocator>& m,
|
||||
const reg_expression<charT, traits, Allocator2>& e,
|
||||
unsigned flags = match_default)
|
||||
{
|
||||
return query_match(str, str + traits::length(str), m, e, flags);
|
||||
}
|
||||
|
||||
template <class ST, class SA, class Allocator, class charT, class traits, class Allocator2>
|
||||
inline bool query_match(const std::basic_string<charT, ST, SA>& s,
|
||||
boost::match_results<typename std::basic_string<charT, ST, SA>::const_iterator, Allocator>& m,
|
||||
const reg_expression<charT, traits, Allocator2>& e,
|
||||
unsigned flags = match_default)
|
||||
{
|
||||
return query_match(s.begin(), s.end(), m, e, flags);
|
||||
}
|
||||
#else // partial ordering
|
||||
inline bool query_match(const char* str,
|
||||
cmatch& m,
|
||||
const regex& e,
|
||||
unsigned flags = match_default)
|
||||
{
|
||||
return query_match(str, str + regex::traits_type::length(str), m, e, flags);
|
||||
}
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
inline bool query_match(const wchar_t* str,
|
||||
wcmatch& m,
|
||||
const wregex& e,
|
||||
unsigned flags = match_default)
|
||||
{
|
||||
return query_match(str, str + wregex::traits_type::length(str), m, e, flags);
|
||||
}
|
||||
#endif
|
||||
inline bool query_match(const std::string& s,
|
||||
boost::match_results<std::string::const_iterator, regex::allocator_type>& m,
|
||||
const regex& e,
|
||||
unsigned flags = match_default)
|
||||
{
|
||||
return query_match(s.begin(), s.end(), m, e, flags);
|
||||
}
|
||||
#if !defined(BOOST_NO_WREGEX)
|
||||
inline bool query_match(const std::basic_string<wchar_t>& s,
|
||||
boost::match_results<std::basic_string<wchar_t>::const_iterator, wregex::allocator_type>& m,
|
||||
const wregex& e,
|
||||
unsigned flags = match_default)
|
||||
{
|
||||
return query_match(s.begin(), s.end(), m, e, flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
template <class iterator, class Allocator, class charT, class traits, class Allocator2>
|
||||
bool reg_search(iterator first, iterator last, boost::match_results<iterator, Allocator>& m, const reg_expression<charT, traits, Allocator2>& e, unsigned flags = match_default)
|
||||
{
|
||||
return boost::regex_search(first, last, m, e, flags);
|
||||
}
|
||||
|
||||
//
|
||||
// reg_search convenience interfaces:
|
||||
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
//
|
||||
// this isn't really a partial specialisation, but template function
|
||||
// overloading - if the compiler doesn't support partial specialisation
|
||||
// then it really won't support this either:
|
||||
template <class charT, class Allocator, class traits, class Allocator2>
|
||||
inline bool reg_search(const charT* str,
|
||||
boost::match_results<const charT*, Allocator>& m,
|
||||
const reg_expression<charT, traits, Allocator2>& e,
|
||||
unsigned flags = match_default)
|
||||
{
|
||||
return reg_search(str, str + traits::length(str), m, e, flags);
|
||||
}
|
||||
|
||||
#ifndef BOOST_RE_NO_STRING_H
|
||||
template <class ST, class SA, class Allocator, class charT, class traits, class Allocator2>
|
||||
inline bool reg_search(const std::basic_string<charT, ST, SA>& s,
|
||||
boost::match_results<typename std::basic_string<charT, ST, SA>::const_iterator, Allocator>& m,
|
||||
const reg_expression<charT, traits, Allocator2>& e,
|
||||
unsigned flags = match_default)
|
||||
{
|
||||
return reg_search(s.begin(), s.end(), m, e, flags);
|
||||
}
|
||||
#endif
|
||||
#else // partial specialisation
|
||||
inline bool reg_search(const char* str,
|
||||
cmatch& m,
|
||||
const regex& e,
|
||||
unsigned flags = match_default)
|
||||
{
|
||||
return reg_search(str, str + regex::traits_type::length(str), m, e, flags);
|
||||
}
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
inline bool reg_search(const wchar_t* str,
|
||||
wcmatch& m,
|
||||
const wregex& e,
|
||||
unsigned flags = match_default)
|
||||
{
|
||||
return reg_search(str, str + wregex::traits_type::length(str), m, e, flags);
|
||||
}
|
||||
#endif
|
||||
#ifndef BOOST_RE_NO_STRING_H
|
||||
inline bool reg_search(const std::string& s,
|
||||
boost::match_results<std::string::const_iterator, regex::allocator_type>& m,
|
||||
const regex& e,
|
||||
unsigned flags = match_default)
|
||||
{
|
||||
return reg_search(s.begin(), s.end(), m, e, flags);
|
||||
}
|
||||
#if !defined(BOOST_NO_WREGEX)
|
||||
inline bool reg_search(const std::basic_string<wchar_t>& s,
|
||||
boost::match_results<std::basic_string<wchar_t>::const_iterator, wregex::allocator_type>& m,
|
||||
const wregex& e,
|
||||
unsigned flags = match_default)
|
||||
{
|
||||
return reg_search(s.begin(), s.end(), m, e, flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// reg_grep:
|
||||
// find all non-overlapping matches within the sequence first last:
|
||||
//
|
||||
template <class Predicate, class iterator, class charT, class traits, class Allocator>
|
||||
inline unsigned int reg_grep(Predicate foo, iterator first, iterator last, const reg_expression<charT, traits, Allocator>& e, unsigned flags = match_default)
|
||||
{
|
||||
return boost::regex_grep(foo, first, last, e, flags);
|
||||
}
|
||||
|
||||
//
|
||||
// reg_grep convenience interfaces:
|
||||
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
//
|
||||
// this isn't really a partial specialisation, but template function
|
||||
// overloading - if the compiler doesn't support partial specialisation
|
||||
// then it really won't support this either:
|
||||
template <class Predicate, class charT, class Allocator, class traits>
|
||||
inline unsigned int reg_grep(Predicate foo, const charT* str,
|
||||
const reg_expression<charT, traits, Allocator>& e,
|
||||
unsigned flags = match_default)
|
||||
{
|
||||
return reg_grep(foo, str, str + traits::length(str), e, flags);
|
||||
}
|
||||
|
||||
#ifndef BOOST_RE_NO_STRING_H
|
||||
template <class Predicate, class ST, class SA, class Allocator, class charT, class traits>
|
||||
inline unsigned int reg_grep(Predicate foo, const std::basic_string<charT, ST, SA>& s,
|
||||
const reg_expression<charT, traits, Allocator>& e,
|
||||
unsigned flags = match_default)
|
||||
{
|
||||
return reg_grep(foo, s.begin(), s.end(), e, flags);
|
||||
}
|
||||
#endif
|
||||
#else // partial specialisation
|
||||
inline unsigned int reg_grep(bool (*foo)(const cmatch&), const char* str,
|
||||
const regex& e,
|
||||
unsigned flags = match_default)
|
||||
{
|
||||
return reg_grep(foo, str, str + regex::traits_type::length(str), e, flags);
|
||||
}
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
inline unsigned int reg_grep(bool (*foo)(const wcmatch&), const wchar_t* str,
|
||||
const wregex& e,
|
||||
unsigned flags = match_default)
|
||||
{
|
||||
return reg_grep(foo, str, str + wregex::traits_type::length(str), e, flags);
|
||||
}
|
||||
#endif
|
||||
#ifndef BOOST_RE_NO_STRING_H
|
||||
inline unsigned int reg_grep(bool (*foo)(const boost::match_results<std::string::const_iterator, regex::allocator_type>&), const std::string& s,
|
||||
const regex& e,
|
||||
unsigned flags = match_default)
|
||||
{
|
||||
return reg_grep(foo, s.begin(), s.end(), e, flags);
|
||||
}
|
||||
#if !defined(BOOST_NO_WREGEX)
|
||||
inline unsigned int reg_grep(bool (*foo)(const boost::match_results<std::basic_string<wchar_t>::const_iterator, wregex::allocator_type>&),
|
||||
const std::basic_string<wchar_t>& s,
|
||||
const wregex& e,
|
||||
unsigned flags = match_default)
|
||||
{
|
||||
return reg_grep(foo, s.begin(), s.end(), e, flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// finally for compatablity with version 1.x of the library
|
||||
// we need a form of reg_grep that takes an output iterator
|
||||
// as its first argument:
|
||||
//
|
||||
|
||||
//
|
||||
// struct grep_match:
|
||||
// stores what matched during a reg_grep,
|
||||
// the output iterator type passed to reg_grep must have an
|
||||
// operator*() that returns a type with an
|
||||
// operator=(const grep_match<iterator, Allocator>&);
|
||||
//
|
||||
template <class iterator, class Allocator>
|
||||
struct grep_match
|
||||
{
|
||||
unsigned int line;
|
||||
iterator line_start;
|
||||
reg_match<iterator, Allocator> what;
|
||||
|
||||
grep_match(Allocator a = Allocator()) : what(a) {}
|
||||
|
||||
grep_match(unsigned int l, iterator p1, const boost::match_results<iterator, Allocator>& m)
|
||||
: what(m) { line = l; line_start = p1; }
|
||||
|
||||
bool operator == (const grep_match& )
|
||||
{ return false; }
|
||||
|
||||
bool operator < (const grep_match&)
|
||||
{ return false; }
|
||||
};
|
||||
|
||||
namespace re_detail{
|
||||
|
||||
template <class O, class I, class A>
|
||||
struct grep_adaptor
|
||||
{
|
||||
O oi;
|
||||
reg_match<I, A> m;
|
||||
grep_adaptor(O i, A a) : m(a), oi(i) {}
|
||||
bool operator()(const boost::re_detail::match_results_base<I, A>& w)
|
||||
{
|
||||
m.what = w;
|
||||
m.line = w.line();
|
||||
m.line_start = w.line_start();
|
||||
*oi = m;
|
||||
++oi;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace re_detail
|
||||
|
||||
template <class Out, class iterator, class charT, class traits, class Allocator>
|
||||
inline unsigned int reg_grep_old(Out oi, iterator first, iterator last, const reg_expression<charT, traits, Allocator>& e, unsigned flags = match_default)
|
||||
{
|
||||
return boost::regex_grep(re_detail::grep_adaptor<Out, iterator, Allocator>(oi, e.allocator()), first, last, e, flags);
|
||||
}
|
||||
|
||||
template <class OutputIterator, class iterator, class Allocator, class charT>
|
||||
OutputIterator BOOST_REGEX_CALL reg_format(OutputIterator out,
|
||||
const boost::match_results<iterator, Allocator>& m,
|
||||
const charT* fmt)
|
||||
{
|
||||
//
|
||||
// start by updating the locale:
|
||||
//
|
||||
return boost::re_detail::_reg_format_aux(out, m, fmt, 0);
|
||||
}
|
||||
|
||||
template <class iterator, class Allocator, class charT>
|
||||
std::basic_string<charT> BOOST_REGEX_CALL reg_format(const boost::match_results<iterator, Allocator>& m, const charT* fmt)
|
||||
{
|
||||
std::basic_string<charT> result;
|
||||
boost::re_detail::string_out_iterator<std::basic_string<charT> > i(result);
|
||||
reg_format(i, m, fmt);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class OutputIterator, class iterator, class traits, class Allocator, class charT>
|
||||
OutputIterator BOOST_REGEX_CALL reg_merge(OutputIterator out,
|
||||
iterator first,
|
||||
iterator last,
|
||||
const reg_expression<charT, traits, Allocator>& e,
|
||||
const charT* fmt,
|
||||
bool copy = true,
|
||||
unsigned int flags = match_default)
|
||||
{
|
||||
//
|
||||
// start by updating the locale:
|
||||
//
|
||||
iterator l = first;
|
||||
if(!copy) flags |= format_no_copy;
|
||||
boost::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 copy ? boost::re_detail::re_copy_out(out, l, last) : out;
|
||||
}
|
||||
|
||||
template <class traits, class Allocator, class charT>
|
||||
std::basic_string<charT> BOOST_REGEX_CALL reg_merge(const std::basic_string<charT>& s,
|
||||
const reg_expression<charT, traits, Allocator>& e,
|
||||
const charT* fmt,
|
||||
bool copy = true,
|
||||
unsigned int flags = match_default)
|
||||
{
|
||||
std::basic_string<charT> result;
|
||||
boost::re_detail::string_out_iterator<std::basic_string<charT> > i(result);
|
||||
reg_merge(i, s.begin(), s.end(), e, fmt, copy, flags);
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace deprecated
|
||||
|
||||
using deprecated::query_match;
|
||||
using deprecated::reg_search;
|
||||
using deprecated::reg_grep;
|
||||
using deprecated::reg_format;
|
||||
using deprecated::reg_merge;
|
||||
//using re_detail::jm_def_alloc;
|
||||
using deprecated::char_regex_traits_i;
|
||||
//using re_detail::re_alloc_binder;
|
||||
using re_detail::padding_size;
|
||||
|
||||
|
||||
} // namspace boost
|
||||
|
||||
namespace jm = boost;
|
||||
|
||||
#if !defined(BOOST_RE_NO_NAMESPACES) && !defined(BOOST_RE_NO_USING)
|
||||
|
||||
using boost::bad_expression;
|
||||
template<class charT>
|
||||
struct char_regex_traits : boost::regex_traits<charT>{};
|
||||
using boost::deprecated::char_regex_traits_i;
|
||||
using boost::regbase;
|
||||
using boost::reg_expression;
|
||||
using boost::deprecated::reg_match;
|
||||
//using boost::reg_match_base;
|
||||
using boost::sub_match;
|
||||
using boost::regex;
|
||||
using boost::cmatch;
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
using boost::wregex;
|
||||
using boost::wcmatch;
|
||||
#endif
|
||||
using boost::deprecated::reg_match;
|
||||
using boost::deprecated::query_match;
|
||||
using boost::deprecated::reg_search;
|
||||
using boost::deprecated::reg_grep;
|
||||
using boost::deprecated::reg_format;
|
||||
using boost::deprecated::reg_merge;
|
||||
//using boost::re_detail::jm_def_alloc;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_RE_USING_HACK
|
||||
using namespace boost;
|
||||
using namespace boost::deprecated;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -1,74 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <regex>
|
||||
|
||||
using namespace std;
|
||||
|
||||
regex expression("^([0-9]+)(\\-| |$)(.*)$");
|
||||
|
||||
// process_ftp:
|
||||
// on success returns the ftp response code, and fills
|
||||
// msg with the ftp response message.
|
||||
int process_ftp(const char* response, std::string* msg)
|
||||
{
|
||||
cmatch what;
|
||||
if(query_match(response, response + strlen(response), what, expression))
|
||||
{
|
||||
// what[0] contains the whole string
|
||||
// what[1] contains the response code
|
||||
// what[2] contains the separator character
|
||||
// what[3] contains the text message.
|
||||
if(msg)
|
||||
msg->assign(what[3].first, what[3].second);
|
||||
return atoi(what[1].first);
|
||||
}
|
||||
// failure did not match
|
||||
if(msg)
|
||||
msg->erase();
|
||||
return -1;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
std::string in, out;
|
||||
while(true)
|
||||
{
|
||||
cout << "enter test string" << endl;
|
||||
std::getline(cin, in);
|
||||
if(in == "quit")
|
||||
break;
|
||||
int result;
|
||||
result = process_ftp(in.c_str(), &out);
|
||||
if(result != -1)
|
||||
{
|
||||
cout << "Match found:" << endl;
|
||||
cout << "Response code: " << result << endl;
|
||||
cout << "Message text: " << out << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << "Match not found" << endl;
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,81 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <regex>
|
||||
|
||||
// purpose:
|
||||
// takes the contents of a file in the form of a string
|
||||
// and searches for all the C++ class definitions, storing
|
||||
// their locations in a map of strings/int's
|
||||
|
||||
typedef std::map<std::string, int, std::less<std::string> > map_type;
|
||||
|
||||
regex expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>[[:space:]]*)?(\\{|:[^;\\{()]*\\{)");
|
||||
|
||||
void IndexClasses(map_type& m, const std::string& file)
|
||||
{
|
||||
std::string::const_iterator start, end;
|
||||
start = file.begin();
|
||||
end = file.end();
|
||||
reg_match<std::string::const_iterator> what;
|
||||
unsigned int flags = match_default;
|
||||
while(reg_search(start, end, what, expression, flags))
|
||||
{
|
||||
// what[0] contains the whole string
|
||||
// what[5] contains the class name.
|
||||
// what[6] contains the template specialisation if any.
|
||||
// add class name and position to map:
|
||||
m[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] =
|
||||
what[5].first - file.begin();
|
||||
// update search position:
|
||||
start = what[0].second;
|
||||
// update flags:
|
||||
flags |= match_prev_avail;
|
||||
flags |= ~match_not_bob;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#include <fileiter.h>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
for(int i = 1; i < argc; ++i)
|
||||
{
|
||||
cout << "Processing file " << argv[i] << endl;
|
||||
map_type m;
|
||||
mapfile f(argv[i]);
|
||||
std::string text(f.begin(), f.end());
|
||||
IndexClasses(m, text);
|
||||
cout << m.size() << " matches found" << endl;
|
||||
map_type::iterator c, d;
|
||||
c = m.begin();
|
||||
d = m.end();
|
||||
while(c != d)
|
||||
{
|
||||
cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl;
|
||||
++c;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,82 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <regex>
|
||||
|
||||
// purpose:
|
||||
// takes the contents of a file in the form of a string
|
||||
// and searches for all the C++ class definitions, storing
|
||||
// their locations in a map of strings/int's
|
||||
|
||||
typedef std::map<std::string, int, std::less<std::string> > map_type;
|
||||
|
||||
regex expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>[[:space:]]*)?(\\{|:[^;\\{()]*\\{)");
|
||||
|
||||
class IndexClassesPred
|
||||
{
|
||||
map_type& m;
|
||||
std::string::const_iterator base;
|
||||
public:
|
||||
IndexClassesPred(map_type& a, std::string::const_iterator b) : m(a), base(b) {}
|
||||
bool operator()(const reg_match<std::string::const_iterator, regex::alloc_type>& what)
|
||||
{
|
||||
// what[0] contains the whole string
|
||||
// what[5] contains the class name.
|
||||
// what[6] contains the template specialisation if any.
|
||||
// add class name and position to map:
|
||||
m[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] =
|
||||
what[5].first - base;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void IndexClasses(map_type& m, const std::string& file)
|
||||
{
|
||||
std::string::const_iterator start, end;
|
||||
start = file.begin();
|
||||
end = file.end();
|
||||
reg_grep(IndexClassesPred(m, start), start, end, expression, match_default);
|
||||
}
|
||||
|
||||
|
||||
#include <fileiter.h>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
for(int i = 1; i < argc; ++i)
|
||||
{
|
||||
cout << "Processing file " << argv[i] << endl;
|
||||
map_type m;
|
||||
mapfile f(argv[i]);
|
||||
std::string text(f.begin(), f.end());
|
||||
IndexClasses(m, text);
|
||||
cout << m.size() << " matches found" << endl;
|
||||
map_type::iterator c, d;
|
||||
c = m.begin();
|
||||
d = m.end();
|
||||
while(c != d)
|
||||
{
|
||||
cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl;
|
||||
++c;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,102 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <iterator>
|
||||
#include <regex>
|
||||
#include <fileiter.h>
|
||||
|
||||
// purpose:
|
||||
// takes the contents of a file and transform to
|
||||
// syntax highlighted code in html format
|
||||
|
||||
regex e1, e2;
|
||||
extern const char* expression_text;
|
||||
extern const char* format_string;
|
||||
extern const char* pre_expression;
|
||||
extern const char* pre_format;
|
||||
extern const char* header_text;
|
||||
extern const char* footer_text;
|
||||
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
e1.set_expression(expression_text);
|
||||
e2.set_expression(pre_expression);
|
||||
for(int i = 1; i < argc; ++i)
|
||||
{
|
||||
std::cout << "Processing file " << argv[i] << std::endl;
|
||||
mapfile in(argv[i]);
|
||||
std::string out_name(std::string(argv[i]) + std::string(".htm"));
|
||||
std::ofstream os(out_name.c_str());
|
||||
os << header_text;
|
||||
// strip '<' and '>' first by outputting to a
|
||||
// temporary string stream
|
||||
std::ostringstream t(std::ios::out | std::ios::binary);
|
||||
std::ostream_iterator<char, char> oi(t);
|
||||
reg_merge(oi, in.begin(), in.end(), e2, pre_format, true);
|
||||
// then output to final output stream
|
||||
// adding syntax highlighting:
|
||||
std::string s(t.str());
|
||||
std::ostream_iterator<char, char> out(os);
|
||||
reg_merge(out, s.begin(), s.end(), e1, format_string, true);
|
||||
os << footer_text;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern const char* pre_expression = "(<)|(>)|\\r";
|
||||
extern const char* pre_format = "(?1<)(?2>)";
|
||||
|
||||
|
||||
const char* expression_text = // preprocessor directives: index 1
|
||||
"(^[[:blank:]]*#([^\\n]*\\\\[[:space:]]+)*[^\\n]*)|"
|
||||
// comment: index 3
|
||||
"(//[^\\n]*|/\\*([^*]|\\*+[^*/])*\\*+/)|"
|
||||
// literals: index 5
|
||||
"\\<([+-]?((0x[[:xdigit:]]+)|(([[:digit:]]*\\.)?[[:digit:]]+([eE][+-]?[[:digit:]]+)?))u?((int(8|16|32|64))|L)?)\\>|"
|
||||
// string literals: index 14
|
||||
"('([^\\\\']|\\\\.)*'|\"([^\\\\\"]|\\\\.)*\")|"
|
||||
// keywords: index 17
|
||||
"\\<(__asm|__cdecl|__declspec|__export|__far16|__fastcall|__fortran|__import"
|
||||
"|__pascal|__rtti|__stdcall|_asm|_cdecl|__except|_export|_far16|_fastcall"
|
||||
"|__finally|_fortran|_import|_pascal|_stdcall|__thread|__try|asm|auto|bool"
|
||||
"|break|case|catch|cdecl|char|class|const|const_cast|continue|default|delete"
|
||||
"|do|double|dynamic_cast|else|enum|explicit|extern|false|float|for|friend|goto"
|
||||
"|if|inline|int|long|mutable|namespace|new|operator|pascal|private|protected"
|
||||
"|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_cast"
|
||||
"|struct|switch|template|this|throw|true|try|typedef|typeid|typename|union|unsigned"
|
||||
"|using|virtual|void|volatile|wchar_t|while)\\>"
|
||||
;
|
||||
|
||||
const char* format_string = "(?1<font color=\"#008040\">$&</font>)"
|
||||
"(?3<I><font color=\"#000080\">$&</font></I>)"
|
||||
"(?5<font color=\"#0000A0\">$&</font>)"
|
||||
"(?14<font color=\"#0000FF\">$&</font>)"
|
||||
"(?17<B>$&</B>)";
|
||||
|
||||
const char* header_text = "<HTML>\n<HEAD>\n"
|
||||
"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=windows-1252\">\n"
|
||||
"</HEAD>\n"
|
||||
"<BODY LINK=\"#0000ff\" VLINK=\"#800080\" BGCOLOR=\"#ffff99\">\n"
|
||||
"<PARA> </PARA>\n<PRE>";
|
||||
|
||||
const char* footer_text = "</PRE>\n</BODY>\n\n";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <regex>
|
||||
|
||||
// purpose:
|
||||
// takes the contents of a file in the form of a string
|
||||
// and searches for all the C++ class definitions, storing
|
||||
// their locations in a map of strings/int's
|
||||
|
||||
typedef std::map<std::string, int, std::less<std::string> > map_type;
|
||||
|
||||
regex expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>[[:space:]]*)?(\\{|:[^;\\{()]*\\{)");
|
||||
map_type class_index;
|
||||
std::string::const_iterator base;
|
||||
|
||||
bool grep_callback(const reg_match<std::string::const_iterator, regex::alloc_type>& what)
|
||||
{
|
||||
// what[0] contains the whole string
|
||||
// what[5] contains the class name.
|
||||
// what[6] contains the template specialisation if any.
|
||||
// add class name and position to map:
|
||||
class_index[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] =
|
||||
what[5].first - base;
|
||||
return true;
|
||||
}
|
||||
|
||||
void IndexClasses(const std::string& file)
|
||||
{
|
||||
std::string::const_iterator start, end;
|
||||
start = file.begin();
|
||||
end = file.end();
|
||||
base = start;
|
||||
reg_grep(grep_callback, start, end, expression, match_default);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,97 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <regex>
|
||||
#include <functional>
|
||||
|
||||
// purpose:
|
||||
// takes the contents of a file in the form of a string
|
||||
// and searches for all the C++ class definitions, storing
|
||||
// their locations in a map of strings/int's
|
||||
|
||||
typedef std::map<std::string, int, std::less<std::string> > map_type;
|
||||
|
||||
class class_index
|
||||
{
|
||||
jm::regex expression;
|
||||
map_type index;
|
||||
std::string::const_iterator base;
|
||||
|
||||
bool grep_callback(reg_match<std::string::const_iterator, regex::alloc_type> what);
|
||||
public:
|
||||
map_type& get_map() { return index; }
|
||||
void IndexClasses(const std::string& file);
|
||||
class_index()
|
||||
: index(),
|
||||
expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"
|
||||
"(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?"
|
||||
"[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>[[:space:]]*)?"
|
||||
"(\\{|:[^;\\{()]*\\{)"
|
||||
){}
|
||||
};
|
||||
|
||||
bool class_index::grep_callback(reg_match<std::string::const_iterator, regex::alloc_type> what)
|
||||
{
|
||||
// what[0] contains the whole string
|
||||
// what[5] contains the class name.
|
||||
// what[6] contains the template specialisation if any.
|
||||
// add class name and position to map:
|
||||
index[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] =
|
||||
what[5].first - base;
|
||||
return true;
|
||||
}
|
||||
|
||||
void class_index::IndexClasses(const std::string& file)
|
||||
{
|
||||
std::string::const_iterator start, end;
|
||||
start = file.begin();
|
||||
end = file.end();
|
||||
base = start;
|
||||
reg_grep(std::bind1st(std::mem_fun(&class_index::grep_callback), this),
|
||||
start,
|
||||
end,
|
||||
expression,
|
||||
match_default);
|
||||
}
|
||||
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
#include <fileiter.h>
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
for(int i = 1; i < argc; ++i)
|
||||
{
|
||||
cout << "Processing file " << argv[i] << endl;
|
||||
mapfile f(argv[i]);
|
||||
std::string text(f.begin(), f.end());
|
||||
class_index i;
|
||||
i.IndexClasses(text);
|
||||
cout << i.get_map().size() << " matches found" << endl;
|
||||
map_type::iterator c, d;
|
||||
c = i.get_map().begin();
|
||||
d = i.get_map().end();
|
||||
while(c != d)
|
||||
{
|
||||
cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl;
|
||||
++c;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,99 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <regex>
|
||||
#include <functional>
|
||||
|
||||
// purpose:
|
||||
// takes the contents of a file in the form of a string
|
||||
// and searches for all the C++ class definitions, storing
|
||||
// their locations in a map of strings/int's
|
||||
|
||||
typedef std::map<std::string, int, std::less<std::string> > map_type;
|
||||
|
||||
class class_index
|
||||
{
|
||||
jm::regex expression;
|
||||
map_type index;
|
||||
std::string::const_iterator base;
|
||||
typedef reg_match<std::string::const_iterator, regex::alloc_type> arg_type;
|
||||
|
||||
bool grep_callback(const reg_match<std::string::const_iterator, regex::alloc_type>& what);
|
||||
public:
|
||||
map_type& get_map() { return index; }
|
||||
typedef bool (__closure* grep_callback_type)(const arg_type&);
|
||||
void IndexClasses(const std::string& file);
|
||||
class_index()
|
||||
: index(),
|
||||
expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"
|
||||
"(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?"
|
||||
"[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>[[:space:]]*)?"
|
||||
"(\\{|:[^;\\{()]*\\{)"
|
||||
){}
|
||||
};
|
||||
|
||||
bool class_index::grep_callback(const reg_match<std::string::const_iterator, regex::alloc_type>& what)
|
||||
{
|
||||
// what[0] contains the whole string
|
||||
// what[5] contains the class name.
|
||||
// what[6] contains the template specialisation if any.
|
||||
// add class name and position to map:
|
||||
index[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] =
|
||||
what[5].first - base;
|
||||
return true;
|
||||
}
|
||||
|
||||
void class_index::IndexClasses(const std::string& file)
|
||||
{
|
||||
std::string::const_iterator start, end;
|
||||
start = file.begin();
|
||||
end = file.end();
|
||||
base = start;
|
||||
class_index::grep_callback_type cl = &(this->grep_callback);
|
||||
reg_grep(cl,
|
||||
start,
|
||||
end,
|
||||
expression,
|
||||
match_default);
|
||||
}
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
#include <fileiter.h>
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
for(int i = 1; i < argc; ++i)
|
||||
{
|
||||
cout << "Processing file " << argv[i] << endl;
|
||||
mapfile f(argv[i]);
|
||||
std::string text(f.begin(), f.end());
|
||||
class_index i;
|
||||
i.IndexClasses(text);
|
||||
cout << i.get_map().size() << " matches found" << endl;
|
||||
map_type::iterator c, d;
|
||||
c = i.get_map().begin();
|
||||
d = i.get_map().end();
|
||||
while(c != d)
|
||||
{
|
||||
cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl;
|
||||
++c;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user