Skip to content

Commit cad3951

Browse files
committed
Remove bespoke parsing for #_hasSymbol
1 parent 740ccb2 commit cad3951

File tree

4 files changed

+1
-33
lines changed

4 files changed

+1
-33
lines changed

Sources/SwiftParser/Lexer/Cursor.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1465,7 +1465,6 @@ extension Lexer.Cursor {
14651465
case "endif": kind = .poundEndifKeyword
14661466
case "available": kind = .poundAvailableKeyword
14671467
case "unavailable": kind = .poundUnavailableKeyword
1468-
case "_hasSymbol": kind = .poundHasSymbolKeyword
14691468
default:
14701469
// If we didn't find a match, then just return `.pound`. This is highly
14711470
// dubious in terms of error recovery, but is useful for code completion and

Sources/SwiftParser/Statements.swift

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,6 @@ extension Parser {
247247
return self.parsePoundAvailableConditionElement()
248248
}
249249

250-
// Parse a #_hasSymbol condition if present.
251-
if self.at(.poundHasSymbolKeyword) {
252-
return .hasSymbol(self.parsePoundHasSymbolConditionElement())
253-
}
254-
255250
// Parse the basic expression case. If we have a leading let/var/case
256251
// keyword or an assignment, then we know this is a binding.
257252
guard self.at(any: [.keyword(.let), .keyword(.var), .keyword(.case)]) else {
@@ -370,30 +365,6 @@ extension Parser {
370365
)
371366
)
372367
}
373-
374-
/// Parse a `#_hasSymbol` condition.
375-
///
376-
/// Grammar
377-
/// =======
378-
///
379-
/// has-symbol-condition → '#_hasSymbol' '(' expr ')'
380-
@_spi(RawSyntax)
381-
public mutating func parsePoundHasSymbolConditionElement() -> RawHasSymbolConditionSyntax {
382-
let (unexpectedBeforeKeyword, keyword) = self.expect(.poundHasSymbolKeyword)
383-
let (unexpectedBeforeLParen, lparen) = self.expect(.leftParen)
384-
let expr = self.parseExpression()
385-
let (unexpectedBeforeRParen, rparen) = self.expect(.rightParen)
386-
return RawHasSymbolConditionSyntax(
387-
unexpectedBeforeKeyword,
388-
hasSymbolKeyword: keyword,
389-
unexpectedBeforeLParen,
390-
leftParen: lparen,
391-
expression: expr,
392-
unexpectedBeforeRParen,
393-
rightParen: rparen,
394-
arena: self.arena
395-
)
396-
}
397368
}
398369

399370
// MARK: Throw Statements

Sources/SwiftParser/TokenPrecedence.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public enum TokenPrecedence: Comparable {
108108
case // Literals
109109
.floatingLiteral, .integerLiteral, .regexLiteral,
110110
// Pound literals
111-
.poundAvailableKeyword, .poundHasSymbolKeyword,
111+
.poundAvailableKeyword,
112112
// Identifiers
113113
.dollarIdentifier, .identifier,
114114
// '_' can occur in types to replace a type identifier

gyb_syntax_support/Token.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,6 @@ def macro_name(self):
241241
PoundConfig('PoundAvailable', 'available', text='#available'),
242242
PoundConfig('PoundUnavailable', 'unavailable', text='#unavailable'),
243243

244-
PoundConfig('PoundHasSymbol', '_hasSymbol', text='#_hasSymbol'),
245-
246244
Literal('IntegerLiteral', 'integer_literal', name_for_diagnostics='integer literal',
247245
classification='IntegerLiteral'),
248246
Literal('FloatingLiteral', 'floating_literal',

0 commit comments

Comments
 (0)