Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
rmatch.h
Go to the documentation of this file.
1#ifndef RBIMPL_RMATCH_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_RMATCH_H
26#include "ruby/internal/cast.h"
28#include "ruby/internal/value.h"
30#include "ruby/assert.h"
31
32#define RMATCH(obj) RBIMPL_CAST((struct RMatch *)(obj))
34#define RMATCH_REGS RMATCH_REGS
37struct re_patter_buffer; /* a.k.a. OnigRegexType, defined in onigmo.h */
38struct re_registers; /* Also in onigmo.h */
39
40/* @shyouhei wonders: is anyone actively using this typedef ...? */
42
44 long beg;
45 long end;
46};
47
48struct rmatch {
50
53};
54
55struct RMatch {
56 struct RBasic basic;
58 struct rmatch *rmatch;
59 VALUE regexp; /* RRegexp */
60};
61
65static inline struct re_registers *
66RMATCH_REGS(VALUE match)
67{
68 RBIMPL_ASSERT_TYPE(match, RUBY_T_MATCH);
70 return &RMATCH(match)->rmatch->regs;
71}
72
73#endif /* RBIMPL_RMATCH_H */
Defines RBIMPL_ATTR_ARTIFICIAL.
#define RBIMPL_ATTR_ARTIFICIAL()
Wraps (or simulates) __attribute__((artificial))
Definition: artificial.h:43
#define RBIMPL_ASSERT_OR_ASSUME(expr)
This is either RUBY_ASSERT or RBIMPL_ASSUME, depending on RUBY_DEBUG.
Definition: assert.h:229
Defines RBIMPL_CAST.
unsigned char match[65280+2]
Definition: gun.c:165
Defines RBIMPL_ATTR_PURE.
#define RBIMPL_ATTR_PURE_UNLESS_DEBUG()
Enables RBIMPL_ATTR_PURE iff.
Definition: pure.h:38
Defines struct RBasic.
#define NULL
Definition: regenc.h:69
Defines RBIMPL_ATTR_RETURNS_NONNULL.
#define RBIMPL_ATTR_RETURNS_NONNULL()
Wraps (or simulates) __attribute__((returns_nonnull))
#define RMATCH(obj)
Definition: rmatch.h:32
Definition: rbasic.h:47
Definition: rmatch.h:55
VALUE regexp
Definition: rmatch.h:59
struct rmatch * rmatch
Definition: rmatch.h:58
struct RBasic basic
Definition: rmatch.h:56
VALUE str
Definition: rmatch.h:57
long beg
Definition: rmatch.h:44
long end
Definition: rmatch.h:45
Definition: rmatch.h:48
int char_offset_num_allocated
Definition: rmatch.h:52
struct rmatch_offset * char_offset
Definition: rmatch.h:51
struct re_registers regs
Definition: rmatch.h:49
Defines VALUE and ID.
unsigned long VALUE
Definition: value.h:38
Defines enum ruby_value_type.
@ RUBY_T_MATCH
Definition: value_type.h:125