REFLEX(1)

NAME
reflex -- regex-centric, fast and flexible lexical analyzer generator

SYNOPSIS
reflex [OPTIONS] [FILE]

DESCRIPTION
Generates C++ source code programs that perform pattern-matching on text. FILE is a lexer specification source file, usually with extension .l. Generates lex.yy.cpp unless option -o specifies otherwise.

OPTIONS

Scanner:

-+, --flex
    Flex-compatible C++ scanner

-a, --dotall
    dot in patterns match newline

-B, --batch
    generate scanner for batch input by buffering the entire input

-f, --full
    generate full scanner with FSM opcode tables

-F, --fast
    generate fast scanner with FSM code

-i, --case-insensitive
    ignore case in patterns

-I, --interactive, --always-interactive
    generate interactive scanner

-m NAME, --matcher=NAME
    match with boost, boost_perl, pcre2_perl, reflex, std_ecma, ...

--pattern=NAME
    use custom pattern class NAME for custom matcher option -m

--include=FILE
    include header FILE.h for custom matcher option -m

-S, --find
    generate search engine to find matches, ignores unmatched input

-T N, --tabs=N
    set default tab size to N (1,2,4,8) for indent/dedent matching

-u, --unicode
    match Unicode . (dot), \p, \s, \w, etc and group UTF-8 bytes

-x, --freespace
    ignore space in patterns

Generated files:

-o FILE, --outfile=FILE
    specify output FILE instead of lex.yy.cpp

-t, --stdout
    write scanner on stdout instead of lex.yy.cpp

--graphs-file[=FILE[.gv]]
    write the scanner's DFA in Graphviz format to FILE.gv

--header-file[=FILE]
    write a C++ header FILE in addition to the scanner

--regexp-file[=FILE[.txt]]
    write the scanner's regular expression patterns to FILE.txt

--tables-file[=FILE[.cpp]]
    write the scanner's FSM opcode tables or FSM code to FILE.cpp

Generated code:

--namespace=NAME
    use C++ namespace NAME for the generated scanner class, with multiple namespaces specified as NAME1.NAME2.NAME3 ...

--lexer=NAME
    use lexer class NAME instead of Lexer or yyFlexLexer

--lex=NAME
    use lex function NAME instead of lex or yylex

--class=NAME
    declare a user-defined scanner class NAME

--yyclass=NAME
    generate Flex-compatible scanner with user-defined class NAME

--main
    generate main() to invoke lex() or yylex() once

-L, --noline
    suppress #line directives in scanner

-P NAME, --prefix=NAME
    use NAME as prefix of the FlexLexer class name and its members

--nostdinit
    initialize input to std::cin instead of stdin

--bison
    generate global yylex() scanner, yytext, yyleng, yylineno

--bison-bridge
    generate reentrant yylex() scanner for bison pure parser

--bison-cc
    generate bison C++ interface code for bison lalr1.cc skeleton

--bison-cc-namespace=NAME
    use namespace NAME with bison lalr1.cc skeleton

--bison-cc-parser=NAME
    use parser class NAME with bison lalr1.cc skeleton

--bison-complete
    use bison complete-symbols feature, implies bison-cc

--bison-locations
    include bison yylloc support

-R, --reentrant
    generate Flex-compatible yylex() reentrant scanner functions NOTE: adds functions only, reflex scanners are always reentrant

-y, --yy
    same as --flex and --bison, also generate global yyin, yyout

--yypanic
    call yypanic() when scanner jams, requires --flex --nodefault

--noyywrap
    do not call yywrap() on EOF, requires option --flex

--exception=VALUE
    use exception VALUE to throw as the default rule

--token-type=NAME
    use NAME as the return type of lex() and yylex() instead of int

Debugging:

-d, --debug
    enable debug mode in scanner

-D, --do=[START:]FILE
    immediately test patterns on input FILE, start condition START

-p, --perf-report
    scanner reports detailed performance statistics to stderr

-s, --nodefault
    disable the default rule that echoes unmatched text

-v, --verbose
    report summary of scanner statistics to stdout

-w, --nowarn
    do not generate warnings

Miscellaneous:

-c, -n
    do-nothing POSIX options

-?, -h, --help
    produce this help message and exit

-V, --version
    report reflex version and exit

Lex/Flex options that are enabled by default or have no effect:

--c++                  default

--lex-compat           n/a

--never-interactive    default

--nounistd             n/a

--posix-compat         n/a

--stack                n/a

--warn                 default

--yylineno             default

--yymore               default

--7bit                 n/a

--8bit                 default

DEPENDENCIES
None, except when option -m specifies an external pattern-matcher engine such as pcre2 or boost that requires the corresponding library.

DOCUMENTATION
The full documentation for reflex is maintained as a Doxygen-generated manual reflex/doc/html/index.html located in the source directory of the reflex installation. Or visit:

    <https://www.genivia.com/doc/reflex/html/index.html>

to browse the latest version of the reflex user guide.

COPYRIGHT
Copyright (c) 2016-2024 Robert A. van Engelen <engelen@acm.org>

reflex is released under the BSD-3 license. All parts of the software have reasonable copyright terms permitting free redistribution. This includes the ability to reuse all or parts of the reflex source tree.

BUGS
REJECT is not functional and not available.

Report bugs at: <https://github.com/Genivia/RE-flex/issues>

SEE ALSO
lex(1), flex(1), flex++(1).