EFeru / DbcParser

.NET CAN bus dbc file parser
MIT License
76 stars 28 forks source link

#47 Fixed enum assignment by index #48

Closed Brainy0207 closed 1 year ago

Brainy0207 commented 1 year ago

It seems like dbc files reference the enum value by index. Changed the parser logic to pass the quoted strings to handle both cases correctly and added an additional test.

Fixes #47

EFeru commented 1 year ago

Thank you for your contribution @Brainy0207 I will do a quick review and merge soon.

Adhara3 commented 1 year ago

Hi @Brainy0207,

thanks for the contribution and for spotting the issue. However I think there is room for improvement, your proposed solution is breaking the responsibility chain, IMHO. The parsing related logic (i.e. syntax related stuff or string manipulation) should stay in the (line) parser and should not leak deeper into the builder or even further into the property value and/or definition. Moreover, analysing code we realised that we are a bit loose on other properties, e.g. we are accepting for an int property a value of "3" which should not happen, that is a string not an int.

We are then reworking a bit and refactoring also adding to the IParseFailureObserver the methods to notify the user among others:

Thanks again for your contribution, it was a very helpful hint to improve code and parsing Feel free to review and comment our PR as soon as we push it.

A

Brainy0207 commented 1 year ago

No problem, I will have look at your PR then. My solution was just the minimal approach, to get stuff working as intended and I knew there was room for improvement, like proper argument or out of bound checks.

Adhara3 commented 1 year ago

@Whitehouse112 merged his refactoring, please @Brainy0207 take a look and let us know if you like it

Thanks A

Brainy0207 commented 1 year ago

Looks great. Thanks for the quick work. Now I can ditch my local fork and use the official package again.