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.

State becomes broken after failure

See original GitHub issue
import lark
import lark.indenter

class PythonIndenter(lark.indenter.Indenter):
    NL_type = '_NEWLINE'
    OPEN_PAREN_types = ['LPAR', 'LSQB', 'LBRACE']
    CLOSE_PAREN_types = ['RPAR', 'RSQB', 'RBRACE']
    INDENT_type = '_INDENT'
    DEDENT_type = '_DEDENT'
    tab_len = 8

# This is workaround.
#    def process(self, stream):
#        lark.indenter.Indenter.__init__(self)
#        yield from lark.indenter.Indenter.process(self, stream)

parser = lark.Lark.open('python3.lark', parser='lalr', start='file_input', postlex=PythonIndenter())

c = """
for i in ssss.sss:
    print(i)
        print(i)
"""

try:
    tree = parser.parse(c)
except:
    pass

c = """
for i in ssss.sss:
    print(i)
"""
tree = parser.parse(c)
print(tree)

I guess this code is self-describing. After a failure, parser breaks itself (but there is a workaround).

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
erezshcommented, Jan 31, 2019

Good catch! Pushed a fix to master

0reactions
erezshcommented, Feb 1, 2019

Oh yeah… My bad. Fixed it now, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed state - Wikipedia
A failed state is a political body that has disintegrated to a point where basic conditions and responsibilities of a sovereign government no...
Read more >
failed state | government - Encyclopedia Britannica
A failed state is composed of feeble and flawed institutions. Often, the executive barely functions, while the legislature, judiciary, bureaucracy, and armed ...
Read more >
What happens to a state after it fails? - Quora
A state fails whenever whatever was holding it together falls apart. The binding thing may be language, religion, tribe or a strong leader...
Read more >
Failed States, Collapsed States, Weak States
Nation-states fail because they are convulsed by internal violence and can no longer deliver positive political goods to their inhabitants. Their govern-.
Read more >
Fail to Known State - Glossary | CSRC
Failure in a known safe state helps to prevent systems from failing to a state that may cause injury to individuals or destruction...
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