Sophie

Sophie

distrib > Mandriva > 2009.0 > i586 > by-pkgid > e4471f7f8e13c237def7fefb7af912ed > files > 42

ocaml-doc-3.10.2-4mdv2009.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="previous" href="Lazy.html">
<link rel="next" href="List.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Arg" rel="Chapter" href="Arg.html">
<link title="Arith_status" rel="Chapter" href="Arith_status.html">
<link title="Array" rel="Chapter" href="Array.html">
<link title="ArrayLabels" rel="Chapter" href="ArrayLabels.html">
<link title="Big_int" rel="Chapter" href="Big_int.html">
<link title="Bigarray" rel="Chapter" href="Bigarray.html">
<link title="Buffer" rel="Chapter" href="Buffer.html">
<link title="Callback" rel="Chapter" href="Callback.html">
<link title="CamlinternalMod" rel="Chapter" href="CamlinternalMod.html">
<link title="CamlinternalOO" rel="Chapter" href="CamlinternalOO.html">
<link title="Char" rel="Chapter" href="Char.html">
<link title="Complex" rel="Chapter" href="Complex.html">
<link title="Condition" rel="Chapter" href="Condition.html">
<link title="Dbm" rel="Chapter" href="Dbm.html">
<link title="Digest" rel="Chapter" href="Digest.html">
<link title="Dynlink" rel="Chapter" href="Dynlink.html">
<link title="Event" rel="Chapter" href="Event.html">
<link title="Filename" rel="Chapter" href="Filename.html">
<link title="Format" rel="Chapter" href="Format.html">
<link title="Gc" rel="Chapter" href="Gc.html">
<link title="Genlex" rel="Chapter" href="Genlex.html">
<link title="Graphics" rel="Chapter" href="Graphics.html">
<link title="GraphicsX11" rel="Chapter" href="GraphicsX11.html">
<link title="Hashtbl" rel="Chapter" href="Hashtbl.html">
<link title="Int32" rel="Chapter" href="Int32.html">
<link title="Int64" rel="Chapter" href="Int64.html">
<link title="Lazy" rel="Chapter" href="Lazy.html">
<link title="Lexing" rel="Chapter" href="Lexing.html">
<link title="List" rel="Chapter" href="List.html">
<link title="ListLabels" rel="Chapter" href="ListLabels.html">
<link title="Map" rel="Chapter" href="Map.html">
<link title="Marshal" rel="Chapter" href="Marshal.html">
<link title="MoreLabels" rel="Chapter" href="MoreLabels.html">
<link title="Mutex" rel="Chapter" href="Mutex.html">
<link title="Nativeint" rel="Chapter" href="Nativeint.html">
<link title="Num" rel="Chapter" href="Num.html">
<link title="Obj" rel="Chapter" href="Obj.html">
<link title="Oo" rel="Chapter" href="Oo.html">
<link title="Parsing" rel="Chapter" href="Parsing.html">
<link title="Pervasives" rel="Chapter" href="Pervasives.html">
<link title="Printexc" rel="Chapter" href="Printexc.html">
<link title="Printf" rel="Chapter" href="Printf.html">
<link title="Queue" rel="Chapter" href="Queue.html">
<link title="Random" rel="Chapter" href="Random.html">
<link title="Scanf" rel="Chapter" href="Scanf.html">
<link title="Set" rel="Chapter" href="Set.html">
<link title="Sort" rel="Chapter" href="Sort.html">
<link title="Stack" rel="Chapter" href="Stack.html">
<link title="StdLabels" rel="Chapter" href="StdLabels.html">
<link title="Str" rel="Chapter" href="Str.html">
<link title="Stream" rel="Chapter" href="Stream.html">
<link title="String" rel="Chapter" href="String.html">
<link title="StringLabels" rel="Chapter" href="StringLabels.html">
<link title="Sys" rel="Chapter" href="Sys.html">
<link title="Thread" rel="Chapter" href="Thread.html">
<link title="ThreadUnix" rel="Chapter" href="ThreadUnix.html">
<link title="Tk" rel="Chapter" href="Tk.html">
<link title="Unix" rel="Chapter" href="Unix.html">
<link title="UnixLabels" rel="Chapter" href="UnixLabels.html">
<link title="Weak" rel="Chapter" href="Weak.html"><link title="Positions" rel="Section" href="#6_Positions">
<link title="Lexer buffers" rel="Section" href="#6_Lexerbuffers">
<link title="Functions for lexer semantic actions" rel="Section" href="#6_Functionsforlexersemanticactions">
<link title="Miscellaneous functions" rel="Section" href="#6_Miscellaneousfunctions">
<title>Lexing</title>
</head>
<body>
<div class="navbar"><a href="Lazy.html">Previous</a>
&nbsp;<a href="index.html">Up</a>
&nbsp;<a href="List.html">Next</a>
</div>
<center><h1>Module <a href="type_Lexing.html">Lexing</a></h1></center>
<br>
<pre><span class="keyword">module</span> Lexing: <code class="code"><span class="keyword">sig</span></code> <a href="Lexing.html">..</a> <code class="code"><span class="keyword">end</span></code></pre>The run-time library for lexers generated by <code class="code">ocamllex</code>.<br>
<hr width="100%">
<br>
<a name="6_Positions"></a>
<h6>Positions</h6><br>
<br><code><span class="keyword">type</span> <a name="TYPEposition"></a><code class="type"></code>position = {</code><table class="typetable">
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code>pos_fname&nbsp;: <code class="type">string</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code>pos_lnum&nbsp;: <code class="type">int</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code>pos_bol&nbsp;: <code class="type">int</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code>pos_cnum&nbsp;: <code class="type">int</code>;</code></td>

</tr></table>
}

