<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>

<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage 2.0">
<title>Gelex: Options</title>
</head>

<body bgcolor="#FFFFFF">

<table border="0" width="100%">
    <tr>
        <td><font size="6"><strong>Options</strong></font></td>
        <td align="right"><a href="scanner.html"><img
        src="../image/previous.gif" alt="Previous" border="0"
        width="40" height="40"></a><a href="patterns.html"><img
        src="../image/next.gif" alt="Next" border="0" width="40"
        height="40"></a></td>
    </tr>
</table>

<hr size="1">

<p><em>Gelex</em> provides an option mechanism for controlling
the way the scanner is generated. Options are specified either in
the <a href="description.html#declarations">declarations section</a>
of <em>gelex</em> input file or from the <a href="#command_line">command
line</a>.</p>

<h2>Declaration Options</h2>

<p>Options are specified in the <a
href="description.html#declarations">declarations section</a>
using unindented lines beginning with <font color="#0000FF"><tt>%option</tt></font>
followed by a whitespace-separated list of options. One can use
more than one <font color="#0000FF"><tt>%option</tt></font><font
color="#0000FF" size="2" face="Courier New"> </font>directives if
necessary. Most options are given simply as names, optionally
preceded by the word <font color="#800000"><tt>no</tt></font>
(with no intervening whitespace) to negate their meaning.
Following is an excerpt from a scanner description file:</p>

<blockquote>
    <pre><font color="#0000FF">%option</font> <font
color="#800000">ecs meta-ecs case-insensitive nodefault</font>
<font color="#0000FF">%option</font> <font color="#800000">nowarn outfile=&quot;my_scanner.e&quot;</font></pre>
</blockquote>

<p>The <em>gelex</em> options have the following meanings:</p>

