Example #1
0
        internal AdjustSpacesOperation(int space, AdjustSpacesOption option)
        {
            Contract.ThrowIfFalse(space >= 0);

            this.Space = space;
            this.Option = option;
        }
        /// <summary>
        /// instruct the engine to try to put the given spaces between two tokens
        /// </summary>
        public static AdjustSpacesOperation CreateAdjustSpacesOperation(int space, AdjustSpacesOption option)
        {
            if (space == 1 && option == AdjustSpacesOption.DefaultSpacesIfOnSingleLine)
            {
                return DefaultOneSpaceIfOnSingleLine;
            }
            else if (space == 0 && option == AdjustSpacesOption.ForceSpacesIfOnSingleLine)
            {
                return ForceZeroSpaceIfOnSingleLine;
            }
            else if (space == 1 && option == AdjustSpacesOption.ForceSpacesIfOnSingleLine)
            {
                return ForceOneSpaceIfOnSingleLine;
            }
            else if (space == 1 && option == AdjustSpacesOption.ForceSpaces)
            {
                return ForceZeroLineUsingSpaceForce;
            }

            return new AdjustSpacesOperation(space, option);
        }
Example #3
0
 private AdjustSpacesOperation AdjustSpacesOperationZeroOrOne(OptionSet optionSet, Option<bool> option, AdjustSpacesOption explicitOption = AdjustSpacesOption.ForceSpacesIfOnSingleLine)
 {
     if (optionSet.GetOption(option))
     {
         return CreateAdjustSpacesOperation(1, explicitOption);
     }
     else
     {
         return CreateAdjustSpacesOperation(0, explicitOption);
     }
 }
Example #4
0
 protected AdjustSpacesOperation CreateAdjustSpacesOperation(int space, AdjustSpacesOption option)
 {
     return FormattingOperations.CreateAdjustSpacesOperation(space, option);
 }