ObjCSelectorPieceListSyntax
SyntaxCollections.swift:957struct ObjCSelectorPieceListSyntax
struct ObjCSelectorPieceListSyntax
import SwiftSyntax
A library for working with Swift code.
struct ObjCSelectorPieceSyntax
A piece of an Objective-C selector. Either consisting of just an identifier for a nullary selector, an identifier and a colon for a labeled argument or just a colon for an unlabeled argument
struct AttributeSyntax
An @
attribute.
var arguments: Arguments? { get set }
The arguments of the attribute.
struct AttributeListSyntax
A list of attributes that can be attached to a declaration.
struct BackDeployedAttributeArgumentsSyntax
A collection of arguments for the @backDeployed
attribute
struct ConventionAttributeArgumentsSyntax
The arguments for the ‘@convention(…)’.
struct ConventionWitnessMethodAttributeArgumentsSyntax
The arguments for the ‘@convention(witness_method: …)’.
struct DerivativeAttributeArgumentsSyntax
The arguments for the ‘@derivative(of:)’ and ‘@transpose(of:)’ attributes: the ‘of:’ label, the original declaration name, and an optional differentiability parameter list.
struct DifferentiabilityArgumentListSyntax
struct DifferentiabilityArgumentSyntax
A differentiability argument: either the “self” identifier, a function parameter name, or a function parameter index.
struct DifferentiabilityArgumentsSyntax
The differentiability arguments.
struct DifferentiabilityWithRespectToArgumentSyntax
A clause containing differentiability parameters.
struct DifferentiableAttributeArgumentsSyntax
The arguments for the @differentiable
attribute: an optional differentiability kind, an optional differentiability parameter clause, and an optional ‘where’ clause.
struct DocumentationAttributeArgumentListSyntax
The arguments of the ‘@_documentation’ attribute
struct DocumentationAttributeArgumentSyntax
struct DynamicReplacementAttributeArgumentsSyntax
The arguments for the ‘@_dynamicReplacement’ attribute
struct EffectsAttributeArgumentListSyntax
The arguments of the ‘@_effects’ attribute. These will be parsed during the SIL stage.
struct ExposeAttributeArgumentsSyntax
The arguments for the ‘@_expose’ attribute
struct ImplementsAttributeArgumentsSyntax
The arguments for the @_implements
attribute of the form Type, methodName(arg1Label:arg2Label:)
struct LabeledSpecializeArgumentSyntax
A labeled argument for the @_specialize
attribute like exported: true
struct OpaqueReturnTypeOfAttributeArgumentsSyntax
The arguments for the ‘@_opaqueReturnTypeOf()’.
struct OriginallyDefinedInAttributeArgumentsSyntax
The arguments for the ‘@_originallyDefinedIn’ attribute
struct PlatformVersionItemListSyntax
struct PlatformVersionItemSyntax
A single platform/version pair in an attribute, e.g. iOS 10.1
.
struct SpecializeAttributeArgumentListSyntax
A collection of arguments for the @_specialize
attribute
struct SpecializeAvailabilityArgumentSyntax
The availability argument for the _specialize attribute
struct SpecializeTargetFunctionArgumentSyntax
A labeled argument for the @_specialize
attribute with a function decl value like target: myFunc(_:)
struct UnavailableFromAsyncAttributeArgumentsSyntax
The arguments for the ‘@_unavailableFromAsync’ attribute
struct UnderscorePrivateAttributeArgumentsSyntax
The arguments for the ‘@_private’ attribute
protocol BidirectionalCollection<Element> : Collection where Self.Indices : BidirectionalCollection, Self.SubSequence : BidirectionalCollection
A collection that supports backward as well as forward traversal.
protocol Collection<Element> : Sequence
A sequence whose elements can be traversed multiple times, nondestructively, and accessed by an indexed subscript.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol CustomReflectable
A type that explicitly supplies its own mirror.
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol ExpressibleByArrayLiteral
A type that can be initialized using an array literal.
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
protocol Sendable
protocol Sequence<Element>
A type that provides sequential, iterated access to its elements.
protocol SyntaxCollection : BidirectionalCollection, ExpressibleByArrayLiteral, SyntaxProtocol where Self.Element : SyntaxProtocol, Self.Index == SyntaxChildrenIndex
protocol SyntaxHashable : Hashable
Protocol that provides a common Hashable implementation for all syntax nodes
protocol SyntaxProtocol : CustomDebugStringConvertible, CustomReflectable, CustomStringConvertible, Sendable, TextOutputStreamable
Provide common functionality for specialized syntax nodes. Extend this protocol to provide common functionality for all syntax nodes.
protocol TextOutputStreamable
A source of text-streaming operations.
init?(_ node: some SyntaxProtocol)
static let syntaxKind: SyntaxKind
let _syntaxNode: Syntax
typealias Element = ObjCSelectorPieceSyntax
init<Children>(_ children: Children) where Children : Sequence, Self.Element == Children.Element
init?<S>(_ node: S?) where S : SyntaxProtocol
Initializes a new instance of the conforming type from a given specialized syntax node.
init(arrayLiteral elements: Element...)
static var structure: SyntaxNodeStructure { get }
var count: Int { get }
The number of elements, present
or missing
, in this collection.
var customMirror: Mirror { get }
var debugDescription: String { get }
A simple description of this node (ie. its type).
var description: String { get }
A source-accurate description of this node.
var detached: Self { get }
Return this subtree with this node as the root, ie. detach this node from its parent.
var endIndex: SyntaxChildrenIndex { get }
var endPosition: AbsolutePosition { get }
The end position of this node, including its trivia.
var endPositionBeforeTrailingTrivia: AbsolutePosition { get }
The end position of this node’s content, before any trailing trivia.
var first: Self.Element? { get }
The first element of the collection.
var hasError: Bool { get }
Whether the tree contained by this layout has any
var hasMaximumNestingLevelOverflow: Bool { get }
var hasParent: Bool { get }
Whether or not this node has a parent.
var hasSequenceExpr: Bool { get }
Whether this tree contains a missing token or unexpected node.
var hasWarning: Bool { get }
Whether the tree contained by this layout has any tokens with a TokenDiagnostic
of severity warning
.
var id: SyntaxIdentifier { get }
Returns a value representing the unique identity of the node.
var indices: DefaultIndices<Self> { get }
The indices that are valid for subscripting the collection, in ascending order.
var isEmpty: Bool { get }
A Boolean value indicating whether the collection is empty.
var keyPathInParent: AnyKeyPath? { get }
var kind: SyntaxKind { get }
The kind of the syntax node, e.g. if it is a functionDecl
.
var last: Self.Element? { get }
The last element of the collection.
var lazy: LazySequence<Self> { get }
A sequence containing the same elements as this sequence, but on which some operations, such as map
and filter
, are implemented lazily.
var leadingTrivia: Trivia { get set }
The leading trivia of this syntax node.
var leadingTriviaLength: SourceLength { get }
The length this node’s leading trivia takes up spelled out in source.
var parent: Syntax? { get }
The parent of this syntax node, or nil
if this node is the root.
var position: AbsolutePosition { get }
The absolute position of the starting point of this node. If the first token is with leading trivia, the position points to the start of the leading trivia.
var positionAfterSkippingLeadingTrivia: AbsolutePosition { get }
The absolute position of the starting point of this node, skipping any leading trivia attached to the first token syntax.
var raw: RawSyntax { get }
var root: Syntax { get }
The root of the tree in which this node resides.
var startIndex: SyntaxChildrenIndex { get }
var syntaxNodeType: SyntaxProtocol.Type { get }
The dynamic metatype of the concrete node.
var syntaxTextBytes: [UInt8] { get }
Retrieve the syntax text as an array of bytes that models the input source even in the presence of invalid UTF-8.
var totalByteRange: ByteSourceRange { get }
The byte source range of this node including leading and trailing trivia.
var totalLength: SourceLength { get }
The length of this node including all of its trivia.
var trailingTrivia: Trivia { get set }
The trailing trivia of this syntax node.
var trailingTriviaLength: SourceLength { get }
The length this node’s trailing trivia takes up spelled out in source.
var trimmed: Self { get }
A copy of this node without the leading trivia of the first token in the node and the trailing trivia of the last token in the node.
var trimmedByteRange: ByteSourceRange { get }
The byte source range of this node excluding leading and trailing trivia.
var trimmedDescription: String { get }
The description of this node with leading whitespace of the first token and trailing whitespace of the last token removed.
var trimmedLength: SourceLength { get }
The length this node takes up spelled out in the source, excluding its leading or trailing trivia.
var underestimatedCount: Int { get }
A value less than or equal to the number of elements in the collection.
subscript(position: SyntaxChildrenIndex) -> Element { get set }
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.
static func + (lhs: some Sequence<Element>, rhs: Self) -> Self
Creates a new collection by concatenating the elements of a sequence and a collection.
static func + (lhs: some RangeReplaceableCollection<Element>, rhs: Self) -> Self
Creates a new collection by concatenating the elements of a sequence and a collection.
static func + (lhs: Self, rhs: some Sequence<Element>) -> Self
Creates a new collection by concatenating the elements of a collection and a sequence.
static func + (lhs: Self, rhs: some RangeReplaceableCollection<Element>) -> Self
Creates a new collection by concatenating the elements of a collection and a sequence.
static func += (lhs: inout Self, rhs: some Sequence<Element>)
Appends the elements of a sequence to a range-replaceable collection.
static func == (lhs: Self, rhs: Self) -> Bool
func allSatisfy(_ predicate: (Self.Element) throws -> Bool) rethrows -> Bool
Returns a Boolean value indicating whether every element of a sequence satisfies a given predicate.
mutating func append(_ newElement: Element)
Adds an element to the end of the collection.
mutating func append(contentsOf newElements: some Sequence<Element>)
Adds the elements of a sequence to the end of this collection.
func `as`<S>(_ syntaxType: S.Type) -> S? where S : SyntaxProtocol
Attempts to cast the current syntax node to a given specialized syntax type.
func asProtocol(_: MissingNodeSyntax.Protocol) -> MissingNodeSyntax?
Return the non-type erased version of this syntax node if it conforms to MissingNodeSyntax
. Otherwise return nil
. Note that this will incur an existential conversion.
func asProtocol(_: ParenthesizedSyntax.Protocol) -> ParenthesizedSyntax?
Return the non-type erased version of this syntax node if it conforms to ParenthesizedSyntax
. Otherwise return nil
. Note that this will incur an existential conversion.
func asProtocol(_: WithCodeBlockSyntax.Protocol) -> WithCodeBlockSyntax?
Return the non-type erased version of this syntax node if it conforms to WithCodeBlockSyntax
. Otherwise return nil
. Note that this will incur an existential conversion.
func asProtocol(_: WithModifiersSyntax.Protocol) -> WithModifiersSyntax?
Return the non-type erased version of this syntax node if it conforms to WithModifiersSyntax
. Otherwise return nil
. Note that this will incur an existential conversion.
func asProtocol(_: WithAttributesSyntax.Protocol) -> WithAttributesSyntax?
Return the non-type erased version of this syntax node if it conforms to WithAttributesSyntax
. Otherwise return nil
. Note that this will incur an existential conversion.
func asProtocol(_: WithStatementsSyntax.Protocol) -> WithStatementsSyntax?
Return the non-type erased version of this syntax node if it conforms to WithStatementsSyntax
. Otherwise return nil
. Note that this will incur an existential conversion.
func asProtocol(_: EffectSpecifiersSyntax.Protocol) -> EffectSpecifiersSyntax?
Return the non-type erased version of this syntax node if it conforms to EffectSpecifiersSyntax
. Otherwise return nil
. Note that this will incur an existential conversion.
func asProtocol(_: WithTrailingCommaSyntax.Protocol) -> WithTrailingCommaSyntax?
Return the non-type erased version of this syntax node if it conforms to WithTrailingCommaSyntax
. Otherwise return nil
. Note that this will incur an existential conversion.
func asProtocol(_: WithGenericParametersSyntax.Protocol) -> WithGenericParametersSyntax?
Return the non-type erased version of this syntax node if it conforms to WithGenericParametersSyntax
. Otherwise return nil
. Note that this will incur an existential conversion.
func asProtocol(_: WithOptionalCodeBlockSyntax.Protocol) -> WithOptionalCodeBlockSyntax?
Return the non-type erased version of this syntax node if it conforms to WithOptionalCodeBlockSyntax
. Otherwise return nil
. Note that this will incur an existential conversion.
func asProtocol(_: FreestandingMacroExpansionSyntax.Protocol) -> FreestandingMacroExpansionSyntax?
Return the non-type erased version of this syntax node if it conforms to FreestandingMacroExpansionSyntax
. Otherwise return nil
. Note that this will incur an existential conversion.
func asProtocol(_: BracedSyntax.Protocol) -> BracedSyntax?
Return the non-type erased version of this syntax node if it conforms to BracedSyntax
. Otherwise return nil
. Note that this will incur an existential conversion.
func asProtocol(_: DeclGroupSyntax.Protocol) -> DeclGroupSyntax?
Return the non-type erased version of this syntax node if it conforms to DeclGroupSyntax
. Otherwise return nil
. Note that this will incur an existential conversion.
func asProtocol(_: NamedDeclSyntax.Protocol) -> NamedDeclSyntax?
Return the non-type erased version of this syntax node if it conforms to NamedDeclSyntax
. Otherwise return nil
. Note that this will incur an existential conversion.
func cast<S>(_ syntaxType: S.Type) -> S where S : SyntaxProtocol
Force-casts the current syntax node to a given specialized syntax type.
func children(viewMode: SyntaxTreeViewMode) -> SyntaxChildren
A sequence over the children of this node.
func compactMap<ElementOfResult>(_ transform: (Self.Element) throws -> ElementOfResult?) rethrows -> [ElementOfResult]
Returns an array containing the non-nil
results of calling the given transformation with each element of this sequence.
func contains(_ element: Self.Element) -> Bool
Returns a Boolean value indicating whether the sequence contains the given element.
func contains(where predicate: (Self.Element) throws -> Bool) rethrows -> Bool
Returns a Boolean value indicating whether the sequence contains an element that satisfies the given predicate.
func count<E>(where predicate: (Self.Element) throws(E) -> Bool) throws(E) -> Int where E : Error
Returns the number of elements in the sequence that satisfy the given predicate.
func debugDescription(includeTrivia: Bool = false, converter: SourceLocationConverter? = nil, mark: SyntaxProtocol? = nil, indentString: String = "") -> String
Returns a summarized dump of this node.
func difference<C>(from other: C) -> CollectionDifference<Self.Element> where C : BidirectionalCollection, Self.Element == C.Element
Returns the difference needed to produce this collection’s ordered elements from the given collection.
func difference<C>(from other: C, by areEquivalent: (C.Element, Self.Element) -> Bool) -> CollectionDifference<Self.Element> where C : BidirectionalCollection, Self.Element == C.Element
Returns the difference needed to produce this collection’s ordered elements from the given collection, using the given predicate as an equivalence test.
func distance(from start: SyntaxChildrenIndex, to end: SyntaxChildrenIndex) -> Int
func drop(while predicate: (Self.Element) throws -> Bool) rethrows -> Self.SubSequence
Returns a subsequence by skipping elements while predicate
returns true
and returning the remaining elements.
func dropFirst(_ k: Int = 1) -> Self.SubSequence
Returns a subsequence containing all but the given number of initial elements.
func dropLast(_ k: Int) -> Self.SubSequence
Returns a subsequence containing all but the specified number of final elements.
func elementsEqual<OtherSequence>(_ other: OtherSequence) -> Bool where OtherSequence : Sequence, Self.Element == OtherSequence.Element
Returns a Boolean value indicating whether this sequence and another sequence contain the same elements in the same order.
func elementsEqual<OtherSequence>(_ other: OtherSequence, by areEquivalent: (Self.Element, OtherSequence.Element) throws -> Bool) rethrows -> Bool where OtherSequence : Sequence
Returns a Boolean value indicating whether this sequence and another sequence contain equivalent elements in the same order, using the given predicate as the equivalence test.
func endLocation(converter: SourceLocationConverter, afterTrailingTrivia: Bool = false) -> SourceLocation
The ending location, in the provided file, of this Syntax node.
func enumerated() -> EnumeratedSequence<Self>
Returns a sequence of pairs (n, x), where n represents a consecutive integer starting at zero and x represents an element of the sequence.
func filter(_ isIncluded: (Element) throws -> Bool) rethrows -> Self
Returns a new SyntaxCollection
that just contains the elements satisfying the given predicate.
func first(where predicate: (Self.Element) throws -> Bool) rethrows -> Self.Element?
Returns the first element of the sequence that satisfies the given predicate.
func firstIndex(of element: Self.Element) -> Self.Index?
Returns the first index where the specified value appears in the collection.
func firstIndex(where predicate: (Self.Element) throws -> Bool) rethrows -> Self.Index?
Returns the first index in which an element of the collection satisfies the given predicate.
func firstRange<C>(of other: C) -> Range<Self.Index>? where C : Collection, Self.Element == C.Element
Finds and returns the range of the first occurrence of a given collection within this collection.
func firstToken(viewMode: SyntaxTreeViewMode) -> TokenSyntax?
Returns the first token node that is part of this syntax node.
func flatMap<SegmentOfResult>(_ transform: (Self.Element) throws -> SegmentOfResult) rethrows -> [SegmentOfResult.Element] where SegmentOfResult : Sequence
Returns an array containing the concatenated results of calling the given transformation with each element of this sequence.
func forEach(_ body: (Self.Element) throws -> Void) rethrows
Calls the given closure on each element in the sequence in the same order as a for
-in
loop.
func formIndex(_ i: inout Self.Index, offsetBy distance: Int)
Offsets the given index by the specified distance.
func formIndex(_ i: inout Self.Index, offsetBy distance: Int, limitedBy limit: Self.Index) -> Bool
Offsets the given index by the specified distance, or so that it equals the given limiting index.
func formIndex(after i: inout Self.Index)
Replaces the given index with its successor.
func formIndex(before i: inout Self.Index)
func hash(into hasher: inout Hasher)
func index(_ i: Self.Index, offsetBy distance: Int) -> Self.Index
func index(_ i: Self.Index, offsetBy distance: Int, limitedBy limit: Self.Index) -> Self.Index?
func index(after index: SyntaxChildrenIndex) -> SyntaxChildrenIndex
func index(at offset: Int) -> SyntaxChildrenIndex
Returns the index of the n-th element in this collection.
func index(before index: SyntaxChildrenIndex) -> SyntaxChildrenIndex
func index(of node: Element) -> SyntaxChildrenIndex?
Return the index of node
within this collection.
func indices(of element: Self.Element) -> RangeSet<Self.Index>
Returns the indices of all the elements that are equal to the given element.
func indices(where predicate: (Self.Element) throws -> Bool) rethrows -> RangeSet<Self.Index>
Returns the indices of all the elements that match the given predicate.
mutating func insert(_ newElement: Element, at i: Index)
Inserts a new element into the collection at the specified position.
mutating func insert(contentsOf newElements: some Collection<Element>, at i: Index)
Inserts the elements of a sequence into the collection at the specified position.
func `is`<S>(_ syntaxType: S.Type) -> Bool where S : SyntaxProtocol
Checks if the current syntax node can be cast to a given specialized syntax type.
func isProtocol(_: MissingNodeSyntax.Protocol) -> Bool
Check whether the non-type erased version of this syntax node conforms to MissingNodeSyntax
. Note that this will incur an existential conversion.
func isProtocol(_: ParenthesizedSyntax.Protocol) -> Bool
Check whether the non-type erased version of this syntax node conforms to ParenthesizedSyntax
. Note that this will incur an existential conversion.
func isProtocol(_: WithCodeBlockSyntax.Protocol) -> Bool
Check whether the non-type erased version of this syntax node conforms to WithCodeBlockSyntax
. Note that this will incur an existential conversion.
func isProtocol(_: WithModifiersSyntax.Protocol) -> Bool
Check whether the non-type erased version of this syntax node conforms to WithModifiersSyntax
. Note that this will incur an existential conversion.
func isProtocol(_: WithAttributesSyntax.Protocol) -> Bool
Check whether the non-type erased version of this syntax node conforms to WithAttributesSyntax
. Note that this will incur an existential conversion.
func isProtocol(_: WithStatementsSyntax.Protocol) -> Bool
Check whether the non-type erased version of this syntax node conforms to WithStatementsSyntax
. Note that this will incur an existential conversion.
func isProtocol(_: EffectSpecifiersSyntax.Protocol) -> Bool
Check whether the non-type erased version of this syntax node conforms to EffectSpecifiersSyntax
. Note that this will incur an existential conversion.
func isProtocol(_: WithTrailingCommaSyntax.Protocol) -> Bool
Check whether the non-type erased version of this syntax node conforms to WithTrailingCommaSyntax
. Note that this will incur an existential conversion.
func isProtocol(_: WithGenericParametersSyntax.Protocol) -> Bool
Check whether the non-type erased version of this syntax node conforms to WithGenericParametersSyntax
. Note that this will incur an existential conversion.
func isProtocol(_: WithOptionalCodeBlockSyntax.Protocol) -> Bool
Check whether the non-type erased version of this syntax node conforms to WithOptionalCodeBlockSyntax
. Note that this will incur an existential conversion.
func isProtocol(_: FreestandingMacroExpansionSyntax.Protocol) -> Bool
Check whether the non-type erased version of this syntax node conforms to FreestandingMacroExpansionSyntax
. Note that this will incur an existential conversion.
func isProtocol(_: BracedSyntax.Protocol) -> Bool
Check whether the non-type erased version of this syntax node conforms to BracedSyntax
. Note that this will incur an existential conversion.
func isProtocol(_: DeclGroupSyntax.Protocol) -> Bool
Check whether the non-type erased version of this syntax node conforms to DeclGroupSyntax
. Note that this will incur an existential conversion.
func isProtocol(_: NamedDeclSyntax.Protocol) -> Bool
Check whether the non-type erased version of this syntax node conforms to NamedDeclSyntax
. Note that this will incur an existential conversion.
func last(where predicate: (Self.Element) throws -> Bool) rethrows -> Self.Element?
Returns the last element of the sequence that satisfies the given predicate.
func lastIndex(of element: Self.Element) -> Self.Index?
Returns the last index where the specified value appears in the collection.
func lastIndex(where predicate: (Self.Element) throws -> Bool) rethrows -> Self.Index?
Returns the index of the last element in the collection that matches the given predicate.
func lastToken(viewMode: SyntaxTreeViewMode) -> TokenSyntax?
Returns the last token node that is part of this syntax node.
func lexicographicallyPrecedes<OtherSequence>(_ other: OtherSequence, by areInIncreasingOrder: (Self.Element, Self.Element) throws -> Bool) rethrows -> Bool where OtherSequence : Sequence, Self.Element == OtherSequence.Element
Returns a Boolean value indicating whether the sequence precedes another sequence in a lexicographical (dictionary) ordering, using the given predicate to compare elements.
func makeIterator() -> SyntaxCollectionIterator<Element>
func map<T, E>(_ transform: (Self.Element) throws(E) -> T) throws(E) -> [T] where E : Error
Returns an array containing the results of mapping the given closure over the sequence’s elements.
func map<T, E>(_ transform: (Self.Element) throws(E) -> T) throws(E) -> [T] where E : Error
Returns an array containing the results of mapping the given closure over the sequence’s elements.
@warn_unqualified_access func max(by areInIncreasingOrder: (Self.Element, Self.Element) throws -> Bool) rethrows -> Self.Element?
Returns the maximum element in the sequence, using the given predicate as the comparison between elements.
@warn_unqualified_access func min(by areInIncreasingOrder: (Self.Element, Self.Element) throws -> Bool) rethrows -> Self.Element?
Returns the minimum element in the sequence, using the given predicate as the comparison between elements.
func nextToken(viewMode: SyntaxTreeViewMode) -> TokenSyntax?
Recursively walks through the tree to find the next token semantically after this node.
func node(at syntaxIdentifier: SyntaxIdentifier) -> Syntax?
If the node with the given syntaxIdentifier
is a (recursive) child of this node, return the node with that identifier.
func prefix(_ maxLength: Int) -> Self.SubSequence
Returns a subsequence, up to the specified maximum length, containing the initial elements of the collection.
func prefix(through position: Self.Index) -> Self.SubSequence
Returns a subsequence from the start of the collection through the specified position.
func prefix(upTo end: Self.Index) -> Self.SubSequence
Returns a subsequence from the start of the collection up to, but not including, the specified position.
func prefix(while predicate: (Self.Element) throws -> Bool) rethrows -> Self.SubSequence
Returns a subsequence containing the initial elements until predicate
returns false
and skipping the remaining elements.
func previousToken(viewMode: SyntaxTreeViewMode) -> TokenSyntax?
Recursively walks through the tree to find the token semantically before this node.
func randomElement() -> Self.Element?
Returns a random element of the collection.
func randomElement<T>(using generator: inout T) -> Self.Element? where T : RandomNumberGenerator
Returns a random element of the collection, using the given generator as a source for randomness.
func ranges<C>(of other: C) -> [Range<Self.Index>] where C : Collection, Self.Element == C.Element
Finds and returns the ranges of the all occurrences of a given sequence within the collection.
func reduce<Result>(_ initialResult: Result, _ nextPartialResult: (Result, Self.Element) throws -> Result) rethrows -> Result
Returns the result of combining the elements of the sequence using the given closure.
func reduce<Result>(into initialResult: Result, _ updateAccumulatingResult: (inout Result, Self.Element) throws -> ()) rethrows -> Result
Returns the result of combining the elements of the sequence using the given closure.
@discardableResult mutating func remove(at position: Index) -> Element
Removes and returns the element at the specified position.
mutating func removeSubrange(_ bounds: Range<Index>)
Removes the elements in the specified subrange from the collection.
func removingSubranges(_ subranges: RangeSet<Self.Index>) -> DiscontiguousSlice<Self>
Returns a collection of the elements in this collection that are not represented by the given range set.
mutating func replaceSubrange(_ subrange: Range<Self.Index>, with newElements: some Collection<Element>)
Replace the nodes in subrange
by newElements
.
func reversed() -> ReversedCollection<Self>
Returns a view presenting the elements of the collection in reverse order.
func shuffled() -> [Self.Element]
Returns the elements of the sequence, shuffled.
func shuffled<T>(using generator: inout T) -> [Self.Element] where T : RandomNumberGenerator
Returns the elements of the sequence, shuffled using the given generator as a source for randomness.
func sorted(by areInIncreasingOrder: (Self.Element, Self.Element) throws -> Bool) rethrows -> [Self.Element]
Returns the elements of the sequence, sorted using the given predicate as the comparison between elements.
func sourceRange(converter: SourceLocationConverter, afterLeadingTrivia: Bool = true, afterTrailingTrivia: Bool = false) -> SourceRange
The source range, in the provided file, of this Syntax node.
func split(maxSplits: Int = Int.max, omittingEmptySubsequences: Bool = true, whereSeparator isSeparator: (Self.Element) throws -> Bool) rethrows -> [Self.SubSequence]
Returns the longest possible subsequences of the collection, in order, that don’t contain elements satisfying the given predicate.
func split(separator: Self.Element, maxSplits: Int = Int.max, omittingEmptySubsequences: Bool = true) -> [Self.SubSequence]
Returns the longest possible subsequences of the collection, in order, around elements equal to the given element.
func startLocation(converter: SourceLocationConverter, afterLeadingTrivia: Bool = true) -> SourceLocation
The starting location, in the provided file, of this Syntax node.
func starts<PossiblePrefix>(with possiblePrefix: PossiblePrefix) -> Bool where PossiblePrefix : Sequence, Self.Element == PossiblePrefix.Element
Returns a Boolean value indicating whether the initial elements of the sequence are the same as the elements in another sequence.
func starts<PossiblePrefix>(with possiblePrefix: PossiblePrefix, by areEquivalent: (Self.Element, PossiblePrefix.Element) throws -> Bool) rethrows -> Bool where PossiblePrefix : Sequence
Returns a Boolean value indicating whether the initial elements of the sequence are equivalent to the elements in another sequence, using the given predicate as the equivalence test.
func suffix(_ maxLength: Int) -> Self.SubSequence
Returns a subsequence, up to the given maximum length, containing the final elements of the collection.
func suffix(from start: Self.Index) -> Self.SubSequence
Returns a subsequence from the specified position to the end of the collection.
func token(at position: AbsolutePosition) -> TokenSyntax?
Find the syntax token at the given absolute position within this syntax node or any of its children.
func tokens(viewMode: SyntaxTreeViewMode) -> TokenSequence
Sequence of tokens that are part of this Syntax node.
func trimmed(matching filter: (TriviaPiece) -> Bool) -> Self
A copy of this node with pieces that match matching
trimmed from the leading trivia of the first token and trailing trivia of the last token.
func trimmedDescription(matching filter: (TriviaPiece) -> Bool) -> String
The description of this node with pieces that match matching
removed from the leading trivia of the first token and trailing trivia of the last token.
func trimmingPrefix<Prefix>(_ prefix: Prefix) -> Self.SubSequence where Prefix : Sequence, Self.Element == Prefix.Element
Returns a new collection of the same type by removing prefix
from the start of the collection.
func trimmingPrefix(while predicate: (Self.Element) throws -> Bool) rethrows -> Self.SubSequence
func with<T>(_ keyPath: WritableKeyPath<Self, T>, _ value: T) -> Self
Returns a new syntax node that has the child at keyPath
replaced by value
.
func withContiguousStorageIfAvailable<R>(_ body: (UnsafeBufferPointer<Self.Element>) throws -> R) rethrows -> R?
func write<Target>(to target: inout Target) where Target : TextOutputStream
Prints the raw value of this node to the provided stream.
init(_ collection: Self)
Initialize the collection from a collection of the same type.
var byteRange: ByteSourceRange { get }
var byteSize: Int { get }
The textual byte length of this node including leading and trailing trivia.
var byteSizeAfterTrimmingTrivia: Int { get }
The textual byte length of this node excluding leading and trailing trivia.
var contentLength: SourceLength { get }
var firstToken: TokenSyntax? { get }
var index: SyntaxChildrenIndex { get }
The index of this node in a SyntaxChildren
collection.
var isImplicit: Bool { get }
When isImplicit is true, the syntax node doesn’t include any underlying tokens, e.g. an empty CodeBlockItemList.
var lastToken: TokenSyntax? { get }
var nextToken: TokenSyntax? { get }
var previousToken: TokenSyntax? { get }
func appending(_ syntax: Element) -> Self
Creates a new collection by appending the provided syntax element to the children.
func `as`(_ syntaxType: Syntax.Type) -> Syntax?
Attempts to upcast the current syntax node to Syntax
node.
func `as`(_ syntaxType: Self.Type) -> Self?
Casts the current syntax node to its own type.
func cast(_ syntaxType: Syntax.Type) -> Syntax
Force-cast the current syntax node to Syntax
node..
func cast(_ syntaxType: Self.Type) -> Self
Force-casts the current syntax node to its own type.
func detach() -> Self
func flatMap<ElementOfResult>(_ transform: (Self.Element) throws -> ElementOfResult?) rethrows -> [ElementOfResult]
func inserting(_ syntax: Element, at index: Int) -> Self
Creates a new collection by inserting the provided syntax element at the provided index in the children.
func `is`(_ syntaxType: Syntax.Type) -> Bool
Checks if the current syntax node can be upcast to Syntax
node.
func `is`(_ syntaxType: Self.Type) -> Bool
Checks if the current syntax node can be cast to its own type.
func prepending(_ syntax: Element) -> Self
Creates a new collection by prepending the provided syntax element to the children.
func removing(childAt index: Int) -> Self
Creates a new collection by removing the syntax element at the provided index.
func removingFirst() -> Self
Creates a new collection by removing the first element.
func removingLast() -> Self
Creates a new collection by removing the last element.
func replacing(childAt index: Int, with syntax: Element) -> Self
Creates a new collection by replacing the syntax element at the provided index.
import SwiftSyntaxBuilder
SwiftSyntaxBuilder is a tool for generating Swift code in a convenient way using result builders.
init(@ObjCSelectorPieceListBuilder itemsBuilder: () throws -> ObjCSelectorPieceListSyntax) rethrows