當前位置: 首頁>>代碼示例>>C#>>正文


C# Node.getStringVal方法代碼示例

本文整理匯總了C#中Tree.Node.getStringVal方法的典型用法代碼示例。如果您正苦於以下問題:C# Node.getStringVal方法的具體用法?C# Node.getStringVal怎麽用?C# Node.getStringVal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Tree.Node的用法示例。


在下文中一共展示了Node.getStringVal方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: apply1

 //if arg's length = 1
 private Node apply1(Node arg1)
 {
     string name = this.symbol.getName();
     bool flag = name.Equals("car");
     Node result;
     if (flag)
     {
         result = arg1.getCar();
     }//end if
     else
     {
         bool flag2 = name.Equals("cdr");
         if (flag2)
         {
             result = arg1.getCdr();
         }//end if
         else
         {
             bool flag3 = name.Equals("number?");
             if (flag3)
             {
                 result = BoolLit.getInstance(arg1.isNumber());
             }//end if
             else
             {
                 bool flag4 = name.Equals("symbol?");
                 if (flag4)
                 {
                     result = BoolLit.getInstance(arg1.isSymbol());
                 }//end if
                 else
                 {
                     bool flag5 = name.Equals("null?");
                     if (flag5)
                     {
                         result = BoolLit.getInstance(arg1.isNull());
                     }//end if
                     else
                     {
                         bool flag6 = name.Equals("pair?");
                         if (flag6)
                         {
                             result = BoolLit.getInstance(arg1.isPair());
                         }//end if
                         else
                         {
                             bool flag7 = name.Equals("procedure?");
                             if (flag7)
                             {
                                 result = BoolLit.getInstance(arg1.isProcedure());
                             }//end if
                             else
                             {
                                 bool flag8 = name.Equals("write");// i am not sure if im handling this correctly
                                 if (flag8)
                                 {
                                     arg1.print(-1);
                                     result = Unspecific.getInstance();
                                 }//end if
                                 else
                                 {
                                     bool flag9 = name.Equals("display"); // i am not sure if im handling this correctly
                                     if (flag9)
                                     {
                                         StringLit.printDoubleQuotes = false;
                                         arg1.print(-1);
                                         StringLit.printDoubleQuotes = true;
                                         result = Unspecific.getInstance();
                                     }//end if
                                     else
                                     {
                                         bool flag10 = name.Equals("load");
                                         if (flag10)
                                         {
                                             bool flag11 = !arg1.isString();
                                             if (flag11)
                                             {
                                                 Console.Error.WriteLine("Error: wrong type of argument");
                                                 result = Nil.getInstance();
                                             }
                                             else
                                             {
                                                 string stringVal = arg1.getStringVal();
                                                 try
                                                 {
                                                     //not sure why it has to be Parse.Scanner to call this
                                                     Parse.Scanner s = new Parse.Scanner(File.OpenText(stringVal));
                                                     TreeBuilder b = new TreeBuilder();
                                                     Parse.Parser parser = new Parse.Parser(s, b);
                                                     for (Node node = (Node)parser.parseExp(); node != null; node = (Node)parser.parseExp())
                                                     {
                                                         node.eval(Scheme4101.env);
                                                     }
                                                 }
                                                 catch (SystemException)
                                                 {
                                                     Console.Error.WriteLine("Could not find file " + stringVal);
                                                 }
                                                 result = Unspecific.getInstance();
//.........這裏部分代碼省略.........
開發者ID:Profitlol,項目名稱:prog2-baum,代碼行數:101,代碼來源:BuiltIn.cs


注:本文中的Tree.Node.getStringVal方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。