peter-winter / ctpg

Compile Time Parser Generator is a C++ single header library which takes a language description as a C++ code and turns it into a LR1 table parser with a deterministic finite automaton lexical analyzer, all in compile time.
MIT License
456 stars 24 forks source link

Add construct ftor #35

Closed stephanroslen closed 2 years ago

stephanroslen commented 2 years ago

It turned out the list helpers example for comma separeted numbers did not work, as the first rule does not take the first number and the second rule expects to start with a comma. So I thought it might be a good idea to provide a helper that initializes a container with a given argument.

peter-winter commented 2 years ago

Good catch! Thanks a lot. I like the idea. Can you please add a section to the readme after 'create' and before 'element placeholders' that describes the 'construct' helper in more detail? You can either create a new example or mention some existing one from the readme if it fits. Of course your change to the readme regarding list helpers is fine.

stephanroslen commented 2 years ago

Thank you! I added some more documentation and tried to keep it more generic - not describing the construction of a container but an arbitrary type from a value.