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

using --stdout and --full option does not output reflex_code_INITIAL #185

Closed haihuayang closed 1 year ago

haihuayang commented 1 year ago

Hi, when I use both --stdout --full option to generate the lexer, reflex does not output reflex_code_INITIAL. it looks like in function Pattern::assemble optf is empty when using --stdout option. if (!opt.f.empty()) { if (opt_.o) gencode_dfa(start); else export_code(); }

is it by design or a bug?

Thanks,

genivia-inc commented 1 year ago

There is no filename to save the source to, so it won't generate the source.

In other parts of the code there is a check for stdout.<extension> to generate the code. The <extension> determines what type of source to save. So it is potentially possible, but not done in the reflex tool. I don't remember the details why I could not get this done. But clearly this is not trivial, since there is also this code that checks if option --stdout is not used (options["stdout"].empty()) to generate the tables:

  if (options["matcher"].empty() && (!options["full"].empty() || !options["fast"].empty()) && options["tables_file"].empty() && options["stdout"].empty())
    write_banner("TABLES");
genivia-inc commented 1 year ago

This should be working now with the upcoming update v3.3.6.