Граф коммитов

98 Коммитов

Автор SHA1 Сообщение Дата
naruse 05c631eefd * regparse.c (fetch_token_in_cc): raise error if given octal escaped
character is too big. [Bug #12420] [Bug #12423]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-25 09:45:22 +00:00
naruse b3935f179b * gc.c (rb_gc_unprotect_logging): throw rb_memerror when it cannot
allocate memory. This is pointed out by Facebook's Infer.

* gc.c (gc_prof_setup_new_record): ditto.

* regparse.c (parse_regexp): ditto.

* util.c (MALLOC): use xmalloc and xfree like above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-08 17:52:38 +00:00
naruse 782fd488d7 * regparse.c (fetch_name_with_level): allow non word characters
at the first character.  [Feature #11949]

* regparse.c (fetch_name): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-21 16:09:09 +00:00
nobu b3377eaa13 Revert r52995
revert slow atomic operations.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09 07:30:44 +00:00
nobu 0599d7de58 use atomic operations
* regcomp.c (onig_chain_link_add): use atomic operation instead of
  mutex.
* regint.h (ONIG_STATE_{INC,DEC}_THREAD): ditto.
* regparse.c (PopFreeNode, node_recycle): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09 06:48:15 +00:00
nobu 5f63d9e741 regparse.c: remove unused variable
* regparse.c (add_ctype_to_cc): suppress a warning by removing
  unused variable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-16 02:44:10 +00:00
naruse d2a5354255 * reg*.c: Merge Onigmo 5.15.0 38a870960aa7370051a3544
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-15 16:18:41 +00:00
naruse 64c81e40d4 * regcomp.c: Merge Onigmo 5.14.1 25a8a69fc05ae3b56a09.
this includes Support for Unicode 7.0 [Bug #9092].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-16 03:27:25 +00:00
naruse 536a3274c9 * Merge Onigmo 5.13.4 f22cf2e566712cace60d17f84d63119d7c5764ee.
[bug] fix problem with optimization of \z (Issue #16) [Bug #8210]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-13 11:30:35 +00:00
naruse 78dbaa1648 * Merge Onigmo 0fe387da2fee089254f6b04990541c731a26757f
v5.13.3 [Bug#7972] [Bug#7974]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-01 16:36:37 +00:00
naruse b44ac42335 * regparse.c (add_ctype_to_cc): don't check dup warn on adding
negative ctype to cclass. [Bug #7471] [ruby-core:50344]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-13 21:51:37 +00:00
nobu be7bf5aa0c adjust style
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-29 12:22:04 +00:00
usa be3a6b8c40 * regparse.c (parse_char_class): should match with a hyphen after a
range in a character class.

* test/ruby/test_regexp.rb (TestRegexp#test_char_class): fixed wrong
  test.

* test/ruby/test_regexp.rb (TestRegexp#check): now can accept the
  error message.

* test/ruby/test_regexp.rb
  (TextRegexp#test_raw_hyphen_and_tk_char_type_after_range): renamed
  because the previous name was wrong.

* test/ruby/test_regexp.rb
  (TextRegexp#test_raw_hyphen_and_tk_char_type_after_range): added
  more test pattern.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-13 14:23:40 +00:00
nobu 40ce1eb403 warning: no indirect flag
* regparse.c (is_onechar_cclass): remove "found" indirect flag to
  suppress warnings by gcc 4.7.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-18 08:41:01 +00:00
naruse bad859ca3e * regparse.c (PFETCH_READY): suppress Wunused-but-set-variable.
* regparse.c (is_onechar_cclass): restructured to clarify that c is
  used iff found == 1.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-13 20:46:11 +00:00
shyouhei 2c1322ec88 * regparse.c (PFETCH_READY): this line was to suppress warning,
but  did emit  warnings if  -Wuninitialized was  set.  Assigning
	  NULL instead if pfetch_prev should suffice the situation.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-13 08:58:05 +00:00
naruse b4be4c7be3 * regparse.c (onig_number_of_names): suppress a warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-02 18:24:24 +00:00
naruse b2cc0976a7 * regcomp.c: Merge Onigmo 3d855b30d574536d3ae600260208c6624ae4791c.
[Bug#6143] [Bug#6144] [Bug#6145]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-21 10:53:06 +00:00
nobu c037f1f616 * adjust style.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-15 01:39:00 +00:00
naruse 291fa223cf * regparse.c (is_onechar_cclass): optimize character class
Merge Onigmo 27278c12e6674043cc8affca6507e20e119a86ee.

* regparse.c (is_onechar_cclass): [bug] unexpected match occurs when a
  char class contains no char

* enc/unicode.c (init_case_fold_table): define the sizes of case
  folding tables in casefold.h

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-29 16:29:06 +00:00
naruse a77ea177fe * regparse.c (add_code_range_to_buf0): wrong condition of duplicated
warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-26 14:32:54 +00:00
naruse b790678398 * regparse.c (fetch_token): don't use // comment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-22 02:03:56 +00:00
nobu 541e1aff20 * regparse.c: fix warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-19 01:51:05 +00:00
naruse 0424e152c6 * Merge Onigmo-5.13.1. [ruby-dev:45057] [Feature #5820]
https://github.com/k-takata/Onigmo
  cp reg{comp,enc,error,exec,parse,syntax}.c reg{enc,int,parse}.h
  cp oniguruma.h
  cp tool/enc-unicode.rb
  cp -r enc/

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-17 07:42:23 +00:00
nobu 3581d76bbb * regparse.c: fix typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-05 10:12:02 +00:00
nobu c09f46301b * regparse.c (PFETCH_READY): separate gcc specific trick.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-05 10:08:07 +00:00
nobu b526738c3b * bignum.c (big_rshift), compile.c (validate_label,
iseq_build_from_ary_exception), cont.c (cont_capture), dir.c
  (dir_open_dir), gc.c (objspace_each_objects), io.c (pipe_open)
  (rb_io_advise), parse.y (parser_compile_string)
  (rb_parser_compile_file), proc.c (binding_free), process.c
  (rb_proc_exec_n, rb_seteuid_core, proc_setegid, rb_setegid_core)
  (p_uid_exchange, p_gid_exchange), regparse.c (strdup_with_null),
  signal.c (sig_dfl), vm.c (rb_iseq_eval, rb_iseq_eval_main),
  vm_insnhelper.c (vm_expandarray): suppress
  unused-but-set-variable warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-05 09:57:00 +00:00
naruse 48de1e292a * addr2line.c: suppressed shorten-64-to-32 warnings.
* regcomp.c: ditto.
* regexec.c: ditto.
* regint.h: ditto.
* regparse.c: ditto.
* regparse.h: ditto.
* time.c: ditto.
* variable.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-31 03:44:57 +00:00
mame 0dbe6b6113 * regparse.c (and_cclass, or_cclass): fix memory leak. Coverity Scan
found this bug.  [ruby-dev:42579]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-15 16:06:35 +00:00
nobu 3642fa1992 * regparse.c (onig_syntax_warn): do not use external strings as
printf format.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-31 10:26:01 +00:00
naruse 81c5ede3ca * regparse.c (add_code_range_to_buf0): fix false negative
warning when given range is just before previous range.
  [ruby-dev:41406]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-25 15:12:19 +00:00
matz db37773e13 * include/ruby/oniguruma.h: updated to follow Oniguruma 5.9.2.
* re.c (make_regexp): use onig_new() instead of onig_alloc_init().

* re.c (rb_reg_to_s): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-01 21:54:59 +00:00
naruse 62f8c207b2 * regcomp.c (onig_compile): initialize ScanEnv.
mainly to initialize env->warnings_flag [ruby-dev:40196]

* regparse.c (scan_env_clear): clear warnings_flag.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-28 00:50:17 +00:00
naruse 67e11229ec * regparse.c (fetch_token): warn invalid back reference
and subexp call. (\k and \g).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-11 20:52:51 +00:00
naruse e0e3d15f12 * regparse.c (fetch_token_in_cc): warn when \p is not
followed by property name.

* regparse.c (fetch_token): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-11 01:06:30 +00:00
naruse c506f190e1 * regerror.c (onig_vsnprintf_with_pattern): added.
* regparse.c (onig_syntax_warn): use above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-11 00:48:35 +00:00
naruse 8e9fb2e14c * regparse.c (onig_syntax_warn): added.
* regparse.c (CC_ESC_WARN, CLOSE_BRACKET_WITHOUT_ESC_WARN,
  CC_DUP_WARN, UNKNOWN_ESC_WARN): use onig_syntax_warn.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-10 18:12:26 +00:00
nobu 62f073a386 * regparse.c (st_str_end_key, str_end_cmp, str_end_hash):
constified.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-22 07:26:22 +00:00
naruse 83b76913d8 Warn unknown escaped chars in regexp.
* regparse.c (UNKNOWN_ESC_WARN): added.

* regparse.c (conv_backslash_value): Warn unknown
  escaped chars in regexp. [ruby-dev:39104]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-10 07:00:44 +00:00
nobu 31b7ae00c0 * include/ruby/st.h (st_hash_func): use st_index_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-08 13:10:04 +00:00
naruse 6ab36c6e19 *regparse.c (CC_DUP_WARN): use rb_compile_warn if ScanEnv has source
information. [ruby-dev:39105]

*re.c (rb_reg_compile): add sourcefile and sourceline to the arguments.

*re.c (make_regexp): ditto.

*re.c (rb_reg_initialize): ditto.

*re.c (rb_reg_initialize_str): ditto.

*re.c (rb_reg_compile): ditto.

*regcomp.c (onig_compile): ditto.

*regint.h (onig_compile): ditto.

*re.c (reg_compile_gen): follow above.

*re.c (rb_reg_to_s): ditto.

*re.c (make_regexp): ditto.

*re.c (rb_reg_initialize): ditto.

*re.c (rb_reg_initialize_str): ditto.

*re.c (rb_reg_new_str): ditto.

*re.c (rb_enc_reg_new): ditto.

*re.c (rb_reg_initialize_m): ditto.

*re.c (rb_reg_init_copy): ditto.

*regcomp.c (onig_new): ditto.

*regcomp.c (onig_compile): set sourcefile and sourceline to scan_env.

*regparse.h (ScanEnv): add sourcefile and sourceline.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-30 08:00:31 +00:00
naruse 9d7ff244c3 Don't warn if the duplicate is caused by /i.
* regparse.c (add_code_range_to_buf0): added with checkdup argument.

* regparse.c (add_code_range_to_buf): use above.

* regparse.c (add_code_range0): added with checkdup argument.

* regparse.c (add_code_range): use above.

* regparse.c (i_apply_case_fold): don't warn if the duplicate is

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-17 01:46:34 +00:00
nobu 95c5a63d2d * regparse.c: commit miss again.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-16 02:20:00 +00:00
nobu 2a8ff72f30 * regparse.c: commit miss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-16 02:15:13 +00:00
nobu 2318bef1de * regparse.c (parse_char_class, parse_exp, parse_branch),
(parse_subexp): fixed memory leak.  a patch from Ralf Junker
  <ralfjunker AT gmx.de> at [ruby-core:24921].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-16 01:45:18 +00:00
naruse c0ec326b7b * regparse.c (add_ctype_to_cc_by_range): fix the first
character bigger than sb_out was dropped.

* test/ruby/test_regexp.rb (TestRegexp#test_posix_bracket):
  add tests for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-15 16:27:13 +00:00
naruse 249697855e \d, \s and \w are now non Unicode class. [ruby-dev:39026]
* include/ruby/oniguruma.h
  (ONIGENC_CTYPE_SPECIAL_MASK): added.
  (ONIGENC_CTYPE_D): ditto.
  (ONIGENC_CTYPE_S): ditto.
  (ONIGENC_CTYPE_W): ditto.

* regparse.c: \d, \s and \w are now non Unicode class.
  [ruby-dev:39026]
  (fetch_token_in_cc): use ONIGENC_CTYPE_[DSW] for \d/\s/\w.
  (fetch_token): ditto.
  (add_ctype_to_cc): add routines for ONIGENC_CTYPE_[DSW].
  (parse_exp): ditto.

* test/ruby/test_regexp.rb (TestRegexp#test_char_class):
  add tests for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-15 16:01:33 +00:00
naruse 60ab77a16a Warn duplicated characters in character class of regexp. [ruby-core:24593]
* include/ruby/oniguruma.h (ONIG_SYN_WARN_CC_DUP): defined.
* regparse.h (ScanEnv): add warnings_flag.
* regparse.c (CC_DUP_WARN): defined for warn duplicated characters in
  character class of regexp. [ruby-core:24593]
  (add_code_range_to_buf): add CC_DUP_WARN.
  (next_state_val): add CC_DUP_WARN.
  (OnigSyntaxRuby): add ONIG_SYN_WARN_CC_DUP.
  (SET_ALL_MULTI_BYTE_RANGE): add env to arguments.
  (add_code_range): ditto.
  (add_code_range_to_buf): ditto.
  (not_code_range_buf): ditto.
  (or_code_range_buf): ditto.
  (and_code_range1): ditto.
  (and_code_range_buf): ditto.
  (and_cclass): ditto.
  (or_cclass): ditto.
  (add_ctype_to_cc_by_range): ditto.
  (add_ctype_to_cc): ditto.
  (parse_char_class): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-04 04:14:38 +00:00
nobu 23a32d6444 * include/ruby/oniguruma.h, include/ruby/re.h, re.c, regcomp.c,
regenc.c, regerror.c, regexec.c, regint.h, regparse.c: use long.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-30 02:08:54 +00:00
nobu 12d2c8ba41 stripped trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 14:23:33 +00:00