Skip to content

Commit 11b9042

Browse files
authored
Merge pull request #1983 from ahoppen/ahoppen/renames-again
Some more renames of syntax nodes
2 parents aa54b10 + a2cf2df commit 11b9042

34 files changed

+205
-123
lines changed

CodeGeneration/Sources/SyntaxSupport/AttributeNodes.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ public let ATTRIBUTE_NODES: [Node] = [
190190
traits: ["WithTrailingComma"],
191191
children: [
192192
Child(
193-
name: "AvailabilityVersionRestriction",
193+
name: "PlatformVersion",
194+
deprecatedName: "AvailabilityVersionRestriction",
194195
kind: .node(kind: .platformVersion)
195196
),
196197
Child(

CodeGeneration/Sources/SyntaxSupport/ExprNodes.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ public let EXPR_NODES: [Node] = [
770770
Child(
771771
name: "Literal",
772772
deprecatedName: "FloatingDigits",
773-
kind: .token(choices: [.token(tokenKind: "FloatingLiteralToken")])
773+
kind: .token(choices: [.token(tokenKind: "FloatLiteralToken")])
774774
)
775775
]
776776
),
@@ -1384,8 +1384,7 @@ public let EXPR_NODES: [Node] = [
13841384
Child(
13851385
name: "Operator",
13861386
deprecatedName: "OperatorToken",
1387-
kind: .token(choices: [.token(tokenKind: "PrefixOperatorToken")]),
1388-
isOptional: true
1387+
kind: .token(choices: [.token(tokenKind: "PrefixOperatorToken")])
13891388
),
13901389
Child(
13911390
name: "Expression",

CodeGeneration/Sources/SyntaxSupport/TokenSpec.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public let SYNTAX_TOKENS: [TokenSpec] = [
7979
.other(name: "endOfFile", nameForDiagnostics: "end of file", text: ""),
8080
.punctuator(name: "equal", text: "="),
8181
.punctuator(name: "exclamationMark", text: "!"),
82-
.other(name: "floatingLiteral", nameForDiagnostics: "floating literal"),
82+
.other(name: "floatLiteral", nameForDiagnostics: "float literal"),
8383
.other(name: "identifier", nameForDiagnostics: "identifier"),
8484
.punctuator(name: "infixQuestionMark", text: "?"),
8585
.other(name: "integerLiteral", nameForDiagnostics: "integer literal"),

CodeGeneration/Tests/ValidateSyntaxNodes/ValidateSyntaxNodes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class ValidateSyntaxNodes: XCTestCase {
178178
}
179179
}
180180

181-
case .token(tokenKind: "IdentifierToken"), .token(tokenKind: "IntegerLiteralToken"), .token(tokenKind: "FloatingLiteralToken"):
181+
case .token(tokenKind: "IdentifierToken"), .token(tokenKind: "IntegerLiteralToken"), .token(tokenKind: "FloatLiteralToken"):
182182
// We allow arbitrary naming of identifiers and literals
183183
break
184184
case .token(tokenKind: "CommaToken"):

Sources/SwiftIDEUtils/SyntaxClassification.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public enum SyntaxClassification {
2828
/// An editor placeholder of the form `<#content#>`
2929
case editorPlaceholder
3030
/// A floating point literal.
31-
case floatingLiteral
31+
case floatLiteral
3232
/// A generic identifier.
3333
case identifier
3434
/// An integer literal.
@@ -51,6 +51,11 @@ public enum SyntaxClassification {
5151
case stringLiteral
5252
/// An identifier referring to a type.
5353
case typeIdentifier
54+
55+
@available(*, deprecated, renamed: "floatLiteral")
56+
public static var floatingLiteral: Self {
57+
return .floatLiteral
58+
}
5459
}
5560

5661
extension SyntaxClassification {
@@ -65,7 +70,7 @@ extension SyntaxClassification {
6570
switch keyPath {
6671
case \AttributeSyntax.attributeName:
6772
return (.attribute, true)
68-
case \PlatformVersionItemSyntax.availabilityVersionRestriction:
73+
case \PlatformVersionItemSyntax.platformVersion:
6974
return (.keyword, false)
7075
case \AvailabilityVersionRestrictionSyntax.platform:
7176
return (.keyword, false)
@@ -124,8 +129,8 @@ extension RawTokenKind {
124129
return .none
125130
case .exclamationMark:
126131
return .none
127-
case .floatingLiteral:
128-
return .floatingLiteral
132+
case .floatLiteral:
133+
return .floatLiteral
129134
case .identifier:
130135
return .identifier
131136
case .infixQuestionMark:

Sources/SwiftParser/Attributes.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ extension Parser {
865865
keepGoing = self.consume(if: .comma)
866866
elements.append(
867867
RawPlatformVersionItemSyntax(
868-
availabilityVersionRestriction: versionRestriction,
868+
platformVersion: versionRestriction,
869869
trailingComma: keepGoing,
870870
arena: self.arena
871871
)
@@ -925,7 +925,7 @@ extension Parser {
925925
keepGoing = self.consume(if: .comma)
926926
platforms.append(
927927
RawPlatformVersionItemSyntax(
928-
availabilityVersionRestriction: restriction,
928+
platformVersion: restriction,
929929
trailingComma: keepGoing,
930930
arena: self.arena
931931
)

Sources/SwiftParser/Availability.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ extension Parser {
210210
}
211211

212212
let version: RawVersionTupleSyntax?
213-
if self.at(.integerLiteral, .floatingLiteral) {
213+
if self.at(.integerLiteral, .floatLiteral) {
214214
version = self.parseVersionTuple(maxComponentCount: 3)
215215
} else {
216216
version = nil
@@ -237,7 +237,7 @@ extension Parser {
237237
return self.consumeAnyToken()
238238
}
239239

240-
/// Consume the unexpected version token(e.g. integerLiteral, floatingLiteral, identifier) until the period no longer appears.
240+
/// Consume the unexpected version token(e.g. integerLiteral, floatLiteral, identifier) until the period no longer appears.
241241
private mutating func parseUnexpectedVersionTokens() -> RawUnexpectedNodesSyntax? {
242242
var unexpectedTokens: [RawTokenSyntax] = []
243243
var keepGoing: RawTokenSyntax? = nil
@@ -246,7 +246,7 @@ extension Parser {
246246
if let keepGoing {
247247
unexpectedTokens.append(keepGoing)
248248
}
249-
if let unexpectedVersion = self.consume(if: .integerLiteral, .floatingLiteral, .identifier) {
249+
if let unexpectedVersion = self.consume(if: .integerLiteral, .floatLiteral, .identifier) {
250250
unexpectedTokens.append(unexpectedVersion)
251251
}
252252
keepGoing = self.consume(if: .period)
@@ -256,7 +256,7 @@ extension Parser {
256256

257257
/// Parse a dot-separated list of version numbers.
258258
mutating func parseVersionTuple(maxComponentCount: Int) -> RawVersionTupleSyntax {
259-
if self.at(.floatingLiteral),
259+
if self.at(.floatLiteral),
260260
let periodIndex = self.currentToken.tokenText.firstIndex(of: UInt8(ascii: ".")),
261261
self.currentToken.tokenText[0..<periodIndex].allSatisfy({ Unicode.Scalar($0).isDigit })
262262
{

Sources/SwiftParser/Expressions.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ extension Parser {
10971097
arena: self.arena
10981098
)
10991099
)
1100-
case (.floatingLiteral, let handle)?:
1100+
case (.floatLiteral, let handle)?:
11011101
let literal = self.eat(handle)
11021102
return RawExprSyntax(
11031103
RawFloatLiteralExprSyntax(
@@ -1186,7 +1186,7 @@ extension Parser {
11861186
return RawExprSyntax(
11871187
RawFloatLiteralExprSyntax(
11881188
literal: RawTokenSyntax(
1189-
missing: .floatingLiteral,
1189+
missing: .floatLiteral,
11901190
text: text,
11911191
arena: self.arena
11921192
),

Sources/SwiftParser/IncrementalParseTransition.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ extension Parser {
3535
}
3636
}
3737

38-
/// Accepts a re-used ``Syntax`` node that `IncrementalParseTransition`
38+
/// Accepts a re-used `Syntax` node that `IncrementalParseTransition`
3939
/// determined they should be re-used for a parse invocation.
4040
///
4141
/// The client can use this information to potentially avoid unnecessary work

Sources/SwiftParser/Lexer/Cursor.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,7 @@ extension Lexer.Cursor {
14071407
let errorPos = tmp
14081408
self.advance(while: { $0.isValidIdentifierContinuationCodePoint })
14091409
return Lexer.Result(
1410-
.floatingLiteral,
1410+
.floatLiteral,
14111411
error: LexingDiagnostic(errorKind, position: errorPos)
14121412
)
14131413
}
@@ -1419,13 +1419,13 @@ extension Lexer.Cursor {
14191419
let errorPos = tmp
14201420
self.advance(while: { $0.isValidIdentifierContinuationCodePoint })
14211421
return Lexer.Result(
1422-
.floatingLiteral,
1422+
.floatLiteral,
14231423
error: LexingDiagnostic(.invalidFloatingPointExponentDigit, position: errorPos)
14241424
)
14251425
}
14261426
}
14271427

1428-
return Lexer.Result(.floatingLiteral)
1428+
return Lexer.Result(.floatLiteral)
14291429
}
14301430

14311431
mutating func lexHexNumber() -> Lexer.Result {
@@ -1529,7 +1529,7 @@ extension Lexer.Cursor {
15291529
let errorPos = tmp
15301530
self.advance(while: { $0.isValidIdentifierContinuationCodePoint })
15311531
return Lexer.Result(
1532-
.floatingLiteral,
1532+
.floatLiteral,
15331533
error: LexingDiagnostic(errorKind, position: errorPos)
15341534
)
15351535
}
@@ -1541,11 +1541,11 @@ extension Lexer.Cursor {
15411541
let errorPos = tmp
15421542
self.advance(while: { $0.isValidIdentifierContinuationCodePoint })
15431543
return Lexer.Result(
1544-
.floatingLiteral,
1544+
.floatLiteral,
15451545
error: LexingDiagnostic(.invalidFloatingPointExponentDigit, position: errorPos)
15461546
)
15471547
}
1548-
return Lexer.Result(.floatingLiteral)
1548+
return Lexer.Result(.floatLiteral)
15491549
}
15501550
}
15511551

0 commit comments

Comments
 (0)