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.

incorrect ignore behavior

See original GitHub issue

Hi Erez,

Given a grammar like this:

sudo_parser = Lark(r"""
    sudo_item : CNAME*

    %import common.CNAME
    %import common.WS
    %ignore /[\\\\]$/m
    %ignore /^#.*\n/m
    %ignore /^Defaults.*$/m
    %ignore WS
""", start='sudo_item')

This input works:

# ======> BEGINNING OF sudoers.d/00_Cmnd_Aliases

This doesn’t:

# ======> BEGINNING OF sudoers.d/00_Cmnd_Aliases
#New aliases

I’m using the master branch.

Note that if I use $ in the comment pattern, neither the first, nor the second case work. Let me know if I’m doing something wrong.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
gerasescommented, Nov 19, 2017

Cool! Confirming the fix! Thanks much.

0reactions
erezshcommented, Nov 20, 2017

When I run it, it seems just fine. If you’re encountering a problem, it’s probably because your grammar is ambiguous (it can be parsed in more than one correct way), and the latest commit has shifted the default interpretation.

Try instanciating Lark with Lark(..., ambiguity='explicit') to see all the possible interpretations. If one of them is incorrect (or undesirable), you have two options:

  1. Correct the grammar to allow only the desirable interpretation (the recommended way)
  2. Get the full tree, and choose the correct one yourself.

Let me know if this helps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ignoring a wrong behavior is not much different than endorsing it
Exactly. Ignoring a wrong behavior is not much different than endorsing it. It is also similar to being neutral in a situation. It...
Read more >
Ignoring: An Effective Way to Change Some Behaviors
The basic principle behind ignoring is: "To stop a child from acting in a particular way, arrange conditions so that the child will...
Read more >
Ignoring | Consequences | Essentials | Parenting Information
Ignoring usually helps stop behaviors that your child is using to get your attention. This includes behaviors like throwing tantrums, whining, and interrupting....
Read more >
What Is Planned Ignoring? Examples Of Extinction Behavior
The procedure of planned ignoring involves deliberate parental inattention to the occurrence of target child behaviors.
Read more >
Using Planned Ignoring | Classroom Check-Up
Effective planned ignoring can help students unlearn problem behaviors that obtain attention and, when paired with positive attention, teaches them more ...
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