Skip to content

Request for Documentation on Parsing Rules for Trivia in swift-syntax #2582

Open
@omochi

Description

@omochi

Description

I'd like to request documentation on the rules for parsing Trivia.
There used to be documentation explaining the rules for parsing Trivia back when we were using libSyntax,
but it seems to have disappeared since the transition to swift-syntax.

The URL at the time was as follows.
https://github.com/apple/swift/blob/980d40951ff557047dce833d1d092b400bbc20db/lib/Syntax/README.md

Just to be sure, I searched both the repository and the documentation site, but I couldn't find it.

Understanding what constitutes the trailing trivia of a preceding token and
what becomes the leading trivia of a following token
is essential for implementing tools that process code.

It's challenging to deduce this behavior from the actual behavior alone,
so I believe it's necessary to have a document that explains this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions