/// <summary>
        /// Creates a command parser for a <see cref="CommandSymbol"/>
        /// </summary>
        private static Parser <LexicalToken, Command> CreateCommandParser(
            CommandSymbol symbol,
            Parser <char, Parser <LexicalToken, SyntaxElement> > commandGrammarParser)
        {
            Parser <LexicalToken, Command> commandParser = null;

            try
            {
                var result       = commandGrammarParser.Parse(symbol.Grammar);
                var customParser = result.Value;

                if (result.Length != symbol.Grammar.Length)
                {
                    Ensure.IsTrue(result.Length == symbol.Grammar.Length, $"control command grammar {symbol.Name} failed to parse fully at offset ({result.Length}): {symbol.Grammar}");
                }

                if (customParser != null)
                {
                    commandParser = Rule(
                        Token(SyntaxKind.DotToken),
                        customParser,
                        (dot, custom) => (Command) new CustomCommand(symbol.Name, dot, custom))
                                    .WithTag($"<{symbol.Name}>");
                }
            }
            finally
            {
            }

#if DEBUG
            if (commandParser == null)
            {
                throw new InvalidOperationException($"invalid command grammar: {symbol.Grammar}");
            }
#endif

            Ensure.NotNull(commandParser, $"invalid command grammar: {symbol.Grammar}");
            commandParser = commandParser ?? Match(t => false, lt => (Command)null);

            return(commandParser);
        }
 /// <summary>
 /// Gets the parser for the command.
 /// </summary>
 public Parser <LexicalToken, Command> GetCommandParser(CommandSymbol command)
 {
     this.commandToParserMap.TryGetValue(command, out var parser);
     return(parser);
 }