-
Notifications
You must be signed in to change notification settings - Fork 89
Syntax examples #3085
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
Syntax examples #3085
Conversation
I see I think it's better if we keep just one of these files. |
(Written in a race with @ncik-roberts's comment above.) @ccasin pointed out on Slack two truths:
The redundancy with About forgetting: this is a good point. So I have now added a workflow that will make a comment reminding you to update these tests whenever parser.mly is edited. You can see this in action at goldfirere#2 What do we think? |
I agree that my new examples file is redundant with source_jane_street.ml. I will modify this now to use that file. |
OK. Ready for review. Please re-read the PR description, as this has significantly changed. |
Fixing the broken test required making it a bit worse. Quick re-review from @ncik-roberts, please? |
Your edits to the test look reasonable. It does mean that |
* Add syntax examples * Add a little workflow to request examples for new syntax * With permissions now * Formatting. Avoid duplicates. * Protect backticks * Fix bug where we printed invalid syntax * Fix bug in printing module strengthening * Move examples into source_jane_street * Update reminder script and add some commentary * Remove redundant examples.ml * Remove dead code from test * Fix broken test
This PR expands the role of the pre-existing source_jane_syntax.ml.
It now tests that Pprintast correctly round-trips (as it used to). But it is also now an expect-test, thus serving as a convenient way to document our syntax.
Some of our syntax (like
[@nontail]
) is in the form of attributes. This conflicted with a feature of the round-trip test that checked that we had done jane-syntax encoding correctly. Given that it was hard to see a good way around this and that jane-syntax is on the way out, I just dropped the check.In the course of preparing this PR, I found two places where Pprintast didn't round-trip, now fixed.
This PR additionally adds some automation that will remind us all to edit this file whenever we change the syntax of the language.