State becomes broken after failure
See original GitHub issueimport 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:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Good catch! Pushed a fix to
master
Oh yeah… My bad. Fixed it now, thanks!