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
504 stars 85 forks source link

Prevent class redefinitions by not generating lexer class in cpp file if generating a header file. #180

Closed killerswin2 closed 1 year ago

killerswin2 commented 1 year ago

Class redefinition can be introduced in the lexer cpp by including the class again in the user code section. This pr provides logic to fix redefinition by not generating the lexer class in cpp, but instead by including the generated header file.

Attached is some code that does redefinition, with the include fix and non include breaking code. Debug.zip

genivia-inc commented 1 year ago

Thanks for the feedback and details. I will take a closer look soon.

genivia-inc commented 1 year ago

I will merge the pull request and make the modest change on my end. Thanks for making reflex better!

killerswin2 commented 1 year ago

Ah sorry. I just got busy in life. Thanks for the review and the merge. I really like using RE-flex, thank you for provide this wonderful tool.