Ruby  2.0.0p451(2014-02-24revision45167)
oniguruma.h
Go to the documentation of this file.
1 #ifndef ONIGURUMA_H
2 #define ONIGURUMA_H
3 /**********************************************************************
4  oniguruma.h - Onigmo (Oniguruma-mod) (regular expression library)
5 **********************************************************************/
6 /*-
7  * Copyright (c) 2002-2009 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
8  * Copyright (c) 2011-2013 K.Takata <kentkt AT csc DOT jp>
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  * notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  * notice, this list of conditions and the following disclaimer in the
18  * documentation and/or other materials provided with the distribution.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30  * SUCH DAMAGE.
31  */
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #if 0
36 } /* satisfy cc-mode */
37 #endif
38 #endif
39 
40 #define ONIGURUMA
41 #define ONIGURUMA_VERSION_MAJOR 5
42 #define ONIGURUMA_VERSION_MINOR 13
43 #define ONIGURUMA_VERSION_TEENY 5
44 
45 #ifdef __cplusplus
46 # ifndef HAVE_PROTOTYPES
47 # define HAVE_PROTOTYPES 1
48 # endif
49 # ifndef HAVE_STDARG_PROTOTYPES
50 # define HAVE_STDARG_PROTOTYPES 1
51 # endif
52 #endif
53 
54 /* escape Mac OS X/Xcode 2.4/gcc 4.0.1 problem */
55 #if defined(__APPLE__) && defined(__GNUC__) && __GNUC__ >= 4
56 # ifndef HAVE_STDARG_PROTOTYPES
57 # define HAVE_STDARG_PROTOTYPES 1
58 # endif
59 #endif
60 
61 #ifdef HAVE_STDARG_H
62 # ifndef HAVE_STDARG_PROTOTYPES
63 # define HAVE_STDARG_PROTOTYPES 1
64 # endif
65 #endif
66 
67 #ifndef P_
68 #if defined(__STDC__) || defined(_WIN32)
69 # define P_(args) args
70 #else
71 # define P_(args) ()
72 #endif
73 #endif
74 
75 #ifndef PV_
76 #ifdef HAVE_STDARG_PROTOTYPES
77 # define PV_(args) args
78 #else
79 # define PV_(args) ()
80 #endif
81 #endif
82 
83 #ifndef ONIG_EXTERN
84 #ifdef RUBY_EXTERN
85 #define ONIG_EXTERN RUBY_EXTERN
86 #else
87 #if defined(_WIN32) && !defined(__GNUC__)
88 #if defined(EXPORT) || defined(RUBY_EXPORT)
89 #define ONIG_EXTERN extern __declspec(dllexport)
90 #else
91 #define ONIG_EXTERN extern __declspec(dllimport)
92 #endif
93 #endif
94 #endif
95 #endif
96 
97 #ifndef ONIG_EXTERN
98 #define ONIG_EXTERN extern
99 #endif
100 
101 #if defined __GNUC__ && __GNUC__ >= 4
102 #pragma GCC visibility push(default)
103 #endif
104 
105 #include <stddef.h> /* for size_t */
106 
107 /* PART: character encoding */
108 
109 #ifndef ONIG_ESCAPE_UCHAR_COLLISION
110 #define UChar OnigUChar
111 #endif
112 
113 typedef unsigned char OnigUChar;
114 typedef unsigned int OnigCodePoint;
115 typedef unsigned int OnigCtype;
116 typedef size_t OnigDistance;
117 typedef ptrdiff_t OnigPosition;
118 
119 #define ONIG_INFINITE_DISTANCE ~((OnigDistance )0)
120 
121 typedef unsigned int OnigCaseFoldType; /* case fold flag */
122 
124 
125 /* #define ONIGENC_CASE_FOLD_HIRAGANA_KATAKANA (1<<1) */
126 /* #define ONIGENC_CASE_FOLD_KATAKANA_WIDTH (1<<2) */
127 #define ONIGENC_CASE_FOLD_TURKISH_AZERI (1<<20)
128 #define INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR (1<<30)
129 
130 #define ONIGENC_CASE_FOLD_MIN INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR
131 #define ONIGENC_CASE_FOLD_DEFAULT OnigDefaultCaseFoldFlag
132 
133 
134 #define ONIGENC_MAX_COMP_CASE_FOLD_CODE_LEN 3
135 #define ONIGENC_GET_CASE_FOLD_CODES_MAX_NUM 13
136 /* 13 => Unicode:0x1ffc */
137 
138 /* code range */
139 #define ONIGENC_CODE_RANGE_NUM(range) ((int )range[0])
140 #define ONIGENC_CODE_RANGE_FROM(range,i) range[((i)*2) + 1]
141 #define ONIGENC_CODE_RANGE_TO(range,i) range[((i)*2) + 2]
142 
143 typedef struct {
144  int byte_len; /* argument(original) character(s) byte length */
145  int code_len; /* number of code */
148 
149 typedef struct {
150  OnigCodePoint esc;
151  OnigCodePoint anychar;
152  OnigCodePoint anytime;
153  OnigCodePoint zero_or_one_time;
154  OnigCodePoint one_or_more_time;
155  OnigCodePoint anychar_anytime;
157 
158 typedef int (*OnigApplyAllCaseFoldFunc)(OnigCodePoint from, OnigCodePoint* to, int to_len, void* arg);
159 
160 typedef struct OnigEncodingTypeST {
161  int (*precise_mbc_enc_len)(const OnigUChar* p,const OnigUChar* e, struct OnigEncodingTypeST* enc);
162  const char* name;
163  int max_enc_len;
164  int min_enc_len;
165  int (*is_mbc_newline)(const OnigUChar* p, const OnigUChar* end, struct OnigEncodingTypeST* enc);
166  OnigCodePoint (*mbc_to_code)(const OnigUChar* p, const OnigUChar* end, struct OnigEncodingTypeST* enc);
167  int (*code_to_mbclen)(OnigCodePoint code, struct OnigEncodingTypeST* enc);
168  int (*code_to_mbc)(OnigCodePoint code, OnigUChar *buf, struct OnigEncodingTypeST* enc);
169  int (*mbc_case_fold)(OnigCaseFoldType flag, const OnigUChar** pp, const OnigUChar* end, OnigUChar* to, struct OnigEncodingTypeST* enc);
171  int (*get_case_fold_codes_by_str)(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem acs[], struct OnigEncodingTypeST* enc);
172  int (*property_name_to_ctype)(struct OnigEncodingTypeST* enc, OnigUChar* p, OnigUChar* end);
173  int (*is_code_ctype)(OnigCodePoint code, OnigCtype ctype, struct OnigEncodingTypeST* enc);
174  int (*get_ctype_code_range)(OnigCtype ctype, OnigCodePoint* sb_out, const OnigCodePoint* ranges[], struct OnigEncodingTypeST* enc);
175  OnigUChar* (*left_adjust_char_head)(const OnigUChar* start, const OnigUChar* p, const OnigUChar* end, struct OnigEncodingTypeST* enc);
176  int (*is_allowed_reverse_match)(const OnigUChar* p, const OnigUChar* end, struct OnigEncodingTypeST* enc);
178  unsigned int flags;
180 
182 
184 
185 #define ONIG_ENCODING_ASCII (&OnigEncodingASCII)
186 
187 #define ONIG_ENCODING_UNDEF ((OnigEncoding )0)
188 
189 
190 /* work size */
191 #define ONIGENC_CODE_TO_MBC_MAXLEN 7
192 #define ONIGENC_MBC_CASE_FOLD_MAXLEN 18
193 /* 18: 6(max-byte) * 3(case-fold chars) */
194 
195 /* character types */
196 #define ONIGENC_CTYPE_NEWLINE 0
197 #define ONIGENC_CTYPE_ALPHA 1
198 #define ONIGENC_CTYPE_BLANK 2
199 #define ONIGENC_CTYPE_CNTRL 3
200 #define ONIGENC_CTYPE_DIGIT 4
201 #define ONIGENC_CTYPE_GRAPH 5
202 #define ONIGENC_CTYPE_LOWER 6
203 #define ONIGENC_CTYPE_PRINT 7
204 #define ONIGENC_CTYPE_PUNCT 8
205 #define ONIGENC_CTYPE_SPACE 9
206 #define ONIGENC_CTYPE_UPPER 10
207 #define ONIGENC_CTYPE_XDIGIT 11
208 #define ONIGENC_CTYPE_WORD 12
209 #define ONIGENC_CTYPE_ALNUM 13 /* alpha || digit */
210 #define ONIGENC_CTYPE_ASCII 14
211 #define ONIGENC_MAX_STD_CTYPE ONIGENC_CTYPE_ASCII
212 
213 /* flags */
214 #define ONIGENC_FLAG_NONE 0U
215 #define ONIGENC_FLAG_UNICODE 1U
216 
217 #define onig_enc_len(enc,p,e) ONIGENC_MBC_ENC_LEN(enc, p, e)
218 
219 #define ONIGENC_IS_UNDEF(enc) ((enc) == ONIG_ENCODING_UNDEF)
220 #define ONIGENC_IS_SINGLEBYTE(enc) (ONIGENC_MBC_MAXLEN(enc) == 1)
221 #define ONIGENC_IS_MBC_HEAD(enc,p,e) (ONIGENC_MBC_ENC_LEN(enc,p,e) != 1)
222 #define ONIGENC_IS_MBC_ASCII(p) (*(p) < 128)
223 #define ONIGENC_IS_CODE_ASCII(code) ((code) < 128)
224 #define ONIGENC_IS_MBC_WORD(enc,s,end) \
225  ONIGENC_IS_CODE_WORD(enc,ONIGENC_MBC_TO_CODE(enc,s,end))
226 #define ONIGENC_IS_MBC_ASCII_WORD(enc,s,end) \
227  onigenc_ascii_is_code_ctype( \
228  ONIGENC_MBC_TO_CODE(enc,s,end),ONIGENC_CTYPE_WORD,enc)
229 #define ONIGENC_IS_UNICODE(enc) ((enc)->flags & ONIGENC_FLAG_UNICODE)
230 
231 
232 #define ONIGENC_NAME(enc) ((enc)->name)
233 
234 #define ONIGENC_MBC_CASE_FOLD(enc,flag,pp,end,buf) \
235  (enc)->mbc_case_fold(flag,(const OnigUChar** )pp,end,buf,enc)
236 #define ONIGENC_IS_ALLOWED_REVERSE_MATCH(enc,s,end) \
237  (enc)->is_allowed_reverse_match(s,end,enc)
238 #define ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc,start,s,end) \
239  (enc)->left_adjust_char_head(start, s, end, enc)
240 #define ONIGENC_APPLY_ALL_CASE_FOLD(enc,case_fold_flag,f,arg) \
241  (enc)->apply_all_case_fold(case_fold_flag,f,arg,enc)
242 #define ONIGENC_GET_CASE_FOLD_CODES_BY_STR(enc,case_fold_flag,p,end,acs) \
243  (enc)->get_case_fold_codes_by_str(case_fold_flag,p,end,acs,enc)
244 #define ONIGENC_STEP_BACK(enc,start,s,end,n) \
245  onigenc_step_back((enc),(start),(s),(end),(n))
246 
247 #define ONIGENC_CONSTRUCT_MBCLEN_CHARFOUND(n) (n)
248 #define ONIGENC_MBCLEN_CHARFOUND_P(r) (0 < (r))
249 #define ONIGENC_MBCLEN_CHARFOUND_LEN(r) (r)
250 
251 #define ONIGENC_CONSTRUCT_MBCLEN_INVALID() (-1)
252 #define ONIGENC_MBCLEN_INVALID_P(r) ((r) == -1)
253 
254 #define ONIGENC_CONSTRUCT_MBCLEN_NEEDMORE(n) (-1-(n))
255 #define ONIGENC_MBCLEN_NEEDMORE_P(r) ((r) < -1)
256 #define ONIGENC_MBCLEN_NEEDMORE_LEN(r) (-1-(r))
257 
258 #define ONIGENC_PRECISE_MBC_ENC_LEN(enc,p,e) (enc)->precise_mbc_enc_len(p,e,enc)
259 
261 int onigenc_mbclen_approximate P_((const OnigUChar* p,const OnigUChar* e, struct OnigEncodingTypeST* enc));
262 
263 #define ONIGENC_MBC_ENC_LEN(enc,p,e) onigenc_mbclen_approximate(p,e,enc)
264 #define ONIGENC_MBC_MAXLEN(enc) ((enc)->max_enc_len)
265 #define ONIGENC_MBC_MAXLEN_DIST(enc) ONIGENC_MBC_MAXLEN(enc)
266 #define ONIGENC_MBC_MINLEN(enc) ((enc)->min_enc_len)
267 #define ONIGENC_IS_MBC_NEWLINE(enc,p,end) (enc)->is_mbc_newline((p),(end),enc)
268 #define ONIGENC_MBC_TO_CODE(enc,p,end) (enc)->mbc_to_code((p),(end),enc)
269 #define ONIGENC_CODE_TO_MBCLEN(enc,code) (enc)->code_to_mbclen(code,enc)
270 #define ONIGENC_CODE_TO_MBC(enc,code,buf) (enc)->code_to_mbc(code,buf,enc)
271 #define ONIGENC_PROPERTY_NAME_TO_CTYPE(enc,p,end) \
272  (enc)->property_name_to_ctype(enc,p,end)
273 
274 #define ONIGENC_IS_CODE_CTYPE(enc,code,ctype) (enc)->is_code_ctype(code,ctype,enc)
275 
276 #define ONIGENC_IS_CODE_NEWLINE(enc,code) \
277  ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_NEWLINE)
278 #define ONIGENC_IS_CODE_GRAPH(enc,code) \
279  ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_GRAPH)
280 #define ONIGENC_IS_CODE_PRINT(enc,code) \
281  ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_PRINT)
282 #define ONIGENC_IS_CODE_ALNUM(enc,code) \
283  ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_ALNUM)
284 #define ONIGENC_IS_CODE_ALPHA(enc,code) \
285  ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_ALPHA)
286 #define ONIGENC_IS_CODE_LOWER(enc,code) \
287  ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_LOWER)
288 #define ONIGENC_IS_CODE_UPPER(enc,code) \
289  ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_UPPER)
290 #define ONIGENC_IS_CODE_CNTRL(enc,code) \
291  ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_CNTRL)
292 #define ONIGENC_IS_CODE_PUNCT(enc,code) \
293  ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_PUNCT)
294 #define ONIGENC_IS_CODE_SPACE(enc,code) \
295  ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_SPACE)
296 #define ONIGENC_IS_CODE_BLANK(enc,code) \
297  ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_BLANK)
298 #define ONIGENC_IS_CODE_DIGIT(enc,code) \
299  ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_DIGIT)
300 #define ONIGENC_IS_CODE_XDIGIT(enc,code) \
301  ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_XDIGIT)
302 #define ONIGENC_IS_CODE_WORD(enc,code) \
303  ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_WORD)
304 
305 #define ONIGENC_GET_CTYPE_CODE_RANGE(enc,ctype,sbout,ranges) \
306  (enc)->get_ctype_code_range(ctype,sbout,ranges,enc)
307 
309 OnigUChar* onigenc_step_back P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, const OnigUChar* end, int n));
310 
311 
312 /* encoding API */
314 int onigenc_init P_((void));
320 void onigenc_set_default_caseconv_table P_((const OnigUChar* table));
322 OnigUChar* onigenc_get_right_adjust_char_head_with_prev P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, const OnigUChar* end, const OnigUChar** prev));
324 OnigUChar* onigenc_get_prev_char_head P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, const OnigUChar* end));
326 OnigUChar* onigenc_get_left_adjust_char_head P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, const OnigUChar* end));
328 OnigUChar* onigenc_get_right_adjust_char_head P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, const OnigUChar* end));
330 int onigenc_strlen P_((OnigEncoding enc, const OnigUChar* p, const OnigUChar* end));
332 int onigenc_strlen_null P_((OnigEncoding enc, const OnigUChar* p));
335 
336 
337 
338 /* PART: regular expression */
339 
340 /* config parameters */
341 #define ONIG_NREGION 10
342 #define ONIG_MAX_BACKREF_NUM 1000
343 #define ONIG_MAX_REPEAT_NUM 100000
344 #define ONIG_MAX_MULTI_BYTE_RANGES_NUM 10000
345 /* constants */
346 #define ONIG_MAX_ERROR_MESSAGE_LEN 90
347 
348 typedef unsigned int OnigOptionType;
349 
350 #define ONIG_OPTION_DEFAULT ONIG_OPTION_NONE
351 
352 /* options */
353 #define ONIG_OPTION_NONE 0U
354 #define ONIG_OPTION_IGNORECASE 1U
355 #define ONIG_OPTION_EXTEND (ONIG_OPTION_IGNORECASE << 1)
356 #define ONIG_OPTION_MULTILINE (ONIG_OPTION_EXTEND << 1)
357 #define ONIG_OPTION_DOTALL ONIG_OPTION_MULTILINE
358 #define ONIG_OPTION_SINGLELINE (ONIG_OPTION_MULTILINE << 1)
359 #define ONIG_OPTION_FIND_LONGEST (ONIG_OPTION_SINGLELINE << 1)
360 #define ONIG_OPTION_FIND_NOT_EMPTY (ONIG_OPTION_FIND_LONGEST << 1)
361 #define ONIG_OPTION_NEGATE_SINGLELINE (ONIG_OPTION_FIND_NOT_EMPTY << 1)
362 #define ONIG_OPTION_DONT_CAPTURE_GROUP (ONIG_OPTION_NEGATE_SINGLELINE << 1)
363 #define ONIG_OPTION_CAPTURE_GROUP (ONIG_OPTION_DONT_CAPTURE_GROUP << 1)
364 /* options (search time) */
365 #define ONIG_OPTION_NOTBOL (ONIG_OPTION_CAPTURE_GROUP << 1)
366 #define ONIG_OPTION_NOTEOL (ONIG_OPTION_NOTBOL << 1)
367 #define ONIG_OPTION_POSIX_REGION (ONIG_OPTION_NOTEOL << 1)
368 /* options (ctype range) */
369 #define ONIG_OPTION_ASCII_RANGE (ONIG_OPTION_POSIX_REGION << 1)
370 #define ONIG_OPTION_POSIX_BRACKET_ALL_RANGE (ONIG_OPTION_ASCII_RANGE << 1)
371 #define ONIG_OPTION_WORD_BOUND_ALL_RANGE (ONIG_OPTION_POSIX_BRACKET_ALL_RANGE << 1)
372 /* options (newline) */
373 #define ONIG_OPTION_NEWLINE_CRLF (ONIG_OPTION_WORD_BOUND_ALL_RANGE << 1)
374 #define ONIG_OPTION_MAXBIT ONIG_OPTION_NEWLINE_CRLF /* limit */
375 
376 #define ONIG_OPTION_ON(options,regopt) ((options) |= (regopt))
377 #define ONIG_OPTION_OFF(options,regopt) ((options) &= ~(regopt))
378 #define ONIG_IS_OPTION_ON(options,option) ((options) & (option))
379 
380 /* syntax */
381 typedef struct {
382  unsigned int op;
383  unsigned int op2;
384  unsigned int behavior;
385  OnigOptionType options; /* default option */
386  OnigMetaCharTableType meta_char_table;
388 
401 
402 /* predefined syntaxes (see regsyntax.c) */
403 #define ONIG_SYNTAX_ASIS (&OnigSyntaxASIS)
404 #define ONIG_SYNTAX_POSIX_BASIC (&OnigSyntaxPosixBasic)
405 #define ONIG_SYNTAX_POSIX_EXTENDED (&OnigSyntaxPosixExtended)
406 #define ONIG_SYNTAX_EMACS (&OnigSyntaxEmacs)
407 #define ONIG_SYNTAX_GREP (&OnigSyntaxGrep)
408 #define ONIG_SYNTAX_GNU_REGEX (&OnigSyntaxGnuRegex)
409 #define ONIG_SYNTAX_JAVA (&OnigSyntaxJava)
410 #define ONIG_SYNTAX_PERL58 (&OnigSyntaxPerl58)
411 #define ONIG_SYNTAX_PERL58_NG (&OnigSyntaxPerl58_NG)
412 #define ONIG_SYNTAX_PERL (&OnigSyntaxPerl)
413 #define ONIG_SYNTAX_RUBY (&OnigSyntaxRuby)
414 #define ONIG_SYNTAX_PYTHON (&OnigSyntaxPython)
415 
416 /* default syntax */
418 #define ONIG_SYNTAX_DEFAULT OnigDefaultSyntax
419 
420 /* syntax (operators) */
421 #define ONIG_SYN_OP_VARIABLE_META_CHARACTERS (1U<<0)
422 #define ONIG_SYN_OP_DOT_ANYCHAR (1U<<1) /* . */
423 #define ONIG_SYN_OP_ASTERISK_ZERO_INF (1U<<2) /* * */
424 #define ONIG_SYN_OP_ESC_ASTERISK_ZERO_INF (1U<<3)
425 #define ONIG_SYN_OP_PLUS_ONE_INF (1U<<4) /* + */
426 #define ONIG_SYN_OP_ESC_PLUS_ONE_INF (1U<<5)
427 #define ONIG_SYN_OP_QMARK_ZERO_ONE (1U<<6) /* ? */
428 #define ONIG_SYN_OP_ESC_QMARK_ZERO_ONE (1U<<7)
429 #define ONIG_SYN_OP_BRACE_INTERVAL (1U<<8) /* {lower,upper} */
430 #define ONIG_SYN_OP_ESC_BRACE_INTERVAL (1U<<9) /* \{lower,upper\} */
431 #define ONIG_SYN_OP_VBAR_ALT (1U<<10) /* | */
432 #define ONIG_SYN_OP_ESC_VBAR_ALT (1U<<11) /* \| */
433 #define ONIG_SYN_OP_LPAREN_SUBEXP (1U<<12) /* (...) */
434 #define ONIG_SYN_OP_ESC_LPAREN_SUBEXP (1U<<13) /* \(...\) */
435 #define ONIG_SYN_OP_ESC_AZ_BUF_ANCHOR (1U<<14) /* \A, \Z, \z */
436 #define ONIG_SYN_OP_ESC_CAPITAL_G_BEGIN_ANCHOR (1U<<15) /* \G */
437 #define ONIG_SYN_OP_DECIMAL_BACKREF (1U<<16) /* \num */
438 #define ONIG_SYN_OP_BRACKET_CC (1U<<17) /* [...] */
439 #define ONIG_SYN_OP_ESC_W_WORD (1U<<18) /* \w, \W */
440 #define ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END (1U<<19) /* <. > */
441 #define ONIG_SYN_OP_ESC_B_WORD_BOUND (1U<<20) /* \b, \B */
442 #define ONIG_SYN_OP_ESC_S_WHITE_SPACE (1U<<21) /* \s, \S */
443 #define ONIG_SYN_OP_ESC_D_DIGIT (1U<<22) /* \d, \D */
444 #define ONIG_SYN_OP_LINE_ANCHOR (1U<<23) /* ^, $ */
445 #define ONIG_SYN_OP_POSIX_BRACKET (1U<<24) /* [:xxxx:] */
446 #define ONIG_SYN_OP_QMARK_NON_GREEDY (1U<<25) /* ??,*?,+?,{n,m}? */
447 #define ONIG_SYN_OP_ESC_CONTROL_CHARS (1U<<26) /* \n,\r,\t,\a ... */
448 #define ONIG_SYN_OP_ESC_C_CONTROL (1U<<27) /* \cx */
449 #define ONIG_SYN_OP_ESC_OCTAL3 (1U<<28) /* \OOO */
450 #define ONIG_SYN_OP_ESC_X_HEX2 (1U<<29) /* \xHH */
451 #define ONIG_SYN_OP_ESC_X_BRACE_HEX8 (1U<<30) /* \x{7HHHHHHH} */
452 #define ONIG_SYN_OP_ESC_O_BRACE_OCTAL (1U<<31) /* \o{OOO} */ /* NOTIMPL */
453 
454 #define ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE (1U<<0) /* \Q...\E */
455 #define ONIG_SYN_OP2_QMARK_GROUP_EFFECT (1U<<1) /* (?...) */
456 #define ONIG_SYN_OP2_OPTION_PERL (1U<<2) /* (?imsxadlu), (?-imsx), (?^imsxalu) */
457 #define ONIG_SYN_OP2_OPTION_RUBY (1U<<3) /* (?imxadu), (?-imx) */
458 #define ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT (1U<<4) /* ?+,*+,++ */
459 #define ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL (1U<<5) /* {n,m}+ */
460 #define ONIG_SYN_OP2_CCLASS_SET_OP (1U<<6) /* [...&&..[..]..] */
461 #define ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP (1U<<7) /* (?<name>...) */
462 #define ONIG_SYN_OP2_ESC_K_NAMED_BACKREF (1U<<8) /* \k<name> */
463 #define ONIG_SYN_OP2_ESC_G_SUBEXP_CALL (1U<<9) /* \g<name>, \g<n> */
464 #define ONIG_SYN_OP2_ATMARK_CAPTURE_HISTORY (1U<<10) /* (?@..),(?@<x>..) */
465 #define ONIG_SYN_OP2_ESC_CAPITAL_C_BAR_CONTROL (1U<<11) /* \C-x */
466 #define ONIG_SYN_OP2_ESC_CAPITAL_M_BAR_META (1U<<12) /* \M-x */
467 #define ONIG_SYN_OP2_ESC_V_VTAB (1U<<13) /* \v as VTAB */
468 #define ONIG_SYN_OP2_ESC_U_HEX4 (1U<<14) /* \uHHHH */
469 #define ONIG_SYN_OP2_ESC_GNU_BUF_ANCHOR (1U<<15) /* \`, \' */
470 #define ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY (1U<<16) /* \p{...}, \P{...} */
471 #define ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT (1U<<17) /* \p{^..}, \P{^..} */
472 /* #define ONIG_SYN_OP2_CHAR_PROPERTY_PREFIX_IS (1U<<18) */
473 #define ONIG_SYN_OP2_ESC_H_XDIGIT (1U<<19) /* \h, \H */
474 #define ONIG_SYN_OP2_INEFFECTIVE_ESCAPE (1U<<20) /* \ */
475 #define ONIG_SYN_OP2_ESC_CAPITAL_R_LINEBREAK (1U<<21) /* \R as (?>\x0D\x0A|[\x0A-\x0D\x{85}\x{2028}\x{2029}]) */
476 #define ONIG_SYN_OP2_ESC_CAPITAL_X_EXTENDED_GRAPHEME_CLUSTER (1U<<22) /* \X as (?>\P{M}\p{M}*) */
477 #define ONIG_SYN_OP2_ESC_V_VERTICAL_WHITESPACE (1U<<23) /* \v, \V -- Perl */ /* NOTIMPL */
478 #define ONIG_SYN_OP2_ESC_H_HORIZONTAL_WHITESPACE (1U<<24) /* \h, \H -- Perl */ /* NOTIMPL */
479 #define ONIG_SYN_OP2_ESC_CAPITAL_K_KEEP (1U<<25) /* \K */
480 #define ONIG_SYN_OP2_ESC_G_BRACE_BACKREF (1U<<26) /* \g{name}, \g{n} */
481 #define ONIG_SYN_OP2_QMARK_SUBEXP_CALL (1U<<27) /* (?&name), (?n), (?R), (?0) */
482 #define ONIG_SYN_OP2_QMARK_VBAR_BRANCH_RESET (1U<<28) /* (?|...) */ /* NOTIMPL */
483 #define ONIG_SYN_OP2_QMARK_LPAREN_CONDITION (1U<<29) /* (?(cond)yes...|no...) */
484 #define ONIG_SYN_OP2_QMARK_CAPITAL_P_NAMED_GROUP (1U<<30) /* (?P<name>...), (?P=name), (?P>name) -- Python/PCRE */
485 #define ONIG_SYN_OP2_OPTION_JAVA (1U<<31) /* (?idmsux), (?-idmsux) */ /* NOTIMPL */
486 
487 /* syntax (behavior) */
488 #define ONIG_SYN_CONTEXT_INDEP_ANCHORS (1U<<31) /* not implemented */
489 #define ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS (1U<<0) /* ?, *, +, {n,m} */
490 #define ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS (1U<<1) /* error or ignore */
491 #define ONIG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP (1U<<2) /* ...)... */
492 #define ONIG_SYN_ALLOW_INVALID_INTERVAL (1U<<3) /* {??? */
493 #define ONIG_SYN_ALLOW_INTERVAL_LOW_ABBREV (1U<<4) /* {,n} => {0,n} */
494 #define ONIG_SYN_STRICT_CHECK_BACKREF (1U<<5) /* /(\1)/,/\1()/ ..*/
495 #define ONIG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND (1U<<6) /* (?<=a|bc) */
496 #define ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP (1U<<7) /* see doc/RE */
497 #define ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME (1U<<8) /* (?<x>)(?<x>) */
498 #define ONIG_SYN_FIXED_INTERVAL_IS_GREEDY_ONLY (1U<<9) /* a{n}?=(?:a{n})? */
499 #define ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME_CALL (1U<<10) /* (?<x>)(?<x>)(?&x) */
500 
501 /* syntax (behavior) in char class [...] */
502 #define ONIG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC (1U<<20) /* [^...] */
503 #define ONIG_SYN_BACKSLASH_ESCAPE_IN_CC (1U<<21) /* [..\w..] etc.. */
504 #define ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC (1U<<22)
505 #define ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC (1U<<23) /* [0-9-a]=[0-9\-a] */
506 /* syntax (behavior) warning */
507 #define ONIG_SYN_WARN_CC_OP_NOT_ESCAPED (1U<<24) /* [,-,] */
508 #define ONIG_SYN_WARN_REDUNDANT_NESTED_REPEAT (1U<<25) /* (?:a*)+ */
509 #define ONIG_SYN_WARN_CC_DUP (1U<<26) /* [aa] */
510 
511 /* meta character specifiers (onig_set_meta_char()) */
512 #define ONIG_META_CHAR_ESCAPE 0
513 #define ONIG_META_CHAR_ANYCHAR 1
514 #define ONIG_META_CHAR_ANYTIME 2
515 #define ONIG_META_CHAR_ZERO_OR_ONE_TIME 3
516 #define ONIG_META_CHAR_ONE_OR_MORE_TIME 4
517 #define ONIG_META_CHAR_ANYCHAR_ANYTIME 5
518 
519 #define ONIG_INEFFECTIVE_META_CHAR 0
520 
521 /* error codes */
522 #define ONIG_IS_PATTERN_ERROR(ecode) ((ecode) <= -100 && (ecode) > -1000)
523 /* normal return */
524 #define ONIG_NORMAL 0
525 #define ONIG_MISMATCH -1
526 #define ONIG_NO_SUPPORT_CONFIG -2
527 
528 /* internal error */
529 #define ONIGERR_MEMORY -5
530 #define ONIGERR_TYPE_BUG -6
531 #define ONIGERR_PARSER_BUG -11
532 #define ONIGERR_STACK_BUG -12
533 #define ONIGERR_UNDEFINED_BYTECODE -13
534 #define ONIGERR_UNEXPECTED_BYTECODE -14
535 #define ONIGERR_MATCH_STACK_LIMIT_OVER -15
536 #define ONIGERR_DEFAULT_ENCODING_IS_NOT_SET -21
537 #define ONIGERR_SPECIFIED_ENCODING_CANT_CONVERT_TO_WIDE_CHAR -22
538 /* general error */
539 #define ONIGERR_INVALID_ARGUMENT -30
540 /* syntax error */
541 #define ONIGERR_END_PATTERN_AT_LEFT_BRACE -100
542 #define ONIGERR_END_PATTERN_AT_LEFT_BRACKET -101
543 #define ONIGERR_EMPTY_CHAR_CLASS -102
544 #define ONIGERR_PREMATURE_END_OF_CHAR_CLASS -103
545 #define ONIGERR_END_PATTERN_AT_ESCAPE -104
546 #define ONIGERR_END_PATTERN_AT_META -105
547 #define ONIGERR_END_PATTERN_AT_CONTROL -106
548 #define ONIGERR_META_CODE_SYNTAX -108
549 #define ONIGERR_CONTROL_CODE_SYNTAX -109
550 #define ONIGERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE -110
551 #define ONIGERR_CHAR_CLASS_VALUE_AT_START_OF_RANGE -111
552 #define ONIGERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS -112
553 #define ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED -113
554 #define ONIGERR_TARGET_OF_REPEAT_OPERATOR_INVALID -114
555 #define ONIGERR_NESTED_REPEAT_OPERATOR -115
556 #define ONIGERR_UNMATCHED_CLOSE_PARENTHESIS -116
557 #define ONIGERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS -117
558 #define ONIGERR_END_PATTERN_IN_GROUP -118
559 #define ONIGERR_UNDEFINED_GROUP_OPTION -119
560 #define ONIGERR_INVALID_POSIX_BRACKET_TYPE -121
561 #define ONIGERR_INVALID_LOOK_BEHIND_PATTERN -122
562 #define ONIGERR_INVALID_REPEAT_RANGE_PATTERN -123
563 #define ONIGERR_INVALID_CONDITION_PATTERN -124
564 /* values error (syntax error) */
565 #define ONIGERR_TOO_BIG_NUMBER -200
566 #define ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE -201
567 #define ONIGERR_UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE -202
568 #define ONIGERR_EMPTY_RANGE_IN_CHAR_CLASS -203
569 #define ONIGERR_MISMATCH_CODE_LENGTH_IN_CLASS_RANGE -204
570 #define ONIGERR_TOO_MANY_MULTI_BYTE_RANGES -205
571 #define ONIGERR_TOO_SHORT_MULTI_BYTE_STRING -206
572 #define ONIGERR_TOO_BIG_BACKREF_NUMBER -207
573 #define ONIGERR_INVALID_BACKREF -208
574 #define ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED -209
575 #define ONIGERR_TOO_SHORT_DIGITS -210
576 #define ONIGERR_TOO_LONG_WIDE_CHAR_VALUE -212
577 #define ONIGERR_EMPTY_GROUP_NAME -214
578 #define ONIGERR_INVALID_GROUP_NAME -215
579 #define ONIGERR_INVALID_CHAR_IN_GROUP_NAME -216
580 #define ONIGERR_UNDEFINED_NAME_REFERENCE -217
581 #define ONIGERR_UNDEFINED_GROUP_REFERENCE -218
582 #define ONIGERR_MULTIPLEX_DEFINED_NAME -219
583 #define ONIGERR_MULTIPLEX_DEFINITION_NAME_CALL -220
584 #define ONIGERR_NEVER_ENDING_RECURSION -221
585 #define ONIGERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY -222
586 #define ONIGERR_INVALID_CHAR_PROPERTY_NAME -223
587 #define ONIGERR_INVALID_CODE_POINT_VALUE -400
588 #define ONIGERR_INVALID_WIDE_CHAR_VALUE -400
589 #define ONIGERR_TOO_BIG_WIDE_CHAR_VALUE -401
590 #define ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION -402
591 #define ONIGERR_INVALID_COMBINATION_OF_OPTIONS -403
592 
593 /* errors related to thread */
594 #define ONIGERR_OVER_THREAD_PASS_LIMIT_COUNT -1001
595 
596 
597 /* must be smaller than BIT_STATUS_BITS_NUM (unsigned int * 8) */
598 #define ONIG_MAX_CAPTURE_HISTORY_GROUP 31
599 #define ONIG_IS_CAPTURE_HISTORY_GROUP(r, i) \
600  ((i) <= ONIG_MAX_CAPTURE_HISTORY_GROUP && (r)->list && (r)->list[i])
601 
602 typedef struct OnigCaptureTreeNodeStruct {
603  int group; /* group number */
606  int allocated;
607  int num_childs;
610 
611 /* match result region type */
612 struct re_registers {
613  int allocated;
614  int num_regs;
615  OnigPosition* beg;
616  OnigPosition* end;
617  /* extended */
618  OnigCaptureTreeNode* history_root; /* capture history tree root */
619 };
620 
621 /* capture tree traverse */
622 #define ONIG_TRAVERSE_CALLBACK_AT_FIRST 1
623 #define ONIG_TRAVERSE_CALLBACK_AT_LAST 2
624 #define ONIG_TRAVERSE_CALLBACK_AT_BOTH \
625  ( ONIG_TRAVERSE_CALLBACK_AT_FIRST | ONIG_TRAVERSE_CALLBACK_AT_LAST )
626 
627 
628 #define ONIG_REGION_NOTPOS -1
629 
630 typedef struct re_registers OnigRegion;
631 
632 typedef struct {
633  OnigEncoding enc;
634  OnigUChar* par;
635  OnigUChar* par_end;
636 } OnigErrorInfo;
637 
638 typedef struct {
639  int lower;
640  int upper;
642 
643 typedef void (*OnigWarnFunc) P_((const char* s));
644 extern void onig_null_warn P_((const char* s));
645 #define ONIG_NULL_WARN onig_null_warn
646 
647 #define ONIG_CHAR_TABLE_SIZE 256
648 
649 /* regex_t state */
650 #define ONIG_STATE_NORMAL 0
651 #define ONIG_STATE_SEARCHING 1
652 #define ONIG_STATE_COMPILING -1
653 #define ONIG_STATE_MODIFY -2
654 
655 #define ONIG_STATE(reg) \
656  ((reg)->state > 0 ? ONIG_STATE_SEARCHING : (reg)->state)
657 
658 typedef struct re_pattern_buffer {
659  /* common members of BBuf(bytes-buffer) */
660  unsigned char* p; /* compiled pattern */
661  unsigned int used; /* used space for p */
662  unsigned int alloc; /* allocated space for p */
663 
664  int state; /* normal, searching, compiling */
665  int num_mem; /* used memory(...) num counted from 1 */
666  int num_repeat; /* OP_REPEAT/OP_REPEAT_NG id-counter */
667  int num_null_check; /* OP_NULL_CHECK_START/END id counter */
668  int num_comb_exp_check; /* combination explosion check */
669  int num_call; /* number of subexp call */
670  unsigned int capture_history; /* (?@...) flag (1-31) */
671  unsigned int bt_mem_start; /* need backtrack flag */
672  unsigned int bt_mem_end; /* need backtrack flag */
673  int stack_pop_level;
674  int repeat_range_alloc;
676 
678  OnigOptionType options;
679  const OnigSyntaxType* syntax;
681  void* name_table;
682 
683  /* optimization info (string search, char-map and anchors) */
684  int optimize; /* optimize flag */
685  int threshold_len; /* search str-length for apply optimize */
686  int anchor; /* BEGIN_BUF, BEGIN_POS, (SEMI_)END_BUF */
687  OnigDistance anchor_dmin; /* (SEMI_)END_BUF anchor distance */
688  OnigDistance anchor_dmax; /* (SEMI_)END_BUF anchor distance */
689  int sub_anchor; /* start-anchor for exact or map */
690  unsigned char *exact;
691  unsigned char *exact_end;
692  unsigned char map[ONIG_CHAR_TABLE_SIZE]; /* used as BM skip or char-map */
693  int *int_map; /* BM skip for exact_len > 255 */
694  int *int_map_backward; /* BM skip for backward search */
695  OnigDistance dmin; /* min-distance of exact or map */
696  OnigDistance dmax; /* max-distance of exact or map */
697 
698  /* regex_t link chain */
699  struct re_pattern_buffer* chain; /* escape compile-conflict */
700 } OnigRegexType;
701 
703 
704 #ifndef ONIG_ESCAPE_REGEX_T_COLLISION
706 #endif
707 
708 
709 typedef struct {
710  int num_of_elements;
711  OnigEncoding pattern_enc;
712  OnigEncoding target_enc;
714  OnigOptionType option;
717 
718 /* Oniguruma Native API */
720 int onig_init P_((void));
722 int onig_error_code_to_str PV_((OnigUChar* s, OnigPosition err_code, ...));
724 void onig_set_warn_func P_((OnigWarnFunc f));
726 void onig_set_verb_warn_func P_((OnigWarnFunc f));
728 int onig_new P_((OnigRegex*, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, const OnigSyntaxType* syntax, OnigErrorInfo* einfo));
730 int onig_reg_init P_((OnigRegex reg, OnigOptionType option, OnigCaseFoldType case_fold_flag, OnigEncoding enc, const OnigSyntaxType* syntax));
732 int onig_new_without_alloc P_((OnigRegex, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo));
734 int onig_new_deluxe P_((OnigRegex* reg, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo));
736 void onig_free P_((OnigRegex));
738 void onig_free_body P_((OnigRegex));
740 int onig_recompile P_((OnigRegex, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo));
742 int onig_recompile_deluxe P_((OnigRegex reg, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo));
744 OnigPosition onig_search P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegion* region, OnigOptionType option));
746 OnigPosition onig_search_gpos P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* global_pos, const OnigUChar* start, const OnigUChar* range, OnigRegion* region, OnigOptionType option));
748 OnigPosition onig_match P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* at, OnigRegion* region, OnigOptionType option));
750 OnigRegion* onig_region_new P_((void));
752 void onig_region_init P_((OnigRegion* region));
754 void onig_region_free P_((OnigRegion* region, int free_self));
756 void onig_region_copy P_((OnigRegion* to, OnigRegion* from));
758 void onig_region_clear P_((OnigRegion* region));
760 int onig_region_resize P_((OnigRegion* region, int n));
762 int onig_region_set P_((OnigRegion* region, int at, int beg, int end));
764 int onig_name_to_group_numbers P_((OnigRegex reg, const OnigUChar* name, const OnigUChar* name_end, int** nums));
766 int onig_name_to_backref_number P_((OnigRegex reg, const OnigUChar* name, const OnigUChar* name_end, OnigRegion *region));
768 int onig_foreach_name P_((OnigRegex reg, int (*func)(const OnigUChar*, const OnigUChar*,int,int*,OnigRegex,void*), void* arg));
770 int onig_number_of_names P_((OnigRegex reg));
772 int onig_number_of_captures P_((OnigRegex reg));
774 int onig_number_of_capture_histories P_((OnigRegex reg));
776 OnigCaptureTreeNode* onig_get_capture_tree P_((OnigRegion* region));
778 int onig_capture_tree_traverse P_((OnigRegion* region, int at, int(*callback_func)(int,OnigPosition,OnigPosition,int,int,void*), void* arg));
780 int onig_noname_group_capture_is_active P_((OnigRegex reg));
782 OnigEncoding onig_get_encoding P_((OnigRegex reg));
784 OnigOptionType onig_get_options P_((OnigRegex reg));
788 const OnigSyntaxType* onig_get_syntax P_((OnigRegex reg));
790 int onig_set_default_syntax P_((const OnigSyntaxType* syntax));
792 void onig_copy_syntax P_((OnigSyntaxType* to, const OnigSyntaxType* from));
794 unsigned int onig_get_syntax_op P_((OnigSyntaxType* syntax));
796 unsigned int onig_get_syntax_op2 P_((OnigSyntaxType* syntax));
798 unsigned int onig_get_syntax_behavior P_((OnigSyntaxType* syntax));
800 OnigOptionType onig_get_syntax_options P_((OnigSyntaxType* syntax));
802 void onig_set_syntax_op P_((OnigSyntaxType* syntax, unsigned int op));
804 void onig_set_syntax_op2 P_((OnigSyntaxType* syntax, unsigned int op2));
806 void onig_set_syntax_behavior P_((OnigSyntaxType* syntax, unsigned int behavior));
808 void onig_set_syntax_options P_((OnigSyntaxType* syntax, OnigOptionType options));
810 int onig_set_meta_char P_((OnigSyntaxType* syntax, unsigned int what, OnigCodePoint code));
818 unsigned int onig_get_match_stack_limit_size P_((void));
820 int onig_set_match_stack_limit_size P_((unsigned int size));
822 int onig_end P_((void));
824 const char* onig_version P_((void));
826 const char* onig_copyright P_((void));
827 
828 #if defined __GNUC__ && __GNUC__ >= 4
829 #pragma GCC visibility pop
830 #endif
831 
832 #ifdef __cplusplus
833 #if 0
834 { /* satisfy cc-mode */
835 #endif
836 }
837 #endif
838 
839 #endif /* ONIGURUMA_H */
int onig_region_resize(OnigRegion *region, int n)
Definition: regexec.c:222
UChar * onigenc_step_back(OnigEncoding enc, const UChar *start, const UChar *s, const UChar *end, int n)
Definition: regenc.c:101
int onig_new_without_alloc(regex_t *reg, const UChar *pattern, const UChar *pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType *syntax, OnigErrorInfo *einfo)
Definition: regcomp.c:5940
struct re_pattern_buffer OnigRegexType
unsigned int OnigCodePoint
Definition: oniguruma.h:114
void onig_set_warn_func(OnigWarnFunc f)
Definition: regparse.c:96
unsigned int onig_get_match_stack_limit_size(void)
Definition: regexec.c:475
int onig_new(regex_t **reg, const UChar *pattern, const UChar *pattern_end, OnigOptionType option, OnigEncoding enc, const OnigSyntaxType *syntax, OnigErrorInfo *einfo)
Definition: regcomp.c:5954
int onig_foreach_name(regex_t *reg, int(*func)(const UChar *, const UChar *, int, int *, regex_t *, void *), void *arg)
Definition: regparse.c:537
unsigned char * exact_end
Definition: ripper.y:692
ONIG_EXTERN const OnigSyntaxType OnigSyntaxPerl
Definition: oniguruma.h:398
int onigenc_mbclen_approximate(const OnigUChar *p, const OnigUChar *e, struct OnigEncodingTypeST *enc)
Definition: regenc.c:55
unsigned int onig_get_syntax_op(OnigSyntaxType *syntax)
Definition: regsyntax.c:335
ONIG_EXTERN const OnigSyntaxType OnigSyntaxPerl58_NG
Definition: oniguruma.h:397
void onig_null_warn(const char *s ARG_UNUSED)
Definition: regparse.c:82
OnigPosition end
Definition: ripper.y:606
ONIG_EXTERN const OnigSyntaxType OnigSyntaxRuby
Definition: oniguruma.h:399
int ruby_encoding_index
Definition: ripper.y:178
UChar * onigenc_get_right_adjust_char_head(OnigEncoding enc, const UChar *start, const UChar *s, const UChar *end)
Definition: regenc.c:66
unsigned int OnigCaseFoldType
Definition: oniguruma.h:121
unsigned int OnigCodePoint
Definition: ripper.y:115
int onigenc_set_default_encoding(OnigEncoding enc)
Definition: regenc.c:48
unsigned int bt_mem_end
Definition: ripper.y:673
int(* property_name_to_ctype)(struct OnigEncodingTypeST *enc, OnigUChar *p, OnigUChar *end)
Definition: ripper.y:173
int onig_set_match_stack_limit_size(unsigned int size)
Definition: regexec.c:481
void onig_region_copy(OnigRegion *to, OnigRegion *from)
Definition: regexec.c:331
OnigCaseFoldType onig_get_default_case_fold_flag(void)
Definition: regcomp.c:36
OnigOptionType onig_get_options(regex_t *reg)
Definition: regexec.c:4298
OnigRepeatRange * repeat_range
Definition: ripper.y:676
UChar * onigenc_get_left_adjust_char_head(OnigEncoding enc, const UChar *start, const UChar *s, const UChar *end)
Definition: regenc.c:375
OnigDistance anchor_dmax
Definition: ripper.y:689
int onig_error_code_to_str(UChar *s, OnigPosition code, va_alist)
Definition: regerror.c:256
int onigenc_strlen(OnigEncoding enc, const UChar *p, const UChar *end)
Definition: regenc.c:123
unsigned int flags
Definition: ripper.y:179
int(* get_case_fold_codes_by_str)(OnigCaseFoldType flag, const OnigUChar *p, const OnigUChar *end, OnigCaseFoldCodeItem acs[], struct OnigEncodingTypeST *enc)
Definition: ripper.y:172
int onig_set_default_syntax(const OnigSyntaxType *syntax)
Definition: regsyntax.c:295
void onig_region_clear(OnigRegion *region)
Definition: regexec.c:209
int(* code_to_mbclen)(OnigCodePoint code, struct OnigEncodingTypeST *enc)
Definition: ripper.y:168
int onig_init(void)
Definition: regcomp.c:5977
UChar * onigenc_get_right_adjust_char_head_with_prev(OnigEncoding enc, const UChar *start, const UChar *s, const UChar *end, const UChar **prev)
Definition: regenc.c:76
int(* code_to_mbc)(OnigCodePoint code, OnigUChar *buf, struct OnigEncodingTypeST *enc)
Definition: ripper.y:169
void onig_set_syntax_op2(OnigSyntaxType *syntax, unsigned int op2)
Definition: regsyntax.c:317
unsigned int OnigOptionType
Definition: oniguruma.h:348
OnigDistance anchor_dmin
Definition: ripper.y:688
unsigned int OnigCaseFoldType
Definition: ripper.y:122
int onig_number_of_captures(regex_t *reg)
Definition: regexec.c:4316
unsigned int bt_mem_start
Definition: ripper.y:672
OnigEncoding onigenc_get_default_encoding(void)
Definition: regenc.c:42
ONIG_EXTERN const OnigSyntaxType OnigSyntaxEmacs
Definition: oniguruma.h:392
void onig_free_body(regex_t *reg)
Definition: regcomp.c:5566
const char * name
Definition: ripper.y:163
unsigned char OnigUChar
Definition: oniguruma.h:113
UChar * onigenc_get_prev_char_head(OnigEncoding enc, const UChar *start, const UChar *s, const UChar *end)
Definition: regenc.c:92
Win32OLEIDispatch * p
Definition: win32ole.c:786
void * name_table
Definition: ripper.y:682
int onig_region_set(OnigRegion *region, int at, int beg, int end)
Definition: regexec.c:279
void onig_region_init(OnigRegion *region)
Definition: regexec.c:294
OnigPosition * end
Definition: ripper.y:617
void onigenc_set_default_caseconv_table(const UChar *table ARG_UNUSED)
Definition: regenc.c:368
OnigCaseFoldType case_fold_flag
Definition: ripper.y:681
OnigPosition beg
Definition: ripper.y:605
#define ONIG_CHAR_TABLE_SIZE
Definition: oniguruma.h:647
int onigenc_init(void)
Definition: regenc.c:36
int(* OnigApplyAllCaseFoldFunc)(OnigCodePoint from, OnigCodePoint *to, int to_len, void *arg)
Definition: oniguruma.h:158
unsigned int onig_get_syntax_behavior(OnigSyntaxType *syntax)
Definition: regsyntax.c:347
int num_comb_exp_check
Definition: ripper.y:669
ONIG_EXTERN const OnigSyntaxType OnigSyntaxGnuRegex
Definition: oniguruma.h:394
OnigEncoding onig_get_encoding(regex_t *reg)
Definition: regexec.c:4292
struct OnigCaptureTreeNodeStruct ** childs
Definition: ripper.y:609
int onig_name_to_backref_number(regex_t *reg, const UChar *name, const UChar *name_end, OnigRegion *region)
Definition: regparse.c:870
unsigned char map[ONIG_CHAR_TABLE_SIZE]
Definition: ripper.y:693
void onig_region_free(OnigRegion *r, int free_self)
Definition: regexec.c:315
int onig_reg_init(regex_t *reg, OnigOptionType option, OnigCaseFoldType case_fold_flag, OnigEncoding enc, const OnigSyntaxType *syntax)
Definition: regcomp.c:5894
unsigned char OnigUChar
Definition: ripper.y:114
void onig_set_verb_warn_func(OnigWarnFunc f)
Definition: regparse.c:101
int(* is_allowed_reverse_match)(const OnigUChar *p, const OnigUChar *end, struct OnigEncodingTypeST *enc)
Definition: ripper.y:177
size_t OnigDistance
Definition: ripper.y:117
#define range(low, item, hi)
Definition: date_strftime.c:21
int stack_pop_level
Definition: ripper.y:674
arg
Definition: ripper.y:1316
#define ONIG_EXTERN
Definition: oniguruma.h:98
unsigned int onig_get_syntax_op2(OnigSyntaxType *syntax)
Definition: regsyntax.c:341
unsigned char * exact
Definition: ripper.y:691
OnigPosition onig_search_gpos(regex_t *reg, const UChar *str, const UChar *end, const UChar *global_pos, const UChar *start, const UChar *range, OnigRegion *region, OnigOptionType option)
Definition: regexec.c:3882
SSL_METHOD *(* func)(void)
Definition: ossl_ssl.c:108
ONIG_EXTERN const OnigSyntaxType * OnigDefaultSyntax
Definition: oniguruma.h:417
#define const
Definition: strftime.c:102
ONIG_EXTERN OnigCaseFoldType OnigDefaultCaseFoldFlag
Definition: oniguruma.h:123
ONIG_EXTERN const OnigSyntaxType OnigSyntaxASIS
Definition: oniguruma.h:389
int onig_name_to_group_numbers(regex_t *reg, const UChar *name, const UChar *name_end, int **nums)
Definition: regparse.c:848
ONIG_EXTERN const OnigSyntaxType OnigSyntaxGrep
Definition: oniguruma.h:393
unsigned int OnigCtype
Definition: oniguruma.h:115
unsigned char buf[MIME_BUF_SIZE]
Definition: nkf.c:4308
ONIG_EXTERN const OnigSyntaxType OnigSyntaxPosixExtended
Definition: oniguruma.h:391
OnigPosition * beg
Definition: ripper.y:616
ONIG_EXTERN const OnigSyntaxType OnigSyntaxPosixBasic
Definition: oniguruma.h:390
OnigCaptureTreeNode * history_root
Definition: ripper.y:619
void onig_set_syntax_op(OnigSyntaxType *syntax, unsigned int op)
Definition: regsyntax.c:311
static int options(unsigned char *cp)
Definition: nkf.c:6355
#define P_(args)
Definition: oniguruma.h:71
ONIG_EXTERN const OnigSyntaxType OnigSyntaxPerl58
Definition: oniguruma.h:396
OnigEncodingType * OnigEncoding
Definition: oniguruma.h:181
#define ONIGENC_MAX_COMP_CASE_FOLD_CODE_LEN
Definition: oniguruma.h:134
unsigned int used
Definition: ripper.y:662
int onigenc_str_bytelen_null(OnigEncoding enc, const UChar *s)
Definition: regenc.c:163
int * int_map_backward
Definition: ripper.y:695
int onigenc_strlen_null(OnigEncoding enc, const UChar *s)
Definition: regenc.c:136
const OnigSyntaxType * syntax
Definition: ripper.y:680
void onig_set_syntax_behavior(OnigSyntaxType *syntax, unsigned int behavior)
Definition: regsyntax.c:323
int(* get_ctype_code_range)(OnigCtype ctype, OnigCodePoint *sb_out, const OnigCodePoint *ranges[], struct OnigEncodingTypeST *enc)
Definition: ripper.y:175
unsigned int OnigCtype
Definition: ripper.y:116
OnigDistance dmax
Definition: ripper.y:697
OnigOptionType onig_get_syntax_options(OnigSyntaxType *syntax)
Definition: regsyntax.c:353
int onig_noname_group_capture_is_active(regex_t *reg)
Definition: regparse.c:924
int size
Definition: encoding.c:52
int(* mbc_case_fold)(OnigCaseFoldType flag, const OnigUChar **pp, const OnigUChar *end, OnigUChar *to, struct OnigEncodingTypeST *enc)
Definition: ripper.y:170
#define f
ONIG_EXTERN const OnigSyntaxType OnigSyntaxPython
Definition: oniguruma.h:400
OnigPosition onig_search(regex_t *reg, const UChar *str, const UChar *end, const UChar *start, const UChar *range, OnigRegion *region, OnigOptionType option)
Definition: regexec.c:3875
void onig_set_syntax_options(OnigSyntaxType *syntax, OnigOptionType options)
Definition: regsyntax.c:329
ptrdiff_t OnigPosition
Definition: oniguruma.h:117
OnigPosition onig_match(regex_t *reg, const UChar *str, const UChar *end, const UChar *at, OnigRegion *region, OnigOptionType option)
Definition: regexec.c:3572
OnigRegexType regex_t
Definition: oniguruma.h:705
unsigned int alloc
Definition: ripper.y:663
OnigRegexType * OnigRegex
Definition: oniguruma.h:702
size_t OnigDistance
Definition: oniguruma.h:116
int num_regs
Definition: ripper.y:615
int onig_number_of_names(regex_t *reg)
Definition: regparse.c:584
unsigned int capture_history
Definition: ripper.y:671
int onig_number_of_capture_histories(regex_t *reg)
Definition: regexec.c:4322
#define PV_(args)
Definition: oniguruma.h:79
int(* is_mbc_newline)(const OnigUChar *p, const OnigUChar *end, struct OnigEncodingTypeST *enc)
Definition: ripper.y:166
struct OnigEncodingTypeST OnigEncodingType
ONIG_EXTERN OnigEncodingType OnigEncodingASCII
Definition: oniguruma.h:183
void onig_copy_encoding(OnigEncoding to, OnigEncoding from)
Definition: regexec.c:4339
int(* is_code_ctype)(OnigCodePoint code, OnigCtype ctype, struct OnigEncodingTypeST *enc)
Definition: ripper.y:174
int(* precise_mbc_enc_len)(const OnigUChar *p, const OnigUChar *e, struct OnigEncodingTypeST *enc)
Definition: ripper.y:162
OnigCodePoint(* mbc_to_code)(const OnigUChar *p, const OnigUChar *end, struct OnigEncodingTypeST *enc)
Definition: ripper.y:167
OnigCaseFoldType onig_get_case_fold_flag(regex_t *reg)
Definition: regexec.c:4304
OnigDistance dmin
Definition: ripper.y:696
struct OnigCaptureTreeNodeStruct OnigCaptureTreeNode
const char * name
Definition: nkf.c:208
void onig_copy_syntax(OnigSyntaxType *to, const OnigSyntaxType *from)
Definition: regsyntax.c:305
ONIG_EXTERN const OnigSyntaxType OnigSyntaxJava
Definition: oniguruma.h:395
OnigEncoding enc
Definition: ripper.y:678
int onig_set_meta_char(OnigSyntaxType *enc, unsigned int what, OnigCodePoint code)
Definition: regsyntax.c:359
OnigRegion * onig_region_new(void)
Definition: regexec.c:304
int onig_end(void)
Definition: regcomp.c:6000
int(* apply_all_case_fold)(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void *arg, struct OnigEncodingTypeST *enc)
Definition: ripper.y:171
int num_null_check
Definition: ripper.y:668
int allocated
Definition: ripper.y:614
OnigOptionType options
Definition: ripper.y:679
const OnigSyntaxType * onig_get_syntax(regex_t *reg)
Definition: regexec.c:4310
void onig_free(regex_t *reg)
Definition: regcomp.c:5583
int repeat_range_alloc
Definition: ripper.y:675
unsigned char * p
Definition: ripper.y:661
int onig_set_default_case_fold_flag(OnigCaseFoldType case_fold_flag)
Definition: regcomp.c:42
struct re_pattern_buffer * chain
Definition: ripper.y:700
ptrdiff_t OnigPosition
Definition: ripper.y:118