diff options
| -rw-r--r-- | ChangeLog | 12 | ||||
| -rw-r--r-- | ext/psych/lib/psych/visitors/to_ruby.rb | 5 | ||||
| -rw-r--r-- | ext/syck/lib/syck/rubytypes.rb | 3 | ||||
| -rw-r--r-- | test/psych/test_yaml.rb | 5 | ||||
| -rw-r--r-- | test/syck/test_yaml.rb | 5 | ||||
| -rw-r--r-- | version.h | 2 |
6 files changed, 29 insertions, 3 deletions
@@ -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 + Mon Jan 31 21:32:44 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com> * thread.c (thread_start_func_2): check deadlock condition before diff --git a/ext/psych/lib/psych/visitors/to_ruby.rb b/ext/psych/lib/psych/visitors/to_ruby.rb index 745338ad99..f3441fff92 100644 --- a/ext/psych/lib/psych/visitors/to_ruby.rb +++ b/ext/psych/lib/psych/visitors/to_ruby.rb @@ -60,7 +60,7 @@ module Psych when "tag:yaml.org,2002:float", "!float" Float(@ss.tokenize(o.value)) when "!ruby/regexp" - o.value =~ /^\/(.*)\/([mix]*)$/ + o.value =~ /^\/(.*)\/([mixn]*)$/ source = $1 options = 0 lang = nil @@ -69,6 +69,9 @@ module Psych when 'x' then options |= Regexp::EXTENDED when 'i' then options |= Regexp::IGNORECASE when 'm' then options |= Regexp::MULTILINE + + # FIXME: there is no constant for ARG_ENCODING_NONE + when 'n' then options |= 32 else lang = option end end diff --git a/ext/syck/lib/syck/rubytypes.rb b/ext/syck/lib/syck/rubytypes.rb index 4aae1373b1..b47045504d 100644 --- a/ext/syck/lib/syck/rubytypes.rb +++ b/ext/syck/lib/syck/rubytypes.rb @@ -261,7 +261,7 @@ end class Regexp yaml_as "tag:ruby.yaml.org,2002:regexp" def Regexp.yaml_new( klass, tag, val ) - if String === val and val =~ /^\/(.*)\/([mix]*)$/ + if String === val and val =~ /^\/(.*)\/([mixn]*)$/ val = { 'regexp' => $1, 'mods' => $2 } end if Hash === val @@ -271,6 +271,7 @@ class Regexp mods |= Regexp::EXTENDED if val['mods'].include?( 'x' ) mods |= Regexp::IGNORECASE if val['mods'].include?( 'i' ) mods |= Regexp::MULTILINE if val['mods'].include?( 'm' ) + mods |= 32 if val['mods'].include?( 'n' ) end val.delete( 'mods' ) r = YAML::object_maker( klass, {} ) diff --git a/test/psych/test_yaml.rb b/test/psych/test_yaml.rb index 45cd39d676..20bf26e5b4 100644 --- a/test/psych/test_yaml.rb +++ b/test/psych/test_yaml.rb @@ -13,6 +13,11 @@ class Psych_Unit_Tests < Psych::TestCase def teardown Psych.domain_types.clear end + + # [ruby-core:34969] + def test_regexp_with_n + assert_cycle(Regexp.new('',0,'n')) + end # # Tests modified from 00basic.t in Psych.pm # diff --git a/test/syck/test_yaml.rb b/test/syck/test_yaml.rb index 3d9d7abe1d..b346de4bee 100644 --- a/test/syck/test_yaml.rb +++ b/test/syck/test_yaml.rb @@ -22,6 +22,11 @@ class YAML_Unit_Tests < Test::Unit::TestCase YAML::ENGINE.yamler = @current_engine 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 # emitting @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 186 +#define RUBY_PATCHLEVEL 187 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 |
