question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add error recovery mode?

See original GitHub issue

In 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 and col of recovery starting point
    • delete recovery starting point (so we return current valid token next time)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
tjvrcommented, Jul 21, 2017

Here are some suggestions:

  1. We recommend not implementing error recovery as part of your lexer (as @nathan says).
  2. Since keyword handling is now explicit (#57), your excerpt from above should now behave as expected.
  3. If you really want to do this, I think the right place is another library on top of moo; not in the moo core itself. Sorry! 😃
0reactions
tjvrcommented, Jul 19, 2017

the whole line } // comment gets parsed as invalid which doesn’t match rCurly.

Argh. I knew making keyword handling implicit would be a bad idea. Perhaps this is another reason to make keyword handling explicit (#53).

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found