Skip to content

Commit 0affc99

Browse files
committed
Remove bespoke parsing for #_hasSymbol
1 parent 0cb014a commit 0affc99

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
@@ -252,11 +252,6 @@ extension Parser {
252252
return self.parsePoundAvailableConditionElement()
253253
}
254254

255-
// Parse a #_hasSymbol condition if present.
256-
if self.at(.poundHasSymbolKeyword) {
257-
return .hasSymbol(self.parsePoundHasSymbolConditionElement())
258-
}
259-
260255
// Parse the basic expression case. If we have a leading let/var/case
261256
// keyword or an assignment, then we know this is a binding.
262257
guard self.at(any: [.keyword(.let), .keyword(.var), .keyword(.case)]) else {
@@ -375,30 +370,6 @@ extension Parser {
375370
)
376371
)
377372
}
378-
379-
/// Parse a `#_hasSymbol` condition.
380-
///
381-
/// Grammar
382-
/// =======
383-
///
384-
/// has-symbol-condition → '#_hasSymbol' '(' expr ')'
385-
@_spi(RawSyntax)
386-
public mutating func parsePoundHasSymbolConditionElement() -> RawHasSymbolConditionSyntax {
387-
let (unexpectedBeforeKeyword, keyword) = self.expect(.poundHasSymbolKeyword)
388-
let (unexpectedBeforeLParen, lparen) = self.expect(.leftParen)
389-
let expr = self.parseExpression()
390-
let (unexpectedBeforeRParen, rparen) = self.expect(.rightParen)
391-
return RawHasSymbolConditionSyntax(
392-
unexpectedBeforeKeyword,
393-
hasSymbolKeyword: keyword,
394-
unexpectedBeforeLParen,
395-
leftParen: lparen,
396-
expression: expr,
397-
unexpectedBeforeRParen,
398-
rightParen: rparen,
399-
arena: self.arena
400-
)
401-
}
402373
}
403374

404375
// 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)