Skip to content

Reconcile Keywords with Grammar #242

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

Open
tadbyt opened this issue Jan 11, 2024 · 0 comments
Open

Reconcile Keywords with Grammar #242

tadbyt opened this issue Jan 11, 2024 · 0 comments

Comments

@tadbyt
Copy link
Contributor

tadbyt commented Jan 11, 2024

Location

https://docs.swift.org/swift-book/documentation/the-swift-programming-language/lexicalstructure#Keywords-and-Punctuation
https://docs.swift.org/swift-book/documentation/the-swift-programming-language/summaryofthegrammar

Description

The following keywords are not identified as such in the Keywords and Punctuation subsection although they are given in various grammar productions in the Summary of the Grammar section:

actor, any (with lowercase a), arch, arm, arm64, assignment, async, borrowing, canImport, compiler, consuming, higherThan, i386, iOS, iOSApplicationExtension, Linux, lowerThan, macCatalyst, macOS, macOSApplicationExtension, macro, nonisolated, os, package, safe, simulator, swift, targetEnvironment, tvOS, tvOSApplicationExtension, unsafe, visionOS, watchOS, watchOSApplicationExtension, Windows, x86_64

(This list assumes that issue #230 (#unavailable not Listed as Keyword) is being handled separately.

The specifics of which keyword list they are missing from is given in the attachment along with the rationale.

throw and switch are reversed in Keywords used in statements
private and precedencegroup are reversed in Keywords used in declarations

Correction

See attachment.
Reconcile Keywords with Grammar.pdf

Also, update the second sentence in the Keywords and Punctuation subsection of the Lexical Structure section to read:

Keywords other than inout, borrowing, consuming, var, and let can be used as parameter names in a function declaration or function call without being escaped with backticks.

Also, remove catch and throw from the Keywords used in expressions and types. (They remain in Keywords used in statements.)

Also, add case, default, else, if, and switch to the Keywords used in expressions and types. (This is due to conditional expressions; these all remain in Keywords used in statements.)

Also, add throws to the Keywords used in declarations. (It remains in Keywords used in expressions and types.)

Also, remove precedence from the Keywords used in particular contexts. (It is not currently contained anywhere in the grammar.)

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

No branches or pull requests

1 participant