*** empty log message ***
[m17n/m17n-lib-cs.git] / MSymbol.cs
index 4aeffb4..c687a0f 100644 (file)
@@ -17,6 +17,7 @@ namespace M17N.Core
     public static MSymbol t = MSymbol.Of ("t");
     public static MSymbol symbol = MSymbol.Of ("symbol");
     public static MSymbol mtext = MSymbol.Of ("mtext");
+    public static MSymbol mstring = MSymbol.Of ("string");
     public static MSymbol plist = MSymbol.Of ("plist");
     public static MSymbol integer = MSymbol.Of ("integer");
 
@@ -25,6 +26,16 @@ namespace M17N.Core
       Name = name;
     }
 
+    public static implicit operator MSymbol (string name)
+    {
+      return Of (name);
+    }
+
+    public static explicit operator string (MSymbol sym)
+    {
+      return sym.Name;
+    }
+
     public static MSymbol Of (string name)
     {
       lock (pool)
@@ -53,6 +64,9 @@ namespace M17N.Core
     {
       MSymbol sym = MSymbol.Of (name);
 
+      if ((flags & MProperty.Flags.BothSticky) != MProperty.Flags.None
+         && (flags & MProperty.Flags.Sensitive) != MProperty.Flags.None)
+       throw new Exception ("A property can't be both sticky and sensitve");
       if (sym.flags == null)
        sym.flags = flags;
       else if (sym.flags != flags)
@@ -66,7 +80,8 @@ namespace M17N.Core
 
       foreach (char c in Name)
        {
-         if (c == '\\' || c == ' ' || c == '\'' || c == '\"' || c == ':')
+         if (c == '\\' || c == ' ' || c == '\'' || c == '\"'
+             || c == '(' || c == ')')
            str += "\\";
          str += c;
        }