Пример #1
0
        private void ParseCommandChildren(CommandNode parent)
        {
            while (More())
            {
                if (CurrentToken.Type == TokenType.EndOfArguments)
                {
                    return;
                }

                var child =
                    ParseSubcommand(parent)
                    ?? (SyntaxNode?)ParseOption(parent)
                    ?? ParseCommandArgument(parent);

                if (child is null)
                {
                    UnmatchedTokens.Add(CurrentToken);
                    Advance();
                }
                else
                {
                    parent.AddChildNode(child);
                }
            }
        }
Пример #2
0
        private void ParseRemainingTokens()
        {
            var foundEndOfArguments = false;

            while (More())
            {
                if (CurrentToken.Type == TokenType.EndOfArguments)
                {
                    foundEndOfArguments = true;
                }
                else if (foundEndOfArguments)
                {
                    UnparsedTokens.Add(CurrentToken);
                }
                else
                {
                    UnmatchedTokens.Add(CurrentToken);
                }

                Advance();
            }
        }