Skip to content

Add 'open' keyword in SwiftSyntax #42260

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

Closed
wants to merge 1 commit into from

Conversation

iMostfa
Copy link
Contributor

@iMostfa iMostfa commented Apr 8, 2022

Signed-off-by: Mostfa [email protected]

This pull request add support for 'open' keyword as TokenAccess
and accessed in swift like this: TokenSyntax.public

Signed-off-by: Mostfa <[email protected]>
@iMostfa
Copy link
Contributor Author

iMostfa commented Apr 8, 2022

Hi, @ahoppen
i would love to know what do you think about the changes

thank you.

@ahoppen
Copy link
Member

ahoppen commented Apr 11, 2022

The Token.py file controls which identifiers are considered tokens by Swift, but we don’t consider open a keyword in the strict sense. It’s a contextual keyword, which allows you to write things like

let open = "hello"
print(open)

which isn’t possible with e.g. public. Thus, it also shouldn’t be included in Token.py.

To make it available as TokenSyntax.open (which I think would be a good idea), I would suggest that you add an extension to TokenSyntax in SwiftSyntaxBuilder which adds the open keyword.

@ahoppen ahoppen closed this Apr 11, 2022
@iMostfa
Copy link
Contributor Author

iMostfa commented Apr 11, 2022

Thank you @ahoppen for your feedback and the clarification
I've opened a pull request with the required changes in SwiftSyntax

waiting for your feedback about my work and if I understand it correctly ...

greetings.

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