summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-28 13:40:59 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-28 13:40:59 +0000
commitbb40ff921676511a54c171a83dc3f3afe8b617f3 (patch)
treebd99e2d01e01f1cd86ee82e01be4a5b4853ab07a /ext
parent67db9280bf681b35ecf10c17ebd936acc3061d4a (diff)
merges r30763 from trunk into ruby_1_9_2.
-- * 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/branches/ruby_1_9_2@31203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/psych/lib/psych/visitors/to_ruby.rb5
-rw-r--r--ext/syck/lib/syck/rubytypes.rb3
2 files changed, 6 insertions, 2 deletions
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, {} )