Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EnumCustomProperty parsing fails if more than one white-space character is used as separator #41

Closed
JuRichter opened this issue Aug 14, 2023 · 3 comments

Comments

@JuRichter
Copy link

Line in dbc file:
BA_DEF_ BO_ "GenMsgSendType" ENUM "Cyclic","Event","CyclicIfActive","SpontanWithDelay","CyclicAndSpontan";

Propose fix in PropertiesDefinitionLineParser.cs:
Line 16:
Add:
private readonly char[] PropertySeparatorChar = { ' ' };

Line 92:
Replace:
var enumDefinition = match.Groups[10].Value.Replace("\"", "").Split(' ')[1];
By:
var enumDefinition = match.Groups[10].Value.Replace("\"", "").Split(PropertySeparatorChar, StringSplitOptions.RemoveEmptyEntries)[1];

@Whitehouse112
Copy link
Contributor

Whitehouse112 commented Aug 25, 2023

Hi @JuRichter ,
thanks for the feedback. The regex to parse the enum custom property has been modified to correctly read more white-spaces without the need of the Split() function. This will be available in the next release.

Regards

@JuRichter
Copy link
Author

Thanks a lot!

Whitehouse112 added a commit to Whitehouse112/DbcParser that referenced this issue Aug 28, 2023
…e character is used as separator. Updated and added some test

EnumCustomProperty parsing fails if more than one white-space chracter is used as separator. Updated and added some test, code clean up.
EFeru pushed a commit that referenced this issue Sep 11, 2023
* #23 Parsing failures management

Added observer to listen for parsing failures. Code clean up.

* #23 Added parsing failures management for each line parser

Added parsing failures management for each line parser.
Created silent and simple failure observer classes

* #23 Added parsing failure tests

Added parsing failure tests. Removed old and no more valid tests

* #23 Added parsing failure observer in Demo application

* #41 EnumCustomProperty parsing fails if more than one white-space character is used as separator. Updated and added some test

EnumCustomProperty parsing fails if more than one white-space chracter is used as separator. Updated and added some test, code clean up.

* #42 Bugfixed on NS definition

Now every NS definition at the top of a file is ignored
Whitehouse112 added a commit to Whitehouse112/DbcParser that referenced this issue Sep 13, 2023
Added support for signed integer in VAL_ regex. Fixed bug in EFeru#41 preventing custom definition from being correctly parsed
Whitehouse112 added a commit to Whitehouse112/DbcParser that referenced this issue Sep 13, 2023
EFeru#23 Now signed integer is correctly parsed in VAL_ regex
EFeru#41 Bug preventing BA_DEF_ regex to be correctly parsed is now fixed
Adhara3 added a commit that referenced this issue Sep 14, 2023
Brainy0207 pushed a commit to Brainy0207/DbcParser that referenced this issue Sep 20, 2023
* EFeru#41 The regex to parse enum definition values had two nested capture groups which led to the last value beeing repeated twice. Fixed the regex and updated the test code to check for the correct values.
@Brainy0207
Copy link

One of the last changes to the regex for parsing enum definitions caused a strange issue.

Assume this definition:
BA_DEF_ BU_ "AttributeName" ENUM "Val1","Val2","Val3";

Parsing this definition would duplicate the last value.
.Values = { "Val1", "Val2", "Val3Val3" };

I submitted a PR (#46) to fix the issue and add some test code.

Brainy0207 pushed a commit to Brainy0207/DbcParser that referenced this issue Sep 25, 2023
Fixed the regex for parsing enum definitions, which got broken by a change related to EFeru#41.
Adhara3 added a commit that referenced this issue Sep 26, 2023
#41 Fixed enum definition parser repeating last value twice
@Adhara3 Adhara3 closed this as completed Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants