Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "accessorSpecifier",
kind: .token(choices: [.keyword(.get), .keyword(.set)]),
kind: .token(choices: [.keyword(.get), .keyword(.set), .keyword(._modify)]),
documentation: "The accessor name.",
isOptional: true
),
Expand Down
7 changes: 6 additions & 1 deletion Sources/SwiftParser/Attributes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,12 @@ extension Parser {
let unexpectedBeforeAccessor: RawUnexpectedNodesSyntax?
let accessor: RawTokenSyntax?
if period != nil {
(unexpectedBeforeAccessor, accessor) = self.expect(.keyword(.get), .keyword(.set), default: .keyword(.get))
(unexpectedBeforeAccessor, accessor) = self.expect(
.keyword(.get),
.keyword(.set),
.keyword(._modify),
default: .keyword(.get)
)
} else {
(unexpectedBeforeAccessor, accessor) = (nil, nil)
}
Expand Down
9 changes: 9 additions & 0 deletions Sources/SwiftParser/generated/Parser+TokenSpecSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1374,13 +1374,16 @@ extension DerivativeAttributeArgumentsSyntax {
public enum AccessorSpecifierOptions: TokenSpecSet {
case get
case set
case _modify

init?(lexeme: Lexer.Lexeme, experimentalFeatures: Parser.ExperimentalFeatures) {
switch PrepareForKeywordMatch(lexeme) {
case TokenSpec(.get):
self = .get
case TokenSpec(.set):
self = .set
case TokenSpec(._modify):
self = ._modify
default:
return nil
}
Expand All @@ -1392,6 +1395,8 @@ extension DerivativeAttributeArgumentsSyntax {
self = .get
case TokenSpec(.set):
self = .set
case TokenSpec(._modify):
self = ._modify
default:
return nil
}
Expand All @@ -1403,6 +1408,8 @@ extension DerivativeAttributeArgumentsSyntax {
return .keyword(.get)
case .set:
return .keyword(.set)
case ._modify:
return .keyword(._modify)
}
}

Expand All @@ -1416,6 +1423,8 @@ extension DerivativeAttributeArgumentsSyntax {
return .keyword(.get)
case .set:
return .keyword(.set)
case ._modify:
return .keyword(._modify)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) {
assertNoError(kind, 6, verify(layout[6], as: RawUnexpectedNodesSyntax?.self))
assertNoError(kind, 7, verify(layout[7], as: RawTokenSyntax?.self, tokenChoices: [.tokenKind(.period)]))
assertNoError(kind, 8, verify(layout[8], as: RawUnexpectedNodesSyntax?.self))
assertNoError(kind, 9, verify(layout[9], as: RawTokenSyntax?.self, tokenChoices: [.keyword("get"), .keyword("set")]))
assertNoError(kind, 9, verify(layout[9], as: RawTokenSyntax?.self, tokenChoices: [.keyword("get"), .keyword("set"), .keyword("_modify")]))
assertNoError(kind, 10, verify(layout[10], as: RawUnexpectedNodesSyntax?.self))
assertNoError(kind, 11, verify(layout[11], as: RawTokenSyntax?.self, tokenChoices: [.tokenKind(.comma)]))
assertNoError(kind, 12, verify(layout[12], as: RawUnexpectedNodesSyntax?.self))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@ public struct DeinitializerEffectSpecifiersSyntax: SyntaxProtocol, SyntaxHashabl
/// - `colon`: `:`
/// - `originalDeclName`: ``ExprSyntax``
/// - `period`: `.`?
/// - `accessorSpecifier`: (`get` | `set`)?
/// - `accessorSpecifier`: (`get` | `set` | `_modify`)?
/// - `comma`: `,`?
/// - `arguments`: ``DifferentiabilityWithRespectToArgumentSyntax``?
///
Expand Down Expand Up @@ -1439,6 +1439,7 @@ public struct DerivativeAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHashable
/// For syntax trees generated by the parser, this is guaranteed to be one of the following kinds:
/// - `get`
/// - `set`
/// - `_modify`
public var accessorSpecifier: TokenSyntax? {
get {
return Syntax(self).child(at: 9)?.cast(TokenSyntax.self)
Expand Down