summaryrefslogtreecommitdiff
path: root/src/regint.h
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2020-04-20 20:33:51 +0200
committerJörg Frings-Fürst <debian@jff.email>2020-04-20 20:33:51 +0200
commit6b986090d954dbac91bbb3c43ce7c3328c91a780 (patch)
tree34b34e41a3f7b7f4794c75be4482bb14695f36a9 /src/regint.h
parent4216de6a3336cbc6dddb572cb7e6ab6193bf3729 (diff)
New upstream version 6.9.5upstream/6.9.5
Diffstat (limited to 'src/regint.h')
-rw-r--r--src/regint.h407
1 files changed, 237 insertions, 170 deletions
diff --git a/src/regint.h b/src/regint.h
index cc540da..04ebe0a 100644
--- a/src/regint.h
+++ b/src/regint.h
@@ -4,7 +4,7 @@
regint.h - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2019 K.Kosako
+ * Copyright (c) 2002-2020 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -44,6 +44,7 @@
defined(ONIG_DEBUG_STATISTICS)
#ifndef ONIG_DEBUG
#define ONIG_DEBUG
+#define DBGFP stderr
#endif
#endif
@@ -55,13 +56,14 @@
/* config */
/* spec. config */
+#define USE_REGSET
#define USE_CALL
#define USE_CALLOUT
#define USE_BACKREF_WITH_LEVEL /* \k<name+n>, \k<name-n> */
#define USE_STUBBORN_CHECK_CAPTURES_IN_EMPTY_REPEAT /* /(?:()|())*\2/ */
#define USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE /* /\n$/ =~ "\n" */
#define USE_WARNING_REDUNDANT_NESTED_REPEAT_OPERATOR
-#define USE_RETRY_LIMIT_IN_MATCH
+#define USE_RETRY_LIMIT
#ifdef USE_GOTO_LABELS_AS_VALUES
#define USE_THREADED_CODE
#define USE_DIRECT_THREADED_CODE
@@ -71,73 +73,33 @@
#define USE_OP_PUSH_OR_JUMP_EXACT
#define USE_QUANT_PEEK_NEXT
#define USE_ST_LIBRARY
+#define USE_TIMEOFDAY
-#define USE_WORD_BEGIN_END /* "\<", "\>" */
+#define USE_WORD_BEGIN_END /* "\<", "\>" */
#define USE_CAPTURE_HISTORY
#define USE_VARIABLE_META_CHARS
#define USE_POSIX_API_REGION_OPTION
#define USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE
/* #define USE_REPEAT_AND_EMPTY_CHECK_LOCAL_VAR */
+#define INIT_MATCH_STACK_SIZE 160
+#define DEFAULT_MATCH_STACK_LIMIT_SIZE 0 /* unlimited */
+#define DEFAULT_RETRY_LIMIT_IN_MATCH 10000000
+#define DEFAULT_RETRY_LIMIT_IN_SEARCH 0 /* unlimited */
+#define DEFAULT_PARSE_DEPTH_LIMIT 4096
+#define DEFAULT_SUBEXP_CALL_MAX_NEST_LEVEL 20
-#include "regenc.h"
-
-#define INIT_MATCH_STACK_SIZE 160
-#define DEFAULT_MATCH_STACK_LIMIT_SIZE 0 /* unlimited */
-#define DEFAULT_RETRY_LIMIT_IN_MATCH 10000000
-#define DEFAULT_PARSE_DEPTH_LIMIT 4096
-
-/* */
-/* escape other system UChar definition */
-#ifdef ONIG_ESCAPE_UCHAR_COLLISION
-#undef ONIG_ESCAPE_UCHAR_COLLISION
-#endif
-#define xmalloc malloc
-#define xrealloc realloc
-#define xcalloc calloc
-#define xfree free
-
-#define st_init_table onig_st_init_table
-#define st_init_table_with_size onig_st_init_table_with_size
-#define st_init_numtable onig_st_init_numtable
-#define st_init_numtable_with_size onig_st_init_numtable_with_size
-#define st_init_strtable onig_st_init_strtable
-#define st_init_strtable_with_size onig_st_init_strtable_with_size
-#define st_delete onig_st_delete
-#define st_delete_safe onig_st_delete_safe
-#define st_insert onig_st_insert
-#define st_lookup onig_st_lookup
-#define st_foreach onig_st_foreach
-#define st_add_direct onig_st_add_direct
-#define st_free_table onig_st_free_table
-#define st_cleanup_safe onig_st_cleanup_safe
-#define st_copy onig_st_copy
-#define st_nothing_key_clone onig_st_nothing_key_clone
-#define st_nothing_key_free onig_st_nothing_key_free
-/* */
-#define onig_st_is_member st_is_member
-
-#define xmemset memset
-#define xmemcpy memcpy
-#define xmemmove memmove
-
-#if defined(_WIN32) && !defined(__GNUC__)
-#define xalloca _alloca
-#define xvsnprintf(buf,size,fmt,args) _vsnprintf_s(buf,size,_TRUNCATE,fmt,args)
-#define xsnprintf sprintf_s
-#define xstrcat(dest,src,size) strcat_s(dest,size,src)
-#else
-#define xalloca alloca
-#define xvsnprintf vsnprintf
-#define xsnprintf snprintf
-#define xstrcat(dest,src,size) strcat(dest,src)
-#endif
+#include "regenc.h"
+#ifndef ONIG_NO_STANDARD_C_HEADERS
#include <stddef.h>
+#include <stdarg.h>
#include <limits.h>
#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
@@ -147,9 +109,6 @@
#include <alloca.h>
#endif
-#include <string.h>
-
-#include <ctype.h>
#ifdef HAVE_SYS_TYPES_H
#ifndef __BORLANDC__
#include <sys/types.h>
@@ -160,21 +119,52 @@
#include <inttypes.h>
#endif
-#ifdef __BORLANDC__
+#if defined(_WIN32) || defined(__BORLANDC__)
#include <malloc.h>
#endif
-#ifdef ONIG_DEBUG
+#if defined(ONIG_DEBUG) || defined(NEED_TO_INCLUDE_STDIO)
# include <stdio.h>
#endif
-#ifdef _WIN32
-#if defined(_MSC_VER) && (_MSC_VER < 1300)
-typedef int intptr_t;
-typedef unsigned int uintptr_t;
+#ifdef ONIG_DEBUG_STATISTICS
+#ifdef USE_TIMEOFDAY
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#else /* USE_TIMEOFDAY */
+
+#ifdef HAVE_SYS_TIMES_H
+#include <sys/times.h>
#endif
+
+#endif /* USE_TIMEOFDAY */
+#endif /* ONIG_DEBUG_STATISTICS */
+
+/* I don't think these x....'s need to be included in
+ ONIG_NO_STANDARD_C_HEADERS, but they are required by Issue #170
+ and do so since there is no problem.
+ */
+#ifndef xmemset
+#define xmemset memset
+#endif
+
+#ifndef xmemcpy
+#define xmemcpy memcpy
+#endif
+
+#ifndef xmemmove
+#define xmemmove memmove
#endif
+#endif /* ONIG_NO_STANDARD_C_HEADERS */
+
+
#ifdef MIN
#undef MIN
#endif
@@ -191,8 +181,94 @@ typedef unsigned int uintptr_t;
#define CHECK_NULL_RETURN_MEMERR(p) if (IS_NULL(p)) return ONIGERR_MEMORY
#define NULL_UCHARP ((UChar* )0)
-#define CHAR_MAP_SIZE 256
-#define INFINITE_LEN ONIG_INFINITE_DISTANCE
+#ifndef ONIG_INT_MAX
+#define ONIG_INT_MAX INT_MAX
+#endif
+
+#define CHAR_MAP_SIZE 256
+#define INFINITE_LEN ONIG_INFINITE_DISTANCE
+#define STEP_BACK_MAX_CHAR_LEN 65535 /* INT_MAX is too big */
+#define LOOK_BEHIND_MAX_CHAR_LEN STEP_BACK_MAX_CHAR_LEN
+
+/* escape other system UChar definition */
+#ifdef ONIG_ESCAPE_UCHAR_COLLISION
+#undef ONIG_ESCAPE_UCHAR_COLLISION
+#endif
+
+#define xmalloc malloc
+#define xrealloc realloc
+#define xcalloc calloc
+#define xfree free
+
+#define st_init_table onig_st_init_table
+#define st_init_table_with_size onig_st_init_table_with_size
+#define st_init_numtable onig_st_init_numtable
+#define st_init_numtable_with_size onig_st_init_numtable_with_size
+#define st_init_strtable onig_st_init_strtable
+#define st_init_strtable_with_size onig_st_init_strtable_with_size
+#define st_delete onig_st_delete
+#define st_delete_safe onig_st_delete_safe
+#define st_insert onig_st_insert
+#define st_lookup onig_st_lookup
+#define st_foreach onig_st_foreach
+#define st_add_direct onig_st_add_direct
+#define st_free_table onig_st_free_table
+#define st_cleanup_safe onig_st_cleanup_safe
+#define st_copy onig_st_copy
+#define st_nothing_key_clone onig_st_nothing_key_clone
+#define st_nothing_key_free onig_st_nothing_key_free
+/* */
+#define onig_st_is_member st_is_member
+
+
+#if defined(_WIN32) && !defined(__GNUC__)
+
+#ifndef xalloca
+#define xalloca _alloca
+#endif
+#ifndef xvsnprintf
+#define xvsnprintf(buf,size,fmt,args) _vsnprintf_s(buf,size,_TRUNCATE,fmt,args)
+#endif
+#ifndef xsnprintf
+#define xsnprintf sprintf_s
+#endif
+#ifndef xstrcat
+#define xstrcat(dest,src,size) strcat_s(dest,size,src)
+#endif
+
+#else
+
+#ifndef xalloca
+#define xalloca alloca
+#endif
+#ifndef xvsnprintf
+#define xvsnprintf vsnprintf
+#endif
+#ifndef xsnprintf
+#define xsnprintf snprintf
+#endif
+#ifndef xstrcat
+#define xstrcat(dest,src,size) strcat(dest,src)
+#endif
+
+#endif /* defined(_WIN32) && !defined(__GNUC__) */
+
+
+#ifdef _WIN32
+#if defined(_MSC_VER) && (_MSC_VER < 1300)
+typedef int intptr_t;
+typedef unsigned int uintptr_t;
+#endif
+#endif
+
+#if SIZEOF_VOIDP == SIZEOF_LONG
+typedef unsigned long hash_data_type;
+#elif SIZEOF_VOIDP == SIZEOF_LONG_LONG
+typedef unsigned long long hash_data_type;
+#endif
+
+/* strend hash */
+typedef void* hash_table_type;
#ifdef USE_CALLOUT
@@ -236,7 +312,6 @@ enum OptimizeType {
OPTIMIZE_STR, /* Slow Search */
OPTIMIZE_STR_FAST, /* Sunday quick search / BMH */
OPTIMIZE_STR_FAST_STEP_FORWARD, /* Sunday quick search / BMH */
- OPTIMIZE_STR_CASE_FOLD, /* Slow Search (ignore case) */
OPTIMIZE_MAP /* char map */
};
@@ -289,32 +364,20 @@ typedef unsigned int MemStatusType;
(IS_CODE_DIGIT_ASCII(enc,code) ? DIGITVAL(code) \
: (ONIGENC_IS_CODE_UPPER(enc,code) ? (code) - 'A' + 10 : (code) - 'a' + 10))
-#define IS_SINGLELINE(option) ((option) & ONIG_OPTION_SINGLELINE)
-#define IS_MULTILINE(option) ((option) & ONIG_OPTION_MULTILINE)
-#define IS_IGNORECASE(option) ((option) & ONIG_OPTION_IGNORECASE)
-#define IS_EXTEND(option) ((option) & ONIG_OPTION_EXTEND)
-#define IS_FIND_LONGEST(option) ((option) & ONIG_OPTION_FIND_LONGEST)
-#define IS_FIND_NOT_EMPTY(option) ((option) & ONIG_OPTION_FIND_NOT_EMPTY)
-#define IS_FIND_CONDITION(option) ((option) & \
+#define OPTON_FIND_LONGEST(option) ((option) & ONIG_OPTION_FIND_LONGEST)
+#define OPTON_FIND_NOT_EMPTY(option) ((option) & ONIG_OPTION_FIND_NOT_EMPTY)
+#define OPTON_FIND_CONDITION(option) ((option) & \
(ONIG_OPTION_FIND_LONGEST | ONIG_OPTION_FIND_NOT_EMPTY))
-#define IS_NOTBOL(option) ((option) & ONIG_OPTION_NOTBOL)
-#define IS_NOTEOL(option) ((option) & ONIG_OPTION_NOTEOL)
-#define IS_POSIX_REGION(option) ((option) & ONIG_OPTION_POSIX_REGION)
-
-#define IS_WORD_ASCII(option) \
- ((option) & (ONIG_OPTION_WORD_IS_ASCII | ONIG_OPTION_POSIX_IS_ASCII))
-#define IS_DIGIT_ASCII(option) \
- ((option) & (ONIG_OPTION_DIGIT_IS_ASCII | ONIG_OPTION_POSIX_IS_ASCII))
-#define IS_SPACE_ASCII(option) \
- ((option) & (ONIG_OPTION_SPACE_IS_ASCII | ONIG_OPTION_POSIX_IS_ASCII))
-#define IS_POSIX_ASCII(option) ((option) & ONIG_OPTION_POSIX_IS_ASCII)
-
-#define IS_ASCII_MODE_CTYPE_OPTION(ctype, options) \
- ((ctype) >= 0 && \
- (((ctype) < ONIGENC_CTYPE_ASCII && IS_POSIX_ASCII(options)) ||\
- ((ctype) == ONIGENC_CTYPE_WORD && IS_WORD_ASCII(options)) ||\
- ((ctype) == ONIGENC_CTYPE_DIGIT && IS_DIGIT_ASCII(options)) ||\
- ((ctype) == ONIGENC_CTYPE_SPACE && IS_SPACE_ASCII(options))))
+#define OPTON_NEGATE_SINGLELINE(option) ((option) & \
+ ONIG_OPTION_NEGATE_SINGLELINE)
+#define OPTON_DONT_CAPTURE_GROUP(option) ((option) & \
+ ONIG_OPTION_DONT_CAPTURE_GROUP)
+#define OPTON_CAPTURE_GROUP(option) ((option) & ONIG_OPTION_CAPTURE_GROUP)
+#define OPTON_NOTBOL(option) ((option) & ONIG_OPTION_NOTBOL)
+#define OPTON_NOTEOL(option) ((option) & ONIG_OPTION_NOTEOL)
+#define OPTON_POSIX_REGION(option) ((option) & ONIG_OPTION_POSIX_REGION)
+#define OPTON_CHECK_VALIDITY_OF_STRING(option) ((option) & \
+ ONIG_OPTION_CHECK_VALIDITY_OF_STRING)
#define DISABLE_CASE_FOLD_MULTI_CHAR(case_fold_flag) \
((case_fold_flag) & ~INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR)
@@ -326,17 +389,17 @@ typedef unsigned int MemStatusType;
#define BITS_PER_BYTE 8
#define SINGLE_BYTE_SIZE (1 << BITS_PER_BYTE)
#define BITS_IN_ROOM 32 /* 4 * BITS_PER_BYTE */
-#define BITSET_SIZE (SINGLE_BYTE_SIZE / BITS_IN_ROOM)
+#define BITSET_REAL_SIZE (SINGLE_BYTE_SIZE / BITS_IN_ROOM)
typedef uint32_t Bits;
-typedef Bits BitSet[BITSET_SIZE];
+typedef Bits BitSet[BITSET_REAL_SIZE];
typedef Bits* BitSetRef;
-#define SIZE_BITSET sizeof(BitSet)
+#define SIZE_BITSET sizeof(BitSet)
#define BITSET_CLEAR(bs) do {\
int i;\
- for (i = 0; i < (int )BITSET_SIZE; i++) { (bs)[i] = 0; } \
+ for (i = 0; i < (int )BITSET_REAL_SIZE; i++) { (bs)[i] = 0; } \
} while (0)
#define BS_ROOM(bs,pos) (bs)[(unsigned int )(pos) >> 5]
@@ -356,14 +419,6 @@ typedef struct _BBuf {
#define BB_INIT(buf,size) bbuf_init((BBuf* )(buf), (size))
-/*
-#define BB_SIZE_INC(buf,inc) do{\
- (buf)->alloc += (inc);\
- (buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
- if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
-} while (0)
-*/
-
#define BB_EXPAND(buf,low) do{\
do { (buf)->alloc *= 2; } while ((buf)->alloc < (unsigned int )low);\
(buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
@@ -460,22 +515,20 @@ typedef struct _BBuf {
/* operation code */
enum OpCode {
- OP_FINISH = 0, /* matching process terminator (no more alternative) */
- OP_END = 1, /* pattern code terminator (success end) */
- OP_STR_1 = 2, /* single byte, N = 1 */
- OP_STR_2, /* single byte, N = 2 */
- OP_STR_3, /* single byte, N = 3 */
- OP_STR_4, /* single byte, N = 4 */
- OP_STR_5, /* single byte, N = 5 */
- OP_STR_N, /* single byte */
- OP_STR_MB2N1, /* mb-length = 2 N = 1 */
- OP_STR_MB2N2, /* mb-length = 2 N = 2 */
- OP_STR_MB2N3, /* mb-length = 2 N = 3 */
- OP_STR_MB2N, /* mb-length = 2 */
- OP_STR_MB3N, /* mb-length = 3 */
- OP_STR_MBN, /* other length */
- OP_STR_1_IC, /* single byte, N = 1, ignore case */
- OP_STR_N_IC, /* single byte, ignore case */
+ OP_FINISH = 0, /* matching process terminator (no more alternative) */
+ OP_END = 1, /* pattern code terminator (success end) */
+ OP_STR_1 = 2, /* single byte, N = 1 */
+ OP_STR_2, /* single byte, N = 2 */
+ OP_STR_3, /* single byte, N = 3 */
+ OP_STR_4, /* single byte, N = 4 */
+ OP_STR_5, /* single byte, N = 5 */
+ OP_STR_N, /* single byte */
+ OP_STR_MB2N1, /* mb-length = 2 N = 1 */
+ OP_STR_MB2N2, /* mb-length = 2 N = 2 */
+ OP_STR_MB2N3, /* mb-length = 2 N = 3 */
+ OP_STR_MB2N, /* mb-length = 2 */
+ OP_STR_MB3N, /* mb-length = 3 */
+ OP_STR_MBN, /* other length */
OP_CCLASS,
OP_CCLASS_MB,
OP_CCLASS_MIX,
@@ -502,7 +555,7 @@ enum OpCode {
OP_BEGIN_LINE,
OP_END_LINE,
OP_SEMI_END_BUF,
- OP_BEGIN_POSITION,
+ OP_CHECK_POSITION,
OP_BACKREF1,
OP_BACKREF2,
OP_BACKREF_N,
@@ -527,7 +580,8 @@ enum OpCode {
OP_JUMP,
OP_PUSH,
OP_PUSH_SUPER,
- OP_POP_OUT,
+ OP_POP,
+ OP_POP_TO_MARK,
#ifdef USE_OP_PUSH_OR_JUMP_EXACT
OP_PUSH_OR_JUMP_EXACT1, /* if match exact then push, else jump. */
#endif
@@ -542,16 +596,12 @@ enum OpCode {
#ifdef USE_CALL
OP_EMPTY_CHECK_END_MEMST_PUSH, /* with capture status and push check-end */
#endif
- OP_PREC_READ_START, /* (?=...) start */
- OP_PREC_READ_END, /* (?=...) end */
- OP_PREC_READ_NOT_START, /* (?!...) start */
- OP_PREC_READ_NOT_END, /* (?!...) end */
- OP_ATOMIC_START, /* (?>...) start */
- OP_ATOMIC_END, /* (?>...) end */
- OP_LOOK_BEHIND, /* (?<=...) start (no needs end opcode) */
- OP_LOOK_BEHIND_NOT_START, /* (?<!...) start */
- OP_LOOK_BEHIND_NOT_END, /* (?<!...) end */
- OP_PUSH_SAVE_VAL,
+ OP_MOVE,
+ OP_STEP_BACK_START,
+ OP_STEP_BACK_NEXT,
+ OP_CUT_TO_MARK,
+ OP_MARK,
+ OP_SAVE_VAL,
OP_UPDATE_VAR,
#ifdef USE_CALL
OP_CALL, /* \g<name> */
@@ -574,7 +624,13 @@ enum UpdateVarType {
UPDATE_VAR_S_FROM_STACK = 1,
UPDATE_VAR_RIGHT_RANGE_FROM_STACK = 2,
UPDATE_VAR_RIGHT_RANGE_FROM_S_STACK = 3,
- UPDATE_VAR_RIGHT_RANGE_INIT = 4,
+ UPDATE_VAR_RIGHT_RANGE_TO_S = 4,
+ UPDATE_VAR_RIGHT_RANGE_INIT = 5,
+};
+
+enum CheckPositionType {
+ CHECK_POSITION_SEARCH_START = 0,
+ CHECK_POSITION_CURRENT_RIGHT_RANGE = 1,
};
enum TextSegmentBoundaryType {
@@ -585,6 +641,7 @@ enum TextSegmentBoundaryType {
typedef int RelAddrType;
typedef int AbsAddrType;
typedef int LengthType;
+typedef int RelPositionType;
typedef int RepeatNumType;
typedef int MemNumType;
typedef void* PointerType;
@@ -619,7 +676,8 @@ typedef int ModeType;
#define OPSIZE_JUMP 1
#define OPSIZE_PUSH 1
#define OPSIZE_PUSH_SUPER 1
-#define OPSIZE_POP_OUT 1
+#define OPSIZE_POP 1
+#define OPSIZE_POP_TO_MARK 1
#ifdef USE_OP_PUSH_OR_JUMP_EXACT
#define OPSIZE_PUSH_OR_JUMP_EXACT1 1
#endif
@@ -628,10 +686,6 @@ typedef int ModeType;
#define OPSIZE_REPEAT_INC 1
#define OPSIZE_REPEAT_INC_NG 1
#define OPSIZE_WORD_BOUNDARY 1
-#define OPSIZE_PREC_READ_START 1
-#define OPSIZE_PREC_READ_NOT_START 1
-#define OPSIZE_PREC_READ_END 1
-#define OPSIZE_PREC_READ_NOT_END 1
#define OPSIZE_BACKREF 1
#define OPSIZE_FAIL 1
#define OPSIZE_MEM_START 1
@@ -640,16 +694,17 @@ typedef int ModeType;
#define OPSIZE_MEM_END_PUSH_REC 1
#define OPSIZE_MEM_END 1
#define OPSIZE_MEM_END_REC 1
-#define OPSIZE_ATOMIC_START 1
-#define OPSIZE_ATOMIC_END 1
#define OPSIZE_EMPTY_CHECK_START 1
#define OPSIZE_EMPTY_CHECK_END 1
-#define OPSIZE_LOOK_BEHIND 1
-#define OPSIZE_LOOK_BEHIND_NOT_START 1
-#define OPSIZE_LOOK_BEHIND_NOT_END 1
+#define OPSIZE_CHECK_POSITION 1
#define OPSIZE_CALL 1
#define OPSIZE_RETURN 1
-#define OPSIZE_PUSH_SAVE_VAL 1
+#define OPSIZE_MOVE 1
+#define OPSIZE_STEP_BACK_START 1
+#define OPSIZE_STEP_BACK_NEXT 1
+#define OPSIZE_CUT_TO_MARK 1
+#define OPSIZE_MARK 1
+#define OPSIZE_SAVE_VAL 1
#define OPSIZE_UPDATE_VAR 1
#ifdef USE_CALLOUT
@@ -750,6 +805,9 @@ typedef struct {
int not;
} text_segment_boundary;
struct {
+ enum CheckPositionType type;
+ } check_position;
+ struct {
union {
MemNumType n1; /* num == 1 */
MemNumType* ns; /* num > 1 */
@@ -781,6 +839,9 @@ typedef struct {
UChar c;
} push_if_peek_next;
struct {
+ MemNumType id;
+ } pop_to_mark;
+ struct {
MemNumType id;
RelAddrType addr;
} repeat; /* REPEAT, REPEAT_NG */
@@ -804,16 +865,33 @@ typedef struct {
RelAddrType addr;
} look_behind_not_start;
struct {
- AbsAddrType addr;
- } call;
+ RelPositionType n; /* char relative position */
+ } move;
+ struct {
+ LengthType initial; /* char length */
+ LengthType remaining; /* char length */
+ RelAddrType addr;
+ } step_back_start;
+ struct {
+ MemNumType id;
+ int restore_pos; /* flag: restore current string position */
+ } cut_to_mark;
+ struct {
+ MemNumType id;
+ int save_pos; /* flag: save current string position */
+ } mark;
struct {
SaveType type;
MemNumType id;
- } push_save_val;
+ } save_val;
struct {
UpdateVarType type;
MemNumType id;
+ int clear; /* UPDATE_VAR_RIGHT_RANGE_FROM_S_STACK or UPDATE_VAR_RIGHT_RANGE_FROM_STACK */
} update_var;
+ struct {
+ AbsAddrType addr;
+ } call;
#ifdef USE_CALLOUT
struct {
MemNumType num;
@@ -899,6 +977,17 @@ struct re_pattern_buffer {
extern void onig_add_end_call(void (*func)(void));
+extern void onig_warning(const char* s);
+extern UChar* onig_error_code_to_format P_((int code));
+extern void ONIG_VARIADIC_FUNC_ATTR onig_snprintf_with_pattern PV_((UChar buf[], int bufsize, OnigEncoding enc, UChar* pat, UChar* pat_end, const UChar *fmt, ...));
+extern int onig_compile P_((regex_t* reg, const UChar* pattern, const UChar* pattern_end, OnigErrorInfo* einfo));
+extern int onig_is_code_in_cc_len P_((int enclen, OnigCodePoint code, void* /* CClassNode* */ cc));
+extern RegexExt* onig_get_regex_ext(regex_t* reg);
+extern int onig_ext_set_pattern(regex_t* reg, const UChar* pattern, const UChar* pattern_end);
+extern int onig_positive_int_multiply(int x, int y);
+extern hash_table_type onig_st_init_strend_table_with_size P_((int size));
+extern int onig_st_lookup_strend P_((hash_table_type table, const UChar* str_key, const UChar* end_key, hash_data_type *value));
+extern int onig_st_insert_strend P_((hash_table_type table, const UChar* str_key, const UChar* end_key, hash_data_type value));
#ifdef ONIG_DEBUG
@@ -910,16 +999,8 @@ extern void onig_print_compiled_byte_code_list(FILE* f, regex_t* reg);
extern void onig_statistics_init P_((void));
extern int onig_print_statistics P_((FILE* f));
#endif
-#endif
-extern void onig_warning(const char* s);
-extern UChar* onig_error_code_to_format P_((int code));
-extern void onig_snprintf_with_pattern PV_((UChar buf[], int bufsize, OnigEncoding enc, UChar* pat, UChar* pat_end, const UChar *fmt, ...));
-extern int onig_compile P_((regex_t* reg, const UChar* pattern, const UChar* pattern_end, OnigErrorInfo* einfo));
-extern int onig_is_code_in_cc_len P_((int enclen, OnigCodePoint code, void* /* CClassNode* */ cc));
-extern RegexExt* onig_get_regex_ext(regex_t* reg);
-extern int onig_ext_set_pattern(regex_t* reg, const UChar* pattern, const UChar* pattern_end);
-extern int onig_positive_int_multiply(int x, int y);
+#endif /* ONIG_DEBUG */
#ifdef USE_CALLOUT
@@ -998,20 +1079,6 @@ extern OnigCalloutFunc onig_get_callout_start_func(regex_t* reg, int callout_num
#endif /* USE_CALLOUT */
-/* strend hash */
-typedef void hash_table_type;
-
-#ifdef _WIN32
-# include <windows.h>
-typedef ULONG_PTR hash_data_type;
-#else
-typedef unsigned long hash_data_type;
-#endif
-
-extern hash_table_type* onig_st_init_strend_table_with_size P_((int size));
-extern int onig_st_lookup_strend P_((hash_table_type* table, const UChar* str_key, const UChar* end_key, hash_data_type *value));
-extern int onig_st_insert_strend P_((hash_table_type* table, const UChar* str_key, const UChar* end_key, hash_data_type value));
-
typedef int (*ONIGENC_INIT_PROPERTY_LIST_FUNC_TYPE)(void);
#endif /* REGINT_H */