hyperrealm / libconfig

C/C++ library for processing configuration files
https://hyperrealm.github.io/libconfig/
GNU Lesser General Public License v2.1
1.1k stars 359 forks source link

Grammar definition error and Peggy grammar file contrib #233

Open kf6kjg opened 9 months ago

kf6kjg commented 9 months ago

I've written a first-pass rough draft of a Peggy-based grammar file. Attached for reference: libconfig.peg.txt

While drafting that file I found that the grammar definition for <float> in the docshas a glitch that makes it not pass the test file: the second condition of the regex requires the + or - prefix, thus a float specified as 1E6 fails unless it's declared as +1E6. Adding a simple ? to that clause fixes the problem.

For the second half of this question, where can I contribute the grammar to? I'd like to PR it into this repo, or a related one, so that it comes with the ecosystem. Alternatively I could publish it myself, but just feels like it'll just be another whiff of gas in the wide world.

hyperrealm commented 8 months ago

Hi, please open a pull request for these changes. There is a 'contrib' directory where you can put your grammar file. Thanks!