public CommandContextBuilder <TSource> WithNode(CommandNode <TSource> node, StringRange range)
 {
     Nodes.Add(new ParsedCommandNode <TSource>(node, range));
     Range     = StringRange.Encompassing(Range, range);
     _modifier = node.RedirectModifier;
     _forks    = node.IsFork;
     return(this);
 }
 public CommandContextBuilder(CommandDispatcher <TSource> dispatcher, TSource source, CommandNode <TSource> rootNode, StringRange range, IDictionary <string, IParsedArgument> arguments, List <ParsedCommandNode <TSource> > nodes)
 {
     Dispatcher = dispatcher;
     Source     = source;
     RootNode   = rootNode;
     Range      = range;
     _arguments = new Dictionary <string, IParsedArgument>(arguments);
     Nodes      = new List <ParsedCommandNode <TSource> >(nodes);
 }
 public CommandContextBuilder(CommandDispatcher <TSource> dispatcher, TSource source, CommandNode <TSource> rootNode, int start)
 {
     RootNode   = rootNode;
     Dispatcher = dispatcher;
     Source     = source;
     Range      = StringRange.At(start);
     _arguments = new Dictionary <string, IParsedArgument>();
     Nodes      = new List <ParsedCommandNode <TSource> >();
 }
Example #4
0
 public CommandContext(TSource source, string input, IDictionary <string, IParsedArgument> arguments, Command <TSource> command, CommandNode <TSource> rootNode, List <ParsedCommandNode <TSource> > nodes, StringRange range, CommandContext <TSource> child, RedirectModifier <TSource> modifier, bool forks)
 {
     Source           = source;
     Input            = input;
     _arguments       = arguments;
     Command          = command;
     RootNode         = rootNode;
     Nodes            = nodes;
     Range            = range;
     Child            = child;
     RedirectModifier = modifier;
     _forks           = forks;
 }
Example #5
0
 public ParsedArgument(int start, int end, T result)
 {
     Range   = StringRange.Between(start, end);
     _result = result;
 }
Example #6
0
 public static StringRange Encompassing(StringRange a, StringRange b)
 {
     return(new StringRange(Math.Min(a.Start, b.Start), Math.Max(a.End, b.End)));
 }
Example #7
0
 public ParsedCommandNode(CommandNode <TSource> node, StringRange range)
 {
     Node  = node;
     Range = range;
 }
 public bool Equals(StringRange other)
 {
     return(Equals(Start, other.Start) && Equals(End, other.End));
 }