lark-parser / Lark.js

Live port of Lark's standalone parser to Javascript
MIT License
71 stars 12 forks source link

Unnecessary options "_plugins" included in the generated parser #13

Closed jillyj closed 2 years ago

jillyj commented 2 years ago

When I tried lark-js to generate the parser from .lark file, the parser includes "_plugins": {} in to the parser file which resulted to the console error.

Grammar file: https://github.com/opencybersecurityalliance/kestrel-lang/blob/develop/src/kestrel/syntax/kestrel.lark[](https://user-images.githubusercontent.com/47232763/155667411-4bba3c14-846f-4082-882d-65645eceb8f5.png)

image

erezsh commented 2 years ago

Fixed and released as version 0.1.1

jillyj commented 2 years ago

I tried against 0.11, but still got the _plugins in the generated parser file in the var DATA object. Would you please check again? image

erezsh commented 2 years ago

I wasn't trying to remove _plugins. But the latest version should work even when it's there.

jillyj commented 2 years ago

But I still got the same console error with the generated parser with version 0.1.1.

jillyj commented 2 years ago

This is what I got from the json_parser.js created by json.lark in the example folder. image

erezsh commented 2 years ago

Are you sure you're using the latest Lark.js? Did you install it with pip install -U lark-js ?

erezsh commented 2 years ago

Afterwards, you also need to use it to regenerate the js parser, of course.

jillyj commented 2 years ago

Oh, you are right. I installed the updated version to wrong python venv. Now it works! Thank you!