<dl>
    <dt><a name="backup"><font color="#800000"><tt>backup</tt></font></a></dt>
    <dd><font size="3">Generate backing-up information to
        standard output. This is a list of scanner states which
        require backing up and the input characters on which they
        do so. By adding rules one can remove backing-up states.
        If all backing-up states are eliminated and the </font><font
        color="#800000"><tt>full</tt></font><font size="3">
        option is used, the generated scanner will run faster.
        Only users who wish to squeeze every last CPU cycle out
        of their scanners need worry about this option. [default:
        </font><font color="#800000"><tt>nobackup</tt></font><font
        size="3">]</font></dd>
    <dt><a name="case-insensitive"><font color="#800000"><tt>case-insensitive</tt></font></a><font
        color="#800000"><tt><br>
        nocase-sensitive</tt></font></dt>
    <dd><font size="3">Generate a case-insensitive scanner. The
        case of letters given in the <em>gelex</em> input
        patterns will be ignored, and tokens in the generated
        scanner input will be matched regardless of case. The
        matched text given in </font><font color="#008080"><em><tt>text</tt></em></font><font
        size="3"> will have the preserved case. [default: </font><font
        color="#800000"><tt>case-sensitive</tt></font><font
        size="3">]</font></dd>
    <dt><a name="nodefault"><font color="#800000"><tt>nodefault</tt></font></a></dt>
    <dd><font size="3">Cause the </font><a
        href="matching_rules.html#default_rule"><font size="3">default
        rule</font></a><font size="3"> (that unmatched scanner
        input is echoed to the standard output) to be suppressed.
        If the scanner encounters input that does not match any
        of its rules, it aborts with an error. This option is
        useful for finding holes in a scanner's rule set.
        [default: </font><font color="#800000"><tt>default</tt></font><font
        size="3">]</font></dd>
    <dt><a name="ecs"><font color="#800000"><tt>ecs</tt></font></a></dt>
    <dd><font size="3">Direct <em>gelex</em> to construct
        equivalence classes, i.e. sets of characters which have
        identical lexical properties (for example, if the only
        appearance of digits in the <em>gelex</em> input is in
        the character class </font><font color="#FF0000"><tt>[0-9]</tt></font><font
        size="3"> then the digits '0', '1', ..., '9' will all be
        put in the same equivalence class). Equivalence classes
        usually give dramatic reductions in the final
        table/object file sizes (typically a factor of 2-5) and
        are pretty cheap performance-wise (one array look-up per
        character scanned). [default: </font><font
        color="#800000"><tt>ecs</tt></font><font size="3">]</font></dd>
    <dt><a name="full"><font color="#800000"><tt>full</tt></font></a></dt>
    <dd><font size="3">Specify that the full scanner tables
        should be generated </font><font size="3" face="Symbol">-</font><font
        size="3"> <em>gelex</em> should not compress the tables
        by taking advantages of similar transition functions for
        different states. The result is large but fast. [default:
        </font><font color="#800000"><tt>nofull</tt></font><font
        size="3">]</font></dd>
    <dt><a name="line"><font color="#800000" size="3"><tt>line</tt></font></a></dt>
    <dd><font size="3">Direct <em>gelex</em> to generate code for
        </font><a href="skeleton.html#line"><font color="#008080"
        size="3"><em><tt>line</tt></em></font></a><font
        color="#008080" size="3"><em><tt> </tt></em></font><font
        size="3">and </font><a href="skeleton.html#column"><font
        color="#008080" size="3"><em><tt>column</tt></em></font></a><font
        color="#008080" size="3"><em><tt> </tt></em></font><font
        size="3">counting. [default: </font><font color="#800000"><tt>noline</tt></font><font
        size="3">]</font></dd>
    <dt><a name="meta-ecs"><font color="#800000"><tt>meta-ecs</tt></font></a></dt>
    <dd><font size="3">Direct <em>gelex</em> to construct
        meta-equivalence classes, which are sets of equivalence
        classes (or characters, if equivalence classes are not
        being used) that are commonly used together.
        Meta-equivalence classes are often a big win when using
        compressed tables, but they have a moderate performance
        impact (one or two &quot;if&quot; tests and one array
        look-up per character scanned). This option does not make
        sense together with option </font><font color="#800000"><tt>full</tt></font><font
        size="3"> since there is no opportunity for
        meta-equivalence classes if the table is not being
        compressed. [default: </font><font color="#800000"><tt>meta-ecs</tt></font><font
        size="3">]</font></dd>
    <dt><a name="outfile"><font color="#800000"><tt>outfile=&quot;filename&quot;</tt></font></a></dt>
    <dd><font size="3">Direct <em>gelex</em> to write the scanner
        class to the file </font><font color="#800000"><tt>filename</tt></font><font
        size="3"> instead of the standard output.</font></dd>
    <dt><a name="position"><font color="#800000" size="3"><tt>position</tt></font></a></dt>
    <dd><font size="3">Direct <em>gelex</em> to generate code for
        </font><a href="skeleton.html#position"><font
        color="#008080" size="3"><em><tt>position</tt></em></font></a><font
        size="3"> counting (i.e. the number of characters read
        since the beginning of the input source). [default: </font><font
        color="#800000"><tt>noposition</tt></font><font size="3">]</font></dd>
    <dt><a name="post-action"><font color="#800000"><tt>post-action</tt></font></a></dt>
    <dd><font size="3">Specify that the feature </font><a
        href="skeleton.html#post_action"><font color="#008080"
        size="3"><em><tt>post_action</tt></em></font></a><font
        size="3"> should be called after each semantic action.
        [default: </font><font color="#800000"><tt>nopost-action</tt></font><font
        size="3">]</font></dd>
    <dt><a name="post-eof-action"><font color="#800000" size="3"><tt>post-eof-action</tt></font></a></dt>
    <dd><font size="3">Specify that the feature </font><a
        href="skeleton.html#post_eof_action"><font
        color="#008080" size="3"><em><tt>post_eof_action</tt></em></font></a><font
        size="3"> should be called after each end-of-file (i.e. </font><font
        color="#FF0000" size="3"><tt>&lt;&lt;EOF&gt;&gt;</tt></font><font
        size="3">) semantic action. [default: </font><font
        color="#800000"><tt>nopost-eof-action</tt></font><font
        size="3">]</font></dd>
    <dt><a name="pre-action"><font color="#800000"><tt>pre-action</tt></font></a></dt>
    <dd><font size="3">Specify that the feature </font><a
        href="skeleton.html#pre_action"><font color="#008080"
        size="3"><em><tt>pre_action</tt></em></font></a><font
        size="3"> should be called before each semantic action.
        [default: </font><font color="#800000"><tt>nopre-action</tt></font><font
        size="3">]</font></dd>
    <dt><a name="pre-eof-action"><font color="#800000" size="3"><tt>pre-eof-action</tt></font></a></dt>
    <dd><font size="3">Specify that the feature </font><a
        href="skeleton.html#pre_eof_action"><font color="#008080"
        size="3"><em><tt>pre_eof_action</tt></em></font></a><font
        size="3"> should be called before each end-of-file (i.e. </font><font
        color="#FF0000" size="3"><tt>&lt;&lt;EOF&gt;&gt;</tt></font><font
        size="3">) semantic action. [default: </font><font
        color="#800000"><tt>nopre-eof-action</tt></font><font
        size="3">]</font></dd>
    <dt><a name="reject"><font color="#800000"><tt>reject</tt></font></a></dt>
    <dd><font size="3">Specify that the feature </font><a
        href="actions.html#reject"><font color="#008080" size="3"><em><tt>reject</tt></em></font></a><font
        size="3"> is used in semantic actions. [default: </font><font
        color="#800000"><tt>noreject</tt></font><font size="3">]</font></dd>
    <dt><a name="nowarn"><font color="#800000"><tt>nowarn</tt></font></a></dt>
    <dd><font size="3">Suppress warning messages. [default: </font><font
        color="#800000"><tt>warn</tt></font><font size="3">]</font></dd>
</dl>

<h2><a name="command_line">Command-line Options</a></h2>

<p>Most of these options can also be specified from the<em> </em>command-line.
Following is <em>gelex</em> command-line usage message:</p>

<blockquote>
    <pre><font color="#800000">gelex </font>[<font
color="#800000">--version</font>][<font color="#800000">--help</font>][<font
color="#800000">-bcefhimsVwxz?</font>][<font color="#800000">-a size</font>][<font
color="#800000">-o filename</font>]<font color="#800000"> filename</font></pre>
</blockquote>

<p>The command-line options have the following meanings:</p>

<dl>
    <dt><a name="--version"><font color="#800000"><tt>--version</tt></font></a></dt>
    <dd><font size="3">Print <em>gelex</em> version number to the
        standard output and exit.</font></dd>
    <dt><a name="--help"><font color="#800000"><tt>--help</tt></font></a></dt>
    <dd><font size="3">Print <em>gelex</em> usage message to the
        standard output and exit.</font></dd>
    <dt><font color="#800000"><tt>-a size</tt></font></dt>
    <dd><font size="3">Some Eiffel compilers experience
        difficulties to process big manifest arrays. This option
        directs <em>gelex</em> to split manifest arrays with more
        than </font><font color="#800000"><tt>size</tt></font><font
        size="3"> elements into several smaller arrays. This
        option can be disabled by setting </font><font
        color="#800000"><tt>size</tt></font><font size="3"> to </font><font
        color="#800000"><tt>0</tt></font><font size="3">.
        [default: </font><font color="#800000"><tt>1000</tt></font><font
        size="3">]</font></dd>
    <dt><font color="#800000"><tt>-b</tt></font></dt>
    <dd><font size="3">Equivalent to </font><a href="#backup"><font
        color="#800000"><tt>backup</tt></font></a><font size="3">.</font></dd>
    <dt><font color="#800000"><tt>-c</tt></font></dt>
    <dd><font size="3">Equivalent to </font><a href="#full"><font
        color="#800000"><tt>nofull</tt></font></a><font size="3">.</font></dd>
    <dt><font color="#800000"><tt>-e</tt></font></dt>
    <dd><font size="3">Equivalent to </font><a href="#ecs"><font
        color="#800000"><tt>ecs</tt></font></a><font size="3">.</font></dd>
    <dt><font color="#800000"><tt>-f</tt></font></dt>
    <dd><font size="3">Equivalent to </font><a href="#full"><font
        color="#800000"><tt>full</tt></font></a><font size="3">.</font></dd>
    <dt><font color="#800000"><tt>-h</tt></font></dt>
    <dd><font size="3">Synonym for </font><a href="#--help"><font
        color="#800000"><tt>--help</tt></font></a><font size="3">.</font></dd>
    <dt><font color="#800000"><tt>-i</tt></font></dt>
    <dd><font size="3">Equivalent to </font><a
        href="#case-insensitive"><font color="#800000"><tt>case-insensitive</tt></font></a><font
        size="3">.</font></dd>
    <dt><font color="#800000"><tt>-m</tt></font></dt>
    <dd><font size="3">Equivalent to </font><a href="#meta-ecs"><font
        color="#800000"><tt>meta-ecs</tt></font></a><font
        size="3">.</font></dd>
    <dt><font color="#800000"><tt>-s</tt></font></dt>
    <dd><font size="3">Equivalent to </font><a href="#nodefault"><font
        color="#800000"><tt>nodefault</tt></font></a><font
        size="3">.</font></dd>
    <dt><font color="#800000"><tt>-V</tt></font></dt>
    <dd><font size="3">Synonym for </font><a href="#--version"><font
        color="#800000"><tt>--version</tt></font></a><font
        size="3">.</font></dd>
    <dt><font color="#800000"><tt>-w</tt></font></dt>
    <dd><font size="3">Equivalent to </font><a href="#nowarn"><font
        color="#800000"><tt>nowarn</tt></font></a><font size="3">.</font></dd>
    <dt><font color="#800000"><tt>-x</tt></font></dt>
    <dd>Write each semantic action into a separate routine. The
        default is to write all actions into the same routine,
        which can become too large for C back-end compilers to
        handle.</dd>
    <dt><font color="#800000"><tt>-z</tt></font></dt>
    <dd><font size="3">The generated code uses an <em>inspect</em>
        instruction to find out which action to execute. The
        default is to use binary-search implemented with <em>if</em>
        instructions.</font></dd>
    <dt><font color="#800000"><tt>-?</tt></font></dt>
    <dd><font size="3">Synonym for </font><a href="#--help"><font
        color="#800000"><tt>--help</tt></font></a><font size="3">.</font></dd>
    <dt><font color="#800000"><tt>-o filename</tt></font></dt>
    <dd><font size="3">Equivalent to </font><a href="#outfile"><font
        color="#800000"><tt>outfile=&quot;filename&quot;</tt></font></a></dd>
    <dt><font color="#800000"><tt>--pragma=[no]line</tt></font></dt>
    <dd>The code generated for the semantic actions contains (or
        not) indication about the line number where it originally
        appeared in the input description file.</dd>
    <dt><font color="#800000"><tt>--</tt></font></dt>
    <dd>Mark the end of the options. Useful when the scanner
        description filename begins with character '<tt>-</tt>'.</dd>
    <dt><font color="#800000"><tt>filename</tt></font></dt>
    <dd>Name of <em>gelex</em> input file containing the scanner
        description. By convention <em>gelex</em> input filenames
        have the extension <font size="3">'</font><font
        color="#800000"><tt>.l</tt></font><font size="3">' such
        as in </font><font color="#800000"><tt>my_scanner.l</tt></font><font
        size="3">. One is not required to follow this convention
        though.</font></dd>
