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.

recoveryEnabled Issue

See original GitHub issue

Simple example has unexpected results, either:

  • Incorrect parsing
  • A missing value for: recoveredNode

Tokens:

export const ID = createTok({ name: "ID", pattern: /[_a-zA-Z]\w+/ });
export const Assign = createTok({ name: "Assign", pattern: /:=/ });
export const String = createTok({ name: "String", pattern: /([xDQUV]?'([^'\\]*(?:\\.[^'\\]*)*)')/ });

Parser:

        $.RULE("program", () => {
            $.CONSUME(ID);
            $.CONSUME(Assign);
            $.CONSUME(String);
        });

Test String:

aaa bbb :=  'Hello';

When recoveryEnabled is false there is no parsed output (as expected). When recoveryEnabled is true it produces the following cst:

{
  "name": "program",
  "children": {
    "ID": [
      {
        "image": "aaa",
...
      }
    ],
    "Assign": [
      {
        "image": ":=",
...
      }
    ],
    "String": [
      {
        "image": "'Hello'",
...
      }
    ]
  },
  "recoveredNode": undefined
}

When I would have expected:

{
  "name": "program",
  "children": {
    "ID": [
      {
        "image": "bbb",
...
      }
    ],
    "Assign": [
      {
        "image": ":=",
...
      }
    ],
    "String": [
      {
        "image": "'Hello'",
...
      }
    ]
  },
  "recoveredNode": undefined
}

Or:

{
  "name": "program",
  "children": {
    "ID": [
      {
        "image": "aaa",
...
      }
    ],
    "Assign": [
      {
        "image": ":=",
...
      }
    ],
    "String": [
      {
        "image": "'Hello'",
...
      }
    ]
  },
  "recoveredNode": true
}

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
bd82commented, Mar 10, 2020

Hello @GordonSmith

I don’t see a problem with the CST that was outputted.

What is happening here is single token deletion as described here:

This is why the bbb is removed, as the parsing and heuristic is mostly greedy.

  • First aaa is consumed to match the ID
  • Then bbb is encountred while trying to consume an Assign
  • The next token is indeed an assign so the bbb is skipped.

The recoveredNode is related to re-sync error recovery see more docs on this here:

Note that you may need to modify how error recovery works in your specific grammar for optimal results, its just a set of greedy heuristics, it is not expected to be the best for all grammars, some examples:

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix a "Stuck in Automatic Repair" Loop in Windows 10
Here's what to do when the tool that's meant to repair issues ends up creating ... Check the values for identifier and recoveryenabled....
Read more >
7 Ways Fix – Stuck in Windows Automatic Repair loop!
7 Methods For Fixing The Automatic Repair Windows 10 Loop · In Command Prompt, type bcdedit /set {default} recoveryenabled No and press Enter....
Read more >
How to fix automatic repair loop in Windows 10 - IT PRO
These tips will help you fix the issue. ... type “bcdedit /set {current} recoveryenabled No” and hit “Enter” (this command deletes problematic system...
Read more >
How to Fix the Automatic Repair Loop in Windows 8.1
Restart the computer and the computer should boot normally. Solution 3. Running check disk to see if your hard drive is the problem....
Read more >
How To Fix "Windows Automatic Repair Not Working" [SOLVED]
How to fix this issue? ... Run Chkdsk Command to Fix Hard Disk & File System Issues ... bcdedit /set {default} recoveryenabled No....
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