Ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e0ba6b95ab71a441357ed5484e33498)
rmatch.h
Go to the documentation of this file.
1#ifndef RBIMPL_RMATCH_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_RMATCH_H
25#include "ruby/internal/cast.h"
27#include "ruby/internal/value.h"
29#include "ruby/assert.h"
30
37#define RMATCH(obj) RBIMPL_CAST((struct RMatch *)(obj))
39#define RMATCH_REGS RMATCH_REGS
42struct re_patter_buffer; /* a.k.a. OnigRegexType, defined in onigmo.h */
43struct re_registers; /* Also in onigmo.h */
44
53
66 long beg;
67 long end;
68};
69
71struct rmatch {
77
80
83};
84
94struct RMatch {
95
97 struct RBasic basic;
98
102 VALUE str;
103
107 struct rmatch *rmatch;
108
112 VALUE regexp; /* RRegexp */
113};
114
138static inline struct re_registers *
139RMATCH_REGS(VALUE match)
140{
141 RBIMPL_ASSERT_TYPE(match, RUBY_T_MATCH);
142 RBIMPL_ASSERT_OR_ASSUME(RMATCH(match)->rmatch != NULL);
143 return &RMATCH(match)->rmatch->regs;
144}
145
146#endif /* RBIMPL_RMATCH_H */
Defines RBIMPL_ATTR_ARTIFICIAL.
#define RBIMPL_ATTR_ARTIFICIAL()
Wraps (or simulates) __attribute__((artificial))
Definition: artificial.h:41
#define RBIMPL_ASSERT_OR_ASSUME(expr)
This is either RUBY_ASSERT or RBIMPL_ASSUME, depending on RUBY_DEBUG.
Definition: assert.h:229
Defines RBIMPL_ATTR_PURE.
#define RBIMPL_ATTR_PURE_UNLESS_DEBUG()
Enables RBIMPL_ATTR_PURE if and only if.
Definition: pure.h:38
Defines struct RBasic.
#define RMATCH(obj)
Convenient casting macro.
Definition: rmatch.h:37
static struct re_registers * RMATCH_REGS(VALUE match)
Queries the raw re_registers.
Definition: rmatch.h:139
Ruby's object's, base components.
Definition: rbasic.h:64
Regular expression execution context.
Definition: rmatch.h:94
VALUE regexp
The expression of this match.
Definition: rmatch.h:112
struct rmatch * rmatch
The result of this match.
Definition: rmatch.h:107
struct RBasic basic
Basic part, including flags and class.
Definition: rmatch.h:97
VALUE str
The target string that the match was made against.
Definition: rmatch.h:102
Represents the region of a capture group.
Definition: rmatch.h:65
long beg
Beginning of a group.
Definition: rmatch.h:66
long end
End of a group.
Definition: rmatch.h:67
Represents a match.
Definition: rmatch.h:71
int char_offset_num_allocated
Number of rmatch_offset that rmatch::char_offset holds.
Definition: rmatch.h:82
struct rmatch_offset * char_offset
Capture group offsets, in C array.
Definition: rmatch.h:79
struct re_registers regs
"Registers" of a match.
Definition: rmatch.h:76
Defines VALUE and ID.
Defines enum ruby_value_type.
@ RUBY_T_MATCH
Definition: value_type.h:127