*** empty log message ***
[m17n/m17n-lib-cs.git] / MPlist.cs
index ab948f4..57005c9 100644 (file)
--- a/MPlist.cs
+++ b/MPlist.cs
@@ -54,6 +54,34 @@ namespace M17N.Core
          next = new MPlist ();
       }
 
+    public MPlist (FileStream stream, MSymbol stop)
+      {
+       MStreamReader reader = new MStreamReader (stream);
+       bool result;
+
+       key = MSymbol.nil;
+       val = null;
+       while (true)
+         {
+           MSymbol this_key;
+           object this_val;
+
+           result = reader.ReadElement (out this_key, out this_val);
+           if (! result)
+             return;
+           if (this_key == MSymbol.plist)
+             {
+               MPlist plist = (MPlist) this_val;
+
+               if (plist.IsSymbol && plist.Symbol == stop)
+                 return;
+             }
+           key = this_key;
+           val = this_val;
+           next = new MPlist (reader, stop);
+         }
+      }
+
     public MPlist (FileStream stream, MSymbol target, MSymbol stop)
       {
        MStreamReader reader = new MStreamReader (stream);
@@ -107,6 +135,44 @@ namespace M17N.Core
          next = new MPlist ();
       }
 
+    private MPlist (MStreamReader reader, MSymbol stop)
+      {
+       bool result;
+       MPlist next_plist = null;
+
+       key = MSymbol.nil;
+       val = null;
+       while (true)
+         {
+           MSymbol this_key;
+           object this_val;
+
+           result = reader.ReadElement (out this_key, out this_val);
+           if (! result)
+             return;
+           if (this_key == MSymbol.plist)
+             {
+               MPlist plist = (MPlist) this_val;
+
+               if (plist.IsSymbol && plist.Symbol == stop)
+                 return;
+             }
+           if (next_plist == null)
+             {
+               key = this_key;
+               val = this_val;
+               next = next_plist = new MPlist ();
+             }
+           else
+             {
+               next_plist.key = this_key;
+               next_plist.val = this_val;
+               next_plist.next = new MPlist ();
+               next_plist = next_plist.next;
+             }
+         }
+      }
+
     private MPlist (MStreamReader reader, MSymbol target, MSymbol stop)
       {
        bool result;
@@ -258,7 +324,10 @@ namespace M17N.Core
       if (IsEmpty)
        Push (key, val);
       else
-       this.val = val;
+       {
+         this.key = key;
+         this.val = val;
+       }
       return this;
     }
 
@@ -622,7 +691,7 @@ namespace M17N.Core
          val = new MPlist (this);
          key = MSymbol.plist;
        }
-      else if (c == '"' || c == '\\')
+      else if (c == '"')
        {
          MText mt;
          ReadMText (out mt);