edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyUtils.cs;C478584
File: RubyUtils.cs
===================================================================
--- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyUtils.cs;C478584  (server)    7/7/2008 4:24 PM
+++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyUtils.cs;MoreYamlStuff
@@ -28,6 +28,8 @@
 using Ruby.Builtins;
 using Ruby.Compiler;
 using Ruby.Runtime.Calls;
+using System.Runtime.Serialization;
+using System.Reflection;
 
 namespace Ruby.Runtime {
 
@@ -612,5 +614,51 @@
                 self   // argument
             );
         }
+
+        private static readonly Type[] _ccTypes = new Type[] { typeof(CodeContext) };
+        private static readonly Type[] _serializableTypeSignature = new Type[] { typeof(SerializationInfo), typeof(StreamingContext) };
+
+        public static object/*!*/ CreateRubyObject(CodeContext/*!*/ context, RubyClass/*!*/ clazz, Hash attributes) {
+            Type baseType = clazz.GetUnderlyingSystemType();
+            object obj;
+            if (typeof(ISerializable).IsAssignableFrom(baseType)) {
+                BindingFlags bindingFlags = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance;
+                ConstructorInfo ci = baseType.GetConstructor(bindingFlags, null, _serializableTypeSignature, null);
+                if (ci == null) {
+                    string message = String.Format("Class {0} does not have a valid deserializing constructor", baseType.FullName);
+                    throw new NotSupportedException(message);
+                }
+                SerializationInfo info = new SerializationInfo(baseType, new FormatterConverter());
+                info.AddValue("#class", clazz);
+                foreach (KeyValuePair<object, object> pair in attributes) {
+                    info.AddValue("@" + pair.Key, pair.Value);
+                }
+                obj = ci.Invoke(new object[2] { info, new StreamingContext(StreamingContextStates.Other, clazz) });
+            } else {
+                obj = LoadNonISerializableObject(context, baseType);
+                foreach (KeyValuePair<object, object> pair in attributes) {
+                    RubyOps.SetInstanceVariable(obj, pair.Value, RubyUtils.GetScope(context),
+                        SymbolTable.StringToId(pair.Key.ToString()));
+                }
+            }
+            return obj;
+        }
+
+        private static object/*!*/ LoadNonISerializableObject(CodeContext/*!*/ context, Type/*!*/ baseType) {
+            object result;
+            BindingFlags bindingFlags = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance;
+            ConstructorInfo ci = baseType.GetConstructor(bindingFlags, null, Type.EmptyTypes, null);
+            if (ci == null || ci.IsPrivate || ci.IsFamilyAndAssembly) {
+                ci = baseType.GetConstructor(bindingFlags, null, _ccTypes, null);
+                if (ci == null || ci.IsPrivate || ci.IsFamilyAndAssembly) {
+                    string message = String.Format("Class {0} does not have a valid constructor", baseType.FullName);
+                    throw new NotSupportedException(message);
+                }
+                result = ci.Invoke(new object[1] { context });
+            } else {
+                result = ci.Invoke(new object[0]);
+            }
+            return result;
+        }
     }
 }
===================================================================
edit: $/Merlin_External/Languages/IronRuby/yaml/IronRuby.Libraries.Yaml/BuiltinsOps.cs;C480838
File: BuiltinsOps.cs
===================================================================
--- $/Merlin_External/Languages/IronRuby/yaml/IronRuby.Libraries.Yaml/BuiltinsOps.cs;C480838  (server)    7/1/2008 4:21 PM
+++ Shelved Change: $/Merlin_External/Languages/IronRuby/yaml/IronRuby.Libraries.Yaml/BuiltinsOps.cs;MoreYamlStuff
@@ -115,10 +115,14 @@
         }
 
         [RubyMethod("taguri")]
