Genivia / RE-flex

A high-performance C++ regex library and lexical analyzer generator with Unicode support. Extends Flex++ with Unicode support, indent/dedent anchors, lazy quantifiers, functions for lex and syntax error reporting and more. Seamlessly integrates with Bison and other parsers.
https://www.genivia.com/doc/reflex/html
BSD 3-Clause "New" or "Revised" License
522 stars 85 forks source link

Injected Lexer class members of type reference cannot be initialized #123

Closed teshields closed 2 years ago

teshields commented 2 years ago

The %init{ ... } code block cannot be used to initialize injected Lexer class members of type reference, which must be initialized in the constructor member initializer list.

Proposal: add %option ctorinit="initializer, initializer, ..." to add injected member initializers to the constructor's member initializer list, mirroring the existing option %option ctorarg="argument, argument, ..." for adding argument declarations to the constructor.

Example:

%class{ int& refint; bool& refbool; } %option ctorarg="int& ri, bool& rb" %option ctorinit="refint(ri), refbool(rb)"

genivia-inc commented 2 years ago

Thanks for the feedback.

genivia-inc commented 2 years ago

Implemented this feature for the next release cycle.

genivia-inc commented 2 years ago

Update 3.2.0 is released.

teshields commented 2 years ago

Thanks!