/[eiffelstudio]/vendor/gobosoft.com/gobo/current/doc/gelex/skeleton.html
ViewVC logotype

Contents of /vendor/gobosoft.com/gobo/current/doc/gelex/skeleton.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 90767 - (show annotations)
Tue Jan 22 00:56:30 2013 UTC (6 years, 8 months ago) by manus
File MIME type: text/xml
File size: 19876 byte(s)
Updated svn:eol-style to be native and svn:mime-style to be text/xml

1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3
4 <head>
5 <meta http-equiv="Content-Type"
6 content="text/html; charset=iso-8859-1">
7 <meta name="GENERATOR" content="Microsoft FrontPage 2.0">
8 <title>Gelex: Scanner Skeleton</title>
9 </head>
10
11 <body bgcolor="#FFFFFF">
12
13 <table border="0" width="100%">
14 <tr>
15 <td><font size="6"><strong>Scanner Skeleton</strong></font></td>
16 <td align="right"><a href="actions.html"><img
17 src="../image/previous.gif" alt="Previous" border="0"
18 width="40" height="40"></a><a href="limitations.html"><img
19 src="../image/next.gif" alt="Next" border="0" width="40"
20 height="40"></a></td>
21 </tr>
22 </table>
23
24 <hr size="1">
25
26 <pre><em><strong>note</strong></em><em>
27
28 description</em>:<em> &quot;General lexical analyzers&quot;
29 library</em>:<em> &quot;Gobo Eiffel Lexical Library&quot;
30 copyright</em>:<em> &quot;Copyright (c) 2001, Eric Bezault and others&quot;
31 license</em>:<em> &quot;MIT License&quot;
32
33 </em><em><strong>deferred</strong></em><em> </em><em><strong>class</strong></em><em> YY_SCANNER
34
35 </em><em><strong>create</strong></em><em>
36
37 </em><a href="scanner.html#make" name="make"><em>make</em></a><em>
38 </em> -- Create a new scanner with
39 -- standard input as input file.<em>
40
41 </em><a href="scanner.html#make_with_file"
42 name="make_with_file"><em>make_with_file</em></a><em> </em>(<em>a_file</em>:<em> FILE</em>)<em>
43 </em>-- Create a new scanner with<em>
44 </em>-- <em>a_file</em> as input file.<em>
45 </em><em><strong>require</strong></em><em>
46 a_file_not_void</em>:<em> a_file </em>/= <em>Void
47 a_file_open_read</em>:<em> a_file.is_open_read
48
49 </em><a href="scanner.html#make_with_buffer"
50 name="make_with_buffer"><em>make_with_buffer</em></a><em> </em>(<em>a_buffer</em>:<em> </em><em><strong>like</strong></em><em> input_buffer</em>)<em>
51 </em>-- Create a new scanner with
52 -- <em>a_buffer</em> as input buffer.<em>
53 </em><em><strong>require</strong></em><em>
54 a_buffer_not_void</em>:<em> a_buffer </em>/=<em> Void
55 </em><em><strong>ensure</strong></em><em>
56 input_buffer_set</em>:<em> input_buffer </em>=<em> a_buffer
57
58 </em><em><strong>feature</strong></em><em> </em>-- Initialization<em>
59
60 </em><a href="scanner.html#reset" name="reset"><em>reset</em></a><em>
61 </em>-- Reset scanner before scanning next input source.
62 -- (This routine can be called in <em>wrap</em> before scanning
63 -- another input buffer.)<em>
64
65 </em><em><strong>feature</strong></em><em> </em>-- Access<em>
66
67 </em><a href="actions.html#last_token" name="last_token"><em>last_token</em></a><em>: INTEGER
68 </em>-- Code of last token read
69 -- (0 means that the end-of-input has been reached,
70 -- non-positive values mean that an error occurred
71 -- (see header-comment of <em>scanning_error</em>.))
72 <em>
73 </em><a href="actions.html#text" name="text"><em>text</em></a>:<em> STRING
74 </em>-- Text of last token read
75 -- (Create a new string at each call.)<em>
76 </em><em><strong>ensure</strong></em><em>
77 text_not_void</em>:<em> Result </em>/= <em>Void
78 correct_count</em>:<em> Result.count </em>=<em> text_count
79
80 </em><a href="actions.html#text_item" name="text_item"><em>text_item</em></a><em> </em>(<em>i</em>:<em> INTEGER</em>):<em> CHARACTER
81 </em>-- <em>i</em>-th character of last token read<em>
82 </em><em><strong>require</strong></em><em>
83 i_large_enough</em>:<em> i </em>&gt;= <em>1
84 i_small_enough</em>:<em> i </em>&lt;= <em>text_count
85 </em><em><strong>ensure</strong></em><em>
86 definition</em>:<em> Result </em>=<em> text.item </em>(<em>i</em>)<em>
87
88 </em><a href="actions.html#text_substring"
89 name="text_substring"><em>text_substring</em></a><em> </em>(<em>s</em>,<em> e</em>:<em> INTEGER</em>):<em> STRING
90 </em>-- Substring of last token read
91 -- (Create a new string at each call.)<em>
92 </em>-- (For efficiency reason, this function can bypass the
93 -- call to <em>text</em> and create the substring directly from
94 -- the input buffer.)<em>
95 </em><em><strong>require</strong></em><em>
96 meaningful_start</em>:<em> 1 </em>&lt;=<em> s
97 meaningful_interval</em>:<em> s </em>&lt;=<em> e </em>+<em> 1
98 meaningful_end</em>:<em> e </em>&lt;= <em>text_count
99 </em><em><strong>ensure</strong></em><em>
100 text_substring_not_void</em>:<em> Result </em>/=<em> Void
101 text_substring_empty</em>:<em> </em>(<em>s </em>&gt;<em> e</em>)<em> </em><em><strong>implies</strong></em><em> Result.empty
102 definition</em>:<em> s </em>&lt;=<em> e </em><em><strong>implies</strong></em><em> Result.is_equal </em>(<em>text.substring </em>(<em>s</em>,<em> e</em>))<em>
103
104 </em><a href="actions.html#start_condition"
105 name="start_condition"><em>start_condition</em></a>:<em> INTEGER
106 </em>-- Start condition<em>
107
108 </em><em><strong>feature</strong></em><em> </em>-- Measurement<em>
109
110 </em><a href="actions.html#text_count" name="text_count"><em>text_count</em></a>:<em> INTEGER
111 </em>-- Length of last token read<em>
112 </em><em><strong>ensure</strong></em><em>
113 positive_count</em>:<em> Result </em>&gt;=<em> 0
114
115 </em><a href="actions.html#line" name="line"><em>line</em></a>:<em> INTEGER
116 </em>-- Line number of last token read when
117 -- '<em>%option line</em>' has been specified<em>
118 </em><em><strong>ensure</strong></em><em>
119 line_positive</em>:<em> Result </em>&gt;=<em> 1
120
121 </em><a href="actions.html#column" name="column"><em>column</em></a>:<em> INTEGER
122 </em>-- Column number of last token read when
123 -- '<em>%option line</em>' has been specified<em>
124 </em><em><strong>ensure</strong></em><em>
125 column_positive</em>:<em> Result </em>&gt;= <em>1
126
127 </em><a href="actions.html#position" name="position"><em>position</em></a>:<em> INTEGER
128 </em>-- Position of last token read (i.e. number of
129 -- characters from the start of the input source)
130 -- when '<em>%option position</em>' has been specified<em>
131 </em><em><strong>ensure</strong></em><em>
132 position_positive</em>:<em> Result </em>&gt;=<em> 1
133
134 </em><em><strong>feature </strong></em>-- Status report<em>
135
136 </em><a href="actions.html#end_of_file" name="end_of_file"><em>end_of_file</em></a>:<em> BOOLEAN
137 </em>-- Has the end of input buffer been reached?<em>
138 </em>-- This means that <em>last_token</em> has been set
139 -- to 0 indicating &quot;all done&quot;.<em>
140
141 </em><a href="actions.html#scanning_error"
142 name="scanning_error"><em>scanning_error</em></a>:<em> BOOLEAN
143 </em>-- Has an error occurred during scanning?<em>
144 </em>-- This can occur when too many <em>reject</em> are called (and hence
145 -- nothing can be matched anymore) or when the option &quot;nodefault&quot;
146 -- (or option -s) has been specified but the default rule is
147 -- matched nevertheless.<em>
148
149 valid_start_condition </em>(<em>sc</em>:<em> INTEGER</em>):<em> BOOLEAN
150 </em>-- Is <em>sc</em> a valid start condition?<em>
151 </em><em><strong>
152 feature</strong></em><em> </em>-- Setting<em>
153
154 </em><a href="actions.html#set_last_token"
155 name="set_last_token"><em>set_last_token</em></a><em> </em>(<em>a_token</em>:<em> INTEGER</em>)<em>
156 </em>-- Set <em>last_token</em> to <em>a_token</em>.<em>
157 </em><em><strong>ensure</strong></em><em>
158 last_token_set</em>: <em>last_token </em>= <em>a_token
159
160 </em><a href="actions.html#set_start_condition"
161 name="set_start_condition"><em>set_start_condition</em></a><em> </em>(<em>a_start_condition</em>:<em> INTEGER</em>)<em>
162 </em>-- Set <em>start_condition</em> to <em>a_start_condition</em>.<em>
163 </em><em><strong>require</strong></em><em>
164 valid_start_condition</em>:<em> valid_start_condition </em>(<em>a_start_condition</em>)<em>
165 </em><em><strong>ensure</strong></em><em>
166 start_condition_set</em>:<em> start_condition </em>=<em> a_start_condition
167
168 </em><em><strong>feature</strong></em><em> </em>-- Scanning<em>
169
170 </em><a href="scanner.html#scan" name="scan"><em>scan</em></a><em>
171 </em> -- Scan <em>input_buffer</em> until end of file is found.<em>
172 </em><em><strong>ensure</strong></em><em>
173 end_of_file</em>:<em> </em><em><strong>not</strong></em><em> scanning_error </em><em><strong>implies</strong></em><em> end_of_file
174
175 </em><a href="scanner.html#read_token" name="read_token"><em>read_token</em></a><em>
176 </em>-- Read a token from <em>input_buffer</em>.
177 -- Make result available in <em>last_token</em>.<em>
178
179 </em><em><strong>feature</strong></em><em> </em>-- Element change<em>
180
181 </em><a href="actions.html#append_text_to_string"
182 name="append_text_to_string"><em>append_text_to_string</em></a><em> </em>(<em>a_string</em>:<em> STRING</em>)<em>
183 </em>-- Append <em>text</em> at end of <em>a_string</em>.
184 -- (For efficiency reason, this feature can bypass the
185 -- call to <em>text</em> and directly copy the characters from
186 -- the input buffer.)<em>
187 </em><em><strong>require</strong></em><em>
188 a_string_not_void</em>:<em> a_string </em>/= <em>Void
189
190 </em><a href="actions.html#append_text_substring_to_string"
191 name="append_text_substring_to_string"><em>append_text_substring_to_string</em></a><em> </em>(<em>s</em>,<em> e</em>:<em> INTEGER</em>;<em> a_string</em>:<em> STRING</em>)<em>
192 </em>-- Append <em>text_substring</em> at end of <em>a_string</em>.
193 -- (For efficiency reason, this feature can bypass
194 -- the call to <em>text_substring</em> and directly copy
195 -- the characters from the input buffer.)<em>
196 </em><em><strong>require</strong></em><em>
197 a_string_not_void</em>:<em> a_string </em>/=<em> Void
198 s_large_enough</em>:<em> 1 </em>&lt;=<em> s
199 valid_interval: s </em>&lt;=<em> e </em>+<em> 1
200 e_small_enough</em>:<em> e </em>&lt;=<em> text_count
201
202 </em><a href="actions.html#terminate" name="terminate"><em>terminate</em></a><em>
203 </em>-- Terminate scanner and set <em>last_token</em>
204 -- to 0 indicating &quot;all done&quot;.<em>
205
206 </em><a href="matching_rules.html#eof_rules" name="wrap"><em>wrap</em></a>:<em> BOOLEAN
207 </em>-- Should current scanner terminate when end of file is reached?
208 -- This function can be redefined to switch to another input
209 -- buffer (but don't forget to update <em>start_condition</em>).<em>
210 </em>-- (Default: True.)<em>
211
212 </em><a href="actions.html#more" name="more"><em>more</em></a><em>
213 </em>-- Tell scanner to append the next matched token
214 -- to current value of <em>text</em> instead of
215 -- replacing it.<em>
216
217 </em><a href="actions.html#less" name="less"><em>less</em></a><em> </em>(<em>n</em>:<em> INTEGER</em>)<em>
218 </em>-- Return all but the first <em>n</em> matched
219 -- characters back to <em>input_buffer</em>.<em>
220 </em><em><strong>require</strong></em><em>
221 n_large_enough</em>:<em> n </em>&gt;=<em> 0
222 n_small_enough</em>: <em>n </em>&lt;=<em> text_count
223 </em><em><strong>ensure</strong></em><em>
224 text_count_set</em>:<em> text_count</em> =<em> n
225
226 </em><a href="actions.html#unread_character"
227 name="unread_character"><em>unread_character</em></a><em> </em>(<em>c</em>:<em> CHARACTER</em>)<em>
228 </em>-- Put <em>c</em> back to <em>input_buffer</em>. This will alter both
229 -- <em>text</em> and the content of <em>input_buffer</em>.<em>
230
231 </em><a href="actions.html#read_character"
232 name="read_character"><em>read_character</em></a><em>
233 </em>-- Read a character from <em>input_buffer</em>.
234 -- Make result available in <em>last_character</em>.<em>
235
236 </em><a href="actions.html#last_character"
237 name="last_character"><em>last_character</em></a>:<em> CHARACTER
238 </em>-- Last character read by <em>read_character
239
240 </em><em><strong>feature</strong></em><em> </em>-- Input<em>
241
242 </em><a href="actions.html#input_buffer" name="input_buffer"><em>input_buffer</em></a>:<em> YY_BUFFER
243 </em> -- Input buffer<em>
244
245 </em><a href="actions.html#set_input_buffer"
246 name="set_input_buffer"><em>set_input_buffer</em></a><em> </em>(<em>a_buffer</em>:<em> </em><em><strong>like</strong></em><em> input_buffer</em>)<em>
247 </em>-- Set <em>input_buffer</em> to <em>a_buffer</em>.<em>
248 </em><em><strong>require</strong></em><em>
249 a_buffer_not_void</em>:<em> a_buffer </em>/=<em> Void
250 </em><em><strong>ensure</strong></em><em>
251 input_buffer_set</em>:<em> input_buffer</em> =<em> a_buffer
252
253 </em><a href="actions.html#flush_input_buffer"
254 name="flush_input_buffer"><em>flush_input_buffer</em></a><em>
255 </em>-- Flush <em>input_buffer</em>. <em>input_buffer</em> will be automatically
256 -- refilled unless end of file has been found.<em>
257 </em><em><strong>ensure</strong></em><em>
258 flushed</em>: <em>input_buffer.count </em>=<em> 0
259
260 </em><a href="actions.html#new_file_buffer"
261 name="new_file_buffer"><em>new_file_buffer</em></a><em> </em>(<em>a_file</em>:<em> FILE</em>):<em> YY_FILE_BUFFER
262 </em>-- New input buffer for <em>a_file
263 </em><em><strong>require</strong></em><em>
264 a_file_not_void</em>:<em> a_file </em>/= <em>Void
265 a_file_open_read</em>:<em> a_file.is_open_read
266 </em><em><strong>ensure</strong></em><em>
267 new_buffer_not_void</em>:<em> Result</em> /=<em> Void
268
269 </em><a href="actions.html#new_string_buffer"
270 name="new_string_buffer"><em>new_string_buffer</em></a><em> </em>(<em>a_string</em>:<em> STRING</em>):<em> YY_BUFFER
271 </em>-- New input buffer for <em>a_string
272 </em><em><strong>require</strong></em><em>
273 a_string_not_void</em>:<em> a_string </em>/=<em> Void
274 </em><em><strong>ensure</strong></em><em>
275 new_buffer_not_void</em>:<em> Result </em>/=<em> Void
276
277 </em><a href="actions.html#Empty_buffer" name="Empty_buffer"><em>Empty_buffer</em></a>:<em> YY_BUFFER
278 </em> -- Empty input buffer<em>
279 </em><em><strong>ensure</strong></em><em>
280 empty_buffer_not_void</em>:<em> Result </em>/=<em> Void
281
282 </em><em><strong>feature</strong></em><em> </em>-- Output<em>
283
284 </em><a href="actions.html#output" name="output"><em>output</em></a><em> </em>(<em>a_text: </em><em><strong>like</strong></em><em> text</em>)<em>
285 </em>-- Output <em>a_text</em>.
286 -- (Note: this routine can be redefined in descendant
287 -- classes. Default: print <em>a_text</em> to standard output.)<em>
288 </em><em><strong>require</strong></em><em>
289 a_text_not_void</em>:<em> a_text </em>/= <em>Void
290
291 </em><a href="actions.html#echo" name="echo"><em>echo</em></a><em>
292 </em>-- Output <em>text</em> using feature <em>output</em>.<em>
293
294 </em><em><strong>feature</strong></em><em> </em>-- Action<em>
295
296 </em><a href="actions.html#pre_action" name="pre_action"><em>pre_action</em></a><em>
297 </em>-- Action executed before every semantic action
298 -- when <em>'%option pre-action</em>' has been specified.
299 -- (Note: this routine can be redefined in descendant
300 -- classes. Default: do nothing.)
301 <em>
302 </em><a href="actions.html#post_action" name="post_action"><em>post_action</em></a><em>
303 </em>-- Action executed after every semantic action
304 -- when <em>'%option post-action' </em>has been specified.
305 -- (Note: this routine can be redefined in descendant
306 -- classes. Default: do nothing.)<em>
307
308 </em><a href="actions.html#pre_eof_action"
309 name="pre_eof_action"><em>pre_eof_action</em></a><em>
310 </em>-- Action executed before every end-of-file semantic action
311 -- (i.e. <em>&lt;&lt;EOF&gt;&gt;</em>) when '<em>%option pre-eof-action</em>' has been specified.
312 -- (Note: this routine can be redefined in descendant classes.
313 -- Default: do nothing.)<em>
314
315 </em><a href="actions.html#post_eof_action"
316 name="post_eof_action"><em>post_eof_action</em></a><em>
317 </em>-- Action executed after every end-of-file semantic action
318 -- (i.e. <em>&lt;&lt;EOF&gt;&gt;</em>) when '<em>%option post-eof-action'</em> has been specified.
319 -- (Note: this routine can be redefined in descendant classes.
320 -- Default: do nothing.)<em>
321
322 </em><a href="matching_rules.html#default_rule"
323 name="default_action"><em>default_action</em></a><em>
324 </em> -- Action executed when default rule is matched.<em>
325 </em>-- (Note: this routine can be redefined in descendant classes.
326 -- Default: print last character read to standard output.)<em>
327
328 </em><em><strong>feature</strong></em><em> </em>-- Error handling<em>
329
330 </em><a name="fatal_error"><em>fatal_error</em></a><em> </em>(<em>a_message</em>:<em> STRING</em>)<em>
331 </em>-- A fatal error occurred.
332 -- Print <em>a_message</em>.<em>
333 </em><em><strong>require</strong></em><em>
334 a_message_not_void</em>:<em> a_message</em> /=<em> Void
335
336 </em><em><strong>feature</strong></em><em> </em>-- Debugging<em>
337
338 </em><a href="actions.html#print_last_token"
339 name="print_last_token"><em>print_last_token</em></a><em>
340 </em> -- Print to standard error debug information
341 -- about the last token read. Can be redefined
342 -- in descendant classes to print more information.
343 -- (Called at the end of <em>read_token</em> when compiled
344 -- with 'debug (&quot;GELEX&quot;)' enabled).<em>
345
346 </em><em><strong>invariant</strong></em><em>
347
348 input_buffer_not_void</em>:<em> input_buffer </em>/=<em> Void
349 valid_start_condition</em>:<em> valid_start_condition </em>(<em>start_condition</em>)<em>
350
351 </em><em><strong>end</strong></em></pre>
352
353 <hr size="1">
354
355 <table border="0" width="100%">
356 <tr>
357 <td><address>
358 <font size="2"><b>Copyright 2001-2005</b></font><font
359 size="1"><b>, </b></font><font size="2"><strong>Eric
360 Bezault and others</strong><br>
361 <strong>mailto:</strong></font><a
362 href="mailto:ericb@gobosoft.com"><font size="2">ericb@gobosoft.com</font></a><font
363 size="2"><br>
364 <strong>http:</strong></font><a
365 href="http://www.gobosoft.com"><font size="2">//www.gobosoft.com</font></a><font
366 size="2"><br>
367 <strong>Last Updated:</strong> 16 February 2005</font><br>
368 <!--webbot bot="PurpleText"
369 preview="
370 $Date$
371 $Revision$"
372 -->
373 </address>
374 </td>
375 <td align="right" valign="top"><a
376 href="http://www.gobosoft.com"><img
377 src="../image/home.gif" alt="Home" border="0" width="40"
378 height="40"></a><a href="index.html"><img
379 src="../image/toc.gif" alt="Toc" border="0" width="40"
380 height="40"></a><a href="actions.html"><img
381 src="../image/previous.gif" alt="Previous" border="0"
382 width="40" height="40"></a><a href="limitations.html"><img
383 src="../image/next.gif" alt="Next" border="0" width="40"
384 height="40"></a></td>
385 </tr>
386 </table>
387 </body>
388 </html>

Properties

Name Value
svn:mime-type text/xml

  ViewVC Help
Powered by ViewVC 1.1.23