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

feat: implement a new experimental concrete syntax tree type. #36

Merged
merged 3 commits into from
May 14, 2024

Conversation

peterhuene
Copy link
Collaborator

This commit adds a new concrete syntax tree type called SyntaxTree that is based on rowan for the underlying representation.

The tree is constructed via an infallible parse method that always returns a SyntaxTree along with a list of parse errors.

A Parser has also been added that takes WDL source and outputs a list of parser events that can be used to build a SyntaxTree.

Currently only version statements are being parsed in the V1 grammar; more grammar will be incrementally introduced in the future.

Additionally, new file-based tests have been added to the wdl-grammar crate; each test has a source.wdl input and a baseline CST and error list files to compare against. The baselines are easily updated by setting the BLESS environment variable and running the test.

All of the above if feature-gated behind the experimental feature of wdl-grammar.

Before submitting this PR, please make sure:

  • You have added a few sentences describing the PR here.
  • You have added yourself or the appropriate individual as the assignee.
  • You have added at least one relevant code reviewer to the PR.
  • Your code builds clean without any errors or warnings.
  • You have added an entry to the relevant CHANGELOG.md (see
    "keep a changelog" for more information).
  • Your commit messages follow the conventional commit style.
  • Your changes are squashed into a single commit (unless there is a really
    good, articulated reason as to why there shouldn be more than one).

@peterhuene peterhuene self-assigned this May 14, 2024
This commit adds a new concrete syntax tree type called `SyntaxTree` that is
based on `rowan` for the underlying representation.

The tree is constructed via an infallible `parse` method that always returns a
`SyntaxTree` along with a list of parse errors.

A `Parser` has also been added that takes WDL source and outputs a list of
parser events that can be used to build a `SyntaxTree`.

Currently only version statements are being parsed in the V1 grammar; more
grammar will be incrementally introduced in the future.

Additionally, new file-based tests have been added to the `wdl-grammar` crate;
each test has a `source.wdl` input and a baseline CST and error list files to
compare against. The baselines are easily updated by setting the `BLESS`
environment variable and running the test.

All of the above if feature-gated behind the `experimental` feature of
`wdl-grammar`.
This commit fixes the description of open brace and close brace tokens now that
they are no longer part of a `Display` implementation.
* Fix return type for `delimited` method.
* Fix implementation of `recover` method.
* Improve error messages slightly.
* Add a `require_in` method that requires the next token be in a set.
@peterhuene peterhuene merged commit 3d26c15 into stjude-rust-labs:main May 14, 2024
5 of 6 checks passed
@peterhuene peterhuene deleted the new-parser branch May 14, 2024 19:47
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.

None yet

2 participants