</dl>

<p><font size="3">Note that options specified on the command-line
will override those specified in the </font><font color="#0000FF"><tt>%option</tt></font><font
color="#0000FF" size="2" face="Courier New"> </font>directives of
the <font size="3">input file.</font></p>

<hr size="1">

<table border="0" width="100%">
    <tr>
        <td><address>
            <font size="2"><b>Copyright © 2000-2004</b></font><font
            size="1"><b>, </b></font><font size="2"><strong>Eric
            Bezault</strong></font><strong> </strong><font
            size="2"><br>
            <strong>mailto:</strong></font><a
            href="mailto:ericb@gobosoft.com"><font size="2">ericb@gobosoft.com</font></a><font
            size="2"><br>
            <strong>http:</strong></font><a
            href="http://www.gobosoft.com"><font size="2">//www.gobosoft.com</font></a><font
            size="2"><br>
            <strong>Last Updated:</strong> 13 July 2004</font><br>
            <!--webbot bot="PurpleText"
            preview="
$Date$ 
$Revision$"
            --> 
        </address>
        </td>
        <td align="right" valign="top"><a
        href="http://www.gobosoft.com"><img
        src="../image/home.gif" alt="Home" border="0" width="40"
        height="40"></a><a href="index.html"><img
        src="../image/toc.gif" alt="Toc" border="0" width="40"
        height="40"></a><a href="scanner.html"><img
        src="../image/previous.gif" alt="Previous" border="0"
        width="40" height="40"></a><a href="patterns.html"><img
        src="../image/next.gif" alt="Next" border="0" width="40"
        height="40"></a></td>
    </tr>
</table>
</body>
</html>
