Closed priyeshshukla closed 4 years ago
I used your exact grammar and it works:
l = Lark(g, parser='lalr')
print(l.parse('pin (acc[0]) {a: 4;}'))
$ python issue598.py
Tree(group, [Tree(name, [Token(CNAME, 'pin')]), Tree(argument_list, [Tree(name, [Token(CNAME, 'acc')]), Tree(number, [Token(SIGNED_NUMBER, '0')])]), Tree(group_body, [Tree(simple_attribute, [Tree(name, [Token(CNAME, 'a')]), Tree(number, [Token(SIGNED_NUMBER, '4')])])])])
Please put more effort into your questions.
@priyeshshukla Could you share the full text you are trying to parse? I think that might be the problem.
UnexpectedCharacters: No terminal defined for '[' at line 531 col 15
Expecting: {'CNAME', 'RPAR', 'LBRACE', 'ESCAPED_STRING', 'DBLQUOTE', 'SEMICOLON', 'LPAR', 'COMMA', 'RBRACE', 'SIGNED_NUMBER', 'COLON'}
Previous tokens: Token(CNAME, 'acc')
I need help with this issue, using lark-parser for the first time. Played with grammar but maybe I am doing something wrong.
the grammar is below