2010-06-29 17:09:40 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file regexp.h
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Peter Kümmel
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LYX_REGEXP_H
|
|
|
|
#define LYX_REGEXP_H
|
|
|
|
|
2016-06-07 18:33:06 +00:00
|
|
|
#ifdef LYX_USE_STD_REGEX
|
2014-12-23 21:18:08 +00:00
|
|
|
# include <regex>
|
2014-12-21 19:19:12 +00:00
|
|
|
// <regex> in gcc is unusable in versions less than 4.9.0
|
|
|
|
// see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53631
|
|
|
|
# define LR_NS std
|
2014-12-23 21:18:08 +00:00
|
|
|
#else
|
2010-06-30 11:04:30 +00:00
|
|
|
# include <boost/regex.hpp>
|
|
|
|
# define LR_NS boost
|
2015-11-24 19:31:14 +00:00
|
|
|
#endif
|
|
|
|
|
2011-03-02 21:28:36 +00:00
|
|
|
namespace lyx {
|
|
|
|
using LR_NS::regex;
|
|
|
|
using LR_NS::regex_match;
|
2015-11-22 12:02:39 +00:00
|
|
|
using LR_NS::regex_replace;
|
|
|
|
using LR_NS::regex_search;
|
2011-03-02 21:28:36 +00:00
|
|
|
using LR_NS::sregex_iterator;
|
|
|
|
using LR_NS::smatch;
|
|
|
|
using LR_NS::basic_regex;
|
|
|
|
using LR_NS::regex_error;
|
2010-06-30 11:04:30 +00:00
|
|
|
using LR_NS::match_results;
|
|
|
|
|
|
|
|
namespace regex_constants
|
2010-06-29 17:09:40 +00:00
|
|
|
{
|
2010-06-30 11:04:30 +00:00
|
|
|
using namespace LR_NS::regex_constants;
|
|
|
|
using LR_NS::regex_constants::match_flag_type;
|
2010-06-29 17:09:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-06-30 11:04:30 +00:00
|
|
|
#undef LR_NS
|
2010-06-29 17:09:40 +00:00
|
|
|
|
2017-04-16 21:10:17 +00:00
|
|
|
#ifdef LYX_USE_STD_REGEX
|
|
|
|
// Match Begin and End of String when using ECMAScript (default std::regex)
|
|
|
|
#define REGEX_BOS "^"
|
|
|
|
#define REGEX_EOS "$"
|
|
|
|
#else
|
|
|
|
// Match Begin and End of String when using Perl RE (default boost::regex)
|
|
|
|
#define REGEX_BOS "\\`"
|
|
|
|
#define REGEX_EOS "\\'"
|
|
|
|
#endif
|
|
|
|
|
2010-06-29 17:09:40 +00:00
|
|
|
#endif
|