<div class="info">
A value of type <code class="code">position</code> describes a point in a source file.
   <code class="code">pos_fname</code> is the file name; <code class="code">pos_lnum</code> is the line number;
   <code class="code">pos_bol</code> is the offset of the beginning of the line (number
   of characters between the beginning of the file and the beginning
   of the line); <code class="code">pos_cnum</code> is the offset of the position (number of
   characters between the beginning of the file and the position).
<p>

   See the documentation of type <code class="code">lexbuf</code> for information about
   how the lexing engine will manage positions.<br>
</div>

<pre><span class="keyword">val</span> <a name="VALdummy_pos"></a>dummy_pos : <code class="type"><a href="Lexing.html#TYPEposition">position</a></code></pre><div class="info">
A value of type <code class="code">position</code>, guaranteed to be different from any
   valid position.<br>
</div>
<br>
<a name="6_Lexerbuffers"></a>
<h6>Lexer buffers</h6><br>
<br><code><span class="keyword">type</span> <a name="TYPElexbuf"></a><code class="type"></code>lexbuf = {</code><table class="typetable">
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code>refill_buff&nbsp;: <code class="type"><a href="Lexing.html#TYPElexbuf">lexbuf</a> -> unit</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable&nbsp;</span>lex_buffer&nbsp;: <code class="type">string</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable&nbsp;</span>lex_buffer_len&nbsp;: <code class="type">int</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable&nbsp;</span>lex_abs_pos&nbsp;: <code class="type">int</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable&nbsp;</span>lex_start_pos&nbsp;: <code class="type">int</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable&nbsp;</span>lex_curr_pos&nbsp;: <code class="type">int</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable&nbsp;</span>lex_last_pos&nbsp;: <code class="type">int</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable&nbsp;</span>lex_last_action&nbsp;: <code class="type">int</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable&nbsp;</span>lex_eof_reached&nbsp;: <code class="type">bool</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable&nbsp;</span>lex_mem&nbsp;: <code class="type">int array</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable&nbsp;</span>lex_start_p&nbsp;: <code class="type"><a href="Lexing.html#TYPEposition">position</a></code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable&nbsp;</span>lex_curr_p&nbsp;: <code class="type"><a href="Lexing.html#TYPEposition">position</a></code>;</code></td>

</tr></table>
}

<div class="info">
The type of lexer buffers. A lexer buffer is the argument passed
   to the scanning functions defined by the generated scanners.
   The lexer buffer holds the current state of the scanner, plus
   a function to refill the buffer from the input.
<p>

   Note that the lexing engine will only change the <code class="code">pos_cnum</code> field
   of <code class="code">lex_curr_p</code> by updating it with the number of characters read
   since the start of the <code class="code">lexbuf</code>.  The other fields are copied
   without change by the lexing engine.  In order to keep them
   accurate, they must be initialised before the first use of the
   lexbuf, and updated by the relevant lexer actions (i.e. at each
   end of line).<br>
</div>

