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

Parse comments #1838

Merged
merged 21 commits into from
May 12, 2024
Merged

Parse comments #1838

merged 21 commits into from
May 12, 2024

Conversation

byorgey
Copy link
Member

@byorgey byorgey commented May 11, 2024

Towards #1467. This is incomplete but I thought it would be useful to split up the work into multiple PRs to avoid having a really massive one at the end.

This PR accomplishes a few things:

  • Creates a new data type Comment to record the text of a comment, along with a bit of metadata giving its source location, whether it is a line or block comment, and whether it was on a line by itself or at the end of a line with some other non-comment tokens (this information will be used to decide which AST node to associate the comment with).
  • Adds a field to store comments in every Syntax' node. Note this is currently unused, since we haven't yet implemented the logic to insert comments into appropriate AST nodes (that will come in a later PR).
    • Note it's a bit annoying that the number of fields of each Syntax' node is growing. I did look into consolidating and generalizing Syntax' to just have a single field for arbitrary annotations, but the changes required seemed annoying enough that I didn't want to bother.

@byorgey byorgey marked this pull request as ready for review May 11, 2024 20:25
Co-authored-by: Restyled.io <commits@restyled.io>
@byorgey byorgey marked this pull request as draft May 11, 2024 20:25
@byorgey byorgey changed the title [WIP] preserve comments Parse comments May 11, 2024
@byorgey byorgey marked this pull request as ready for review May 11, 2024 20:57
@byorgey byorgey requested a review from kostmo May 11, 2024 20:58
src/swarm-lang/Swarm/Language/Parse.hs Outdated Show resolved Hide resolved
@byorgey byorgey added the merge me Trigger the merge process of the Pull request. label May 12, 2024
@mergify mergify bot merged commit 4bd409d into main May 12, 2024
11 checks passed
@mergify mergify bot deleted the feature/preserve-comments branch May 12, 2024 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge me Trigger the merge process of the Pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants