Peter Zhu
91e13a5207
[ruby/strscan] Fix indentation in strscan.c
...
[ci skip]
2023-07-28 10:12:52 -04:00
Peter Zhu
7193b404a1
Add function rb_reg_onig_match
...
rb_reg_onig_match performs preparation, error handling, and cleanup for
matching a regex against a string. This reduces repetitive code and
removes the need for StringScanner to access internal data of regex.
2023-07-27 13:33:40 -04:00
Peter Zhu
e27eab2f85
[ruby/strscan] Sync missed commit
...
Syncs commit ruby/strscan@76b377a5d8 .
2023-07-27 09:42:42 -04:00
Sutou Kouhei
18e840ac60
[ruby/strscan] Bump version
...
https://github.com/ruby/strscan/commit/681cde0f27
2023-02-21 19:31:36 +09:00
OKURA Masafumi
a44f5ab089
[ruby/strscan] Mention return value of `rest?` in the doc
...
(https://github.com/ruby/strscan/pull/49 )
The doc of `rest?` was unclear about return value. This commit adds the
return value to the doc.
2023-02-21 19:31:35 +09:00
Sutou Kouhei
79ad045214
[ruby/strscan] Bump version
...
https://github.com/ruby/strscan/commit/3ada12613d
2022-12-26 15:09:21 +09:00
Hiroshi SHIBATA
4e31fea77d
Merge strscan-3.0.5
2022-12-09 16:36:22 +09:00
Sutou Kouhei
c0c43276a1
[ruby/strscan] Bump version
...
If we use the same version as the default strscan gem in Ruby, "gem
install" doesn't extract .gem. It fails "gem install" because "gem
install" can't find ext/strscan/ to be built.
https://github.com/ruby/strscan/commit/3ceafa6cdc
2021-10-24 05:57:48 +09:00
Gannon McGibbon
a42b7de436
[ruby/strscan] Replace "iff" with "if and only if" ( #18 )
...
iff means if and only if, but readers without that knowledge might
assume this to be a spelling mistake. To me, this seems like
exclusionary language that is unnecessary. Simply using "if and only if"
instead should suffice.
https://github.com/ruby/strscan/commit/066451c11e
2021-05-06 16:21:14 +09:00
Kenichi Kamiya
564ccd095a
[ruby/strscan] Fix segmentation fault of `StringScanner#charpos` when `String#byteslice` returns non string value [Bug #17756 ] ( #20 )
...
https://github.com/ruby/strscan/commit/92961cde2b
2021-05-06 16:20:38 +09:00
Jeremy Evans
c03b723f56
Update class documentation for StringScanner
...
The [] wasn't being displayed, and try to fix formatting for bol?
and << (even if they aren't linked).
Fixes [Bug #17620 ]
2021-02-10 08:17:07 -08:00
Kenta Murata
b5de66e132
[strscan] Fix license comment and files
...
https://github.com/ruby/strscan/commit/a999f2c6d1
2020-12-18 14:25:48 +09:00
Kenta Murata
5370963992
[strscan] Version 3.0.0
...
https://github.com/ruby/strscan/commit/08645e4e77
2020-12-18 14:25:42 +09:00
Kenta Murata
985f0af257
[strscan] Make strscan Ractor safe ( #17 )
...
* Make strscan Ractor safe
* Add test-unit in the development dependencies
https://github.com/ruby/strscan/commit/3c93c2bebe
2020-12-18 14:25:41 +09:00
Aaron Patterson
6aa466ba9c
mark regex internal to string scanner
2020-10-02 12:01:57 -07:00
Jeremy Evans
d9b8411a7b
Document that StringScanner#matched_size returns size in bytes [ci skip]
...
Fixes [Bug #17139 ]
2020-09-02 10:41:49 -07:00
Sutou Kouhei
c23c880f56
[ruby/strscan] Bump version
...
https://github.com/ruby/strscan/commit/df90d541fa
2020-08-31 21:57:35 +09:00
Nobuyoshi Nakada
c76508b88c
[ruby/strscan] Replaced examples using $KCODE with encodings
...
`$KCODE` has been deprecated and not effective since years ago.
https://github.com/ruby/strscan/commit/7c4dbd4cb3
2020-08-31 21:57:35 +09:00
Nobuyoshi Nakada
d8720eb7de
Suppress -Wshorten-64-to-32 warnings
2020-04-08 16:28:38 +09:00
Jeremy Evans
d03da13b17
[ruby/strscan] Remove taint support
...
Ruby 2.7 deprecates taint and it no longer has an effect.
The lack of taint support should not cause a problem in
previous Ruby versions.
2019-11-18 01:00:25 +02:00
Nobuyoshi Nakada
3e763883ea
Fixed overflow at onig_region_set
...
To get rid of a bug of `onig_region_set` which takes `int`s
instead of `OnigPosition`s, set elements of `beg` and `end`
members directly, for the time being.
2019-10-14 15:10:56 +09:00
Sutou Kouhei
95c420c4a6
Import StringScanner 1.0.3 ( #2553 )
2019-10-14 12:40:50 +09:00
nobu
c8094ff154
no ID cache in Init functions
...
Init functions are called only once, cache is useless.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-16 08:39:48 +00:00
stomar
9a26a4c13a
ext/strscan/strscan.c: [DOC] grammar fixes
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-08 22:42:19 +00:00
nobu
256c88861b
strscan.c: add MatchData-like methods
...
* ext/strscan/strscan.c: added `size`, `captures` and `values_at`
to StringScanner, shorthands of accessing the matched data.
based on the patch by apeiros (Stefan Rusterholz) at
[ruby-core:20412]. [Feature #836 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-29 07:57:48 +00:00
nobu
90311f37e4
strscan.c: fix segfault in aref
...
* ext/strscan/strscan.c (strscan_aref): fix segfault after
get_byte or getch which do not apply regexp.
[ruby-core:82116] [Bug #13759 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-21 13:30:46 +00:00
nobu
0b149ab5f3
strscan.c: minl
...
* ext/strscan/strscan.c (minl): extract to reduce repeated S_LEN.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-28 05:11:22 +00:00
nobu
604ae2e151
strscan.c: use S_RESTLEN
...
* ext/strscan/strscan.c (strscan_getch, strscan_peek),
(strscan_rest_size, inspect2): use S_RESTLEN consistently.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-28 05:11:20 +00:00
naruse
21daa56b2a
* re.c: Introduce RREGEXP_PTR.
...
patch by dbussink.
partially merge https://github.com/ruby/ruby/pull/497
* include/ruby/ruby.h: ditto.
* gc.c: ditto.
* ext/strscan/strscan.c: ditto.
* parse.y: ditto.
* string.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-02 04:39:44 +00:00
ko1
dff42b0ea0
* ext/**/*.c (*_memsize): same as r52986 for extensions.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09 01:01:17 +00:00
nobu
6fb9349d85
allocate structs with wrapper
...
* parse.y (rb_parser_new, ripper_s_allocate): allocate structs
with making new wrapper objects and get rid of potential memory
leak.
* variable.c (rb_autoload): ditto.
* ext/digest/digest.c (rb_digest_base_alloc): ditto.
* ext/strscan/strscan.c (strscan_s_allocate): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-16 12:56:48 +00:00
nobu
012c558127
re.c: rb_reg_region_copy
...
* re.c (rb_reg_region_copy): new function to try with GC if copy
failed and return the error.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-01 21:30:58 +00:00
nobu
8b3813f6b0
strscan.c: fix condition
...
* ext/strscan/strscan.c (strscan_init_copy): fix inverted
condition.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-01 19:47:36 +00:00
nobu
4d63c85031
re.c: check if onig_region_copy failed
...
* re.c (CHECK_REGION_COPIED): onig_region_copy() can fail when
memory exhausted but returns nothing, so check by if allocated.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-01 19:43:10 +00:00
nobu
e580a631be
use 0 for reserved
...
use 0 for rb_data_type_t::reserved instead of NULL, since its type
may be changed in the future and possibly not a pointer type.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-01 06:38:04 +00:00
nobu
28b9f11d5a
protoize no-arguments functions
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-30 05:25:32 +00:00
nobu
4713ace44c
strscan.c: encoding in messages
...
* ext/strscan/strscan.c (strscan_aref): preserve argument encoding
in error messages.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-03 01:56:31 +00:00
nobu
27c4fb3361
ext: get rid of inadvertent ID creation
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-03 01:56:16 +00:00
normal
48a2b96d2b
introduce ZALLOC{,_N} to replace ALLOC{,_N}+MEMZERO use
...
Using calloc where possible reduces code and binary sizes.
* include/ruby/ruby.h (ZALLOC, ZALLOC_N): implement
(Data_Make_Struct, TypedData_Make_Struct):
ZALLOC replaces ALLOC+memset
* compile.c (iseq_seq_sequence): ZALLOC_N replaces ALLOC_N+MEMZERO
* cont.c (fiber_t_alloc): ZALLOC replaces ALLOC+MEMZERO
* io.c (rb_io_reopen): ditto
* iseq.c (prepare_iseq_build): ditto
* parse.y (new_args_tail_gen, parser_new, ripper_s_allocate): ditto
* re.c (match_alloc): ditto
* variable.c (rb_const_set): ditto
* ext/socket/raddrinfo.c (get_addrinfo): ditto
* ext/strscan/strscan.c (strscan_s_allocate): ditto
* gc.c (rb_objspace_alloc): calloc replaces malloc+MEMZERO
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-25 21:34:35 +00:00
akr
543b402f38
* ext/socket/ifaddr.c (IS_IFADDRS): Unused macro removed.
...
* ext/strscan/strscan.c (BUFSIZE): Ditto.
* ext/zlib/zlib.c (OBJ_IS_FREED): Ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-11 16:31:51 +00:00
nobu
43d4148682
strscan.c: fix typo
...
* ext/strscan/strscan.c (inspect1): fix typo, rb_str_cat() instead
of rb_str_cat2().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-14 03:23:20 +00:00
nobu
747e3c73e0
strscan.c: make string directly
...
* ext/strscan/strscan.c (inspect1): extract intermediate string from
the buffer directly, like as inspect2.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-14 02:48:07 +00:00
nobu
7e9bd8f72c
ext: real class name
...
* ext/dl/cptr.c (rb_dlptr_inspect): use real class name, not
singleton class.
* ext/fiddle/pointer.c (rb_fiddle_ptr_inspect): ditto.
* ext/strscan/strscan.c (strscan_inspect): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-13 00:57:36 +00:00
nobu
9bd672f668
ext: use rb_sprintf() and rb_vsprintf() with PRIsVALUE
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-12 08:11:36 +00:00
ko1
c5e08b764e
* add RUBY_TYPED_FREE_IMMEDIATELY to data types which only use
...
safe functions during garbage collection such as xfree().
On default, T_DATA objects are freed at same points as fianlizers.
This approach protects issues such as reported by [ruby-dev:35578].
However, freeing T_DATA objects immediately helps heap usage.
Most of T_DATA (in other words, most of dfree functions) are safe.
However, we turned off RUBY_TYPED_FREE_IMMEDIATELY by default
for safety.
* cont.c: ditto.
* dir.c: ditto.
* encoding.c: ditto.
* enumerator.c: ditto.
* error.c: ditto.
* file.c: ditto.
* gc.c: ditto.
* io.c: ditto.
* iseq.c: ditto.
* marshal.c: ditto.
* parse.y: ditto.
* proc.c: ditto.
* process.c: ditto.
* random.c: ditto.
* thread.c: ditto.
* time.c: ditto.
* transcode.c: ditto.
* variable.c: ditto.
* vm.c: ditto.
* vm_backtrace.c: ditto.
* vm_trace.c: ditto.
* ext/bigdecimal/bigdecimal.c: ditto.
* ext/objspace/objspace.c: ditto.
* ext/stringio/stringio.c: ditto.
* ext/strscan/strscan.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29 11:16:54 +00:00
naruse
9b119ab456
Remove unused variable
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-25 11:37:35 +00:00
naruse
c43dd625b6
* ext/strscan/strscan.c (strscan_aref): raise error if given
...
name reference is not found.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-24 07:32:45 +00:00
naruse
ecd5bbe82a
* ext/strscan/strscan.c (strscan_aref): support named captures.
...
patched by Konstantin Haase [ruby-core:54664] [Feature #8343 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-21 13:48:57 +00:00
ryan
0700a9113f
Added #charpos for multibyte string position.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-28 00:17:33 +00:00
nobu
00e6c80221
* ext/strscan/strscan.c: use typed data with
...
onig_region_memsize().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-15 05:48:39 +00:00