RawTokenSyntax
RawSyntaxNodeProtocol.swift:101This declaration is gated by at least one @_spi attribute.
struct RawTokenSyntax
This declaration is gated by at least one @_spi attribute.
struct RawTokenSyntax
import SwiftSyntax
A library for working with Swift code.
protocol CustomStringConvertible
A type with a customized textual representation.
protocol RawSyntaxNodeProtocol : CustomStringConvertible, Sendable, TextOutputStreamable
All typed raw syntax nodes conform to this protocol. RawXXXSyntax
is a typed wrappeer of RawSyntax
.
protocol Sendable
protocol TextOutputStreamable
A source of text-streaming operations.
init?(_ other: some RawSyntaxNodeProtocol)
init(kind: RawTokenKind, text: SyntaxText, leadingTriviaPieces: [RawTriviaPiece] = [], trailingTriviaPieces: [RawTriviaPiece] = [], presence: SourcePresence, tokenDiagnostic: TokenDiagnostic? = nil, arena: ParsingSyntaxArena)
Creates a RawTokenSyntax
. text
and trivia must be managed by the same arena
.
init(kind: RawTokenKind, wholeText: SyntaxText, textRange: Range<SyntaxText.Index>, presence: SourcePresence, tokenDiagnostic: TokenDiagnostic?, arena: ParsingSyntaxArena)
Creates a RawTokenSyntax
. wholeText
must be managed by the same arena
. textRange
is a range of the token text in wholeText
.
init(missing kind: RawTokenKind, text: SyntaxText? = nil, leadingTriviaPieces: [RawTriviaPiece] = [], trailingTriviaPieces: [RawTriviaPiece] = [], arena: SyntaxArena)
Creates a missing TokenSyntax
with the specified kind. If text
is passed, it will be used to represent the missing token’s text. If text
is nil
, the kind
’s default text will be used. If that is also nil
, the token will have empty text.
static func isKindOf(_ raw: RawSyntax) -> Bool
var byteLength: Int { get }
var isMissing: Bool { get }
var leadingTriviaByteLength: Int { get }
var leadingTriviaPieces: [RawTriviaPiece] { get }
var presence: SourcePresence { get }
var raw: RawSyntax
var tokenKind: RawTokenKind { get }
var tokenText: SyntaxText { get }
var tokenView: RawSyntaxTokenView { get }
var trailingTriviaByteLength: Int { get }
var trailingTriviaPieces: [RawTriviaPiece] { get }
typealias SyntaxType = TokenSyntax
var description: String { get }
var hasError: Bool { get }
Whether the tree contained by this layout has any
var isEmpty: Bool { get }
func `as`<Node>(_: Node.Type) -> Node? where Node : RawSyntaxNodeProtocol
Cast to the specified raw syntax type if possible.
func cast<S>(_ syntaxType: S.Type) -> S where S : RawSyntaxNodeProtocol
func `is`<Node>(_: Node.Type) -> Bool where Node : RawSyntaxNodeProtocol
Check if this instance can be cast to the specified syntax type.
func write(to target: inout some TextOutputStream)
import SwiftParser
A parser for the Swift programming language.
protocol Copyable
A type whose values can be implicitly or explicitly copied.
protocol Escapable