<?xml version="1.0"?>
<!--
SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org)
SPDX-License-Identifier: MIT
SPDX-FileType: DOCUMENTATION

This file is processed by the bin/SConsDoc.py module.
-->

<!DOCTYPE sconsdoc [
<!ENTITY % scons SYSTEM '../../doc/scons.mod'>
%scons;
<!ENTITY % builders-mod SYSTEM '../../doc/generated/builders.mod'>
%builders-mod;
<!ENTITY % functions-mod SYSTEM '../../doc/generated/functions.mod'>
%functions-mod;
<!ENTITY % tools-mod SYSTEM '../../doc/generated/tools.mod'>
%tools-mod;
<!ENTITY % variables-mod SYSTEM '../../doc/generated/variables.mod'>
%variables-mod;
]>

<sconsdoc xmlns="http://www.scons.org/dbxsd/v1.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://www.scons.org/dbxsd/v1.0 http://www.scons.org/dbxsd/v1.0/scons.xsd">

<tool name="lex">
<summary>
<para>
Sets construction variables for the &lex; lexical analyzer.
</para>
</summary>
<sets>
<item>LEX</item>
<item>LEXFLAGS</item>
<item>LEXCOM</item>
<item>LEXUNISTD</item>
</sets>
<uses>
<item>LEXCOMSTR</item>
<item>LEXFLAGS</item>
<item>LEX_HEADER_FILE</item>
<item>LEX_TABLES_FILE</item>
</uses>
</tool>

<cvar name="LEX">
<summary>
<para>
The lexical analyzer generator.
</para>
</summary>
</cvar>

<cvar name="LEXCOM">
<summary>
<para>
The command line used to call the lexical analyzer generator
to generate a source file.
</para>
</summary>
</cvar>

<cvar name="LEXCOMSTR">
<summary>
<para>
The string displayed when generating a source file
using the lexical analyzer generator.
If this is not set, then &cv-link-LEXCOM; (the command line) is displayed.
</para>

<example_commands>
env = Environment(LEXCOMSTR="Lex'ing $TARGET from $SOURCES")
</example_commands>
</summary>
</cvar>

<cvar name="LEXFLAGS">
<summary>
<para>
General options passed to the lexical analyzer generator.
In addition to passing the value on during invocation,
the &t-link-lex; tool also examines this &consvar; for options
which cause additional output files to be generated,
and adds those to the target list.
Recognized for this purpose are GNU &flex; options
<option>--header-file=</option> and
<option>--tables-file=</option>;
the output file is named by the option argument.
</para>
<para>
Note that files specified by <option>--header-file=</option> and
<option>--tables-file=</option> may not be properly handled
by &SCons; in all situations. Consider using
&cv-link-LEX_HEADER_FILE; and &cv-link-LEX_TABLES_FILE; instead.
</para>
</summary>
</cvar>

<cvar name="LEX_HEADER_FILE">
<summary>
<para>
If supplied, generate a C header file with the name taken from this variable.
Will be emitted as a <option>--header-file=</option>
command-line option. Use this in preference to including
<option>--header-file=</option> in &cv-link-LEXFLAGS; directly.
</para>
</summary>
</cvar>

<cvar name="LEX_TABLES_FILE">
<summary>
<para>
If supplied, write the lex tables to a file with the name
taken from this variable.
Will be emitted as a <option>--tables-file=</option>
command-line option. Use this in preference to including
<option>--tables-file=</option> in &cv-link-LEXFLAGS; directly.
</para>
</summary>
</cvar>

<cvar name="LEXUNISTD">
<summary>
<para>
Used only in Windows environments to set a lex flag to prevent 'unistd.h' from being included. The default value is '--nounistd'.
</para>
</summary>
</cvar>

</sconsdoc>
