aboutsummaryrefslogtreecommitdiffstats
path: root/re.c
Commit message (Collapse)AuthorAgeFilesLines
* * include/ruby/encoding.h, encoding.c, re.c, io.c, parse.y, numeric.c,akr2007-12-221-2/+2
| | | | | | | | | ruby.c, transcode.c: rename rb_ascii_encoding. to rb_ascii8bit_encoding. rb_ascii_encoding is ambiguous with ASCII-8BIT and US-ASCII. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* refine error message.akr2007-12-221-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_ascii_encoding): renamed from previousmatz2007-12-211-5/+5
| | | | | | rb_default_encoding(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_prepare_re): stop ENCODING_NONE warning if thematz2007-12-211-1/+2
| | | | | | encoding of the str is ASCII-8BIT. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (ARG_ENCODING_NONE): defined for /.../n option.akr2007-12-211-6/+21
| | | | | | | | | | (REG_ENCODING_NONE): ditto. (rb_char_to_option_kcode): return ARG_ENCODING_NONE for n. (rb_reg_prepare_re): warn /ascii/n =~ "non-ascii". (rb_reg_initialize): set REG_ENCODING_NONE from ARG_ENCODING_NONE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (append_utf8): use rb_utf8_encoding() instead ofakr2007-12-211-2/+2
| | | | | | | rb_enc_find("utf-8"). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_system.rb (TestSystem::valid_syntax): applymatz2007-12-211-1/+1
| | | | | | | | ASCII-8BIT encoding explicitly. * re.c (rb_reg_prepare_re): add encoding name in the message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14402 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c: change "character encodings differ" error messages.akr2007-12-211-5/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_rindex_m): too much adjustment.matz2007-12-191-1/+2
| | | | | | | | | | * re.c (reg_match_pos): pos adjustment should be based on characters. * test/ruby/test_m17n.rb (TestM17N::test_str_insert): test updated to check negative offset behavior. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_regsub): should set checked encoding.nobu2007-12-191-1/+1
| | | | | | | * string.c (rb_str_sub_bang): applied r14212 too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (arg tMATCH arg): call reg_named_capture_assign_gen if regexpakr2007-12-181-0/+31
| | | | | | | | | | | | literal is used. (reg_named_capture_assign_gen): assign the result of named capture into local variables. [ruby-dev:32588] * re.c: document the assignment by named captures. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_initialize): raise error if non-Unicode fixedmatz2007-12-171-1/+1
| | | | | | | | | | encoding option is specified for regexp literals with \u{} escapes. * string.c (rb_str_squeeze_bang): should squeeze multibyte characters as well. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (scan_once): need no encoding compatibility check.matz2007-12-171-1/+0
| | | | | | | | | | it's done inside of re_reg_seach(). * string.c (rb_str_split_m): ditto. * re.c (rb_reg_regsub): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_initialize): embedded string may override encodingmatz2007-12-131-8/+13
| | | | | | | | | of the regular expression. * re.c (rb_reg_initialize): fix encoding of regular expression if embedded string has its own encoding specified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_compatible): encoding should never fall backmatz2007-12-131-1/+2
| | | | | | to ASCII-8BIT unless both encodings are ASCII-8BIT. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c, regerror.c, string.c, parse.y, ruby.c, file.c:akr2007-12-121-3/+3
| | | | | | | | use capital letter for \xHH notation. [ruby-dev:32511] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_regsub): should copy encoding.nobu2007-12-121-0/+1
| | | | | | | | * string.c (rb_str_sub_bang, str_gsub): should check and copy encoding to be replaced. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_ascget): renamed from rb_enc_get_ascii.akr2007-12-111-8/+8
| | | | | | | | | | * include/ruby/encoding.h: follow the renaming. * re.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_get_ascii): add an argument to provide the akr2007-12-111-60/+66
| | | | | | | | | | | | | length of the returned character. * include/ruby/encoding.h (rb_enc_get_ascii): add the argument. * re.c (rb_reg_expr_str): modify rb_enc_get_ascii call. (rb_reg_quote): ditto. (rb_reg_regsub): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_match): should calculate offset by convertedmatz2007-12-101-4/+6
| | | | | | operand. [ruby-cvs:21416] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_search): return byte offset. [ruby-dev:32452]nobu2007-12-101-12/+12
| | | | | | | | | | | | * re.c (rb_reg_match, rb_reg_match2, rb_reg_match_m): convert byte offset to char index. * string.c (rb_str_index): return byte offset. [ruby-dev:32472] * string.c (rb_str_split_m): calculate in byte offset. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_expr_str): use \xHH instead of \OOO.akr2007-12-091-1/+1
| | | | | | | | | | | | | | | | | | * regerror.c (to_ascii): ditto. (onig_snprintf_with_pattern): ditto. (onig_snprintf_with_pattern): ditto. * string.c (rb_str_inspect): ditto. (rb_str_dump): ditto. * parse.y (parser_yylex): ditto. * ruby.c (proc_options): ditto. * file.c (rb_f_test): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_names): new method Regexp#names.akr2007-12-091-1/+120
| | | | | | | | | | | (rb_reg_named_captures): new method Regexp#named_captures (match_regexp): new method MatchData#regexp. (match_names): new method MatchData#names. * lib/pp.rb (MatchData#pretty_print): show names of named captures. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_s_last_match): accept named capture's name.akr2007-12-091-43/+82
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Regexp#fixed_encoding? documented.akr2007-12-091-0/+25
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* document named capture of MatchData#{offset,begin,end,inspect}.akr2007-12-091-3/+20
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (match_backref_number): new function for converting a backrefakr2007-12-091-6/+77
| | | | | | | | | | | | name/number to an integer. (match_offset): use match_backref_number. (match_begin): ditto. (match_end): ditto. (name_to_backref_number): raise IndexError instead of RuntimeError. (match_inspect): show capture index. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (append_utf8): check unicode range.akr2007-12-091-4/+13
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_check_preprocess): new function for validating regexpakr2007-12-081-0/+23
| | | | | | | | | | | fragment. * parse.y (regexp): invoke reg_fragment_check. (reg_fragment_check): defined. (reg_fragment_check_gen): defined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_mbclen): make it never fail.akr2007-12-081-24/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (rb_enc_nth): don't check the return value of rb_enc_mbclen. (rb_enc_strlen): ditto. (rb_enc_precise_mbclen): return needmore(1) if e <= p. (rb_enc_get_ascii): new function for extracting ASCII character. * include/ruby/encoding.h (rb_enc_get_ascii): declared. * include/ruby/regex.h (ismbchar): removed. * re.c (rb_reg_expr_str): use rb_enc_get_ascii. (unescape_escaped_nonascii): use rb_enc_precise_mbclen to determine the termination of escaped non-ASCII character. (unescape_nonascii): use rb_enc_precise_mbclen. (rb_reg_quote): use rb_enc_get_ascii. (rb_reg_regsub): use rb_enc_get_ascii. * string.c (rb_str_reverse) don't check the return value of rb_enc_mbclen. (rb_str_split_m): don't call rb_enc_mbclen with e <= p. * parse.y (is_identchar): use ISASCII. (parser_ismbchar): removed. (parser_precise_mbclen): new macro. (parser_isascii): new macro. (parser_tokadd_mbchar): use parser_precise_mbclen to check invalid character precisely. (parser_tokadd_string): use parser_isascii. (parser_yylex): ditto. (is_special_global_name): don't call is_identchar with e <= p. (rb_enc_symname_p): ditto. [ruby-dev:32455] * ext/tk/sample/tkextlib/vu/canvSticker2.rb: remove coding cookie because the encoding is not UTF-8. [ruby-dev:32475] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix Regexp#inspect document.akr2007-12-021-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14088 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* document MatchData#inspect.akr2007-12-021-0/+13
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (unescape_escaped_nonascii): fix mbclen argument.akr2007-12-021-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* s/unicode/Unicode/ in error messages.akr2007-12-021-6/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/intern.h (rb_uv_to_utf8): declared.akr2007-12-011-15/+431
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * re.c (rb_reg_preprocess): new function for dynamic regexp with \u{} such as Regexp.new("\\u{6666}"). (rb_reg_prepare_re): preprocess regexp for recompiling. (read_escaped_byte): new function. (unescape_escaped_nonascii): new function. (append_utf8): new function. (unescape_unicode_list): new function. (unescape_unicode_bmp): new function. (unescape_nonascii): new function. (rb_reg_initialize): preprocess regexp. * pack.c (rb_uv_to_utf8): renamed from uv_to_utf8. * parse.y (STR_NEW3): take func instead of has8 and hasmb. (parser_str_new): use default coderange mechanism except for regexp. (parser_tokadd_utf8): copy regexp source as-is. (parser_read_escape): UTF-8 stuff removed. (parser_tokadd_escape): has8bit and hasmb removed. (parser_tokadd_string): fix 8-bit single byte character with \u. (parser_parse_string): has8bit and hasmb removed. (parser_here_document): has8bit and hasmb removed. (parser_yylex): call parser_tokadd_utf8 instead of read_escape for UTF-8 character. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/encoding.h, encoding.c, re.c, string.c, parse.y: akr2007-11-271-1/+1
| | | | | | | | | | rename ENC_CODERANGE_SINGLE to ENC_CODERANGE_7BIT. rename ENC_CODERANGE_MULTI to ENC_CODERANGE_8BIT. Because single byte 8bit character, such as Shift_JIS 1byte katakana, is represented by ENC_CODERANGE_MULTI even if it is not multi byte. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (Init_Regexp): new method Regexp#fixed_encoding?akr2007-11-261-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_fixed_encoding_p): extracted from rb_reg_prepare_re andakr2007-11-261-63/+48
| | | | | | | | rb_reg_s_union. (rb_reg_s_union): refactored. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/encoding.h (rb_enc_str_asciionly_p): declared.akr2007-11-251-19/+98
| | | | | | | | | | | | | | (rb_enc_str_asciicompat_p): defined. * re.c (rb_reg_initialize_str): use rb_enc_str_asciionly_p. (rb_reg_quote): return ascii-8bit string if the argument is ascii-only to generate encoding generic regexp if possible. (rb_reg_s_union): fix encoding handling. [ruby-dev:32094] * string.c (rb_enc_str_asciionly_p): defined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (REG_CASESTATE): unused macro removed.akr2007-11-231-9/+19
| | | | | | | | | | | | (rb_reg_prepare_re): check encoding difference. (rb_reg_initialize): check 8bit byte. * parse.y (parser_tokadd_escape): fix has8bit. [ruby-dev:32113] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (match_begin): should return offset by character.matz2007-11-231-12/+22
| | | | | | | | | | [ruby-dev:32331] * re.c (match_end): ditto. * re.c (rb_reg_search): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_quote): quote \v as well.akr2007-11-041-1/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_initialize_m): use StringValuePtr instead ofakr2007-11-041-1/+1
| | | | | | | StringValueCStr because \0 exists when Regexp.new("\0"). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (parser_regx_options, reg_compile_gen): relaxened encodingnobu2007-10-191-24/+32
| | | | | | | | | | | | | | matching rule. * re.c (rb_reg_initialize): always set encoding of Regexp. * re.c (rb_reg_initialize_str): fix enconding for non 7bit-clean strings. * re.c (rb_reg_initialize_m): use ascii encoding for 'n' option. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_s_union): the last check was not complete.matz2007-10-171-3/+9
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_from_encoding, rb_enc_register): associate indexnobu2007-10-171-3/+3
| | | | | | | | | | | | to self. * encoding.c (enc_capable): Encoding objects are encoding capable. * re.c (rb_reg_s_union): check if encoding matching by exact encoding objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_desc): set encoding.nobu2007-10-161-1/+2
| | | | | | | * re.c (rb_reg_s_union): check encodings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_initialize_m): allow binary encoding option.nobu2007-10-161-1/+11
| | | | | | | [ruby-dev:32083] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_s_union): check for encoding of original object.nobu2007-10-161-3/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (parser_regx_options): check if regexp encoding optionnobu2007-10-161-392/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | matches to current encoding. * re.c (char_to_option, rb_char_to_option_kcode): 'n' is not kcode option now. * re.c (rb_reg_to_s, rb_reg_error_desc): copy encoding rather than append as an option. * re.c (make_regexp, rb_reg_prepare_re): use encoding of Regexp and String instead of kcode. * re.c (rb_reg_initialize): set fixed option if none is set. * re.c (rb_reg_regcomp): ditto. * re.c (rb_reg_equal): check if encodings are equal. * re.c (rb_reg_initialize_m): encoding option is obsolete. * re.c (rb_kcode, rb_get_kcode, rb_set_kcode): removed. * re.c (Init_Regexp): removed Regexp#kcode method. * ruby.c (proc_options): allow long encoding name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e