本文整理汇总了C#中Tree.Node.isSymbol方法的典型用法代码示例。如果您正苦于以下问题:C# Node.isSymbol方法的具体用法?C# Node.isSymbol怎么用?C# Node.isSymbol使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tree.Node
的用法示例。
在下文中一共展示了Node.isSymbol方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: apply2
private Node apply2(Node arg1, Node arg2)
{
string name = this.symbol.getName();
bool flag = name.Equals("eq?");
Node result;
if (flag)
{
bool flag2 = arg1.isSymbol() && arg2.isSymbol();
if (flag2)
{
string name2 = arg1.getName();
string name3 = arg2.getName();
result = BoolLit.getInstance(name2.Equals(name3));
}
else
{
result = BoolLit.getInstance(arg1 == arg2);
}
}
else
{
bool flag3 = name.Equals("cons");
if (flag3)
{
result = new Cons(arg1, arg2);
}
else
{
bool flag4 = name.Equals("set-car!");
if (flag4)
{
arg1.setCar(arg2);
result = Unspecific.getInstance();
}
else
{
bool flag5 = name.Equals("set-cdr!");
if (flag5)
{
arg1.setCdr(arg2);
result = Unspecific.getInstance();
}
else
{
bool flag6 = name.Equals("eval");
if (flag6)
{
bool flag7 = arg2.isEnvironment();
if (flag7)
{
result = arg1.eval((Environment)arg2);
}
else
{
Console.Error.WriteLine("Error: wrong type of argument");
result = Nil.getInstance();
}
}
else
{
bool flag8 = name.Equals("apply");
if (flag8)
{
result = arg1.apply(arg2);
}
else
{
bool flag9 = name[0] == 'b' && name.Length == 2;
if (flag9)
{
bool flag10 = arg1.isNumber() && arg2.isNumber();
if (flag10)
{
result = this.apply2(arg1.getIntVal(), arg2.getIntVal());
}
else
{
Console.Error.WriteLine("Error: invalid arguments");
result = Nil.getInstance();
}
}
else
{
Console.Error.WriteLine("Error: wrong number of arguments");
result = Nil.getInstance();
}
}
}
}
}
}
}
return result;
}
示例2: checkSymbols
//check if valid statement
private bool checkSymbols(Node parms)
{
return parms.isNull() || parms.isSymbol() || (parms.isPair() && parms.getCar().isSymbol() && this.checkSymbols(parms.getCdr()));
}
示例3: 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();
//.........这里部分代码省略.........
示例4: pairup
//Function for pairing up arguments with corresponding symbols
private static void pairup(Node parms, Node args, Environment env)
{
//if null return nothing
if (parms.isNull() && args.isNull())
{
return;
}
//check the symbol type
if (parms.isSymbol())
{
env.define(parms, args);
}
//depending on the parameter, check the # of required valid arguments
else if (parms.isNull() || args.isNull())
{
Console.get_Error().WriteLine("Error: wrong number of arguments");
}
//look for values in different env w/ closure pointer? idk how to explain this
else if (parms.isPair() && args.isPair())
{
env.define(parms.getCar(), args.getCar());
Closure.pairup(parms.getCdr(), args.getCdr(), env);
}
else
{
Console.get_Error().WriteLine("Error: invalid expression");
}
}