Skip to content

Commit f6057d6

Browse files
committed
Supports exact: package requirement
1 parent d322e9d commit f6057d6

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

CodeGeneration/Sources/SyntaxSupport/KeywordSpec.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ public let KEYWORDS: [KeywordSpec] = [
124124
KeywordSpec("else", isLexerClassified: true, requiresTrailingSpace: true),
125125
KeywordSpec("enum", isLexerClassified: true, requiresTrailingSpace: true),
126126
KeywordSpec("escaping"),
127+
KeywordSpec("exact"),
127128
KeywordSpec("exclusivity"),
128129
KeywordSpec("exported"),
129130
KeywordSpec("extension", isLexerClassified: true, requiresTrailingSpace: true),

CodeGeneration/Sources/SyntaxSupport/gyb_generated/AttributeNodes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public let ATTRIBUTE_NODES: [Node] = [
213213
description: "The comma before the package requirement, if it exists.",
214214
isOptional: true),
215215
Child(name: "RequirementLabel",
216-
kind: .token(choices: [.keyword(text: "branch"), .keyword(text: "from"), .keyword(text: "revision")]),
216+
kind: .token(choices: [.keyword(text: "branch"), .keyword(text: "exact"), .keyword(text: "from"), .keyword(text: "revision")]),
217217
description: "The requirement label.",
218218
isOptional: true),
219219
Child(name: "RequirementColon",

Sources/SwiftParser/Attributes.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -885,8 +885,8 @@ extension Parser {
885885
let requirement: RawExprSyntax?
886886
if locationLabel.tokenKind != .keyword(.path) {
887887
(unexpectedBeforeRequirementComma, requirementComma) = self.expect(.comma)
888-
if self.at(any: [.keyword(.from), .keyword(.branch), .keyword(.revision)]) {
889-
(unexpectedBeforeRequirementLabel, requirementLabel) = self.expectAny([.keyword(.from), .keyword(.branch), .keyword(.revision)], default: .keyword(.from))
888+
if self.at(any: [.keyword(.from), .keyword(.exact), .keyword(.branch), .keyword(.revision)]) {
889+
(unexpectedBeforeRequirementLabel, requirementLabel) = self.expectAny([.keyword(.from), .keyword(.exact), .keyword(.branch), .keyword(.revision)], default: .keyword(.from))
890890
(unexpectedBeforeRequirementColon, requirementColon) = self.expect(.colon)
891891
requirement = self.parseStringLiteral().as(RawExprSyntax.self)
892892
} else {

Sources/SwiftSyntax/generated/Keyword.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ public enum Keyword: UInt8, Hashable {
199199

200200
case escaping
201201

202+
case exact
203+
202204
case exclusivity
203205

204206
case exported
@@ -554,6 +556,8 @@ public enum Keyword: UInt8, Hashable {
554556
self = .cType
555557
case "defer":
556558
self = .`defer`
559+
case "exact":
560+
self = .exact
557561
case "false":
558562
self = .`false`
559563
case "final":
@@ -1159,6 +1163,7 @@ public enum Keyword: UInt8, Hashable {
11591163
"else",
11601164
"enum",
11611165
"escaping",
1166+
"exact",
11621167
"exclusivity",
11631168
"exported",
11641169
"extension",

gyb_syntax_support/AttributeNodes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@
224224
The comma before the package requirement, if it exists.
225225
'''),
226226
Child('RequirementLabel', kind='IdentifierToken',
227-
token_choices=['KeywordToken|branch', 'KeywordToken|from', 'KeywordToken|revision'],
227+
token_choices=['KeywordToken|branch', 'KeywordToken|exact', 'KeywordToken|from', 'KeywordToken|revision'],
228228
description='The requirement label.', is_optional=True),
229229
Child('RequirementColon', kind='ColonToken', is_optional=True),
230230
Child('Requirement', kind='Expr',

0 commit comments

Comments
 (0)