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.

IndexError in parse_tree_builder.py, release 0.10.0

See original GitHub issue

Describe the bug

I’m trying to parse a snippet and I get this error:

contrib/python/lark-parser/lark/lark.py:438: in parse
    return self.parser.parse(text, start=start)
contrib/python/lark-parser/lark/parser_frontends.py:215: in parse
    return self._parse(text, start)
contrib/python/lark-parser/lark/parser_frontends.py:58: in _parse
    return self.parser.parse(input, start, *args)
contrib/python/lark-parser/lark/parsers/earley.py:320: in parse
    return transformer.transform(solutions[0])
contrib/python/lark-parser/lark/parsers/earley_forest.py:353: in transform
    self.visit(root)
contrib/python/lark-parser/lark/parsers/earley_forest.py:295: in visit
    vpno(current)
contrib/python/lark-parser/lark/parsers/earley_forest.py:417: in visit_packed_node_out
    transformed = self.transform_packed_node(node, self.data[id(node)])
contrib/python/lark-parser/lark/parsers/earley_forest.py:559: in transform_packed_node
    return self._call_rule_func(node, children)
contrib/python/lark-parser/lark/parsers/earley_forest.py:521: in _call_rule_func
    return self.callbacks[node.rule](data)
contrib/python/lark-parser/lark/parse_tree_builder.py:124: in __call__
    filtered = children[i].children
E   IndexError: list index out of range

I can’t figure out what’s wrong, could you help me please?

To Reproduce

l = Lark(open('golang.lark').read(), start='go_file', regex=True)
l.parse("""
package x
func evalFrameHash(frame FrameData) norm.Hash {
h := [4]byte{0x5b, 0xd1, 0xe9, 0x95}
for i, b := range frame.FrameData() {
    h[i%4] ^= b
}
return norm.Hash{Data: h}
""")

grammar is here https://gist.github.com/grihabor/2014488c65cde5a5ef71fd61c13a75d6

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
erezshcommented, Nov 16, 2020

Lark 0.11.0 has been released.

2reactions
erezshcommented, Nov 11, 2020

Probably next week.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix IndexError in Python - Rollbar
The IndexError in Python occurs when an item from a list is attempted to be accessed that is outside the index range of...
Read more >
Does "IndexError: list index out of range" when trying to ...
The IndexError is raised when you attempt to retrieve an index from a sequence, like a list or a tuple , and the...
Read more >
IndexError: list index out of range [BUG] · Issue #298 - GitHub
Please complete the following information: pySCENIC version: [0.11.2]; Installation method: [pip]; Run environment: [Jupyter notebook]; OS: [ ...
Read more >
Indexerror: list Index Out of Range in Python - STechies
List index out of range means index error in Python. It occurs when you try to access an index that is outside bounds...
Read more >
Python IndexError: List Index Out of Range Error Explained
In this tutorial, you'll learn how all about the Python list index out of range error, including what it is, why it occurs,...
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