@@ -113,13 +113,13 @@ extension Parser {
113
113
var poundIf : Parser . Token
114
114
let condition : RawExprSyntax ?
115
115
var atElifTypo : Bool {
116
- guard self . at ( . pound) else {
116
+ guard self . at ( TokenSpec ( . pound) ) , self . currentToken . trailingTriviaText . isEmpty else {
117
117
return false
118
118
}
119
119
let identifierSpec = TokenSpec ( . identifier, allowAtStartOfLine: false )
120
120
var lookahead = self . lookahead ( )
121
121
lookahead. consumeAnyToken ( )
122
- guard lookahead. at ( identifierSpec) , lookahead. currentToken. tokenText == " elif " else {
122
+ guard lookahead. at ( identifierSpec) , lookahead. currentToken. tokenText == " elif " , lookahead . currentToken . leadingTriviaText . isEmpty else {
123
123
return false
124
124
}
125
125
lookahead. consumeAnyToken ( )
@@ -128,7 +128,7 @@ extension Parser {
128
128
129
129
if atElifTypo {
130
130
( unexpectedBeforePoundIf, poundIf) = self . eat ( poundIfHandle)
131
- guard let identifier = self . consume ( if: TokenSpec ( . identifier, allowAtStartOfLine: false ) ) else {
131
+ guard self . currentToken . leadingTriviaText . isEmpty , let identifier = self . consume ( if: TokenSpec ( . identifier, allowAtStartOfLine: false ) ) else {
132
132
preconditionFailure ( " The current token should be an identifier, guaranteed by the previous if statement " )
133
133
}
134
134
unexpectedBeforePoundIf = RawUnexpectedNodesSyntax ( combining: unexpectedBeforePoundIf, poundIf, identifier, arena: self . arena)
0 commit comments