Docs formatting cleanup for consistency
This commit is contained in:
parent
1b4531e616
commit
313b68d8dd
|
@ -5,5 +5,6 @@ identifier_name:
|
|||
excluded:
|
||||
- cr
|
||||
- ln
|
||||
- no
|
||||
nesting:
|
||||
type_level: 2
|
||||
|
|
|
@ -22,8 +22,8 @@ public class YAMLEncoder {
|
|||
|
||||
/// Encode a value of type `T` to a YAML string.
|
||||
///
|
||||
/// - value: Value to encode.
|
||||
/// - userInfo: Additional key/values which can be used when looking up keys to encode.
|
||||
/// - parameter value: Value to encode.
|
||||
/// - parameter userInfo: Additional key/values which can be used when looking up keys to encode.
|
||||
///
|
||||
/// - returns: The YAML string.
|
||||
///
|
||||
|
|
|
@ -14,12 +14,13 @@ import Foundation
|
|||
/// Parse all YAML documents in a String
|
||||
/// and produce corresponding Swift objects.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - yaml: String
|
||||
/// - resolver: Resolver
|
||||
/// - constructor: Constructor
|
||||
/// - parameter yaml: String
|
||||
/// - parameter resolver: Resolver
|
||||
/// - parameter constructor: Constructor
|
||||
///
|
||||
/// - returns: YamlSequence<Any>
|
||||
/// - Throws: YamlError
|
||||
///
|
||||
/// - throws: YamlError
|
||||
public func load_all(yaml: String,
|
||||
_ resolver: Resolver = .default,
|
||||
_ constructor: Constructor = .default) throws -> YamlSequence<Any> {
|
||||
|
@ -30,12 +31,13 @@ public func load_all(yaml: String,
|
|||
/// Parse the first YAML document in a String
|
||||
/// and produce the corresponding Swift object.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - yaml: String
|
||||
/// - resolver: Resolver
|
||||
/// - constructor: Constructor
|
||||
/// - parameter yaml: String
|
||||
/// - parameter resolver: Resolver
|
||||
/// - parameter constructor: Constructor
|
||||
///
|
||||
/// - returns: Any?
|
||||
/// - Throws: YamlError
|
||||
///
|
||||
/// - throws: YamlError
|
||||
public func load(yaml: String,
|
||||
_ resolver: Resolver = .default,
|
||||
_ constructor: Constructor = .default) throws -> Any? {
|
||||
|
@ -45,12 +47,13 @@ public func load(yaml: String,
|
|||
/// Parse all YAML documents in a String
|
||||
/// and produce corresponding representation trees.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - yaml: String
|
||||
/// - resolver: Resolver
|
||||
/// - constructor: Constructor
|
||||
/// - parameter yaml: String
|
||||
/// - parameter resolver: Resolver
|
||||
/// - parameter constructor: Constructor
|
||||
///
|
||||
/// - returns: YamlSequence<Node>
|
||||
/// - Throws: YamlError
|
||||
///
|
||||
/// - throws: YamlError
|
||||
public func compose_all(yaml: String,
|
||||
_ resolver: Resolver = .default,
|
||||
_ constructor: Constructor = .default) throws -> YamlSequence<Node> {
|
||||
|
@ -61,12 +64,13 @@ public func compose_all(yaml: String,
|
|||
/// Parse the first YAML document in a String
|
||||
/// and produce the corresponding representation tree.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - yaml: String
|
||||
/// - resolver: Resolver
|
||||
/// - constructor: Constructor
|
||||
/// - parameter yaml: String
|
||||
/// - parameter resolver: Resolver
|
||||
/// - parameter constructor: Constructor
|
||||
///
|
||||
/// - returns: Node?
|
||||
/// - Throws: YamlError
|
||||
///
|
||||
/// - throws: YamlError
|
||||
public func compose(yaml: String,
|
||||
_ resolver: Resolver = .default,
|
||||
_ constructor: Constructor = .default) throws -> Node? {
|
||||
|
|
|
@ -13,8 +13,9 @@ extension String {
|
|||
|
||||
/// line number, column and contents at utf8 offset.
|
||||
///
|
||||
/// - Parameter offset: Int
|
||||
/// - Returns: lineNumber: line number start from 0,
|
||||
/// - parameter offset: Int
|
||||
///
|
||||
/// - returns: lineNumber: line number start from 0,
|
||||
/// column: utf16 column start from 0,
|
||||
/// contents: substring of line
|
||||
func utf8LineNumberColumnAndContents(at offset: Int) -> LineNumberColumnAndContents? {
|
||||
|
@ -26,8 +27,9 @@ extension String {
|
|||
|
||||
/// line number, column and contents at utf16 offset.
|
||||
///
|
||||
/// - Parameter offset: Int
|
||||
/// - Returns: lineNumber: line number start from 0,
|
||||
/// - parameter offset: Int
|
||||
///
|
||||
/// - returns: lineNumber: line number start from 0,
|
||||
/// column: utf16 column start from 0,
|
||||
/// contents: substring of line
|
||||
func utf16LineNumberColumnAndContents(at offset: Int) -> LineNumberColumnAndContents? {
|
||||
|
@ -39,8 +41,9 @@ extension String {
|
|||
|
||||
/// line number, column and contents at Index.
|
||||
///
|
||||
/// - Parameter index: String.Index
|
||||
/// - Returns: lineNumber: line number start from 0,
|
||||
/// - parameter index: String.Index
|
||||
///
|
||||
/// - returns: lineNumber: line number start from 0,
|
||||
/// column: utf16 column start from 0,
|
||||
/// contents: substring of line
|
||||
func lineNumberColumnAndContents(at index: Index) -> LineNumberColumnAndContents {
|
||||
|
@ -66,8 +69,9 @@ extension String {
|
|||
|
||||
/// substring indicated by line number.
|
||||
///
|
||||
/// - Parameter line: line number starts from 0.
|
||||
/// - Returns: substring of line contains line ending characters
|
||||
/// - parameter line: line number starts from 0.
|
||||
///
|
||||
/// - returns: substring of line contains line ending characters
|
||||
func substring(at line: Int) -> String {
|
||||
var number = 0
|
||||
var outStartIndex = startIndex, outEndIndex = startIndex, outContentsEndIndex = startIndex
|
||||
|
|
|
@ -16,63 +16,65 @@ public enum YamlError: Swift.Error {
|
|||
// Used in `yaml_emitter_t` and `yaml_parser_t`
|
||||
/// `YAML_NO_ERROR`. No error is produced.
|
||||
case no
|
||||
// swiftlint:disable:previous identifier_name
|
||||
|
||||
/// `YAML_MEMORY_ERROR`. Cannot allocate or reallocate a block of memory.
|
||||
case memory
|
||||
|
||||
// Used in `yaml_parser_t`
|
||||
/// `YAML_READER_ERROR`. Cannot read or decode the input stream.
|
||||
/// - Parameters:
|
||||
/// - problem: Error description.
|
||||
/// - byteOffset: The byte about which the problem occured.
|
||||
/// - value: The problematic value (-1 is none).
|
||||
/// - yaml: YAML String which the problem occured while reading.
|
||||
///
|
||||
/// - parameter problem: Error description.
|
||||
/// - parameter byteOffset: The byte about which the problem occured.
|
||||
/// - parameter value: The problematic value (-1 is none).
|
||||
/// - parameter yaml: YAML String which the problem occured while reading.
|
||||
case reader(problem: String, byteOffset: Int, value: Int32, yaml: String)
|
||||
|
||||
// line and column start from 1, column is counted by unicodeScalars
|
||||
/// `YAML_SCANNER_ERROR`. Cannot scan the input stream.
|
||||
/// - Parameters:
|
||||
/// - context: Error context.
|
||||
/// - problem: Error description.
|
||||
/// - mark: Problem position.
|
||||
/// - yaml: YAML String which the problem occured while scanning.
|
||||
///
|
||||
/// - parameter context: Error context.
|
||||
/// - parameter problem: Error description.
|
||||
/// - parameter mark: Problem position.
|
||||
/// - parameter yaml: YAML String which the problem occured while scanning.
|
||||
case scanner(context: Context?, problem: String, Mark, yaml: String)
|
||||
|
||||
/// `YAML_PARSER_ERROR`. Cannot parse the input stream.
|
||||
/// - Parameters:
|
||||
/// - context: Error context.
|
||||
/// - problem: Error description.
|
||||
/// - mark: Problem position.
|
||||
/// - yaml: YAML String which the problem occured while parsing.
|
||||
///
|
||||
/// - parameter context: Error context.
|
||||
/// - parameter problem: Error description.
|
||||
/// - parameter mark: Problem position.
|
||||
/// - parameter yaml: YAML String which the problem occured while parsing.
|
||||
case parser(context: Context?, problem: String, Mark, yaml: String)
|
||||
|
||||
/// `YAML_COMPOSER_ERROR`. Cannot compose a YAML document.
|
||||
/// - Parameters:
|
||||
/// - context: Error context.
|
||||
/// - problem: Error description.
|
||||
/// - mark: Problem position.
|
||||
/// - yaml: YAML String which the problem occured while composing.
|
||||
///
|
||||
/// - parameter context: Error context.
|
||||
/// - parameter problem: Error description.
|
||||
/// - parameter mark: Problem position.
|
||||
/// - parameter yaml: YAML String which the problem occured while composing.
|
||||
case composer(context: Context?, problem: String, Mark, yaml: String)
|
||||
|
||||
// Used in `yaml_emitter_t`
|
||||
/// `YAML_WRITER_ERROR`. Cannot write to the output stream.
|
||||
/// - Parameter problem: Error description.
|
||||
///
|
||||
/// - parameter problem: Error description.
|
||||
case writer(problem: String)
|
||||
|
||||
/// `YAML_EMITTER_ERROR`. Cannot emit a YAML stream.
|
||||
/// - Parameter problem: Error description.
|
||||
///
|
||||
/// - parameter problem: Error description.
|
||||
case emitter(problem: String)
|
||||
|
||||
/// Used in `NodeRepresentable`
|
||||
/// - Parameter problem: Error description.
|
||||
/// Used in `NodeRepresentable`.
|
||||
///
|
||||
/// - parameter problem: Error description.
|
||||
case representer(problem: String)
|
||||
|
||||
/// The error context
|
||||
/// The error context.
|
||||
public struct Context: CustomStringConvertible {
|
||||
/// context text
|
||||
/// Context text.
|
||||
public let text: String
|
||||
/// context position
|
||||
/// Context position.
|
||||
public let mark: Mark
|
||||
/// A textual representation of this instance.
|
||||
public var description: String {
|
||||
|
|
|
@ -35,16 +35,16 @@ func timestamp(_ timeZoneHour: Int = 0,
|
|||
|
||||
/// AssertEqual for Any
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - lhs: Any
|
||||
/// - rhs: Any
|
||||
/// - context: Closure generating String that used on generating assertion
|
||||
/// - file: file path string
|
||||
/// - line: line number
|
||||
/// - Returns: true if lhs is equal to rhs
|
||||
/// - parameter lhs: Any
|
||||
/// - parameter rhs: Any
|
||||
/// - parameter context: Closure generating String that used on generating assertion
|
||||
/// - parameter file: file path string
|
||||
/// - parameter line: line number
|
||||
///
|
||||
/// - returns: true if lhs is equal to rhs
|
||||
|
||||
@discardableResult func YamsAssertEqual(_ lhs: Any?, _ rhs: Any?,
|
||||
// swiftlint:disable:previous function_body_length identifier_name
|
||||
// swiftlint:disable:previous function_body_length
|
||||
_ context: @autoclosure @escaping () -> String = "",
|
||||
file: StaticString = #file, line: UInt = #line) -> Bool {
|
||||
// use inner function for capturing `file` and `line`
|
||||
|
|
Loading…
Reference in New Issue