Esempio n. 1
0
        private static ParsingResult ParseSimpleCommandBody(string line, ICommand command, out string remainder)
        {
            var result     = new ParsingResult();
            var bodyResult = TryCommandBody(line, command.Name());

            remainder = "";

            if (bodyResult.WasSuccessful == false)
            {
                result.Type = ParsingResultType.WrongCommand;
                return(result);
            }

            remainder = line.Substring(bodyResult.Remainder.Position).TrimEnd();

            if (bodyResult.Remainder.AtEnd || remainder.Length <= 0)
            {
                result.Type = ParsingResultType.SuccessReachedEnd;
                return(result);
            }

            result.Type = ParsingResultType.Success;
            return(result);
        }