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

Consolidate PandocParseError/PandocParsecError #8382

Closed
jgm opened this issue Oct 17, 2022 · 1 comment · Fixed by #8385
Closed

Consolidate PandocParseError/PandocParsecError #8382

jgm opened this issue Oct 17, 2022 · 1 comment · Fixed by #8385
Labels

Comments

@jgm
Copy link
Owner

jgm commented Oct 17, 2022

A drawback of the PandocParsecError constructor is that it includes a Parsec type; this makes it impossible to use it with other parsers. It would be good to eliminate this dependence of T.P.Error on Parsec.

Suggestion: Add to PandocParseError some (perhaps optional) fields for sourcename, line, and column, and maybe for the snippet from sources where the error occurs.
Use this where we currently use PandocParsecError

We can take the code currently in rendereError for PandocParsecError and create a helper function for creating a PandocParseError.

@jgm jgm added bug API and removed bug labels Oct 17, 2022
@jgm
Copy link
Owner Author

jgm commented Oct 17, 2022

Another option would be to create a module that provides (parsec's) SourcePos, so we can use it in T.P.Error and T.P.Logging without directly importing parsec.

jgm added a commit that referenced this issue Oct 18, 2022
T.P.Parsing now exports `fromParsecError`, which can be used
to turn a parsec ParseError into a regular PandocParseError
(the appearance to the user should be unchanged in every case).

[API change]

Closes #8382.
@jgm jgm closed this as completed in #8385 Oct 18, 2022
jgm added a commit that referenced this issue Oct 18, 2022
)

Henceforth we just use `PandocParseError`.

T.P.Parsing now exports `fromParsecError`, which can be used
to turn a parsec ParseError into a regular PandocParseError
(the appearance to the user should be unchanged in every case).

[API change]

Closes #8382.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant