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.

How to rule/terminal priority works

See original GitHub issue

Hello,

I have the following grammar:

    Lark(r"""
    documento: PALABRA+ monto PALABRA+
    monto: SIGNO ENTERO 
    SIGNO: "$" INT    
    ENTERO.5: INT+    
    PALABRA.1: /[^\s]+/
    """, start='documento', parser="earley", lexer="dynamic", ambiguity="resolve")

The priority does not work in the last grammar, the curious is the priority works in the following code

Lark(r"""
documento:PALABRA+ acciondemandante PALABRA+
    acciondemandante: PALABRASDEMANDA informacionentidad+
     PALABRASDEMANDA: "demandante"i                
  informacionentidad: nombres distancia identificacion
             nombres: NOMBRE+ 
              NOMBRE: NOMBRENORMAL+
        NOMBRENORMAL: (UCASE_LETTER LCASE_LETTER+)
           distancia: CONECTOR~0..3
            CONECTOR: LCASE_LETTER+
    identificacion.5: tipo INT+
                tipo: (LCASE_LETTER | UCASE_LETTER) (LCASE_LETTER | UCASE_LETTER)
           PALABRA.1: /.+/

    """, start='documento', parser="earley", lexer="dynamic", ambiguity="resolve")

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
erezshcommented, Oct 25, 2018

Hi, The current Earley implementation supports rule priority, but not terminal priority.

LALR supports terminal priority but not rule priority.

There are reasons! But it’s also something I hope to correct in the future.

0reactions
erezshcommented, Oct 25, 2018

I think plain old regular expressions will solve your problem very easily.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Timing and priority - MTG Wiki - Fandom
Priority is the right to cast a spell, activate an ability, or take a special action. Players can't cast spells, activate abilities or...
Read more >
Grammar Reference - Lark documentation - Read the Docs
Like terminals, rules can be assigned a priority. Rule priorities are signed integers with a default value of 0. When using LALR, the...
Read more >
ip route prefix-priority-scheduler - Huawei Support
The ip route prefix-priority-scheduler command sets the priority-based scheduling weight of IPv4 routes. The undo ip route prefix-priority-scheduler command ...
Read more >
Chapter 7. Running - JBoss.org
LIFO priorities are based on the assigned Working Memory Action counter value, with all rules created during the same action receiving the same...
Read more >
PRIORITY Explained! NO MORE FAKE RULES - YouTube
yugioh #FakeRules #priorityThanks for supporting me Patreon: https://www.patreon.com/msttvJoin the Discord: https://discord.gg/zMUuD49== ...
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