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 IRJ parser for Menhir new error handling #240

Merged
merged 31 commits into from
Jun 26, 2024

Conversation

mdurero
Copy link
Collaborator

@mdurero mdurero commented Jun 13, 2024

As stated in #238, traditionnal error handling is deprecated in favor of a flexible approach using Menhir incremental API.

Close #238

@mdurero
Copy link
Collaborator Author

mdurero commented Jun 13, 2024

The current architecture is kind of underwhelming.

On the one hand I would find satisfying to merge the parse_file and dummy_parse_file_with_incremental in a unique parser entry point, to reuse the lexbuf for instance.
On the other hand, in Mlang interpreter context and other "not validation" ones, do we want the full two pass parser to be called when the first pass would be enough ?

Yes, writing it I just realise that the second pass is called only on errors, so it doesn’t slow the interpreter in a right case. But I keep the question as my problem is more than both pass have a very distinct behaviour. The second pass prints on error output in all cases.

So at the end, my proposition would be:

  • modify second pass to create a proper error type with its message, but do nothing with it,
  • the irj_checker displays all errors,
  • other context like the interpreter can choose to not do that and fail silently, or be less verbose.

At the end, I feel like irj_checker could also almost be just a wrapper calling parse_file with a verbose flag…

@mdurero mdurero marked this pull request as ready for review June 20, 2024 14:14
@mdurero
Copy link
Collaborator Author

mdurero commented Jun 20, 2024

I think we should slow the work on the json generator and focus on the polish on file validation to merge it soon.

@mdurero mdurero marked this pull request as draft June 20, 2024 14:16
@denismerigoux denismerigoux marked this pull request as ready for review June 26, 2024 11:58
Copy link
Contributor

@denismerigoux denismerigoux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, let's merge!

@denismerigoux denismerigoux merged commit af983c3 into master Jun 26, 2024
1 check passed
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.

Menhir "error" token is deprecated
2 participants