You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Even in a regular parsing flow (no recovery) such an error is less than useful for the grammar's end user. it is more of "development helper error".
Instead of throwing an error when we encounter an infinite loop we could simply gracefully
exit the repetition's loop and "carry on", this would resolve both issues described above:
No error would be thrown to break the error recovery flow.
If a syntax error would occur due to gracefully exiting the repetition, it would be a "regular"
syntax error with full position information so it would be much more useful for a grammar's end user.
The one disadvantage to this approach is that we would be losing the clear indication
of infinite loops for grammar developers. While this is unfortunate as long as we actually avoid the infinite loops than such grammar issues would still be far easier for grammar developers to debug versus the original situation which caused the infinite loop detection to be implemented.
The text was updated successfully, but these errors were encountered:
Chevrotain currently detects infinite loops in repetitions (MANY/AT_LEAST_ONE).
If this is detected an error will be thrown at runtime.
There are some problems with this approach:
Instead of throwing an error when we encounter an infinite loop we could simply gracefully
exit the repetition's loop and "carry on", this would resolve both issues described above:
syntax error with full position information so it would be much more useful for a grammar's end user.
The one disadvantage to this approach is that we would be losing the clear indication
of infinite loops for grammar developers. While this is unfortunate as long as we actually avoid the infinite loops than such grammar issues would still be far easier for grammar developers to debug versus the original situation which caused the infinite loop detection to be implemented.
The text was updated successfully, but these errors were encountered: