Exemple #1
0
  Fixnum* Regexp::options(STATE) {
    regex_t*       reg;

    reg    = onig_data;

    int result = ((int)onig_get_options(reg) & OPTION_MASK);

    if(forced_encoding_) {
      result |= get_kcode_from_enc(onig_get_encoding(reg));
    }

    return Fixnum::from(result);
  }
Exemple #2
0
  Fixnum* Regexp::options(STATE) {
    if(unlikely(!onig_data)) {
      Exception::argument_error(state, "Not properly initialized Regexp");
    }

    int result = ((int)onig_get_options(onig_data) & OPTION_MASK);

    if(forced_encoding_) {
      result |= get_kcode_from_enc(onig_get_encoding(onig_data));
    }

    return Fixnum::from(result);
  }
Exemple #3
0
  Fixnum* Regexp::options(STATE) {
    if(unlikely(!onig_data)) {
      Exception::argument_error(state, "Not properly initialized Regexp");
    }

    int result = ((int)onig_get_options(onig_data) & OPTION_MASK);

    if(LANGUAGE_18_ENABLED(state)) {
      if(fixed_encoding_) {
        result |= get_kcode_from_enc(onig_get_encoding(onig_data));
      }
    } else {
      if(fixed_encoding_) {
        result |= OPTION_FIXEDENCODING;
      }
      if(no_encoding_) {
        result |= OPTION_NOENCODING;
      }
    }

    return Fixnum::from(result);
  }