public static Node Make(Token token, Node parent) { int id; if (int.TryParse(token.Head, out id)) { return Terminal.MakeNewTerminal(id, parent); } else { string f = token.Head.ToUpper(); var t = token.Tokens; if (f == "AND") { return FunctionAnd.Make(t[0], t[1], parent); } else if (f == "OR") { return FunctionOr.Make(t[0], t[1], parent); } else if (f == "NOT") { return FunctionNot.Make(t[0], parent); } else { throw new Exception(string.Format("Invalid token head: {0}", f)); } } }
private FunctionOr(Token left, Token right, Node parent) { _parent = parent; _left = NodeFactory.Make(left, this); _right = NodeFactory.Make(right, this); }
public static Node Make(string s, Node parent) { var token = new Token(s); return Make(token, parent); }
internal static Node Make(Token left, Token right, Node parent) { return new FunctionOr(left,right, parent); }
private FunctionNot(Token token, Node parent) { _parent = parent; _node = NodeFactory.Make(token, this); }
internal static Node Make(Token token, Node parent) { return new FunctionNot(token, parent); }