3
<link rel="stylesheet" href="style.css" type="text/css">
4
<link rel="Start" href="index.html">
5
<link rel="previous" href="Lazy.html">
6
<link rel="next" href="List.html">
7
<link rel="Up" href="index.html">
8
<link title="Index of types" rel="Appendix" href="index_types.html">
9
<link title="Index of exceptions" rel="Appendix" href="index_exceptions.html">
10
<link title="Index of values" rel="Appendix" href="index_values.html">
11
<link title="Index of class attributes" rel="Appendix" href="index_attributes.html">
12
<link title="Index of class methods" rel="Appendix" href="index_methods.html">
13
<link title="Index of classes" rel="Appendix" href="index_classes.html">
14
<link title="Index of class types" rel="Appendix" href="index_class_types.html">
15
<link title="Index of modules" rel="Appendix" href="index_modules.html">
16
<link title="Index of module types" rel="Appendix" href="index_module_types.html">
17
<link title="Arg" rel="Chapter" href="Arg.html">
19
<link title="Arith_status" rel="Chapter" href="Arith_status.html">
21
<link title="Array" rel="Chapter" href="Array.html">
23
<link title="ArrayLabels" rel="Chapter" href="ArrayLabels.html">
25
<link title="Big_int" rel="Chapter" href="Big_int.html">
27
<link title="Bigarray" rel="Chapter" href="Bigarray.html">
29
<link title="Buffer" rel="Chapter" href="Buffer.html">
31
<link title="Callback" rel="Chapter" href="Callback.html">
33
<link title="Char" rel="Chapter" href="Char.html">
35
<link title="Condition" rel="Chapter" href="Condition.html">
37
<link title="Dbm" rel="Chapter" href="Dbm.html">
39
<link title="Digest" rel="Chapter" href="Digest.html">
41
<link title="Dynlink" rel="Chapter" href="Dynlink.html">
43
<link title="Event" rel="Chapter" href="Event.html">
45
<link title="Filename" rel="Chapter" href="Filename.html">
47
<link title="Format" rel="Chapter" href="Format.html">
49
<link title="Gc" rel="Chapter" href="Gc.html">
51
<link title="Genlex" rel="Chapter" href="Genlex.html">
53
<link title="Graphics" rel="Chapter" href="Graphics.html">
55
<link title="GraphicsX11" rel="Chapter" href="GraphicsX11.html">
57
<link title="Hashtbl" rel="Chapter" href="Hashtbl.html">
59
<link title="Int32" rel="Chapter" href="Int32.html">
61
<link title="Int64" rel="Chapter" href="Int64.html">
63
<link title="Lazy" rel="Chapter" href="Lazy.html">
65
<link title="Lexing" rel="Chapter" href="Lexing.html">
67
<link title="List" rel="Chapter" href="List.html">
69
<link title="ListLabels" rel="Chapter" href="ListLabels.html">
71
<link title="Map" rel="Chapter" href="Map.html">
73
<link title="Marshal" rel="Chapter" href="Marshal.html">
75
<link title="MoreLabels" rel="Chapter" href="MoreLabels.html">
77
<link title="Mutex" rel="Chapter" href="Mutex.html">
79
<link title="Nativeint" rel="Chapter" href="Nativeint.html">
81
<link title="Num" rel="Chapter" href="Num.html">
83
<link title="Obj" rel="Chapter" href="Obj.html">
85
<link title="Oo" rel="Chapter" href="Oo.html">
87
<link title="Parsing" rel="Chapter" href="Parsing.html">
89
<link title="Pervasives" rel="Chapter" href="Pervasives.html">
91
<link title="Printexc" rel="Chapter" href="Printexc.html">
93
<link title="Printf" rel="Chapter" href="Printf.html">
95
<link title="Queue" rel="Chapter" href="Queue.html">
97
<link title="Random" rel="Chapter" href="Random.html">
99
<link title="Set" rel="Chapter" href="Set.html">
101
<link title="Sort" rel="Chapter" href="Sort.html">
103
<link title="Stack" rel="Chapter" href="Stack.html">
105
<link title="StdLabels" rel="Chapter" href="StdLabels.html">
107
<link title="Str" rel="Chapter" href="Str.html">
109
<link title="Stream" rel="Chapter" href="Stream.html">
111
<link title="String" rel="Chapter" href="String.html">
113
<link title="StringLabels" rel="Chapter" href="StringLabels.html">
115
<link title="Sys" rel="Chapter" href="Sys.html">
117
<link title="Thread" rel="Chapter" href="Thread.html">
119
<link title="ThreadUnix" rel="Chapter" href="ThreadUnix.html">
121
<link title="Tk" rel="Chapter" href="Tk.html">
123
<link title="Unix" rel="Chapter" href="Unix.html">
125
<link title="UnixLabels" rel="Chapter" href="UnixLabels.html">
127
<link title="Weak" rel="Chapter" href="Weak.html">
128
<title>Lexing</title>
131
<div class="navbar"><a href="Lazy.html">Previous</a>
132
<a href="index.html">Up</a>
133
<a href="List.html">Next</a>
135
<center><h1>Module <a href="type_Lexing.html">Lexing</a></h1></center>
137
<pre><span class="keyword">module</span> Lexing = <code><span class="keyword">struct</span> ... <span class="keyword">end</span> </code></pre><div class="info">
138
The run-time library for lexers generated by <code>ocamllex</code>.<br>
143
<table cellpadding=0 cellspacing=0 width="100%">
144
<tr class="title2"><td><div align=center>
145
<table><tr class="title2">
146
<td width="100%" align=center>
147
<span class="title2">Lexer buffers</span>
156
<br><code><span class="keyword">type</span> <a name="TYPElexbuf"></a>lexbuf = {<br></code><table border="0" cellpadding="1">
158
<td align="left" valign="top" >
159
<code> refill_buff : <code class="type"><a href="Lexing.html#TYPElexbuf">lexbuf</a> -> unit</code>;</code></td>
163
<td align="left" valign="top" >
164
<code> <span class="keyword">mutable </span>lex_buffer : <code class="type">string</code>;</code></td>
168
<td align="left" valign="top" >
169
<code> <span class="keyword">mutable </span>lex_buffer_len : <code class="type">int</code>;</code></td>
173
<td align="left" valign="top" >
174
<code> <span class="keyword">mutable </span>lex_abs_pos : <code class="type">int</code>;</code></td>
178
<td align="left" valign="top" >
179
<code> <span class="keyword">mutable </span>lex_start_pos : <code class="type">int</code>;</code></td>
183
<td align="left" valign="top" >
184
<code> <span class="keyword">mutable </span>lex_curr_pos : <code class="type">int</code>;</code></td>
188
<td align="left" valign="top" >
189
<code> <span class="keyword">mutable </span>lex_last_pos : <code class="type">int</code>;</code></td>
193
<td align="left" valign="top" >
194
<code> <span class="keyword">mutable </span>lex_last_action : <code class="type">int</code>;</code></td>
198
<td align="left" valign="top" >
199
<code> <span class="keyword">mutable </span>lex_eof_reached : <code class="type">bool</code>;</code></td>
205
The type of lexer buffers. A lexer buffer is the argument passed
206
to the scanning functions defined by the generated scanners.
207
The lexer buffer holds the current state of the scanner, plus
208
a function to refill the buffer from the input.<br>
211
<pre><span class="keyword">val</span> <a name="VALfrom_channel"></a>from_channel : <code class="type"><a href="Pervasives.html#TYPEin_channel">Pervasives.in_channel</a> -> <a href="Lexing.html#TYPElexbuf">lexbuf</a></code></pre><div class="info">
212
Create a lexer buffer on the given input channel.
213
<code><span class="constructor">Lexing</span>.from_channel inchan</code> returns a lexer buffer which reads
214
from the input channel <code>inchan</code>, at the current reading position.<br>
216
<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">
217
Create a lexer buffer which reads from
218
the given string. Reading starts from the first character in
219
the string. An end-of-input condition is generated when the
220
end of the string is reached.<br>
222
<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">
223
Create a lexer buffer with the given function as its reading method.
224
When the scanner needs more characters, it will call the given
225
function, giving it a character string <code>s</code> and a character
226
count <code>n</code>. The function should put <code>n</code> characters or less in <code>s</code>,
227
starting at character number 0, and return the number of characters
228
provided. A return value of 0 means end of input.<br>
232
<table cellpadding=0 cellspacing=0 width="100%">
233
<tr class="title2"><td><div align=center>
234
<table><tr class="title2">
235
<td width="100%" align=center>
236
<span class="title2">Functions for lexer semantic actions</span>
246
The following functions can be called from the semantic actions
247
of lexer definitions (the ML code enclosed in braces that
248
computes the value returned by lexing functions). They give
249
access to the character string matched by the regular expression
250
associated with the semantic action. These functions must be
251
applied to the argument <code>lexbuf</code>, which, in the code generated by
252
<code>ocamllex</code>, is bound to the lexer buffer passed to the parsing
254
<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">
255
<code><span class="constructor">Lexing</span>.lexeme lexbuf</code> returns the string matched by
256
the regular expression.<br>
258
<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">
259
<code><span class="constructor">Lexing</span>.lexeme_char lexbuf i</code> returns character number <code>i</code> in
260
the matched string.<br>
262
<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">
263
<code><span class="constructor">Lexing</span>.lexeme_start lexbuf</code> returns the position in the
264
input stream of the first character of the matched string.
265
The first character of the stream has position 0.<br>
267
<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">
268
<code><span class="constructor">Lexing</span>.lexeme_end lexbuf</code> returns the position in the input stream
269
of the character following the last character of the matched
270
string. The first character of the stream has position 0.<br>
b'\\ No newline at end of file'