170 lines
2.5 KiB
HTML
170 lines
2.5 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of Stdlib.Genlex</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>Stdlib.Genlex</H1>
|
|
Section: OCaml library (3o)<BR>Updated: 2020-01-30<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
Stdlib.Genlex - no description
|
|
<A NAME="lbAC"> </A>
|
|
<H2>Module</H2>
|
|
|
|
Module Stdlib.Genlex
|
|
<A NAME="lbAD"> </A>
|
|
<H2>Documentation</H2>
|
|
|
|
<P>
|
|
Module
|
|
<B>Genlex</B>
|
|
|
|
<BR> :
|
|
<B>(module Stdlib__genlex)</B>
|
|
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>type token </I>
|
|
|
|
=
|
|
<BR> | Kwd
|
|
<B>of </B>
|
|
|
|
<B>string</B>
|
|
|
|
<BR> | Ident
|
|
<B>of </B>
|
|
|
|
<B>string</B>
|
|
|
|
<BR> | Int
|
|
<B>of </B>
|
|
|
|
<B>int</B>
|
|
|
|
<BR> | Float
|
|
<B>of </B>
|
|
|
|
<B>float</B>
|
|
|
|
<BR> | String
|
|
<B>of </B>
|
|
|
|
<B>string</B>
|
|
|
|
<BR> | Char
|
|
<B>of </B>
|
|
|
|
<B>char</B>
|
|
|
|
<BR>
|
|
<P>
|
|
The type of tokens. The lexical classes are:
|
|
<B>Int</B>
|
|
|
|
and
|
|
<B>Float</B>
|
|
|
|
for integer and floating-point numbers;
|
|
<B>String</B>
|
|
|
|
for
|
|
string literals, enclosed in double quotes;
|
|
<B>Char</B>
|
|
|
|
for
|
|
character literals, enclosed in single quotes;
|
|
<B>Ident</B>
|
|
|
|
for
|
|
identifiers (either sequences of letters, digits, underscores
|
|
and quotes, or sequences of 'operator characters' such as
|
|
<B>+</B>
|
|
|
|
,
|
|
<B>*</B>
|
|
|
|
, etc); and
|
|
<B>Kwd</B>
|
|
|
|
for keywords (either identifiers or
|
|
single 'special characters' such as
|
|
<B>(</B>
|
|
|
|
,
|
|
<B>}</B>
|
|
|
|
, etc).
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val make_lexer </I>
|
|
|
|
:
|
|
<B>string list -> char Stream.t -> token Stream.t</B>
|
|
|
|
<P>
|
|
Construct the lexer function. The first argument is the list of
|
|
keywords. An identifier
|
|
<B>s</B>
|
|
|
|
is returned as
|
|
<B>Kwd s</B>
|
|
|
|
if
|
|
<B>s</B>
|
|
|
|
belongs to this list, and as
|
|
<B>Ident s</B>
|
|
|
|
otherwise.
|
|
A special character
|
|
<B>s</B>
|
|
|
|
is returned as
|
|
<B>Kwd s</B>
|
|
|
|
if
|
|
<B>s</B>
|
|
|
|
belongs to this list, and cause a lexical error (exception
|
|
<B>Stream.Error</B>
|
|
|
|
with the offending lexeme as its parameter) otherwise.
|
|
Blanks and newlines are skipped. Comments delimited by
|
|
<B>(*</B>
|
|
|
|
and
|
|
<B>*)</B>
|
|
|
|
are skipped as well, and can be nested. A
|
|
<B>Stream.Failure</B>
|
|
|
|
exception
|
|
is raised if end of stream is unexpectedly reached.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="2"><A HREF="#lbAC">Module</A><DD>
|
|
<DT id="3"><A HREF="#lbAD">Documentation</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:57 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|