Пример #1
0
        public void Register(string head, params CommandNode <TEnv>[] nodes)
        {
            CommandNode <TEnv> n = PresetNodes.Literal <TEnv>(head);

            foreach (CommandNode <TEnv> node in nodes)
            {
                n.AddChild(node);
            }
            commands[head] = n;
        }
Пример #2
0
 public void AddChild(CommandNode <TEnv> node)
 {
     string[] certain = node.Parser.Certain;
     if (certain != null && certain.Length > 0)
     {
         foreach (string c in certain)
         {
             certainChuldren.Add(c, node);
         }
     }
     else
     {
         children.Add(node);
     }
 }
Пример #3
0
 public bool TryGetCommand(string head, out CommandNode <TEnv> cmd)
 {
     return(certainChildren.TryGetValue(head, out cmd));
 }
Пример #4
0
 public CommandNode <TEnv> Rest(CommandNode <TEnv> node)
 {
     node.Spread = true;
     AddChild(node);
     return(this);
 }
Пример #5
0
 public CommandNode <TEnv> Next(CommandNode <TEnv> node)
 {
     AddChild(node);
     return(node);
 }
Пример #6
0
 public CommandNode <TEnv> Then(CommandNode <TEnv> node)
 {
     AddChild(node);
     return(this);
 }