Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../opt/alt/ruby32/include/ruby
File: re.h
#ifndef RUBY_RE_H /*-*-C++-*-vi:se ft=cpp:*/
[0] Fix | Delete
#define RUBY_RE_H 1
[1] Fix | Delete
/**
[2] Fix | Delete
* @file
[3] Fix | Delete
* @author $Author$
[4] Fix | Delete
* @date Thu Sep 30 14:18:32 JST 1993
[5] Fix | Delete
* @copyright Copyright (C) 1993-2007 Yukihiro Matsumoto
[6] Fix | Delete
* @copyright This file is a part of the programming language Ruby.
[7] Fix | Delete
* Permission is hereby granted, to either redistribute and/or
[8] Fix | Delete
* modify this file, provided that the conditions mentioned in the
[9] Fix | Delete
* file COPYING are met. Consult the file for details.
[10] Fix | Delete
*/
[11] Fix | Delete
#include "ruby/internal/config.h"
[12] Fix | Delete
[13] Fix | Delete
#ifdef HAVE_SYS_TYPES_H
[14] Fix | Delete
# include <sys/types.h>
[15] Fix | Delete
#endif
[16] Fix | Delete
[17] Fix | Delete
#include <stdio.h>
[18] Fix | Delete
[19] Fix | Delete
#include "ruby/regex.h"
[20] Fix | Delete
#include "ruby/internal/core/rmatch.h"
[21] Fix | Delete
#include "ruby/internal/dllexport.h"
[22] Fix | Delete
[23] Fix | Delete
struct re_registers; /* Defined in onigmo.h */
[24] Fix | Delete
[25] Fix | Delete
RBIMPL_SYMBOL_EXPORT_BEGIN()
[26] Fix | Delete
[27] Fix | Delete
/**
[28] Fix | Delete
* Creates a new instance of ::rb_cRegexp. It can be seen as a specialised
[29] Fix | Delete
* version of rb_reg_new_str() where it does not take options.
[30] Fix | Delete
*
[31] Fix | Delete
* @param[in] str Source code in String.
[32] Fix | Delete
* @return Allocated new instance of ::rb_cRegexp.
[33] Fix | Delete
*/
[34] Fix | Delete
VALUE rb_reg_regcomp(VALUE str);
[35] Fix | Delete
[36] Fix | Delete
/**
[37] Fix | Delete
* Runs the passed regular expression over the passed string. Unlike
[38] Fix | Delete
* rb_reg_search() this function also takes position and direction of the
[39] Fix | Delete
* search, which make it possible for this function to run from in middle of
[40] Fix | Delete
* the string.
[41] Fix | Delete
*
[42] Fix | Delete
* @param[in] re Regular expression to execute.
[43] Fix | Delete
* @param[in] str Target string to search.
[44] Fix | Delete
* @param[in] pos Offset in `str` to start searching, in bytes.
[45] Fix | Delete
* @param[in] dir `pos`' direction; 0 means left-to-right, 1 for
[46] Fix | Delete
* the opposite.
[47] Fix | Delete
* @exception rb_eArgError `re` is broken.
[48] Fix | Delete
* @exception rb_eRegexpError `re` is malformed.
[49] Fix | Delete
* @retval -1 Match failed.
[50] Fix | Delete
* @retval otherwise Offset of first such byte where match happened.
[51] Fix | Delete
* @post `Regexp.last_match` is updated.
[52] Fix | Delete
* @post `$&`, `$~`, etc., are updated.
[53] Fix | Delete
*
[54] Fix | Delete
* @internal
[55] Fix | Delete
*
[56] Fix | Delete
* Distinction between raising ::rb_eArgError and ::rb_eRegexpError is not
[57] Fix | Delete
* obvious, at least to @shyouhei.
[58] Fix | Delete
*/
[59] Fix | Delete
long rb_reg_search(VALUE re, VALUE str, long pos, int dir);
[60] Fix | Delete
[61] Fix | Delete
/**
[62] Fix | Delete
* Substitution. This is basically the implementation of `String#sub`. Also
[63] Fix | Delete
* `String#gsub` repeatedly calls this function.
[64] Fix | Delete
*
[65] Fix | Delete
* @param[in] repl Replacement string, e.g. `"\\1\\2"`
[66] Fix | Delete
* @param[in] src Source string, to be replaced.
[67] Fix | Delete
* @param[in] regs Matched data generated by applying `rexp` to `src`.
[68] Fix | Delete
* @param[in] rexp Regular expression.
[69] Fix | Delete
* @return A substituted string.
[70] Fix | Delete
*
[71] Fix | Delete
* @internal
[72] Fix | Delete
*
[73] Fix | Delete
* This function does not check for encoding compatibility. `String#sub!`
[74] Fix | Delete
* etc. employ their own checker.
[75] Fix | Delete
*
[76] Fix | Delete
* `regs` should have been `const struct re_registers *` because it is read
[77] Fix | Delete
* only. Kept as-is for compatibility.
[78] Fix | Delete
*/
[79] Fix | Delete
VALUE rb_reg_regsub(VALUE repl, VALUE src, struct re_registers *regs, VALUE rexp);
[80] Fix | Delete
[81] Fix | Delete
/**
[82] Fix | Delete
* Tell us if this is a wrong idea, but it seems this function has no usage at
[83] Fix | Delete
* all. Just remains here for theoretical backwards compatibility.
[84] Fix | Delete
*
[85] Fix | Delete
* @param[in] re Regular expression to execute.
[86] Fix | Delete
* @param[in] str Target string to search.
[87] Fix | Delete
* @param[in] pos Offset in `str` to start searching, in bytes.
[88] Fix | Delete
* @param[in] dir `pos`' direction; 0 means left-to-right, 1 for
[89] Fix | Delete
* the opposite.
[90] Fix | Delete
* @return Adjusted nearest offset to `pos` inside of `str`, where is a
[91] Fix | Delete
* character boundary.
[92] Fix | Delete
*
[93] Fix | Delete
*/
[94] Fix | Delete
long rb_reg_adjust_startpos(VALUE re, VALUE str, long pos, int dir);
[95] Fix | Delete
[96] Fix | Delete
/**
[97] Fix | Delete
* Escapes any characters that would have special meaning in a regular
[98] Fix | Delete
* expression.
[99] Fix | Delete
*
[100] Fix | Delete
* @param[in] str Target string to escape.
[101] Fix | Delete
* @return A copy of `str` whose contents are escaped.
[102] Fix | Delete
*/
[103] Fix | Delete
VALUE rb_reg_quote(VALUE str);
[104] Fix | Delete
[105] Fix | Delete
/**
[106] Fix | Delete
* Exercises various checks and preprocesses so that the given regular
[107] Fix | Delete
* expression can be applied to the given string. The preprocess here includes
[108] Fix | Delete
* (but not limited to) for instance encoding conversion.
[109] Fix | Delete
*
[110] Fix | Delete
* @param[in] re Target regular expression.
[111] Fix | Delete
* @param[in] str What `re` is about to run on.
[112] Fix | Delete
* @exception rb_eArgError `re` does not fit for `str`.
[113] Fix | Delete
* @exception rb_eEncCompatError `re` and `str` are incompatible.
[114] Fix | Delete
* @exception rb_eRegexpError `re` is malformed.
[115] Fix | Delete
* @return A preprocessesed pattern buffer ready to be applied to `str`.
[116] Fix | Delete
* @note The return value is manages by our GC. Don't free.
[117] Fix | Delete
*
[118] Fix | Delete
* @internal
[119] Fix | Delete
*
[120] Fix | Delete
* The return type, `regex_t *`, is defined in `<ruby/onigmo.h>`, _and_
[121] Fix | Delete
* _conflicts_ with POSIX's `<regex.h>`. We can no longer save the situation
[122] Fix | Delete
* at this point. Just don't mix the two.
[123] Fix | Delete
*/
[124] Fix | Delete
regex_t *rb_reg_prepare_re(VALUE re, VALUE str);
[125] Fix | Delete
[126] Fix | Delete
/**
[127] Fix | Delete
* Duplicates a match data. This is roughly the same as `onig_region_copy()`,
[128] Fix | Delete
* except it tries to GC when there is not enough memory.
[129] Fix | Delete
*
[130] Fix | Delete
* @param[out] dst Target registers to fill.
[131] Fix | Delete
* @param[in] src Source registers to duplicate.
[132] Fix | Delete
* @exception rb_eNoMemError Not enough memory.
[133] Fix | Delete
* @retval 0 Successful
[134] Fix | Delete
* @retval ONIGERR_MEMORY Not enough memory, even after GC (unlikely).
[135] Fix | Delete
* @post `dst` has identical contents to `src`.
[136] Fix | Delete
*
[137] Fix | Delete
* @internal
[138] Fix | Delete
*
[139] Fix | Delete
* It seems this function is here for `ext/strscan` and nothing else.
[140] Fix | Delete
*/
[141] Fix | Delete
int rb_reg_region_copy(struct re_registers *dst, const struct re_registers *src);
[142] Fix | Delete
[143] Fix | Delete
RBIMPL_SYMBOL_EXPORT_END()
[144] Fix | Delete
[145] Fix | Delete
#endif /* RUBY_RE_H */
[146] Fix | Delete
[147] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function