* ext/psych/lib/psych/visitors/to_ruby.rb: ARG_ENCODING_NONE regular
expressions can round trip. [ruby-core:34969] * test/psych/test_yaml.rb: test for ARG_ENCODING_NONE regex * ext/sych/lib/syck/rubytypes.rb: ARG_ENCODING_NONE regular expressions can round trip. * test/syck/test_yaml.rb: test for ARG_ENCODING_NONE regex git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3722e3a29a
commit
cc6b1b3c8d
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
|||||||
|
Thu Feb 3 07:02:16 2011 Aaron Patterson <aaron@tenderlovemaking.com>
|
||||||
|
|
||||||
|
* ext/psych/lib/psych/visitors/to_ruby.rb: ARG_ENCODING_NONE regular
|
||||||
|
expressions can round trip. [ruby-core:34969]
|
||||||
|
|
||||||
|
* test/psych/test_yaml.rb: test for ARG_ENCODING_NONE regex
|
||||||
|
|
||||||
|
* ext/sych/lib/syck/rubytypes.rb: ARG_ENCODING_NONE regular
|
||||||
|
expressions can round trip.
|
||||||
|
|
||||||
|
* test/syck/test_yaml.rb: test for ARG_ENCODING_NONE regex
|
||||||
|
|
||||||
Wed Feb 2 17:09:22 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
Wed Feb 2 17:09:22 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
* io.c (rb_io_fdatasync): Use fsync(2) if if the underlying
|
* io.c (rb_io_fdatasync): Use fsync(2) if if the underlying
|
||||||
|
@ -60,7 +60,7 @@ module Psych
|
|||||||
when "tag:yaml.org,2002:float", "!float"
|
when "tag:yaml.org,2002:float", "!float"
|
||||||
Float(@ss.tokenize(o.value))
|
Float(@ss.tokenize(o.value))
|
||||||
when "!ruby/regexp"
|
when "!ruby/regexp"
|
||||||
o.value =~ /^\/(.*)\/([mix]*)$/
|
o.value =~ /^\/(.*)\/([mixn]*)$/
|
||||||
source = $1
|
source = $1
|
||||||
options = 0
|
options = 0
|
||||||
lang = nil
|
lang = nil
|
||||||
@ -69,6 +69,9 @@ module Psych
|
|||||||
when 'x' then options |= Regexp::EXTENDED
|
when 'x' then options |= Regexp::EXTENDED
|
||||||
when 'i' then options |= Regexp::IGNORECASE
|
when 'i' then options |= Regexp::IGNORECASE
|
||||||
when 'm' then options |= Regexp::MULTILINE
|
when 'm' then options |= Regexp::MULTILINE
|
||||||
|
|
||||||
|
# FIXME: there is no constant for ARG_ENCODING_NONE
|
||||||
|
when 'n' then options |= 32
|
||||||
else lang = option
|
else lang = option
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -261,7 +261,7 @@ end
|
|||||||
class Regexp
|
class Regexp
|
||||||
yaml_as "tag:ruby.yaml.org,2002:regexp"
|
yaml_as "tag:ruby.yaml.org,2002:regexp"
|
||||||
def Regexp.yaml_new( klass, tag, val )
|
def Regexp.yaml_new( klass, tag, val )
|
||||||
if String === val and val =~ /^\/(.*)\/([mix]*)$/
|
if String === val and val =~ /^\/(.*)\/([mixn]*)$/
|
||||||
val = { 'regexp' => $1, 'mods' => $2 }
|
val = { 'regexp' => $1, 'mods' => $2 }
|
||||||
end
|
end
|
||||||
if Hash === val
|
if Hash === val
|
||||||
@ -271,6 +271,7 @@ class Regexp
|
|||||||
mods |= Regexp::EXTENDED if val['mods'].include?( 'x' )
|
mods |= Regexp::EXTENDED if val['mods'].include?( 'x' )
|
||||||
mods |= Regexp::IGNORECASE if val['mods'].include?( 'i' )
|
mods |= Regexp::IGNORECASE if val['mods'].include?( 'i' )
|
||||||
mods |= Regexp::MULTILINE if val['mods'].include?( 'm' )
|
mods |= Regexp::MULTILINE if val['mods'].include?( 'm' )
|
||||||
|
mods |= 32 if val['mods'].include?( 'n' )
|
||||||
end
|
end
|
||||||
val.delete( 'mods' )
|
val.delete( 'mods' )
|
||||||
r = YAML::object_maker( klass, {} )
|
r = YAML::object_maker( klass, {} )
|
||||||
|
@ -13,6 +13,11 @@ class Psych_Unit_Tests < Psych::TestCase
|
|||||||
def teardown
|
def teardown
|
||||||
Psych.domain_types.clear
|
Psych.domain_types.clear
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# [ruby-core:34969]
|
||||||
|
def test_regexp_with_n
|
||||||
|
assert_cycle(Regexp.new('',0,'n'))
|
||||||
|
end
|
||||||
#
|
#
|
||||||
# Tests modified from 00basic.t in Psych.pm
|
# Tests modified from 00basic.t in Psych.pm
|
||||||
#
|
#
|
||||||
|
@ -22,6 +22,11 @@ class YAML_Unit_Tests < Test::Unit::TestCase
|
|||||||
YAML::ENGINE.yamler = @current_engine
|
YAML::ENGINE.yamler = @current_engine
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# [ruby-core:34969]
|
||||||
|
def test_regexp_with_n
|
||||||
|
assert_cycle(Regexp.new('',0,'n'))
|
||||||
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Convert between YAML and the object to verify correct parsing and
|
# Convert between YAML and the object to verify correct parsing and
|
||||||
# emitting
|
# emitting
|
||||||
|
Loading…
x
Reference in New Issue
Block a user