-
Notifications
You must be signed in to change notification settings - Fork 440
Add gyb for Punctuators and Misc tokens #264
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed the actor
keyword is not in the generated list here, does the gyb generation perhaps have to run with -enable-experimental-concurrency or is there some other way to get that?
Ah, yes, forgot about
Add it to the main swift repo, set up a PR there for your changes and just link to this PR in the description. |
That’s because |
@ahoppen I opened a PR in the Swift repo. Should there be some default in the Etc:
|
At a first glance the Swift PR looks very good. I think you went a very good way with the defaults already. I think for all the other tokens we can reasonably assume a default of If you don’t know what some of the tokens are or whether they need trivia, you can also just leave them unspaced for now. It’s probably easier to go and revisit the decisions later once we have the builder up and running and get a feeling for how it behaves. |
51ff869
to
45ee09e
Compare
I have now pushed a new gyb file for Tokens. As you say we can leave them unspaced, and then change later if needed. |
Okey so I confirmed that piece. We indeed have it as a contextual keyword, same with await and async. For the builders once we get there it'll be nice to construct an |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR looks very good overall (also the Swift side, I’ve left a comment there as well).
I think we can make it to one loop as the Token.py contains all information about leading/trailing.
I agree that one loop should be sufficient. As a bonus you could adjust the comment to say "the … keyword" or "the … token" depending on whether the token is a keyword or not, but I’m also fine with just having the comment say "the … token".
Also, I don’t care about the MARK
comments. Feel free to remove them if they complicate things.
Other than that, I’ve got a few minor comments about the doc-comments, although they are not critical. Once we generate all tokens in one loop, I think we’re good to merge.
Sounds like a case where we need to hand write a constructor for those contextual keywords. We can do that once we’re approaching a close with the auto-generated stuff. |
45ee09e
to
156c887
Compare
156c887
to
2f4a144
Compare
static let `poundColorLiteral` = SyntaxFactory.makePoundColorLiteralKeyword() | ||
.withLeadingTrivia(.spaces(1)) | ||
|
||
static let `integerLiteral` = SyntaxFactory.makeIntegerLiteral() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t think this compiles. makeIntegerLiteral
has a required text
parameter.
Stupid question but are you checking if your code compiles before pushing the changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to my self: Remember to delete DerivedData
when chugging toolchain, sorry about that! 😞
SwiftSyntax
started not to compile.. Strange.. But it should be fixed now and build and tests pass locally.
Pushed to swiftlang/swift#36383 as tests did fail with {
and }
because we added trailing space. We can not generalise that.
2f4a144
to
e513bf5
Compare
e513bf5
to
0cfced9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good now!
@swift-ci Please test |
Update the version number printed by `-v`.
From #263
I have added tokens for Punctuators and Misc, but as you mention we should add
requires_trailing_space
.I have seen that the
=
also require a leading space, so we should also we also add anrequires_leading_space
for those few cases?You mention that we should add to Token.
Is that an extension or should we add this to the main swift repo? 😁