-
Notifications
You must be signed in to change notification settings - Fork 55
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
[DISCARDED] RFC: WIP: More detailed error reporting (reporting full failed expressions) #100
Conversation
# ########################################################################## | ||
# WIP: We have doubts about this behavior. To our understanding, | ||
# the parsing of OrderedChoice should not throw. | ||
# ########################################################################## |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution @mettta and @stanislaw. I think you are heading in the right direction but there is an issue that you have noticed (and was reported recently in #96) that needs to be handled before your work is integrated. I'm working on it and will do a detailed review of this PR when finished.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I just finished the work I've mentioned. Please rebase both your PRs on the master
to see if everything works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will rebase in just a few minutes. We are preparing one small commit on top of this patch that makes all previous tests pass as they were in the master branch (reporting only the non-matched expressions in a non-matched expression, not the whole expression). We are fixing the remaining tests and don't know yet how long this should take.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent. Thanks a lot! Just take your time. Nothing urgent here :)
This patch is more advanced compared to textX#100 The NoMatch class is made smarter and tracks the exact match errors. With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions. For example, for `Sequence`, the `SequenceNoMatch` class collects the failed expression as well as all previously matched (but failed) `Optional` expressions. The naming of `*NoMatch` certainly introduces some redundancy in the class names, however, without this measure I had hard time visualizing the internal structure of the failed expression to be printed.
This patch is more advanced compared to textX#100 The NoMatch class is made smarter and tracks the exact match errors. With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions. For example, for `Sequence`, the `SequenceNoMatch` class collects the failed expression as well as all previously matched (but failed) `Optional` expressions. The naming of `*NoMatch` certainly introduces some redundancy in the class names, however, without this measure I had hard time visualizing the internal structure of the failed expression to be printed. Open question: - Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example: ``` assert ( "Expected '4' at position (1, 15)" " or " "'five' at position (1, 20)" in str(e.value) ) ``` The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to control whether several `at position` strings have to be presented instead of a single `at position` at the end of the inspection message.
This patch is more advanced compared to textX#100 The NoMatch class is made smarter and tracks the exact match errors. With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions. For example, for `Sequence`, the `SequenceNoMatch` class collects the failed expression as well as all previously matched (but failed) `Optional` expressions. The naming of `*NoMatch` certainly introduces some redundancy in the class names, however, without this measure I had hard time visualizing the internal structure of the failed expression to be printed. Open question: - Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example: ``` assert ( "Expected '4' at position (1, 15)" " or " "'five' at position (1, 20)" in str(e.value) ) ``` The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to control whether several `at position` strings have to be presented instead of a single `at position` at the end of the inspection message.
This patch is more advanced compared to textX#100 The NoMatch class is made smarter and tracks the exact match errors. With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions. For example, for `Sequence`, the `SequenceNoMatch` class collects the failed expression as well as all previously matched (but failed) `Optional` expressions. The naming of `*NoMatch` certainly introduces some redundancy in the class names, however, without this measure I had hard time visualizing the internal structure of the failed expression to be printed. Open question: - Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example: ``` assert ( "Expected '4' at position (1, 15)" " or " "'five' at position (1, 20)" in str(e.value) ) ``` The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to control whether several `at position` strings have to be presented instead of a single `at position` at the end of the inspection message.
This patch is more advanced compared to textX#100 The NoMatch class is made smarter and tracks the exact match errors. With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions. For example, for `Sequence`, the `SequenceNoMatch` class collects the failed expression as well as all previously matched (but failed) `Optional` expressions. The naming of `*NoMatch` certainly introduces some redundancy in the class names, however, without this measure I had hard time visualizing the internal structure of the failed expression to be printed. Open question: - Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example: ``` assert ( "Expected '4' at position (1, 15)" " or " "'five' at position (1, 20)" in str(e.value) ) ``` The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to control whether several `at position` strings have to be presented instead of a single `at position` at the end of the inspection message.
This patch is more advanced compared to textX#100 The NoMatch class is made smarter and tracks the exact match errors. With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions. For example, for `Sequence`, the `SequenceNoMatch` class collects the failed expression as well as all previously matched (but failed) `Optional` expressions. The naming of `*NoMatch` certainly introduces some redundancy in the class names, however, without this measure I had hard time visualizing the internal structure of the failed expression to be printed. Open question: - Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example: ``` assert ( "Expected '4' at position (1, 15)" " or " "'five' at position (1, 20)" in str(e.value) ) ``` The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to control whether several `at position` strings have to be presented instead of a single `at position` at the end of the inspection message.
This patch is more advanced compared to textX#100 The NoMatch class is made smarter and tracks the exact match errors. With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions. For example, for `Sequence`, the `SequenceNoMatch` class collects the failed expression as well as all previously matched (but failed) `Optional` expressions. The naming of `*NoMatch` certainly introduces some redundancy in the class names, however, without this measure I had hard time visualizing the internal structure of the failed expression to be printed. Open question: - Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example: ``` assert ( "Expected '4' at position (1, 15)" " or " "'five' at position (1, 20)" in str(e.value) ) ``` The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to control whether several `at position` strings have to be presented instead of a single `at position` at the end of the inspection message.
This patch is more advanced compared to textX#100 The NoMatch class is made smarter and tracks the exact match errors. With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions. For example, for `Sequence`, the `SequenceNoMatch` class collects the failed expression as well as all previously matched (but failed) `Optional` expressions. The naming of `*NoMatch` certainly introduces some redundancy in the class names, however, without this measure I had hard time visualizing the internal structure of the failed expression to be printed. Open question: - Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example: ``` assert ( "Expected '4' at position (1, 15)" " or " "'five' at position (1, 20)" in str(e.value) ) ``` The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to control whether several `at position` strings have to be presented instead of a single `at position` at the end of the inspection message.
This patch is more advanced compared to textX#100 The NoMatch class is made smarter and tracks the exact match errors. With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions. For example, for `Sequence`, the `SequenceNoMatch` class collects the failed expression as well as all previously matched (but failed) `Optional` expressions. The naming of `*NoMatch` certainly introduces some redundancy in the class names, however, without this measure I had hard time visualizing the internal structure of the failed expression to be printed. Open question: - Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example: ``` assert ( "Expected '4' at position (1, 15)" " or " "'five' at position (1, 20)" in str(e.value) ) ``` The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to control whether several `at position` strings have to be presented instead of a single `at position` at the end of the inspection message.
This patch is more advanced compared to textX#100 The NoMatch class is made smarter and tracks the exact match errors. With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions. For example, for `Sequence`, the `SequenceNoMatch` class collects the failed expression as well as all previously matched (but failed) `Optional` expressions. The naming of `*NoMatch` certainly introduces some redundancy in the class names, however, without this measure I had hard time visualizing the internal structure of the failed expression to be printed. Open question: - Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example: ``` assert ( "Expected '4' at position (1, 15)" " or " "'five' at position (1, 20)" in str(e.value) ) ``` The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to control whether several `at position` strings have to be presented instead of a single `at position` at the end of the inspection message.
This patch is more advanced compared to textX#100 The NoMatch class is made smarter and tracks the exact match errors. With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions. For example, for `Sequence`, the `SequenceNoMatch` class collects the failed expression as well as all previously matched (but failed) `Optional` expressions. The naming of `*NoMatch` certainly introduces some redundancy in the class names, however, without this measure I had hard time visualizing the internal structure of the failed expression to be printed. Open question: - Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example: ``` assert ( "Expected '4' at position (1, 15)" " or " "'five' at position (1, 20)" in str(e.value) ) ``` The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to control whether several `at position` strings have to be presented instead of a single `at position` at the end of the inspection message.
This patch is more advanced compared to textX#100 The NoMatch class is made smarter and tracks the exact match errors. With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions. For example, for `Sequence`, the `SequenceNoMatch` class collects the failed expression as well as all previously matched (but failed) `Optional` expressions. The naming of `*NoMatch` certainly introduces some redundancy in the class names, however, without this measure I had hard time visualizing the internal structure of the failed expression to be printed. Open question: - Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example: ``` assert ( "Expected '4' at position (1, 15)" " or " "'five' at position (1, 20)" in str(e.value) ) ``` The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to control whether several `at position` strings have to be presented instead of a single `at position` at the end of the inspection message.
This patch is more advanced compared to textX#100 The NoMatch class is made smarter and tracks the exact match errors. With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions. For example, for `Sequence`, the `SequenceNoMatch` class collects the failed expression as well as all previously matched (but failed) `Optional` expressions. The naming of `*NoMatch` certainly introduces some redundancy in the class names, however, without this measure I had hard time visualizing the internal structure of the failed expression to be printed. Open question: - Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example: ``` assert ( "Expected '4' at position (1, 15)" " or " "'five' at position (1, 20)" in str(e.value) ) ``` The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to control whether several `at position` strings have to be presented instead of a single `at position` at the end of the inspection message.
This patch is more advanced compared to textX#100 The NoMatch class is made smarter and tracks the exact match errors. With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions. For example, for `Sequence`, the `SequenceNoMatch` class collects the failed expression as well as all previously matched (but failed) `Optional` expressions. The naming of `*NoMatch` certainly introduces some redundancy in the class names, however, without this measure I had hard time visualizing the internal structure of the failed expression to be printed. Open question: - Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example: ``` assert ( "Expected '4' at position (1, 15)" " or " "'five' at position (1, 20)" in str(e.value) ) ``` The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to control whether several `at position` strings have to be presented instead of a single `at position` at the end of the inspection message.
This patch is more advanced compared to textX#100 The NoMatch class is made smarter and tracks the exact match errors. With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions. For example, for `Sequence`, the `SequenceNoMatch` class collects the failed expression as well as all previously matched (but failed) `Optional` expressions. The naming of `*NoMatch` certainly introduces some redundancy in the class names, however, without this measure I had hard time visualizing the internal structure of the failed expression to be printed. Open question: - Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example: ``` assert ( "Expected '4' at position (1, 15)" " or " "'five' at position (1, 20)" in str(e.value) ) ``` The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to control whether several `at position` strings have to be presented instead of a single `at position` at the end of the inspection message.
This patch is more advanced compared to textX#100 The NoMatch class is made smarter and tracks the exact match errors. With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions. For example, for `Sequence`, the `SequenceNoMatch` class collects the failed expression as well as all previously matched (but failed) `Optional` expressions. The naming of `*NoMatch` certainly introduces some redundancy in the class names, however, without this measure I had hard time visualizing the internal structure of the failed expression to be printed. Open question: - Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example: ``` assert ( "Expected '4' at position (1, 15)" " or " "'five' at position (1, 20)" in str(e.value) ) ``` The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to control whether several `at position` strings have to be presented instead of a single `at position` at the end of the inspection message.
This patch is more advanced compared to textX#100 The NoMatch class is made smarter and tracks the exact match errors. With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions. For example, for `Sequence`, the `SequenceNoMatch` class collects the failed expression as well as all previously matched (but failed) `Optional` expressions. The naming of `*NoMatch` certainly introduces some redundancy in the class names, however, without this measure I had hard time visualizing the internal structure of the failed expression to be printed. Open question: - Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example: ``` assert ( "Expected '4' at position (1, 15)" " or " "'five' at position (1, 20)" in str(e.value) ) ``` The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to control whether several `at position` strings have to be presented instead of a single `at position` at the end of the inspection message.
This patch is more advanced compared to textX#100 The NoMatch class is made smarter and tracks the exact match errors. With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions. For example, for `Sequence`, the `SequenceNoMatch` class collects the failed expression as well as all previously matched (but failed) `Optional` expressions. The naming of `*NoMatch` certainly introduces some redundancy in the class names, however, without this measure I had hard time visualizing the internal structure of the failed expression to be printed. Open question: - Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example: ``` assert ( "Expected '4' at position (1, 15)" " or " "'five' at position (1, 20)" in str(e.value) ) ``` The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to control whether several `at position` strings have to be presented instead of a single `at position` at the end of the inspection message.
This patch is more advanced compared to textX#100 The NoMatch class is made smarter and tracks the exact match errors. With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions. For example, for `Sequence`, the `SequenceNoMatch` class collects the failed expression as well as all previously matched (but failed) `Optional` expressions. The naming of `*NoMatch` certainly introduces some redundancy in the class names, however, without this measure I had hard time visualizing the internal structure of the failed expression to be printed. Open question: - Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example: ``` assert ( "Expected '4' at position (1, 15)" " or " "'five' at position (1, 20)" in str(e.value) ) ``` The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to control whether several `at position` strings have to be presented instead of a single `at position` at the end of the inspection message.
Closing this in favour of the more advanced (and correct) #102. |
This patch is more advanced compared to textX#100 The NoMatch class is made smarter and tracks the exact match errors. With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions. For example, for `Sequence`, the `SequenceNoMatch` class collects the failed expression as well as all previously matched (but failed) `Optional` expressions. The naming of `*NoMatch` certainly introduces some redundancy in the class names, however, without this measure I had hard time visualizing the internal structure of the failed expression to be printed. Open question: - Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example: ``` assert ( "Expected '4' at position (1, 15)" " or " "'five' at position (1, 20)" in str(e.value) ) ``` The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to control whether several `at position` strings have to be presented instead of a single `at position` at the end of the inspection message.
This patch is more advanced compared to textX#100 The NoMatch class is made smarter and tracks the exact match errors. With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions. For example, for `Sequence`, the `SequenceNoMatch` class collects the failed expression as well as all previously matched (but failed) `Optional` expressions. The naming of `*NoMatch` certainly introduces some redundancy in the class names, however, without this measure I had hard time visualizing the internal structure of the failed expression to be printed. Open question: - Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example: ``` assert ( "Expected '4' at position (1, 15)" " or " "'five' at position (1, 20)" in str(e.value) ) ``` The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to control whether several `at position` strings have to be presented instead of a single `at position` at the end of the inspection message.
This patch is more advanced compared to textX#100 The NoMatch class is made smarter and tracks the exact match errors. With this design, reporting an error translates to printing the diagnostics of all failed subexpressions of a failed expressions. For example, for `Sequence`, the `SequenceNoMatch` class collects the failed expression as well as all previously matched (but failed) `Optional` expressions. The naming of `*NoMatch` certainly introduces some redundancy in the class names, however, without this measure I had hard time visualizing the internal structure of the failed expression to be printed. Open question: - Is this desirable that in case of ordered choices, we could print not only the winning match but all matches that are equally possible, as in this example: ``` assert ( "Expected '4' at position (1, 15)" " or " "'five' at position (1, 20)" in str(e.value) ) ``` The advantage of this approach would be that a user sees all alternatives that are possible in cases like this. The cost: the implementation has to control whether several `at position` strings have to be presented instead of a single `at position` at the end of the inspection message.
Hello,
This is our (@mettta and @stanislaw) attempt to make a step towards more precise error reporting.
This slightly more simple implementation at first sacrifices some of the previous capabilities, such as "not reporting the whole failed expression, but only it's failed part". However, these capabilities can be implemented outside the
_nm_raise
method.I would be curious to hear from you if you consider this to be going to the right direction. In the meantime, I would like to focus on implementing this capability given the direction taken in this patch:
Code review checklist
CHANGELOG.md
, no needto update for typo fixes and such).