From bb06a83db4f0c176875d9d49756b760d15211134 Mon Sep 17 00:00:00 2001 From: Alan Zimmerman Date: Fri, 6 Oct 2023 03:08:08 -0700 Subject: [PATCH] Update CONTRIBUTING.md to include grammar validation Summary: Explicitly mention that the grammar is used as the front-end for ELP, and that any change must not break the ability to run `cargo xtask codegen` in ELP. Reviewed By: perehonchuk Differential Revision: D50004829 fbshipit-source-id: f9525423922ebec69c366594a936f0c573a01ec2 --- CONTRIBUTING.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 15f7175..51a4c5c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,6 +17,33 @@ We actively welcome your pull requests. 3. Ensure the test suite passes. 4. If you haven't already, complete the Contributor License Agreement ("CLA"). +### Grammar Validation + +This grammar is used as the front end for the [Erlang Language Platform (ELP)](https://github.com/WhatsApp/erlang-language-platform). + +As part of this process, we generate an ELP AST structure from the generated `grammar.json` file. + +So a pull request will not be landed until it has matching changes in ELP. + +The most important thing is to check that the code generation does not +fail, as it imposes additional constraints on the shape of the grammar. + +Thes can be checked by + +1. Setting up an ELP development environment according it [CONTRIBUTING](https://github.com/WhatsApp/erlang-language-platform/blob/main/CONTRIBUTING.md) + +2. Updating + [Cargo.toml](https://github.com/WhatsApp/erlang-language-platform/blob/c4d3602e08418432a020abb734723727a8374549/Cargo.toml#L94) + to get the `tree-sitter-erlang` crate from your checked out changed `tree-sitter-erlang` repository. + +3. In the `ELP` repository, running `cargo xtask codegen`. If it succeeds + without errors, the grammar change is acceptable. + +4. For bonus points you can then `cargo build` ELP and deal with + changes induced by the grammar, but that is not necessary. + However, the change will not land until a matching change is made + to ELP by a contributor. + ## Contributor License Agreement ("CLA") In order to accept your pull request, we need you to submit a CLA. You only need