Skip to content

Commit fb134e9

Browse files
committed
Rename newlinePresence property of the Lexer Result
1 parent 8e6ce86 commit fb134e9

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Sources/SwiftParser/Lexer/Cursor.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,8 @@ extension Lexer {
320320
/// If `tokenKind` is `.keyword`, the kind of keyword produced, otherwise
321321
/// `nil`.
322322
let keywordKind: Keyword?
323-
/// Indicates whether the lexed token text contains a newline.
324-
let newlinePresence: Lexer.Cursor.NewlinePresence
323+
/// Indicates whether the end of the lexed token text contains a newline.
324+
let trailingNewlinePresence: Lexer.Cursor.NewlinePresence
325325

326326
private init(
327327
_ tokenKind: RawTokenKind,
@@ -330,15 +330,15 @@ extension Lexer {
330330
stateTransition: StateTransition?,
331331
trailingTriviaLexingMode: Lexer.Cursor.TriviaLexingMode?,
332332
keywordKind: Keyword?,
333-
newlinePresence: Lexer.Cursor.NewlinePresence
333+
trailingNewlinePresence: Lexer.Cursor.NewlinePresence
334334
) {
335335
self.tokenKind = tokenKind
336336
self.flags = flags
337337
self.error = error
338338
self.stateTransition = stateTransition
339339
self.trailingTriviaLexingMode = trailingTriviaLexingMode
340340
self.keywordKind = keywordKind
341-
self.newlinePresence = newlinePresence
341+
self.trailingNewlinePresence = trailingNewlinePresence
342342
}
343343

344344
/// Create a lexer result. Note that keywords should use `Result.keyword`
@@ -349,7 +349,7 @@ extension Lexer {
349349
error: Cursor.LexingDiagnostic? = nil,
350350
stateTransition: StateTransition? = nil,
351351
trailingTriviaLexingMode: Lexer.Cursor.TriviaLexingMode? = nil,
352-
newlinePresence: Lexer.Cursor.NewlinePresence = .absent
352+
trailingNewlinePresence: Lexer.Cursor.NewlinePresence = .absent
353353
) {
354354
precondition(tokenKind != .keyword, "Use Result.keyword instead")
355355
self.init(
@@ -359,7 +359,7 @@ extension Lexer {
359359
stateTransition: stateTransition,
360360
trailingTriviaLexingMode: trailingTriviaLexingMode,
361361
keywordKind: nil,
362-
newlinePresence: newlinePresence
362+
trailingNewlinePresence: trailingNewlinePresence
363363
)
364364
}
365365

@@ -372,7 +372,7 @@ extension Lexer {
372372
stateTransition: nil,
373373
trailingTriviaLexingMode: nil,
374374
keywordKind: kind,
375-
newlinePresence: .absent
375+
trailingNewlinePresence: .absent
376376
)
377377
}
378378
}
@@ -448,7 +448,7 @@ extension Lexer.Cursor {
448448
flags.insert(.isAtStartOfLine)
449449
}
450450

451-
self.previousLexemeTrailingNewlinePresence = result.newlinePresence
451+
self.previousLexemeTrailingNewlinePresence = result.trailingNewlinePresence
452452

453453
if let stateTransition = result.stateTransition {
454454
self.stateStack.perform(stateTransition: stateTransition, stateAllocator: stateAllocator)
@@ -1905,7 +1905,7 @@ extension Lexer.Cursor {
19051905
if character == UInt8(ascii: "\r") {
19061906
_ = self.advance(matching: "\n")
19071907
}
1908-
return Lexer.Result(.stringSegment, error: error, newlinePresence: .present)
1908+
return Lexer.Result(.stringSegment, error: error, trailingNewlinePresence: .present)
19091909
} else {
19101910
// Single line literals cannot span multiple lines.
19111911
// Terminate the string here and go back to normal lexing (instead of `afterStringLiteral`)

0 commit comments

Comments
 (0)