Skip to content

Commit b8ce7f8

Browse files
authored
Merge pull request #2013 from ahoppen/ahoppen/tokenkind-instead-of-text
Compare `Token.tokenKind` instead of `Token.text` in a couple of places in SwiftOperators
2 parents 64e7475 + 1e0cbf7 commit b8ce7f8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Sources/SwiftOperators/OperatorTable+Semantics.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ extension PrecedenceGroup {
2323
switch attr {
2424
// Relation (lowerThan, higherThan)
2525
case .precedenceGroupRelation(let relation):
26-
let isLowerThan = relation.higherThanOrLowerThanLabel.text == "lowerThan"
26+
let isLowerThan = relation.higherThanOrLowerThanLabel.tokenKind == .keyword(.lowerThan)
2727
for otherGroup in relation.precedenceGroups {
2828
let otherGroupName = otherGroup.name.text
2929
let relationKind: PrecedenceRelation.Kind =
@@ -40,18 +40,18 @@ extension PrecedenceGroup {
4040

4141
// Assignment
4242
case .precedenceGroupAssignment(let assignment):
43-
self.assignment = assignment.value.text == "true"
43+
self.assignment = assignment.value.tokenKind == .keyword(.true)
4444

4545
// Associativity
4646
case .precedenceGroupAssociativity(let associativity):
47-
switch associativity.value.text {
48-
case "left":
47+
switch associativity.value.tokenKind {
48+
case .keyword(.left):
4949
self.associativity = .left
5050

51-
case "right":
51+
case .keyword(.right):
5252
self.associativity = .right
5353

54-
case "none":
54+
case .keyword(.none):
5555
self.associativity = .none
5656

5757
default:

0 commit comments

Comments
 (0)