Add error recovery mode?
See original GitHub issueIn my language, lines with invalid stuff are considered comments. I know, insane, but I’d like to support that if possible. Currently, { error: true }
is extremely greedy and considers everything from the first error to be a single token.
I propose an optional error tolerance mode that can be enabled with { error: true, recover: true }
:
- if can’t parse a token starting with current position position:
- if not already in recovery mode, save current position as recovery starting point
- increment position (skip current character)
- if can parse a token && recovery starting point exists:
- return a token with name of error token type,
line
andcol
of recovery starting point - delete recovery starting point (so we return current valid token next time)
- return a token with name of error token type,
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
If you can't update or restore your iPhone or iPod touch
If you can't update or restore your iPhone or iPod touch. You can put your iOS device in recovery mode, then restore it...
Read more >Windows 10 - Login Screen Error Recovery Mode
Has anyone seen the Error Recovery Mode message on the login screen for Windows 10 (see below)? If so, what can be done...
Read more >Safe mode & recovery mode on Android | T-Mobile Support
Safe mode is designed to help you find problems with your apps and widgets, but it disables parts of your phone. Pressing or...
Read more >WordPress Recovery Mode: What Is It and How to Use It to Fix ...
WordPress recovery mode helps you fix fatal errors on your site. Learn how to access recovery mode and how you can use it...
Read more >Error Recovery Strategies in Compiler Design - GeeksforGeeks
Thus, in panic mode recovery a considerable amount of input checking is for additional errors. If there is less number of errors in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Here are some suggestions:
Argh. I knew making keyword handling implicit would be a bad idea. Perhaps this is another reason to make keyword handling explicit (#53).