Sophie

Sophie

distrib > Arklinux > devel > i586 > media > main > by-pkgid > dec60dedc1ff6e8fa4a0987dbc72ed1d > files > 694

ocaml-3.12.1-1ark.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="CamlinternalLazy" rel="Chapter" href="CamlinternalLazy.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>
<span id="6_Positions"><h6>Positions</h6></span><br>
<br><code><span id="TYPEposition"><span class="keyword">type</span> <code class="type"></code>position</span> = {</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 id="VALdummy_pos"><span class="keyword">val</span> dummy_pos</span> : <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>
<span id="6_Lexerbuffers"><h6>Lexer buffers</h6></span><br>
<br><code><span id="TYPElexbuf"><span class="keyword">type</span> <code class="type"></code>lexbuf</span> = {</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>

   At each token, the lexing engine will copy <code class="code">lex_curr_p</code> to
   <code class="code">lex_start_p</code>, then 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 left
   unchanged 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 -- see also <code class="code">new_line</code>).<br>
</div>

<pre><span id="VALfrom_channel"><span class="keyword">val</span> from_channel</span> : <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 id="VALfrom_string"><span class="keyword">val</span> from_string</span> : <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 id="VALfrom_function"><span class="keyword">val</span> from_function</span> : <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>
<span id="6_Functionsforlexersemanticactions"><h6>Functions for lexer semantic actions</h6></span><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 id="VALlexeme"><span class="keyword">val</span> lexeme</span> : <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 id="VALlexeme_char"><span class="keyword">val</span> lexeme_char</span> : <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 id="VALlexeme_start"><span class="keyword">val</span> lexeme_start</span> : <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 id="VALlexeme_end"><span class="keyword">val</span> lexeme_end</span> : <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 id="VALlexeme_start_p"><span class="keyword">val</span> lexeme_start_p</span> : <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 id="VALlexeme_end_p"><span class="keyword">val</span> lexeme_end_p</span> : <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>
<pre><span id="VALnew_line"><span class="keyword">val</span> new_line</span> : <code class="type"><a href="Lexing.html#TYPElexbuf">lexbuf</a> -> unit</code></pre><div class="info">
Update the <code class="code">lex_curr_p</code> field of the lexbuf to reflect the start
    of a new line.  You can call this function in the semantic action
    of the rule that matches the end-of-line character.<br>
<b>Since</b> 3.11.0<br>
</div>
<br>
<span id="6_Miscellaneousfunctions"><h6>Miscellaneous functions</h6></span><br>
<pre><span id="VALflush_input"><span class="keyword">val</span> flush_input</span> : <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>