Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > 1108558cde51b93cec9c8d25c1b81da7 > files > 7

jflex-1.4.3-6.mga4.noarch.rpm

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>JFlex Ant Task</title>
</head>

<body>

<h2><a name="JFlex">JFlex Ant Task</a></h2>
<p>
 JFlex can be easily integrated with <a HREF="http://ant.apache.org/" 
 target="_top">Ant</a> build tool. 
 To use JFlex with Ant, simply copy JFlex.jar to <i>$ANT_HOME/lib/</i> directory.
</p>
<h3>Description</h3>
<p>
  The JFlex Ant Task invokes the <a HREF="http://jflex.de/" target="_top">JFlex</a> lexical 
  analyzer generator on a grammar file.
</p>
<p>
 To use the JFlex task, the following line must be placed in the Ant build file:
</p>
<pre>&lt;taskdef classname=&quot;JFlex.anttask.JFlexTask&quot; name=&quot;jflex&quot; /&gt;</pre>

<p>
  The JFlex task requires the <i>file</i> attribute to be set to the source grammar file (*.flex).
  Unless the target directory is specified with the <i>destdir</i> option, 
  the generated class will be saved to the same directory where grammar file resides. 
  Like javac, the JFlex task creates subdirectories in <i>destdir</i> according to the 
  generated class package.
</p>
<p>
  This task only invokes JFlex if the grammar file is newer than the generated
  files.
</p>

<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0" width="80%">
  <tr>
    <td valign="top"><b>Attribute</b></td>
    <td valign="top"><b>Description</b></td>
    <td align="center" valign="top"><b>Required</b></td>
    <td align="center" valign="top"><b>Default</b></td>
  </tr>
  <tr>
    <td valign="top">file="file"</td>
    <td valign="top">The grammar file to process.</td>
    <td valign="top" align="center">Yes</td>
    <td></td>
  </tr>
  <tr>
    <td valign="top">destdir="dir"</td>
    <td valign="top">
      The directory to write the generated files to.  If not set, the files
      are written to the directory containing the grammar file. Note that unlike 
      JFlex's "-d" command line option, <i>destdir</i> causes the generated file to be written to 
      {destdir}/<b>{package name}</b>. This behaviour is similar to <i>javac -d dir</i>.
    </td>
    <td valign="top" align="center">No</td>
    <td></td>
  </tr>
  <tr>
    <td valign="top">outdir="dir"</td>
    <td valign="top">
      The directory to write the generated files to.  If not set, the files
      are written to the directory containing the grammar file. This options works 
      exactly like JFlex's "-d" command line option, it causes the output file to
      be written to <i>dir</i> regardless of the package name.
    </td>
    <td valign="top" align="center">No</td>
    <td></td>
  </tr>
  <tr>
    <td valign="top">verbose</td>
    <td valign="top">Display generation process messages.</td>
    <td align="center" valign="top">No</td>
    <td align="center" valign="top">&quot;off&quot;</td>
  </tr>
  <tr>
    <td valign="top">dump</td>
    <td valign="top">Dump character classes, NFA and DFA tables.</td>
    <td align="center" valign="top">No</td>
    <td align="center" valign="top">&quot;off&quot;</td>
  </tr>
  <tr>
    <td valign="top">time or<p>timeStatistics</td>
    <td valign="top">Display generation time statistics.</td>
    <td align="center" valign="top">No</td>
    <td align="center" valign="top">&quot;off&quot;</td>
  </tr>
  <tr>
    <td valign="top">nomin or<p>skipMinimization</td>
    <td valign="top">Skip minimization step.</td>
    <td align="center" valign="top">No</td>
    <td align="center" valign="top">&quot;off&quot;</td>
  </tr>
  <tr>
    <td valign="top">skel="file" or<p>skeleton="file"</td>
    <td valign="top">Use external skeleton file.</td>
    <td align="center" valign="top">No</td>
    <td align="center" valign="top">&quot;off&quot;</td>
  </tr>
  <tr>
    <td valign="top">dot or<p>generateDot</td>
    <td valign="top">Write graphviz .dot files for the generated automata (alpha).</td>
    <td align="center" valign="top">No</td>
    <td align="center" valign="top">&quot;off&quot;</td>
  </tr>
  <tr>
    <td valign="top">nobak</td>
    <td valign="top">Do not make a backup if the generated file exists.</td>
    <td align="center" valign="top">No</td>
    <td align="center" valign="top">&quot;off&quot;</td>
  </tr>
  <tr>
    <td valign="top">switch</td>
    <td valign="top">Use code generation method <i>switch</t>.</td>
    <td align="center" valign="top">No</td>
    <td align="center" valign="top">&quot;off&quot;</td>
  </tr>
  <tr>
    <td valign="top">table</td>
    <td valign="top">Use code generation method <i>table</t>.</td>
    <td align="center" valign="top">No</td>
    <td align="center" valign="top">&quot;off&quot;</td>
  </tr>
  <tr>
    <td valign="top">pack</td>
    <td valign="top">Use code generation method <i>pack</t>.</td>
    <td align="center" valign="top">No</td>
    <td align="center" valign="top">&quot;on&quot;</td>
  </tr>

</table>
<h3>Example</h3>
<blockquote><pre>
&lt;jflex
    file=&quot;src/parser/Parser.flex&quot;
    destdir=&quot;build/generated/&quot;
/&gt;
</pre></blockquote>
<p>
  JFlex generates the lexical analyzer for <tt>src/parser/Parser.flex</tt> and saves the result 
  to <tt>build/generated/parser/</tt>, providing <tt>Parser.flex</tt> declares to be in package <tt>parser</tt>.
</p>

<blockquote><pre>
&lt;jflex
    file=&quot;src/parser/Parser.flex&quot;
    destdir=&quot;build/generated/&quot;
/&gt;
&lt;javac
    srcdir=&quot;build/generated/&quot;
    destdir=&quot;build/classes/&quot;
/&gt;
</pre></blockquote>
<p>
 The same as above plus compile generated classes to <i>build/classes</i>
</p>
<hr>

</body>
</html>