RawSyntaxTokenView
A view into RawSyntax
that exposes functionality that only applies to tokens.
This declaration is gated by at least one @_spi attribute.
struct RawSyntaxTokenView
A view into RawSyntax
that exposes functionality that only applies to tokens.
This declaration is gated by at least one @_spi attribute.
struct RawSyntaxTokenView
import SwiftSyntax
A library for working with Swift code.
struct RawSyntax
Represents the raw tree structure underlying the syntax tree. These nodes have no notion of identity and only provide structure to the tree. They are immutable and can be freely shared between syntax nodes.
protocol Sendable
var leadingRawTriviaPieces: [RawTriviaPiece] { get }
var leadingTriviaByteLength: Int { get }
The UTF-8 byte length of the leading trivia.
var leadingTriviaLength: SourceLength { get }
Returns the leading Trivia
length.
var presence: SourcePresence { get }
var rawKind: RawTokenKind { get }
Token kind of this node.
var rawText: SyntaxText { get }
Token text of this node.
var textByteLength: Int { get }
The length of the token without leading or trailing trivia, assuming this is a token node.
var tokenDiagnostic: TokenDiagnostic? { get }
var trailingRawTriviaPieces: [RawTriviaPiece] { get }
var trailingTriviaByteLength: Int { get }
The UTF-8 byte length of the trailing trivia.
var trailingTriviaLength: SourceLength { get }
Returns the trailing Trivia
length.
var trimmedLength: SourceLength { get }
func formKind() -> TokenKind
func formLeadingTrivia() -> Trivia
Returns the leading Trivia
.
func formTrailingTrivia() -> Trivia
Returns the trailing Trivia
.
func leadingTrivia<T>(_ body: (SyntaxText) -> T) -> T
Run body
with text of the leading trivia and return its result.
func trailingTrivia<T>(_ body: (SyntaxText) -> T) -> T
Run body
with text of the leading trivia and return its result.
func withKind(_ newValue: TokenKind, arena: SyntaxArena) -> RawSyntax
Returns a RawSyntax
node with the same source text but with the token kind changed to newValue
.
func withPresence(_ newValue: SourcePresence, arena: SyntaxArena) -> RawSyntax
Returns a RawSyntax
node with the presence changed to newValue
.
func withTokenDiagnostic(tokenDiagnostic: TokenDiagnostic?, arena: SyntaxArena) -> RawTokenSyntax