Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

regsyntax.c
Go to the documentation of this file.
1 /**********************************************************************
2 regsyntax.c - Onigmo (Oniguruma-mod) (regular expression library)
3 **********************************************************************/
4 /*-
5 * Copyright (c) 2002-2006 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
6 * Copyright (c) 2011-2016 K.Takata <kentkt AT csc DOT jp>
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
31 #include "regint.h"
32
33 const OnigSyntaxType OnigSyntaxASIS = {
34 0
35 , ONIG_SYN_OP2_INEFFECTIVE_ESCAPE
36 , 0
37 , ONIG_OPTION_NONE
38 ,
39 {
40 (OnigCodePoint )'\\' /* esc */
41 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar '.' */
42 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anytime '*' */
43 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* zero or one time '?' */
44 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* one or more time '+' */
45 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar anytime */
46 }
47 };
48
49 const OnigSyntaxType OnigSyntaxPosixBasic = {
50 ( SYN_POSIX_COMMON_OP | ONIG_SYN_OP_ESC_LPAREN_SUBEXP |
51 ONIG_SYN_OP_ESC_BRACE_INTERVAL )
52 , 0
53 , 0
54 , ( ONIG_OPTION_SINGLELINE | ONIG_OPTION_MULTILINE )
55 ,
56 {
57 (OnigCodePoint )'\\' /* esc */
58 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar '.' */
59 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anytime '*' */
60 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* zero or one time '?' */
61 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* one or more time '+' */
62 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar anytime */
63 }
64 };
65
66 const OnigSyntaxType OnigSyntaxPosixExtended = {
67 ( SYN_POSIX_COMMON_OP | ONIG_SYN_OP_LPAREN_SUBEXP |
68 ONIG_SYN_OP_BRACE_INTERVAL |
69 ONIG_SYN_OP_PLUS_ONE_INF | ONIG_SYN_OP_QMARK_ZERO_ONE | ONIG_SYN_OP_VBAR_ALT )
70 , 0
71 , ( ONIG_SYN_CONTEXT_INDEP_ANCHORS |
72 ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS | ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS |
73 ONIG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP |
74 ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC )
75 , ( ONIG_OPTION_SINGLELINE | ONIG_OPTION_MULTILINE )
76 ,
77 {
78 (OnigCodePoint )'\\' /* esc */
79 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar '.' */
80 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anytime '*' */
81 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* zero or one time '?' */
82 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* one or more time '+' */
83 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar anytime */
84 }
85 };
86
87 const OnigSyntaxType OnigSyntaxEmacs = {
88 ( ONIG_SYN_OP_DOT_ANYCHAR | ONIG_SYN_OP_BRACKET_CC |
89 ONIG_SYN_OP_ESC_BRACE_INTERVAL |
90 ONIG_SYN_OP_ESC_LPAREN_SUBEXP | ONIG_SYN_OP_ESC_VBAR_ALT |
91 ONIG_SYN_OP_ASTERISK_ZERO_INF | ONIG_SYN_OP_PLUS_ONE_INF |
92 ONIG_SYN_OP_QMARK_ZERO_ONE | ONIG_SYN_OP_DECIMAL_BACKREF |
93 ONIG_SYN_OP_LINE_ANCHOR | ONIG_SYN_OP_ESC_CONTROL_CHARS )
94 , ONIG_SYN_OP2_ESC_GNU_BUF_ANCHOR
95 , ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC
96 , ONIG_OPTION_NONE
97 ,
98 {
99 (OnigCodePoint )'\\' /* esc */
100 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar '.' */
101 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anytime '*' */
102 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* zero or one time '?' */
103 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* one or more time '+' */
104 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar anytime */
105 }
106 };
107
108 const OnigSyntaxType OnigSyntaxGrep = {
109 ( ONIG_SYN_OP_DOT_ANYCHAR | ONIG_SYN_OP_BRACKET_CC | ONIG_SYN_OP_POSIX_BRACKET |
110 ONIG_SYN_OP_ESC_BRACE_INTERVAL | ONIG_SYN_OP_ESC_LPAREN_SUBEXP |
111 ONIG_SYN_OP_ESC_VBAR_ALT |
112 ONIG_SYN_OP_ASTERISK_ZERO_INF | ONIG_SYN_OP_ESC_PLUS_ONE_INF |
113 ONIG_SYN_OP_ESC_QMARK_ZERO_ONE | ONIG_SYN_OP_LINE_ANCHOR |
114 ONIG_SYN_OP_ESC_W_WORD | ONIG_SYN_OP_ESC_B_WORD_BOUND |
115 ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END | ONIG_SYN_OP_DECIMAL_BACKREF )
116 , 0
117 , ( ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC | ONIG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC )
118 , ONIG_OPTION_NONE
119 ,
120 {
121 (OnigCodePoint )'\\' /* esc */
122 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar '.' */
123 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anytime '*' */
124 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* zero or one time '?' */
125 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* one or more time '+' */
126 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar anytime */
127 }
128 };
129
130 const OnigSyntaxType OnigSyntaxGnuRegex = {
131 SYN_GNU_REGEX_OP
132 , 0
133 , SYN_GNU_REGEX_BV
134 , ONIG_OPTION_NONE
135 ,
136 {
137 (OnigCodePoint )'\\' /* esc */
138 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar '.' */
139 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anytime '*' */
140 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* zero or one time '?' */
141 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* one or more time '+' */
142 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar anytime */
143 }
144 };
145
146 const OnigSyntaxType OnigSyntaxJava = {
147 (( SYN_GNU_REGEX_OP | ONIG_SYN_OP_QMARK_NON_GREEDY |
148 ONIG_SYN_OP_ESC_CONTROL_CHARS | ONIG_SYN_OP_ESC_C_CONTROL |
149 ONIG_SYN_OP_ESC_OCTAL3 | ONIG_SYN_OP_ESC_X_HEX2 )
150 & ~ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END )
151 , ( ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE | ONIG_SYN_OP2_QMARK_GROUP_EFFECT |
152 ONIG_SYN_OP2_OPTION_PERL | ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT |
153 ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL | ONIG_SYN_OP2_CCLASS_SET_OP |
154 ONIG_SYN_OP2_ESC_V_VTAB | ONIG_SYN_OP2_ESC_U_HEX4 |
155 ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY )
156 , ( SYN_GNU_REGEX_BV | ONIG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND )
157 , ( ONIG_OPTION_SINGLELINE | ONIG_OPTION_ASCII_RANGE |
158 ONIG_OPTION_WORD_BOUND_ALL_RANGE )
159 ,
160 {
161 (OnigCodePoint )'\\' /* esc */
162 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar '.' */
163 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anytime '*' */
164 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* zero or one time '?' */
165 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* one or more time '+' */
166 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar anytime */
167 }
168 };
169
170 /* Perl 5.8 */
171 const OnigSyntaxType OnigSyntaxPerl58 = {
172 (( SYN_GNU_REGEX_OP | ONIG_SYN_OP_QMARK_NON_GREEDY |
173 ONIG_SYN_OP_ESC_OCTAL3 | ONIG_SYN_OP_ESC_X_HEX2 |
174 ONIG_SYN_OP_ESC_X_BRACE_HEX8 | ONIG_SYN_OP_ESC_CONTROL_CHARS |
175 ONIG_SYN_OP_ESC_C_CONTROL )
176 & ~ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END )
177 , ( ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE |
178 ONIG_SYN_OP2_QMARK_GROUP_EFFECT | ONIG_SYN_OP2_OPTION_PERL |
179 ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY |
180 ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT |
181 ONIG_SYN_OP2_ESC_CAPITAL_X_EXTENDED_GRAPHEME_CLUSTER |
182 ONIG_SYN_OP2_QMARK_LPAREN_CONDITION)
183 , SYN_GNU_REGEX_BV
184 , ONIG_OPTION_SINGLELINE
185 ,
186 {
187 (OnigCodePoint )'\\' /* esc */
188 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar '.' */
189 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anytime '*' */
190 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* zero or one time '?' */
191 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* one or more time '+' */
192 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar anytime */
193 }
194 };
195
196 /* Perl 5.8 + named group */
197 const OnigSyntaxType OnigSyntaxPerl58_NG = {
198 (( SYN_GNU_REGEX_OP | ONIG_SYN_OP_QMARK_NON_GREEDY |
199 ONIG_SYN_OP_ESC_OCTAL3 | ONIG_SYN_OP_ESC_X_HEX2 |
200 ONIG_SYN_OP_ESC_X_BRACE_HEX8 | ONIG_SYN_OP_ESC_CONTROL_CHARS |
201 ONIG_SYN_OP_ESC_C_CONTROL )
202 & ~ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END )
203 , ( ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE |
204 ONIG_SYN_OP2_QMARK_GROUP_EFFECT | ONIG_SYN_OP2_OPTION_PERL |
205 ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY |
206 ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT |
207 ONIG_SYN_OP2_ESC_CAPITAL_X_EXTENDED_GRAPHEME_CLUSTER |
208 ONIG_SYN_OP2_QMARK_LPAREN_CONDITION |
209 ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP |
210 ONIG_SYN_OP2_ESC_K_NAMED_BACKREF |
211 ONIG_SYN_OP2_ESC_G_SUBEXP_CALL )
212 , ( SYN_GNU_REGEX_BV |
213 ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP |
214 ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME )
215 , ONIG_OPTION_SINGLELINE
216 ,
217 {
218 (OnigCodePoint )'\\' /* esc */
219 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar '.' */
220 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anytime '*' */
221 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* zero or one time '?' */
222 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* one or more time '+' */
223 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar anytime */
224 }
225 };
226
227 /* Perl 5.10+ */
228 const OnigSyntaxType OnigSyntaxPerl = {
229 (( SYN_GNU_REGEX_OP | ONIG_SYN_OP_QMARK_NON_GREEDY |
230 ONIG_SYN_OP_ESC_OCTAL3 | ONIG_SYN_OP_ESC_X_HEX2 |
231 ONIG_SYN_OP_ESC_X_BRACE_HEX8 | ONIG_SYN_OP_ESC_CONTROL_CHARS |
232 ONIG_SYN_OP_ESC_O_BRACE_OCTAL | ONIG_SYN_OP_ESC_C_CONTROL )
233 & ~ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END )
234 , ( ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE |
235 ONIG_SYN_OP2_QMARK_GROUP_EFFECT | ONIG_SYN_OP2_OPTION_PERL |
236 ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY |
237 ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT |
238 ONIG_SYN_OP2_ESC_CAPITAL_X_EXTENDED_GRAPHEME_CLUSTER |
239 ONIG_SYN_OP2_QMARK_LPAREN_CONDITION |
240 ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT |
241 ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL |
242 ONIG_SYN_OP2_ESC_CAPITAL_R_LINEBREAK |
243 ONIG_SYN_OP2_ESC_CAPITAL_K_KEEP |
244 ONIG_SYN_OP2_QMARK_SUBEXP_CALL |
245 ONIG_SYN_OP2_ESC_G_BRACE_BACKREF |
246 ONIG_SYN_OP2_QMARK_CAPITAL_P_NAMED_GROUP |
247 ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP |
248 ONIG_SYN_OP2_ESC_K_NAMED_BACKREF )
249 , ( SYN_GNU_REGEX_BV |
250 ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME |
251 ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME_CALL |
252 ONIG_SYN_USE_LEFT_MOST_NAMED_GROUP )
253 , ( ONIG_OPTION_SINGLELINE | ONIG_OPTION_CAPTURE_GROUP )
254 ,
255 {
256 (OnigCodePoint )'\\' /* esc */
257 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar '.' */
258 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anytime '*' */
259 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* zero or one time '?' */
260 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* one or more time '+' */
261 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar anytime */
262 }
263 };
264
265 const OnigSyntaxType OnigSyntaxPython = {
266 (( SYN_GNU_REGEX_OP | ONIG_SYN_OP_QMARK_NON_GREEDY |
267 ONIG_SYN_OP_ESC_OCTAL3 | ONIG_SYN_OP_ESC_X_HEX2 |
268 ONIG_SYN_OP_ESC_X_BRACE_HEX8 | ONIG_SYN_OP_ESC_CONTROL_CHARS |
269 ONIG_SYN_OP_ESC_C_CONTROL )
270 & ~ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END )
271 , ( ONIG_SYN_OP2_QMARK_GROUP_EFFECT | ONIG_SYN_OP2_OPTION_PERL |
272 ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY |
273 ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT |
274 ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT |
275 ONIG_SYN_OP2_ESC_V_VTAB |
276 ONIG_SYN_OP2_ESC_U_HEX4 |
277 ONIG_SYN_OP2_QMARK_LPAREN_CONDITION |
278 ONIG_SYN_OP2_QMARK_CAPITAL_P_NAMED_GROUP )
279 , ( SYN_GNU_REGEX_BV |
280 ONIG_SYN_ALLOW_INTERVAL_LOW_ABBREV )
281 , ( ONIG_OPTION_SINGLELINE | ONIG_OPTION_ASCII_RANGE )
282 ,
283 {
284 (OnigCodePoint )'\\' /* esc */
285 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar '.' */
286 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anytime '*' */
287 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* zero or one time '?' */
288 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* one or more time '+' */
289 , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar anytime */
290 }
291 };
292
293
294
295 extern int
296 onig_set_default_syntax(const OnigSyntaxType* syntax)
297 {
298 if (IS_NULL(syntax))
299 syntax = ONIG_SYNTAX_RUBY;
300
301 OnigDefaultSyntax = syntax;
302 return 0;
303 }
304
305 extern void
306 onig_copy_syntax(OnigSyntaxType* to, const OnigSyntaxType* from)
307 {
308 *to = *from;
309 }
310
311 extern void
312 onig_set_syntax_op(OnigSyntaxType* syntax, unsigned int op)
313 {
314 syntax->op = op;
315 }
316
317 extern void
318 onig_set_syntax_op2(OnigSyntaxType* syntax, unsigned int op2)
319 {
320 syntax->op2 = op2;
321 }
322
323 extern void
324 onig_set_syntax_behavior(OnigSyntaxType* syntax, unsigned int behavior)
325 {
326 syntax->behavior = behavior;
327 }
328
329 extern void
330 onig_set_syntax_options(OnigSyntaxType* syntax, OnigOptionType options)
331 {
332 syntax->options = options;
333 }
334
335 extern unsigned int
336 onig_get_syntax_op(const OnigSyntaxType* syntax)
337 {
338 return syntax->op;
339 }
340
341 extern unsigned int
342 onig_get_syntax_op2(const OnigSyntaxType* syntax)
343 {
344 return syntax->op2;
345 }
346
347 extern unsigned int
348 onig_get_syntax_behavior(const OnigSyntaxType* syntax)
349 {
350 return syntax->behavior;
351 }
352
353 extern OnigOptionType
354 onig_get_syntax_options(const OnigSyntaxType* syntax)
355 {
356 return syntax->options;
357 }
358
359 #ifdef USE_VARIABLE_META_CHARS
360 extern int onig_set_meta_char(OnigSyntaxType* enc,
361 unsigned int what, OnigCodePoint code)
362 {
363 switch (what) {
364 case ONIG_META_CHAR_ESCAPE:
365 enc->meta_char_table.esc = code;
366 break;
367 case ONIG_META_CHAR_ANYCHAR:
368 enc->meta_char_table.anychar = code;
369 break;
370 case ONIG_META_CHAR_ANYTIME:
371 enc->meta_char_table.anytime = code;
372 break;
373 case ONIG_META_CHAR_ZERO_OR_ONE_TIME:
374 enc->meta_char_table.zero_or_one_time = code;
375 break;
376 case ONIG_META_CHAR_ONE_OR_MORE_TIME:
377 enc->meta_char_table.one_or_more_time = code;
378 break;
379 case ONIG_META_CHAR_ANYCHAR_ANYTIME:
380 enc->meta_char_table.anychar_anytime = code;
381 break;
382 default:
383 return ONIGERR_INVALID_ARGUMENT;
384 break;
385 }
386 return 0;
387 }
388 #endif /* USE_VARIABLE_META_CHARS */
ONIG_SYN_OP2_OPTION_PERL
#define ONIG_SYN_OP2_OPTION_PERL
Definition: onigmo.h:554
ONIG_SYN_OP_ESC_LPAREN_SUBEXP
#define ONIG_SYN_OP_ESC_LPAREN_SUBEXP
Definition: onigmo.h:532
ONIG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC
#define ONIG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC
Definition: onigmo.h:602
onig_set_syntax_op2
void onig_set_syntax_op2(OnigSyntaxType *syntax, unsigned int op2)
Definition: regsyntax.c:318
ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP
#define ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP
Definition: onigmo.h:559
ONIGERR_INVALID_ARGUMENT
#define ONIGERR_INVALID_ARGUMENT
Definition: onigmo.h:640
OnigSyntaxJava
const OnigSyntaxType OnigSyntaxJava
Definition: regsyntax.c:146
ONIG_OPTION_NONE
#define ONIG_OPTION_NONE
Definition: onigmo.h:450
ONIG_SYN_OP2_CCLASS_SET_OP
#define ONIG_SYN_OP2_CCLASS_SET_OP
Definition: onigmo.h:558
ONIG_SYN_OP_ESC_BRACE_INTERVAL
#define ONIG_SYN_OP_ESC_BRACE_INTERVAL
Definition: onigmo.h:528
ONIG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP
#define ONIG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP
Definition: onigmo.h:590
OnigSyntaxGnuRegex
const OnigSyntaxType OnigSyntaxGnuRegex
Definition: regsyntax.c:130
ONIG_SYN_ALLOW_INTERVAL_LOW_ABBREV
#define ONIG_SYN_ALLOW_INTERVAL_LOW_ABBREV
Definition: onigmo.h:592
OnigSyntaxEmacs
const OnigSyntaxType OnigSyntaxEmacs
Definition: regsyntax.c:87
ONIG_SYN_OP_ESC_X_HEX2
#define ONIG_SYN_OP_ESC_X_HEX2
Definition: onigmo.h:548
OnigMetaCharTableType::anychar
OnigCodePoint anychar
Definition: onigmo.h:151
OnigSyntaxPerl58
const OnigSyntaxType OnigSyntaxPerl58
Definition: regsyntax.c:171
ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY
#define ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY
Definition: onigmo.h:568
OnigMetaCharTableType::one_or_more_time
OnigCodePoint one_or_more_time
Definition: onigmo.h:154
OnigCodePoint
unsigned int OnigCodePoint
Definition: onigmo.h:80
ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP
#define ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP
Definition: onigmo.h:595
onig_get_syntax_options
OnigOptionType onig_get_syntax_options(const OnigSyntaxType *syntax)
Definition: regsyntax.c:354
ONIG_SYN_OP_LPAREN_SUBEXP
#define ONIG_SYN_OP_LPAREN_SUBEXP
Definition: onigmo.h:531
ONIG_SYN_OP2_ESC_CAPITAL_X_EXTENDED_GRAPHEME_CLUSTER
#define ONIG_SYN_OP2_ESC_CAPITAL_X_EXTENDED_GRAPHEME_CLUSTER
Definition: onigmo.h:574
onig_get_syntax_op
unsigned int onig_get_syntax_op(const OnigSyntaxType *syntax)
Definition: regsyntax.c:336
ONIG_META_CHAR_ANYCHAR
#define ONIG_META_CHAR_ANYCHAR
Definition: onigmo.h:613
ONIG_SYN_CONTEXT_INDEP_ANCHORS
#define ONIG_SYN_CONTEXT_INDEP_ANCHORS
Definition: onigmo.h:587
ONIG_SYN_OP_QMARK_NON_GREEDY
#define ONIG_SYN_OP_QMARK_NON_GREEDY
Definition: onigmo.h:544
ONIG_SYN_OP_QMARK_ZERO_ONE
#define ONIG_SYN_OP_QMARK_ZERO_ONE
Definition: onigmo.h:525
ONIG_SYN_OP2_QMARK_GROUP_EFFECT
#define ONIG_SYN_OP2_QMARK_GROUP_EFFECT
Definition: onigmo.h:553
ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC
#define ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC
Definition: onigmo.h:604
OnigSyntaxType::meta_char_table
OnigMetaCharTableType meta_char_table
Definition: onigmo.h:484
ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME
#define ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME
Definition: onigmo.h:596
OnigMetaCharTableType::esc
OnigCodePoint esc
Definition: onigmo.h:150
OnigSyntaxPosixExtended
const OnigSyntaxType OnigSyntaxPosixExtended
Definition: regsyntax.c:66
ONIG_SYN_OP2_QMARK_SUBEXP_CALL
#define ONIG_SYN_OP2_QMARK_SUBEXP_CALL
Definition: onigmo.h:579
OnigSyntaxType::op2
unsigned int op2
Definition: onigmo.h:481
ONIG_SYN_OP_ESC_B_WORD_BOUND
#define ONIG_SYN_OP_ESC_B_WORD_BOUND
Definition: onigmo.h:539
ONIG_SYNTAX_RUBY
#define ONIG_SYNTAX_RUBY
Definition: onigmo.h:511
ONIG_SYN_OP_ESC_VBAR_ALT
#define ONIG_SYN_OP_ESC_VBAR_ALT
Definition: onigmo.h:530
OnigSyntaxType
Definition: onigmo.h:479
ONIG_SYN_OP_DOT_ANYCHAR
#define ONIG_SYN_OP_DOT_ANYCHAR
Definition: onigmo.h:520
ONIG_SYN_OP_ESC_CONTROL_CHARS
#define ONIG_SYN_OP_ESC_CONTROL_CHARS
Definition: onigmo.h:545
ONIG_SYN_OP2_ESC_GNU_BUF_ANCHOR
#define ONIG_SYN_OP2_ESC_GNU_BUF_ANCHOR
Definition: onigmo.h:567
SYN_GNU_REGEX_BV
#define SYN_GNU_REGEX_BV
Definition: regint.h:780
ONIG_SYN_OP2_ESC_G_SUBEXP_CALL
#define ONIG_SYN_OP2_ESC_G_SUBEXP_CALL
Definition: onigmo.h:561
OnigMetaCharTableType::anychar_anytime
OnigCodePoint anychar_anytime
Definition: onigmo.h:155
ONIG_SYN_OP2_ESC_K_NAMED_BACKREF
#define ONIG_SYN_OP2_ESC_K_NAMED_BACKREF
Definition: onigmo.h:560
ONIG_SYN_OP_LINE_ANCHOR
#define ONIG_SYN_OP_LINE_ANCHOR
Definition: onigmo.h:542
ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME_CALL
#define ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME_CALL
Definition: onigmo.h:598
ONIG_META_CHAR_ONE_OR_MORE_TIME
#define ONIG_META_CHAR_ONE_OR_MORE_TIME
Definition: onigmo.h:616
ONIG_SYN_OP_ESC_OCTAL3
#define ONIG_SYN_OP_ESC_OCTAL3
Definition: onigmo.h:547
OnigSyntaxPerl
const OnigSyntaxType OnigSyntaxPerl
Definition: regsyntax.c:228
ONIG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND
#define ONIG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND
Definition: onigmo.h:594
ONIG_OPTION_MULTILINE
#define ONIG_OPTION_MULTILINE
Definition: onigmo.h:453
ONIG_META_CHAR_ZERO_OR_ONE_TIME
#define ONIG_META_CHAR_ZERO_OR_ONE_TIME
Definition: onigmo.h:615
OnigOptionType
unsigned int OnigOptionType
Definition: onigmo.h:445
ONIG_SYN_OP2_QMARK_CAPITAL_P_NAMED_GROUP
#define ONIG_SYN_OP2_QMARK_CAPITAL_P_NAMED_GROUP
Definition: onigmo.h:582
ONIG_SYN_OP2_ESC_CAPITAL_K_KEEP
#define ONIG_SYN_OP2_ESC_CAPITAL_K_KEEP
Definition: onigmo.h:577
ONIG_INEFFECTIVE_META_CHAR
#define ONIG_INEFFECTIVE_META_CHAR
Definition: onigmo.h:619
OnigSyntaxGrep
const OnigSyntaxType OnigSyntaxGrep
Definition: regsyntax.c:108
ONIG_OPTION_ASCII_RANGE
#define ONIG_OPTION_ASCII_RANGE
Definition: onigmo.h:467
ONIG_OPTION_WORD_BOUND_ALL_RANGE
#define ONIG_OPTION_WORD_BOUND_ALL_RANGE
Definition: onigmo.h:469
ONIG_SYN_OP_DECIMAL_BACKREF
#define ONIG_SYN_OP_DECIMAL_BACKREF
Definition: onigmo.h:535
ONIG_SYN_OP_PLUS_ONE_INF
#define ONIG_SYN_OP_PLUS_ONE_INF
Definition: onigmo.h:523
OnigSyntaxPerl58_NG
const OnigSyntaxType OnigSyntaxPerl58_NG
Definition: regsyntax.c:197
OnigSyntaxType::op
unsigned int op
Definition: onigmo.h:480
ONIG_SYN_OP_POSIX_BRACKET
#define ONIG_SYN_OP_POSIX_BRACKET
Definition: onigmo.h:543
OnigSyntaxType::options
OnigOptionType options
Definition: onigmo.h:483
ONIG_SYN_OP_ESC_C_CONTROL
#define ONIG_SYN_OP_ESC_C_CONTROL
Definition: onigmo.h:546
OnigMetaCharTableType::zero_or_one_time
OnigCodePoint zero_or_one_time
Definition: onigmo.h:153
onig_set_syntax_options
void onig_set_syntax_options(OnigSyntaxType *syntax, OnigOptionType options)
Definition: regsyntax.c:330
onig_copy_syntax
void onig_copy_syntax(OnigSyntaxType *to, const OnigSyntaxType *from)
Definition: regsyntax.c:306
onig_get_syntax_behavior
unsigned int onig_get_syntax_behavior(const OnigSyntaxType *syntax)
Definition: regsyntax.c:348
ONIG_SYN_OP_ESC_W_WORD
#define ONIG_SYN_OP_ESC_W_WORD
Definition: onigmo.h:537
ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT
#define ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT
Definition: onigmo.h:569
ONIG_META_CHAR_ESCAPE
#define ONIG_META_CHAR_ESCAPE
Definition: onigmo.h:612
OnigSyntaxPosixBasic
const OnigSyntaxType OnigSyntaxPosixBasic
Definition: regsyntax.c:49
ONIG_SYN_OP_BRACE_INTERVAL
#define ONIG_SYN_OP_BRACE_INTERVAL
Definition: onigmo.h:527
OnigSyntaxASIS
const OnigSyntaxType OnigSyntaxASIS
Definition: regsyntax.c:33
regint.h
ONIG_SYN_OP_BRACKET_CC
#define ONIG_SYN_OP_BRACKET_CC
Definition: onigmo.h:536
onig_set_meta_char
int onig_set_meta_char(OnigSyntaxType *enc, unsigned int what, OnigCodePoint code)
Definition: regsyntax.c:360
ONIG_SYN_OP_VBAR_ALT
#define ONIG_SYN_OP_VBAR_ALT
Definition: onigmo.h:529
ONIG_SYN_OP_ESC_O_BRACE_OCTAL
#define ONIG_SYN_OP_ESC_O_BRACE_OCTAL
Definition: onigmo.h:550
ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END
#define ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END
Definition: onigmo.h:538
ONIG_SYN_OP2_ESC_CAPITAL_R_LINEBREAK
#define ONIG_SYN_OP2_ESC_CAPITAL_R_LINEBREAK
Definition: onigmo.h:573
onig_set_default_syntax
int onig_set_default_syntax(const OnigSyntaxType *syntax)
Definition: regsyntax.c:296
OnigSyntaxType::behavior
unsigned int behavior
Definition: onigmo.h:482
ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS
#define ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS
Definition: onigmo.h:588
ONIG_SYN_OP_ESC_X_BRACE_HEX8
#define ONIG_SYN_OP_ESC_X_BRACE_HEX8
Definition: onigmo.h:549
ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE
#define ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE
Definition: onigmo.h:552
SYN_GNU_REGEX_OP
#define SYN_GNU_REGEX_OP
Definition: regint.h:767
ONIG_SYN_OP_ESC_PLUS_ONE_INF
#define ONIG_SYN_OP_ESC_PLUS_ONE_INF
Definition: onigmo.h:524
ONIG_SYN_OP_ASTERISK_ZERO_INF
#define ONIG_SYN_OP_ASTERISK_ZERO_INF
Definition: onigmo.h:521
onig_set_syntax_op
void onig_set_syntax_op(OnigSyntaxType *syntax, unsigned int op)
Definition: regsyntax.c:312
ONIG_SYN_OP2_INEFFECTIVE_ESCAPE
#define ONIG_SYN_OP2_INEFFECTIVE_ESCAPE
Definition: onigmo.h:572
ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS
#define ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS
Definition: onigmo.h:589
ONIG_OPTION_SINGLELINE
#define ONIG_OPTION_SINGLELINE
Definition: onigmo.h:455
ONIG_SYN_OP2_ESC_G_BRACE_BACKREF
#define ONIG_SYN_OP2_ESC_G_BRACE_BACKREF
Definition: onigmo.h:578
ONIG_SYN_OP2_ESC_V_VTAB
#define ONIG_SYN_OP2_ESC_V_VTAB
Definition: onigmo.h:565
ONIG_META_CHAR_ANYTIME
#define ONIG_META_CHAR_ANYTIME
Definition: onigmo.h:614
ONIG_SYN_OP2_QMARK_LPAREN_CONDITION
#define ONIG_SYN_OP2_QMARK_LPAREN_CONDITION
Definition: onigmo.h:581
SYN_POSIX_COMMON_OP
#define SYN_POSIX_COMMON_OP
Definition: regint.h:760
ONIG_OPTION_CAPTURE_GROUP
#define ONIG_OPTION_CAPTURE_GROUP
Definition: onigmo.h:460
ONIG_SYN_OP_ESC_QMARK_ZERO_ONE
#define ONIG_SYN_OP_ESC_QMARK_ZERO_ONE
Definition: onigmo.h:526
ONIG_META_CHAR_ANYCHAR_ANYTIME
#define ONIG_META_CHAR_ANYCHAR_ANYTIME
Definition: onigmo.h:617
OnigMetaCharTableType::anytime
OnigCodePoint anytime
Definition: onigmo.h:152
ONIG_SYN_USE_LEFT_MOST_NAMED_GROUP
#define ONIG_SYN_USE_LEFT_MOST_NAMED_GROUP
Definition: onigmo.h:599
onig_set_syntax_behavior
void onig_set_syntax_behavior(OnigSyntaxType *syntax, unsigned int behavior)
Definition: regsyntax.c:324
ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL
#define ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL
Definition: onigmo.h:557
IS_NULL
#define IS_NULL(p)
Definition: regint.h:298
onig_get_syntax_op2
unsigned int onig_get_syntax_op2(const OnigSyntaxType *syntax)
Definition: regsyntax.c:342
ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT
#define ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT
Definition: onigmo.h:556
ONIG_SYN_OP2_ESC_U_HEX4
#define ONIG_SYN_OP2_ESC_U_HEX4
Definition: onigmo.h:566
ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC
#define ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC
Definition: onigmo.h:605
OnigDefaultSyntax
const ONIG_EXTERN OnigSyntaxType * OnigDefaultSyntax
Definition: onigmo.h:515
OnigSyntaxPython
const OnigSyntaxType OnigSyntaxPython
Definition: regsyntax.c:265