2000-05-01 05:42:38 -04:00
|
|
|
/**********************************************************************
|
1998-01-16 07:13:05 -05:00
|
|
|
|
|
|
|
re.h -
|
|
|
|
|
|
|
|
$Author$
|
|
|
|
created at: Thu Sep 30 14:18:32 JST 1993
|
|
|
|
|
* encoding.c: provide basic features for M17N.
* parse.y: encoding aware parsing.
* parse.y (pragma_encoding): encoding specification pragma.
* parse.y (rb_intern3): encoding specified symbols.
* string.c (rb_str_length): length based on characters.
for older behavior, bytesize method added.
* string.c (rb_str_index_m): index based on characters. rindex as
well.
* string.c (succ_char): encoding aware succeeding string.
* string.c (rb_str_reverse): reverse based on characters.
* string.c (rb_str_inspect): encoding aware string description.
* string.c (rb_str_upcase_bang): encoding aware case conversion.
downcase, capitalize, swapcase as well.
* string.c (rb_str_tr_bang): tr based on characters. delete,
squeeze, tr_s, count as well.
* string.c (rb_str_split_m): split based on characters.
* string.c (rb_str_each_line): encoding aware each_line.
* string.c (rb_str_each_char): added. iteration based on
characters.
* string.c (rb_str_strip_bang): encoding aware whitespace
stripping. lstrip, rstrip as well.
* string.c (rb_str_justify): encoding aware justifying (ljust,
rjust, center).
* string.c (str_encoding): get encoding attribute from a string.
* re.c (rb_reg_initialize): encoding aware regular expression
* sprintf.c (rb_str_format): formatting (i.e. length count) based
on characters.
* io.c (rb_io_getc): getc to return one-character string.
for older behavior, getbyte method added.
* ext/stringio/stringio.c (strio_getc): ditto.
* io.c (rb_io_ungetc): allow pushing arbitrary string at the
current reading point.
* ext/stringio/stringio.c (strio_ungetc): ditto.
* ext/strscan/strscan.c: encoding support.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-24 23:29:39 -04:00
|
|
|
Copyright (C) 1993-2007 Yukihiro Matsumoto
|
1998-01-16 07:13:05 -05:00
|
|
|
|
2000-05-01 05:42:38 -04:00
|
|
|
**********************************************************************/
|
1998-01-16 07:13:05 -05:00
|
|
|
|
2007-06-09 23:06:15 -04:00
|
|
|
#ifndef RUBY_RE_H
|
|
|
|
#define RUBY_RE_H 1
|
|
|
|
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#if 0
|
|
|
|
} /* satisfy cc-mode */
|
|
|
|
#endif
|
|
|
|
#endif
|
1998-01-16 07:13:05 -05:00
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2007-06-09 23:06:15 -04:00
|
|
|
#include "ruby/regex.h"
|
1998-01-16 07:13:05 -05:00
|
|
|
|
2010-07-21 17:38:25 -04:00
|
|
|
#if defined __GNUC__ && __GNUC__ >= 4
|
|
|
|
#pragma GCC visibility push(default)
|
|
|
|
#endif
|
|
|
|
|
1998-01-16 07:13:05 -05:00
|
|
|
typedef struct re_pattern_buffer Regexp;
|
|
|
|
|
2008-02-16 15:08:35 -05:00
|
|
|
struct rmatch_offset {
|
2009-06-29 22:08:54 -04:00
|
|
|
long beg;
|
|
|
|
long end;
|
2008-02-16 15:08:35 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
struct rmatch {
|
|
|
|
struct re_registers regs;
|
|
|
|
|
|
|
|
int char_offset_updated;
|
|
|
|
int char_offset_num_allocated;
|
|
|
|
struct rmatch_offset *char_offset;
|
|
|
|
};
|
|
|
|
|
1998-01-16 07:13:05 -05:00
|
|
|
struct RMatch {
|
|
|
|
struct RBasic basic;
|
|
|
|
VALUE str;
|
2008-02-16 15:08:35 -05:00
|
|
|
struct rmatch *rmatch;
|
2006-03-21 08:16:21 -05:00
|
|
|
VALUE regexp; /* RRegexp */
|
1998-01-16 07:13:05 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#define RMATCH(obj) (R_CAST(RMatch)(obj))
|
2008-02-16 15:08:35 -05:00
|
|
|
#define RMATCH_REGS(obj) (&(R_CAST(RMatch)(obj))->rmatch->regs)
|
1998-01-16 07:13:05 -05:00
|
|
|
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
VALUE rb_reg_regcomp(VALUE);
|
2009-06-29 22:08:54 -04:00
|
|
|
long rb_reg_search(VALUE, VALUE, long, int);
|
2006-03-22 10:03:40 -05:00
|
|
|
VALUE rb_reg_regsub(VALUE, VALUE, struct re_registers *, VALUE);
|
2009-06-29 22:08:54 -04:00
|
|
|
long rb_reg_adjust_startpos(VALUE, VALUE, long, int);
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
void rb_match_busy(VALUE);
|
|
|
|
VALUE rb_reg_quote(VALUE);
|
2010-07-21 17:38:25 -04:00
|
|
|
regex_t *rb_reg_prepare_re(VALUE re, VALUE str);
|
|
|
|
|
|
|
|
#if defined __GNUC__ && __GNUC__ >= 4
|
|
|
|
#pragma GCC visibility pop
|
|
|
|
#endif
|
1999-01-19 23:59:39 -05:00
|
|
|
|
2007-06-09 23:06:15 -04:00
|
|
|
#if defined(__cplusplus)
|
|
|
|
#if 0
|
|
|
|
{ /* satisfy cc-mode */
|
|
|
|
#endif
|
|
|
|
} /* extern "C" { */
|
1998-01-16 07:13:05 -05:00
|
|
|
#endif
|
2007-06-09 23:06:15 -04:00
|
|
|
|
|
|
|
#endif /* RUBY_RE_H */
|