c4deszes / ldfparser

LIN Description File parser written in Python
https://c4deszes.github.io/ldfparser/
MIT License
64 stars 26 forks source link

Support parsing ldf file with Only master ECU no slave ECUs included #95

Closed FersiMajd closed 2 years ago

FersiMajd commented 2 years ago

When parsing ldf file that contains only Master ECU, the script shows an error and skips the file. While it's not an error the file is valid and should be parsed.

c4deszes commented 2 years ago

Could you provide more information?

FersiMajd commented 2 years ago
c4deszes commented 2 years ago

This is an "issue" with the grammar, in the nodes group the slaves field is mandatory both according to the standard and this library.

I've created a branch that makes this part optional, you can install it using: pip install git+https://github.com/c4deszes/ldfparser.git@feature/optional-nodes, this is using 0.14.0 but it should be easy to backport to 0.10.0. In the lark file a lot of fields could be made optional, in this case though the LdfTransformer had to be modified as well.

In the future error handling will be better shared between the grammar and the parser, but as long as you're only using the library to convert the LDF to JSON this wouldn't affect you. These parts in particular will likely be optional but with the parser raising an error at the end that can be suppressed.

If you need this ported to 0.10.0 or have further issues parsing your LDF let me know, otherwise you could close this issue.