-        public static MutableString TagUri(CodeContext/*!*/ context, object self) {
-            MutableString str = MutableString.Create("!ruby/struct:");
-            str.Append(RubyUtils.GetClassName(context, self));
-            return str;
+        public static MutableString TagUri(CodeContext/*!*/ context, RubyStruct/*!*/ self) {
+            MutableString str = MutableString.Create("tag:ruby.yaml.org,2002:struct:");
+            string name = RubyUtils.GetClassName(context, self);    
+            string structPrefix = "Struct::";
+            if (name.StartsWith(structPrefix)) {
+                name = name.Substring(structPrefix.Length);
+            }
+            return str.Append(name);
         }
     }
 
@@ -278,6 +282,10 @@
         public static Node ToYaml(CodeContext context, object self, RubyRepresenter rep) {
             return rep.Scalar(context, self, RubySites.Inspect(context, self));
         }
+        [RubyMethod("taguri")]
+        public static MutableString TagUri(CodeContext/*!*/ context, [NotNull]RubyRegex self) {
+            return MutableString.Create("tag:ruby.yaml.org,2002:regexp");
+        }
     }
 
     [RubyModule(Extends = typeof(SymbolId))]
===================================================================
edit: $/Merlin_External/Languages/IronRuby/yaml/IronRuby.Libraries.Yaml/Initializer.Generated.cs;C480838
File: Initializer.Generated.cs
===================================================================
--- $/Merlin_External/Languages/IronRuby/yaml/IronRuby.Libraries.Yaml/Initializer.Generated.cs;C480838  (server)    7/1/2008 4:22 PM
+++ Shelved Change: $/Merlin_External/Languages/IronRuby/yaml/IronRuby.Libraries.Yaml/Initializer.Generated.cs;MoreYamlStuff
@@ -131,6 +131,10 @@
         
         private void LoadRuby__Builtins__RubyRegex_Instance(Ruby.Builtins.RubyModule/*!*/ module) {
             
+            module.DefineLibraryMethod("taguri", 0x9, new System.Delegate[] {
+                new System.Func<System.Scripting.Runtime.CodeContext, Ruby.Builtins.RubyRegex, Ruby.Builtins.MutableString>(Ruby.StandardLibrary.Yaml.YamlRegexpOps.TagUri),
+            });
+            
             module.DefineLibraryMethod("to_yaml_node", 0x9, new System.Delegate[] {
                 new System.Func<System.Scripting.Runtime.CodeContext, System.Object, Ruby.StandardLibrary.Yaml.RubyRepresenter, Ruby.StandardLibrary.Yaml.Node>(Ruby.StandardLibrary.Yaml.YamlRegexpOps.ToYaml),
             });
@@ -140,7 +144,7 @@
         private void LoadRuby__Builtins__RubyStruct_Instance(Ruby.Builtins.RubyModule/*!*/ module) {
             
             module.DefineLibraryMethod("taguri", 0x9, new System.Delegate[] {
-                new System.Func<System.Scripting.Runtime.CodeContext, System.Object, Ruby.Builtins.MutableString>(Ruby.StandardLibrary.Yaml.YamlStructOps.TagUri),
+                new System.Func<System.Scripting.Runtime.CodeContext, Ruby.Builtins.RubyStruct, Ruby.Builtins.MutableString>(Ruby.StandardLibrary.Yaml.YamlStructOps.TagUri),
             });
             
             module.DefineLibraryMethod("to_yaml_node", 0x9, new System.Delegate[] {
===================================================================
edit: $/Merlin_External/Languages/IronRuby/yaml/IronRuby.Libraries.Yaml/RubyConstructor.cs;C480838
File: RubyConstructor.cs
===================================================================
--- $/Merlin_External/Languages/IronRuby/yaml/IronRuby.Libraries.Yaml/RubyConstructor.cs;C480838  (server)    7/1/2008 10:33 AM
+++ Shelved Change: $/Merlin_External/Languages/IronRuby/yaml/IronRuby.Libraries.Yaml/RubyConstructor.cs;MoreYamlStuff
@@ -16,22 +16,25 @@
  * 
  ***** END LICENSE BLOCK *****/
 
-using System.Collections;
+using System;
+using System.IO;
+using System.Reflection;
+using System.Runtime.Serialization;
 using System.Collections.Generic;
 using System.Text.RegularExpressions;
-using Microsoft.Scripting.Runtime;
-using Ruby;
+using System.Scripting.Runtime;
+using System.Scripting;
+using Microsoft.Scripting.Actions;
 using Ruby.Builtins;
 using Ruby.Runtime;
-using System.Scripting.Runtime;
 
 namespace Ruby.StandardLibrary.Yaml {
 
     public class RubyConstructor : Constructor {
         private readonly static Dictionary<string, YamlConstructor> _yamlConstructors = new Dictionary<string, YamlConstructor>();
         private readonly static Dictionary<string, YamlMultiConstructor> _yamlMultiConstructors = new Dictionary<string, YamlMultiConstructor>();
-        private readonly static Dictionary<string, Regex> _yamlMultiRegexps = new Dictionary<string, Regex>();
-        private readonly CodeContext/*!*/ _context;
+        private readonly static Dictionary<string, Regex> _yamlMultiRegexps = new Dictionary<string, Regex>();                
+        private readonly static Regex _regexPattern = new Regex("^/(?<expr>.+)/(?<opts>[eimnosux]*)$", RegexOptions.Compiled);        
 
         public override YamlConstructor GetYamlConstructor(string key) {
             YamlConstructor result;
@@ -68,8 +71,10 @@
         }
 
         public new static void AddMultiConstructor(string tagPrefix, YamlMultiConstructor ctor) {
-            _yamlMultiConstructors.Add(tagPrefix, ctor);
-            _yamlMultiRegexps.Add(tagPrefix, new Regex("^" + tagPrefix, RegexOptions.Compiled));
+            if (!_yamlMultiConstructors.ContainsKey(tagPrefix)) {
+                _yamlMultiConstructors.Add(tagPrefix, ctor);
+                _yamlMultiRegexps.Add(tagPrefix, new Regex("^" + tagPrefix, RegexOptions.Compiled));
+            }
         }
 
         public static object ConstructRubyOmap(IConstructor ctor, Node node) {
@@ -88,38 +93,139 @@
             return value;
         }
 
-        public Range ConstructRubyRange(IConstructor ctor, Node node) {
-            MappingNode mapping = node as MappingNode;
-            if (mapping == null) {
-                throw new ConstructorException("can only contruct Range from mapping node");
+        private static object ParseObject(IConstructor ctor, string value) {
+            Composer composer = RubyYaml.MakeComposer(new StringReader(value));
+            if (composer.CheckNode()) {
+                return ctor.ConstructObject(composer.GetNode());
+            } else {
+                throw new ConstructorException("Invalid YAML element: " + value);
             }
+        }
+
+        public static Range ConstructRubyRange(IConstructor ctor, Node node) {
             object begin = null;
             object end = null;
             bool excludeEnd = false;
-            foreach (KeyValuePair<Node, Node> n in mapping.Nodes) {
-                string key = ConstructScalar(n.Key).ToString();
-                switch (key) {
-                    case "begin":
-                        begin = ConstructObject(n.Value);    
-                        break;
-                    case "end":
-                        end = ConstructObject(n.Value);    
-                        break;
-                    case "excl":
-                        TryConstructYamlBool(ctor, n.Value, out excludeEnd);                        
-                        break;
+            ScalarNode scalar = node as ScalarNode;                        
+            if (scalar != null) {
+                string value = scalar.Value;                
+                int dotsIdx;
+                if ((dotsIdx = value.IndexOf("...")) != -1) {
+                    begin = ParseObject(ctor, value.Substring(0, dotsIdx));                
+                    end = ParseObject(ctor, value.Substring(dotsIdx + 3));
+                    excludeEnd = true;
+                } else if ((dotsIdx = value.IndexOf("..")) != -1) {
+                    begin = ParseObject(ctor, value.Substring(0, dotsIdx));
+                    end = ParseObject(ctor, value.Substring(dotsIdx + 2));
+                } else {
+                    throw new ConstructorException("Invalid Range: " + value);
+                }
+            } else {
+                MappingNode mapping = node as MappingNode;
+                if (mapping == null) {
+                    throw new ConstructorException("Invalid Range: " + node);    
+                }
+                foreach (KeyValuePair<Node, Node> n in mapping.Nodes) {
+                    string key = ctor.ConstructScalar(n.Key).ToString();
+                    switch (key) {
+                        case "begin":
+                            begin = ctor.ConstructObject(n.Value);
+                            break;
+                        case "end":
+                            end = ctor.ConstructObject(n.Value);
+                            break;
+                        case "excl":
+                            TryConstructYamlBool(ctor, n.Value, out excludeEnd);
+                            break;
+                        default:
+                            throw new ConstructorException(string.Format("'{0}' is not allowed as an instance variable name for class Range", key));
+                    }
+                }                
+            }
+            return new Range(ctor.GetContext(), begin, end, excludeEnd);            
+        }
+
+        public static RubyRegex ConstructRubyRegexp(IConstructor ctor, Node node) {
+            ScalarNode scalar = node as ScalarNode;
+            if (node == null) {
+                throw RubyExceptions.CreateTypeError("Can only create regex from scalar node");
+            }                        
+            Match match = _regexPattern.Match(scalar.Value);
+            if (!match.Success) {
+                throw new ConstructorException("Invalid Regular expression: \"" + scalar.Value + "\"");
+            }
+            RubyRegexOptions options = new RubyRegexOptions();
+            foreach (char c in match.Groups["opts"].Value) {
+                switch (c) {
+                    case 'i': options |= RubyRegexOptions.IgnoreCase; break;
+                    case 'x': options |= RubyRegexOptions.Extended; break;
+                    case 'm': options |= RubyRegexOptions.Multiline; break;
+                    case 'o': break;
+                    case 'n': options |= RubyRegexOptions.FIXED; break;
+                    case 'e': options |= RubyRegexOptions.EUC; break;
+                    case 's': options |= RubyRegexOptions.SJIS; break;
+                    case 'u': options |= RubyRegexOptions.UTF8; break;
                     default:
-                        throw new ConstructorException(string.Format("'{0}' is not allowed as an instance variable name for class Range", key));
-                }                
+                        throw new ConstructorException("Unknown regular expression option: '" + c + "'");
+                }
+            }            
+            return new RubyRegex(match.Groups["expr"].Value, options);            
+        }
+        
+        public static object ConstructPrivateObject(IConstructor ctor, string className, Node node) {
+            MappingNode mapping = node as MappingNode;
+            if (mapping == null) {
+                throw new ConstructorException("can only construct private type from mapping node");
             }
-            return new Range(Context, begin, end, excludeEnd);            
+            RubyModule module;
+            CodeContext context = ctor.GetContext();
+            if (RubyUtils.GetExecutionContext(context).TryGetModule(SymbolTable.StringToId(className), out module)) {
+                RubyClass clazz = module as RubyClass;
+                if (clazz == null) {
+                    throw new ConstructorException("Cannot construct module");
+                }
+                return RubyUtils.CreateRubyObject(context, clazz, ctor.ConstructMapping(mapping));
+            } else {
+                //TODO: YAML::Object
+                throw new NotImplementedError("YAML::Object is not implemented yet");
+            }
         }
 
+        public static object ConstructRubyStruct(IConstructor ctor, string className, Node node) {
+            MappingNode mapping = node as MappingNode;
+            if (mapping == null) {
+                throw new ConstructorException("can only construct struct from mapping node");
+            }
+            CodeContext context = ctor.GetContext();
+            SymbolId classNameId = SymbolTable.StringToId(className);
+            RubyModule module;
+            RubyClass clazz;
+            if (RubyUtils.GetExecutionContext(context).TryGetModule(classNameId, out module)) {
+                clazz = module as RubyClass;
+                if (clazz == null) {
+                    throw new ConstructorException("Struct type name must be Ruby class name");
+                }
+            } else {
+                RubyModule structModule = RubyUtils.GetExecutionContext(context).GetModule(typeof(RubyStruct));
+                clazz = (RubyClass)RubyUtils.GetConstant(context, structModule, classNameId, false);
+                if (clazz == null) {
+                    throw new ConstructorException("Cannot find struct class \"" + className + "\"");
+                }
+            }
+            RubyStruct newStruct = new RubyStruct(clazz);            
+            foreach (KeyValuePair<object, object> pair in ctor.ConstructMapping(mapping)) {
+                RubyStructOps.SetValue(newStruct, SymbolTable.StringToId(pair.Key.ToString()), pair.Value);        
+            }
+            return newStruct;
+        }
+
         public RubyConstructor(CodeContext/*!*/ context, NodeProvider/*!*/ nodeProvider)
-            : base(nodeProvider, context) {
-            _context = context;
+            : base(nodeProvider, context) {            
             AddConstructor("tag:yaml.org,2002:str", ConstructRubyScalar);
             AddConstructor("tag:ruby.yaml.org,2002:range", ConstructRubyRange);
+            AddConstructor("tag:ruby.yaml.org,2002:regexp", ConstructRubyRegexp);
+            AddMultiConstructor("tag:ruby.yaml.org,2002:object:", ConstructPrivateObject);            
+            AddMultiConstructor("tag:ruby.yaml.org,2002:struct:", ConstructRubyStruct);
 
             //AddConstructor("tag:yaml.org,2002:omap", ConstructRubyOmap);
             //AddMultiConstructor("tag:yaml.org,2002:seq:", ConstructSpecializedRubySequence);
===================================================================
edit: $/Merlin_External/Languages/IronRuby/yaml/IronRuby.Libraries.Yaml/RubyYaml.cs;C479346
File: RubyYaml.cs
===================================================================
--- $/Merlin_External/Languages/IronRuby/yaml/IronRuby.Libraries.Yaml/RubyYaml.cs;C479346  (server)    7/1/2008 3:11 PM
+++ Shelved Change: $/Merlin_External/Languages/IronRuby/yaml/IronRuby.Libraries.Yaml/RubyYaml.cs;MoreYamlStuff
@@ -235,7 +235,7 @@
             return new RubyConstructor(context, MakeComposer(reader));
         }
 
-        private static Composer/*!*/ MakeComposer(TextReader/*!*/ reader) {
+        internal static Composer/*!*/ MakeComposer(TextReader/*!*/ reader) {
             return new Composer(new Parser(new Scanner(reader), YamlOptions.DefaultOptions.Version));
         }
 
===================================================================
edit: $/Merlin_External/Languages/IronRuby/yaml/IronRuby.Libraries.Yaml/Engine/BaseConstructor.cs;C480838
File: BaseConstructor.cs
===================================================================
--- $/Merlin_External/Languages/IronRuby/yaml/IronRuby.Libraries.Yaml/Engine/BaseConstructor.cs;C480838  (server)    7/2/2008 11:01 AM
+++ Shelved Change: $/Merlin_External/Languages/IronRuby/yaml/IronRuby.Libraries.Yaml/Engine/BaseConstructor.cs;MoreYamlStuff
@@ -43,6 +43,7 @@
         object ConstructPairs(Node node);
         void DoRecursionFix(Node node, object obj);
         void AddFixer(Node node, RecursiveFixer fixer);
+        CodeContext GetContext();
     }
 
     public class BaseConstructor : IConstructor {
@@ -60,8 +61,8 @@
             _context = context;
         }
 
-        protected CodeContext Context {
-            get { return _context; }
+        public CodeContext GetContext() {
+            return _context;
         }
 
         public static object NullObjectKey {
@@ -224,7 +225,7 @@
                 val = ConstructSequence(node);
             } else {
                 throw new ConstructorException("unexpected node type: " + node);
-            }
+            }            
             return new PrivateType(node.Tag,val);
         }
         
===================================================================
