DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(flex.info.gz) Scanner Options

Info Catalog (flex.info.gz) Yacc (flex.info.gz) Top (flex.info.gz) Performance
 
 16 Scanner Options
 ******************
 
 The various `flex' options are categorized by function in the following
 menu. If you want to lookup a particular option by name,  Index of
 Scanner Options.
 

Menu

 
* Options for Specifying Filenames
* Options Affecting Scanner Behavior
* Code-Level And API Options
* Options for Scanner Speed and Size
* Debugging Options
* Miscellaneous Options
 
    Even though there are many scanner options, a typical scanner might
 only specify the following options:
 
 
      %option   8bit reentrant bison-bridge
      %option   warn nodefault
      %option   yylineno
      %option   outfile="scanner.c" header-file="scanner.h"
 
    The first line specifies the general type of scanner we want. The
 second line specifies that we are being careful. The third line asks
 flex to track line numbers. The last line tells flex what to name the
 files. (The options can be specified in any order. We just divided
 them.)
 
    `flex' also provides a mechanism for controlling options within the
 scanner specification itself, rather than from the flex command-line.
 This is done by including `%option' directives in the first section of
 the scanner specification.  You can specify multiple options with a
 single `%option' directive, and multiple directives in the first
 section of your flex input file.
 
    Most options are given simply as names, optionally preceded by the
 word `no' (with no intervening whitespace) to negate their meaning.
 The names are the same as their long-option equivalents (but without the
 leading `--' ).
 
    `flex' scans your rule actions to determine whether you use the
 `REJECT' or `yymore()' features.  The `REJECT' and `yymore' options are
 available to override its decision as to whether you use the options,
 either by setting them (e.g., `%option reject)' to indicate the feature
 is indeed used, or unsetting them to indicate it actually is not used
 (e.g., `%option noyymore)'.
 
    A number of options are available for lint purists who want to
 suppress the appearance of unneeded routines in the generated scanner.
 Each of the following, if unset (e.g., `%option nounput'), results in
 the corresponding routine not appearing in the generated scanner:
 
 
          input, unput
          yy_push_state, yy_pop_state, yy_top_state
          yy_scan_buffer, yy_scan_bytes, yy_scan_string
 
          yyget_extra, yyset_extra, yyget_leng, yyget_text,
          yyget_lineno, yyset_lineno, yyget_in, yyset_in,
          yyget_out, yyset_out, yyget_lval, yyset_lval,
          yyget_lloc, yyset_lloc, yyget_debug, yyset_debug
 
    (though `yy_push_state()' and friends won't appear anyway unless you
 use `%option stack)'.
 
Info Catalog (flex.info.gz) Yacc (flex.info.gz) Top (flex.info.gz) Performance
automatically generated byinfo2html