X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=MSymbol.cs;h=c687a0ff80fab8986725d5b21327fb4c58e48153;hb=ef1004c41650cf895724f0555cf10e61527bb67f;hp=4aeffb4160e6b4832b8e0832c75e94b9b67cbbae;hpb=d571ebf04b3954e89b335cf9130f38eb20d03ce9;p=m17n%2Fm17n-lib-cs.git diff --git a/MSymbol.cs b/MSymbol.cs index 4aeffb4..c687a0f 100644 --- a/MSymbol.cs +++ b/MSymbol.cs @@ -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; }