Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:08:37

0001 /*
0002  *
0003  * Copyright (c) 1998-2002
0004  * John Maddock
0005  *
0006  * Use, modification and distribution are subject to the 
0007  * Boost Software License, Version 1.0. (See accompanying file 
0008  * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009  *
0010  */
0011 
0012  /*
0013   *   LOCATION:    see http://www.boost.org for most recent version.
0014   *   FILE         regbase.cpp
0015   *   VERSION      see <boost/version.hpp>
0016   *   DESCRIPTION: Declares class regbase.
0017   */
0018 
0019 #ifndef BOOST_REGEX_V5_REGBASE_HPP
0020 #define BOOST_REGEX_V5_REGBASE_HPP
0021 
0022 namespace boost{
0023 //
0024 // class regbase
0025 // handles error codes and flags
0026 //
0027 class regbase
0028 {
0029 public:
0030    enum flag_type_
0031    {
0032       //
0033       // Divide the flags up into logical groups:
0034       // bits 0-7 indicate main synatx type.
0035       // bits 8-15 indicate syntax subtype.
0036       // bits 16-31 indicate options that are common to all
0037       // regex syntaxes.
0038       // In all cases the default is 0.
0039       //
0040       // Main synatx group:
0041       //
0042       perl_syntax_group = 0,                      // default
0043       basic_syntax_group = 1,                     // POSIX basic
0044       literal = 2,                                // all characters are literals
0045       main_option_type = literal | basic_syntax_group | perl_syntax_group, // everything!
0046       //
0047       // options specific to perl group:
0048       //
0049       no_bk_refs = 1 << 8,                        // \d not allowed
0050       no_perl_ex = 1 << 9,                        // disable perl extensions
0051       no_mod_m = 1 << 10,                         // disable Perl m modifier
0052       mod_x = 1 << 11,                            // Perl x modifier
0053       mod_s = 1 << 12,                            // force s modifier on (overrides match_not_dot_newline)
0054       no_mod_s = 1 << 13,                         // force s modifier off (overrides match_not_dot_newline)
0055 
0056       //
0057       // options specific to basic group:
0058       //
0059       no_char_classes = 1 << 8,                   // [[:CLASS:]] not allowed
0060       no_intervals = 1 << 9,                      // {x,y} not allowed
0061       bk_plus_qm = 1 << 10,                       // uses \+ and \?
0062       bk_vbar = 1 << 11,                          // use \| for alternatives
0063       emacs_ex = 1 << 12,                         // enables emacs extensions
0064 
0065       //
0066       // options common to all groups:
0067       //
0068       no_escape_in_lists = 1 << 16,                     // '\' not special inside [...]
0069       newline_alt = 1 << 17,                            // \n is the same as |
0070       no_except = 1 << 18,                              // no exception on error
0071       failbit = 1 << 19,                                // error flag
0072       icase = 1 << 20,                                  // characters are matched regardless of case
0073       nocollate = 0,                                    // don't use locale specific collation (deprecated)
0074       collate = 1 << 21,                                // use locale specific collation
0075       nosubs = 1 << 22,                                 // don't mark sub-expressions
0076       save_subexpression_location = 1 << 23,            // save subexpression locations
0077       no_empty_expressions = 1 << 24,                   // no empty expressions allowed
0078       optimize = 0,                                     // not really supported
0079       
0080 
0081 
0082       basic = basic_syntax_group | collate | no_escape_in_lists,
0083       extended = no_bk_refs | collate | no_perl_ex | no_escape_in_lists,
0084       normal = 0,
0085       emacs = basic_syntax_group | collate | emacs_ex | bk_vbar,
0086       awk = no_bk_refs | collate | no_perl_ex,
0087       grep = basic | newline_alt,
0088       egrep = extended | newline_alt,
0089       sed = basic,
0090       perl = normal,
0091       ECMAScript = normal,
0092       JavaScript = normal,
0093       JScript = normal
0094    };
0095    typedef unsigned int flag_type;
0096 
0097    enum restart_info
0098    {
0099       restart_any = 0,
0100       restart_word = 1,
0101       restart_line = 2,
0102       restart_buf = 3,
0103       restart_continue = 4,
0104       restart_lit = 5,
0105       restart_fixed_lit = 6, 
0106       restart_count = 7
0107    };
0108 };
0109 
0110 //
0111 // provide std lib proposal compatible constants:
0112 //
0113 namespace regex_constants{
0114 
0115    enum flag_type_
0116    {
0117 
0118       no_except = ::boost::regbase::no_except,
0119       failbit = ::boost::regbase::failbit,
0120       literal = ::boost::regbase::literal,
0121       icase = ::boost::regbase::icase,
0122       nocollate = ::boost::regbase::nocollate,
0123       collate = ::boost::regbase::collate,
0124       nosubs = ::boost::regbase::nosubs,
0125       optimize = ::boost::regbase::optimize,
0126       bk_plus_qm = ::boost::regbase::bk_plus_qm,
0127       bk_vbar = ::boost::regbase::bk_vbar,
0128       no_intervals = ::boost::regbase::no_intervals,
0129       no_char_classes = ::boost::regbase::no_char_classes,
0130       no_escape_in_lists = ::boost::regbase::no_escape_in_lists,
0131       no_mod_m = ::boost::regbase::no_mod_m,
0132       mod_x = ::boost::regbase::mod_x,
0133       mod_s = ::boost::regbase::mod_s,
0134       no_mod_s = ::boost::regbase::no_mod_s,
0135       save_subexpression_location = ::boost::regbase::save_subexpression_location,
0136       no_empty_expressions = ::boost::regbase::no_empty_expressions,
0137 
0138       basic = ::boost::regbase::basic,
0139       extended = ::boost::regbase::extended,
0140       normal = ::boost::regbase::normal,
0141       emacs = ::boost::regbase::emacs,
0142       awk = ::boost::regbase::awk,
0143       grep = ::boost::regbase::grep,
0144       egrep = ::boost::regbase::egrep,
0145       sed = basic,
0146       perl = normal,
0147       ECMAScript = normal,
0148       JavaScript = normal,
0149       JScript = normal
0150    };
0151    typedef ::boost::regbase::flag_type syntax_option_type;
0152 
0153 } // namespace regex_constants
0154 
0155 } // namespace boost
0156 
0157 #endif
0158