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

Refactor transcript parser #5235

Merged
merged 2 commits into from
Jul 19, 2024

Conversation

sellout
Copy link
Contributor

@sellout sellout commented Jul 17, 2024

Overview

This cleans up and reorganizes some of the transcript parsing/running code after #5204.

It is mostly a refactor, except that it does fix one issue I had in #5204, which was the need to use Text.init when parsing some fenced blocks. I managed to remove that here, and that resulted in a minor (but correct, I think) change to a couple transcript outputs, where an parsing EOF error was reported on the wrong line.

Test coverage

Every transcript tests this.

Loose ends

There is still some complexity and coupling in here, but I don’t think it’s worth spending time on at the moment.

A bunch of small changes in TranscriptParser

- remove dead code
- don’t use `Show` for formatted output
- put processed blocks in a separate sum type from unprocessed blocks
- remove `Transcript` from identifiers (changed importers to use
 `qualified as Transcript`)
- deduplicated some error reporting

And one happy fix, IMO – got rid of the `Text.init` that plagued me in
- `Transcript` – the data model
- `Transcript.Parser` – the parser and printer
- `Transcript.Runner` – the runner

There is unfortunately still some printing tightly coupled to the
runner, but this makes it more obvious. Also, the runner is the only
component tied to the CLI.
@sellout sellout requested a review from aryairani July 17, 2024 01:40
@aryairani aryairani merged commit ef62cd9 into unisonweb:trunk Jul 19, 2024
20 checks passed
@sellout sellout deleted the refactor-transcript-parser branch August 15, 2024 05:50
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