44#if defined(ONIG_DEBUG_PARSE_TREE) || defined(ONIG_DEBUG_MATCH) || \
45 defined(ONIG_DEBUG_SEARCH) || defined(ONIG_DEBUG_COMPILE) || \
46 defined(ONIG_DEBUG_STATISTICS) || defined(ONIG_DEBUG_MEMLEAK)
52#ifndef UNALIGNED_WORD_ACCESS
53# if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
54 defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || \
55 defined(__powerpc64__) || defined(__aarch64__) || \
57# define UNALIGNED_WORD_ACCESS 1
59# define UNALIGNED_WORD_ACCESS 0
63#if UNALIGNED_WORD_ACCESS
64# define PLATFORM_UNALIGNED_WORD_ACCESS
69#define USE_NAMED_GROUP
70#define USE_SUBEXP_CALL
71#define USE_PERL_SUBEXP_CALL
72#define USE_CAPITAL_P_NAMED_GROUP
73#define USE_BACKREF_WITH_LEVEL
74#define USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT
75#define USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE
76#define USE_WARNING_REDUNDANT_NESTED_REPEAT_OPERATOR
78#define USE_NO_INVALID_QUANTIFIER
82#define USE_QTFR_PEEK_NEXT
84#define USE_SUNDAY_QUICK_SEARCH
86#define INIT_MATCH_STACK_SIZE 160
87#define DEFAULT_MATCH_STACK_LIMIT_SIZE 0
88#define DEFAULT_PARSE_DEPTH_LIMIT 4096
90#define OPT_EXACT_MAXLEN 24
93#if defined(USE_PERL_SUBEXP_CALL) || defined(USE_CAPITAL_P_NAMED_GROUP)
94# if !defined(USE_NAMED_GROUP) || !defined(USE_SUBEXP_CALL)
95# error USE_NAMED_GROUP and USE_SUBEXP_CALL must be defined.
100# define ARG_UNUSED __attribute__ ((unused))
105#if !defined(RUBY) && defined(RUBY_EXPORT)
109# ifndef RUBY_DEFINES_H
118# if SIZEOF_LONG_LONG > 0
119# define LONG_LONG long long
127#ifdef ONIG_ESCAPE_UCHAR_COLLISION
128# undef ONIG_ESCAPE_UCHAR_COLLISION
131#define USE_WORD_BEGIN_END
133# undef USE_CAPTURE_HISTORY
135# define USE_CAPTURE_HISTORY
137#define USE_VARIABLE_META_CHARS
138#define USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE
143# define xmalloc malloc
144# define xrealloc realloc
145# define xcalloc calloc
151# define CHECK_INTERRUPT_IN_MATCH_AT rb_thread_check_ints()
152# define onig_st_init_table st_init_table
153# define onig_st_init_table_with_size st_init_table_with_size
154# define onig_st_init_numtable st_init_numtable
155# define onig_st_init_numtable_with_size st_init_numtable_with_size
156# define onig_st_init_strtable st_init_strtable
157# define onig_st_init_strtable_with_size st_init_strtable_with_size
158# define onig_st_delete st_delete
159# define onig_st_delete_safe st_delete_safe
160# define onig_st_insert st_insert
161# define onig_st_lookup st_lookup
162# define onig_st_foreach st_foreach
163# define onig_st_add_direct st_add_direct
164# define onig_st_free_table st_free_table
165# define onig_st_cleanup_safe st_cleanup_safe
166# define onig_st_copy st_copy
167# define onig_st_nothing_key_clone st_nothing_key_clone
168# define onig_st_nothing_key_free st_nothing_key_free
169# define onig_st_is_member st_is_member
171# define USE_UPPER_CASE_TABLE
174# define CHECK_INTERRUPT_IN_MATCH_AT
176# define st_init_table onig_st_init_table
177# define st_init_table_with_size onig_st_init_table_with_size
178# define st_init_numtable onig_st_init_numtable
179# define st_init_numtable_with_size onig_st_init_numtable_with_size
180# define st_init_strtable onig_st_init_strtable
181# define st_init_strtable_with_size onig_st_init_strtable_with_size
182# define st_delete onig_st_delete
183# define st_delete_safe onig_st_delete_safe
184# define st_insert onig_st_insert
185# define st_lookup onig_st_lookup
186# define st_foreach onig_st_foreach
187# define st_add_direct onig_st_add_direct
188# define st_free_table onig_st_free_table
189# define st_cleanup_safe onig_st_cleanup_safe
190# define st_copy onig_st_copy
191# define st_nothing_key_clone onig_st_nothing_key_clone
192# define st_nothing_key_free onig_st_nothing_key_free
194# define onig_st_is_member st_is_member
198#define STATE_CHECK_STRING_THRESHOLD_LEN 7
199#define STATE_CHECK_BUFF_MAX_SIZE 0x4000
201#define xmemset memset
202#define xmemcpy memcpy
203#define xmemmove memmove
205#if ((defined(RUBY_MSVCRT_VERSION) && RUBY_MSVCRT_VERSION >= 90) \
206 || (!defined(RUBY_MSVCRT_VERSION) && defined(_WIN32))) \
207 && !defined(__GNUC__)
208# define xalloca _alloca
209# define xvsnprintf(buf,size,fmt,args) _vsnprintf_s(buf,size,_TRUNCATE,fmt,args)
210# define xsnprintf sprintf_s
211# define xstrcat(dest,src,size) strcat_s(dest,size,src)
213# define xalloca alloca
214# define xvsnprintf vsnprintf
215# define xsnprintf snprintf
216# define xstrcat(dest,src,size) strcat(dest,src)
219#if defined(ONIG_DEBUG_MEMLEAK) && defined(_MSC_VER)
220# define _CRTDBG_MAP_ALLOC
227#if defined(HAVE_ALLOCA_H) && (defined(_AIX) || !defined(__GNUC__))
234#ifdef HAVE_SYS_TYPES_H
235# include <sys/types.h>
242#ifdef HAVE_INTTYPES_H
243# include <inttypes.h>
257# if defined(_MSC_VER) && (_MSC_VER < 1300)
258# ifndef _INTPTR_T_DEFINED
259# define _INTPTR_T_DEFINED
262# ifndef _UINTPTR_T_DEFINED
263# define _UINTPTR_T_DEFINED
271# define PRIdPTR "I64d"
272# define PRIuPTR "I64u"
273# define PRIxPTR "I64x"
282# define PRIdPTRDIFF PRIdPTR
295#define MIN(a,b) (((a)>(b))?(b):(a))
296#define MAX(a,b) (((a)<(b))?(b):(a))
298#define IS_NULL(p) (((void*)(p)) == (void*)0)
299#define IS_NOT_NULL(p) (((void*)(p)) != (void*)0)
300#define CHECK_NULL_RETURN(p) if (IS_NULL(p)) return NULL
301#define CHECK_NULL_RETURN_MEMERR(p) if (IS_NULL(p)) return ONIGERR_MEMORY
302#define NULL_UCHARP ((UChar* )0)
304#define ONIG_LAST_CODE_POINT (~((OnigCodePoint )0))
306#ifdef PLATFORM_UNALIGNED_WORD_ACCESS
308# define PLATFORM_GET_INC(val,p,type) do{\
310 (p) += sizeof(type);\
315# define PLATFORM_GET_INC(val,p,type) do{\
316 xmemcpy(&val, (p), sizeof(type));\
317 (p) += sizeof(type);\
321# define WORD_ALIGNMENT_SIZE SIZEOF_LONG
323# define GET_ALIGNMENT_PAD_SIZE(addr,pad_size) do {\
324 (pad_size) = WORD_ALIGNMENT_SIZE \
325 - ((uintptr_t )(addr) % WORD_ALIGNMENT_SIZE);\
326 if ((pad_size) == WORD_ALIGNMENT_SIZE) (pad_size) = 0;\
329# define ALIGNMENT_RIGHT(addr) do {\
330 (addr) += (WORD_ALIGNMENT_SIZE - 1);\
331 (addr) -= ((uintptr_t )(addr) % WORD_ALIGNMENT_SIZE);\
337#define STACK_POP_LEVEL_FREE 0
338#define STACK_POP_LEVEL_MEM_START 1
339#define STACK_POP_LEVEL_ALL 2
342#define ONIG_OPTIMIZE_NONE 0
343#define ONIG_OPTIMIZE_EXACT 1
344#define ONIG_OPTIMIZE_EXACT_BM 2
345#define ONIG_OPTIMIZE_EXACT_BM_NOT_REV 3
346#define ONIG_OPTIMIZE_EXACT_IC 4
347#define ONIG_OPTIMIZE_MAP 5
348#define ONIG_OPTIMIZE_EXACT_BM_IC 6
349#define ONIG_OPTIMIZE_EXACT_BM_NOT_REV_IC 7
354#define BIT_STATUS_BITS_NUM (sizeof(BitStatusType) * 8)
355#define BIT_STATUS_CLEAR(stats) (stats) = 0
356#define BIT_STATUS_ON_ALL(stats) (stats) = ~((BitStatusType )0)
357#define BIT_STATUS_AT(stats,n) \
358 ((n) < (int )BIT_STATUS_BITS_NUM ? ((stats) & ((BitStatusType )1 << n)) : ((stats) & 1))
360#define BIT_STATUS_ON_AT(stats,n) do {\
361 if ((n) < (int )BIT_STATUS_BITS_NUM)\
362 (stats) |= (1 << (n));\
367#define BIT_STATUS_ON_AT_SIMPLE(stats,n) do {\
368 if ((n) < (int )BIT_STATUS_BITS_NUM)\
369 (stats) |= (1 << (n));\
373#define INT_MAX_LIMIT ((1UL << (SIZEOF_INT * 8 - 1)) - 1)
375#define DIGITVAL(code) ((code) - '0')
376#define ODIGITVAL(code) DIGITVAL(code)
377#define XDIGITVAL(enc,code) \
378 (ONIGENC_IS_CODE_DIGIT(enc,code) ? DIGITVAL(code) \
379 : (ONIGENC_IS_CODE_UPPER(enc,code) ? (code) - 'A' + 10 : (code) - 'a' + 10))
381#define IS_SINGLELINE(option) ((option) & ONIG_OPTION_SINGLELINE)
382#define IS_MULTILINE(option) ((option) & ONIG_OPTION_MULTILINE)
383#define IS_IGNORECASE(option) ((option) & ONIG_OPTION_IGNORECASE)
384#define IS_EXTEND(option) ((option) & ONIG_OPTION_EXTEND)
385#define IS_FIND_LONGEST(option) ((option) & ONIG_OPTION_FIND_LONGEST)
386#define IS_FIND_NOT_EMPTY(option) ((option) & ONIG_OPTION_FIND_NOT_EMPTY)
387#define IS_FIND_CONDITION(option) ((option) & \
388 (ONIG_OPTION_FIND_LONGEST | ONIG_OPTION_FIND_NOT_EMPTY))
389#define IS_NOTBOL(option) ((option) & ONIG_OPTION_NOTBOL)
390#define IS_NOTEOL(option) ((option) & ONIG_OPTION_NOTEOL)
391#define IS_NOTBOS(option) ((option) & ONIG_OPTION_NOTBOS)
392#define IS_NOTEOS(option) ((option) & ONIG_OPTION_NOTEOS)
393#define IS_ASCII_RANGE(option) ((option) & ONIG_OPTION_ASCII_RANGE)
394#define IS_POSIX_BRACKET_ALL_RANGE(option) ((option) & ONIG_OPTION_POSIX_BRACKET_ALL_RANGE)
395#define IS_WORD_BOUND_ALL_RANGE(option) ((option) & ONIG_OPTION_WORD_BOUND_ALL_RANGE)
396#define IS_NEWLINE_CRLF(option) ((option) & ONIG_OPTION_NEWLINE_CRLF)
403#define IS_DYNAMIC_OPTION(option) 0
405#define DISABLE_CASE_FOLD_MULTI_CHAR(case_fold_flag) \
406 ((case_fold_flag) & ~INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR)
408#define REPEAT_INFINITE -1
409#define IS_REPEAT_INFINITE(n) ((n) == REPEAT_INFINITE)
412#define BITS_PER_BYTE 8
413#define SINGLE_BYTE_SIZE (1 << BITS_PER_BYTE)
414#define BITS_IN_ROOM ((int )sizeof(Bits) * BITS_PER_BYTE)
415#define BITSET_SIZE (SINGLE_BYTE_SIZE / BITS_IN_ROOM)
417#ifdef PLATFORM_UNALIGNED_WORD_ACCESS
418typedef unsigned int Bits;
425#define SIZE_BITSET (int )sizeof(BitSet)
427#define BITSET_CLEAR(bs) do {\
429 for (i = 0; i < BITSET_SIZE; i++) { (bs)[i] = 0; } \
432#define BS_ROOM(bs,pos) (bs)[(int )(pos) / BITS_IN_ROOM]
433#define BS_BIT(pos) (1U << ((int )(pos) % BITS_IN_ROOM))
435#define BITSET_AT(bs, pos) (BS_ROOM(bs,pos) & BS_BIT(pos))
436#define BITSET_SET_BIT(bs, pos) BS_ROOM(bs,pos) |= BS_BIT(pos)
437#define BITSET_CLEAR_BIT(bs, pos) BS_ROOM(bs,pos) &= ~(BS_BIT(pos))
438#define BITSET_INVERT_BIT(bs, pos) BS_ROOM(bs,pos) ^= BS_BIT(pos)
447#define BBUF_INIT(buf,size) onig_bbuf_init((BBuf* )(buf), (size))
449#define BBUF_SIZE_INC(buf,inc) do{\
451 (buf)->alloc += (inc);\
452 tmp = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
453 if (IS_NULL(tmp)) return(ONIGERR_MEMORY);\
457#define BBUF_EXPAND(buf,low) do{\
459 do { (buf)->alloc *= 2; } while ((buf)->alloc < (unsigned int )low);\
460 tmp = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
461 if (IS_NULL(tmp)) return(ONIGERR_MEMORY);\
465#define BBUF_ENSURE_SIZE(buf,size) do{\
466 unsigned int new_alloc = (buf)->alloc;\
467 while (new_alloc < (unsigned int )(size)) { new_alloc *= 2; }\
468 if ((buf)->alloc != new_alloc) {\
470 tmp = (UChar* )xrealloc((buf)->p, new_alloc);\
471 if (IS_NULL(tmp)) return(ONIGERR_MEMORY);\
473 (buf)->alloc = new_alloc;\
477#define BBUF_WRITE(buf,pos,bytes,n) do{\
478 int used = (pos) + (int )(n);\
479 if ((buf)->alloc < (unsigned int )used) BBUF_EXPAND((buf),used);\
480 xmemcpy((buf)->p + (pos), (bytes), (n));\
481 if ((buf)->used < (unsigned int )used) (buf)->used = used;\
484#define BBUF_WRITE1(buf,pos,byte) do{\
485 int used = (pos) + 1;\
486 if ((buf)->alloc < (unsigned int )used) BBUF_EXPAND((buf),used);\
487 (buf)->p[(pos)] = (UChar )(byte);\
488 if ((buf)->used < (unsigned int )used) (buf)->used = used;\
491#define BBUF_ADD(buf,bytes,n) BBUF_WRITE((buf),(buf)->used,(bytes),(n))
492#define BBUF_ADD1(buf,byte) BBUF_WRITE1((buf),(buf)->used,(byte))
493#define BBUF_GET_ADD_ADDRESS(buf) ((buf)->p + (buf)->used)
494#define BBUF_GET_OFFSET_POS(buf) ((buf)->used)
497#define BBUF_MOVE_RIGHT(buf,from,to,n) do {\
498 if ((unsigned int )((to)+(n)) > (buf)->alloc) BBUF_EXPAND((buf),(to) + (n));\
499 xmemmove((buf)->p + (to), (buf)->p + (from), (n));\
500 if ((unsigned int )((to)+(n)) > (buf)->used) (buf)->used = (to) + (n);\
504#define BBUF_MOVE_LEFT(buf,from,to,n) do {\
505 xmemmove((buf)->p + (to), (buf)->p + (from), (n));\
509#define BBUF_MOVE_LEFT_REDUCE(buf,from,to) do {\
510 xmemmove((buf)->p + (to), (buf)->p + (from), (buf)->used - (from));\
511 (buf)->used -= (from - to);\
514#define BBUF_INSERT(buf,pos,bytes,n) do {\
515 if (pos >= (buf)->used) {\
516 BBUF_WRITE(buf,pos,bytes,n);\
519 BBUF_MOVE_RIGHT((buf),(pos),(pos) + (n),((buf)->used - (pos)));\
520 xmemcpy((buf)->p + (pos), (bytes), (n));\
524#define BBUF_GET_BYTE(buf, pos) (buf)->p[(pos)]
527#define ANCHOR_BEGIN_BUF (1<<0)
528#define ANCHOR_BEGIN_LINE (1<<1)
529#define ANCHOR_BEGIN_POSITION (1<<2)
530#define ANCHOR_END_BUF (1<<3)
531#define ANCHOR_SEMI_END_BUF (1<<4)
532#define ANCHOR_END_LINE (1<<5)
534#define ANCHOR_WORD_BOUND (1<<6)
535#define ANCHOR_NOT_WORD_BOUND (1<<7)
536#define ANCHOR_WORD_BEGIN (1<<8)
537#define ANCHOR_WORD_END (1<<9)
538#define ANCHOR_PREC_READ (1<<10)
539#define ANCHOR_PREC_READ_NOT (1<<11)
540#define ANCHOR_LOOK_BEHIND (1<<12)
541#define ANCHOR_LOOK_BEHIND_NOT (1<<13)
543#define ANCHOR_ANYCHAR_STAR (1<<14)
544#define ANCHOR_ANYCHAR_STAR_ML (1<<15)
546#define ANCHOR_KEEP (1<<16)
676#define SIZE_RELADDR (int )sizeof(RelAddrType)
677#define SIZE_ABSADDR (int )sizeof(AbsAddrType)
678#define SIZE_LENGTH (int )sizeof(LengthType)
679#define SIZE_MEMNUM (int )sizeof(MemNumType)
680#define SIZE_STATE_CHECK_NUM (int )sizeof(StateCheckNumType)
681#define SIZE_REPEATNUM (int )sizeof(RepeatNumType)
682#define SIZE_OPTION (int )sizeof(OnigOptionType)
683#define SIZE_CODE_POINT (int )sizeof(OnigCodePoint)
684#define SIZE_POINTER (int )sizeof(PointerType)
687#define GET_RELADDR_INC(addr,p) PLATFORM_GET_INC(addr, p, RelAddrType)
688#define GET_ABSADDR_INC(addr,p) PLATFORM_GET_INC(addr, p, AbsAddrType)
689#define GET_LENGTH_INC(len,p) PLATFORM_GET_INC(len, p, LengthType)
690#define GET_MEMNUM_INC(num,p) PLATFORM_GET_INC(num, p, MemNumType)
691#define GET_REPEATNUM_INC(num,p) PLATFORM_GET_INC(num, p, RepeatNumType)
692#define GET_OPTION_INC(option,p) PLATFORM_GET_INC(option, p, OnigOptionType)
693#define GET_POINTER_INC(ptr,p) PLATFORM_GET_INC(ptr, p, PointerType)
694#define GET_STATE_CHECK_NUM_INC(num,p) PLATFORM_GET_INC(num, p, StateCheckNumType)
697#define GET_CODE_POINT(code,p) code = *((OnigCodePoint* )(p))
698#define GET_BYTE_INC(byte,p) do{\
705#define SIZE_OP_ANYCHAR_STAR SIZE_OPCODE
706#define SIZE_OP_ANYCHAR_STAR_PEEK_NEXT (SIZE_OPCODE + 1)
707#define SIZE_OP_JUMP (SIZE_OPCODE + SIZE_RELADDR)
708#define SIZE_OP_PUSH (SIZE_OPCODE + SIZE_RELADDR)
709#define SIZE_OP_POP SIZE_OPCODE
710#define SIZE_OP_PUSH_OR_JUMP_EXACT1 (SIZE_OPCODE + SIZE_RELADDR + 1)
711#define SIZE_OP_PUSH_IF_PEEK_NEXT (SIZE_OPCODE + SIZE_RELADDR + 1)
712#define SIZE_OP_REPEAT_INC (SIZE_OPCODE + SIZE_MEMNUM)
713#define SIZE_OP_REPEAT_INC_NG (SIZE_OPCODE + SIZE_MEMNUM)
714#define SIZE_OP_PUSH_POS SIZE_OPCODE
715#define SIZE_OP_PUSH_POS_NOT (SIZE_OPCODE + SIZE_RELADDR)
716#define SIZE_OP_POP_POS SIZE_OPCODE
717#define SIZE_OP_FAIL_POS SIZE_OPCODE
718#define SIZE_OP_SET_OPTION (SIZE_OPCODE + SIZE_OPTION)
719#define SIZE_OP_SET_OPTION_PUSH (SIZE_OPCODE + SIZE_OPTION)
720#define SIZE_OP_FAIL SIZE_OPCODE
721#define SIZE_OP_MEMORY_START (SIZE_OPCODE + SIZE_MEMNUM)
722#define SIZE_OP_MEMORY_START_PUSH (SIZE_OPCODE + SIZE_MEMNUM)
723#define SIZE_OP_MEMORY_END_PUSH (SIZE_OPCODE + SIZE_MEMNUM)
724#define SIZE_OP_MEMORY_END_PUSH_REC (SIZE_OPCODE + SIZE_MEMNUM)
725#define SIZE_OP_MEMORY_END (SIZE_OPCODE + SIZE_MEMNUM)
726#define SIZE_OP_MEMORY_END_REC (SIZE_OPCODE + SIZE_MEMNUM)
727#define SIZE_OP_PUSH_STOP_BT SIZE_OPCODE
728#define SIZE_OP_POP_STOP_BT SIZE_OPCODE
729#define SIZE_OP_NULL_CHECK_START (SIZE_OPCODE + SIZE_MEMNUM)
730#define SIZE_OP_NULL_CHECK_END (SIZE_OPCODE + SIZE_MEMNUM)
731#define SIZE_OP_LOOK_BEHIND (SIZE_OPCODE + SIZE_LENGTH)
732#define SIZE_OP_PUSH_LOOK_BEHIND_NOT (SIZE_OPCODE + SIZE_RELADDR + SIZE_LENGTH)
733#define SIZE_OP_FAIL_LOOK_BEHIND_NOT SIZE_OPCODE
734#define SIZE_OP_CALL (SIZE_OPCODE + SIZE_ABSADDR)
735#define SIZE_OP_RETURN SIZE_OPCODE
736#define SIZE_OP_CONDITION (SIZE_OPCODE + SIZE_MEMNUM + SIZE_RELADDR)
737#define SIZE_OP_PUSH_ABSENT_POS SIZE_OPCODE
738#define SIZE_OP_ABSENT (SIZE_OPCODE + SIZE_RELADDR)
739#define SIZE_OP_ABSENT_END SIZE_OPCODE
741#ifdef USE_COMBINATION_EXPLOSION_CHECK
742# define SIZE_OP_STATE_CHECK (SIZE_OPCODE + SIZE_STATE_CHECK_NUM)
743# define SIZE_OP_STATE_CHECK_PUSH (SIZE_OPCODE + SIZE_STATE_CHECK_NUM + SIZE_RELADDR)
744# define SIZE_OP_STATE_CHECK_PUSH_OR_JUMP (SIZE_OPCODE + SIZE_STATE_CHECK_NUM + SIZE_RELADDR)
745# define SIZE_OP_STATE_CHECK_ANYCHAR_STAR (SIZE_OPCODE + SIZE_STATE_CHECK_NUM)
748#define MC_ESC(syn) (syn)->meta_char_table.esc
749#define MC_ANYCHAR(syn) (syn)->meta_char_table.anychar
750#define MC_ANYTIME(syn) (syn)->meta_char_table.anytime
751#define MC_ZERO_OR_ONE_TIME(syn) (syn)->meta_char_table.zero_or_one_time
752#define MC_ONE_OR_MORE_TIME(syn) (syn)->meta_char_table.one_or_more_time
753#define MC_ANYCHAR_ANYTIME(syn) (syn)->meta_char_table.anychar_anytime
755#define IS_MC_ESC_CODE(code, syn) \
756 ((code) == MC_ESC(syn) && \
757 !IS_SYNTAX_OP2((syn), ONIG_SYN_OP2_INEFFECTIVE_ESCAPE))
760#define SYN_POSIX_COMMON_OP \
761 ( ONIG_SYN_OP_DOT_ANYCHAR | ONIG_SYN_OP_POSIX_BRACKET | \
762 ONIG_SYN_OP_DECIMAL_BACKREF | \
763 ONIG_SYN_OP_BRACKET_CC | ONIG_SYN_OP_ASTERISK_ZERO_INF | \
764 ONIG_SYN_OP_LINE_ANCHOR | \
765 ONIG_SYN_OP_ESC_CONTROL_CHARS )
767#define SYN_GNU_REGEX_OP \
768 ( ONIG_SYN_OP_DOT_ANYCHAR | ONIG_SYN_OP_BRACKET_CC | \
769 ONIG_SYN_OP_POSIX_BRACKET | ONIG_SYN_OP_DECIMAL_BACKREF | \
770 ONIG_SYN_OP_BRACE_INTERVAL | ONIG_SYN_OP_LPAREN_SUBEXP | \
771 ONIG_SYN_OP_VBAR_ALT | \
772 ONIG_SYN_OP_ASTERISK_ZERO_INF | ONIG_SYN_OP_PLUS_ONE_INF | \
773 ONIG_SYN_OP_QMARK_ZERO_ONE | \
774 ONIG_SYN_OP_ESC_AZ_BUF_ANCHOR | ONIG_SYN_OP_ESC_CAPITAL_G_BEGIN_ANCHOR | \
775 ONIG_SYN_OP_ESC_W_WORD | \
776 ONIG_SYN_OP_ESC_B_WORD_BOUND | ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END | \
777 ONIG_SYN_OP_ESC_S_WHITE_SPACE | ONIG_SYN_OP_ESC_D_DIGIT | \
778 ONIG_SYN_OP_LINE_ANCHOR )
780#define SYN_GNU_REGEX_BV \
781 ( ONIG_SYN_CONTEXT_INDEP_ANCHORS | ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS | \
782 ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS | ONIG_SYN_ALLOW_INVALID_INTERVAL | \
783 ONIG_SYN_BACKSLASH_ESCAPE_IN_CC | ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC )
786#define NCCLASS_FLAGS(cc) ((cc)->flags)
787#define NCCLASS_FLAG_SET(cc,flag) (NCCLASS_FLAGS(cc) |= (flag))
788#define NCCLASS_FLAG_CLEAR(cc,flag) (NCCLASS_FLAGS(cc) &= ~(flag))
789#define IS_NCCLASS_FLAG_ON(cc,flag) ((NCCLASS_FLAGS(cc) & (flag)) != 0)
792#define FLAG_NCCLASS_NOT (1<<0)
794#define NCCLASS_SET_NOT(nd) NCCLASS_FLAG_SET(nd, FLAG_NCCLASS_NOT)
795#define NCCLASS_CLEAR_NOT(nd) NCCLASS_FLAG_CLEAR(nd, FLAG_NCCLASS_NOT)
796#define IS_NCCLASS_NOT(nd) IS_NCCLASS_FLAG_ON(nd, FLAG_NCCLASS_NOT)
820#ifdef USE_COMBINATION_EXPLOSION_CHECK
821 unsigned int state_check;
844#ifdef USE_SUBEXP_CALL
865#ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE
869#ifdef USE_COMBINATION_EXPLOSION_CHECK
870 void* state_check_buff;
871 int state_check_buff_size;
876#define IS_CODE_SB_WORD(enc,code) \
877 (ONIGENC_IS_CODE_ASCII(code) && ONIGENC_IS_CODE_WORD(enc,code))
895extern OnigOpInfoType OnigOpInfo[];
900# ifdef ONIG_DEBUG_STATISTICS
901extern void onig_statistics_init(
void);
902extern void onig_print_statistics(
FILE*
f);
unsigned int OnigCodePoint
unsigned int OnigOptionType
size_t onig_region_memsize(const OnigRegion *regs)
size_t onig_memsize(const regex_t *reg)
int onig_compile_ruby(regex_t *reg, const UChar *pattern, const UChar *pattern_end, OnigErrorInfo *einfo, const char *sourcefile, int sourceline)
#define enclen(enc, p, e)
int onig_st_insert_strend(hash_table_type *table, const UChar *str_key, const UChar *end_key, hash_data_type value)
int onig_bbuf_init(BBuf *buf, OnigDistance size)
struct OnigEndCallListItem OnigEndCallListItemType
hash_table_type * onig_st_init_strend_table_with_size(st_index_t size)
struct _OnigStackType OnigStackType
int onig_is_code_in_cc(OnigEncoding enc, OnigCodePoint code, CClassNode *cc)
unsigned int BitStatusType
void onig_transfer(regex_t *to, regex_t *from)
int onig_is_code_in_cc_len(int enclen, OnigCodePoint code, CClassNode *cc)
int onig_compile(regex_t *reg, const UChar *pattern, const UChar *pattern_end, OnigErrorInfo *einfo)
short int StateCheckNumType
void onig_add_end_call(void(*func)(void))
void onig_vsnprintf_with_pattern(UChar buf[], int bufsize, OnigEncoding enc, UChar *pat, UChar *pat_end, const UChar *fmt, va_list args)
@ OP_STATE_CHECK_PUSH_OR_JUMP
@ OP_STATE_CHECK_ANYCHAR_STAR
@ OP_ANYCHAR_STAR_PEEK_NEXT
@ OP_PUSH_LOOK_BEHIND_NOT
@ OP_NOT_ASCII_WORD_BOUND
@ OP_NULL_CHECK_END_MEMST_PUSH
@ OP_STATE_CHECK_ANYCHAR_ML_STAR
@ OP_ANYCHAR_ML_STAR_PEEK_NEXT
@ OP_FAIL_LOOK_BEHIND_NOT
@ OP_NULL_CHECK_END_MEMST
UChar * onig_error_code_to_format(OnigPosition code)
int onig_st_lookup_strend(hash_table_type *table, const UChar *str_key, const UChar *end_key, hash_data_type *value)
void onig_snprintf_with_pattern(UChar buf[], int bufsize, OnigEncoding enc, UChar *pat, UChar *pat_end, const UChar *fmt,...)
struct _OnigStackType::@198::@203 null_check
struct _OnigStackType::@198::@204 call_frame
struct _OnigStackType::@198::@205 absent_pos
union _OnigStackType::@198 u
struct _OnigStackType::@198::@201 repeat_inc
struct _OnigStackType::@198::@199 state
struct _OnigStackType::@198::@200 repeat
struct _OnigStackType::@198::@202 mem
struct OnigEndCallListItem * next