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
528 stars 86 forks source link

Support for Bison's C++ Interface #11

Closed Krantz-XRF closed 6 years ago

Krantz-XRF commented 6 years ago

Wonderful tool! It saved me from struggling in the broken C++ implementation of Flex!

I have just quickly looked through the manual, but I did not find a way to make the scanner compatible with Bison's C++ interface. Since the scanner is in C++, I would prefer the parser to be in C++, too.

The Bison's C++ interface expects the lex function to receive a yylval and a location (in the Split Symbols version), or receive only a location but return a "Complete Symbol" instead of an int, so I find it quite difficult to achieve this.

Is there any way to make it work with Bison's C++ interface? Perhaps with some command line options, or I have to write some code myself? Can you give me a clue?

genivia-inc commented 6 years ago

Makes sense to support Bison's C++ code. I'll work on supporting this feature for the next release.

genivia-inc commented 6 years ago

The new feature to support Bison 3.0 C++ %skeleton "lalr1.cc" parsers is now available with reflex 1.0.6. User reflex option --bison-cc and --bison-locations (optional). See also the updated documentation.

genivia-inc commented 6 years ago

Let me know if this is what you wanted. Thanks for starring and for rating our project at SourceForge https://sourceforge.net/projects/re-flex/

Krantz-XRF commented 6 years ago

Thanks for this update. That's just what I meant. I'll go to try out this new feature.