/// <summary> /// Returns the kind of leading character that appears most in the document between tabs and spaces. /// If they are exactly tied, this will pick the default value. /// </summary> public LineLeadingCharacter GetLeadingWhitespaceCharacter(LineLeadingCharacter defaultValue) { if (_tab > _space) { return(LineLeadingCharacter.Tab); } else if (_space > _tab) { return(LineLeadingCharacter.Space); } else { return(defaultValue); } }
/// <summary> /// Increments the count for a leading character by the provided number /// </summary> /// <param name="leadingCharacter">Leading character to be adjusted</param> /// <param name="count">May be any positive or negative value</param> public void Increment(LineLeadingCharacter leadingCharacter, int count) { switch (leadingCharacter) { case LineLeadingCharacter.Tab: _tab += count; break; case LineLeadingCharacter.Space: _space += count; break; case LineLeadingCharacter.Printable: _printable += count; break; case LineLeadingCharacter.Empty: _empty += count; break; default: throw new ArgumentException($"Unknown leading whitespace value {leadingCharacter}", nameof(leadingCharacter)); } }