Compare commits

..
6 Commits
Author SHA1 Message Date
Christoph M. Becker 89dc78e0f0 Prepare PHP 7.3.9 2019-08-27 23:29:58 +02:00
Stanislav Malyshev a3bc8443f3 Fix CVE-2019-13224: don't allow different encodings for onig_new_deluxe()
Backport from https://github.com/kkos/oniguruma/commit/0f7f61ed1b7b697e283e37bd2d731d0bd57adb55

(cherry picked from commit 1258303e66)
2019-08-27 23:27:11 +02:00
Stanislav Malyshev 510ca4a126 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #75457: heap-use-after-free in php7.0.25

(cherry picked from commit 5d25ebb0dd)
2019-08-27 23:15:50 +02:00
Nikita Popov c4cfab8f84 Fixed bug #78412
$this should only be included in the generator GC buffer, if it
will be released on destruction.

(cherry picked from commit fcabe7e5e4)
2019-08-15 15:24:39 +02:00
Christoph M. Becker 8dc9e843a1 Update credits_ext.h 2019-08-15 15:21:18 +02:00
Christoph M. Becker 2c0381f330 Prepare 7.3.9RC1 2019-08-13 23:29:54 +02:00
123 changed files with 15483 additions and 20108 deletions

No files matched your search

+1 -1
View File
@@ -16,7 +16,7 @@ environment:
PHP_BUILD_CACHE_BASE_DIR: c:\build-cache
PHP_BUILD_OBJ_DIR: c:\obj
PHP_BUILD_CACHE_SDK_DIR: c:\build-cache\sdk
PHP_BUILD_SDK_BRANCH: php-sdk-2.2.0
PHP_BUILD_SDK_BRANCH: php-sdk-2.2.0beta6
PHP_BUILD_CRT: vc15
# ext and env setup for tests
#MYSQL_TEST_PASSWD: Password12!
-40
View File
@@ -1,45 +1,5 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
26 Sep 2019, PHP 7.3.10
- Core:
. Fixed bug #78220 (Can't access OneDrive folder). (cmb, ab)
. Fixed bug #77922 (Double release of doc comment on inherited shadow
property). (Nikita)
. Fixed bug #78441 (Parse error due to heredoc identifier followed by digit).
(cmb)
. Fixed bug #77812 (Interactive mode does not support PHP 7.3-style heredoc).
(cmb, Nikita)
- FastCGI:
. Fixed bug #78469 (FastCGI on_accept hook is not called when using named
pipes on Windows). (Sergei Turchanov)
- FPM:
. Fixed bug #78334 (fpm log prefix message includes wrong stdout/stderr
notation). (Tsuyoshi Sadakata)
- Intl:
. Ensure IDNA2003 rules are used with idn_to_ascii() and idn_to_utf8()
when requested. (Sara)
- MBString:
. Fixed bug #78559 (Heap buffer overflow in mb_eregi). (cmb)
- MySQLnd:
. Fixed connect_attr issues and added the _server_host connection attribute.
(Qianqian Bu)
- ODBC:
. Fixed bug #78473 (odbc_close() closes arbitrary resources). (cmb)
- PDO_MySQL:
. Fixed bug #41997 (SP call yields additional empty result set). (cmb)
- sodium:
. Fixed bug #78510 (Partially uninitialized buffer returned by
sodium_crypto_generichash_init()). (Frank Denis, cmb)
29 Aug 2019, PHP 7.3.9
- Core:
-20
View File
@@ -1,20 +0,0 @@
--TEST--
Bug #77922: Double release of doc comment on inherited shadow property
--FILE--
<?php
class A {
/** Foo */
private $prop;
}
class B extends A {
}
class C extends B {
}
?>
===DONE===
--EXPECT--
===DONE===
-11
View File
@@ -1,11 +0,0 @@
--TEST--
Immediately invoked closure with extra args
--FILE--
<?php
(function() {})(new stdClass);
?>
===DONE===
--EXPECT--
===DONE===
-28
View File
@@ -1,28 +0,0 @@
--TEST--
Object properties HT may need to be removed from nested data
--FILE--
<?php
class Test {
public function __destruct() {
$GLOBALS['x'] = $this;
}
}
$t = new Test;
$t->x = new stdClass;
$t->x->t = $t;
$a = (array) $t->x;
unset($t, $a);
gc_collect_cycles();
var_dump($x);
?>
--EXPECT--
object(Test)#1 (1) {
["x"]=>
object(stdClass)#2 (1) {
["t"]=>
*RECURSION*
}
}
-24
View File
@@ -1,24 +0,0 @@
--TEST--
Bug #78441 (Parse error due to heredoc identifier followed by digit)
--FILE--
<?php
echo <<<FOO
FOO4
FOO, PHP_EOL;
echo <<<FOO
bar
FOO4
FOO, PHP_EOL;
echo <<<'FOO'
bar
FOO4
FOO, PHP_EOL;
?>
--EXPECT--
FOO4
bar
FOO4
bar
FOO4
+1 -1
View File
@@ -20,7 +20,7 @@
#ifndef ZEND_H
#define ZEND_H
#define ZEND_VERSION "3.3.10"
#define ZEND_VERSION "3.3.9"
#define ZEND_ENGINE_3
+5 -5
View File
@@ -982,7 +982,7 @@ get_chunk:
heap->cached_chunks = chunk->next;
} else {
#if ZEND_MM_LIMIT
if (UNEXPECTED(ZEND_MM_CHUNK_SIZE > heap->limit - heap->real_size)) {
if (UNEXPECTED(heap->real_size + ZEND_MM_CHUNK_SIZE > heap->limit)) {
if (zend_mm_gc(heap)) {
goto get_chunk;
} else if (heap->overflow == 0) {
@@ -1510,8 +1510,8 @@ static zend_never_inline void *zend_mm_realloc_huge(zend_mm_heap *heap, void *pt
}
} else /* if (new_size > old_size) */ {
#if ZEND_MM_LIMIT
if (UNEXPECTED(new_size - old_size > heap->limit - heap->real_size)) {
if (zend_mm_gc(heap) && new_size - old_size <= heap->limit - heap->real_size) {
if (UNEXPECTED(heap->real_size + (new_size - old_size) > heap->limit)) {
if (zend_mm_gc(heap) && heap->real_size + (new_size - old_size) <= heap->limit) {
/* pass */
} else if (heap->overflow == 0) {
#if ZEND_DEBUG
@@ -1799,8 +1799,8 @@ static void *zend_mm_alloc_huge(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_D
void *ptr;
#if ZEND_MM_LIMIT
if (UNEXPECTED(new_size > heap->limit - heap->real_size)) {
if (zend_mm_gc(heap) && new_size <= heap->limit - heap->real_size) {
if (UNEXPECTED(heap->real_size + new_size > heap->limit)) {
if (zend_mm_gc(heap) && heap->real_size + new_size <= heap->limit) {
/* pass */
} else if (heap->overflow == 0) {
#if ZEND_DEBUG
-4
View File
@@ -1400,10 +1400,6 @@ tail_call:
ref = Z_COUNTED_P(zv);
goto tail_call;
}
if (GC_REF_ADDRESS(ht) != 0 && GC_REF_CHECK_COLOR(ht, GC_BLACK)) {
GC_TRACE_REF(ht, "removing from buffer");
GC_REMOVE_FROM_BUFFER(ht);
}
} else {
return;
}
File diff suppressed because it is too large. Load diff
+3 -4
View File
@@ -115,7 +115,6 @@ do { \
#define GET_DOUBLE_QUOTES_SCANNED_LENGTH() SCNG(scanned_string_len)
#define IS_LABEL_START(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z') || (c) == '_' || (c) >= 0x80)
#define IS_LABEL_SUCCESSOR(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z') || ((c) >= '0' && (c) <= '9') || (c) == '_' || (c) >= 0x80)
#define ZEND_IS_OCT(c) ((c)>='0' && (c)<='7')
#define ZEND_IS_HEX(c) (((c)>='0' && (c)<='9') || ((c)>='a' && (c)<='f') || ((c)>='A' && (c)<='F'))
@@ -2320,7 +2319,7 @@ skip_escape_conversion:
/* Check for ending label on the next line */
if (heredoc_label->length < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, s, heredoc_label->length)) {
if (!IS_LABEL_SUCCESSOR(YYCURSOR[heredoc_label->length])) {
if (!IS_LABEL_START(YYCURSOR[heredoc_label->length])) {
if (spacing == (HEREDOC_USING_SPACES | HEREDOC_USING_TABS)) {
zend_throw_exception(zend_ce_parse_error, "Invalid indentation - tabs and spaces cannot be mixed", 0);
}
@@ -2577,7 +2576,7 @@ double_quotes_scan_done:
/* Check for ending label on the next line */
if (IS_LABEL_START(*YYCURSOR) && heredoc_label->length < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, heredoc_label->label, heredoc_label->length)) {
if (IS_LABEL_SUCCESSOR(YYCURSOR[heredoc_label->length])) {
if (IS_LABEL_START(YYCURSOR[heredoc_label->length])) {
continue;
}
@@ -2698,7 +2697,7 @@ heredoc_scan_done:
/* Check for ending label on the next line */
if (IS_LABEL_START(*YYCURSOR) && heredoc_label->length < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, heredoc_label->label, heredoc_label->length)) {
if (IS_LABEL_SUCCESSOR(YYCURSOR[heredoc_label->length])) {
if (IS_LABEL_START(YYCURSOR[heredoc_label->length])) {
continue;
}
+1 -1
View File
@@ -1,4 +1,4 @@
/* Generated by re2c 1.1.1 */
/* Generated by re2c 1.0.1 */
#line 3 "Zend/zend_language_scanner_defs.h"
enum YYCONDTYPE {
+1 -2
View File
@@ -235,8 +235,7 @@ ZEND_API void destroy_zend_class(zval *zv)
efree(ce->default_static_members_table);
}
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop_info) {
if (prop_info->ce == ce ||
((prop_info->flags & ZEND_ACC_SHADOW) && prop_info->ce == ce->parent)) {
if (prop_info->ce == ce || (prop_info->flags & ZEND_ACC_SHADOW)) {
zend_string_release_ex(prop_info->name, 0);
if (prop_info->doc_comment) {
zend_string_release_ex(prop_info->doc_comment, 0);
+2 -18
View File
@@ -89,8 +89,6 @@ static cwd_state main_cwd_state; /* True global */
#include <unistd.h>
#else
#include <direct.h>
#include "zend_globals.h"
#include "zend_globals_macros.h"
#endif
#define CWD_STATE_COPY(d, s) \
@@ -859,7 +857,6 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
tmp = do_alloca(len+1, use_heap);
memcpy(tmp, path, len+1);
retry:
if(save &&
!(IS_UNC_PATH(path, len) && len >= 3 && path[2] != '?') &&
(dataw.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
@@ -907,21 +904,7 @@ retry:
return (size_t)-1;
}
if(!DeviceIoControl(hLink, FSCTL_GET_REPARSE_POINT, NULL, 0, pbuffer, MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &retlength, NULL)) {
BY_HANDLE_FILE_INFORMATION fileInformation;
free_alloca(pbuffer, use_heap_large);
if ((dataw.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) &&
(dataw.dwReserved0 & ~IO_REPARSE_TAG_CLOUD_MASK) == IO_REPARSE_TAG_CLOUD &&
EG(windows_version_info).dwMajorVersion >= 10 &&
EG(windows_version_info).dwMinorVersion == 0 &&
EG(windows_version_info).dwBuildNumber >= 18362 &&
GetFileInformationByHandle(hLink, &fileInformation) &&
!(fileInformation.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) {
dataw.dwFileAttributes = fileInformation.dwFileAttributes;
CloseHandle(hLink);
(*ll)--;
goto retry;
}
free_alloca(tmp, use_heap);
CloseHandle(hLink);
FREE_PATHW()
@@ -1001,7 +984,8 @@ retry:
}
else if (pbuffer->ReparseTag == IO_REPARSE_TAG_DEDUP ||
/* Starting with 1709. */
(pbuffer->ReparseTag & ~IO_REPARSE_TAG_CLOUD_MASK) == IO_REPARSE_TAG_CLOUD ||
(pbuffer->ReparseTag & IO_REPARSE_TAG_CLOUD_MASK) != 0 && 0x90001018L != pbuffer->ReparseTag ||
IO_REPARSE_TAG_CLOUD == pbuffer->ReparseTag ||
IO_REPARSE_TAG_ONEDRIVE == pbuffer->ReparseTag) {
isabsolute = 1;
substitutename = malloc((len + 1) * sizeof(char));
+1 -5
View File
@@ -2430,11 +2430,6 @@ ZEND_VM_HOT_HELPER(zend_leave_helper, ANY, ANY)
zend_clean_and_cache_symbol_table(EX(symbol_table));
}
EG(current_execute_data) = EX(prev_execute_data);
/* Free extra args before releasing the closure,
* as that may free the op_array. */
zend_vm_stack_free_extra_args_ex(call_info, execute_data);
if (UNEXPECTED(call_info & ZEND_CALL_RELEASE_THIS)) {
zend_object *object = Z_OBJ(execute_data->This);
#if 0
@@ -2450,6 +2445,7 @@ ZEND_VM_HOT_HELPER(zend_leave_helper, ANY, ANY)
OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(func)));
}
zend_vm_stack_free_extra_args_ex(call_info, execute_data);
old_execute_data = execute_data;
execute_data = EX(prev_execute_data);
zend_vm_stack_free_call_frame_ex(call_info, old_execute_data);
+2 -10
View File
@@ -541,11 +541,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_
zend_clean_and_cache_symbol_table(EX(symbol_table));
}
EG(current_execute_data) = EX(prev_execute_data);
/* Free extra args before releasing the closure,
* as that may free the op_array. */
zend_vm_stack_free_extra_args_ex(call_info, execute_data);
if (UNEXPECTED(call_info & ZEND_CALL_RELEASE_THIS)) {
zend_object *object = Z_OBJ(execute_data->This);
#if 0
@@ -561,6 +556,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_
OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(func)));
}
zend_vm_stack_free_extra_args_ex(call_info, execute_data);
old_execute_data = execute_data;
execute_data = EX(prev_execute_data);
zend_vm_stack_free_call_frame_ex(call_info, old_execute_data);
@@ -55379,11 +55375,6 @@ zend_leave_helper_SPEC_LABEL:
zend_clean_and_cache_symbol_table(EX(symbol_table));
}
EG(current_execute_data) = EX(prev_execute_data);
/* Free extra args before releasing the closure,
* as that may free the op_array. */
zend_vm_stack_free_extra_args_ex(call_info, execute_data);
if (UNEXPECTED(call_info & ZEND_CALL_RELEASE_THIS)) {
zend_object *object = Z_OBJ(execute_data->This);
#if 0
@@ -55399,6 +55390,7 @@ zend_leave_helper_SPEC_LABEL:
OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(func)));
}
zend_vm_stack_free_extra_args_ex(call_info, execute_data);
old_execute_data = execute_data;
execute_data = EX(prev_execute_data);
zend_vm_stack_free_call_frame_ex(call_info, old_execute_data);
+1 -1
View File
@@ -2179,7 +2179,7 @@ AC_DEFUN([PHP_SETUP_ICU],[
dnl If pkg-config is found try using it
if test "$PHP_ICU_DIR" = "DEFAULT" && test -x "$PKG_CONFIG" && $PKG_CONFIG --exists icu-uc icu-io icu-i18n; then
if $PKG_CONFIG --atleast-version=4.0 icu-uc; then
if $PKG_CONFIG --atleast-version=40 icu-uc; then
found_icu=yes
icu_version_full=`$PKG_CONFIG --modversion icu-uc`
ac_IFS=$IFS
+1 -1
View File
@@ -107,7 +107,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
PHP_MAJOR_VERSION=7
PHP_MINOR_VERSION=3
PHP_RELEASE_VERSION=10
PHP_RELEASE_VERSION=9
PHP_EXTRA_VERSION=""
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
+18 -12
View File
@@ -224,27 +224,33 @@ static void php_intl_idn_to(INTERNAL_FUNCTION_PARAMETERS,
}
RETURN_FALSE;
} else {
UParseError parse_error;
UChar converted[MAXPATHLEN];
int32_t converted_ret_len;
status = U_ZERO_ERROR;
#if defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif ZEND_GCC_VERSION >= 4008
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#if U_ICU_VERSION_MAJOR_NUM >= 55
UIDNAInfo info = UIDNA_INFO_INITIALIZER;
UIDNA *idna = uidna_openUTS46((int32_t)option, &status);
if (U_FAILURE(status)) {
intl_error_set( NULL, status, "idn_to_ascii: failed to create an UIDNA instance", 0 );
RETURN_FALSE;
}
if (mode == INTL_IDN_TO_ASCII) {
converted_ret_len = uidna_nameToASCII(idna, ustring, ustring_len, converted, MAXPATHLEN, &info, &status);
} else {
converted_ret_len = uidna_nameToUnicode(idna, ustring, ustring_len, converted, MAXPATHLEN, &info, &status);
}
uidna_close(idna);
#else
UParseError parse_error;
if (mode == INTL_IDN_TO_ASCII) {
converted_ret_len = uidna_IDNToASCII(ustring, ustring_len, converted, MAXPATHLEN, (int32_t)option, &parse_error, &status);
} else {
converted_ret_len = uidna_IDNToUnicode(ustring, ustring_len, converted, MAXPATHLEN, (int32_t)option, &parse_error, &status);
}
#if defined(__clang__)
# pragma clang diagnostic pop
#elif ZEND_GCC_VERSION >= 4008
# pragma GCC diagnostic pop
#endif
efree(ustring);
+5 -5
View File
@@ -146,7 +146,7 @@ static void _php_ldap_control_to_array(LDAP *ld, LDAPControl* ctrl, zval* array,
add_assoc_bool(array, "iscritical", (ctrl->ldctl_iscritical != 0));
}
/* If it is a known oid, parse to values */
// If it is a known oid, parse to values
if (strcmp(ctrl->ldctl_oid, LDAP_CONTROL_PASSWORDPOLICYRESPONSE) == 0) {
int expire = 0, grace = 0, rc;
LDAPPasswordPolicyError pperr;
@@ -361,8 +361,8 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
rc = -1;
php_error_docref(NULL, E_WARNING, "Failed to allocate control value");
} else {
/* ldap_create_assertion_control_value does not reset ld_errno, we need to do it ourselves
See http://www.openldap.org/its/index.cgi/Incoming?id=8674 */
// ldap_create_assertion_control_value does not reset ld_errno, we need to do it ourselves
// See http://www.openldap.org/its/index.cgi/Incoming?id=8674
int success = LDAP_SUCCESS;
ldap_set_option(ld, LDAP_OPT_RESULT_CODE, &success);
rc = ldap_create_assertion_control_value(ld, ZSTR_VAL(assert), control_value);
@@ -612,7 +612,7 @@ failure:
return LDAP_SUCCESS;
}
/* Failed */
// Failed
*ctrl = NULL;
return -1;
}
@@ -1589,7 +1589,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
}
if (argcount > 8) {
/* We have to parse controls again for each link as they use it */
// We have to parse controls again for each link as they use it
_php_ldap_controls_free(&lserverctrls);
lserverctrls = _php_ldap_controls_from_array(ld->link, serverctrls);
if (lserverctrls == NULL) {
+1 -1
View File
@@ -1,7 +1,7 @@
Oniguruma LICENSE
-----------------
Copyright (c) 2002-2019 K.Kosako <kkosako0@gmail.com>
Copyright (c) 2002-2018 K.Kosako <kkosako0@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
+22 -79
View File
@@ -1,62 +1,5 @@
History
2019/08/06: Version 6.9.3 (secirity fix release)
2019/07/30: add ONIG_SYN_ALLOW_INVALID_CODE_END_OF_RANGE
2019/07/29: add STK_PREC_READ_START/END stack type
2019/07/29: Fix #147: Stack Exhaustion Problem caused by some parsing functions
2019/07/11: add a dictionary file for libfuzzer
2019/07/07: add harnesses directory
2019/07/05-2019/07/29: fix many problems found by libfuzzer programs
2019/06/27: deprecate onig_new_deluxe()
2019/06/27: Fix CVE-2019-13224: don't allow different encodings for onig_new_deluxe()
2019/06/27: Fix CVE-2019-13225: problem in converting if-then-else pattern
2019/05/07: Version 6.9.2 (same as Release Candidate 3)
2019/04/23: Release Candidate 3 for 6.9.2
2019/04/23: add doc/SYNTAX.md into distribution file
2019/04/09: Release Candidate 2 for 6.9.2
2019/04/09: fix #139: UAF in match_at()
2019/04/01: Release Candidate 1 for 6.9.2
2019/04/01: update Unicode version to 12.1.0 (draft)
2019/03/29: allow {n,m} (n>m) as possessive interval
2019/03/25: add ONIG_SYN_OP2_OPTION_ONIGURUMA
2019/03/22: add new options ONIG_OPTION_TEXT_SEGMENT_EXTENDED_GRAPHEME_CLUSTER and
ONIG_OPTION_TEXT_SEGMENT_WORD
2019/03/21: PR #137: fix cross-compilation
2019/03/20: update Unicode version to 12.0.0
2019/03/17: add doc/SYNTAX.md
2019/03/13: {n,m}+ and {n,m}? are possessive and reluctant range operator
in Perl syntax
2019/03/04: fix #132: don't execute testp if ENABLE_POSIX_API == no
2019/02/28: re-implement bytecode by using Operation struct
2019/02/26: fix #130: Build error on UWP with VS2017
2019/02/03: PR #128: regerror/toascii: do not attempt to serialize NULL pointer
2019/01/30: Build breaks without autoreconf #73
2019/01/02: fix #127: Windows VS 2008 build errors
2018/12/19: fix #126: Unable to compile when USE_CALLOUT is not defined
2018/12/11: Version 6.9.1
2018/10/08: use ENC_FLAG_SKIP_OFFSET_XXX values
2018/10/06: UTF-8 supports code range from 0x0000 to 0x10FFFF
(https://tools.ietf.org/html/rfc3629)
2018/10/05: speed improvement
2018/10/03: use OPTIMIZE_STR_CASE_FOLD_FAST
2018/10/01: convert CRLF line endings to LF
2018/09/27: set SIZEOF_SIZE_T for windows platforms
2018/09/22: use Sunday quick search algorithm instead of Boyer-Moor-Horspool
2018/09/20: introduce threaded code into match_at()
2018/09/17: remove HAVE_STRINGS_H
2018/09/16: remove HAVE_PROTOTYPES and HAVE_STDARG_PROTOTYPES
2018/09/14: add a command line option '-gc' for make_unicode_property_data.py.
2018/09/08: remove AC_HEADER_STDC
2018/09/06: remove AC_OUTPUT macro call
2018/09/06: remove AC_FUNC_MEMCMP, AC_HEADER_TIME, AC_C_CONST, HAVE__SETJMP and
HAVE_STRING_H
2018/09/05: remove HAVE_LIMITS_H, HAVE_FLOAT_H and HAVE_STDLIB_H
2018/09/03: Version 6.9.0
2018/08/24: add Unicode Emoji properties
@@ -451,12 +394,12 @@ History
2006/11/07: [dist] remove test.rb, testconv.rb and testconvu.rb.
2006/11/07: [bug] get_case_fold_codes_by_str() should handle 'Ss' and 'sS'
combination for ess-tsett.
2006/11/07: [impl] apply_all_case_fold() doesn't need to return all
2006/11/07: [impl] apply_all_case_fold() doesn't need to return all
case character combination for multi-character folding.
(ONIGENC_CASE_FOLD_MULTI_CHAR)
2006/11/07: [bug] (thanks Byte)
add { 0xa3, 0xb3 } to CaseFoldMap[] for KOI8-R.
2006/11/06: [spec] change ONIG_OPTION_FIND_LONGEST to search all of
2006/11/06: [spec] change ONIG_OPTION_FIND_LONGEST to search all of
the string range.
add USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE.
2006/11/02: [impl] re-implement expand_case_fold_string() for
@@ -724,7 +667,7 @@ History
2006/05/11: [test] success in ruby 1.9.0 (2006-03-01) [i686-linux].
2006/05/11: [bug] (thanks Yuji Kaneda)
dead-lock in onig_end().
dead-lock in onig_end().
2006/05/11: [dist] update index.html.
2006/05/08: Version 4.0.3
@@ -776,7 +719,7 @@ History
use GNU libtool/automake.
change configure.in and add Makefile.am, sample/Makefile.am.
add AUTHORS file.
2006/01/24: [dist] test programs return exit code -1 when test fails.
2006/01/24: [dist] test programs return exit code -1 when test fails.
2006/01/24: [bug] (thanks KIMURA Koichi)
invalid syntax definition in ONIG_SYNTAX_GREP.
ONIG_SYN_OP_BRACE_INTERVAL
@@ -794,7 +737,7 @@ History
2005/11/24: [test] success in ruby 1.9.0 (2005-08-09) [i686-linux].
2005/11/21: [test] success in ruby 1.9.0 (2005-11-20) [i386-cygwin].
2005/11/21: [bug] (thanks Allan Odgaard)
utf-8 character comments in extended mode leads
utf-8 character comments in extended mode leads
invalid result.
ex. /(?x)(?<= # <any-utf-8 multibyte char>o\n~) /
fix onigenc_unicode_is_code_ctype() and
@@ -876,7 +819,7 @@ History
add new character encoding ONIG_ENCODING_GB18030.
2005/06/30: [bug] invalid ctype check for multibyte encodings.
("graph", "print")
fix onigenc_mb2/4_is_code_ctype(),
fix onigenc_mb2/4_is_code_ctype(),
eucjp_is_code_ctype() and sjis_is_code_ctype().
2005/06/30: [bug] invalid conversion from code point to mbc in
onigenc_mb4_code_to_mbc().
@@ -951,7 +894,7 @@ History
remove oniggnu.h from make 19.
2005/03/01: [bug] (thanks matz) [ruby-dev:25778]
uninitialized member (OptEnv.backrefed_status)
was used.
was used.
2005/02/19: Version 3.7.0
@@ -1002,7 +945,7 @@ History
2005/01/19: [bug] (thanks Isao Sonobe)
callback function argument name_end of onig_foreach_name()
was wrong.
name key of name table should be null terminated for
name key of name table should be null terminated for
character encoding length.
add strdup_with_null(), rename onig_strdup() to k_strdup().
use e->name_len in i_names().
@@ -1274,7 +1217,7 @@ History
RelAddrType, AbsAddrType and LengthType change
from short int to int type for the very long string match.
2004/06/14: [bug] (thanks Greg A. Woods)
fix nmatch argument of regexec() is smaller than
fix nmatch argument of regexec() is smaller than
reg->num_mem + 1 case. (POSIX API)
2004/06/14: [spec] (thanks Greg A. Woods)
set pmatch to NULL if nmatch is 0 in regexec(). (POSIX API)
@@ -1454,7 +1397,7 @@ History
2004/02/23: [new] support ISO-8859-10. (ONIG_ENCODING_ISO_8859_10)
2004/02/20: [bug] fix iso_8859_4_mbc_is_case_ambig().
2004/02/20: [new] support ISO-8859-9. (ONIG_ENCODING_ISO_8859_9)
2004/02/19: [bug] correct ctype tables for ISO-8859-3, ISO-8859-4,
2004/02/19: [bug] correct ctype tables for ISO-8859-3, ISO-8859-4,
ISO-8859-6, ISO-8859-7, ISO-8859-8, KOI8_R.
2004/02/18: [bug] wrong replaced name OnigSyntaxGnuOnigex.
2004/02/17: [spec] check capture status for empty infinite loop.
@@ -1627,7 +1570,7 @@ History
2003/11/11: [spec] add syntax op. REG_SYN_OP_VARIABLE_META_CHARS.
2003/11/11: [spec] rename REG_SYN_OP_ESC_CAPITAL_Q_QUOTE to
REG_SYN_OP2_ESC_CAPITAL_Q_QUOTE,
REG_SYN_OP_QMARK_GROUP_EFFECT to
REG_SYN_OP_QMARK_GROUP_EFFECT to
REG_SYN_OP2_QMARK_GROUP_EFFECT.
2003/11/06: [impl] define THREAD_PASS as rb_thread_schedule() in Ruby mode.
2003/11/05: [spec] add syntax behavior REG_SYN_WARN_REDUNDANT_NESTED_REPEAT.
@@ -1644,7 +1587,7 @@ History
2003/10/03: [bug] (thanks nobu) [ruby-dev:21472]
sub-anchor of optimization map info was wrong
in concat_left_node_opt_info().
ex. /^(x?y)/ = "xy" fail.
ex. /^(x?y)/ = "xy" fail.
2003/09/17: Version 1.9.4
@@ -1707,7 +1650,7 @@ History
2003/09/01: [dist] update doc/RE and doc/RE.ja.
2003/08/26: [bug] (thanks Guy Decoux)
should not double free node at the case TK_CC_CC_OPEN
in parse_char_class().
in parse_char_class().
2003/08/19: Version 1.9.3
@@ -1719,8 +1662,8 @@ History
REG_SYN_OP2_ATMARK_CAPTURE_HISTORY.
2003/08/18: [spec] (thanks nobu)
don't use IMPORT in oniguruma.h and onigposix.h.
2003/08/18: [impl] (thanks nobu) change error output to stdout in testconv.rb.
2003/08/18: [inst] (thanks nobu) lacked $(srcdir) in Makefile.in.
2003/08/18: [impl] (thanks nobu) change error output to stdout in testconv.rb.
2003/08/18: [inst] (thanks nobu) lacked $(srcdir) in Makefile.in.
2003/08/18: [bug] REG_MBLEN_TABLE[SJIS][0xFD-0xFF] should be 1.
2003/08/18: [bug] (thanks nobu) mbctab_sjis[0x80] should be 0.
2003/08/18: [bug] (thanks nobu)
@@ -1749,7 +1692,7 @@ History
2003/07/29: [new] add regex_get_encoding(), regex_get_options() and
regex_get_syntax().
2003/07/25: [spec] (thanks akr)
change group(...) to shy-group(?:...) if named group is
change group(...) to shy-group(?:...) if named group is
used in the pattern.
add REG_SYN_CAPTURE_ONLY_NAMED_GROUP.
2003/07/24: [spec] rename REG_OPTION_CAPTURE_ONLY_NAMED_GROUP to
@@ -1777,7 +1720,7 @@ History
set option status to effect memory in optimize_node_left().
2003/07/07: [impl] add opcode OP_ANYCHAR_ML, OP_ANYCHAR_ML_STAR and
OP_ANYCHAR_ML_START_PEEK_NEXT.
2003/07/07: [bug] (thanks nobu) REG_MBLEN_TABLE[SJIS][0x80] should be 1.
2003/07/07: [bug] (thanks nobu) REG_MBLEN_TABLE[SJIS][0x80] should be 1.
2003/07/07: [spec] rename REG_SYN_OP_QUOTE to REG_SYN_OP_ESC_Q_QUOTE.
2003/07/04: Version 1.9.1
@@ -1840,7 +1783,7 @@ History
2003/06/12: [spec] add syntax behavior REG_SYN_WARN_FOR_CC_OP_NOT_ESCAPEED.
2003/06/12: [spec] invalid POSIX bracket should be error. ex. [[:upper :]]
2003/06/11: [new] char-class in char-class (as Java(TM)).
2003/06/11: [spec] change AND operator in char-class from &&[..] to &&.
2003/06/11: [spec] change AND operator in char-class from &&[..] to &&.
2003/06/04: [spec] {n,m}+ should not be possessive operator.
ex. a{3}+ should be (?:a{3})+
2003/06/03: [bug] should compare strings with min-length in is_not_included().
@@ -2004,7 +1947,7 @@ History
2003/02/26: [impl] add -win option to testconv.rb.
2003/02/25: [spec] allow to assign same name to different group.
add OP_BACKREF_MULTI.
2003/02/24: [impl] reduce redundant repeat of empty target.
2003/02/24: [impl] reduce redundant repeat of empty target.
ex. /()*/ ==> /()?/, /()+/ ==> /()/, /(?:)+/ ==> //
2003/02/24: [impl] change condition in regex_is_allow_reverse_match().
2003/02/24: [impl] convert i(/../, ...) functions in testconv.rb.
@@ -2073,7 +2016,7 @@ History
2003/02/04: [bug] typo miss in regex_region_copy().
2003/02/04: [impl] change THREAD_PASS macro. (regint.h)
2003/02/04: [dist] add API document file doc/API.
2003/02/04: [tune] if sub_anchor has ANCHOR_BEGIN_LINE then
2003/02/04: [tune] if sub_anchor has ANCHOR_BEGIN_LINE then
set REG_OPTIMIZE_EXACT_BM in set_optimize_exact_info().
2003/02/04: [spec] reimplement regex_clone() and it is obsoleted.
2003/02/04: [bug] add REGERR_OVER_THREAD_PASS_LIMIT_COUNT
@@ -2193,7 +2136,7 @@ History
2002/04/01: [dist] add COPYING.
2002/03/30: [spec] warn redundant nested repeat operator
in Ruby verbose mode. ex. (?:a*)?
2002/03/30: [spec] nested repeat operator error check should be
2002/03/30: [spec] nested repeat operator error check should be
same with GNU regex. (thanks Guy Decoux)
2002/03/30: [new] add \x{hexadecimal-wide-char}. (thanks matz)
2002/03/27: [bug] MBCTYPE_XXX symbol values should be same with GNU regex.
@@ -2256,7 +2199,7 @@ History
ex. /(?:abc){10}/
2002/03/06: [new] add a symbol REG_TRANSTABLE_USE_DEFAULT in regex.h.
2002/03/06: [impl] rename RegDefaultCharCode to RegDefaultCharEncoding.
2002/03/06: [bug] if pattern has NULL(\000) char, infinite loop happens
2002/03/06: [bug] if pattern has NULL(\000) char, infinite loop happens
in ScanMakeNode(). (beware of strchr(). thanks Nobu)
2002/03/06: [bug] range argument of ForwardSearchRange() is wrong.
ex. /\A.a/, /\G.a/ mismatched with "aa". (thanks Nobu)
+1 -1
View File
@@ -94,7 +94,7 @@ Usage
See doc/API for Oniguruma API.
If you want to disable UChar type (== unsigned char) definition
in oniguruma.h, define ONIG_ESCAPE_UCHAR_COLLISION and then
in oniguruma.h, define ONIG_ESCAPE_UCHAR_COLLISION and then
include oniguruma.h.
If you want to disable regex_t type definition in oniguruma.h,
+29 -58
View File
@@ -1,6 +1,4 @@
[![Build Status](https://travis-ci.org/kkos/oniguruma.svg?branch=master)](https://travis-ci.org/kkos/oniguruma)
[![Code Quality: Cpp](https://img.shields.io/lgtm/grade/cpp/g/kkos/oniguruma.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/kkos/oniguruma/context:cpp)
[![Total Alerts](https://img.shields.io/lgtm/alerts/g/kkos/oniguruma.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/kkos/oniguruma/alerts)
Oniguruma
=========
@@ -24,58 +22,31 @@ Supported character encodings:
* GB18030: contributed by KUBO Takehiro
* CP1251: contributed by Byte
* doc/SYNTAX.md: contributed by seanofw
Version 6.9.3 (security fix release)
------------------------------------
* Fixed CVE-2019-13224
* Fixed CVE-2019-13225
* Fixed many problems (found by libfuzzer programs)
Version 6.9.2 (Reiwa)
---------------------
* add doc/SYNTAX.md
* Update Unicode version 12.1.0
* NEW: Unicode Text Segment mode option (?y{g}) (?y{w}) (*original)
g: Extended Grapheme Cluster mode / w: Word mode
(Unicode Standard Annex #29 [http://unicode.org/reports/tr29/])
Version 6.9.1
-------------
* Speed improvement (* especially UTF-8)
Version 6.9.0
-------------
New feature of version 6.9.0
--------------------------
* Update Unicode version 11.0.0
* NEW: add Emoji properties
Version 6.8.2
-------------
New feature of version 6.8.2
--------------------------
* Fix: #80 UChar in header causes issue
* NEW API: onig_set_callout_user_data_of_match_param() (* omission in 6.8.0)
* add doc/CALLOUTS.API and doc/CALLOUTS.API.ja
Version 6.8.1
-------------
New feature of version 6.8.1
--------------------------
* Update shared library version to 5.0.0 for API incompatible changes from 6.7.1
Version 6.8.0
-------------
New feature of version 6.8.0
--------------------------
* Retry-limit-in-match function enabled by default
* NEW: configure option --enable-posix-api=no (* enabled by default)
@@ -86,14 +57,14 @@ Version 6.8.0
* Examples of Callouts program: [callout.c](sample/callout.c), [count.c](sample/count.c), [echo.c](sample/echo.c)
Version 6.7.1
-------------
New feature of version 6.7.1
--------------------------
* NEW: Mechanism of retry-limit-in-match (* disabled by default)
Version 6.7.0
-------------
New feature of version 6.7.0
--------------------------
* NEW: hexadecimal codepoint \uHHHH
* NEW: add ONIG_SYNTAX_ONIGURUMA (== ONIG_SYNTAX_DEFAULT)
@@ -101,17 +72,17 @@ Version 6.7.0
* Reduced size of object file
Version 6.6.0
-------------
New feature of version 6.6.0
--------------------------
* NEW: ASCII only mode options for character type/property (?WDSP)
* NEW: Extended Grapheme Cluster boundary \y, \Y
* NEW: Extended Grapheme Cluster boundary \y, \Y (*original)
* NEW: Extended Grapheme Cluster \X
* Range-clear (Absent-clear) operator restores previous range in retractions.
Version 6.5.0
-------------
New feature of version 6.5.0
--------------------------
* NEW: \K (keep)
* NEW: \R (general newline) \N (no newline)
@@ -123,16 +94,16 @@ Version 6.5.0
* NEW: Absent stopper (?~|absent) (*original)
Version 6.4.0
-------------
New feature of version 6.4.0
--------------------------
* Fix fatal problem of endless repeat on Windows
* NEW: call zero (call the total regexp) \g<0>
* NEW: relative backref/call by positive number \k<+n>, \g<+n>
Version 6.3.0
-------------
New feature of version 6.3.0
--------------------------
* NEW: octal codepoint \o{.....}
* Fixed CVE-2017-9224
@@ -143,20 +114,20 @@ Version 6.3.0
* Fixed CVE-2017-9229
Version 6.1.2
-------------
New feature of version 6.1.2
--------------------------
* allow word bound, word begin and word end in look-behind.
* NEW option: ONIG_OPTION_CHECK_VALIDITY_OF_STRING
Version 6.1
-----------
New feature of version 6.1
--------------------------
* improved doc/RE
* NEW API: onig_scan()
Version 6.0
-----------
New feature of version 6.0
--------------------------
* Update Unicode 8.0 Property/Case-folding
* NEW API: onig_unicode_define_user_property()
@@ -222,7 +193,7 @@ Usage
See doc/API for Oniguruma API.
If you want to disable UChar type (== unsigned char) definition
in oniguruma.h, define ONIG_ESCAPE_UCHAR_COLLISION and then
in oniguruma.h, define ONIG_ESCAPE_UCHAR_COLLISION and then
include oniguruma.h.
If you want to disable regex_t type definition in oniguruma.h,
@@ -323,4 +294,4 @@ Source Files
|utf32_le.c |UTF-32LE encoding |
|unicode.c |common codes of Unicode encoding |
|unicode_fold_data.c|Unicode folding data |
|windows/testc.c |Test program for Windows (VC++) |
|windows/testc.c |Test program for Windowns (VC++) |
+5 -25
View File
@@ -1,4 +1,4 @@
Oniguruma API Version 6.9.3 2019/07/06
Oniguruma API Version 6.8.0 2018/03/13
#include <oniguruma.h>
@@ -92,8 +92,6 @@ Oniguruma API Version 6.9.3 2019/07/06
(alnum, alpha, blank, cntrl, digit, graph,
lower, print, punct, space, upper, xdigit,
word)
ONIG_OPTION_TEXT_SEGMENT_EXTENDED_GRAPHEME_CLUSTER Extended Grapheme Cluster mode
ONIG_OPTION_TEXT_SEGMENT_WORD Word mode
5 enc: character encoding.
@@ -168,9 +166,6 @@ Oniguruma API Version 6.9.3 2019/07/06
# int onig_new_deluxe(regex_t** reg, const UChar* pattern, const UChar* pattern_end,
OnigCompileInfo* ci, OnigErrorInfo* einfo)
This function is deprecate, and it does not allow the case where
the encoding of pattern and target is different.
Create a regex object.
This function is deluxe version of onig_new().
@@ -187,7 +182,7 @@ Oniguruma API Version 6.9.3 2019/07/06
ci->target_enc: target string character encoding.
ci->syntax: address of pattern syntax definition.
ci->option: compile time option.
ci->case_fold_flag: character matching case fold bit flag for
ci->case_fold_flag: character matching case fold bit flag for
ONIG_OPTION_IGNORECASE mode.
ONIGENC_CASE_FOLD_MIN: minimum
@@ -302,7 +297,6 @@ Oniguruma API Version 6.9.3 2019/07/06
const UChar* range, OnigRegion* region, OnigOptionType option)
Search string and return search result and matching region.
Do not pass invalid byte string in the regex character encoding.
normal return: match position offset (i.e. p - str >= 0)
not found: ONIG_MISMATCH (< 0)
@@ -327,19 +321,15 @@ Oniguruma API Version 6.9.3 2019/07/06
const UChar* start, const UChar* range, OnigRegion* region,
OnigOptionType option, OnigMatchParam* mp)
Search string and return search result and matching region.
Do not pass invalid byte string in the regex character encoding.
arguments
1-7: same as onig_search()
8 mp: match parameter values (match_stack_limit, retry_limit_in_match)
arguments
1-7: same as onig_search()
8 mp: match parameter values (match_stack_limit, retry_limit_in_match)
# int onig_match(regex_t* reg, const UChar* str, const UChar* end, const UChar* at,
OnigRegion* region, OnigOptionType option)
Match string and return result and matching region.
Do not pass invalid byte string in the regex character encoding.
normal return: match length (>= 0)
not match: ONIG_MISMATCH ( < 0)
@@ -361,9 +351,6 @@ Oniguruma API Version 6.9.3 2019/07/06
const UChar* at, OnigRegion* region,
OnigOptionType option, OnigMatchParam* mp)
Match string and return result and matching region.
Do not pass invalid byte string in the regex character encoding.
arguments
1-6: same as onig_match()
7 mp: match parameter values (match_stack_limit, retry_limit_in_match)
@@ -375,7 +362,6 @@ Oniguruma API Version 6.9.3 2019/07/06
void* callback_arg)
Scan string and callback with matching region.
Do not pass invalid byte string in the regex character encoding.
normal return: number of matching times
error: error code
@@ -623,20 +609,14 @@ Oniguruma API Version 6.9.3 2019/07/06
# int onigenc_strlen(OnigEncoding enc, const UChar* s, const UChar* end)
Return number of characters in the string.
# int onigenc_strlen_null(OnigEncoding enc, const UChar* s)
Return number of characters in the string.
Do not pass invalid byte string in the character encoding.
# int onigenc_str_bytelen_null(OnigEncoding enc, const UChar* s)
Return number of bytes in the string.
Do not pass invalid byte string in the character encoding.
# int onig_set_default_syntax(OnigSyntaxType* syntax)
+3 -23
View File
@@ -1,4 +1,4 @@
鬼車インターフェース Version 6.9.3 2019/07/06
鬼車インターフェース Version 6.8.0 2018/03/13
#include <oniguruma.h>
@@ -91,8 +91,6 @@
(alnum, alpha, blank, cntrl, digit, graph,
lower, print, punct, space, upper, xdigit,
word)
ONIG_OPTION_TEXT_SEGMENT_EXTENDED_GRAPHEME_CLUSTER 拡張書記素房モード
ONIG_OPTION_TEXT_SEGMENT_WORD 単語モード
5 enc: 文字エンコーディング
@@ -167,9 +165,6 @@
# int onig_new_deluxe(regex_t** reg, const UChar* pattern, const UChar* pattern_end,
OnigCompileInfo* ci, OnigErrorInfo* einfo)
この関数は廃止予定。
パターンと対象文字列の文字エンコーディングが異なる場合を許さなくなった。
正規表現オブジェクト(regex)を作成する。
この関数は、onig_new()のデラックス版。
@@ -301,7 +296,6 @@
const UChar* range, OnigRegion* region, OnigOptionType option)
正規表現で文字列を検索し、検索結果とマッチ領域を返す。
正規表現オブジェクトの文字エンコーディングで、検索文字列として不正な文字列を渡してはいけない。
正常終了戻り値: マッチ位置 (p - str >= 0)
検索失敗: ONIG_MISMATCH (< 0)
@@ -326,19 +320,15 @@
const UChar* start, const UChar* range, OnigRegion* region,
OnigOptionType option, OnigMatchParam* mp)
正規表現で文字列を検索し、検索結果とマッチ領域を返す。
正規表現オブジェクトの文字エンコーディングで、検索文字列として不正な文字列を渡してはいけない。
引数
1-7: onig_search()と同じ
8 mp: マッチパラメタ値 (match_stack_limit, retry_limit_in_match)
# int onig_match(regex_t* reg, const UChar* str, const UChar* end,
const UChar* at, OnigRegion* region, OnigOptionType option)
# int onig_match(regex_t* reg, const UChar* str, const UChar* end, const UChar* at,
OnigRegion* region, OnigOptionType option)
文字列の指定位置でマッチングを行い、結果とマッチ領域を返す。
正規表現オブジェクトの文字エンコーディングで、検索文字列として不正な文字列を渡してはいけない。
正常終了戻り値: マッチしたバイト長 (>= 0)
not match: ONIG_MISMATCH ( < 0)
@@ -360,9 +350,6 @@
const UChar* at, OnigRegion* region,
OnigOptionType option, OnigMatchParam* mp)
文字列の指定位置でマッチングを行い、結果とマッチ領域を返す。
正規表現オブジェクトの文字エンコーディングで、検索文字列として不正な文字列を渡してはいけない。
引数
1-6: onig_match()と同じ
7 mp: マッチパラメタ値 (match_stack_limit, retry_limit_in_match)
@@ -374,7 +361,6 @@
void* callback_arg)
正規表現で文字列をスキャンして、マッチングする毎にコールバック関数を呼び出す。
正規表現オブジェクトの文字エンコーディングで、検索文字列として不正な文字列を渡してはいけない。
正常終了: マッチ回数 (0回も含める)
エラー: エラーコード (< 0)
@@ -628,20 +614,14 @@
# int onigenc_strlen(OnigEncoding enc, const UChar* s, const UChar* end)
文字列の文字数を返す。
# int onigenc_strlen_null(OnigEncoding enc, const UChar* s)
文字列の文字数を返す。
文字エンコーディングに対して、不正な文字列を渡してはいけない。
# int onigenc_str_bytelen_null(OnigEncoding enc, const UChar* s)
文字列のバイト数を返す。
文字エンコーディングに対して、不正な文字列を渡してはいけない。
# int onig_set_default_syntax(OnigSyntaxType* syntax)
+54 -69
View File
@@ -1,4 +1,4 @@
Oniguruma Regular Expressions Version 6.9.2 2019/03/29
Oniguruma Regular Expressions Version 6.8.0 2018/07/26
syntax: ONIG_SYNTAX_ONIGURUMA (default)
@@ -81,24 +81,16 @@ syntax: ONIG_SYNTAX_ONIGURUMA (default)
\O true anychar (?m:.) (* original function)
\X Text Segment \X === (?>\O(?:\Y\O)*)
\X Extended Grapheme Cluster (?>\O(?:\Y\O)*)
The meaning of this operator changes depending on the setting of
the option (?y{..}).
\X doesn't check whether matching start position is boundary.
Write as \y\X if you want to ensure it.
\X doesn't check whether matching start position is boundary or not.
Please write as \y\X if you want to ensure it.
[Extended Grapheme Cluster mode] (default)
Unicode case:
See [Unicode Standard Annex #29: http://unicode.org/reports/tr29/]
Not Unicode case: \X === (?>\r\n|\O)
[Word mode]
Currently, this mode is supported in Unicode only.
Unicode case:
See [Unicode Standard Annex #29: http://unicode.org/reports/tr29/]
Not Unicode: (?>\r\n|\O)
Character Property
@@ -127,17 +119,17 @@ syntax: ONIG_SYNTAX_ONIGURUMA (default)
? 1 or 0 times
* 0 or more times
+ 1 or more times
{n,m} (n <= m) at least n but no more than m times
{n,m} at least n but no more than m times
{n,} at least n times
{,n} at least 0 but no more than n times ({0,n})
{n} n times
reluctant
?? 0 or 1 times
?? 1 or 0 times
*? 0 or more times
+? 1 or more times
{n,m}? (n <= m) at least n but not more than m times
{n,m}? at least n but not more than m times
{n,}? at least n times
{,n}? at least 0 but not more than n times (== {0,n}?)
@@ -146,10 +138,8 @@ syntax: ONIG_SYNTAX_ONIGURUMA (default)
?+ 1 or 0 times
*+ 0 or more times
++ 1 or more times
{n,m} (n > m) at least m but not more than n times
{n,m}+, {n,}+, {n}+ are possessive operators in ONIG_SYNTAX_JAVA and
ONIG_SYNTAX_PERL only.
({n,m}+, {n,}+, {n}+ are possessive op. in ONIG_SYNTAX_JAVA only)
ex. /a*+/ === /(?>a*)/
@@ -160,6 +150,8 @@ syntax: ONIG_SYNTAX_ONIGURUMA (default)
$ end of the line
\b word boundary
\B non-word boundary
\y Extended Grapheme Cluster boundary
\Y Extended Grapheme Cluster non-boundary
\A beginning of string
\Z end of string, or before newline at the end
@@ -168,24 +160,6 @@ syntax: ONIG_SYNTAX_ONIGURUMA (default)
\K keep (keep start position of the result string)
\y Text Segment boundary
\Y Text Segment non-boundary
The meaning of these operators(\y, \Y) changes depending on the setting
of the option (?y{..}).
[Extended Grapheme Cluster mode] (default)
Unicode case:
See [Unicode Standard Annex #29: http://unicode.org/reports/tr29/]
Not Unicode:
All positions except between \r and \n.
[Word mode]
Currently, this mode is supported in Unicode only.
See [Unicode Standard Annex #29: http://unicode.org/reports/tr29/]
6. Character class
@@ -247,28 +221,20 @@ syntax: ONIG_SYNTAX_ONIGURUMA (default)
(?#...) comment
(?imxWDSPy-imxWDSP:subexp) option on/off for subexp
(?imxWDSP-imxWDSP:subexp) option on/off for subexp
i: ignore case
m: multi-line (dot (.) also matches newline)
x: extended form
W: ASCII only word (\w, \p{Word}, [[:word:]])
ASCII only word bound (\b)
D: ASCII only digit (\d, \p{Digit}, [[:digit:]])
S: ASCII only space (\s, \p{Space}, [[:space:]])
P: ASCII only POSIX properties (includes W,D,S)
(alnum, alpha, blank, cntrl, digit, graph,
lower, print, punct, space, upper, xdigit, word)
i: ignore case
m: multi-line (dot (.) also matches newline)
x: extended form
W: ASCII only word (\w, \p{Word}, [[:word:]])
ASCII only word bound (\b)
D: ASCII only digit (\d, \p{Digit}, [[:digit:]])
S: ASCII only space (\s, \p{Space}, [[:space:]])
P: ASCII only POSIX properties (includes W,D,S)
(alnum, alpha, blank, cntrl, digit, graph,
lower, print, punct, space, upper, xdigit, word)
y{?}: Text Segment mode
This option changes the meaning of \X, \y, \Y.
Currently, this option is supported in Unicode only.
y{g}: Extended Grapheme Cluster mode (default)
y{w}: Word mode
See [Unicode Standard Annex #29]
(?imxWDSPy-imxWDSP) isolated option
(?imxWDSP-imxWDSP) isolated option
* It makes a group to the next ')' or end of the pattern.
/ab(?i)c|def|gh/ == /ab(?i:c|def|gh)/
@@ -370,7 +336,7 @@ syntax: ONIG_SYNTAX_ONIGURUMA (default)
else_exp can be omitted.
Then it works as a backreference validity checker.
[ Backreference validity checker ] (* original)
[ backreference validity checker ] (* original)
(?(n)), (?(-n)), (?(+n)), (?(n+level)) ...
(?(<n>)), (?('-n')), (?(<+n>)) ...
@@ -504,15 +470,10 @@ A-1. Syntax-dependent options
A-2. Original extensions
+ hexadecimal digit char type \h, \H
+ true anychar \O
+ text segment boundary \y, \Y
+ backreference validity checker (?(...))
+ named group (?<name>...), (?'name'...)
+ named backref \k<name>
+ subexp call \g<name>, \g<group-num>
+ absent expression (?~|...|...)
+ absent stopper (?|...)
+ hexadecimal digit char type \h, \H
+ named group (?<name>...), (?'name'...)
+ named backref \k<name>
+ subexp call \g<name>, \g<group-num>
A-3. Missing features compared with perl 5.8.0
@@ -567,4 +528,28 @@ A-4. Differences with Japanized GNU regex(version 0.12) of Ruby 1.8
/(?:()|())*\1\2/ =~ ""
/(?:\1a|())*/ =~ "a"
A-5. Features disabled in default syntax
+ capture history
(?@...) and (?@<name>...)
ex. /(?@a)*/.match("aaa") ==> [<0-1>, <1-2>, <2-3>]
see sample/listcap.c file.
A-6. Problems
+ Invalid encoding byte sequence is not checked.
ex. UTF-8
* Invalid first byte is treated as a character.
/./u =~ "\xa3"
* Incomplete byte sequence is not checked.
/\w+/ =~ "a\xf3\x8ec"
// END
+46 -50
View File
@@ -1,4 +1,4 @@
鬼車 正規表現 Version 6.9.2 2019/03/29
鬼車 正規表現 Version 6.8.0 2018/07/26
使用文法: ONIG_SYNTAX_ONIGURUMA (既定値)
@@ -54,7 +54,7 @@
\t, \n, \v, \f, \r, \x20
Unicodeの場合:
U+0009, U+000A, U+000B, U+000C, U+000D, U+0085(NEL),
U+0009, U+000A, U+000B, U+000C, U+000D, U+0085(NEL),
General_Category -- Line_Separator
-- Paragraph_Separator
-- Space_Separator
@@ -81,23 +81,16 @@
\O 真任意文字 (?m:.) (* 原作)
\X 文章区分 \X === (?>\O(?:\Y\O)*)
\X 拡張書記素房 (?>\O(?:\Y\O)*)
この演算子の意味は、オプション (?y{..})の設定によって変化する。
\Xは照合の開始位置が区分の境界かどうかを確認しない。
\Xは照合の開始位置が拡張書記素房の境界かどうかを確認しない。
それを確実にしたければ、\y\Xと書けば良い。
[拡張書記素房-状態のとき] (デフォルト)
Unicodeの場合:
参照 [Unicode Standard Annex #29: http://unicode.org/reports/tr29/]
Unicode以外の場合: \X === (?>\r\n|\O)
[単語-状態のとき]
現在、Unicodeしかサポートしていない。
Unicodeの場合:
参照 [Unicode Standard Annex #29: http://unicode.org/reports/tr29/]
Unicode以外の場合: (?>\r\n|\O)
Character Property
@@ -126,17 +119,17 @@
? 一回または零回
* 零回以上
+ 一回以上
{n,m} (n <= m) n回以上 かつ m回以下
{n,m} n回以上m回以下
{n,} n回以上
{,n} 零回以上n回以下 ({0,n})
{n} n回
無欲
?? 零回または一回
?? 一回または零回
*? 零回以上
+? 一回以上
{n,m}? (n <= m) n回以上 かつ m回以下
{n,m}? n回以上m回以下
{n,}? n回以上
{,n}? 零回以上n回以下 (== {0,n}?)
@@ -145,9 +138,8 @@
?+ 一回または零回
*+ 零回以上
++ 一回以上
{n,m} (n > m) m回以上 かつ n回以下
{n,m}+, {n,}+, {n}+ は、ONIG_SYNTAX_JAVAとONIG_SYNTAX_PERLでのみ強欲な指定子
({n,m}+, {n,}+, {n}+ は、ONIG_SYNTAX_JAVAでのみ強欲な指定子)
例. /a*+/ === /(?>a*)/
@@ -158,6 +150,8 @@
$ 行末
\b 単語境界
\B 非単語境界
\y 拡張書記素房 境界
\Y 拡張書記素房 非境界
\A 文字列先頭
\Z 文字列末尾、または文字列末尾の改行の直前
@@ -166,23 +160,6 @@
\K 保持 (結果の開始位置をこの位置に保つ)
\y 文章区分 境界
\Y 文章区分 非境界
この演算子の意味は、オプション (?y{..})の設定によって変化する。
[拡張書記素房-状態のとき] (デフォルト)
Unicodeの場合:
参照 [Unicode Standard Annex #29: http://unicode.org/reports/tr29/]
Unicode以外の場合:
\rと\nの間を除く全ての位置
[単語-状態のとき]
現在、Unicodeしかサポートしていない。
参照 [Unicode Standard Annex #29: http://unicode.org/reports/tr29/]
6. 文字集合
@@ -243,7 +220,7 @@
(?#...) 注釈
(?imxWDSPy-imxWDSP:式) 式オプション
(?imxWDSP-imxWDSP:式) 式オプション
i: 大文字小文字照合
m: 複数行
@@ -256,14 +233,7 @@
(alnum, alpha, blank, cntrl, digit, graph,
lower, print, punct, space, upper, xdigit, word)
y{?}: 文章区分状態
このオプションは\X, \y, \Yの意味を変更する。
現在このオプションはUnicodeでしかサポートしていない
y{g}: 拡張書記素房-状態 (デフォルト)
y{w}: 単語-状態
参照 [Unicode Standard Annex #29]
(?imxWDSPy-imxWDSP) 孤立オプション
(?imxWDSP-imxWDSP) 孤立オプション
* これは次の')'またはパターンの終わりまでのグループを形成する
/ab(?i)c|def|gh/ == /ab(?i:c|def|gh)/
@@ -512,14 +482,9 @@
補記 2. 独自拡張機能
+ 16進数数字、非16進数字 \h, \H
+ 真任意文字 \O
+ 文章区分境界 \y, \Y
+ 後方参照値有効性確認器 (?(...))
+ 名前付き捕獲式集合 (?<name>...), (?'name'...)
+ 名前指定後方参照 \k<name>
+ 部分式呼出し \g<name>, \g<group-num>
+ 不在式 (?~|...|...)
+ 不在停止 (?|...)
補記 3. Perl 5.8.0と比較して存在しない機能
@@ -574,4 +539,35 @@
/(?:()|())*\1\2/ =~ ""
/(?:\1a|())*/ =~ "a"
補記 5. 実装されているが、既定値では有効にしていない機能
+ 捕獲履歴参照
(?@...) と (?@<name>...)
例. /(?@a)*/.match("aaa") ==> [<0-1>, <1-2>, <2-3>]
使用方法は、sample/listcap.cを参照
有効にしていない理由は、どの程度役に立つかはっきりしないため。
補記 6. 問題点
+ エンコーディングバイト値が適正な価かどうかのチェックは行なっていない。
例: UTF-8
* 先頭バイトとして不正なバイトを一文字とみなす
/./u =~ "\xa3"
* 不完全なバイトシーケンスのチェックをしない
/\w+/u =~ "a\xf3\x8ec"
これを調べることは可能ではあるが、遅くなるので行なわない。
文字列として、そのようなバイト列を指定した場合の動作は保証しない。
終り
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+1 -4
View File
@@ -8,7 +8,7 @@
<h1>Oniguruma</h1> (<a href="index_ja.html">Japanese</a>)
<p>
(c) K.Kosako, updated at: 2019/08/05
(c) K.Kosako, updated at: 2018/08/31
</p>
<dl>
@@ -16,9 +16,6 @@
<dt><b>What's new</b>
</font>
<ul>
<li>2019/08/06: Version 6.9.3 released.</li>
<li>2019/05/07: Version 6.9.2 released.</li>
<li>2018/12/11: Version 6.9.1 released.</li>
<li>2018/09/03: Version 6.9.0 released.</li>
<li>2018/04/17: Version 6.8.2 released.</li>
<li>2018/03/19: Version 6.8.1 released.</li>
+1 -4
View File
@@ -8,7 +8,7 @@
<h1>鬼車</h1>
<p>
(c) K.Kosako, 最終更新: 2019/08/05
(c) K.Kosako, 最終更新: 2018/09/03
</p>
<dl>
@@ -16,9 +16,6 @@
<dt><b>更新情報</b>
</font>
<ul>
<li>2019/08/06: Version 6.9.3 リリース</li>
<li>2019/05/07: Version 6.9.2 リリース</li>
<li>2018/12/11: Version 6.9.1 リリース</li>
<li>2018/09/03: Version 6.9.0 リリース</li>
<li>2018/04/17: Version 6.8.2 リリース</li>
<li>2018/03/19: Version 6.8.1 リリース</li>
+1 -1
View File
@@ -113,6 +113,6 @@ OnigEncodingType OnigEncodingASCII = {
init,
0, /* is_initialized */
onigenc_always_true_is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1,
ENC_FLAG_ASCII_COMPATIBLE,
0, 0
};
+5 -5
View File
@@ -102,7 +102,7 @@ big5_mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end,
#if 0
static int
big5_is_mbc_ambiguous(OnigCaseFoldType flag,
const UChar** pp, const UChar* end)
const UChar** pp, const UChar* end)
{
return onigenc_mbn_is_mbc_ambiguous(ONIG_ENCODING_BIG5, flag, pp, end);
}
@@ -148,10 +148,10 @@ big5_left_adjust_char_head(const UChar* start, const UChar* s)
if (BIG5_ISMB_TRAIL(*p)) {
while (p > start) {
if (! BIG5_ISMB_FIRST(*--p)) {
p++;
break;
p++;
break;
}
}
}
}
len = enclen(ONIG_ENCODING_BIG5, p);
if (p + len > s) return (UChar* )p;
@@ -187,6 +187,6 @@ OnigEncodingType OnigEncodingBIG5 = {
NULL, /* init */
NULL, /* is_initialized */
is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1,
ENC_FLAG_ASCII_COMPATIBLE,
0, 0
};
+4 -4
View File
@@ -164,7 +164,7 @@ static const OnigPairCaseFoldCodes CaseFoldMap[] = {
static int
cp1251_apply_all_case_fold(OnigCaseFoldType flag,
OnigApplyAllCaseFoldFunc f, void* arg)
OnigApplyAllCaseFoldFunc f, void* arg)
{
return onigenc_apply_all_case_fold_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
@@ -176,8 +176,8 @@ cp1251_get_case_fold_codes_by_str(OnigCaseFoldType flag,
const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
{
return onigenc_get_case_fold_codes_by_str_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
flag, p, end, items);
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
flag, p, end, items);
}
OnigEncodingType OnigEncodingCP1251 = {
@@ -200,6 +200,6 @@ OnigEncodingType OnigEncodingCP1251 = {
NULL, /* init */
NULL, /* is_initialized */
onigenc_always_true_is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1,
ENC_FLAG_ASCII_COMPATIBLE,
0, 0
};
+4 -4
View File
@@ -151,13 +151,13 @@ code_to_mbc(OnigCodePoint code, UChar *buf)
#if 1
if (enclen(ONIG_ENCODING_EUC_JP, buf) != (p - buf))
return ONIGERR_INVALID_CODE_POINT_VALUE;
#endif
#endif
return (int )(p - buf);
}
static int
mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED,
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
{
int len;
const UChar* p = *pp;
@@ -269,7 +269,7 @@ is_code_ctype(OnigCodePoint code, unsigned int ctype)
static int
get_ctype_code_range(OnigCtype ctype, OnigCodePoint* sb_out,
const OnigCodePoint* ranges[])
const OnigCodePoint* ranges[])
{
if (ctype <= ONIGENC_MAX_STD_CTYPE) {
return ONIG_NO_SUPPORT_CONFIG;
@@ -307,6 +307,6 @@ OnigEncodingType OnigEncodingEUC_JP = {
NULL, /* init */
NULL, /* is_initialized */
is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1_OR_0,
ENC_FLAG_ASCII_COMPATIBLE,
0, 0
};
+1 -1
View File
@@ -1,5 +1,5 @@
/* ANSI-C code produced by gperf version 3.1 */
/* Command-line: /usr/local/bin/gperf -pt -T -L ANSI-C -N onigenc_euc_jp_lookup_property_name --output-file gperf1.tmp euc_jp_prop.gperf */
/* Command-line: /usr/bin/gperf -pt -T -L ANSI-C -N onigenc_euc_jp_lookup_property_name --output-file gperf1.tmp euc_jp_prop.gperf */
/* Computed positions: -k'1,3' */
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
+4 -6
View File
@@ -68,7 +68,7 @@ is_valid_mbc_string(const UChar* p, const UChar* end)
p++;
if (p >= end) return FALSE;
if (*p < 0xa1 || *p == 0xff)
return FALSE;
return FALSE;
p++;
}
else
@@ -101,7 +101,7 @@ euckr_mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end,
#if 0
static int
euckr_is_mbc_ambiguous(OnigCaseFoldType flag,
const UChar** pp, const UChar* end)
const UChar** pp, const UChar* end)
{
return onigenc_mbn_is_mbc_ambiguous(ONIG_ENCODING_EUC_KR, flag, pp, end);
}
@@ -161,9 +161,7 @@ OnigEncodingType OnigEncodingEUC_KR = {
euckr_is_allowed_reverse_match,
NULL, /* init */
NULL, /* is_initialized */
is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1_OR_0,
0, 0
is_valid_mbc_string
};
/* Same with OnigEncodingEUC_KR except the name */
@@ -187,6 +185,6 @@ OnigEncodingType OnigEncodingEUC_CN = {
NULL, /* init */
NULL, /* is_initialized */
is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1_OR_0,
ENC_FLAG_ASCII_COMPATIBLE,
0, 0
};
+15 -15
View File
@@ -63,27 +63,27 @@ is_valid_mbc_string(const UChar* p, const UChar* end)
}
else if (*p < 0xa1) {
if (*p == 0x8e) {
p++;
if (p >= end) return FALSE;
if (*p < 0xa1 || *p > 0xb0) return FALSE;
p++;
if (p >= end) return FALSE;
if (*p < 0xa1 || *p == 0xff)
return FALSE;
p++;
if (p >= end) return FALSE;
if (*p < 0xa1 || *p == 0xff)
return FALSE;
p++;
p++;
if (p >= end) return FALSE;
if (*p < 0xa1 || *p > 0xb0) return FALSE;
p++;
if (p >= end) return FALSE;
if (*p < 0xa1 || *p == 0xff)
return FALSE;
p++;
if (p >= end) return FALSE;
if (*p < 0xa1 || *p == 0xff)
return FALSE;
p++;
}
else
return FALSE;
return FALSE;
}
else if (*p < 0xff) {
p++;
if (p >= end) return FALSE;
if (*p < 0xa1 || *p == 0xff)
return FALSE;
return FALSE;
p++;
}
else
@@ -168,6 +168,6 @@ OnigEncodingType OnigEncodingEUC_TW = {
NULL, /* init */
NULL, /* is_initialized */
is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1,
ENC_FLAG_ASCII_COMPATIBLE,
0, 0
};
+4 -4
View File
@@ -2,7 +2,7 @@
gb18030.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2005-2019 KUBO Takehiro <kubo AT jiubao DOT org>
* Copyright (c) 2005-2018 KUBO Takehiro <kubo AT jiubao DOT org>
* K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
@@ -67,11 +67,11 @@ gb18030_mbc_enc_len(const UChar* p)
{
if (GB18030_MAP[*p] != CM)
return 1;
p++;
if (GB18030_MAP[*p] == C4)
return 4;
if (GB18030_MAP[*p] == C1)
return 1; /* illegal sequence */
return 2;
}
@@ -535,6 +535,6 @@ OnigEncodingType OnigEncodingGB18030 = {
NULL, /* init */
NULL, /* is_initialized */
is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1,
ENC_FLAG_ASCII_COMPATIBLE,
0, 0
};
+9 -8
View File
@@ -103,7 +103,7 @@ static const OnigPairCaseFoldCodes CaseFoldMap[] = {
static int
apply_all_case_fold(OnigCaseFoldType flag,
OnigApplyAllCaseFoldFunc f, void* arg)
OnigApplyAllCaseFoldFunc f, void* arg)
{
return onigenc_apply_all_case_fold_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
@@ -112,15 +112,15 @@ apply_all_case_fold(OnigCaseFoldType flag,
static int
get_case_fold_codes_by_str(OnigCaseFoldType flag ARG_UNUSED,
const OnigUChar* p, const OnigUChar* end,
OnigCaseFoldCodeItem items[])
const OnigUChar* p, const OnigUChar* end,
OnigCaseFoldCodeItem items[])
{
if (0x41 <= *p && *p <= 0x5a) {
items[0].byte_len = 1;
items[0].code_len = 1;
items[0].code[0] = (OnigCodePoint )(*p + 0x20);
if (*p == 0x53 && end > p + 1
&& (*(p+1) == 0x53 || *(p+1) == 0x73)) { /* SS */
&& (*(p+1) == 0x53 || *(p+1) == 0x73)) { /* SS */
items[1].byte_len = 2;
items[1].code_len = 1;
items[1].code[0] = (OnigCodePoint )0xdf;
@@ -134,7 +134,7 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag ARG_UNUSED,
items[0].code_len = 1;
items[0].code[0] = (OnigCodePoint )(*p - 0x20);
if (*p == 0x73 && end > p + 1
&& (*(p+1) == 0x73 || *(p+1) == 0x53)) { /* ss */
&& (*(p+1) == 0x73 || *(p+1) == 0x53)) { /* ss */
items[1].byte_len = 2;
items[1].code_len = 1;
items[1].code[0] = (OnigCodePoint )0xdf;
@@ -200,7 +200,7 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag ARG_UNUSED,
static int
mbc_case_fold(OnigCaseFoldType flag, const UChar** pp,
const UChar* end ARG_UNUSED, UChar* lower)
const UChar* end ARG_UNUSED, UChar* lower)
{
const UChar* p = *pp;
@@ -218,7 +218,8 @@ mbc_case_fold(OnigCaseFoldType flag, const UChar** pp,
#if 0
static int
is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end)
is_mbc_ambiguous(OnigCaseFoldType flag,
const UChar** pp, const UChar* end)
{
int v;
const UChar* p = *pp;
@@ -271,6 +272,6 @@ OnigEncodingType OnigEncodingISO_8859_1 = {
NULL, /* init */
NULL, /* is_initialized */
onigenc_always_true_is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1,
ENC_FLAG_ASCII_COMPATIBLE,
0, 0
};
+5 -5
View File
@@ -105,7 +105,7 @@ static const unsigned short EncISO_8859_10_CtypeTable[256] = {
static int
mbc_case_fold(OnigCaseFoldType flag,
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
{
const UChar* p = *pp;
@@ -203,7 +203,7 @@ static const OnigPairCaseFoldCodes CaseFoldMap[] = {
static int
apply_all_case_fold(OnigCaseFoldType flag,
OnigApplyAllCaseFoldFunc f, void* arg)
OnigApplyAllCaseFoldFunc f, void* arg)
{
return onigenc_apply_all_case_fold_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
@@ -215,8 +215,8 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag,
const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
{
return onigenc_get_case_fold_codes_by_str_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
}
OnigEncodingType OnigEncodingISO_8859_10 = {
@@ -239,6 +239,6 @@ OnigEncodingType OnigEncodingISO_8859_10 = {
NULL, /* init */
NULL, /* is_initialized */
onigenc_always_true_is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1,
ENC_FLAG_ASCII_COMPATIBLE,
0, 0
};
+1 -1
View File
@@ -96,6 +96,6 @@ OnigEncodingType OnigEncodingISO_8859_11 = {
NULL, /* init */
NULL, /* is_initialized */
onigenc_always_true_is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1,
ENC_FLAG_ASCII_COMPATIBLE,
0, 0
};
+5 -5
View File
@@ -105,7 +105,7 @@ static const unsigned short EncISO_8859_13_CtypeTable[256] = {
static int
mbc_case_fold(OnigCaseFoldType flag,
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
{
const UChar* p = *pp;
@@ -192,7 +192,7 @@ static const OnigPairCaseFoldCodes CaseFoldMap[] = {
static int
apply_all_case_fold(OnigCaseFoldType flag,
OnigApplyAllCaseFoldFunc f, void* arg)
OnigApplyAllCaseFoldFunc f, void* arg)
{
return onigenc_apply_all_case_fold_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
@@ -204,8 +204,8 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag,
const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
{
return onigenc_get_case_fold_codes_by_str_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
}
OnigEncodingType OnigEncodingISO_8859_13 = {
@@ -228,6 +228,6 @@ OnigEncodingType OnigEncodingISO_8859_13 = {
NULL, /* init */
NULL, /* is_initialized */
onigenc_always_true_is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1,
ENC_FLAG_ASCII_COMPATIBLE,
0, 0
};
+6 -6
View File
@@ -105,7 +105,7 @@ static const unsigned short EncISO_8859_14_CtypeTable[256] = {
static int
mbc_case_fold(OnigCaseFoldType flag,
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
{
const UChar* p = *pp;
@@ -124,7 +124,7 @@ mbc_case_fold(OnigCaseFoldType flag,
#if 0
static int
is_mbc_ambiguous(OnigCaseFoldType flag,
const UChar** pp, const UChar* end)
const UChar** pp, const UChar* end)
{
int v;
const UChar* p = *pp;
@@ -205,7 +205,7 @@ static const OnigPairCaseFoldCodes CaseFoldMap[] = {
static int
apply_all_case_fold(OnigCaseFoldType flag,
OnigApplyAllCaseFoldFunc f, void* arg)
OnigApplyAllCaseFoldFunc f, void* arg)
{
return onigenc_apply_all_case_fold_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
@@ -217,8 +217,8 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag,
const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
{
return onigenc_get_case_fold_codes_by_str_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
}
OnigEncodingType OnigEncodingISO_8859_14 = {
@@ -241,6 +241,6 @@ OnigEncodingType OnigEncodingISO_8859_14 = {
NULL, /* init */
NULL, /* is_initialized */
onigenc_always_true_is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1,
ENC_FLAG_ASCII_COMPATIBLE,
0, 0
};
+7 -6
View File
@@ -105,7 +105,7 @@ static const unsigned short EncISO_8859_15_CtypeTable[256] = {
static int
mbc_case_fold(OnigCaseFoldType flag,
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
{
const UChar* p = *pp;
@@ -123,7 +123,8 @@ mbc_case_fold(OnigCaseFoldType flag,
#if 0
static int
is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end)
is_mbc_ambiguous(OnigCaseFoldType flag,
const UChar** pp, const UChar* end)
{
int v;
const UChar* p = *pp;
@@ -198,7 +199,7 @@ static const OnigPairCaseFoldCodes CaseFoldMap[] = {
static int
apply_all_case_fold(OnigCaseFoldType flag,
OnigApplyAllCaseFoldFunc f, void* arg)
OnigApplyAllCaseFoldFunc f, void* arg)
{
return onigenc_apply_all_case_fold_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
@@ -210,8 +211,8 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag,
const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
{
return onigenc_get_case_fold_codes_by_str_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
}
OnigEncodingType OnigEncodingISO_8859_15 = {
@@ -234,6 +235,6 @@ OnigEncodingType OnigEncodingISO_8859_15 = {
NULL, /* init */
NULL, /* is_initialized */
onigenc_always_true_is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1,
ENC_FLAG_ASCII_COMPATIBLE,
0, 0
};
+5 -5
View File
@@ -105,7 +105,7 @@ static const unsigned short EncISO_8859_16_CtypeTable[256] = {
static int
mbc_case_fold(OnigCaseFoldType flag,
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
{
const UChar* p = *pp;
@@ -201,7 +201,7 @@ static const OnigPairCaseFoldCodes CaseFoldMap[] = {
static int
apply_all_case_fold(OnigCaseFoldType flag,
OnigApplyAllCaseFoldFunc f, void* arg)
OnigApplyAllCaseFoldFunc f, void* arg)
{
return onigenc_apply_all_case_fold_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
@@ -213,8 +213,8 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag,
const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
{
return onigenc_get_case_fold_codes_by_str_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
}
OnigEncodingType OnigEncodingISO_8859_16 = {
@@ -237,6 +237,6 @@ OnigEncodingType OnigEncodingISO_8859_16 = {
NULL, /* init */
NULL, /* is_initialized */
onigenc_always_true_is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1,
ENC_FLAG_ASCII_COMPATIBLE,
0, 0
};
+5 -5
View File
@@ -105,7 +105,7 @@ static const unsigned short EncISO_8859_2_CtypeTable[256] = {
static int
mbc_case_fold(OnigCaseFoldType flag,
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
{
const UChar* p = *pp;
@@ -190,7 +190,7 @@ static const OnigPairCaseFoldCodes CaseFoldMap[] = {
static int
apply_all_case_fold(OnigCaseFoldType flag,
OnigApplyAllCaseFoldFunc f, void* arg)
OnigApplyAllCaseFoldFunc f, void* arg)
{
return onigenc_apply_all_case_fold_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
@@ -202,8 +202,8 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag,
const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
{
return onigenc_get_case_fold_codes_by_str_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
}
static int
@@ -235,6 +235,6 @@ OnigEncodingType OnigEncodingISO_8859_2 = {
NULL, /* init */
NULL, /* is_initialized */
onigenc_always_true_is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1,
ENC_FLAG_ASCII_COMPATIBLE,
0, 0
};
+5 -5
View File
@@ -105,7 +105,7 @@ static const unsigned short EncISO_8859_3_CtypeTable[256] = {
static int
mbc_case_fold(OnigCaseFoldType flag, const UChar** pp,
const UChar* end ARG_UNUSED, UChar* lower)
const UChar* end ARG_UNUSED, UChar* lower)
{
const UChar* p = *pp;
@@ -199,7 +199,7 @@ static const OnigPairCaseFoldCodes CaseFoldMap[] = {
static int
apply_all_case_fold(OnigCaseFoldType flag,
OnigApplyAllCaseFoldFunc f, void* arg)
OnigApplyAllCaseFoldFunc f, void* arg)
{
return onigenc_apply_all_case_fold_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
@@ -211,8 +211,8 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag,
const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
{
return onigenc_get_case_fold_codes_by_str_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
}
OnigEncodingType OnigEncodingISO_8859_3 = {
@@ -235,6 +235,6 @@ OnigEncodingType OnigEncodingISO_8859_3 = {
NULL, /* init */
NULL, /* is_initialized */
onigenc_always_true_is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1,
ENC_FLAG_ASCII_COMPATIBLE,
0, 0
};
+5 -5
View File
@@ -105,7 +105,7 @@ static const unsigned short EncISO_8859_4_CtypeTable[256] = {
static int
mbc_case_fold(OnigCaseFoldType flag,
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
{
const UChar* p = *pp;
@@ -201,7 +201,7 @@ static const OnigPairCaseFoldCodes CaseFoldMap[] = {
static int
apply_all_case_fold(OnigCaseFoldType flag,
OnigApplyAllCaseFoldFunc f, void* arg)
OnigApplyAllCaseFoldFunc f, void* arg)
{
return onigenc_apply_all_case_fold_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
@@ -213,8 +213,8 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag,
const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
{
return onigenc_get_case_fold_codes_by_str_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
}
OnigEncodingType OnigEncodingISO_8859_4 = {
@@ -237,6 +237,6 @@ OnigEncodingType OnigEncodingISO_8859_4 = {
NULL, /* init */
NULL, /* is_initialized */
onigenc_always_true_is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1,
ENC_FLAG_ASCII_COMPATIBLE,
0, 0
};
+7 -7
View File
@@ -105,7 +105,7 @@ static const unsigned short EncISO_8859_5_CtypeTable[256] = {
static int
mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED,
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
{
const UChar* p = *pp;
@@ -189,7 +189,7 @@ static const OnigPairCaseFoldCodes CaseFoldMap[] = {
static int
apply_all_case_fold(OnigCaseFoldType flag,
OnigApplyAllCaseFoldFunc f, void* arg)
OnigApplyAllCaseFoldFunc f, void* arg)
{
return onigenc_apply_all_case_fold_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
@@ -198,12 +198,12 @@ apply_all_case_fold(OnigCaseFoldType flag,
static int
get_case_fold_codes_by_str(OnigCaseFoldType flag,
const OnigUChar* p, const OnigUChar* end,
OnigCaseFoldCodeItem items[])
const OnigUChar* p, const OnigUChar* end,
OnigCaseFoldCodeItem items[])
{
return onigenc_get_case_fold_codes_by_str_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
flag, p, end, items);
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
flag, p, end, items);
}
OnigEncodingType OnigEncodingISO_8859_5 = {
@@ -226,6 +226,6 @@ OnigEncodingType OnigEncodingISO_8859_5 = {
NULL, /* init */
NULL, /* is_initialized */
onigenc_always_true_is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1,
ENC_FLAG_ASCII_COMPATIBLE,
0, 0
};
+1 -1
View File
@@ -96,6 +96,6 @@ OnigEncodingType OnigEncodingISO_8859_6 = {
NULL, /* init */
NULL, /* is_initialized */
onigenc_always_true_is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1,
ENC_FLAG_ASCII_COMPATIBLE,
0, 0
};
+7 -6
View File
@@ -105,7 +105,7 @@ static const unsigned short EncISO_8859_7_CtypeTable[256] = {
static int
mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED,
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
{
const UChar* p = *pp;
@@ -116,7 +116,8 @@ mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED,
#if 0
static int
is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end)
is_mbc_ambiguous(OnigCaseFoldType flag,
const UChar** pp, const UChar* end)
{
int v;
const UChar* p = *pp;
@@ -184,7 +185,7 @@ static const OnigPairCaseFoldCodes CaseFoldMap[] = {
static int
apply_all_case_fold(OnigCaseFoldType flag,
OnigApplyAllCaseFoldFunc f, void* arg)
OnigApplyAllCaseFoldFunc f, void* arg)
{
return onigenc_apply_all_case_fold_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
@@ -196,8 +197,8 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag,
const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
{
return onigenc_get_case_fold_codes_by_str_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
flag, p, end, items);
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
flag, p, end, items);
}
@@ -221,6 +222,6 @@ OnigEncodingType OnigEncodingISO_8859_7 = {
NULL, /* init */
NULL, /* is_initialized */
onigenc_always_true_is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1,
ENC_FLAG_ASCII_COMPATIBLE,
0, 0
};
+1 -1
View File
@@ -96,6 +96,6 @@ OnigEncodingType OnigEncodingISO_8859_8 = {
NULL, /* init */
NULL, /* is_initialized */
onigenc_always_true_is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1,
ENC_FLAG_ASCII_COMPATIBLE,
0, 0
};
+5 -5
View File
@@ -105,7 +105,7 @@ static const unsigned short EncISO_8859_9_CtypeTable[256] = {
static int
mbc_case_fold(OnigCaseFoldType flag,
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
{
const UChar* p = *pp;
@@ -192,7 +192,7 @@ static const OnigPairCaseFoldCodes CaseFoldMap[] = {
static int
apply_all_case_fold(OnigCaseFoldType flag,
OnigApplyAllCaseFoldFunc f, void* arg)
OnigApplyAllCaseFoldFunc f, void* arg)
{
return onigenc_apply_all_case_fold_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
@@ -204,8 +204,8 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag,
const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
{
return onigenc_get_case_fold_codes_by_str_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
}
OnigEncodingType OnigEncodingISO_8859_9 = {
@@ -228,6 +228,6 @@ OnigEncodingType OnigEncodingISO_8859_9 = {
NULL, /* init */
NULL, /* is_initialized */
onigenc_always_true_is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1,
ENC_FLAG_ASCII_COMPATIBLE,
0, 0
};
+5 -5
View File
@@ -106,7 +106,7 @@ static const unsigned short EncKOI8_CtypeTable[256] = {
static int
koi8_mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED,
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
{
const UChar* p = *pp;
@@ -214,7 +214,7 @@ static const OnigPairCaseFoldCodes CaseFoldMap[] = {
static int
koi8_apply_all_case_fold(OnigCaseFoldType flag,
OnigApplyAllCaseFoldFunc f, void* arg)
OnigApplyAllCaseFoldFunc f, void* arg)
{
return onigenc_apply_all_case_fold_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
@@ -226,8 +226,8 @@ koi8_get_case_fold_codes_by_str(OnigCaseFoldType flag,
const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
{
return onigenc_get_case_fold_codes_by_str_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
flag, p, end, items);
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
flag, p, end, items);
}
OnigEncodingType OnigEncodingKOI8 = {
@@ -250,6 +250,6 @@ OnigEncodingType OnigEncodingKOI8 = {
NULL, /* init */
NULL, /* is_initialized */
onigenc_always_true_is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1,
ENC_FLAG_ASCII_COMPATIBLE,
0, 0
};
+4 -4
View File
@@ -176,7 +176,7 @@ static const OnigPairCaseFoldCodes CaseFoldMap[] = {
static int
koi8_r_apply_all_case_fold(OnigCaseFoldType flag,
OnigApplyAllCaseFoldFunc f, void* arg)
OnigApplyAllCaseFoldFunc f, void* arg)
{
return onigenc_apply_all_case_fold_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
@@ -188,8 +188,8 @@ koi8_r_get_case_fold_codes_by_str(OnigCaseFoldType flag,
const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
{
return onigenc_get_case_fold_codes_by_str_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
flag, p, end, items);
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
flag, p, end, items);
}
OnigEncodingType OnigEncodingKOI8_R = {
@@ -212,6 +212,6 @@ OnigEncodingType OnigEncodingKOI8_R = {
NULL, /* init */
NULL, /* is_initialized */
onigenc_always_true_is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1,
ENC_FLAG_ASCII_COMPATIBLE,
0, 0
};
+15 -15
View File
@@ -2,7 +2,7 @@
mktable.c
**********************************************************************/
/*-
* Copyright (c) 2002-2019 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2016 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -269,7 +269,7 @@ static int IsBlank(int enc, int c)
if (enc == ASCII)
return isblank(c);
if (c == 0x09 || c == 0x20) return 1;
if (c == 0x09 || c == 0x20) return 1;
switch (enc) {
case UNICODE_ISO_8859_1:
@@ -308,7 +308,7 @@ static int IsCntrl(int enc, int c)
if (enc == ASCII)
return iscntrl(c);
if (c >= 0x00 && c <= 0x1F) return 1;
if (c >= 0x00 && c <= 0x1F) return 1;
switch (enc) {
case UNICODE_ISO_8859_1:
@@ -376,10 +376,10 @@ static int IsGraph(int enc, int c)
case ISO_8859_3:
if (c >= 0xa1) {
if (c == 0xa5 || c == 0xae || c == 0xbe || c == 0xc3 || c == 0xd0 ||
c == 0xe3 || c == 0xf0)
return 0;
c == 0xe3 || c == 0xf0)
return 0;
else
return 1;
return 1;
}
break;
@@ -392,8 +392,8 @@ static int IsGraph(int enc, int c)
case ISO_8859_7:
if (c >= 0xa1 && c <= 0xfe &&
c != 0xa4 && c != 0xa5 && c != 0xaa &&
c != 0xae && c != 0xd2) return 1;
c != 0xa4 && c != 0xa5 && c != 0xaa &&
c != 0xae && c != 0xd2) return 1;
break;
case ISO_8859_8:
@@ -583,10 +583,10 @@ static int IsPrint(int enc, int c)
case ISO_8859_3:
if (c >= 0xa0) {
if (c == 0xa5 || c == 0xae || c == 0xbe || c == 0xc3 || c == 0xd0 ||
c == 0xe3 || c == 0xf0)
return 0;
c == 0xe3 || c == 0xf0)
return 0;
else
return 1;
return 1;
}
break;
@@ -600,8 +600,8 @@ static int IsPrint(int enc, int c)
case ISO_8859_7:
if (c >= 0xa0 && c <= 0xfe &&
c != 0xa4 && c != 0xa5 && c != 0xaa &&
c != 0xae && c != 0xd2) return 1;
c != 0xa4 && c != 0xa5 && c != 0xaa &&
c != 0xae && c != 0xd2) return 1;
break;
case ISO_8859_8:
@@ -1012,7 +1012,7 @@ static int IsWord(int enc, int c)
case ISO_8859_10:
if (c >= 0xa1 && c <= 0xff) {
if (c != 0xa7 && c != 0xad && c != 0xb0 && c != 0xb7 && c != 0xbd)
return 1;
return 1;
}
break;
@@ -1037,7 +1037,7 @@ static int IsWord(int enc, int c)
case ISO_8859_14:
if (c >= 0xa1 && c <= 0xff) {
if (c == 0xa3 || c == 0xa7 || c == 0xa9 || c == 0xad || c == 0xae ||
c == 0xb6) return 0;
c == 0xb6) return 0;
return 1;
}
break;
+5 -16
View File
@@ -4,7 +4,7 @@
oniguruma.h - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2019 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -36,9 +36,9 @@ extern "C" {
#define ONIGURUMA
#define ONIGURUMA_VERSION_MAJOR 6
#define ONIGURUMA_VERSION_MINOR 9
#define ONIGURUMA_VERSION_TEENY 3
#define ONIGURUMA_VERSION_TEENY 0
#define ONIGURUMA_VERSION_INT 60903
#define ONIGURUMA_VERSION_INT 60900
#ifndef P_
#if defined(__STDC__) || defined(_WIN32)
@@ -52,7 +52,6 @@ extern "C" {
# define PV_(args) args
#endif
#ifndef ONIG_STATIC
#ifndef ONIG_EXTERN
#if defined(_WIN32) && !defined(__GNUC__)
#if defined(ONIGURUMA_EXPORT)
@@ -66,9 +65,6 @@ extern "C" {
#ifndef ONIG_EXTERN
#define ONIG_EXTERN extern
#endif
#else
#define ONIG_EXTERN extern
#endif
/* PART: character encoding */
@@ -389,10 +385,8 @@ typedef unsigned int OnigOptionType;
#define ONIG_OPTION_DIGIT_IS_ASCII (ONIG_OPTION_WORD_IS_ASCII << 1)
#define ONIG_OPTION_SPACE_IS_ASCII (ONIG_OPTION_DIGIT_IS_ASCII << 1)
#define ONIG_OPTION_POSIX_IS_ASCII (ONIG_OPTION_SPACE_IS_ASCII << 1)
#define ONIG_OPTION_TEXT_SEGMENT_EXTENDED_GRAPHEME_CLUSTER (ONIG_OPTION_POSIX_IS_ASCII << 1)
#define ONIG_OPTION_TEXT_SEGMENT_WORD (ONIG_OPTION_TEXT_SEGMENT_EXTENDED_GRAPHEME_CLUSTER << 1)
#define ONIG_OPTION_MAXBIT ONIG_OPTION_TEXT_SEGMENT_WORD /* limit */
#define ONIG_OPTION_MAXBIT ONIG_OPTION_POSIX_IS_ASCII /* limit */
#define ONIG_OPTION_ON(options,regopt) ((options) |= (regopt))
#define ONIG_OPTION_OFF(options,regopt) ((options) &= ~(regopt))
@@ -496,12 +490,10 @@ ONIG_EXTERN OnigSyntaxType* OnigDefaultSyntax;
#define ONIG_SYN_OP2_ESC_CAPITAL_R_GENERAL_NEWLINE (1U<<23) /* \R \r\n else [\x0a-\x0d] */
#define ONIG_SYN_OP2_ESC_CAPITAL_N_O_SUPER_DOT (1U<<24) /* \N (?-m:.), \O (?m:.) */
#define ONIG_SYN_OP2_QMARK_TILDE_ABSENT_GROUP (1U<<25) /* (?~...) */
#define ONIG_SYN_OP2_ESC_X_Y_GRAPHEME_CLUSTER (1U<<26) /* obsoleted: use next */
#define ONIG_SYN_OP2_ESC_X_Y_TEXT_SEGMENT (1U<<26) /* \X \y \Y */
#define ONIG_SYN_OP2_ESC_X_Y_GRAPHEME_CLUSTER (1U<<26) /* \X \y \Y */
#define ONIG_SYN_OP2_QMARK_PERL_SUBEXP_CALL (1U<<27) /* (?R), (?&name)... */
#define ONIG_SYN_OP2_QMARK_BRACE_CALLOUT_CONTENTS (1U<<28) /* (?{...}) (?{{...}}) */
#define ONIG_SYN_OP2_ASTERISK_CALLOUT_NAME (1U<<29) /* (*name) (*name{a,..}) */
#define ONIG_SYN_OP2_OPTION_ONIGURUMA (1U<<30) /* (?imxWDSPy) */
/* syntax (behavior) */
#define ONIG_SYN_CONTEXT_INDEP_ANCHORS (1U<<31) /* not implemented */
@@ -521,7 +513,6 @@ ONIG_EXTERN OnigSyntaxType* OnigDefaultSyntax;
#define ONIG_SYN_BACKSLASH_ESCAPE_IN_CC (1U<<21) /* [..\w..] etc.. */
#define ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC (1U<<22)
#define ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC (1U<<23) /* [0-9-a]=[0-9\-a] */
#define ONIG_SYN_ALLOW_INVALID_CODE_END_OF_RANGE_IN_CC (1U<<26)
/* syntax (behavior) warning */
#define ONIG_SYN_WARN_CC_OP_NOT_ESCAPED (1U<<24) /* [,-,] */
#define ONIG_SYN_WARN_REDUNDANT_NESTED_REPEAT (1U<<25) /* (?:a*)+ */
@@ -771,8 +762,6 @@ int onig_init P_((void));
ONIG_EXTERN
int onig_error_code_to_str PV_((OnigUChar* s, int err_code, ...));
ONIG_EXTERN
int onig_is_error_code_needs_param PV_((int code));
ONIG_EXTERN
void onig_set_warn_func P_((OnigWarnFunc f));
ONIG_EXTERN
void onig_set_verb_warn_func P_((OnigWarnFunc f));
File diff suppressed because it is too large. Load diff
+37 -45
View File
@@ -2,7 +2,7 @@
regenc.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2019 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -77,17 +77,6 @@ enc_is_inited(OnigEncoding enc)
return 0;
}
static int OnigEncInited;
extern int
onigenc_init(void)
{
if (OnigEncInited != 0) return 0;
OnigEncInited = 1;
return 0;
}
extern int
onigenc_end(void)
{
@@ -97,12 +86,17 @@ onigenc_end(void)
InitedList[i].enc = 0;
InitedList[i].inited = 0;
}
InitedListNum = 0;
OnigEncInited = 0;
InitedListNum = 0;
return ONIG_NORMAL;
}
extern int
onigenc_init(void)
{
return 0;
}
extern int
onig_initialize_encoding(OnigEncoding enc)
{
@@ -173,7 +167,7 @@ onigenc_get_right_adjust_char_head(OnigEncoding enc, const UChar* start, const U
extern UChar*
onigenc_get_right_adjust_char_head_with_prev(OnigEncoding enc,
const UChar* start, const UChar* s, const UChar** prev)
const UChar* start, const UChar* s, const UChar** prev)
{
UChar* p = ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, start, s);
@@ -237,7 +231,7 @@ onigenc_strlen(OnigEncoding enc, const UChar* p, const UChar* end)
{
int n = 0;
UChar* q = (UChar* )p;
while (q < end) {
q += ONIGENC_MBC_ENC_LEN(enc, q);
n++;
@@ -250,7 +244,7 @@ onigenc_strlen_null(OnigEncoding enc, const UChar* s)
{
int n = 0;
UChar* p = (UChar* )s;
while (1) {
if (*p == '\0') {
UChar* q;
@@ -517,7 +511,7 @@ const OnigPairCaseFoldCodes OnigAsciiLowerMap[] = {
extern int
onigenc_ascii_apply_all_case_fold(OnigCaseFoldType flag ARG_UNUSED,
OnigApplyAllCaseFoldFunc f, void* arg)
OnigApplyAllCaseFoldFunc f, void* arg)
{
OnigCodePoint code;
int i, r;
@@ -539,8 +533,8 @@ onigenc_ascii_apply_all_case_fold(OnigCaseFoldType flag ARG_UNUSED,
extern int
onigenc_ascii_get_case_fold_codes_by_str(OnigCaseFoldType flag ARG_UNUSED,
const OnigUChar* p, const OnigUChar* end ARG_UNUSED,
OnigCaseFoldCodeItem items[])
const OnigUChar* p, const OnigUChar* end ARG_UNUSED,
OnigCaseFoldCodeItem items[])
{
if (0x41 <= *p && *p <= 0x5a) {
items[0].byte_len = 1;
@@ -560,7 +554,7 @@ onigenc_ascii_get_case_fold_codes_by_str(OnigCaseFoldType flag ARG_UNUSED,
static int
ss_apply_all_case_fold(OnigCaseFoldType flag ARG_UNUSED,
OnigApplyAllCaseFoldFunc f, void* arg)
OnigApplyAllCaseFoldFunc f, void* arg)
{
static OnigCodePoint ss[] = { 0x73, 0x73 };
@@ -606,7 +600,7 @@ onigenc_get_case_fold_codes_by_str_with_map(int map_size,
items[0].code_len = 1;
items[0].code[0] = (OnigCodePoint )(*p + 0x20);
if (*p == 0x53 && ess_tsett_flag != 0 && end > p + 1
&& (*(p+1) == 0x53 || *(p+1) == 0x73)) {
&& (*(p+1) == 0x53 || *(p+1) == 0x73)) {
/* SS */
items[1].byte_len = 2;
items[1].code_len = 1;
@@ -621,7 +615,7 @@ onigenc_get_case_fold_codes_by_str_with_map(int map_size,
items[0].code_len = 1;
items[0].code[0] = (OnigCodePoint )(*p - 0x20);
if (*p == 0x73 && ess_tsett_flag != 0 && end > p + 1
&& (*(p+1) == 0x73 || *(p+1) == 0x53)) {
&& (*(p+1) == 0x73 || *(p+1) == 0x53)) {
/* ss */
items[1].byte_len = 2;
items[1].code_len = 1;
@@ -659,16 +653,16 @@ onigenc_get_case_fold_codes_by_str_with_map(int map_size,
for (i = 0; i < map_size; i++) {
if (*p == map[i].from) {
items[0].byte_len = 1;
items[0].code_len = 1;
items[0].code[0] = map[i].to;
return 1;
items[0].byte_len = 1;
items[0].code_len = 1;
items[0].code[0] = map[i].to;
return 1;
}
else if (*p == map[i].to) {
items[0].byte_len = 1;
items[0].code_len = 1;
items[0].code[0] = map[i].from;
return 1;
items[0].byte_len = 1;
items[0].code_len = 1;
items[0].code[0] = map[i].from;
return 1;
}
}
}
@@ -679,8 +673,8 @@ onigenc_get_case_fold_codes_by_str_with_map(int map_size,
extern int
onigenc_not_support_get_ctype_code_range(OnigCtype ctype ARG_UNUSED,
OnigCodePoint* sb_out ARG_UNUSED,
const OnigCodePoint* ranges[] ARG_UNUSED)
OnigCodePoint* sb_out ARG_UNUSED,
const OnigCodePoint* ranges[] ARG_UNUSED)
{
return ONIG_NO_SUPPORT_CONFIG;
}
@@ -697,7 +691,7 @@ onigenc_is_mbc_newline_0x0a(const UChar* p, const UChar* end)
/* for single byte encodings */
extern int
onigenc_ascii_mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED, const UChar** p,
const UChar*end ARG_UNUSED, UChar* lower)
const UChar*end ARG_UNUSED, UChar* lower)
{
*lower = ONIGENC_ASCII_CODE_TO_LOWER_CASE(**p);
@@ -708,7 +702,7 @@ onigenc_ascii_mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED, const UChar** p,
#if 0
extern int
onigenc_ascii_is_mbc_ambiguous(OnigCaseFoldType flag,
const UChar** pp, const UChar* end)
const UChar** pp, const UChar* end)
{
const UChar* p = *pp;
@@ -744,35 +738,35 @@ onigenc_single_byte_code_to_mbc(OnigCodePoint code, UChar *buf)
extern UChar*
onigenc_single_byte_left_adjust_char_head(const UChar* start ARG_UNUSED,
const UChar* s)
const UChar* s)
{
return (UChar* )s;
}
extern int
onigenc_always_true_is_allowed_reverse_match(const UChar* s ARG_UNUSED,
const UChar* end ARG_UNUSED)
const UChar* end ARG_UNUSED)
{
return TRUE;
}
extern int
onigenc_always_false_is_allowed_reverse_match(const UChar* s ARG_UNUSED,
const UChar* end ARG_UNUSED)
const UChar* end ARG_UNUSED)
{
return FALSE;
}
extern int
onigenc_always_true_is_valid_mbc_string(const UChar* s ARG_UNUSED,
const UChar* end ARG_UNUSED)
const UChar* end ARG_UNUSED)
{
return TRUE;
}
extern int
onigenc_length_check_is_valid_mbc_string(OnigEncoding enc,
const UChar* p, const UChar* end)
const UChar* p, const UChar* end)
{
while (p < end) {
p += enclen(enc, p);
@@ -811,7 +805,7 @@ onigenc_mbn_mbc_to_code(OnigEncoding enc, const UChar* p, const UChar* end)
extern int
onigenc_mbn_mbc_case_fold(OnigEncoding enc, OnigCaseFoldType flag ARG_UNUSED,
const UChar** pp, const UChar* end ARG_UNUSED,
UChar* lower)
UChar* lower)
{
int len;
const UChar *p = *pp;
@@ -853,8 +847,6 @@ onigenc_mbn_is_mbc_ambiguous(OnigEncoding enc, OnigCaseFoldType flag,
extern int
onigenc_mb2_code_to_mbclen(OnigCodePoint code)
{
if ((code & (~0xffff)) != 0) return ONIGERR_INVALID_CODE_POINT_VALUE;
if ((code & 0xff00) != 0) return 2;
else return 1;
}
@@ -954,7 +946,7 @@ onigenc_is_mbc_word_ascii(OnigEncoding enc, UChar* s, const UChar* end)
extern int
onigenc_mb2_is_code_ctype(OnigEncoding enc, OnigCodePoint code,
unsigned int ctype)
unsigned int ctype)
{
if (code < 128)
return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype);
@@ -969,7 +961,7 @@ onigenc_mb2_is_code_ctype(OnigEncoding enc, OnigCodePoint code,
extern int
onigenc_mb4_is_code_ctype(OnigEncoding enc, OnigCodePoint code,
unsigned int ctype)
unsigned int ctype)
{
if (code < 128)
return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype);
+4 -21
View File
@@ -4,7 +4,7 @@
regenc.h - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2019 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -114,7 +114,6 @@ struct PropertyNameCtype {
/* #define USE_CRNL_AS_LINE_TERMINATOR */
#define USE_UNICODE_PROPERTIES
#define USE_UNICODE_EXTENDED_GRAPHEME_CLUSTER
#define USE_UNICODE_WORD_BREAK
/* #define USE_UNICODE_CASE_FOLD_TURKISH_AZERI */
/* #define USE_UNICODE_ALL_LINE_TERMINATORS */ /* see Unicode.org UTS #18 */
@@ -122,20 +121,8 @@ struct PropertyNameCtype {
#define ONIG_ENCODING_INIT_DEFAULT ONIG_ENCODING_ASCII
#define ENC_SKIP_OFFSET_1_OR_0 7
#define ENC_FLAG_ASCII_COMPATIBLE (1<<0)
#define ENC_FLAG_UNICODE (1<<1)
#define ENC_FLAG_SKIP_OFFSET_MASK (7<<2)
#define ENC_FLAG_SKIP_OFFSET_0 0
#define ENC_FLAG_SKIP_OFFSET_1 (1<<2)
#define ENC_FLAG_SKIP_OFFSET_2 (2<<2)
#define ENC_FLAG_SKIP_OFFSET_3 (3<<2)
#define ENC_FLAG_SKIP_OFFSET_4 (4<<2)
#define ENC_FLAG_SKIP_OFFSET_1_OR_0 (ENC_SKIP_OFFSET_1_OR_0<<2)
#define ENC_GET_SKIP_OFFSET(enc) \
(((enc)->flag & ENC_FLAG_SKIP_OFFSET_MASK)>>2)
/* for encoding system implementation (internal) */
@@ -175,19 +162,15 @@ extern int onigenc_mb4_is_code_ctype P_((OnigEncoding enc, OnigCodePoint code, u
extern struct PropertyNameCtype* onigenc_euc_jp_lookup_property_name P_((register const char *str, register size_t len));
extern struct PropertyNameCtype* onigenc_sjis_lookup_property_name P_((register const char *str, register size_t len));
/* in unicode.c */
/* in enc/unicode.c */
extern int onigenc_unicode_is_code_ctype P_((OnigCodePoint code, unsigned int ctype));
extern int onigenc_utf16_32_get_ctype_code_range P_((OnigCtype ctype, OnigCodePoint *sb_out, const OnigCodePoint* ranges[]));
extern int onigenc_unicode_ctype_code_range P_((OnigCtype ctype, const OnigCodePoint* ranges[]));
extern int onigenc_unicode_get_case_fold_codes_by_str P_((OnigEncoding enc, OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]));
extern int onigenc_unicode_mbc_case_fold P_((OnigEncoding enc, OnigCaseFoldType flag, const UChar** pp, const UChar* end, UChar* fold));
extern int onigenc_unicode_apply_all_case_fold P_((OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg));
extern int onigenc_egcb_is_break_position P_((OnigEncoding enc, UChar* p, UChar* prev, const UChar* start, const UChar* end));
#ifdef USE_UNICODE_WORD_BREAK
extern int onigenc_wb_is_break_position P_((OnigEncoding enc, UChar* p, UChar* prev, const UChar* start, const UChar* end));
#endif
#define UTF16_IS_SURROGATE_FIRST(c) (((c) & 0xfc) == 0xd8)
#define UTF16_IS_SURROGATE_SECOND(c) (((c) & 0xfc) == 0xdc)
@@ -214,7 +197,7 @@ extern int onigenc_wb_is_break_position P_((OnigEncoding enc, UChar* p, UChar* p
else if ((buk)->fold_len == 3)\
addr = OnigUnicodeFolds3 + (buk)->index;\
else\
return ONIGERR_INVALID_CODE_POINT_VALUE;\
addr = 0;\
} while (0)
extern OnigCodePoint OnigUnicodeFolds1[];
@@ -269,7 +252,7 @@ extern const unsigned short OnigEncAsciiCtypeTable[];
#define ONIGENC_IS_ASCII_CODE_CASE_AMBIG(code) \
(ONIGENC_IS_ASCII_CODE_CTYPE(code, ONIGENC_CTYPE_UPPER) ||\
ONIGENC_IS_ASCII_CODE_CTYPE(code, ONIGENC_CTYPE_LOWER))
#define ONIGENC_IS_UNICODE_ENCODING(enc) \
(((enc)->flag & ENC_FLAG_UNICODE) != 0)
+35 -30
View File
@@ -2,7 +2,7 @@
regerror.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2019 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,7 +30,13 @@
#include "regint.h"
#include <stdio.h> /* for vsnprintf() */
#ifdef HAVE_STDARG_PROTOTYPES
#include <stdarg.h>
#define va_init_list(a,b) va_start(a,b)
#else
#include <varargs.h>
#define va_init_list(a,b) va_start(a)
#endif
extern UChar*
onig_error_code_to_format(int code)
@@ -205,17 +211,13 @@ static void sprint_byte_with_x(char* s, unsigned int v)
}
static int to_ascii(OnigEncoding enc, UChar *s, UChar *end,
UChar buf[], int buf_size, int *is_over)
UChar buf[], int buf_size, int *is_over)
{
int len;
UChar *p;
OnigCodePoint code;
if (!s) {
len = 0;
*is_over = 0;
}
else if (ONIGENC_MBC_MINLEN(enc) > 1) {
if (ONIGENC_MBC_MINLEN(enc) > 1) {
p = s;
len = 0;
while (p < end) {
@@ -245,7 +247,7 @@ static int to_ascii(OnigEncoding enc, UChar *s, UChar *end,
if (len >= buf_size) break;
}
*is_over = p < end;
*is_over = ((p < end) ? 1 : 0);
}
else {
len = MIN((int )(end - s), buf_size);
@@ -257,27 +259,18 @@ static int to_ascii(OnigEncoding enc, UChar *s, UChar *end,
}
extern int
onig_is_error_code_needs_param(int code)
{
switch (code) {
case ONIGERR_UNDEFINED_NAME_REFERENCE:
case ONIGERR_UNDEFINED_GROUP_REFERENCE:
case ONIGERR_MULTIPLEX_DEFINED_NAME:
case ONIGERR_MULTIPLEX_DEFINITION_NAME_CALL:
case ONIGERR_INVALID_GROUP_NAME:
case ONIGERR_INVALID_CHAR_IN_GROUP_NAME:
case ONIGERR_INVALID_CHAR_PROPERTY_NAME:
return 1;
default:
return 0;
}
}
/* for ONIG_MAX_ERROR_MESSAGE_LEN */
#define MAX_ERROR_PAR_LEN 30
extern int onig_error_code_to_str(UChar* s, int code, ...)
extern int
#ifdef HAVE_STDARG_PROTOTYPES
onig_error_code_to_str(UChar* s, int code, ...)
#else
onig_error_code_to_str(s, code, va_alist)
UChar* s;
int code;
va_dcl
#endif
{
UChar *p, *q;
OnigErrorInfo* einfo;
@@ -285,7 +278,7 @@ extern int onig_error_code_to_str(UChar* s, int code, ...)
UChar parbuf[MAX_ERROR_PAR_LEN];
va_list vargs;
va_start(vargs, code);
va_init_list(vargs, code);
switch (code) {
case ONIGERR_UNDEFINED_NAME_REFERENCE:
@@ -337,15 +330,27 @@ extern int onig_error_code_to_str(UChar* s, int code, ...)
}
void onig_snprintf_with_pattern(UChar buf[], int bufsize, OnigEncoding enc,
UChar* pat, UChar* pat_end, const UChar *fmt, ...)
void
#ifdef HAVE_STDARG_PROTOTYPES
onig_snprintf_with_pattern(UChar buf[], int bufsize, OnigEncoding enc,
UChar* pat, UChar* pat_end, const UChar *fmt, ...)
#else
onig_snprintf_with_pattern(buf, bufsize, enc, pat, pat_end, fmt, va_alist)
UChar buf[];
int bufsize;
OnigEncoding enc;
UChar* pat;
UChar* pat_end;
const UChar *fmt;
va_dcl
#endif
{
int n, need, len;
UChar *p, *s, *bp;
UChar bs[6];
va_list args;
va_start(args, fmt);
va_init_list(args, fmt);
n = xvsnprintf((char* )buf, bufsize, (const char* )fmt, args);
va_end(args);
File diff suppressed because it is too large. Load diff
+2 -4
View File
@@ -2,7 +2,7 @@
regext.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2019 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2017 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,6 @@ conv_ext0be32(const UChar* s, const UChar* end, UChar* conv)
}
}
#if 0
static void
conv_ext0le32(const UChar* s, const UChar* end, UChar* conv)
{
@@ -92,7 +91,6 @@ conv_swap2bytes(const UChar* s, const UChar* end, UChar* conv)
s += 2;
}
}
#endif
static int
conv_encoding(OnigEncoding from, OnigEncoding to, const UChar* s, const UChar* end,
@@ -187,7 +185,7 @@ onig_new_deluxe(regex_t** reg, const UChar* pattern, const UChar* pattern_end,
}
r = onig_reg_init(*reg, ci->option, ci->case_fold_flag, ci->target_enc,
ci->syntax);
ci->syntax);
if (r != 0) goto err;
r = onig_compile(*reg, cpat, cpat_end, einfo);
+11 -11
View File
@@ -2,7 +2,7 @@
reggnu.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2019 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -39,7 +39,7 @@ re_free_registers(OnigRegion* r)
extern int
re_adjust_startpos(regex_t* reg, const char* string, int size,
int startpos, int range)
int startpos, int range)
{
if (startpos > 0 && ONIGENC_MBC_MAXLEN(reg->enc) != 1 && startpos < size) {
UChar *p;
@@ -59,20 +59,20 @@ re_adjust_startpos(regex_t* reg, const char* string, int size,
extern int
re_match(regex_t* reg, const char* str, int size, int pos,
struct re_registers* regs)
struct re_registers* regs)
{
return onig_match(reg, (UChar* )str, (UChar* )(str + size),
(UChar* )(str + pos), regs, ONIG_OPTION_NONE);
(UChar* )(str + pos), regs, ONIG_OPTION_NONE);
}
extern int
re_search(regex_t* bufp, const char* string, int size, int startpos, int range,
struct re_registers* regs)
struct re_registers* regs)
{
return onig_search(bufp, (UChar* )string, (UChar* )(string + size),
(UChar* )(string + startpos),
(UChar* )(string + startpos + range),
regs, ONIG_OPTION_NONE);
(UChar* )(string + startpos),
(UChar* )(string + startpos + range),
regs, ONIG_OPTION_NONE);
}
extern int
@@ -103,9 +103,9 @@ re_alloc_pattern(regex_t** reg)
if (IS_NULL(*reg)) return ONIGERR_MEMORY;
return onig_reg_init(*reg, ONIG_OPTION_DEFAULT,
ONIGENC_CASE_FOLD_DEFAULT,
OnigEncDefaultCharEncoding,
OnigDefaultSyntax);
ONIGENC_CASE_FOLD_DEFAULT,
OnigEncDefaultCharEncoding,
OnigDefaultSyntax);
}
extern void
+136 -291
View File
@@ -4,7 +4,7 @@
regint.h - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2019 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -54,37 +54,44 @@
#define PLATFORM_UNALIGNED_WORD_ACCESS
#endif
#ifdef __GNUC__
#define USE_GOTO_LABELS_AS_VALUES
#endif
/* config */
/* spec. config */
#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_INSISTENT_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
#ifdef USE_GOTO_LABELS_AS_VALUES
#define USE_THREADED_CODE
#define USE_DIRECT_THREADED_CODE
#endif
/* internal config */
#define USE_OP_PUSH_OR_JUMP_EXACT
#define USE_QUANT_PEEK_NEXT
#define USE_ST_LIBRARY
#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
#include "regenc.h"
#ifdef __cplusplus
# ifndef HAVE_STDARG_PROTOTYPES
# define HAVE_STDARG_PROTOTYPES 1
# endif
#endif
/* escape Mac OS X/Xcode 2.4/gcc 4.0.1 problem */
#if defined(__APPLE__) && defined(__GNUC__) && __GNUC__ >= 4
# ifndef HAVE_STDARG_PROTOTYPES
# define HAVE_STDARG_PROTOTYPES 1
# endif
#endif
#ifdef HAVE_STDARG_H
# ifndef HAVE_STDARG_PROTOTYPES
# define HAVE_STDARG_PROTOTYPES 1
# endif
#endif
#define INIT_MATCH_STACK_SIZE 160
#define DEFAULT_MATCH_STACK_LIMIT_SIZE 0 /* unlimited */
#define DEFAULT_RETRY_LIMIT_IN_MATCH 10000000
@@ -96,6 +103,12 @@
#undef ONIG_ESCAPE_UCHAR_COLLISION
#endif
#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 xmalloc malloc
#define xrealloc realloc
#define xcalloc calloc
@@ -139,8 +152,14 @@
#include <stddef.h>
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STDINT_H
#include <stdint.h>
@@ -150,7 +169,11 @@
#include <alloca.h>
#endif
#include <string.h>
#ifdef HAVE_STRING_H
# include <string.h>
#else
# include <strings.h>
#endif
#include <ctype.h>
#ifdef HAVE_SYS_TYPES_H
@@ -194,7 +217,6 @@ 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
#ifdef PLATFORM_UNALIGNED_WORD_ACCESS
@@ -259,6 +281,64 @@ typedef struct {
#endif
typedef struct {
const UChar* pattern;
const UChar* pattern_end;
#ifdef USE_CALLOUT
void* tag_table;
int callout_num;
int callout_list_alloc;
CalloutListEntry* callout_list; /* index: callout num */
#endif
} RegexExt;
#define REG_EXTP(reg) ((RegexExt* )((reg)->chain))
#define REG_EXTPL(reg) ((reg)->chain)
struct re_pattern_buffer {
/* common members of BBuf(bytes-buffer) */
unsigned char* p; /* compiled pattern */
unsigned int used; /* used space for p */
unsigned int alloc; /* allocated space for p */
int num_mem; /* used memory(...) num counted from 1 */
int num_repeat; /* OP_REPEAT/OP_REPEAT_NG id-counter */
int num_null_check; /* OP_EMPTY_CHECK_START/END id counter */
int num_comb_exp_check; /* no longer used (combination explosion check) */
int num_call; /* number of subexp call */
unsigned int capture_history; /* (?@...) flag (1-31) */
unsigned int bt_mem_start; /* need backtrack flag */
unsigned int bt_mem_end; /* need backtrack flag */
int stack_pop_level;
int repeat_range_alloc;
OnigRepeatRange* repeat_range;
OnigEncoding enc;
OnigOptionType options;
OnigSyntaxType* syntax;
OnigCaseFoldType case_fold_flag;
void* name_table;
/* optimization info (string search, char-map and anchors) */
int optimize; /* optimize flag */
int threshold_len; /* search str-length for apply optimize */
int anchor; /* BEGIN_BUF, BEGIN_POS, (SEMI_)END_BUF */
OnigLen anchor_dmin; /* (SEMI_)END_BUF anchor distance */
OnigLen anchor_dmax; /* (SEMI_)END_BUF anchor distance */
int sub_anchor; /* start-anchor for exact or map */
unsigned char *exact;
unsigned char *exact_end;
unsigned char map[ONIG_CHAR_TABLE_SIZE]; /* used as BM skip or char-map */
int *int_map; /* BM skip for exact_len > 255 */
int *int_map_backward; /* BM skip for backward search */
OnigLen dmin; /* min-distance of exact or map */
OnigLen dmax; /* max-distance of exact or map */
/* regex_t link chain */
struct re_pattern_buffer* chain; /* escape compile-conflict */
};
/* stack pop level */
enum StackPopLevel {
STACK_POP_LEVEL_FREE = 0,
@@ -268,13 +348,12 @@ enum StackPopLevel {
/* optimize flags */
enum OptimizeType {
OPTIMIZE_NONE = 0,
OPTIMIZE_STR, /* Slow Search */
OPTIMIZE_STR_FAST, /* Sunday quick search / BMH */
OPTIMIZE_STR_FAST_STEP_FORWARD, /* Sunday quick search / BMH */
OPTIMIZE_STR_CASE_FOLD_FAST, /* Sunday quick search / BMH (ignore case) */
OPTIMIZE_STR_CASE_FOLD, /* Slow Search (ignore case) */
OPTIMIZE_MAP /* char map */
OPTIMIZE_NONE = 0,
OPTIMIZE_EXACT = 1, /* Slow Search */
OPTIMIZE_EXACT_BM = 2, /* Boyer Moore Search */
OPTIMIZE_EXACT_BM_NO_REV = 3, /* BM (but not simple match) */
OPTIMIZE_EXACT_IC = 4, /* Slow Search (ignore case) */
OPTIMIZE_MAP = 5 /* char map */
};
/* bit status */
@@ -348,8 +427,8 @@ typedef unsigned int MemStatusType;
#define DISABLE_CASE_FOLD_MULTI_CHAR(case_fold_flag) \
((case_fold_flag) & ~INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR)
#define INFINITE_REPEAT -1
#define IS_INFINITE_REPEAT(n) ((n) == INFINITE_REPEAT)
#define REPEAT_INFINITE -1
#define IS_REPEAT_INFINITE(n) ((n) == REPEAT_INFINITE)
/* bitset */
#define BITS_PER_BYTE 8
@@ -387,7 +466,7 @@ typedef struct _BBuf {
unsigned int alloc;
} BBuf;
#define BB_INIT(buf,size) bbuf_init((BBuf* )(buf), (size))
#define BB_INIT(buf,size) onig_bbuf_init((BBuf* )(buf), (size))
#define BB_SIZE_INC(buf,inc) do{\
(buf)->alloc += (inc);\
@@ -462,32 +541,32 @@ typedef struct _BBuf {
/* has body */
#define ANCR_PREC_READ (1<<0)
#define ANCR_PREC_READ_NOT (1<<1)
#define ANCR_LOOK_BEHIND (1<<2)
#define ANCR_LOOK_BEHIND_NOT (1<<3)
#define ANCHOR_PREC_READ (1<<0)
#define ANCHOR_PREC_READ_NOT (1<<1)
#define ANCHOR_LOOK_BEHIND (1<<2)
#define ANCHOR_LOOK_BEHIND_NOT (1<<3)
/* no body */
#define ANCR_BEGIN_BUF (1<<4)
#define ANCR_BEGIN_LINE (1<<5)
#define ANCR_BEGIN_POSITION (1<<6)
#define ANCR_END_BUF (1<<7)
#define ANCR_SEMI_END_BUF (1<<8)
#define ANCR_END_LINE (1<<9)
#define ANCR_WORD_BOUNDARY (1<<10)
#define ANCR_NO_WORD_BOUNDARY (1<<11)
#define ANCR_WORD_BEGIN (1<<12)
#define ANCR_WORD_END (1<<13)
#define ANCR_ANYCHAR_INF (1<<14)
#define ANCR_ANYCHAR_INF_ML (1<<15)
#define ANCR_TEXT_SEGMENT_BOUNDARY (1<<16)
#define ANCR_NO_TEXT_SEGMENT_BOUNDARY (1<<17)
#define ANCHOR_BEGIN_BUF (1<<4)
#define ANCHOR_BEGIN_LINE (1<<5)
#define ANCHOR_BEGIN_POSITION (1<<6)
#define ANCHOR_END_BUF (1<<7)
#define ANCHOR_SEMI_END_BUF (1<<8)
#define ANCHOR_END_LINE (1<<9)
#define ANCHOR_WORD_BOUNDARY (1<<10)
#define ANCHOR_NO_WORD_BOUNDARY (1<<11)
#define ANCHOR_WORD_BEGIN (1<<12)
#define ANCHOR_WORD_END (1<<13)
#define ANCHOR_ANYCHAR_INF (1<<14)
#define ANCHOR_ANYCHAR_INF_ML (1<<15)
#define ANCHOR_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY (1<<16)
#define ANCHOR_NO_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY (1<<17)
#define ANCHOR_HAS_BODY(a) ((a)->type < ANCR_BEGIN_BUF)
#define ANCHOR_HAS_BODY(a) ((a)->type < ANCHOR_BEGIN_BUF)
#define IS_WORD_ANCHOR_TYPE(type) \
((type) == ANCR_WORD_BOUNDARY || (type) == ANCR_NO_WORD_BOUNDARY || \
(type) == ANCR_WORD_BEGIN || (type) == ANCR_WORD_END)
((type) == ANCHOR_WORD_BOUNDARY || (type) == ANCHOR_NO_WORD_BOUNDARY || \
(type) == ANCHOR_WORD_BEGIN || (type) == ANCHOR_WORD_END)
/* operation code */
enum OpCode {
@@ -516,6 +595,9 @@ enum OpCode {
OP_CCLASS_NOT,
OP_CCLASS_MB_NOT,
OP_CCLASS_MIX_NOT,
#ifdef USE_OP_CCLASS_NODE
OP_CCLASS_NODE, /* pointer to CClassNode node */
#endif
OP_ANYCHAR, /* "." */
OP_ANYCHAR_ML, /* "." multi-line */
@@ -533,7 +615,8 @@ enum OpCode {
OP_WORD_BEGIN,
OP_WORD_END,
OP_TEXT_SEGMENT_BOUNDARY,
OP_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY,
OP_NO_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY,
OP_BEGIN_BUF,
OP_END_BUF,
@@ -549,7 +632,6 @@ enum OpCode {
OP_BACKREF_MULTI,
OP_BACKREF_MULTI_IC,
OP_BACKREF_WITH_LEVEL, /* \k<xxx+n>, \k<xxx-n> */
OP_BACKREF_WITH_LEVEL_IC, /* \k<xxx+n>, \k<xxx-n> */
OP_BACKREF_CHECK, /* (?(n)), (?('name')) */
OP_BACKREF_CHECK_WITH_LEVEL, /* (?(n-level)), (?('name-level')) */
@@ -565,9 +647,7 @@ enum OpCode {
OP_PUSH,
OP_PUSH_SUPER,
OP_POP_OUT,
#ifdef USE_OP_PUSH_OR_JUMP_EXACT
OP_PUSH_OR_JUMP_EXACT1, /* if match exact then push, else jump. */
#endif
OP_PUSH_IF_PEEK_NEXT, /* if match exact then push, else none. */
OP_REPEAT, /* {n,m} */
OP_REPEAT_NG, /* {n,m}? (non greedy) */
@@ -614,11 +694,6 @@ enum UpdateVarType {
UPDATE_VAR_RIGHT_RANGE_INIT = 4,
};
enum TextSegmentBoundaryType {
EXTENDED_GRAPHEME_CLUSTER_BOUNDARY = 0,
WORD_BOUNDARY = 1,
};
typedef int RelAddrType;
typedef int AbsAddrType;
typedef int LengthType;
@@ -662,16 +737,13 @@ typedef int ModeType;
/* op-code + arg size */
#if 0
#define SIZE_OP_ANYCHAR_STAR SIZE_OPCODE
#define SIZE_OP_ANYCHAR_STAR_PEEK_NEXT (SIZE_OPCODE + 1)
#define SIZE_OP_JUMP (SIZE_OPCODE + SIZE_RELADDR)
#define SIZE_OP_PUSH (SIZE_OPCODE + SIZE_RELADDR)
#define SIZE_OP_PUSH_SUPER (SIZE_OPCODE + SIZE_RELADDR)
#define SIZE_OP_POP_OUT SIZE_OPCODE
#ifdef USE_OP_PUSH_OR_JUMP_EXACT
#define SIZE_OP_PUSH_OR_JUMP_EXACT1 (SIZE_OPCODE + SIZE_RELADDR + 1)
#endif
#define SIZE_OP_PUSH_IF_PEEK_NEXT (SIZE_OPCODE + SIZE_RELADDR + 1)
#define SIZE_OP_REPEAT_INC (SIZE_OPCODE + SIZE_MEMNUM)
#define SIZE_OP_REPEAT_INC_NG (SIZE_OPCODE + SIZE_MEMNUM)
@@ -704,56 +776,6 @@ typedef int ModeType;
#define SIZE_OP_CALLOUT_NAME (SIZE_OPCODE + SIZE_MEMNUM + SIZE_MEMNUM)
#endif
#else /* if 0 */
/* for relative address increment to go next op. */
#define SIZE_INC_OP 1
#define SIZE_OP_ANYCHAR_STAR 1
#define SIZE_OP_ANYCHAR_STAR_PEEK_NEXT 1
#define SIZE_OP_JUMP 1
#define SIZE_OP_PUSH 1
#define SIZE_OP_PUSH_SUPER 1
#define SIZE_OP_POP_OUT 1
#ifdef USE_OP_PUSH_OR_JUMP_EXACT
#define SIZE_OP_PUSH_OR_JUMP_EXACT1 1
#endif
#define SIZE_OP_PUSH_IF_PEEK_NEXT 1
#define SIZE_OP_REPEAT 1
#define SIZE_OP_REPEAT_INC 1
#define SIZE_OP_REPEAT_INC_NG 1
#define SIZE_OP_WORD_BOUNDARY 1
#define SIZE_OP_PREC_READ_START 1
#define SIZE_OP_PREC_READ_NOT_START 1
#define SIZE_OP_PREC_READ_END 1
#define SIZE_OP_PREC_READ_NOT_END 1
#define SIZE_OP_BACKREF 1
#define SIZE_OP_FAIL 1
#define SIZE_OP_MEMORY_START 1
#define SIZE_OP_MEMORY_START_PUSH 1
#define SIZE_OP_MEMORY_END_PUSH 1
#define SIZE_OP_MEMORY_END_PUSH_REC 1
#define SIZE_OP_MEMORY_END 1
#define SIZE_OP_MEMORY_END_REC 1
#define SIZE_OP_ATOMIC_START 1
#define SIZE_OP_ATOMIC_END 1
#define SIZE_OP_EMPTY_CHECK_START 1
#define SIZE_OP_EMPTY_CHECK_END 1
#define SIZE_OP_LOOK_BEHIND 1
#define SIZE_OP_LOOK_BEHIND_NOT_START 1
#define SIZE_OP_LOOK_BEHIND_NOT_END 1
#define SIZE_OP_CALL 1
#define SIZE_OP_RETURN 1
#define SIZE_OP_PUSH_SAVE_VAL 1
#define SIZE_OP_UPDATE_VAR 1
#ifdef USE_CALLOUT
#define SIZE_OP_CALLOUT_CONTENTS 1
#define SIZE_OP_CALLOUT_NAME 1
#endif
#endif /* if 0 */
#define MC_ESC(syn) (syn)->meta_char_table.esc
#define MC_ANYCHAR(syn) (syn)->meta_char_table.anychar
#define MC_ANYTIME(syn) (syn)->meta_char_table.anytime
@@ -805,187 +827,9 @@ typedef int ModeType;
#define NCCLASS_CLEAR_NOT(nd) NCCLASS_FLAG_CLEAR(nd, FLAG_NCCLASS_NOT)
#define IS_NCCLASS_NOT(nd) IS_NCCLASS_FLAG_ON(nd, FLAG_NCCLASS_NOT)
typedef struct {
#ifdef USE_DIRECT_THREADED_CODE
const void* opaddr;
#else
enum OpCode opcode;
#endif
union {
struct {
UChar s[16]; /* Now used first 7 bytes only. */
} exact;
struct {
UChar* s;
LengthType n; /* number of chars */
} exact_n; /* EXACTN, EXACTN_IC, EXACTMB2N, EXACTMB3N */
struct {
UChar* s;
LengthType n; /* number of chars */
LengthType len; /* char byte length */
} exact_len_n; /* EXACTMBN */
struct {
BitSetRef bsp;
} cclass;
struct {
void* mb;
} cclass_mb;
struct {
void* mb; /* mb must be same position with cclass_mb for match_at(). */
BitSetRef bsp;
} cclass_mix;
struct {
UChar c;
} anychar_star_peek_next;
struct {
ModeType mode;
} word_boundary; /* OP_WORD_BOUNDARY, OP_NO_WORD_BOUNDARY, OP_WORD_BEGIN, OP_WORD_END */
struct {
enum TextSegmentBoundaryType type;
int not;
} text_segment_boundary;
struct {
union {
MemNumType n1; /* num == 1 */
MemNumType* ns; /* num > 1 */
};
int num;
int nest_level;
} backref_general; /* BACKREF_MULTI, BACKREF_MULTI_IC, BACKREF_WITH_LEVEL, BACKREF_CHECK, BACKREF_CHECK_WITH_LEVEL, */
struct {
MemNumType n1;
} backref_n; /* BACKREF_N, BACKREF_N_IC */
struct {
MemNumType num;
} memory_start; /* MEMORY_START, MEMORY_START_PUSH */
struct {
MemNumType num;
} memory_end; /* MEMORY_END, MEMORY_END_REC, MEMORY_END_PUSH, MEMORY_END_PUSH_REC */
struct {
RelAddrType addr;
} jump;
struct {
RelAddrType addr;
} push;
struct {
RelAddrType addr;
UChar c;
} push_or_jump_exact1;
struct {
RelAddrType addr;
UChar c;
} push_if_peek_next;
struct {
MemNumType id;
RelAddrType addr;
} repeat; /* REPEAT, REPEAT_NG */
struct {
MemNumType id;
} repeat_inc; /* REPEAT_INC, REPEAT_INC_SG, REPEAT_INC_NG, REPEAT_INC_NG_SG */
struct {
MemNumType mem;
} empty_check_start;
struct {
MemNumType mem;
} empty_check_end; /* EMPTY_CHECK_END, EMPTY_CHECK_END_MEMST, EMPTY_CHECK_END_MEMST_PUSH */
struct {
RelAddrType addr;
} prec_read_not_start;
struct {
LengthType len;
} look_behind;
struct {
LengthType len;
RelAddrType addr;
} look_behind_not_start;
struct {
AbsAddrType addr;
} call;
struct {
SaveType type;
MemNumType id;
} push_save_val;
struct {
UpdateVarType type;
MemNumType id;
} update_var;
#ifdef USE_CALLOUT
struct {
MemNumType num;
} callout_contents;
struct {
MemNumType num;
MemNumType id;
} callout_name;
#endif
};
} Operation;
typedef struct {
const UChar* pattern;
const UChar* pattern_end;
#ifdef USE_CALLOUT
void* tag_table;
int callout_num;
int callout_list_alloc;
CalloutListEntry* callout_list; /* index: callout num */
#endif
} RegexExt;
struct re_pattern_buffer {
/* common members of BBuf(bytes-buffer) */
Operation* ops;
#ifdef USE_DIRECT_THREADED_CODE
enum OpCode* ocs;
#endif
Operation* ops_curr;
unsigned int ops_used; /* used space for ops */
unsigned int ops_alloc; /* allocated space for ops */
unsigned char* string_pool;
unsigned char* string_pool_end;
int num_mem; /* used memory(...) num counted from 1 */
int num_repeat; /* OP_REPEAT/OP_REPEAT_NG id-counter */
int num_null_check; /* OP_EMPTY_CHECK_START/END id counter */
int num_call; /* number of subexp call */
unsigned int capture_history; /* (?@...) flag (1-31) */
unsigned int bt_mem_start; /* need backtrack flag */
unsigned int bt_mem_end; /* need backtrack flag */
int stack_pop_level;
int repeat_range_alloc;
OnigRepeatRange* repeat_range;
OnigEncoding enc;
OnigOptionType options;
OnigSyntaxType* syntax;
OnigCaseFoldType case_fold_flag;
void* name_table;
/* optimization info (string search, char-map and anchors) */
int optimize; /* optimize flag */
int threshold_len; /* search str-length for apply optimize */
int anchor; /* BEGIN_BUF, BEGIN_POS, (SEMI_)END_BUF */
OnigLen anchor_dmin; /* (SEMI_)END_BUF anchor distance */
OnigLen anchor_dmax; /* (SEMI_)END_BUF anchor distance */
int sub_anchor; /* start-anchor for exact or map */
unsigned char *exact;
unsigned char *exact_end;
unsigned char map[CHAR_MAP_SIZE]; /* used as BMH skip or char-map */
int map_offset;
OnigLen dmin; /* min-distance of exact or map */
OnigLen dmax; /* max-distance of exact or map */
RegexExt* extp;
};
#define COP(reg) ((reg)->ops_curr)
#define COP_CURR_OFFSET(reg) ((reg)->ops_used - 1)
#define COP_CURR_OFFSET_BYTES(reg, p) \
((int )((char* )(&((reg)->ops_curr->p)) - (char* )((reg)->ops)))
extern void onig_add_end_call(void (*func)(void));
#ifdef ONIG_DEBUG
#ifdef ONIG_DEBUG_COMPILE
@@ -1001,11 +845,12 @@ extern int onig_print_statistics P_((FILE* f));
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_bbuf_init P_((BBuf* buf, int size));
extern int onig_compile P_((regex_t* reg, const UChar* pattern, const UChar* pattern_end, OnigErrorInfo* einfo));
extern void onig_transfer P_((regex_t* to, regex_t* from));
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);
#ifdef USE_CALLOUT
File diff suppressed because it is too large. Load diff
+158 -155
View File
@@ -4,7 +4,7 @@
regparse.h - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2019 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,10 +31,6 @@
#include "regint.h"
#define NODE_STRING_MARGIN 16
#define NODE_STRING_BUF_SIZE 24 /* sizeof(CClassNode) - sizeof(int)*4 */
#define NODE_BACKREFS_SIZE 6
/* node type */
typedef enum {
NODE_STRING = 0,
@@ -42,7 +38,7 @@ typedef enum {
NODE_CTYPE = 2,
NODE_BACKREF = 3,
NODE_QUANT = 4,
NODE_BAG = 5,
NODE_ENCLOSURE = 5,
NODE_ANCHOR = 6,
NODE_LIST = 7,
NODE_ALT = 8,
@@ -50,29 +46,161 @@ typedef enum {
NODE_GIMMICK = 10
} NodeType;
enum BagType {
BAG_MEMORY = 0,
BAG_OPTION = 1,
BAG_STOP_BACKTRACK = 2,
BAG_IF_ELSE = 3,
};
enum GimmickType {
GIMMICK_FAIL = 0,
GIMMICK_SAVE = 1,
GIMMICK_UPDATE_VAR = 2,
GIMMICK_FAIL = 0,
GIMMICK_KEEP = 1,
GIMMICK_SAVE = 2,
GIMMICK_UPDATE_VAR = 3,
#ifdef USE_CALLOUT
GIMMICK_CALLOUT = 3,
GIMMICK_CALLOUT = 4,
#endif
};
enum BodyEmptyType {
BODY_IS_NOT_EMPTY = 0,
BODY_IS_EMPTY_POSSIBILITY = 1,
BODY_IS_EMPTY_POSSIBILITY_MEM = 2,
BODY_IS_EMPTY_POSSIBILITY_REC = 3
/* node type bit */
#define NODE_TYPE2BIT(type) (1<<(type))
#define NODE_BIT_STRING NODE_TYPE2BIT(NODE_STRING)
#define NODE_BIT_CCLASS NODE_TYPE2BIT(NODE_CCLASS)
#define NODE_BIT_CTYPE NODE_TYPE2BIT(NODE_CTYPE)
#define NODE_BIT_BACKREF NODE_TYPE2BIT(NODE_BACKREF)
#define NODE_BIT_QUANT NODE_TYPE2BIT(NODE_QUANT)
#define NODE_BIT_ENCLOSURE NODE_TYPE2BIT(NODE_ENCLOSURE)
#define NODE_BIT_ANCHOR NODE_TYPE2BIT(NODE_ANCHOR)
#define NODE_BIT_LIST NODE_TYPE2BIT(NODE_LIST)
#define NODE_BIT_ALT NODE_TYPE2BIT(NODE_ALT)
#define NODE_BIT_CALL NODE_TYPE2BIT(NODE_CALL)
#define NODE_BIT_GIMMICK NODE_TYPE2BIT(NODE_GIMMICK)
#define NODE_IS_SIMPLE_TYPE(node) \
((NODE_TYPE2BIT(NODE_TYPE(node)) & \
(NODE_BIT_STRING | NODE_BIT_CCLASS | NODE_BIT_CTYPE | NODE_BIT_BACKREF)) != 0)
#define NODE_TYPE(node) ((node)->u.base.node_type)
#define NODE_SET_TYPE(node, ntype) (node)->u.base.node_type = (ntype)
#define STR_(node) (&((node)->u.str))
#define CCLASS_(node) (&((node)->u.cclass))
#define CTYPE_(node) (&((node)->u.ctype))
#define BACKREF_(node) (&((node)->u.backref))
#define QUANT_(node) (&((node)->u.quant))
#define ENCLOSURE_(node) (&((node)->u.enclosure))
#define ANCHOR_(node) (&((node)->u.anchor))
#define CONS_(node) (&((node)->u.cons))
#define CALL_(node) (&((node)->u.call))
#define GIMMICK_(node) (&((node)->u.gimmick))
#define NODE_CAR(node) (CONS_(node)->car)
#define NODE_CDR(node) (CONS_(node)->cdr)
#define CTYPE_ANYCHAR -1
#define NODE_IS_ANYCHAR(node) \
(NODE_TYPE(node) == NODE_CTYPE && CTYPE_(node)->ctype == CTYPE_ANYCHAR)
#define CTYPE_OPTION(node, reg) \
(NODE_IS_FIXED_OPTION(node) ? CTYPE_(node)->options : reg->options)
#define ANCHOR_ANYCHAR_INF_MASK (ANCHOR_ANYCHAR_INF | ANCHOR_ANYCHAR_INF_ML)
#define ANCHOR_END_BUF_MASK (ANCHOR_END_BUF | ANCHOR_SEMI_END_BUF)
enum EnclosureType {
ENCLOSURE_MEMORY = 0,
ENCLOSURE_OPTION = 1,
ENCLOSURE_STOP_BACKTRACK = 2,
ENCLOSURE_IF_ELSE = 3,
};
#define NODE_STRING_MARGIN 16
#define NODE_STRING_BUF_SIZE 24 /* sizeof(CClassNode) - sizeof(int)*4 */
#define NODE_BACKREFS_SIZE 6
#define NODE_STRING_RAW (1<<0) /* by backslashed number */
#define NODE_STRING_AMBIG (1<<1)
#define NODE_STRING_DONT_GET_OPT_INFO (1<<2)
#define NODE_STRING_LEN(node) (int )((node)->u.str.end - (node)->u.str.s)
#define NODE_STRING_SET_RAW(node) (node)->u.str.flag |= NODE_STRING_RAW
#define NODE_STRING_CLEAR_RAW(node) (node)->u.str.flag &= ~NODE_STRING_RAW
#define NODE_STRING_SET_AMBIG(node) (node)->u.str.flag |= NODE_STRING_AMBIG
#define NODE_STRING_SET_DONT_GET_OPT_INFO(node) \
(node)->u.str.flag |= NODE_STRING_DONT_GET_OPT_INFO
#define NODE_STRING_IS_RAW(node) \
(((node)->u.str.flag & NODE_STRING_RAW) != 0)
#define NODE_STRING_IS_AMBIG(node) \
(((node)->u.str.flag & NODE_STRING_AMBIG) != 0)
#define NODE_STRING_IS_DONT_GET_OPT_INFO(node) \
(((node)->u.str.flag & NODE_STRING_DONT_GET_OPT_INFO) != 0)
#define BACKREFS_P(br) \
(IS_NOT_NULL((br)->back_dynamic) ? (br)->back_dynamic : (br)->back_static)
enum QuantBodyEmpty {
QUANT_BODY_IS_NOT_EMPTY = 0,
QUANT_BODY_IS_EMPTY = 1,
QUANT_BODY_IS_EMPTY_MEM = 2,
QUANT_BODY_IS_EMPTY_REC = 3
};
/* node status bits */
#define NODE_ST_MIN_FIXED (1<<0)
#define NODE_ST_MAX_FIXED (1<<1)
#define NODE_ST_CLEN_FIXED (1<<2)
#define NODE_ST_MARK1 (1<<3)
#define NODE_ST_MARK2 (1<<4)
#define NODE_ST_STOP_BT_SIMPLE_REPEAT (1<<5)
#define NODE_ST_RECURSION (1<<6)
#define NODE_ST_CALLED (1<<7)
#define NODE_ST_ADDR_FIXED (1<<8)
#define NODE_ST_NAMED_GROUP (1<<9)
#define NODE_ST_IN_REAL_REPEAT (1<<10) /* STK_REPEAT is nested in stack. */
#define NODE_ST_IN_ZERO_REPEAT (1<<11) /* (....){0} */
#define NODE_ST_IN_MULTI_ENTRY (1<<12)
#define NODE_ST_NEST_LEVEL (1<<13)
#define NODE_ST_BY_NUMBER (1<<14) /* {n,m} */
#define NODE_ST_BY_NAME (1<<15) /* backref by name */
#define NODE_ST_BACKREF (1<<16)
#define NODE_ST_CHECKER (1<<17)
#define NODE_ST_FIXED_OPTION (1<<18)
#define NODE_ST_PROHIBIT_RECURSION (1<<19)
#define NODE_ST_SUPER (1<<20)
#define NODE_STATUS(node) (((Node* )node)->u.base.status)
#define NODE_STATUS_ADD(node,f) (NODE_STATUS(node) |= (NODE_ST_ ## f))
#define NODE_STATUS_REMOVE(node,f) (NODE_STATUS(node) &= ~(NODE_ST_ ## f))
#define NODE_IS_BY_NUMBER(node) ((NODE_STATUS(node) & NODE_ST_BY_NUMBER) != 0)
#define NODE_IS_IN_REAL_REPEAT(node) ((NODE_STATUS(node) & NODE_ST_IN_REAL_REPEAT) != 0)
#define NODE_IS_CALLED(node) ((NODE_STATUS(node) & NODE_ST_CALLED) != 0)
#define NODE_IS_IN_MULTI_ENTRY(node) ((NODE_STATUS(node) & NODE_ST_IN_MULTI_ENTRY) != 0)
#define NODE_IS_RECURSION(node) ((NODE_STATUS(node) & NODE_ST_RECURSION) != 0)
#define NODE_IS_IN_ZERO_REPEAT(node) ((NODE_STATUS(node) & NODE_ST_IN_ZERO_REPEAT) != 0)
#define NODE_IS_NAMED_GROUP(node) ((NODE_STATUS(node) & NODE_ST_NAMED_GROUP) != 0)
#define NODE_IS_ADDR_FIXED(node) ((NODE_STATUS(node) & NODE_ST_ADDR_FIXED) != 0)
#define NODE_IS_CLEN_FIXED(node) ((NODE_STATUS(node) & NODE_ST_CLEN_FIXED) != 0)
#define NODE_IS_MIN_FIXED(node) ((NODE_STATUS(node) & NODE_ST_MIN_FIXED) != 0)
#define NODE_IS_MAX_FIXED(node) ((NODE_STATUS(node) & NODE_ST_MAX_FIXED) != 0)
#define NODE_IS_MARK1(node) ((NODE_STATUS(node) & NODE_ST_MARK1) != 0)
#define NODE_IS_MARK2(node) ((NODE_STATUS(node) & NODE_ST_MARK2) != 0)
#define NODE_IS_NEST_LEVEL(node) ((NODE_STATUS(node) & NODE_ST_NEST_LEVEL) != 0)
#define NODE_IS_BY_NAME(node) ((NODE_STATUS(node) & NODE_ST_BY_NAME) != 0)
#define NODE_IS_BACKREF(node) ((NODE_STATUS(node) & NODE_ST_BACKREF) != 0)
#define NODE_IS_CHECKER(node) ((NODE_STATUS(node) & NODE_ST_CHECKER) != 0)
#define NODE_IS_FIXED_OPTION(node) ((NODE_STATUS(node) & NODE_ST_FIXED_OPTION) != 0)
#define NODE_IS_SUPER(node) ((NODE_STATUS(node) & NODE_ST_SUPER) != 0)
#define NODE_IS_PROHIBIT_RECURSION(node) \
((NODE_STATUS(node) & NODE_ST_PROHIBIT_RECURSION) != 0)
#define NODE_IS_STOP_BT_SIMPLE_REPEAT(node) \
((NODE_STATUS(node) & NODE_ST_STOP_BT_SIMPLE_REPEAT) != 0)
#define NODE_BODY(node) ((node)->u.base.body)
#define NODE_QUANT_BODY(node) ((node)->body)
#define NODE_ENCLOSURE_BODY(node) ((node)->body)
#define NODE_CALL_BODY(node) ((node)->body)
#define NODE_ANCHOR_BODY(node) ((node)->body)
typedef struct {
NodeType node_type;
int status;
@@ -80,7 +208,7 @@ typedef struct {
UChar* s;
UChar* end;
unsigned int flag;
int capacity; /* (allocated size - 1) or 0: use buf[] */
int capa; /* (allocated size - 1) or 0: use buf[] */
UChar buf[NODE_STRING_BUF_SIZE];
} StrNode;
@@ -101,7 +229,7 @@ typedef struct {
int lower;
int upper;
int greedy;
enum BodyEmptyType emptiness;
enum QuantBodyEmpty body_empty_info;
struct _Node* head_exact;
struct _Node* next_head_exact;
int is_refered; /* include called node. don't eliminate even if {0} */
@@ -112,7 +240,7 @@ typedef struct {
int status;
struct _Node* body;
enum BagType type;
enum EnclosureType type;
union {
struct {
int regnum;
@@ -134,7 +262,7 @@ typedef struct {
OnigLen max_len; /* max length (byte) */
int char_len; /* character length */
int opt_count; /* referenced count in optimize_nodes() */
} BagNode;
} EnclosureNode;
#ifdef USE_CALL
@@ -152,7 +280,7 @@ typedef struct {
typedef struct {
NodeType node_type;
int status;
struct _Node* body; /* to BagNode : BAG_MEMORY */
struct _Node* body; /* to EnclosureNode : ENCLOSURE_MEMORY */
int by_number;
int group_num;
@@ -222,7 +350,7 @@ typedef struct _Node {
StrNode str;
CClassNode cclass;
QuantNode quant;
BagNode bag;
EnclosureNode enclosure;
BackRefNode backref;
AnchorNode anchor;
ConsAltNode cons;
@@ -234,134 +362,9 @@ typedef struct _Node {
} u;
} Node;
#define NULL_NODE ((Node* )0)
/* node type bit */
#define NODE_TYPE2BIT(type) (1<<(type))
#define NODE_BIT_STRING NODE_TYPE2BIT(NODE_STRING)
#define NODE_BIT_CCLASS NODE_TYPE2BIT(NODE_CCLASS)
#define NODE_BIT_CTYPE NODE_TYPE2BIT(NODE_CTYPE)
#define NODE_BIT_BACKREF NODE_TYPE2BIT(NODE_BACKREF)
#define NODE_BIT_QUANT NODE_TYPE2BIT(NODE_QUANT)
#define NODE_BIT_BAG NODE_TYPE2BIT(NODE_BAG)
#define NODE_BIT_ANCHOR NODE_TYPE2BIT(NODE_ANCHOR)
#define NODE_BIT_LIST NODE_TYPE2BIT(NODE_LIST)
#define NODE_BIT_ALT NODE_TYPE2BIT(NODE_ALT)
#define NODE_BIT_CALL NODE_TYPE2BIT(NODE_CALL)
#define NODE_BIT_GIMMICK NODE_TYPE2BIT(NODE_GIMMICK)
#define NODE_TYPE(node) ((node)->u.base.node_type)
#define NODE_SET_TYPE(node, ntype) (node)->u.base.node_type = (ntype)
#define STR_(node) (&((node)->u.str))
#define CCLASS_(node) (&((node)->u.cclass))
#define CTYPE_(node) (&((node)->u.ctype))
#define BACKREF_(node) (&((node)->u.backref))
#define QUANT_(node) (&((node)->u.quant))
#define BAG_(node) (&((node)->u.bag))
#define ANCHOR_(node) (&((node)->u.anchor))
#define CONS_(node) (&((node)->u.cons))
#define CALL_(node) (&((node)->u.call))
#define GIMMICK_(node) (&((node)->u.gimmick))
#define NODE_CAR(node) (CONS_(node)->car)
#define NODE_CDR(node) (CONS_(node)->cdr)
#define CTYPE_ANYCHAR -1
#define NODE_IS_ANYCHAR(node) \
(NODE_TYPE(node) == NODE_CTYPE && CTYPE_(node)->ctype == CTYPE_ANYCHAR)
#define CTYPE_OPTION(node, reg) \
(NODE_IS_FIXED_OPTION(node) ? CTYPE_(node)->options : reg->options)
#define ANCR_ANYCHAR_INF_MASK (ANCR_ANYCHAR_INF | ANCR_ANYCHAR_INF_ML)
#define ANCR_END_BUF_MASK (ANCR_END_BUF | ANCR_SEMI_END_BUF)
#define NODE_STRING_RAW (1<<0) /* by backslashed number */
#define NODE_STRING_AMBIG (1<<1)
#define NODE_STRING_GOOD_AMBIG (1<<2)
#define NODE_STRING_DONT_GET_OPT_INFO (1<<3)
#define NODE_STRING_LEN(node) (int )((node)->u.str.end - (node)->u.str.s)
#define NODE_STRING_SET_RAW(node) (node)->u.str.flag |= NODE_STRING_RAW
#define NODE_STRING_CLEAR_RAW(node) (node)->u.str.flag &= ~NODE_STRING_RAW
#define NODE_STRING_SET_AMBIG(node) (node)->u.str.flag |= NODE_STRING_AMBIG
#define NODE_STRING_SET_GOOD_AMBIG(node) (node)->u.str.flag |= NODE_STRING_GOOD_AMBIG
#define NODE_STRING_SET_DONT_GET_OPT_INFO(node) \
(node)->u.str.flag |= NODE_STRING_DONT_GET_OPT_INFO
#define NODE_STRING_IS_RAW(node) \
(((node)->u.str.flag & NODE_STRING_RAW) != 0)
#define NODE_STRING_IS_AMBIG(node) \
(((node)->u.str.flag & NODE_STRING_AMBIG) != 0)
#define NODE_STRING_IS_GOOD_AMBIG(node) \
(((node)->u.str.flag & NODE_STRING_GOOD_AMBIG) != 0)
#define NODE_STRING_IS_DONT_GET_OPT_INFO(node) \
(((node)->u.str.flag & NODE_STRING_DONT_GET_OPT_INFO) != 0)
#define BACKREFS_P(br) \
(IS_NOT_NULL((br)->back_dynamic) ? (br)->back_dynamic : (br)->back_static)
/* node status bits */
#define NODE_ST_MIN_FIXED (1<<0)
#define NODE_ST_MAX_FIXED (1<<1)
#define NODE_ST_CLEN_FIXED (1<<2)
#define NODE_ST_MARK1 (1<<3)
#define NODE_ST_MARK2 (1<<4)
#define NODE_ST_STRICT_REAL_REPEAT (1<<5)
#define NODE_ST_RECURSION (1<<6)
#define NODE_ST_CALLED (1<<7)
#define NODE_ST_ADDR_FIXED (1<<8)
#define NODE_ST_NAMED_GROUP (1<<9)
#define NODE_ST_IN_REAL_REPEAT (1<<10) /* STK_REPEAT is nested in stack. */
#define NODE_ST_IN_ZERO_REPEAT (1<<11) /* (....){0} */
#define NODE_ST_IN_MULTI_ENTRY (1<<12)
#define NODE_ST_NEST_LEVEL (1<<13)
#define NODE_ST_BY_NUMBER (1<<14) /* {n,m} */
#define NODE_ST_BY_NAME (1<<15) /* backref by name */
#define NODE_ST_BACKREF (1<<16)
#define NODE_ST_CHECKER (1<<17)
#define NODE_ST_FIXED_OPTION (1<<18)
#define NODE_ST_PROHIBIT_RECURSION (1<<19)
#define NODE_ST_SUPER (1<<20)
#define NODE_STATUS(node) (((Node* )node)->u.base.status)
#define NODE_STATUS_ADD(node,f) (NODE_STATUS(node) |= (NODE_ST_ ## f))
#define NODE_STATUS_REMOVE(node,f) (NODE_STATUS(node) &= ~(NODE_ST_ ## f))
#define NODE_IS_BY_NUMBER(node) ((NODE_STATUS(node) & NODE_ST_BY_NUMBER) != 0)
#define NODE_IS_IN_REAL_REPEAT(node) ((NODE_STATUS(node) & NODE_ST_IN_REAL_REPEAT) != 0)
#define NODE_IS_CALLED(node) ((NODE_STATUS(node) & NODE_ST_CALLED) != 0)
#define NODE_IS_IN_MULTI_ENTRY(node) ((NODE_STATUS(node) & NODE_ST_IN_MULTI_ENTRY) != 0)
#define NODE_IS_RECURSION(node) ((NODE_STATUS(node) & NODE_ST_RECURSION) != 0)
#define NODE_IS_IN_ZERO_REPEAT(node) ((NODE_STATUS(node) & NODE_ST_IN_ZERO_REPEAT) != 0)
#define NODE_IS_NAMED_GROUP(node) ((NODE_STATUS(node) & NODE_ST_NAMED_GROUP) != 0)
#define NODE_IS_ADDR_FIXED(node) ((NODE_STATUS(node) & NODE_ST_ADDR_FIXED) != 0)
#define NODE_IS_CLEN_FIXED(node) ((NODE_STATUS(node) & NODE_ST_CLEN_FIXED) != 0)
#define NODE_IS_MIN_FIXED(node) ((NODE_STATUS(node) & NODE_ST_MIN_FIXED) != 0)
#define NODE_IS_MAX_FIXED(node) ((NODE_STATUS(node) & NODE_ST_MAX_FIXED) != 0)
#define NODE_IS_MARK1(node) ((NODE_STATUS(node) & NODE_ST_MARK1) != 0)
#define NODE_IS_MARK2(node) ((NODE_STATUS(node) & NODE_ST_MARK2) != 0)
#define NODE_IS_NEST_LEVEL(node) ((NODE_STATUS(node) & NODE_ST_NEST_LEVEL) != 0)
#define NODE_IS_BY_NAME(node) ((NODE_STATUS(node) & NODE_ST_BY_NAME) != 0)
#define NODE_IS_BACKREF(node) ((NODE_STATUS(node) & NODE_ST_BACKREF) != 0)
#define NODE_IS_CHECKER(node) ((NODE_STATUS(node) & NODE_ST_CHECKER) != 0)
#define NODE_IS_FIXED_OPTION(node) ((NODE_STATUS(node) & NODE_ST_FIXED_OPTION) != 0)
#define NODE_IS_SUPER(node) ((NODE_STATUS(node) & NODE_ST_SUPER) != 0)
#define NODE_IS_PROHIBIT_RECURSION(node) \
((NODE_STATUS(node) & NODE_ST_PROHIBIT_RECURSION) != 0)
#define NODE_IS_STRICT_REAL_REPEAT(node) \
((NODE_STATUS(node) & NODE_ST_STRICT_REAL_REPEAT) != 0)
#define NODE_BODY(node) ((node)->u.base.body)
#define NODE_QUANT_BODY(node) ((node)->body)
#define NODE_BAG_BODY(node) ((node)->body)
#define NODE_CALL_BODY(node) ((node)->body)
#define NODE_ANCHOR_BODY(node) ((node)->body)
#define SCANENV_MEMENV_SIZE 8
#define SCANENV_MEMENV(senv) \
(IS_NOT_NULL((senv)->mem_env_dynamic) ? \
@@ -431,7 +434,7 @@ extern void onig_node_conv_to_str_node P_((Node* node, int raw));
extern int onig_node_str_cat P_((Node* node, const UChar* s, const UChar* end));
extern int onig_node_str_set P_((Node* node, const UChar* s, const UChar* end));
extern void onig_node_free P_((Node* node));
extern Node* onig_node_new_bag P_((enum BagType type));
extern Node* onig_node_new_enclosure P_((int type));
extern Node* onig_node_new_anchor P_((int type, int ascii_mode));
extern Node* onig_node_new_str P_((const UChar* s, const UChar* end));
extern Node* onig_node_new_list P_((Node* left, Node* right));
+7 -3
View File
@@ -2,7 +2,7 @@
regposerr.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2019 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,7 +37,11 @@
#include "config.h"
#include "onigposix.h"
#include <string.h>
#ifdef HAVE_STRING_H
# include <string.h>
#else
# include <strings.h>
#endif
#if defined(__GNUC__)
# define ARG_UNUSED __attribute__ ((unused))
@@ -80,7 +84,7 @@ static char* ESTRING[] = {
extern size_t
regerror(int posix_ecode, const regex_t* reg ARG_UNUSED, char* buf,
size_t size)
size_t size)
{
char* s;
char tbuf[35];
+6 -10
View File
@@ -2,7 +2,7 @@
regposix.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2019 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,7 +30,6 @@
#define regex_t onig_regex_t
#include "regint.h"
#undef regex_t
#include "onigposix.h"
#define ONIG_C(reg) ((onig_regex_t* )((reg)->onig))
@@ -149,8 +148,6 @@ regcomp(regex_t* reg, const char* pattern, int posix_options)
OnigSyntaxType* syntax = OnigDefaultSyntax;
OnigOptionType options;
reg->onig = (void* )0;
if ((posix_options & REG_EXTENDED) == 0)
syntax = ONIG_SYNTAX_POSIX_BASIC;
@@ -166,8 +163,8 @@ regcomp(regex_t* reg, const char* pattern, int posix_options)
ENC_STRING_LEN(OnigEncDefaultCharEncoding, pattern, len);
r = onig_new(PONIG_C(reg), (UChar* )pattern, (UChar* )(pattern + len),
options, OnigEncDefaultCharEncoding, syntax,
(OnigErrorInfo* )NULL);
options, OnigEncDefaultCharEncoding, syntax,
(OnigErrorInfo* )NULL);
if (r != ONIG_NORMAL) {
return onig2posix_error_code(r);
}
@@ -178,7 +175,7 @@ regcomp(regex_t* reg, const char* pattern, int posix_options)
extern int
regexec(regex_t* reg, const char* str, size_t nmatch,
regmatch_t pmatch[], int posix_options)
regmatch_t pmatch[], int posix_options)
{
int r, i, len;
UChar* end;
@@ -206,7 +203,7 @@ regexec(regex_t* reg, const char* str, size_t nmatch,
ENC_STRING_LEN(ONIG_C(reg)->enc, str, len);
end = (UChar* )(str + len);
r = onig_search(ONIG_C(reg), (UChar* )str, end, (UChar* )str, end,
(OnigRegion* )pm, options);
(OnigRegion* )pm, options);
if (r >= 0) {
r = 0; /* Match */
@@ -238,7 +235,6 @@ extern void
regfree(regex_t* reg)
{
onig_free(ONIG_C(reg));
reg->onig = (void* )0;
}
@@ -292,7 +288,7 @@ typedef struct {
static int
i_wrapper(const UChar* name, const UChar* name_end, int ng, int* gs,
onig_regex_t* reg ARG_UNUSED, void* arg)
onig_regex_t* reg ARG_UNUSED, void* arg)
{
i_wrap* warg = (i_wrap* )arg;
+5 -7
View File
@@ -2,7 +2,7 @@
regsyntax.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2019 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -67,8 +67,8 @@ OnigSyntaxType OnigSyntaxPosixExtended = {
ONIG_SYN_OP_BRACE_INTERVAL |
ONIG_SYN_OP_PLUS_ONE_INF | ONIG_SYN_OP_QMARK_ZERO_ONE | ONIG_SYN_OP_VBAR_ALT )
, 0
, ( ONIG_SYN_CONTEXT_INDEP_ANCHORS |
ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS | ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS |
, ( ONIG_SYN_CONTEXT_INDEP_ANCHORS |
ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS | ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS |
ONIG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP |
ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC )
, ( ONIG_OPTION_SINGLELINE | ONIG_OPTION_MULTILINE )
@@ -174,12 +174,11 @@ OnigSyntaxType OnigSyntaxPerl = {
& ~ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END )
, ( ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE |
ONIG_SYN_OP2_QMARK_GROUP_EFFECT | ONIG_SYN_OP2_OPTION_PERL |
ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT | ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL |
ONIG_SYN_OP2_QMARK_LPAREN_IF_ELSE |
ONIG_SYN_OP2_QMARK_TILDE_ABSENT_GROUP |
ONIG_SYN_OP2_QMARK_BRACE_CALLOUT_CONTENTS |
ONIG_SYN_OP2_ASTERISK_CALLOUT_NAME |
ONIG_SYN_OP2_ESC_X_Y_TEXT_SEGMENT |
ONIG_SYN_OP2_ESC_X_Y_GRAPHEME_CLUSTER |
ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY |
ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT |
ONIG_SYN_OP2_ESC_CAPITAL_K_KEEP |
@@ -208,12 +207,11 @@ OnigSyntaxType OnigSyntaxPerl_NG = {
& ~ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END )
, ( ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE |
ONIG_SYN_OP2_QMARK_GROUP_EFFECT | ONIG_SYN_OP2_OPTION_PERL |
ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT | ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL |
ONIG_SYN_OP2_QMARK_LPAREN_IF_ELSE |
ONIG_SYN_OP2_QMARK_TILDE_ABSENT_GROUP |
ONIG_SYN_OP2_QMARK_BRACE_CALLOUT_CONTENTS |
ONIG_SYN_OP2_ASTERISK_CALLOUT_NAME |
ONIG_SYN_OP2_ESC_X_Y_TEXT_SEGMENT |
ONIG_SYN_OP2_ESC_X_Y_GRAPHEME_CLUSTER |
ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY |
ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT |
ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP |
+17 -13
View File
@@ -85,11 +85,11 @@ is_valid_mbc_string(const UChar* p, const UChar* end)
}
else if (*p < 0xa1) {
if (*p == 0xa0 || *p == 0x80)
return FALSE;
return FALSE;
p++;
if (p >= end) return FALSE;
if (*p < 0x40 || *p > 0xfc || *p == 0x7f)
return FALSE;
return FALSE;
p++;
}
else if (*p < 0xe0) {
@@ -99,7 +99,7 @@ is_valid_mbc_string(const UChar* p, const UChar* end)
p++;
if (p >= end) return FALSE;
if (*p < 0x40 || *p > 0xfc || *p == 0x7f)
return FALSE;
return FALSE;
p++;
}
else
@@ -113,7 +113,10 @@ static int
code_to_mbclen(OnigCodePoint code)
{
if (code < 256) {
return EncLen_SJIS[(int )code] == 1;
if (EncLen_SJIS[(int )code] == 1)
return 1;
else
return 0;
}
else if (code <= 0xffff) {
return 2;
@@ -158,7 +161,7 @@ code_to_mbc(OnigCodePoint code, UChar *buf)
static int
mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED,
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
{
const UChar* p = *pp;
@@ -181,10 +184,11 @@ mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED,
#if 0
static int
is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end)
is_mbc_ambiguous(OnigCaseFoldType flag,
const UChar** pp, const UChar* end)
{
return onigenc_mbn_is_mbc_ambiguous(ONIG_ENCODING_SJIS, flag, pp, end);
}
#endif
@@ -216,10 +220,10 @@ left_adjust_char_head(const UChar* start, const UChar* s)
if (SJIS_ISMB_TRAIL(*p)) {
while (p > start) {
if (! SJIS_ISMB_FIRST(*--p)) {
p++;
break;
p++;
break;
}
}
}
}
len = enclen(ONIG_ENCODING_SJIS, p);
if (p + len > s) return (UChar* )p;
@@ -280,7 +284,7 @@ is_code_ctype(OnigCodePoint code, unsigned int ctype)
return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype);
else {
if (CTYPE_IS_WORD_GRAPH_PRINT(ctype)) {
return (code_to_mbclen(code) > 1 ? TRUE : FALSE);
return (code_to_mbclen(code) > 1 ? TRUE : FALSE);
}
}
}
@@ -297,7 +301,7 @@ is_code_ctype(OnigCodePoint code, unsigned int ctype)
static int
get_ctype_code_range(OnigCtype ctype, OnigCodePoint* sb_out,
const OnigCodePoint* ranges[])
const OnigCodePoint* ranges[])
{
if (ctype <= ONIGENC_MAX_STD_CTYPE) {
return ONIG_NO_SUPPORT_CONFIG;
@@ -334,6 +338,6 @@ OnigEncodingType OnigEncodingSJIS = {
NULL, /* init */
NULL, /* is_initialized */
is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1_OR_0,
ENC_FLAG_ASCII_COMPATIBLE,
0, 0
};
+1 -1
View File
@@ -1,5 +1,5 @@
/* ANSI-C code produced by gperf version 3.1 */
/* Command-line: /usr/local/bin/gperf -pt -T -L ANSI-C -N onigenc_sjis_lookup_property_name --output-file gperf2.tmp sjis_prop.gperf */
/* Command-line: /usr/bin/gperf -pt -T -L ANSI-C -N onigenc_sjis_lookup_property_name --output-file gperf2.tmp sjis_prop.gperf */
/* Computed positions: -k'1,3' */
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
+7 -286
View File
@@ -2,7 +2,7 @@
unicode.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2019 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -504,281 +504,6 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
#endif
#ifdef USE_UNICODE_WORD_BREAK
enum WB_TYPE {
WB_Any = 0,
WB_ALetter,
WB_CR,
WB_Double_Quote,
WB_Extend,
WB_ExtendNumLet,
WB_Format,
WB_Hebrew_Letter,
WB_Katakana,
WB_LF,
WB_MidLetter,
WB_MidNum,
WB_MidNumLet,
WB_Newline,
WB_Numeric,
WB_Regional_Indicator,
WB_Single_Quote,
WB_WSegSpace,
WB_ZWJ,
};
typedef struct {
OnigCodePoint start;
OnigCodePoint end;
enum WB_TYPE type;
} WB_RANGE_TYPE;
#include "unicode_wb_data.c"
static enum WB_TYPE
wb_get_type(OnigCodePoint code)
{
OnigCodePoint low, high, x;
enum WB_TYPE type;
for (low = 0, high = (OnigCodePoint )WB_RANGE_NUM; low < high; ) {
x = (low + high) >> 1;
if (code > WB_RANGES[x].end)
low = x + 1;
else
high = x;
}
type = (low < (OnigCodePoint )WB_RANGE_NUM &&
code >= WB_RANGES[low].start) ?
WB_RANGES[low].type : WB_Any;
return type;
}
#define IS_WB_IGNORE_TAIL(t) ((t) == WB_Extend || (t) == WB_Format || (t) == WB_ZWJ)
#define IS_WB_AHLetter(t) ((t) == WB_ALetter || (t) == WB_Hebrew_Letter)
#define IS_WB_MidNumLetQ(t) ((t) == WB_MidNumLet || (t) == WB_Single_Quote)
static int
wb_get_next_main_code(OnigEncoding enc, UChar* p, const UChar* end,
OnigCodePoint* rcode, enum WB_TYPE* rtype)
{
OnigCodePoint code;
enum WB_TYPE type;
while (TRUE) {
p += enclen(enc, p);
if (p >= end) break;
code = ONIGENC_MBC_TO_CODE(enc, p, end);
type = wb_get_type(code);
if (! IS_WB_IGNORE_TAIL(type)) {
*rcode = code;
*rtype = type;
return 1;
}
}
return 0;
}
extern int
onigenc_wb_is_break_position(OnigEncoding enc, UChar* p, UChar* prev,
const UChar* start, const UChar* end)
{
int r;
UChar* pp;
OnigCodePoint cfrom;
OnigCodePoint cfrom2;
OnigCodePoint cto;
OnigCodePoint cto2;
enum WB_TYPE from;
enum WB_TYPE from2;
enum WB_TYPE to;
enum WB_TYPE to2;
/* WB1: sot / Any */
if (p == start) return TRUE;
/* WB2: Any / eot */
if (p == end) return TRUE;
if (IS_NULL(prev)) {
prev = onigenc_get_prev_char_head(enc, start, p);
if (IS_NULL(prev)) return TRUE;
}
cfrom = ONIGENC_MBC_TO_CODE(enc, prev, end);
cto = ONIGENC_MBC_TO_CODE(enc, p, end);
from = wb_get_type(cfrom);
to = wb_get_type(cto);
/* short cut */
if (from == 0 && to == 0) goto WB999;
/* WB3: CR + LF */
if (from == WB_CR && to == WB_LF) return FALSE;
/* WB3a: (Newline|CR|LF) / */
if (from == WB_Newline || from == WB_CR || from == WB_LF) return TRUE;
/* WB3b: / (Newline|CR|LF) */
if (to == WB_Newline || to == WB_CR || to == WB_LF) return TRUE;
/* WB3c: ZWJ + {Extended_Pictographic} */
if (from == WB_ZWJ) {
if (onigenc_unicode_is_code_ctype(cto, PROP_INDEX_EXTENDEDPICTOGRAPHIC))
return FALSE;
}
/* WB3d: WSegSpace + WSegSpace */
if (from == WB_WSegSpace && to == WB_WSegSpace) return FALSE;
/* WB4: X (Extend|Format|ZWJ)* -> X */
if (IS_WB_IGNORE_TAIL(to)) return FALSE;
if (IS_WB_IGNORE_TAIL(from)) {
while ((pp = onigenc_get_prev_char_head(enc, start, prev)) != NULL) {
prev = pp;
cfrom = ONIGENC_MBC_TO_CODE(enc, prev, end);
from = wb_get_type(cfrom);
if (! IS_WB_IGNORE_TAIL(from))
break;
}
}
if (IS_WB_AHLetter(from)) {
/* WB5: AHLetter + AHLetter */
if (IS_WB_AHLetter(to)) return FALSE;
/* WB6: AHLetter + (MidLetter | MidNumLetQ) AHLetter */
if (to == WB_MidLetter || IS_WB_MidNumLetQ(to)) {
r = wb_get_next_main_code(enc, p, end, &cto2, &to2);
if (r == 1) {
if (IS_WB_AHLetter(to2)) return FALSE;
}
}
}
/* WB7: AHLetter (MidLetter | MidNumLetQ) + AHLetter */
if (from == WB_MidLetter || IS_WB_MidNumLetQ(from)) {
if (IS_WB_AHLetter(to)) {
from2 = WB_Any;
while ((pp = onigenc_get_prev_char_head(enc, start, prev)) != NULL) {
prev = pp;
cfrom2 = ONIGENC_MBC_TO_CODE(enc, prev, end);
from2 = wb_get_type(cfrom2);
if (! IS_WB_IGNORE_TAIL(from2))
break;
}
if (IS_WB_AHLetter(from2)) return FALSE;
}
}
if (from == WB_Hebrew_Letter) {
/* WB7a: Hebrew_Letter + Single_Quote */
if (to == WB_Single_Quote) return FALSE;
/* WB7b: Hebrew_Letter + Double_Quote Hebrew_Letter */
if (to == WB_Double_Quote) {
r = wb_get_next_main_code(enc, p, end, &cto2, &to2);
if (r == 1) {
if (to2 == WB_Hebrew_Letter) return FALSE;
}
}
}
/* WB7c: Hebrew_Letter Double_Quote + Hebrew_Letter */
if (from == WB_Double_Quote) {
if (to == WB_Hebrew_Letter) {
from2 = WB_Any;
while ((pp = onigenc_get_prev_char_head(enc, start, prev)) != NULL) {
prev = pp;
cfrom2 = ONIGENC_MBC_TO_CODE(enc, prev, end);
from2 = wb_get_type(cfrom2);
if (! IS_WB_IGNORE_TAIL(from2))
break;
}
if (from2 == WB_Hebrew_Letter) return FALSE;
}
}
if (to == WB_Numeric) {
/* WB8: Numeric + Numeric */
if (from == WB_Numeric) return FALSE;
/* WB9: AHLetter + Numeric */
if (IS_WB_AHLetter(from)) return FALSE;
/* WB11: Numeric (MidNum | MidNumLetQ) + Numeric */
if (from == WB_MidNum || IS_WB_MidNumLetQ(from)) {
from2 = WB_Any;
while ((pp = onigenc_get_prev_char_head(enc, start, prev)) != NULL) {
prev = pp;
cfrom2 = ONIGENC_MBC_TO_CODE(enc, prev, end);
from2 = wb_get_type(cfrom2);
if (! IS_WB_IGNORE_TAIL(from2))
break;
}
if (from2 == WB_Numeric) return FALSE;
}
}
if (from == WB_Numeric) {
/* WB10: Numeric + AHLetter */
if (IS_WB_AHLetter(to)) return FALSE;
/* WB12: Numeric + (MidNum | MidNumLetQ) Numeric */
if (to == WB_MidNum || IS_WB_MidNumLetQ(to)) {
r = wb_get_next_main_code(enc, p, end, &cto2, &to2);
if (r == 1) {
if (to2 == WB_Numeric) return FALSE;
}
}
}
/* WB13: Katakana + Katakana */
if (from == WB_Katakana && to == WB_Katakana) return FALSE;
/* WB13a: (AHLetter | Numeric | Katakana | ExtendNumLet) + ExtendNumLet */
if (IS_WB_AHLetter(from) || from == WB_Numeric || from == WB_Katakana
|| from == WB_ExtendNumLet) {
if (to == WB_ExtendNumLet) return FALSE;
}
/* WB13b: ExtendNumLet + (AHLetter | Numeric | Katakana) */
if (from == WB_ExtendNumLet) {
if (IS_WB_AHLetter(to) || to == WB_Numeric || to == WB_Katakana)
return FALSE;
}
/* WB15: sot (RI RI)* RI + RI */
/* WB16: [^RI] (RI RI)* RI + RI */
if (from == WB_Regional_Indicator && to == WB_Regional_Indicator) {
int n = 0;
while ((prev = onigenc_get_prev_char_head(enc, start, prev)) != NULL) {
cfrom2 = ONIGENC_MBC_TO_CODE(enc, prev, end);
from2 = wb_get_type(cfrom2);
if (from2 != WB_Regional_Indicator)
break;
n++;
}
if ((n % 2) == 0) return FALSE;
}
WB999:
/* WB999: Any / Any */
return TRUE;
}
#endif /* USE_UNICODE_WORD_BREAK */
#ifdef USE_UNICODE_EXTENDED_GRAPHEME_CLUSTER
enum EGCB_BREAK_TYPE {
@@ -932,7 +657,8 @@ onigenc_egcb_is_break_position(OnigEncoding enc, UChar* p, UChar* prev,
#ifdef USE_UNICODE_EXTENDED_GRAPHEME_CLUSTER
if (! ONIGENC_IS_UNICODE_ENCODING(enc)) {
return from != 0x000d || to != 0x000a;
if (from == 0x000d && to == 0x000a) return 0;
else return 1;
}
btype = unicode_egcb_is_break_2code(from, to);
@@ -975,7 +701,8 @@ onigenc_egcb_is_break_position(OnigEncoding enc, UChar* p, UChar* prev,
return 1;
#else
return from != 0x000d || to != 0x000a;
if (from == 0x000d && to == 0x000a) return 0;
else return 1;
#endif /* USE_UNICODE_EXTENDED_GRAPHEME_CLUSTER */
}
@@ -1002,7 +729,6 @@ onig_unicode_define_user_property(const char* name, OnigCodePoint* ranges)
int len;
int c;
char* s;
UChar* uname;
if (UserDefinedPropertyNum >= USER_DEFINED_PROPERTY_MAX_NUM)
return ONIGERR_TOO_MANY_USER_DEFINED_OBJECTS;
@@ -1015,11 +741,10 @@ onig_unicode_define_user_property(const char* name, OnigCodePoint* ranges)
if (s == 0)
return ONIGERR_MEMORY;
uname = (UChar* )name;
n = 0;
for (i = 0; i < len; i++) {
c = uname[i];
if (c < 0x20 || c >= 0x80) {
c = name[i];
if (c <= 0 || c >= 0x80) {
xfree(s);
return ONIGERR_INVALID_CHAR_PROPERTY_NAME;
}
@@ -1033,10 +758,6 @@ onig_unicode_define_user_property(const char* name, OnigCodePoint* ranges)
if (UserDefinedPropertyTable == 0) {
UserDefinedPropertyTable = onig_st_init_strend_table_with_size(10);
if (IS_NULL(UserDefinedPropertyTable)) {
xfree(s);
return ONIGERR_MEMORY;
}
}
e = UserDefinedPropertyRanges + UserDefinedPropertyNum;
+13 -18
View File
@@ -25,7 +25,7 @@
* SUCH DAMAGE.
*/
#define GRAPHEME_BREAK_PROPERTY_VERSION 12_1_0
#define GRAPHEME_BREAK_PROPERTY_VERSION 11_0_0
/*
CR
@@ -43,7 +43,7 @@ V
ZWJ
*/
static int EGCB_RANGE_NUM = 1326;
static int EGCB_RANGE_NUM = 1321;
static EGCB_RANGE_TYPE EGCB_RANGES[] = {
{0x000000, 0x000009, EGCB_Control },
{0x00000a, 0x00000a, EGCB_LF },
@@ -197,7 +197,8 @@ static EGCB_RANGE_TYPE EGCB_RANGES[] = {
{0x000e47, 0x000e4e, EGCB_Extend },
{0x000eb1, 0x000eb1, EGCB_Extend },
{0x000eb3, 0x000eb3, EGCB_SpacingMark },
{0x000eb4, 0x000ebc, EGCB_Extend },
{0x000eb4, 0x000eb9, EGCB_Extend },
{0x000ebb, 0x000ebc, EGCB_Extend },
{0x000ec8, 0x000ecd, EGCB_Extend },
{0x000f18, 0x000f19, EGCB_Extend },
{0x000f35, 0x000f35, EGCB_Extend },
@@ -270,7 +271,9 @@ static EGCB_RANGE_TYPE EGCB_RANGES[] = {
{0x001ab0, 0x001abe, EGCB_Extend },
{0x001b00, 0x001b03, EGCB_Extend },
{0x001b04, 0x001b04, EGCB_SpacingMark },
{0x001b34, 0x001b3a, EGCB_Extend },
{0x001b34, 0x001b34, EGCB_Extend },
{0x001b35, 0x001b35, EGCB_SpacingMark },
{0x001b36, 0x001b3a, EGCB_Extend },
{0x001b3b, 0x001b3b, EGCB_SpacingMark },
{0x001b3c, 0x001b3c, EGCB_Extend },
{0x001b3d, 0x001b41, EGCB_SpacingMark },
@@ -302,6 +305,7 @@ static EGCB_RANGE_TYPE EGCB_RANGES[] = {
{0x001ce1, 0x001ce1, EGCB_SpacingMark },
{0x001ce2, 0x001ce8, EGCB_Extend },
{0x001ced, 0x001ced, EGCB_Extend },
{0x001cf2, 0x001cf3, EGCB_SpacingMark },
{0x001cf4, 0x001cf4, EGCB_Extend },
{0x001cf7, 0x001cf7, EGCB_SpacingMark },
{0x001cf8, 0x001cf9, EGCB_Extend },
@@ -344,8 +348,8 @@ static EGCB_RANGE_TYPE EGCB_RANGES[] = {
{0x00a9b4, 0x00a9b5, EGCB_SpacingMark },
{0x00a9b6, 0x00a9b9, EGCB_Extend },
{0x00a9ba, 0x00a9bb, EGCB_SpacingMark },
{0x00a9bc, 0x00a9bd, EGCB_Extend },
{0x00a9be, 0x00a9c0, EGCB_SpacingMark },
{0x00a9bc, 0x00a9bc, EGCB_Extend },
{0x00a9bd, 0x00a9c0, EGCB_SpacingMark },
{0x00a9e5, 0x00a9e5, EGCB_Extend },
{0x00aa29, 0x00aa2e, EGCB_Extend },
{0x00aa2f, 0x00aa30, EGCB_SpacingMark },
@@ -1173,6 +1177,7 @@ static EGCB_RANGE_TYPE EGCB_RANGES[] = {
{0x00d789, 0x00d7a3, EGCB_LVT },
{0x00d7b0, 0x00d7c6, EGCB_V },
{0x00d7cb, 0x00d7fb, EGCB_T },
{0x00d800, 0x00dfff, EGCB_Control },
{0x00fb1e, 0x00fb1e, EGCB_Extend },
{0x00fe00, 0x00fe0f, EGCB_Extend },
{0x00fe20, 0x00fe2f, EGCB_Extend },
@@ -1286,12 +1291,6 @@ static EGCB_RANGE_TYPE EGCB_RANGES[] = {
{0x01182f, 0x011837, EGCB_Extend },
{0x011838, 0x011838, EGCB_SpacingMark },
{0x011839, 0x01183a, EGCB_Extend },
{0x0119d1, 0x0119d3, EGCB_SpacingMark },
{0x0119d4, 0x0119d7, EGCB_Extend },
{0x0119da, 0x0119db, EGCB_Extend },
{0x0119dc, 0x0119df, EGCB_SpacingMark },
{0x0119e0, 0x0119e0, EGCB_Extend },
{0x0119e4, 0x0119e4, EGCB_SpacingMark },
{0x011a01, 0x011a0a, EGCB_Extend },
{0x011a33, 0x011a38, EGCB_Extend },
{0x011a39, 0x011a39, EGCB_SpacingMark },
@@ -1301,7 +1300,7 @@ static EGCB_RANGE_TYPE EGCB_RANGES[] = {
{0x011a51, 0x011a56, EGCB_Extend },
{0x011a57, 0x011a58, EGCB_SpacingMark },
{0x011a59, 0x011a5b, EGCB_Extend },
{0x011a84, 0x011a89, EGCB_Prepend },
{0x011a86, 0x011a89, EGCB_Prepend },
{0x011a8a, 0x011a96, EGCB_Extend },
{0x011a97, 0x011a97, EGCB_SpacingMark },
{0x011a98, 0x011a99, EGCB_Extend },
@@ -1331,11 +1330,9 @@ static EGCB_RANGE_TYPE EGCB_RANGES[] = {
{0x011d97, 0x011d97, EGCB_Extend },
{0x011ef3, 0x011ef4, EGCB_Extend },
{0x011ef5, 0x011ef6, EGCB_SpacingMark },
{0x013430, 0x013438, EGCB_Control },
{0x016af0, 0x016af4, EGCB_Extend },
{0x016b30, 0x016b36, EGCB_Extend },
{0x016f4f, 0x016f4f, EGCB_Extend },
{0x016f51, 0x016f87, EGCB_SpacingMark },
{0x016f51, 0x016f7e, EGCB_SpacingMark },
{0x016f8f, 0x016f92, EGCB_Extend },
{0x01bc9d, 0x01bc9e, EGCB_Extend },
{0x01bca0, 0x01bca3, EGCB_Control },
@@ -1360,8 +1357,6 @@ static EGCB_RANGE_TYPE EGCB_RANGES[] = {
{0x01e01b, 0x01e021, EGCB_Extend },
{0x01e023, 0x01e024, EGCB_Extend },
{0x01e026, 0x01e02a, EGCB_Extend },
{0x01e130, 0x01e136, EGCB_Extend },
{0x01e2ec, 0x01e2ef, EGCB_Extend },
{0x01e8d0, 0x01e8d6, EGCB_Extend },
{0x01e944, 0x01e94a, EGCB_Extend },
{0x01f1e6, 0x01f1ff, EGCB_Regional_Indicator },
File diff suppressed because it is too large. Load diff
@@ -1,7 +1,7 @@
/* This file was converted by gperf_fold_key_conv.py
from gperf output file. */
/* ANSI-C code produced by gperf version 3.1 */
/* Command-line: /usr/local/bin/gperf -n -C -T -c -t -j1 -L ANSI-C -F,-1 -N onigenc_unicode_fold2_key unicode_fold2_key.gperf */
/* Command-line: /usr/bin/gperf -n -C -T -c -t -j1 -L ANSI-C -F,-1 -N onigenc_unicode_fold2_key unicode_fold2_key.gperf */
/* Computed positions: -k'3,6' */
@@ -225,3 +225,5 @@ onigenc_unicode_fold2_key(OnigCodePoint codes[])
}
return -1;
}
@@ -1,7 +1,7 @@
/* This file was converted by gperf_fold_key_conv.py
from gperf output file. */
/* ANSI-C code produced by gperf version 3.1 */
/* Command-line: /usr/local/bin/gperf -n -C -T -c -t -j1 -L ANSI-C -F,-1 -N onigenc_unicode_fold3_key unicode_fold3_key.gperf */
/* Command-line: /usr/bin/gperf -n -C -T -c -t -j1 -L ANSI-C -F,-1 -N onigenc_unicode_fold3_key unicode_fold3_key.gperf */
/* Computed positions: -k'3,6,9' */
@@ -135,3 +135,5 @@ onigenc_unicode_fold3_key(OnigCodePoint codes[])
}
return -1;
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+10 -36
View File
@@ -2,7 +2,7 @@
utf16_be.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2019 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -103,25 +103,7 @@ utf16be_mbc_enc_len(const UChar* p)
static int
is_valid_mbc_string(const UChar* s, const UChar* end)
{
while (s < end) {
int len = utf16be_mbc_enc_len(s);
if (len == 4) {
if (s + 2 >= end)
return FALSE;
if (! UTF16_IS_SURROGATE_SECOND(*(s+2)))
return FALSE;
}
else
if (UTF16_IS_SURROGATE_SECOND(*s))
return FALSE;
s += len;
}
if (s != end)
return FALSE;
else
return TRUE;
return onigenc_length_check_is_valid_mbc_string(ONIG_ENCODING_UTF16_BE, s, end);
}
static int
@@ -166,15 +148,7 @@ utf16be_mbc_to_code(const UChar* p, const UChar* end)
static int
utf16be_code_to_mbclen(OnigCodePoint code)
{
if (code > 0xffff) {
if (code > 0x10ffff)
return ONIGERR_INVALID_CODE_POINT_VALUE;
else
return 4;
}
else {
return 2;
}
return (code > 0xffff ? 4 : 2);
}
static int
@@ -202,7 +176,7 @@ utf16be_code_to_mbc(OnigCodePoint code, UChar *buf)
static int
utf16be_mbc_case_fold(OnigCaseFoldType flag,
const UChar** pp, const UChar* end, UChar* fold)
const UChar** pp, const UChar* end, UChar* fold)
{
const UChar* p = *pp;
@@ -226,7 +200,7 @@ utf16be_mbc_case_fold(OnigCaseFoldType flag,
}
else
return onigenc_unicode_mbc_case_fold(ONIG_ENCODING_UTF16_BE, flag,
pp, end, fold);
pp, end, fold);
}
#if 0
@@ -246,7 +220,8 @@ utf16be_is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* e
}
c = *p;
v = ONIGENC_IS_UNICODE_ISO_8859_1_BIT_CTYPE(c, (BIT_CTYPE_UPPER | BIT_CTYPE_LOWER));
v = ONIGENC_IS_UNICODE_ISO_8859_1_BIT_CTYPE(c,
(BIT_CTYPE_UPPER | BIT_CTYPE_LOWER));
if ((v | BIT_CTYPE_LOWER) != 0) {
/* 0xaa, 0xb5, 0xba are lower case letter, but can't convert. */
@@ -271,8 +246,7 @@ utf16be_left_adjust_char_head(const UChar* start, const UChar* s)
s--;
}
if (UTF16_IS_SURROGATE_SECOND(*s) && s > start + 1 &&
UTF16_IS_SURROGATE_FIRST(*(s-2)))
if (UTF16_IS_SURROGATE_SECOND(*s) && s > start + 1)
s -= 2;
return (UChar* )s;
@@ -283,7 +257,7 @@ utf16be_get_case_fold_codes_by_str(OnigCaseFoldType flag,
const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
{
return onigenc_unicode_get_case_fold_codes_by_str(ONIG_ENCODING_UTF16_BE,
flag, p, end, items);
flag, p, end, items);
}
OnigEncodingType OnigEncodingUTF16_BE = {
@@ -306,6 +280,6 @@ OnigEncodingType OnigEncodingUTF16_BE = {
init,
0, /* is_initialized */
is_valid_mbc_string,
ENC_FLAG_UNICODE|ENC_FLAG_SKIP_OFFSET_2,
ENC_FLAG_UNICODE,
0, 0
};
+9 -27
View File
@@ -2,7 +2,7 @@
utf16_le.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2019 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -95,15 +95,7 @@ static const int EncLen_UTF16[] = {
static int
utf16le_code_to_mbclen(OnigCodePoint code)
{
if (code > 0xffff) {
if (code > 0x10ffff)
return ONIGERR_INVALID_CODE_POINT_VALUE;
else
return 4;
}
else {
return 2;
}
return (code > 0xffff ? 4 : 2);
}
static int
@@ -118,16 +110,7 @@ is_valid_mbc_string(const UChar* p, const UChar* end)
const UChar* end1 = end - 1;
while (p < end1) {
int len = utf16le_mbc_enc_len(p);
if (len == 4) {
if (p + 3 < end && ! UTF16_IS_SURROGATE_SECOND(*(p + 3)))
return FALSE;
}
else
if (UTF16_IS_SURROGATE_SECOND(*(p + 1)))
return FALSE;
p += len;
p += utf16le_mbc_enc_len(p);
}
if (p != end)
@@ -202,7 +185,7 @@ utf16le_code_to_mbc(OnigCodePoint code, UChar *buf)
static int
utf16le_mbc_case_fold(OnigCaseFoldType flag,
const UChar** pp, const UChar* end, UChar* fold)
const UChar** pp, const UChar* end, UChar* fold)
{
const UChar* p = *pp;
@@ -225,13 +208,13 @@ utf16le_mbc_case_fold(OnigCaseFoldType flag,
}
else
return onigenc_unicode_mbc_case_fold(ONIG_ENCODING_UTF16_LE, flag, pp, end,
fold);
fold);
}
#if 0
static int
utf16le_is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp,
const UChar* end)
const UChar* end)
{
const UChar* p = *pp;
@@ -270,8 +253,7 @@ utf16le_left_adjust_char_head(const UChar* start, const UChar* s)
s--;
}
if (UTF16_IS_SURROGATE_SECOND(*(s+1)) && s > start + 1 &&
UTF16_IS_SURROGATE_FIRST(*(s-1)))
if (UTF16_IS_SURROGATE_SECOND(*(s+1)) && s > start + 1)
s -= 2;
return (UChar* )s;
@@ -282,7 +264,7 @@ utf16le_get_case_fold_codes_by_str(OnigCaseFoldType flag,
const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
{
return onigenc_unicode_get_case_fold_codes_by_str(ONIG_ENCODING_UTF16_LE,
flag, p, end, items);
flag, p, end, items);
}
OnigEncodingType OnigEncodingUTF16_LE = {
@@ -305,6 +287,6 @@ OnigEncodingType OnigEncodingUTF16_LE = {
init,
0, /* is_initialized */
is_valid_mbc_string,
ENC_FLAG_UNICODE|ENC_FLAG_SKIP_OFFSET_1,
ENC_FLAG_UNICODE,
0, 0
};
+4 -4
View File
@@ -91,7 +91,7 @@ utf32be_code_to_mbc(OnigCodePoint code, UChar *buf)
static int
utf32be_mbc_case_fold(OnigCaseFoldType flag,
const UChar** pp, const UChar* end, UChar* fold)
const UChar** pp, const UChar* end, UChar* fold)
{
const UChar* p = *pp;
@@ -117,7 +117,7 @@ utf32be_mbc_case_fold(OnigCaseFoldType flag,
}
else
return onigenc_unicode_mbc_case_fold(ONIG_ENCODING_UTF32_BE, flag, pp, end,
fold);
fold);
}
#if 0
@@ -169,7 +169,7 @@ utf32be_get_case_fold_codes_by_str(OnigCaseFoldType flag,
const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
{
return onigenc_unicode_get_case_fold_codes_by_str(ONIG_ENCODING_UTF32_BE,
flag, p, end, items);
flag, p, end, items);
}
OnigEncodingType OnigEncodingUTF32_BE = {
@@ -192,6 +192,6 @@ OnigEncodingType OnigEncodingUTF32_BE = {
NULL, /* init */
NULL, /* is_initialized */
is_valid_mbc_string,
ENC_FLAG_UNICODE|ENC_FLAG_SKIP_OFFSET_4,
ENC_FLAG_UNICODE,
0, 0
};
+3 -3
View File
@@ -91,7 +91,7 @@ utf32le_code_to_mbc(OnigCodePoint code, UChar *buf)
static int
utf32le_mbc_case_fold(OnigCaseFoldType flag,
const UChar** pp, const UChar* end, UChar* fold)
const UChar** pp, const UChar* end, UChar* fold)
{
const UChar* p = *pp;
@@ -169,7 +169,7 @@ utf32le_get_case_fold_codes_by_str(OnigCaseFoldType flag,
const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
{
return onigenc_unicode_get_case_fold_codes_by_str(ONIG_ENCODING_UTF32_LE,
flag, p, end, items);
flag, p, end, items);
}
OnigEncodingType OnigEncodingUTF32_LE = {
@@ -192,6 +192,6 @@ OnigEncodingType OnigEncodingUTF32_LE = {
NULL, /* init */
NULL, /* is_initialized */
is_valid_mbc_string,
ENC_FLAG_UNICODE|ENC_FLAG_SKIP_OFFSET_1,
ENC_FLAG_UNICODE,
0, 0
};
+11 -26
View File
@@ -2,7 +2,7 @@
utf8.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2019 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -29,9 +29,6 @@
#include "regenc.h"
/* U+0000 - U+10FFFF */
#define USE_RFC3629_RANGE
/* #define USE_INVALID_CODE_SCHEME */
#ifdef USE_INVALID_CODE_SCHEME
@@ -60,11 +57,7 @@ static const int EncLen_UTF8[] = {
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
#ifdef USE_RFC3629_RANGE
4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
#else
4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 1, 1
#endif
};
static int
@@ -85,11 +78,11 @@ is_valid_mbc_string(const UChar* p, const UChar* end)
len = mbc_enc_len(p++);
if (len > 1) {
for (i = 1; i < len; i++) {
if (p == end)
return FALSE;
if (p == end)
return FALSE;
if (! utf8_istail(*p++))
return FALSE;
if (! utf8_istail(*p++))
return FALSE;
}
}
}
@@ -160,10 +153,8 @@ code_to_mbclen(OnigCodePoint code)
else if ((code & 0xfffff800) == 0) return 2;
else if ((code & 0xffff0000) == 0) return 3;
else if ((code & 0xffe00000) == 0) return 4;
#ifndef USE_RFC3629_RANGE
else if ((code & 0xfc000000) == 0) return 5;
else if ((code & 0x80000000) == 0) return 6;
#endif
#ifdef USE_INVALID_CODE_SCHEME
else if (code == INVALID_CODE_FE) return 1;
else if (code == INVALID_CODE_FF) return 1;
@@ -197,7 +188,6 @@ code_to_mbc(OnigCodePoint code, UChar *buf)
*p++ = UTF8_TRAILS(code, 12);
*p++ = UTF8_TRAILS(code, 6);
}
#ifndef USE_RFC3629_RANGE
else if ((code & 0xfc000000) == 0) {
*p++ = (UChar )(((code>>24) & 0x03) | 0xf8);
*p++ = UTF8_TRAILS(code, 18);
@@ -211,7 +201,6 @@ code_to_mbc(OnigCodePoint code, UChar *buf)
*p++ = UTF8_TRAILS(code, 12);
*p++ = UTF8_TRAILS(code, 6);
}
#endif
#ifdef USE_INVALID_CODE_SCHEME
else if (code == INVALID_CODE_FE) {
*p = 0xfe;
@@ -233,7 +222,7 @@ code_to_mbc(OnigCodePoint code, UChar *buf)
static int
mbc_case_fold(OnigCaseFoldType flag, const UChar** pp,
const UChar* end, UChar* fold)
const UChar* end, UChar* fold)
{
const UChar* p = *pp;
@@ -255,13 +244,13 @@ mbc_case_fold(OnigCaseFoldType flag, const UChar** pp,
}
else {
return onigenc_unicode_mbc_case_fold(ONIG_ENCODING_UTF8, flag,
pp, end, fold);
pp, end, fold);
}
}
static int
get_ctype_code_range(OnigCtype ctype, OnigCodePoint *sb_out,
const OnigCodePoint* ranges[])
const OnigCodePoint* ranges[])
{
*sb_out = 0x80;
return onigenc_unicode_ctype_code_range(ctype, ranges);
@@ -285,17 +274,13 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag,
const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
{
return onigenc_unicode_get_case_fold_codes_by_str(ONIG_ENCODING_UTF8,
flag, p, end, items);
flag, p, end, items);
}
OnigEncodingType OnigEncodingUTF8 = {
mbc_enc_len,
"UTF-8", /* name */
#ifdef USE_RFC3629_RANGE
4, /* max enc length */
#else
6,
#endif
6, /* max enc length */
1, /* min enc length */
onigenc_is_mbc_newline_0x0a,
mbc_to_code,
@@ -312,6 +297,6 @@ OnigEncodingType OnigEncodingUTF8 = {
NULL, /* init */
NULL, /* is_initialized */
is_valid_mbc_string,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_UNICODE|ENC_FLAG_SKIP_OFFSET_1_OR_0,
ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_UNICODE,
0, 0
};
-15
View File
@@ -1,15 +0,0 @@
--TEST--
Bug #78559 (#78559 Heap buffer overflow in mb_eregi)
--SKIPIF--
<?php
if (!extension_loaded('mbstring')) die('skip mbstring extension not available');
if (!function_exists('mb_ereg')) die('skip mb_ereg() not available');
?>
--FILE--
<?php
$str = "5b5b5b5b5b5b5b492a5bce946b5c4b5d5c6b5c4b5d5c4b5d1cceb04b5d1cceb07a73717e4b1c52525252525252525252525252525252525252525252525252492a5bce946b5c4b5d5c6b5c4b5d5c4b5d1cceb04b5d1cceb07a73717e4b1c1cceb04b5d1cceb07a73717e4b1c302c36303030ceb07b7bd2a15c305c30663f436f6e74655c5238416711087b363030302c36303030ceb07b7b7b7b7b7b7b363030302c36303030ceb07b7b7b7b7b7b7b4a01";
$str = hex2bin($str);
var_dump(mb_eregi($str, $str));
?>
--EXPECT--
bool(false)
-78
View File
@@ -1,78 +0,0 @@
--TEST--
mysqli check the session_connect_attrs table for connection attributes
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
if (!$IS_MYSQLND)
die("skip: test applies only to mysqlnd");
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
die("skip Cannot connect to the server");
/* skip test if the server version does not have session_connect_attrs table yet*/
if (!$res = mysqli_query($link, "select count(*) as count from information_schema.tables where table_schema='performance_schema' and table_name='session_connect_attrs';"))
die("skip select from information_schema.tables for session_connect_attrs query failed");
$tmp = mysqli_fetch_assoc($res);
mysqli_free_result($res);
if($tmp['count'] == "0") {
mysqli_close($link);
die("skip mysql does not support session_connect_attrs table yet");
}
/* skip test if performance_schema is OFF*/
if (!$res = mysqli_query($link, "show variables like 'performance_schema';"))
die("skip show variables like 'performance_schema' failed");
$tmp = mysqli_fetch_assoc($res);
mysqli_free_result($res);
if($tmp['Value'] == "OFF") {
mysqli_close($link);
die("skip performance_schema is OFF");
}
mysqli_close($link);
?>
--FILE--
<?php
require_once("connect.inc");
$tmp = NULL;
$link = NULL;
$res = NULL;
if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",$host, $user, $db, $port, $socket);
//in case $host is empty, do not test for _server_host field
if (isset($host) && trim($host) != '') {
if (!$res = mysqli_query($link, "select * from performance_schema.session_connect_attrs where ATTR_NAME='_server_host' and processlist_id = connection_id()")) {
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
} else {
$tmp = mysqli_fetch_assoc($res);
if (!$tmp || !isset($tmp['ATTR_NAME'])) {
echo "[003] _server_host missing\n";
} elseif ($tmp['ATTR_VALUE'] !== $host) {
printf("[004] _server_host value mismatch\n") ;
}
mysqli_free_result($res);
}
}
if (!$res = mysqli_query($link, "select * from performance_schema.session_connect_attrs where ATTR_NAME='_client_name' and processlist_id = connection_id()")) {
printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
} else {
$tmp = mysqli_fetch_assoc($res);
if (!$tmp || !isset($tmp['ATTR_NAME'])) {
echo "[006] _client_name missing\n";
} elseif ($tmp['ATTR_VALUE'] !== "mysqlnd") {
printf("[007] _client_name value mismatch\n") ;
}
mysqli_free_result($res);
}
printf("done!");
?>
--EXPECTF--
done!
-3
View File
@@ -409,9 +409,6 @@ mysqlnd_auth_change_user(MYSQLND_CONN_DATA * const conn,
auth_packet.auth_data_len = auth_plugin_data_len;
auth_packet.auth_plugin_name = auth_protocol;
if (conn->server_capabilities & CLIENT_CONNECT_ATTRS) {
auth_packet.connect_attr = conn->options->connect_attr;
}
if (conn->m->get_server_version(conn) >= 50123) {
auth_packet.charset_no = conn->charset->nr;
+1 -8
View File
@@ -510,10 +510,6 @@ MYSQLND_METHOD(mysqlnd_conn_data, get_updated_connect_flags)(MYSQLND_CONN_DATA *
}
#endif
if (conn->options->connect_attr && zend_hash_num_elements(conn->options->connect_attr)) {
mysql_flags |= CLIENT_CONNECT_ATTRS;
}
DBG_RETURN(mysql_flags);
}
/* }}} */
@@ -657,7 +653,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, connect)(MYSQLND_CONN_DATA * conn,
password.s = "";
password.l = 0;
}
if (!database.s || !database.s[0]) {
if (!database.s) {
DBG_INF_FMT("no db given, using empty string");
database.s = "";
database.l = 0;
@@ -825,9 +821,6 @@ MYSQLND_METHOD(mysqlnd_conn, connect)(MYSQLND * conn_handle,
if (PASS == conn->m->local_tx_start(conn, this_func)) {
mysqlnd_options4(conn_handle, MYSQL_OPT_CONNECT_ATTR_ADD, "_client_name", "mysqlnd");
if (hostname.l > 0) {
mysqlnd_options4(conn_handle, MYSQL_OPT_CONNECT_ATTR_ADD, "_server_host", hostname.s);
}
ret = conn->m->connect(conn, hostname, username, password, database, port, socket_or_pipe, mysql_flags);
conn->m->local_tx_end(conn, this_func, FAIL);
+1 -1
View File
@@ -546,7 +546,7 @@ size_t php_mysqlnd_auth_write(MYSQLND_CONN_DATA * conn, void * _packet)
p+= packet->auth_data_len;
}
if (packet->db_len > 0) {
if (packet->db) {
/* CLIENT_CONNECT_WITH_DB should have been set */
size_t real_db_len = MIN(MYSQLND_MAX_ALLOWED_DB_LEN, packet->db_len);
memcpy(p, packet->db, real_db_len);
+1 -4
View File
@@ -2695,10 +2695,7 @@ PHP_FUNCTION(odbc_close)
return;
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
RETURN_FALSE;
}
conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn);
if (Z_RES_P(pv_conn)->type == le_pconn) {
is_pconn = 1;
}
-14
View File
@@ -1,14 +0,0 @@
--TEST--
Bug #78473 (odbc_close() closes arbitrary resources)
--SKIPIF--
<?php
if (!extension_loaded('odbc')) die('skip odbc extension not available');
?>
--FILE--
<?php
odbc_close(STDIN);
var_dump(STDIN);
?>
--EXPECTF--
Warning: odbc_close(): supplied resource is not a valid ODBC-Link resource in %s on line %d
resource(%d) of type (stream)
+3 -3
View File
@@ -274,7 +274,7 @@ static const func_info_t func_infos[] = {
F0("sleep", MAY_BE_FALSE | MAY_BE_LONG),
F0("usleep", MAY_BE_NULL | MAY_BE_FALSE),
#if HAVE_NANOSLEEP
F0("time_nanosleep", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG),
F0("time_nanosleep", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F0("time_sleep_until", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
#endif
#if HAVE_STRPTIME
@@ -401,7 +401,7 @@ static const func_info_t func_infos[] = {
F1("system", MAY_BE_FALSE | MAY_BE_STRING),
F1("escapeshellcmd", MAY_BE_NULL | MAY_BE_STRING),
F1("escapeshellarg", MAY_BE_NULL | MAY_BE_STRING),
F1("passthru", MAY_BE_NULL | MAY_BE_FALSE),
F1("passthru", MAY_BE_FALSE | MAY_BE_STRING),
F1("shell_exec", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
#ifdef PHP_CAN_SUPPORT_PROC_OPEN
F1("proc_open", MAY_BE_FALSE | MAY_BE_RESOURCE),
@@ -1291,7 +1291,7 @@ static const func_info_t func_infos[] = {
F1("hash_hmac_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("hash_init", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT),
F0("hash_update", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F0("hash_update_stream", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
F0("hash_update_stream", MAY_BE_NULL | MAY_BE_LONG),
F0("hash_update_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F1("hash_final", MAY_BE_NULL | MAY_BE_STRING),
F1("hash_copy", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT),
+1 -1
View File
@@ -6,5 +6,5 @@ $pattern = "/(((?(?C)0?=))(?!()0|.(?0)0)())/";
var_dump(preg_match($pattern, "hello"));
?>
--EXPECTF--
Warning: preg_match(): Compilation failed: assertion expected after (?( or (?(?C) at offset 8 in %sbug75457.php on line %d
Warning: preg_match(): Compilation failed: assertion expected after (?( or (?(?C) at offset %d in %sbug75457.php on line %d
bool(false)
-2
View File
@@ -1,7 +1,5 @@
--TEST--
Bug #78338 (Array cross-border reading in PCRE)
--INI--
pcre.jit=1
--FILE--
<?php
$string = hex2bin('2f5c583f3d3f223f3536ff3636ffffffff36a8a8a83636367a7a7a7a3d2aff2f0a');
+2 -2
View File
@@ -423,14 +423,14 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt) /* {{{ */
pdo_mysql_error_stmt(stmt);
PDO_DBG_RETURN(0);
} else {
PDO_DBG_RETURN(pdo_mysql_fill_stmt_from_result(stmt) && stmt->row_count);
PDO_DBG_RETURN(pdo_mysql_fill_stmt_from_result(stmt));
}
#else
if (mysql_next_result(H->server) > 0) {
pdo_mysql_error_stmt(stmt);
PDO_DBG_RETURN(0);
} else {
PDO_DBG_RETURN(pdo_mysql_fill_stmt_from_result(stmt) && stmt->row_count);
PDO_DBG_RETURN(pdo_mysql_fill_stmt_from_result(stmt));
}
#endif
}
Loaded 100 of 123 files, more files were not shown because too many files have changed in this diff. Show more