TSUYUSATO Kitsune
b726d60c98
Fix [Bug 19273], set correct value to `outer_repeat` on `OP_REPEAT` ( #7035 )
2022-12-28 20:03:25 +09:00
Nobuyoshi Nakada
43f4093a31
Adjust style [ci skip]
2022-12-22 15:12:05 +09:00
TSUYUSATO Kitsune
fbedadb61f
Add `Regexp.linear_time?` ( #6901 )
2022-12-14 12:57:14 +09:00
Yusuke Endoh
b8e542b463
Make absent operator work at the end of the input string
...
https://bugs.ruby-lang.org/issues/19104#change-100542
2022-12-12 14:26:38 +09:00
TSUYUSATO Kitsune
189e3c0ada
Add default cases for cache point finding function
2022-11-17 23:19:17 +09:00
TSUYUSATO Kitsune
90bfac296e
Add OP_CCLASS_MB case
2022-11-17 23:19:17 +09:00
TSUYUSATO Kitsune
1dc4128e92
Reduce warnings
2022-11-09 23:21:26 +09:00
TSUYUSATO Kitsune
36ff0521c1
Use long instead of int
2022-11-09 23:21:26 +09:00
Yusuke Endoh
d868f4ca31
Check for integer overflow in the allocation of match_cache table
2022-11-09 23:21:26 +09:00
Yusuke Endoh
14845ab4ff
Ensure that the table size for CACHE_MATCH fits with int
...
Currently, the keys for CACHE_MATCH are handled as an `int` type. So we
should make sure the table size are smaller than the range of `int`.
2022-11-09 23:21:26 +09:00
Yusuke Endoh
537286d0bb
Prevent GCC warnings
...
```
regexec.c: In function ‘reset_match_cache’:
regexec.c:1259:56: warning: suggest parentheses around ‘-’ inside ‘<<’ [-Wparentheses]
1259 | match_cache[k1 >> 3] &= ((1 << (8 - (k2 & 7) - 1)) - 1 << ((k2 & 7) + 1)) | ((1 << (k1 & 7)) - 1);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
regexec.c:1269:60: warning: suggest parentheses around ‘-’ inside ‘<<’ [-Wparentheses]
1269 | match_cache[k2 >> 3] &= ((1 << (8 - (k2 & 7) - 1)) - 1 << ((k2 & 7) + 1));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
regexec.c: In function ‘find_cache_index_table’:
regexec.c:1192:11: warning: ‘m’ may be used uninitialized [-Wmaybe-uninitialized]
1192 | if (!(0 <= m && m < num_cache_table && table[m].addr == p)) {
| ~~^~~~
regexec.c: In function ‘match_at’:
regexec.c:1238:12: warning: ‘m1’ is used uninitialized [-Wuninitialized]
1238 | if (table[m1].addr < pbegin && m1 + 1 < num_cache_table) m1++;
| ^
regexec.c:1218:39: note: ‘m1’ was declared here
1218 | int l = 0, r = num_cache_table - 1, m1, m2;
| ^~
regexec.c:1239:12: warning: ‘m2’ is used uninitialized [-Wuninitialized]
1239 | if (table[m2].addr > pend && m2 - 1 > 0) m2--;
| ^
regexec.c:1218:43: note: ‘m2’ was declared here
1218 | int l = 0, r = num_cache_table - 1, m1, m2;
| ^~
```
2022-11-09 23:21:26 +09:00
Yusuke Endoh
ff5dba8319
Return ONIGERR_MEMORY if it fails to allocate memory for cache_match_opt
2022-11-09 23:21:26 +09:00
TSUYUSATO Kitsune
a1c1fc558a
Revert "Refactor field names"
...
This reverts commit 1e6673d6bbd2adbf555d82c7c0906ceb148ed6ee.
2022-11-09 23:21:26 +09:00
TSUYUSATO Kitsune
22294731a8
Refactor field names
2022-11-09 23:21:26 +09:00
TSUYUSATO Kitsune
ff2998a86c
Remove debug printf
2022-11-09 23:21:26 +09:00
TSUYUSATO Kitsune
37613fea16
Clear cache on OP_NULL_CHECK_END_MEMST
2022-11-09 23:21:26 +09:00
TSUYUSATO Kitsune
f25bb291b4
Support OP_REPEAT and OP_REPEAT_INC
2022-11-09 23:21:26 +09:00
TSUYUSATO Kitsune
ea3d9893bf
Reduce warnings
2022-11-09 23:21:26 +09:00
TSUYUSATO Kitsune
3c79731981
Fix to compile when USE_CACHE_MATCH_OPT is disabled
2022-11-09 23:21:26 +09:00
TSUYUSATO Kitsune
1134fa40ee
Enable optimization for PUSH_IF/OR opcodes
2022-11-09 23:21:26 +09:00
TSUYUSATO Kitsune
70f8e9efda
Enable optimization for ANYCHAR_STAR opcodes
2022-11-09 23:21:26 +09:00
TSUYUSATO Kitsune
cbabba9c82
Add index to the latest NULL_CHECK_STACK for fast matching
2022-11-09 23:21:26 +09:00
TSUYUSATO Kitsune
aefb7e5fa5
Add static declaration to new functions
2022-11-09 23:21:26 +09:00
TSUYUSATO Kitsune
d84edce689
Increment num_fail on OP_POP too
2022-11-09 23:21:26 +09:00
TSUYUSATO Kitsune
8c9e4d37a3
Fix look-around like operators and cclass
2022-11-09 23:21:26 +09:00
TSUYUSATO Kitsune
f07dea16e3
Keep cache optimization info to MatchArg for global matching
2022-11-09 23:21:26 +09:00
TSUYUSATO Kitsune
881bf9a0b8
Implement cache optimization for regexp matching
2022-11-09 23:21:26 +09:00
Yusuke Endoh
ffc3b37f96
re.c: Add Regexp.timeout= and Regexp.timeout
...
[Feature #17837 ]
2022-03-30 16:50:46 +09:00
Jeremy Evans
6d3f447aec
Fix multiplex backreferencs near end of string in regexp match
...
Idea from Jirka Marsik.
Fixes [Bug #18631 ]
2022-03-29 15:29:15 -07:00
Yusuke Endoh
9112cf4ae7
regint.h: Reduce the frequency of rb_thread_check_ints
...
edc8576a65
checks interrupt at every
backtrack, which brought significant overhead.
This change makes the check only once every 128 backtracks.
2022-03-24 09:47:22 +09:00
Jeremy Evans
edc8576a65
Allow interrupting regexps that backtrack
...
Fixes [Bug #14103 ]
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2022-03-10 11:06:33 -08:00
Nobuyoshi Nakada
40612d55c6
Fixed shorten-64-to-32 errors when USE_COMBINATION_EXPLOSION_CHECK
2021-05-07 20:15:05 +09:00
Lourens Naudé
31cf13060c
Only define history_root member of the Oniguruma re_registers struct if USE_CAPTURE_HISTORY is enabled
2019-04-24 00:40:17 +09:00
shyouhei
1f76918a33
label as lvalue is a GCCism
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-02 06:41:54 +00:00
naruse
51716c331f
re-apply r60755
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-01 14:32:12 +00:00
naruse
31796f17d3
Update to Onigmo 6.1.3-669ac9997619954c298da971fcfacccf36909d05.
...
[Bug #13892 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-01 13:50:13 +00:00
nobu
24d38cc447
regexec.c: invalidate previously matched position
...
* regexec.c (match_at): invalidate end position not yet matched
when new start position is pushed, to dispose previously stored
position. [ruby-core:83743] [Bug #14101 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-13 05:50:54 +00:00
naruse
6b1c6e0e55
Merge Onigmo 6.1.1
...
* Support absent operator https://github.com/k-takata/Onigmo/issues/82
* https://github.com/k-takata/Onigmo/blob/Onigmo-6.1.1/HISTORY
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-11 15:08:33 +00:00
naruse
2873edeafb
Merge Onigmo 6.0.0
...
* https://github.com/k-takata/Onigmo/blob/Onigmo-6.0.0/HISTORY
* fix for ruby 2.4: https://github.com/k-takata/Onigmo/pull/78
* suppress warning: https://github.com/k-takata/Onigmo/pull/79
* include/ruby/oniguruma.h: include onigmo.h.
* template/encdb.h.tmpl: ignore duplicated definition of EUC-CN in
enc/euc_kr.c. It is defined in enc/gb2313.c with CRuby macro.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-10 17:47:04 +00:00
naruse
e342418e46
* regexec.c (OPCODE_EXEC_HOOK): op is p-1 because p is already
...
incremented.
* regexec.c (OPCODE_EXEC_HOOK): use the exact end address.
* regexec.c (match_at): don't call OPCODE_EXEC_HOOK in CASE()
when it comes from goto fail.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-03 21:06:50 +00:00
naruse
267d34c6e8
* regexec.c (ONIGENC_IS_MBC_ASCII_WORD): redefine optimized one.
...
WORD of Ruby's ascii compatible encoding is always [a-zA-Z0-9_].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-29 13:58:45 +00:00
naruse
9ff5f9c071
* regexec.c (match_at): make compilers optimize harder.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-29 13:56:38 +00:00
nobu
84f4550341
regexec.c: constify
...
* regexec.c (match_at): constify oplabels.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-24 02:10:09 +00:00
nobu
9fb596815d
regexec.c: fix build with direct threaded VM
...
* regexec.c (match_at): move direct threaded VM code to get rid of
mixed declarations and code, and enable it only for gcc since it
depends on a gcc extension.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-22 17:34:38 +00:00
nobu
6e767dd0ac
regexec.c: enable direct threaded VM
...
* regexec.c (USE_DIRECT_THREADED_VM): enable direct threaded VM by
the default.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-22 16:58:22 +00:00
svn
4afebfd2c6
* remove trailing spaces.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-26 08:31:53 +00:00
naruse
9ed1d63f41
* regcomp.c, regenc.c, regexec.c, regint.h, enc/unicode.c:
...
Merge Onigmo 58fa099ed1a34367de67fb3d06dd48d076839692
+ https://github.com/k-takata/Onigmo/pull/52
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-26 08:31:27 +00:00
nobu
1db0393eb1
uninitialized variable
...
* process.c (rb_spawn_process): get rid of usage of uninitialized
variable.
reported by Denis Denisov <denji0k AT gmail.com>.
* regexec.c (match_at): ditto.
* ext/win32ole/win32ole.c (ole_wc2mb_alloc, ole_vstr2wc, ole_mb2wc):
ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-26 06:09:11 +00:00
nobu
d5b81e6844
fix printf format conversion specifiers
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-26 05:33:01 +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