Пример #1
0
        internal string ToString(bool convertMcall)
        {
            if (!convertMcall)
            {
                return(ToStringFunctionStyle());
            }
            if (var == null)
            {
                return(ToStringFunctionStyle());
            }
            if (exp == null)
            {
                return(ToStringFunctionStyle());
            }
            if (arg == null)
            {
                return(ToStringFunctionStyle());
            }
            StringBuilder builder = new StringBuilder();

            builder.Append(var.ToString());
            builder.Append("->");
            builder.Append(exp.ToString());
            //deHSP1.20のバグ修正。expとargの間にカンマを入れないように修正。
            if (arg != null)
            {
                builder.Append(arg.ToString(true));
            }

            return(builder.ToString());
        }
Пример #2
0
            public override string ToString()
            {
                if (Kind == TokenKind.Number)
                    return Num.ToString();
                else if (Kind == TokenKind.Identifier)
                    return Ident;

                List<string> strs = new List<string>();
                if(Tok1!=null) strs.Add(Tok1.ToString());
                if(Tok2!=null) strs.Add(Tok2.ToString());
                if(Tok3!=null) strs.Add(Tok3.ToString());
                string r="("+Kind.ToString()+" "+string.Join(" ", strs)+")";
                return r;
            }
Пример #3
0
        public override string ToString()
        {
            StringBuilder builder = new StringBuilder();

            if (token != null)
            {
                builder.Append(token.ToString());
            }
            if (exp != null)
            {
                builder.Append(' ');
                builder.Append(exp.ToString());
            }
            if (func != null)
            {
                builder.Append(' ');
                builder.Append(func.ToString());
            }
            return(builder.ToString());
        }
        public void ToString_WhenCalled_ReturnStringRepresentation()
        {
            List <IToken> expression = new List <IToken>()
            {
                new Token()
                {
                    Value = "1"
                }, new Token()
                {
                    Value = "2"
                }, new Token()
                {
                    Value = "3"
                }
            };
            ExpressionToken token = new ExpressionToken()
            {
                Expression = expression
            };

            var result = token.ToString();

            Assert.That(result, Is.EqualTo("1 2 3"));
        }
Пример #5
0
 private static T Dump <T>(this T o, string description, int?depth, bool toDataGrid, Action <ClickContext> onClick)
 {
     if (o != null)
     {
         Type type = o.GetType();
         if ((((!type.IsValueType && !type.IsPrimitive) && (type.Namespace != null)) && (type.Namespace.StartsWith("System.Threading.Tasks.Dataflow") && (type.GetInterface("System.Threading.Tasks.Dataflow.IDataflowBlock") != null))) && DataflowBridge.Dump(o, description))
         {
             return(o);
         }
     }
     if (depth < 0)
     {
         depth = null;
     }
     if (depth > 20)
     {
         depth = 20;
     }
     if (((depth.HasValue || toDataGrid) || !AppDomain.CurrentDomain.GetAssemblies().Any <Assembly>(a => a.FullName.StartsWith("PresentationCore,", StringComparison.InvariantCultureIgnoreCase))) || !WpfBridge.DumpWpfElement(o, description))
     {
         bool flag2;
         if ((!depth.HasValue && !toDataGrid) && (o is Control))
         {
             if (o is Form)
             {
                 ((Form)o).Show();
                 return(o);
             }
             PanelManager.DisplayControl((Control)o, description ?? "WinForms");
             return(o);
         }
         if ((o is XContainer) || (o is XmlDocument))
         {
             PanelManager.DisplaySyntaxColoredText(o.ToString(), SyntaxLanguageStyle.XML, description ?? "XML");
             return(o);
         }
         Server     currentServer = Server.CurrentServer;
         TextWriter writer        = (currentServer == null) ? null : currentServer.LambdaFormatter;
         Expression expr          = null;
         if (writer != null)
         {
             if (o is IQueryable)
             {
                 expr = ((IQueryable)o).Expression;
             }
             else if (o is Expression)
             {
                 expr = (Expression)o;
             }
         }
         if (expr != null)
         {
             string content = "";
             try
             {
                 ExpressionToken token = ExpressionToken.Visit(expr);
                 if (token != null)
                 {
                     content = token.ToString();
                 }
             }
             catch (Exception exception)
             {
                 Log.Write(exception, "Dump ExpressionToken Visit");
             }
             if (content.Length > 0)
             {
                 lock (writer)
                 {
                     if (!string.IsNullOrEmpty(description))
                     {
                         writer.WriteLine(new HeadingPresenter(description, content));
                     }
                     else
                     {
                         writer.WriteLine(content + "\r\n");
                     }
                 }
             }
         }
         if ((currentServer != null) && currentServer.WriteResultsToGrids)
         {
             toDataGrid = true;
         }
         if (toDataGrid && (o != null))
         {
             Type t = o.GetType();
             if (((!ExplorerGrid.IsAtomic(t) && (!t.IsArray || (t.GetArrayRank() == 1))) && (t.GetInterface("System.IObservable`1") == null)) && (t.GetCustomAttributes(typeof(MetaGraphNodeAttribute), false).Length == 0))
             {
                 return(o.Explore <T>(description));
             }
         }
         XhtmlWriter writer3 = (currentServer == null) ? null : currentServer.ResultsWriter;
         if (flag2 = o is Type)
         {
             ObjectNode.ExpandTypes = true;
         }
         try
         {
             if (!string.IsNullOrEmpty(description))
             {
                 HeadingPresenter presenter = new HeadingPresenter(description, o);
                 if (writer3 != null)
                 {
                     writer3.WriteDepth(presenter, depth, onClick);
                 }
                 else
                 {
                     Console.Write(presenter);
                 }
                 return(o);
             }
             if (writer3 != null)
             {
                 writer3.WriteLineDepth(o, depth, onClick);
             }
             else
             {
                 Console.WriteLine(o);
             }
         }
         finally
         {
             if (flag2)
             {
                 ObjectNode.ExpandTypes = false;
             }
         }
     }
     return(o);
 }