bash / broccolini

A non-destructive parser for INI files compatible with `GetPrivateProfileString`
https://broccolini.tau.garden/
MIT License
2 stars 2 forks source link

Empty lines are recognized as an UnrecognizedIniNode #13

Closed csillikd closed 4 months ago

csillikd commented 4 months ago

Here


[section]

key=value

the first two empty lines are recognized as UnrecognizedIniNodes, and the third one is ignored.

I think the first belongs to the section node as leading trivia, the second as trailing trivia, and the third empty line belongs to the KeyValueIniNode as trailing trivia.

It would also help to decide whether the document is well-formatted.

bash commented 4 months ago

Agreed. Empty lines should be considered leading/trailing trivia instead of unrecognized nodes. [^1]

I don't plan on working on this soon, but I'm open to PRs :)

A couple of pointers towards a PR:

[^1]: The third blank line in your example is not ignored. The final newline is included in the NewLine property of your key-value node (I made the line endings explicit using ):

  ```
  ␊
  [section]␊
  ␊
  key=value␊

  ```
  If there were two line feeds at the end of the document I would agree with you :)
csillikd commented 4 months ago

Tank you for the infos, I may try it! Footnote: Yes, you are right! :D

csillikd commented 4 months ago

Do you plan a new release? We need that fix :)

bash commented 4 months ago

Yes, I'm currently working on this issue :) See #17

I noticed that what we discussed needs some tweaking though:

Empty lines at the end of a section should count as trailing trivia for that section and not the last node in that section. This will make inserting a new node at the end of the section much easier.

bash commented 4 months ago

This is how I plan to categorize leading/trailing trivia:

trivia-explainer

Does this look good to you?

csillikd commented 4 months ago

Looks good :)

Tau Gärtli @.***> ezt írta (időpont: 2024. jún. 24., H, 18:08):

This is how I plan to categorize leading/trailing trivia:

trivia-explainer.svg (view on web) https://github.com/bash/broccolini/assets/4602612/103bca75-15dc-4e34-83fc-79501009b709

Does this look good to you?

— Reply to this email directly, view it on GitHub https://github.com/bash/broccolini/issues/13#issuecomment-2186925202, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADYO5VHE5QXTRRMD4KU45KLZJBAAPAVCNFSM6AAAAABJGFPWPWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBWHEZDKMRQGI . You are receiving this because you authored the thread.Message ID: @.***>

bash commented 4 months ago

2.0.0-rc.1 is published 🎉 (still indexing atm)

I'd be grateful if you could run your internal test suite against the new version and let me know if I broke anything. If everything is good and my changes are useful I'll release 2.0.0.

csillikd commented 4 months ago

It works!

Tau Gärtli @.***> ezt írta (időpont: 2024. jún. 25., K, 11:39):

2.0.0-rc.1 https://www.nuget.org/packages/Broccolini/2.0.0-rc.1 is published 🎉

I'd be grateful if you could run your internal test suite against the new version and let me know if I broke anything. If everything is good and my changes are useful I'll release 2.0.0.

— Reply to this email directly, view it on GitHub https://github.com/bash/broccolini/issues/13#issuecomment-2188443293, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADYO5VAYW6YMRJP2E4QYVP3ZJE3GZAVCNFSM6AAAAABJGFPWPWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBYGQ2DGMRZGM . You are receiving this because you authored the thread.Message ID: @.***>

bash commented 4 months ago

Great! 2.0.0 is uploaded to nuget.org: https://www.nuget.org/packages/Broccolini/2.0.0

csillikd commented 4 months ago

🥳 Great! I have tested it only with the new tool that we develop, I trust your tests :)

Tau Gärtli @.***> ezt írta (időpont: 2024. jún. 25., K, 16:37):

Great! 2.0.0 is uploaded to nuget.org: https://www.nuget.org/packages/Broccolini/2.0.0

— Reply to this email directly, view it on GitHub https://github.com/bash/broccolini/issues/13#issuecomment-2189140335, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADYO5VCKC7ICDSCLUNZALBDZJF6BBAVCNFSM6AAAAABJGFPWPWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBZGE2DAMZTGU . You are receiving this because you authored the thread.Message ID: @.***>