-
Notifications
You must be signed in to change notification settings - Fork 441
[SR-10024] Add new TokenKinds for contextual keyword in libSyntax/SwiftSyntax #434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think this is the kind of contextual "classification" we have the SyntaxClassifier for. For example for "let x: Int" "Int" is an identifier token, but the classifier will mark it as 'type-identifier'. In the case of "weak" in your example it will mark it as 'builtin-attribute' classification kind. |
We already have |
Could you clarify how we use it currently ? |
In parser, we set the token kind to |
@harlanhaskins Do you remember why |
That patch was really introducing TokenKinds to cover the new ones in swiftlang/swift#11809 I think SyntaxClassifier serves the need that contextual_keyword served. @nkcsgexi should we get rid of contextual_keyword? |
I've added a convenience API |
rdar://95638944 |
Looks like
|
Workaround new trivia behavior in SwiftSyntax.
Attachment: Download
Additional Detail from JIRA
md5: f6a7999be8142907c0d76093517b06c8
Issue Description:
All contextual keyword's token kind is `identifier` for now, but I would like to have them as keyword kind instead.
For example, I was expecting to have `weakKeyword` for below variable declaration, but I got `identifier("weak")` in SwiftSyntax. In this context, it can tell keyword, not identifier.
Same thing happens to other contextual keywords as well.
Sample code:
Expected:
Actual:
Environment:
Xcode 10.2 beta 3 (10P99q)
Apple Swift version 5.0 (swiftlang-1001.0.63.8 clang-1001.0.43)
Target: x86_64-apple-darwin18.2.0
The text was updated successfully, but these errors were encountered: