Example #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;
        }
Example #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);
     }
 }
Example #3
0
 public bool TryGetCommand(string head, out CommandNode <TEnv> cmd)
 {
     return(certainChildren.TryGetValue(head, out cmd));
 }
Example #4
0
 public CommandNode <TEnv> Rest(CommandNode <TEnv> node)
 {
     node.Spread = true;
     AddChild(node);
     return(this);
 }
Example #5
0
 public CommandNode <TEnv> Next(CommandNode <TEnv> node)
 {
     AddChild(node);
     return(node);
 }
Example #6
0
 public CommandNode <TEnv> Then(CommandNode <TEnv> node)
 {
     AddChild(node);
     return(this);
 }