Home | History | Annotate | Download | only in re.matchflag
      1 // -*- C++ -*-
      2 //===----------------------------------------------------------------------===//
      3 //
      4 //                     The LLVM Compiler Infrastructure
      5 //
      6 // This file is dual licensed under the MIT and the University of Illinois Open
      7 // Source Licenses. See LICENSE.TXT for details.
      8 //
      9 //===----------------------------------------------------------------------===//
     10 
     11 // <regex>
     12 
     13 // namespace regex_constants
     14 // {
     15 //
     16 // emum match_flag_type  // bitmask type
     17 // {
     18 //     match_default     = 0,
     19 //     match_not_bol     = unspecified,
     20 //     match_not_eol     = unspecified,
     21 //     match_not_bow     = unspecified,
     22 //     match_not_eow     = unspecified,
     23 //     match_any         = unspecified,
     24 //     match_not_null    = unspecified,
     25 //     match_continuous  = unspecified,
     26 //     match_prev_avail  = unspecified,
     27 //     format_default    = 0,
     28 //     format_sed        = unspecified,
     29 //     format_no_copy    = unspecified,
     30 //     format_first_only = unspecified
     31 // };
     32 //
     33 // }
     34 
     35 #include <regex>
     36 #include <cassert>
     37 
     38 int main()
     39 {
     40     assert(std::regex_constants::match_default == 0);
     41     assert(std::regex_constants::match_not_bol != 0);
     42     assert(std::regex_constants::match_not_eol != 0);
     43     assert(std::regex_constants::match_not_bow != 0);
     44     assert(std::regex_constants::match_not_eow != 0);
     45     assert(std::regex_constants::match_any != 0);
     46     assert(std::regex_constants::match_not_null != 0);
     47     assert(std::regex_constants::match_continuous != 0);
     48     assert(std::regex_constants::match_prev_avail != 0);
     49     assert(std::regex_constants::format_default == 0);
     50     assert(std::regex_constants::format_sed != 0);
     51     assert(std::regex_constants::format_no_copy != 0);
     52     assert(std::regex_constants::format_first_only != 0);
     53 
     54     assert((std::regex_constants::match_not_bol & std::regex_constants::match_not_eol) == 0);
     55     assert((std::regex_constants::match_not_bol & std::regex_constants::match_not_bow) == 0);
     56     assert((std::regex_constants::match_not_bol & std::regex_constants::match_not_eow) == 0);
     57     assert((std::regex_constants::match_not_bol & std::regex_constants::match_any) == 0);
     58     assert((std::regex_constants::match_not_bol & std::regex_constants::match_not_null) == 0);
     59     assert((std::regex_constants::match_not_bol & std::regex_constants::match_continuous) == 0);
     60     assert((std::regex_constants::match_not_bol & std::regex_constants::match_prev_avail) == 0);
     61     assert((std::regex_constants::match_not_bol & std::regex_constants::format_sed) == 0);
     62     assert((std::regex_constants::match_not_bol & std::regex_constants::format_no_copy) == 0);
     63     assert((std::regex_constants::match_not_bol & std::regex_constants::format_first_only) == 0);
     64 
     65     assert((std::regex_constants::match_not_eol & std::regex_constants::match_not_bow) == 0);
     66     assert((std::regex_constants::match_not_eol & std::regex_constants::match_not_eow) == 0);
     67     assert((std::regex_constants::match_not_eol & std::regex_constants::match_any) == 0);
     68     assert((std::regex_constants::match_not_eol & std::regex_constants::match_not_null) == 0);
     69     assert((std::regex_constants::match_not_eol & std::regex_constants::match_continuous) == 0);
     70     assert((std::regex_constants::match_not_eol & std::regex_constants::match_prev_avail) == 0);
     71     assert((std::regex_constants::match_not_eol & std::regex_constants::format_sed) == 0);
     72     assert((std::regex_constants::match_not_eol & std::regex_constants::format_no_copy) == 0);
     73     assert((std::regex_constants::match_not_eol & std::regex_constants::format_first_only) == 0);
     74 
     75     assert((std::regex_constants::match_not_bow & std::regex_constants::match_not_eow) == 0);
     76     assert((std::regex_constants::match_not_bow & std::regex_constants::match_any) == 0);
     77     assert((std::regex_constants::match_not_bow & std::regex_constants::match_not_null) == 0);
     78     assert((std::regex_constants::match_not_bow & std::regex_constants::match_continuous) == 0);
     79     assert((std::regex_constants::match_not_bow & std::regex_constants::match_prev_avail) == 0);
     80     assert((std::regex_constants::match_not_bow & std::regex_constants::format_sed) == 0);
     81     assert((std::regex_constants::match_not_bow & std::regex_constants::format_no_copy) == 0);
     82     assert((std::regex_constants::match_not_bow & std::regex_constants::format_first_only) == 0);
     83 
     84     assert((std::regex_constants::match_not_eow & std::regex_constants::match_any) == 0);
     85     assert((std::regex_constants::match_not_eow & std::regex_constants::match_not_null) == 0);
     86     assert((std::regex_constants::match_not_eow & std::regex_constants::match_continuous) == 0);
     87     assert((std::regex_constants::match_not_eow & std::regex_constants::match_prev_avail) == 0);
     88     assert((std::regex_constants::match_not_eow & std::regex_constants::format_sed) == 0);
     89     assert((std::regex_constants::match_not_eow & std::regex_constants::format_no_copy) == 0);
     90     assert((std::regex_constants::match_not_eow & std::regex_constants::format_first_only) == 0);
     91 
     92     assert((std::regex_constants::match_any & std::regex_constants::match_not_null) == 0);
     93     assert((std::regex_constants::match_any & std::regex_constants::match_continuous) == 0);
     94     assert((std::regex_constants::match_any & std::regex_constants::match_prev_avail) == 0);
     95     assert((std::regex_constants::match_any & std::regex_constants::format_sed) == 0);
     96     assert((std::regex_constants::match_any & std::regex_constants::format_no_copy) == 0);
     97     assert((std::regex_constants::match_any & std::regex_constants::format_first_only) == 0);
     98 
     99     assert((std::regex_constants::match_not_null & std::regex_constants::match_continuous) == 0);
    100     assert((std::regex_constants::match_not_null & std::regex_constants::match_prev_avail) == 0);
    101     assert((std::regex_constants::match_not_null & std::regex_constants::format_sed) == 0);
    102     assert((std::regex_constants::match_not_null & std::regex_constants::format_no_copy) == 0);
    103     assert((std::regex_constants::match_not_null & std::regex_constants::format_first_only) == 0);
    104 
    105     assert((std::regex_constants::match_continuous & std::regex_constants::match_prev_avail) == 0);
    106     assert((std::regex_constants::match_continuous & std::regex_constants::format_sed) == 0);
    107     assert((std::regex_constants::match_continuous & std::regex_constants::format_no_copy) == 0);
    108     assert((std::regex_constants::match_continuous & std::regex_constants::format_first_only) == 0);
    109 
    110     assert((std::regex_constants::match_prev_avail & std::regex_constants::format_sed) == 0);
    111     assert((std::regex_constants::match_prev_avail & std::regex_constants::format_no_copy) == 0);
    112     assert((std::regex_constants::match_prev_avail & std::regex_constants::format_first_only) == 0);
    113 
    114     assert((std::regex_constants::format_sed & std::regex_constants::format_no_copy) == 0);
    115     assert((std::regex_constants::format_sed & std::regex_constants::format_first_only) == 0);
    116 
    117     assert((std::regex_constants::format_no_copy & std::regex_constants::format_first_only) == 0);
    118 
    119     std::regex_constants::match_flag_type e1 = std::regex_constants::match_not_bol;
    120     std::regex_constants::match_flag_type e2 = std::regex_constants::match_not_eol;
    121     e1 = ~e1;
    122     e1 = e1 & e2;
    123     e1 = e1 | e2;
    124     e1 = e1 ^ e2;
    125     e1 &= e2;
    126     e1 |= e2;
    127     e1 ^= e2;
    128 }
    129