<pre><span class="keyword">val</span> <a name="VALfrom_channel"></a>from_channel : <code class="type"><a href="Pervasives.html#TYPEin_channel">in_channel</a> -> <a href="Lexing.html#TYPElexbuf">lexbuf</a></code></pre><div class="info">
Create a lexer buffer on the given input channel.
   <code class="code"><span class="constructor">Lexing</span>.from_channel inchan</code> returns a lexer buffer which reads
   from the input channel <code class="code">inchan</code>, at the current reading position.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALfrom_string"></a>from_string : <code class="type">string -> <a href="Lexing.html#TYPElexbuf">lexbuf</a></code></pre><div class="info">
Create a lexer buffer which reads from
   the given string. Reading starts from the first character in
   the string. An end-of-input condition is generated when the
   end of the string is reached.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALfrom_function"></a>from_function : <code class="type">(string -> int -> int) -> <a href="Lexing.html#TYPElexbuf">lexbuf</a></code></pre><div class="info">
Create a lexer buffer with the given function as its reading method.
   When the scanner needs more characters, it will call the given
   function, giving it a character string <code class="code">s</code> and a character
   count <code class="code">n</code>. The function should put <code class="code">n</code> characters or less in <code class="code">s</code>,
   starting at character number 0, and return the number of characters
   provided. A return value of 0 means end of input.<br>
</div>
<br>
<a name="6_Functionsforlexersemanticactions"></a>
<h6>Functions for lexer semantic actions</h6><br>
<br>
The following functions can be called from the semantic actions
   of lexer definitions (the ML code enclosed in braces that
   computes the value returned by lexing functions). They give
   access to the character string matched by the regular expression
   associated with the semantic action. These functions must be
   applied to the argument <code class="code">lexbuf</code>, which, in the code generated by
   <code class="code">ocamllex</code>, is bound to the lexer buffer passed to the parsing
   function.<br>
<pre><span class="keyword">val</span> <a name="VALlexeme"></a>lexeme : <code class="type"><a href="Lexing.html#TYPElexbuf">lexbuf</a> -> string</code></pre><div class="info">
<code class="code"><span class="constructor">Lexing</span>.lexeme lexbuf</code> returns the string matched by
           the regular expression.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALlexeme_char"></a>lexeme_char : <code class="type"><a href="Lexing.html#TYPElexbuf">lexbuf</a> -> int -> char</code></pre><div class="info">
<code class="code"><span class="constructor">Lexing</span>.lexeme_char lexbuf i</code> returns character number <code class="code">i</code> in
   the matched string.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALlexeme_start"></a>lexeme_start : <code class="type"><a href="Lexing.html#TYPElexbuf">lexbuf</a> -> int</code></pre><div class="info">
<code class="code"><span class="constructor">Lexing</span>.lexeme_start lexbuf</code> returns the offset in the
   input stream of the first character of the matched string.
   The first character of the stream has offset 0.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALlexeme_end"></a>lexeme_end : <code class="type"><a href="Lexing.html#TYPElexbuf">lexbuf</a> -> int</code></pre><div class="info">
<code class="code"><span class="constructor">Lexing</span>.lexeme_end lexbuf</code> returns the offset in the input stream
   of the character following the last character of the matched
   string. The first character of the stream has offset 0.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALlexeme_start_p"></a>lexeme_start_p : <code class="type"><a href="Lexing.html#TYPElexbuf">lexbuf</a> -> <a href="Lexing.html#TYPEposition">position</a></code></pre><div class="info">
Like <code class="code">lexeme_start</code>, but return a complete <code class="code">position</code> instead
    of an offset.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALlexeme_end_p"></a>lexeme_end_p : <code class="type"><a href="Lexing.html#TYPElexbuf">lexbuf</a> -> <a href="Lexing.html#TYPEposition">position</a></code></pre><div class="info">
Like <code class="code">lexeme_end</code>, but return a complete <code class="code">position</code> instead
    of an offset.<br>
</div>
<br>
<a name="6_Miscellaneousfunctions"></a>
<h6>Miscellaneous functions</h6><br>
<pre><span class="keyword">val</span> <a name="VALflush_input"></a>flush_input : <code class="type"><a href="Lexing.html#TYPElexbuf">lexbuf</a> -> unit</code></pre><div class="info">
Discard the contents of the buffer and reset the current
    position to 0.  The next use of the lexbuf will trigger a
    refill.<br>
</div>
</body></html>