Skip to content

Parsing ItemMod fails #393

Closed
Closed
@Bert-Proesmans

Description

@Bert-Proesmans

I built a reproduction here: https://github.com/Bert-Proesmans/syn-issue

The reproduction consists of an attribute macro which simply parses and tokenizes it's input. The attribute must be attached to modules. Each 'test-suite' is guarded by a feature flag.
The reproduction demonstrates the following:

  • In test cases 1 (one_two) and 4 (four_two) parsing an ItemMod fails because inner sugared documentation is present before another inner attribute. The compiler allows inner sugared docs to be placed before any other inner attribute, so this is an issue.
    The workaround is to place the inner sugar documentation after all inner attributes.

  • Inner sugar docs lose their attachment. This can be observed in test cases 1 (one_one), 4 (four_one).
    Also after fixing test case one_two, four_two by moving the inner sugar doc below other inner attributes.
    After parsing the module and tokenizing again the sugar doc is wrongly converted into a doc-attribute. This attribute is missing it's bang-token so it becomes attached to the next syntax item.
    See below
    afbeelding

  • As mentioned in issue Remove Attribute::is_sugared_doc #389, documentation that is parsed by syn contains the triple slashes '/' before it's content. The image above also demonstrates this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions