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

Add a documentation tokens to pps #281

Merged
merged 7 commits into from
Jul 3, 2023

Conversation

n-osborne
Copy link
Contributor

@n-osborne n-osborne commented May 30, 2023

This PR proposes a fix for #288

It adds two new tokens to the lexer:

  • a Documentation token with starting and ending position and the contents
  • an Empty_documentation token with the ending position

Both are printed as documentation attributes when they appears between an Ocaml declaration and a gospel specification (the case where the documentation comments is considered as detached by the OCaml parser)

Tests are added to check that the documentation is not considered as detached anymore and to make sure that original position is preserved.

@n-osborne n-osborne requested a review from shym May 30, 2023 10:51
Copy link
Contributor

@shym shym left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice job!
I think I found two corner cases that it would be nice to cover before merging.

CHANGES.md Outdated Show resolved Hide resolved
src/pps.mll Outdated Show resolved Hide resolved
src/pps.mll Outdated Show resolved Hide resolved
src/pps.mll Outdated Show resolved Hide resolved
- a Documentation token with positions and contents
- an Empty_documentation with just ending position

The Empty_documentation token correspond to `(**)`
@n-osborne n-osborne changed the title Add a documentation token to pps Add a documentation tokens to pps Jun 28, 2023
@n-osborne n-osborne requested a review from shym June 28, 2023 15:58
Copy link
Contributor

@shym shym left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice job!
I managed to find two minor points just to quibble :-) but LGTM.

src/pps.mll Outdated Show resolved Hide resolved
These printers turns the documentation comments into documentation
attributes. We will want to use them when the documentation appears
between an OCaml declaration and gospel specifications.
Capture all the cases spacing-wise where a documentation comment appears
between an OCaml declaration and a gospel specification.
Dune 3 enables cram tests by default
@n-osborne n-osborne merged commit aac9b24 into ocaml-gospel:main Jul 3, 2023
2 checks passed
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