Skip to content
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

[SR-6932] libSyntax: Some trivia are not so trivial #49480

Closed
dabrahams opened this issue Feb 6, 2018 · 1 comment
Closed

[SR-6932] libSyntax: Some trivia are not so trivial #49480

dabrahams opened this issue Feb 6, 2018 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself † libswiftSyntax † Area → compiler: the once-integrated C++ Syntax library succeeded by SwiftSyntax stale Resolution: No longer relevant, stale

Comments

@dabrahams
Copy link
Collaborator

Previous ID SR-6932
Radar None
Original Reporter @dabrahams
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Source Tooling
Labels Bug, Syntax
Assignee None
Priority Medium

md5: 99576744d57298235b0f4e2fea0f3023

Issue Description:

We mostly think of trivia as things that could be dropped without changing semantics, but some are crucial. For example, the space in “let x=1” prevents tokenization as “letx, =, 1.” Also, the newlines between statements, where there are no semicolons, are required. A formatter/pretty-printer that normalizes whitespace needs to be able to find-and-preserve or ensure-it-recreates nontrivial whitespace.

The current libSyntax API makes that especially difficult when multiple identifiers and/or keywords appear together, because the rules about what characters can be part of an identifier are complex. One could special-case all the known token combinations, but when the language grows a new token these rules are very likely to break down until the formatter is updated and rebuilt with a new libSyntax. It should be possible to handle this in an efficient way that is very likely to be resilient to future language changes.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the compiler The Swift compiler in itself label Apr 5, 2023
@AnthonyLatsis
Copy link
Collaborator

libSyntax was removed in #62145 and succeeded by swift-syntax.

@AnthonyLatsis AnthonyLatsis closed this as not planned Won't fix, can't repro, duplicate, stale Apr 5, 2023
@AnthonyLatsis AnthonyLatsis added the stale Resolution: No longer relevant, stale label Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself † libswiftSyntax † Area → compiler: the once-integrated C++ Syntax library succeeded by SwiftSyntax stale Resolution: No longer relevant, stale
Projects
None yet
Development

No branches or pull requests

2 participants