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.

Recovery Re-Sync logic ignores Token Categories

See original GitHub issue

It seems the tokenMatcher function is not used which means the token categories are not handled properly.

Example:

Possibly also affects this:

This may cause the Parser to re-sync (throw out) more input than needed to recover.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
AlansCodeLogcommented, Jan 25, 2021

Edit: Nevermind, I think the problem was something else and also maybe I misunderstood how the recovery is supposed to work*, but, I got things working again and recovering how I wanted. <strike> Just ran into this. I’m writing a parser that takes both symbol and non-symbol operators, so they are distinct token types (since the word operators must use longer_alt but not the symbol ones), but the operators have a category to be able to consume them since MANY_SEP won’t take rules, unfortunately using it leads to this issue.

The following workaround works but is very wordy since DEF must be written twice.

// $.MANY_SEP({ SEP: OPERATOR_AND, DEF })
$.OR([
	{
		GATE: () => $.LA(2).tokenType === SYM_AND,
		ALT: () => $.MANY_SEP({ SEP: SYM_AND, DEF }),
	},
	{
		GATE: () => $.LA(2).tokenType !== SYM_AND,
		ALT: () => $.MANY_SEP2({ SEP: WORD_AND, DEF2 })
	},
])

Is there any danger in just using js control flows like this if it seems to work?

if ($.LA(2).tokenType === SYM_AND) {
	$.MANY_SEP({ SEP: SYM_AND, DEF })
} else {
	$.MANY_SEP({ SEP: WORD_AND, DEF })
}
</strike>
0reactions
bd82commented, Jan 31, 2022

I will see where I can contribute.

Awesome 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

changes/CHANGELOG.md - Chevrotain
A resolved performance related bug and a couple of new micro optimizations have produced minor performance improvements in the JSON(5%) and CSS(15%) benchmarks....
Read more >
rsync(1) - Linux manual page - man7.org
By default, rsync works silently. A single -v will give you information about what files are being transferred and a brief summary at...
Read more >
Transaction locking and row versioning guide - SQL Server
This guide describes the locking and row versioning mechanisms the SQL Server Database Engine uses to ensure the physical integrity of each ...
Read more >
Troubleshooting Geo - GitLab Docs
Sync status Rake task ... An unsupported replication method was used (for example, logical replication) ... On a Geo primary site this error...
Read more >
Configuring and managing high availability clusters Red Hat ...
You can determine the behavior of a resource in a cluster by configuring constraints. You can configure the following categories of constraints: location ......
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