Lark: IndexError in parse_tree_builder.py, release 0.10.0

Created on 11 Nov 2020  路  7Comments  路  Source: lark-parser/lark

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

Most helpful comment

Lark 0.11.0 has been released.

All 7 comments

Please try the master version and see if it helps.

I can't reproduce. Please make sure that you are actually using the most recent version (e.g. it should be 0.10.1).

@MegaIng As I can tell the latest release is 0.10.0

@erezsh master works, thank you! When the next release is coming?

Probably next week.

Cool. This looks like the same problem I reported in Gitter.

Close this issue?

Lark 0.11.0 has been released.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

evandrocoan picture evandrocoan  路  6Comments

ius picture ius  路  4Comments

Michael0x2a picture Michael0x2a  路  6Comments

shewitt-au picture shewitt-au  路  3Comments

aravindkumaremis picture aravindkumaremis  路  6Comments