public CatExpr NodesToFxns(string name, List <CatAstNode> nodes) { CatExpr result = new CatExpr(); for (int i = 0; i < nodes.Count; ++i) { CatAstNode node = nodes[i]; if (node.GetLabel().Equals(AstLabel.Name)) { string s = node.ToString(); if (s.Equals(name)) { result.Add(new SelfFunction(name)); } else { result.Add(ThrowingLookup(s)); } } else if (node is AstLiteral) { result.Add(LiteralToFunction(name, node as AstLiteral)); } else if (node is AstDef) { MakeFunction(node as AstDef); } else if (node is AstMacro) { MetaCat.AddMacro(node as AstMacro); } else { throw new Exception("unable to convert node to function: " + node.ToString()); } } return(result); }
public static bool TermEquals(CatAstNode term, string var) { return(term.ToString().Equals(var)); }
public static bool TermEquals(CatAstNode term, string var) { return term.ToString().Equals(var); }