Chris@16: /* Chris@16: * Chris@16: * Copyright (c) 1998-2002 Chris@16: * John Maddock Chris@16: * Chris@16: * Use, modification and distribution are subject to the Chris@16: * Boost Software License, Version 1.0. (See accompanying file Chris@16: * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: * Chris@16: */ Chris@16: Chris@16: /* Chris@16: * LOCATION: see http://www.boost.org for most recent version. Chris@16: * FILE regbase.cpp Chris@16: * VERSION see Chris@16: * DESCRIPTION: Declares class regbase. Chris@16: */ Chris@16: Chris@16: #ifndef BOOST_REGEX_V4_REGBASE_HPP Chris@16: #define BOOST_REGEX_V4_REGBASE_HPP Chris@16: Chris@16: #ifdef BOOST_MSVC Chris@16: #pragma warning(push) Chris@16: #pragma warning(disable: 4103) Chris@16: #endif Chris@16: #ifdef BOOST_HAS_ABI_HEADERS Chris@16: # include BOOST_ABI_PREFIX Chris@16: #endif Chris@16: #ifdef BOOST_MSVC Chris@16: #pragma warning(pop) Chris@16: #endif Chris@16: Chris@16: namespace boost{ Chris@16: // Chris@16: // class regbase Chris@16: // handles error codes and flags Chris@16: // Chris@16: class BOOST_REGEX_DECL regbase Chris@16: { Chris@16: public: Chris@16: enum flag_type_ Chris@16: { Chris@16: // Chris@16: // Divide the flags up into logical groups: Chris@16: // bits 0-7 indicate main synatx type. Chris@16: // bits 8-15 indicate syntax subtype. Chris@16: // bits 16-31 indicate options that are common to all Chris@16: // regex syntaxes. Chris@16: // In all cases the default is 0. Chris@16: // Chris@16: // Main synatx group: Chris@16: // Chris@16: perl_syntax_group = 0, // default Chris@16: basic_syntax_group = 1, // POSIX basic Chris@16: literal = 2, // all characters are literals Chris@16: main_option_type = literal | basic_syntax_group | perl_syntax_group, // everything! Chris@16: // Chris@16: // options specific to perl group: Chris@16: // Chris@16: no_bk_refs = 1 << 8, // \d not allowed Chris@16: no_perl_ex = 1 << 9, // disable perl extensions Chris@16: no_mod_m = 1 << 10, // disable Perl m modifier Chris@16: mod_x = 1 << 11, // Perl x modifier Chris@16: mod_s = 1 << 12, // force s modifier on (overrides match_not_dot_newline) Chris@16: no_mod_s = 1 << 13, // force s modifier off (overrides match_not_dot_newline) Chris@16: Chris@16: // Chris@16: // options specific to basic group: Chris@16: // Chris@16: no_char_classes = 1 << 8, // [[:CLASS:]] not allowed Chris@16: no_intervals = 1 << 9, // {x,y} not allowed Chris@16: bk_plus_qm = 1 << 10, // uses \+ and \? Chris@16: bk_vbar = 1 << 11, // use \| for alternatives Chris@16: emacs_ex = 1 << 12, // enables emacs extensions Chris@16: Chris@16: // Chris@16: // options common to all groups: Chris@16: // Chris@16: no_escape_in_lists = 1 << 16, // '\' not special inside [...] Chris@16: newline_alt = 1 << 17, // \n is the same as | Chris@16: no_except = 1 << 18, // no exception on error Chris@16: failbit = 1 << 19, // error flag Chris@16: icase = 1 << 20, // characters are matched regardless of case Chris@16: nocollate = 0, // don't use locale specific collation (deprecated) Chris@16: collate = 1 << 21, // use locale specific collation Chris@16: nosubs = 1 << 22, // don't mark sub-expressions Chris@16: save_subexpression_location = 1 << 23, // save subexpression locations Chris@16: no_empty_expressions = 1 << 24, // no empty expressions allowed Chris@16: optimize = 0, // not really supported Chris@16: Chris@16: Chris@16: Chris@16: basic = basic_syntax_group | collate | no_escape_in_lists, Chris@16: extended = no_bk_refs | collate | no_perl_ex | no_escape_in_lists, Chris@16: normal = 0, Chris@16: emacs = basic_syntax_group | collate | emacs_ex | bk_vbar, Chris@16: awk = no_bk_refs | collate | no_perl_ex, Chris@16: grep = basic | newline_alt, Chris@16: egrep = extended | newline_alt, Chris@16: sed = basic, Chris@16: perl = normal, Chris@16: ECMAScript = normal, Chris@16: JavaScript = normal, Chris@16: JScript = normal Chris@16: }; Chris@16: typedef unsigned int flag_type; Chris@16: Chris@16: enum restart_info Chris@16: { Chris@16: restart_any = 0, Chris@16: restart_word = 1, Chris@16: restart_line = 2, Chris@16: restart_buf = 3, Chris@16: restart_continue = 4, Chris@16: restart_lit = 5, Chris@16: restart_fixed_lit = 6, Chris@16: restart_count = 7 Chris@16: }; Chris@16: }; Chris@16: Chris@16: // Chris@16: // provide std lib proposal compatible constants: Chris@16: // Chris@16: namespace regex_constants{ Chris@16: Chris@16: enum flag_type_ Chris@16: { Chris@16: Chris@16: no_except = ::boost::regbase::no_except, Chris@16: failbit = ::boost::regbase::failbit, Chris@16: literal = ::boost::regbase::literal, Chris@16: icase = ::boost::regbase::icase, Chris@16: nocollate = ::boost::regbase::nocollate, Chris@16: collate = ::boost::regbase::collate, Chris@16: nosubs = ::boost::regbase::nosubs, Chris@16: optimize = ::boost::regbase::optimize, Chris@16: bk_plus_qm = ::boost::regbase::bk_plus_qm, Chris@16: bk_vbar = ::boost::regbase::bk_vbar, Chris@16: no_intervals = ::boost::regbase::no_intervals, Chris@16: no_char_classes = ::boost::regbase::no_char_classes, Chris@16: no_escape_in_lists = ::boost::regbase::no_escape_in_lists, Chris@16: no_mod_m = ::boost::regbase::no_mod_m, Chris@16: mod_x = ::boost::regbase::mod_x, Chris@16: mod_s = ::boost::regbase::mod_s, Chris@16: no_mod_s = ::boost::regbase::no_mod_s, Chris@16: save_subexpression_location = ::boost::regbase::save_subexpression_location, Chris@16: no_empty_expressions = ::boost::regbase::no_empty_expressions, Chris@16: Chris@16: basic = ::boost::regbase::basic, Chris@16: extended = ::boost::regbase::extended, Chris@16: normal = ::boost::regbase::normal, Chris@16: emacs = ::boost::regbase::emacs, Chris@16: awk = ::boost::regbase::awk, Chris@16: grep = ::boost::regbase::grep, Chris@16: egrep = ::boost::regbase::egrep, Chris@16: sed = basic, Chris@16: perl = normal, Chris@16: ECMAScript = normal, Chris@16: JavaScript = normal, Chris@16: JScript = normal Chris@16: }; Chris@16: typedef ::boost::regbase::flag_type syntax_option_type; Chris@16: Chris@16: } // namespace regex_constants Chris@16: Chris@16: } // namespace boost Chris@16: Chris@16: #ifdef BOOST_MSVC Chris@16: #pragma warning(push) Chris@16: #pragma warning(disable: 4103) Chris@16: #endif Chris@16: #ifdef BOOST_HAS_ABI_HEADERS Chris@16: # include BOOST_ABI_SUFFIX Chris@16: #endif Chris@16: #ifdef BOOST_MSVC Chris@16: #pragma warning(pop) Chris@16: #endif Chris@16: Chris@16: #endif Chris@16: