当前位置: 首页>>代码示例>>C#>>正文


C# Symbol.ToString方法代码示例

本文整理汇总了C#中clojure.lang.Symbol.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Symbol.ToString方法的具体用法?C# Symbol.ToString怎么用?C# Symbol.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在clojure.lang.Symbol的用法示例。


在下文中一共展示了Symbol.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadTagged

            static object ReadTagged(PushbackTextReader r, Symbol tag)
            {
                object o = read(r, true, null, true);

                ILookup dataReaders = (ILookup)RT.DataReadersVar.deref();
                IFn dataReader = (IFn)RT.get(dataReaders, tag);
                if (dataReader == null)
                {
                    dataReaders = (ILookup)RT.DefaultDataReadersVar.deref();
                    dataReader = (IFn)RT.get(dataReaders, tag);
                    if (dataReader == null)
                    {
                        IFn default_reader = (IFn)RT.DefaultDataReaderFnVar.deref();
                        if (default_reader != null)
                            return default_reader.invoke(tag, o);
                        else
                            throw new ArgumentException("No reader function for tag " + tag.ToString());
                    }
                }
                return dataReader.invoke(o);
            }
开发者ID:vietnt,项目名称:clojure-clr,代码行数:21,代码来源:LispReader.cs

示例2: ReadRecord

            static object ReadRecord(PushbackTextReader r, Symbol recordName)
            {
                Type recordType = RT.classForName(recordName.ToString());

                char endch;
                bool shortForm = true;

                int ch = r.Read();

                // flush whitespace
                //while (isWhitespace(ch))
                //    ch = r.Read();

                // A defrecord ctor can take two forms.  Check for map->R version first.
                if (ch == '{')
                {
                    endch = '}';
                    shortForm = false;
                }
                else if (ch == '[')
                    endch = ']';
                else
                    throw new ArgumentException(String.Format("Unreadable constructor form starting with \"#{0}{1}\"", recordName, (char)ch));

                object[] recordEntries = ReadDelimitedList(endch, r, true).ToArray();
                object ret = null;
                ConstructorInfo[] allCtors = recordType.GetConstructors();

                if (shortForm)
                {
                    bool ctorFound = false;
                    foreach ( ConstructorInfo cinfo in allCtors )
                        if ( cinfo.GetParameters().Length == recordEntries.Length )
                            ctorFound = true;

                    if ( ! ctorFound )
                        throw new ArgumentException(String.Format("Unexpected number of constructor arguments to {0}: got {1}", recordType.ToString(), recordEntries.Length));

                    ret = Reflector.InvokeConstructor(recordType,recordEntries);
                }
                else
                {
                    IPersistentMap vals = RT.map(recordEntries);
                    for (ISeq s = RT.keys(vals); s != null; s = s.next())
                    {
                        if (!(s.first() is Keyword))
                            throw new ArgumentException(String.Format("Unreadable defrecord form: key must be of type clojure.lang.Keyword, got {0}", s.first().ToString()));
                    }

                    ret = Reflector.InvokeStaticMethod(recordType, "create", new Object[] { vals });
                }

                return ret;
            }
开发者ID:vietnt,项目名称:clojure-clr,代码行数:54,代码来源:LispReader.cs

示例3: ReadRecord

            static object ReadRecord(object form, Symbol recordName, object opts, object pendingForms)
            {
                bool readeval = RT.booleanCast(RT.ReadEvalVar.deref());
                if (!readeval)
                    throw new InvalidOperationException("Record construction syntax can only be used when *read-eval* == true ");

                Type recordType = RT.classForNameE(recordName.ToString());

                IPersistentVector recordEntries;
                IPersistentMap vals;

                object ret = null;
                ConstructorInfo[] allCtors = recordType.GetConstructors();

                if ((recordEntries = form as IPersistentVector) != null)
                {
                    // shortForm
                    bool ctorFound = false;
                    foreach (ConstructorInfo cinfo in allCtors)
                        if (cinfo.GetParameters().Length == recordEntries.count())
                            ctorFound = true;

                    if (!ctorFound)
                        throw new ArgumentException(String.Format("Unexpected number of constructor arguments to {0}: got {1}", recordType.ToString(), recordEntries.count()));

                    ret = Reflector.InvokeConstructor(recordType, RT.toArray(recordEntries));
                }
                else if ((vals = form as IPersistentMap) != null)
                {
                    for (ISeq s = RT.keys(vals); s != null; s = s.next())
                    {
                        if (!(s.first() is Keyword))
                            throw new ArgumentException(String.Format("Unreadable defrecord form: key must be of type clojure.lang.Keyword, got {0}", s.first().ToString()));
                    }

                    ret = Reflector.InvokeStaticMethod(recordType, "create", new Object[] { vals });
                }
                else
                {
                    throw new ArgumentException("Unreadable constructor form starting with \"#" + recordName + "\"");
                }

                return ret;
            }
开发者ID:telefunkenvf14,项目名称:clojure-clr,代码行数:44,代码来源:LispReader.cs

示例4: ReadTagged

 static object ReadTagged(object o, Symbol tag, object opts, object pendingForms)
 {
     ILookup dataReaders = (ILookup)RT.DataReadersVar.deref();
     IFn dataReader = (IFn)RT.get(dataReaders, tag);
     if (dataReader == null)
     {
         dataReaders = (ILookup)RT.DefaultDataReadersVar.deref();
         dataReader = (IFn)RT.get(dataReaders, tag);
         if (dataReader == null)
         {
             IFn default_reader = (IFn)RT.DefaultDataReaderFnVar.deref();
             if (default_reader != null)
                 return default_reader.invoke(tag, o);
             else
                 throw new ArgumentException("No reader function for tag " + tag.ToString());
         }
     }
     return dataReader.invoke(o);
 }
开发者ID:telefunkenvf14,项目名称:clojure-clr,代码行数:19,代码来源:LispReader.cs

示例5: ReadTagged

            private static object ReadTagged(PushbackTextReader r, Symbol tag, IPersistentMap opts)
            {
                object o = ReadAux(r, opts);

                ILookup readers = (ILookup)RT.get(opts, READERS);
                IFn dataReader = (IFn)RT.get(readers, tag);
                if (dataReader == null)
                    dataReader = (IFn)RT.get(RT.DefaultDataReadersVar.deref(), tag);
                if (dataReader == null)
                {
                    IFn defaultReader = (IFn)RT.get(opts, DEFAULT);
                    if (defaultReader != null)
                        return defaultReader.invoke(tag, o);
                    else
                        throw new InvalidOperationException("No reader function for tag " + tag.ToString());
                }
                else
                    return dataReader.invoke(o);
            }
开发者ID:EricThorsen,项目名称:clojure-clr,代码行数:19,代码来源:EdnReader.cs


注:本文中的clojure.lang.Symbol.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。