Skip to content

Don’t generate BasicFormat+Extensions.swift and SyntaxClassifcation.swift #1915

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

Merged
merged 4 commits into from
Jul 18, 2023

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Jul 17, 2023

Instead of generating these files, we can just define them directly.

Also: Remove a couple of unused properties in TokenSpec.

@ahoppen
Copy link
Member Author

ahoppen commented Jul 17, 2023

@swift-ci Please test

@ahoppen ahoppen force-pushed the ahoppen/less-generation branch from 223365b to 8ffd59a Compare July 17, 2023 16:46
@ahoppen
Copy link
Member Author

ahoppen commented Jul 17, 2023

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented Jul 17, 2023

@swift-ci Please test Windows

@@ -164,7 +164,43 @@ open class BasicFormat: SyntaxRewriter {

/// Whether a leading newline on `token` should be added.
open func requiresIndent(_ node: some SyntaxProtocol) -> Bool {
return node.requiresIndent
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The nice thing about this being generated is that when a node is added, isIndented is right in the constructor and would hopefully have some thought put into it. Where as now you have to know to also update BasicFormat. Maybe that's fine (it's a similar case for the whitespace now), but seems worth mentioning.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s a price I’m willing to pay for the reduced complexity. And I don’t really expect many new nodes that require indentation anyway 😉

@ahoppen ahoppen merged commit 69c9c53 into swiftlang:main Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants