1 mike 1.1 /* A lexical scanner generated by flex */
2
3 /* Scanner skeleton version:
|
4 krisbash 1.5 * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
|
5 mike 1.1 */
6
7 #define FLEX_SCANNER
8 #define YY_FLEX_MAJOR_VERSION 2
9 #define YY_FLEX_MINOR_VERSION 5
10
11 #include <stdio.h>
12
13
14 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
15 #ifdef c_plusplus
16 #ifndef __cplusplus
17 #define __cplusplus
18 #endif
19 #endif
20
21
22 #ifdef __cplusplus
23
24 #include <stdlib.h>
25 #include <unistd.h>
26 mike 1.1
27 /* Use prototypes in function declarations. */
28 #define YY_USE_PROTOS
29
30 /* The "const" storage-class-modifier is valid. */
31 #define YY_USE_CONST
32
|
33 krisbash 1.5 #else /* ! __cplusplus */
|
34 mike 1.1
35 #if __STDC__
36
37 #define YY_USE_PROTOS
38 #define YY_USE_CONST
39
|
40 krisbash 1.5 #endif /* __STDC__ */
41 #endif /* ! __cplusplus */
|
42 mike 1.1
43 #ifdef __TURBOC__
44 #pragma warn -rch
45 #pragma warn -use
46 #include <io.h>
47 #include <stdlib.h>
48 #define YY_USE_CONST
49 #define YY_USE_PROTOS
50 #endif
51
52 #ifdef YY_USE_CONST
53 #define yyconst const
54 #else
55 #define yyconst
56 #endif
57
58
59 #ifdef YY_USE_PROTOS
60 #define YY_PROTO(proto) proto
61 #else
62 #define YY_PROTO(proto) ()
63 mike 1.1 #endif
64
65 /* Returned upon end-of-file. */
66 #define YY_NULL 0
67
68 /* Promotes a possibly negative, possibly signed char to an unsigned
69 * integer for use as an array index. If the signed char is negative,
70 * we want to instead treat it as an 8-bit unsigned char, hence the
71 * double cast.
72 */
73 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
74
75 /* Enter a start condition. This macro really ought to take a parameter,
76 * but we do it the disgusting crufty way forced on us by the ()-less
77 * definition of BEGIN.
78 */
79 #define BEGIN yy_start = 1 + 2 *
80
81 /* Translate the current start state into a value that can be later handed
82 * to BEGIN to return to the state. The YYSTATE alias is for lex
83 * compatibility.
84 mike 1.1 */
85 #define YY_START ((yy_start - 1) / 2)
86 #define YYSTATE YY_START
87
88 /* Action number for EOF rule of a given start state. */
89 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
90
91 /* Special action meaning "start processing a new file". */
92 #define YY_NEW_FILE yyrestart( yyin )
93
94 #define YY_END_OF_BUFFER_CHAR 0
95
96 /* Size of default input buffer. */
97 #define YY_BUF_SIZE 16384
98
99 typedef struct yy_buffer_state *YY_BUFFER_STATE;
100
101 extern int yyleng;
102 extern FILE *yyin, *yyout;
103
104 #define EOB_ACT_CONTINUE_SCAN 0
105 mike 1.1 #define EOB_ACT_END_OF_FILE 1
106 #define EOB_ACT_LAST_MATCH 2
107
108 /* The funky do-while in the following #define is used to turn the definition
109 * int a single C statement (which needs a semi-colon terminator). This
110 * avoids problems with code like:
111 *
|
112 krisbash 1.5 * if ( condition_holds )
113 * yyless( 5 );
114 * else
115 * do_something_else();
|
116 mike 1.1 *
117 * Prior to using the do-while the compiler would get upset at the
118 * "else" because it interpreted the "if" statement as being all
119 * done when it reached the ';' after the yyless() call.
120 */
121
122 /* Return all but the first 'n' matched characters back to the input stream. */
123
124 #define yyless(n) \
|
125 krisbash 1.5 do \
126 { \
127 /* Undo effects of setting up yytext. */ \
128 *yy_cp = yy_hold_char; \
129 YY_RESTORE_YY_MORE_OFFSET \
130 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
131 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
132 } \
133 while ( 0 )
|
134 mike 1.1
135 #define unput(c) yyunput( c, yytext_ptr )
136
137 /* The following is because we cannot portably get our hands on size_t
138 * (without autoconf's help, which isn't available because we want
139 * flex-generated scanners to compile on their own).
140 */
141 typedef unsigned int yy_size_t;
142
143
144 struct yy_buffer_state
|
145 krisbash 1.5 {
146 FILE *yy_input_file;
147
148 char *yy_ch_buf; /* input buffer */
149 char *yy_buf_pos; /* current position in input buffer */
|
150 mike 1.1
|
151 krisbash 1.5 /* Size of input buffer in bytes, not including room for EOB
152 * characters.
153 */
154 yy_size_t yy_buf_size;
155
156 /* Number of characters read into yy_ch_buf, not including EOB
157 * characters.
158 */
159 int yy_n_chars;
|
160 mike 1.1
|
161 krisbash 1.5 /* Whether we "own" the buffer - i.e., we know we created it,
162 * and can PAL_Realloc() it to grow it, and should PAL_Free() it to
163 * delete it.
164 */
165 int yy_is_our_buffer;
|
166 mike 1.1
|
167 krisbash 1.5 /* Whether this is an "interactive" input source; if so, and
168 * if we're using stdio for input, then we want to use getc()
169 * instead of fread(), to make sure we stop fetching input after
170 * each newline.
171 */
172 int yy_is_interactive;
173
174 /* Whether we're considered to be at the beginning of a line.
175 * If so, '^' rules will be active on the next match, otherwise
176 * not.
177 */
178 int yy_at_bol;
179
180 /* Whether to try to fill the input buffer when we reach the
181 * end of it.
182 */
183 int yy_fill_buffer;
184
185 int yy_buffer_status;
|
186 mike 1.1 #define YY_BUFFER_NEW 0
187 #define YY_BUFFER_NORMAL 1
|
188 krisbash 1.5 /* When an EOF's been seen but there's still some text to process
189 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
190 * shouldn't try reading from the input source any more. We might
191 * still have a bunch of tokens to match, though, because of
192 * possible backing-up.
193 *
194 * When we actually see the EOF, we change the status to "new"
195 * (via yyrestart()), so that the user can continue scanning by
196 * just pointing yyin at a new input file.
197 */
|
198 mike 1.1 #define YY_BUFFER_EOF_PENDING 2
|
199 krisbash 1.5 };
|
200 mike 1.1
201 static YY_BUFFER_STATE yy_current_buffer = 0;
202
203 /* We provide macros for accessing buffer states in case in the
204 * future we want to put the buffer states in a more general
205 * "scanner state".
206 */
207 #define YY_CURRENT_BUFFER yy_current_buffer
208
209
210 /* yy_hold_char holds the character lost when yytext is formed. */
211 static char yy_hold_char;
212
|
213 krisbash 1.5 static int yy_n_chars; /* number of characters read into yy_ch_buf */
|
214 mike 1.1
215
216 int yyleng;
217
218 /* Points to current character in buffer. */
219 static char *yy_c_buf_p = (char *) 0;
|
220 krisbash 1.5 static int yy_init = 1; /* whether we need to initialize */
221 static int yy_start = 0; /* start state number */
|
222 mike 1.1
223 /* Flag which is used to allow yywrap()'s to do buffer switches
|
224 krisbash 1.5 * instead of setting up a fresh yyin. A bit of a workaround ...
|
225 mike 1.1 */
226 static int yy_did_buffer_switch_on_eof;
227
228 void yyrestart YY_PROTO(( FILE *input_file ));
229
230 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
231 void yy_load_buffer_state YY_PROTO(( void ));
232 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
233 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
234 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
235 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
236 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
237
238 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
239 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
240 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
241
242 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
243 static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
244 static void yy_flex_free YY_PROTO(( void * ));
245
246 mike 1.1 #define yy_new_buffer yy_create_buffer
247
248 #define yy_set_interactive(is_interactive) \
|
249 krisbash 1.5 { \
250 if ( ! yy_current_buffer ) \
251 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
252 yy_current_buffer->yy_is_interactive = is_interactive; \
253 }
|
254 mike 1.1
255 #define yy_set_bol(at_bol) \
|
256 krisbash 1.5 { \
257 if ( ! yy_current_buffer ) \
258 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
259 yy_current_buffer->yy_at_bol = at_bol; \
260 }
|
261 mike 1.1
262 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
263
264 typedef unsigned char YY_CHAR;
265 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
266 typedef int yy_state_type;
267 extern char *yytext;
268 #define yytext_ptr yytext
269
270 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
271 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
272 static int yy_get_next_buffer YY_PROTO(( void ));
273 static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
274
275 /* Done after the current pattern has been matched and before the
276 * corresponding action - sets up yytext.
277 */
278 #define YY_DO_BEFORE_ACTION \
|
279 krisbash 1.5 yytext_ptr = yy_bp; \
280 yyleng = (int) (yy_cp - yy_bp); \
281 yy_hold_char = *yy_cp; \
282 *yy_cp = '\0'; \
283 yy_c_buf_p = yy_cp;
284
285 #define YY_NUM_RULES 67
286 #define YY_END_OF_BUFFER 68
287 static yyconst short int yy_accept[286] =
|
288 mike 1.1 { 0,
|
289 krisbash 1.5 0, 0, 68, 66, 65, 65, 43, 66, 66, 66,
290 56, 57, 66, 64, 66, 66, 47, 48, 48, 62,
291 63, 55, 53, 53, 53, 53, 53, 53, 53, 53,
292 53, 53, 53, 53, 53, 53, 53, 53, 53, 58,
293 59, 60, 61, 65, 0, 54, 0, 0, 0, 47,
294 48, 48, 49, 41, 42, 51, 51, 0, 52, 0,
295 48, 48, 53, 53, 38, 53, 53, 53, 53, 53,
296 53, 53, 53, 53, 53, 53, 53, 37, 53, 53,
297 53, 53, 53, 53, 53, 53, 53, 53, 0, 54,
298 44, 0, 44, 0, 0, 50, 28, 53, 53, 53,
299
300 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
301 53, 53, 53, 53, 53, 18, 53, 53, 53, 53,
302 53, 53, 53, 53, 53, 0, 45, 0, 0, 49,
303 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
304 53, 53, 3, 53, 53, 53, 53, 53, 53, 53,
305 53, 53, 53, 53, 53, 53, 1, 53, 0, 46,
306 53, 53, 53, 20, 53, 53, 53, 2, 53, 53,
307 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
308 19, 53, 53, 53, 5, 53, 53, 53, 53, 53,
309 53, 53, 6, 0, 53, 53, 16, 53, 53, 53,
310 krisbash 1.5
311 29, 53, 53, 26, 39, 53, 53, 53, 13, 14,
312 53, 53, 7, 9, 11, 17, 53, 53, 53, 8,
313 10, 12, 0, 53, 4, 53, 53, 53, 53, 53,
314 53, 53, 53, 53, 53, 53, 53, 53, 40, 53,
315 15, 53, 53, 53, 36, 53, 24, 53, 53, 53,
316 53, 53, 53, 53, 53, 53, 53, 27, 23, 25,
317 53, 53, 53, 53, 53, 53, 53, 22, 32, 34,
318 33, 53, 21, 53, 53, 53, 53, 53, 35, 53,
319 53, 53, 30, 31, 0
|
320 mike 1.1 } ;
321
322 static yyconst int yy_ec[256] =
323 { 0,
324 1, 1, 1, 1, 1, 1, 1, 2, 2, 3,
325 1, 2, 2, 1, 1, 1, 1, 1, 1, 1,
326 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
327 1, 4, 1, 5, 6, 7, 1, 1, 8, 9,
328 10, 11, 12, 13, 12, 14, 15, 16, 17, 18,
329 19, 20, 21, 22, 21, 23, 24, 25, 26, 1,
330 27, 1, 1, 1, 28, 29, 30, 31, 32, 33,
|
331 krisbash 1.5 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
332 44, 45, 46, 47, 48, 49, 38, 50, 51, 38,
333 52, 53, 54, 1, 38, 1, 28, 55, 30, 31,
334
335 32, 56, 34, 35, 36, 37, 38, 39, 40, 57,
336 42, 43, 44, 58, 46, 59, 48, 49, 38, 50,
337 51, 38, 60, 1, 61, 1, 1, 1, 1, 1,
|
338 mike 1.1 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
339 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
340 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
341 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
342 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
343 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
344 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
345
346 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
347 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
348 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
349 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
350 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
351 1, 1, 1, 1, 1
352 } ;
353
|
354 krisbash 1.5 static yyconst int yy_meta[62] =
|
355 mike 1.1 { 0,
|
356 krisbash 1.5 1, 1, 1, 1, 1, 1, 1, 2, 1, 1,
357 1, 3, 1, 4, 1, 5, 5, 5, 5, 5,
358 5, 5, 5, 5, 1, 1, 1, 6, 6, 6,
359 6, 7, 6, 8, 8, 8, 8, 8, 8, 8,
360 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
361 8, 1, 1, 1, 6, 6, 8, 8, 8, 1,
362 1
|
363 mike 1.1 } ;
364
|
365 krisbash 1.5 static yyconst short int yy_base[296] =
|
366 mike 1.1 { 0,
|
367 krisbash 1.5 0, 0, 460, 461, 60, 63, 461, 416, 0, 405,
368 461, 461, 54, 461, 56, 70, 72, 114, 86, 461,
369 461, 461, 41, 415, 65, 69, 42, 78, 0, 66,
370 424, 407, 91, 81, 406, 421, 112, 71, 416, 461,
371 461, 461, 461, 108, 63, 0, 443, 144, 144, 0,
372 0, 0, 418, 461, 461, 399, 128, 434, 461, 0,
373 0, 0, 0, 396, 400, 403, 416, 415, 111, 396,
374 413, 401, 411, 38, 125, 399, 400, 0, 95, 394,
375 407, 149, 392, 132, 129, 139, 128, 139, 405, 0,
376 461, 424, 423, 0, 418, 0, 0, 387, 389, 134,
377
378 381, 394, 397, 96, 378, 374, 386, 134, 386, 381,
379 387, 390, 374, 377, 376, 382, 139, 370, 157, 376,
380 149, 363, 150, 378, 161, 375, 461, 400, 205, 214,
381 377, 374, 388, 358, 192, 159, 364, 370, 359, 370,
382 371, 356, 0, 367, 356, 363, 358, 190, 195, 196,
383 361, 196, 201, 346, 188, 345, 0, 227, 350, 461,
384 353, 360, 365, 0, 350, 346, 352, 0, 202, 355,
385 204, 351, 205, 349, 210, 215, 362, 359, 346, 341,
386 0, 354, 357, 354, 0, 339, 210, 342, 332, 348,
387 351, 348, 0, 339, 338, 215, 0, 325, 332, 321,
388 krisbash 1.5
389 0, 215, 332, 0, 0, 216, 218, 325, 0, 0,
390 225, 330, 0, 0, 0, 0, 331, 319, 329, 0,
391 0, 0, 352, 220, 0, 323, 312, 304, 316, 319,
392 318, 298, 316, 317, 226, 229, 318, 229, 461, 308,
393 0, 284, 283, 267, 0, 233, 0, 235, 275, 274,
394 274, 255, 272, 256, 265, 236, 242, 0, 0, 0,
395 265, 258, 213, 255, 246, 244, 247, 0, 0, 0,
396 0, 172, 0, 250, 174, 123, 118, 119, 0, 88,
397 86, 82, 0, 0, 461, 305, 313, 318, 319, 323,
398 327, 331, 332, 335, 340
399
|
400 mike 1.1 } ;
401
|
402 krisbash 1.5 static yyconst short int yy_def[296] =
|
403 mike 1.1 { 0,
|
404 krisbash 1.5 285, 1, 285, 285, 285, 285, 285, 285, 286, 287,
405 285, 285, 288, 285, 285, 285, 285, 285, 18, 285,
406 285, 285, 289, 289, 289, 289, 289, 289, 289, 289,
407 289, 289, 289, 289, 289, 289, 289, 289, 289, 285,
408 285, 285, 285, 285, 285, 290, 285, 285, 285, 17,
409 18, 19, 291, 285, 285, 17, 17, 292, 285, 293,
410 18, 19, 289, 289, 289, 289, 289, 289, 289, 289,
411 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
412 289, 289, 289, 289, 289, 289, 289, 289, 285, 290,
413 285, 285, 285, 294, 295, 293, 289, 289, 289, 289,
414
415 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
416 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
417 289, 289, 289, 289, 289, 285, 285, 294, 285, 285,
418 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
419 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
420 289, 289, 289, 289, 289, 289, 289, 289, 285, 285,
421 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
422 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
423 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
424 289, 289, 289, 285, 289, 289, 289, 289, 289, 289,
425 krisbash 1.5
426 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
427 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
428 289, 289, 285, 289, 289, 289, 289, 289, 289, 289,
429 289, 289, 289, 289, 289, 289, 289, 289, 285, 289,
430 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
431 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
432 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
433 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
434 289, 289, 289, 289, 0, 285, 285, 285, 285, 285,
435 285, 285, 285, 285, 285
436
|
437 mike 1.1 } ;
438
|
439 krisbash 1.5 static yyconst short int yy_nxt[523] =
|
440 mike 1.1 { 0,
441 4, 5, 6, 5, 7, 8, 9, 10, 11, 12,
442 4, 13, 14, 15, 16, 17, 18, 19, 19, 19,
443 19, 19, 19, 19, 20, 21, 22, 23, 24, 25,
|
444 krisbash 1.5 26, 27, 28, 29, 29, 30, 29, 29, 29, 31,
445 32, 33, 34, 35, 36, 37, 38, 39, 29, 29,
446 29, 40, 4, 41, 24, 28, 32, 36, 38, 42,
447 43, 44, 44, 44, 44, 44, 44, 49, 107, 50,
448 51, 53, 53, 53, 53, 53, 53, 53, 53, 53,
449 54, 64, 71, 108, 55, 49, 65, 56, 56, 57,
450 57, 57, 57, 57, 58, 58, 69, 64, 71, 67,
451
452 59, 62, 62, 68, 70, 72, 74, 89, 79, 44,
453 44, 44, 86, 284, 285, 87, 73, 283, 282, 77,
454 89, 60, 74, 78, 137, 80, 59, 49, 87, 61,
455 61, 62, 62, 62, 62, 62, 62, 62, 80, 112,
456 285, 83, 59, 57, 57, 77, 78, 84, 92, 281,
457 137, 93, 112, 280, 279, 123, 285, 102, 85, 53,
458 53, 53, 53, 53, 53, 53, 53, 53, 59, 102,
459 85, 109, 119, 120, 121, 124, 115, 285, 133, 125,
460 141, 116, 285, 109, 122, 150, 120, 166, 119, 154,
461 156, 133, 141, 94, 117, 125, 92, 150, 92, 92,
462
463 92, 92, 92, 152, 116, 154, 156, 158, 177, 278,
464 276, 178, 182, 166, 183, 152, 188, 184, 185, 158,
465 krisbash 1.5 130, 130, 130, 130, 130, 130, 130, 130, 130, 130,
466 130, 130, 130, 130, 130, 130, 130, 130, 165, 179,
467 180, 186, 188, 190, 203, 191, 201, 208, 192, 193,
468 165, 205, 179, 180, 207, 225, 217, 186, 271, 201,
469 203, 229, 231, 205, 232, 234, 240, 207, 217, 251,
470 208, 225, 250, 229, 231, 253, 232, 258, 240, 259,
471 267, 234, 268, 272, 250, 251, 273, 253, 274, 270,
472 258, 275, 259, 267, 277, 269, 266, 265, 268, 264,
473
474 263, 274, 273, 262, 275, 261, 260, 277, 257, 272,
475 46, 46, 46, 47, 256, 47, 47, 47, 47, 47,
476 47, 52, 52, 63, 63, 63, 63, 90, 90, 90,
477 90, 53, 255, 53, 58, 58, 96, 96, 96, 128,
478 128, 128, 130, 254, 130, 252, 249, 248, 247, 246,
479 245, 244, 243, 242, 241, 239, 238, 237, 236, 235,
480 233, 230, 228, 227, 226, 224, 223, 222, 221, 220,
481 219, 218, 216, 215, 214, 213, 212, 211, 210, 209,
482 206, 204, 202, 200, 199, 198, 197, 196, 195, 194,
483 189, 187, 181, 176, 175, 174, 173, 172, 171, 170,
484
485 169, 168, 167, 164, 163, 162, 161, 160, 159, 157,
486 krisbash 1.5 155, 153, 151, 149, 148, 147, 146, 145, 144, 143,
487 142, 140, 139, 138, 136, 135, 134, 132, 131, 129,
488 127, 127, 126, 118, 114, 113, 111, 110, 106, 105,
489 104, 103, 101, 100, 99, 98, 97, 49, 285, 95,
490 91, 88, 82, 81, 76, 75, 66, 48, 45, 285,
491 3, 285, 285, 285, 285, 285, 285, 285, 285, 285,
492 285, 285, 285, 285, 285, 285, 285, 285, 285, 285,
493 285, 285, 285, 285, 285, 285, 285, 285, 285, 285,
494 285, 285, 285, 285, 285, 285, 285, 285, 285, 285,
495
496 285, 285, 285, 285, 285, 285, 285, 285, 285, 285,
497 285, 285, 285, 285, 285, 285, 285, 285, 285, 285,
498 285, 285
|
499 mike 1.1 } ;
500
|
501 krisbash 1.5 static yyconst short int yy_chk[523] =
|
502 mike 1.1 { 0,
503 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
504 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
505 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
506 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
507 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
508 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
509 krisbash 1.5 1, 5, 5, 5, 6, 6, 6, 13, 74, 13,
510 13, 15, 15, 15, 15, 15, 15, 15, 15, 15,
511 16, 23, 27, 74, 16, 17, 23, 17, 17, 17,
512 17, 17, 17, 17, 17, 17, 26, 23, 27, 25,
513
514 17, 19, 19, 25, 26, 28, 30, 45, 34, 44,
515 44, 44, 38, 282, 19, 38, 28, 281, 280, 33,
516 45, 17, 30, 33, 104, 34, 17, 18, 38, 18,
517 18, 18, 18, 18, 18, 18, 18, 18, 34, 79,
518 19, 37, 18, 57, 57, 33, 33, 37, 48, 278,
519 104, 48, 79, 277, 276, 87, 57, 69, 37, 49,
520 49, 49, 49, 49, 49, 49, 49, 49, 18, 69,
521 37, 75, 84, 85, 86, 87, 82, 57, 100, 88,
522 108, 82, 57, 75, 86, 117, 85, 136, 84, 121,
523 123, 100, 108, 48, 82, 88, 48, 117, 48, 48,
524
525 48, 48, 48, 119, 82, 121, 123, 125, 148, 275,
526 272, 148, 152, 136, 152, 119, 155, 152, 152, 125,
527 129, 129, 129, 129, 129, 129, 129, 129, 129, 130,
528 130, 130, 130, 130, 130, 130, 130, 130, 135, 149,
529 150, 153, 155, 158, 171, 158, 169, 176, 158, 158,
530 krisbash 1.5 135, 173, 149, 150, 175, 196, 187, 153, 263, 169,
531 171, 202, 206, 173, 207, 211, 224, 175, 187, 236,
532 176, 196, 235, 202, 206, 238, 207, 246, 224, 248,
533 256, 211, 257, 264, 235, 236, 265, 238, 266, 262,
534 246, 267, 248, 256, 274, 261, 255, 254, 257, 253,
535
536 252, 266, 265, 251, 267, 250, 249, 274, 244, 264,
537 286, 286, 286, 287, 243, 287, 287, 287, 287, 287,
538 287, 288, 288, 289, 289, 289, 289, 290, 290, 290,
539 290, 291, 242, 291, 292, 292, 293, 293, 293, 294,
540 294, 294, 295, 240, 295, 237, 234, 233, 232, 231,
541 230, 229, 228, 227, 226, 223, 219, 218, 217, 212,
542 208, 203, 200, 199, 198, 195, 194, 192, 191, 190,
543 189, 188, 186, 184, 183, 182, 180, 179, 178, 177,
544 174, 172, 170, 167, 166, 165, 163, 162, 161, 159,
545 156, 154, 151, 147, 146, 145, 144, 142, 141, 140,
546
547 139, 138, 137, 134, 133, 132, 131, 128, 126, 124,
548 122, 120, 118, 116, 115, 114, 113, 112, 111, 110,
549 109, 107, 106, 105, 103, 102, 101, 99, 98, 95,
550 93, 92, 89, 83, 81, 80, 77, 76, 73, 72,
551 krisbash 1.5 71, 70, 68, 67, 66, 65, 64, 58, 56, 53,
552 47, 39, 36, 35, 32, 31, 24, 10, 8, 3,
553 285, 285, 285, 285, 285, 285, 285, 285, 285, 285,
554 285, 285, 285, 285, 285, 285, 285, 285, 285, 285,
555 285, 285, 285, 285, 285, 285, 285, 285, 285, 285,
556 285, 285, 285, 285, 285, 285, 285, 285, 285, 285,
557
558 285, 285, 285, 285, 285, 285, 285, 285, 285, 285,
559 285, 285, 285, 285, 285, 285, 285, 285, 285, 285,
560 285, 285
|
561 mike 1.1 } ;
562
563 static yy_state_type yy_last_accepting_state;
564 static char *yy_last_accepting_cpos;
565
566 /* The intent behind this definition is that it'll catch
567 * any uses of REJECT which flex missed.
568 */
569 #define REJECT reject_used_but_not_detected
570 #define yymore() yymore_used_but_not_detected
571 #define YY_MORE_ADJ 0
572 #define YY_RESTORE_YY_MORE_OFFSET
573 char *yytext;
574 #line 1 "mof.l"
575 #define INITIAL 0
576 /*
577 **==============================================================================
578 **
579 ** mof.lex
580 **
581 ** This file defines a lexigraphical analyzer for the Managed Object Format
582 mike 1.1 ** (MOF). See the BNF in the CIM Infrastructure Specification.
583 **
584 **==============================================================================
585 */
586 #line 13 "mof.l"
587
588 /* Do not read from standard input */
589 #define YY_NEVER_INTERACTIVE 1
590 #define MOF_STACK_SIZE 32
591
592 #include "config.h"
593 #include "mof.h"
594 #include "types.h"
595 #include "mofyacc.h"
596 #include "buffer.h"
597 #include "ptrarray.h"
598 #include "state.h"
599 #include <stdlib.h>
600 #include <string.h>
601 #include <stdarg.h>
602
603 mike 1.1 extern int yyparse();
604 int closeIncludeFile();
605
606 struct _MOF_Parser
607 {
608 MOF_State state;
609 };
610
611 typedef struct _StackItem
612 {
613 char* file;
614 unsigned int line;
615 YY_BUFFER_STATE buffer;
616 }
617 StackItem;
618
619 /* Stack of parser states for open nested MOF files */
620 static StackItem s_stack[MOF_STACK_SIZE];
621
622 /* Current size of stack s_stack[s_top-1] is the top */
623 static size_t s_top = 0;
624 mike 1.1
625 /*
626 **==============================================================================
627 **
628 ** Case-insensitive keywords (see CIM Infrastructure specification).
629 **
630 **==============================================================================
631 */
632 /* True and false */
633 /* Null value */
634 /* Data types */
635 /* Ref */
636 /* Scope */
637 /* Flavor */
638 /* Instance of */
|
639 krisbash 1.5 /* Object */
|
640 mike 1.1 /* Alias */
641 /* #pragma */
642 /*
643 **==============================================================================
644 **
645 ** Literal productions (see CIM Infrastructure specification).
646 **
647 **==============================================================================
648 */
649 /*
650 **------------------------------------------------------------------------------
651 **
652 ** Lex productions:
653 **
654 **------------------------------------------------------------------------------
655 */
|
656 krisbash 1.5 #line 657 "lex.yy.c"
|
657 mike 1.1
658 /* Macros after this point can all be overridden by user definitions in
659 * section 1.
660 */
661
662 #ifndef YY_SKIP_YYWRAP
663 #ifdef __cplusplus
664 extern "C" int yywrap YY_PROTO(( void ));
665 #else
666 extern int yywrap YY_PROTO(( void ));
667 #endif
668 #endif
669
670 #ifndef YY_NO_UNPUT
671 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
672 #endif
673
674 #ifndef yytext_ptr
675 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
676 #endif
677
678 mike 1.1 #ifdef YY_NEED_STRLEN
679 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
680 #endif
681
682 #ifndef YY_NO_INPUT
683 #ifdef __cplusplus
684 static int yyinput YY_PROTO(( void ));
685 #else
686 static int input YY_PROTO(( void ));
687 #endif
688 #endif
689
690 #if YY_STACK_USED
691 static int yy_start_stack_ptr = 0;
692 static int yy_start_stack_depth = 0;
693 static int *yy_start_stack = 0;
694 #ifndef YY_NO_PUSH_STATE
695 static void yy_push_state YY_PROTO(( int new_state ));
696 #endif
697 #ifndef YY_NO_POP_STATE
698 static void yy_pop_state YY_PROTO(( void ));
699 mike 1.1 #endif
700 #ifndef YY_NO_TOP_STATE
701 static int yy_top_state YY_PROTO(( void ));
702 #endif
703
704 #else
705 #define YY_NO_PUSH_STATE 1
706 #define YY_NO_POP_STATE 1
707 #define YY_NO_TOP_STATE 1
708 #endif
709
710 #ifdef YY_MALLOC_DECL
711 YY_MALLOC_DECL
712 #else
713 #if __STDC__
714 #ifndef __cplusplus
715 #include <stdlib.h>
716 #endif
717 #else
718 /* Just try to get by without declaring the routines. This will fail
719 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
720 mike 1.1 * or sizeof(void*) != sizeof(int).
721 */
722 #endif
723 #endif
724
725 /* Amount of stuff to slurp up with each read. */
726 #ifndef YY_READ_BUF_SIZE
727 #define YY_READ_BUF_SIZE 8192
728 #endif
729
730 /* Copy whatever the last rule matched to the standard output. */
731
732 #ifndef ECHO
733 /* This used to be an fputs(), but since the string might contain NUL's,
734 * we now use fwrite().
735 */
736 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
737 #endif
738
739 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
740 * is returned in "result".
741 mike 1.1 */
742 #ifndef YY_INPUT
743 #define YY_INPUT(buf,result,max_size) \
|
744 krisbash 1.5 if ( yy_current_buffer->yy_is_interactive ) \
745 { \
746 int c = '*', n; \
747 for ( n = 0; n < max_size && \
748 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
749 buf[n] = (char) c; \
750 if ( c == '\n' ) \
751 buf[n++] = (char) c; \
752 if ( c == EOF && ferror( yyin ) ) \
753 YY_FATAL_ERROR( "input in flex scanner failed" ); \
754 result = n; \
755 } \
756 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
757 && ferror( yyin ) ) \
758 YY_FATAL_ERROR( "input in flex scanner failed" );
|
759 mike 1.1 #endif
760
761 /* No semi-colon after return; correct usage is to write "yyterminate();" -
762 * we don't want an extra ';' after the "return" because that will cause
763 * some compilers to complain about unreachable statements.
764 */
765 #ifndef yyterminate
766 #define yyterminate() return YY_NULL
767 #endif
768
769 /* Number of entries by which start-condition stack grows. */
770 #ifndef YY_START_STACK_INCR
771 #define YY_START_STACK_INCR 25
772 #endif
773
774 /* Report a fatal error. */
775 #ifndef YY_FATAL_ERROR
776 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
777 #endif
778
779 /* Default declaration of generated scanner - a define so the user can
780 mike 1.1 * easily add parameters.
781 */
782 #ifndef YY_DECL
783 #define YY_DECL int yylex YY_PROTO(( void ))
784 #endif
785
786 /* Code executed at the beginning of each rule, after yytext and yyleng
787 * have been set up.
788 */
789 #ifndef YY_USER_ACTION
790 #define YY_USER_ACTION
791 #endif
792
793 /* Code executed at the end of each rule. */
794 #ifndef YY_BREAK
795 #define YY_BREAK break;
796 #endif
797
798 #define YY_RULE_SETUP \
|
799 krisbash 1.5 YY_USER_ACTION
|
800 mike 1.1
801 YY_DECL
|
802 krisbash 1.5 {
803 register yy_state_type yy_current_state;
804 register char *yy_cp, *yy_bp;
805 register int yy_act;
|
806 mike 1.1
|
807 krisbash 1.5 #line 150 "mof.l"
|
808 mike 1.1
809
|
810 krisbash 1.5 #line 811 "lex.yy.c"
|
811 mike 1.1
|
812 krisbash 1.5 if ( yy_init )
813 {
814 yy_init = 0;
|
815 mike 1.1
816 #ifdef YY_USER_INIT
|
817 krisbash 1.5 YY_USER_INIT;
|
818 mike 1.1 #endif
819
|
820 krisbash 1.5 if ( ! yy_start )
821 yy_start = 1; /* first start state */
|
822 mike 1.1
|
823 krisbash 1.5 if ( ! yyin )
824 yyin = stdin;
|
825 mike 1.1
|
826 krisbash 1.5 if ( ! yyout )
827 yyout = stdout;
|
828 mike 1.1
|
829 krisbash 1.5 if ( ! yy_current_buffer )
830 yy_current_buffer =
831 yy_create_buffer( yyin, YY_BUF_SIZE );
|
832 mike 1.1
|
833 krisbash 1.5 yy_load_buffer_state();
834 }
|
835 mike 1.1
|
836 krisbash 1.5 while ( 1 ) /* loops until end-of-file is reached */
837 {
838 yy_cp = yy_c_buf_p;
|
839 mike 1.1
|
840 krisbash 1.5 /* Support of yytext. */
841 *yy_cp = yy_hold_char;
|
842 mike 1.1
|
843 krisbash 1.5 /* yy_bp points to the position in yy_ch_buf of the start of
844 * the current run.
845 */
846 yy_bp = yy_cp;
|
847 mike 1.1
|
848 krisbash 1.5 yy_current_state = yy_start;
|
849 mike 1.1 yy_match:
|
850 krisbash 1.5 do
851 {
852 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
853 if ( yy_accept[yy_current_state] )
854 {
855 yy_last_accepting_state = yy_current_state;
856 yy_last_accepting_cpos = yy_cp;
857 }
858 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
859 {
860 yy_current_state = (int) yy_def[yy_current_state];
861 if ( yy_current_state >= 286 )
862 yy_c = yy_meta[(unsigned int) yy_c];
863 }
864 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
865 ++yy_cp;
866 }
867 while ( yy_base[yy_current_state] != 461 );
|
868 mike 1.1
869 yy_find_action:
|
870 krisbash 1.5 yy_act = yy_accept[yy_current_state];
871 if ( yy_act == 0 )
872 { /* have to back up */
873 yy_cp = yy_last_accepting_cpos;
874 yy_current_state = yy_last_accepting_state;
875 yy_act = yy_accept[yy_current_state];
876 }
877
878 YY_DO_BEFORE_ACTION;
879
880
881 do_action: /* This label is used only to access EOF actions. */
882
883
884 switch ( yy_act )
885 { /* beginning of action switch */
886 case 0: /* must back up */
887 /* undo the effects of YY_DO_BEFORE_ACTION */
888 *yy_cp = yy_hold_char;
889 yy_cp = yy_last_accepting_cpos;
890 yy_current_state = yy_last_accepting_state;
891 krisbash 1.5 goto yy_find_action;
|
892 mike 1.1
893 case YY_STATE_EOF(INITIAL):
|
894 krisbash 1.5 #line 152 "mof.l"
|
895 mike 1.1 {
896 if (s_top == 0)
897 yyterminate();
898 else
899 {
900 if (closeIncludeFile() != 0)
901 return TOK_ERROR;
902 }
903 }
|
904 krisbash 1.5 YY_BREAK
|
905 mike 1.1 case 1:
906 YY_RULE_SETUP
|
907 krisbash 1.5 #line 162 "mof.l"
|
908 mike 1.1 {
909 yylval.boolean = 1;
910 return TOK_BOOLEAN_VALUE;
911 }
|
912 krisbash 1.5 YY_BREAK
|
913 mike 1.1 case 2:
914 YY_RULE_SETUP
|
915 krisbash 1.5 #line 167 "mof.l"
|
916 mike 1.1 {
917 yylval.boolean = 0;
918 return TOK_BOOLEAN_VALUE;
919 }
|
920 krisbash 1.5 YY_BREAK
|
921 mike 1.1 case 3:
922 YY_RULE_SETUP
|
923 krisbash 1.5 #line 172 "mof.l"
|
924 mike 1.1 {
925 return TOK_NULL;
926 }
|
927 krisbash 1.5 YY_BREAK
|
928 mike 1.1 case 4:
929 YY_RULE_SETUP
|
930 krisbash 1.5 #line 176 "mof.l"
|
931 mike 1.1 {
|
932 krisbash 1.5 yylval.identifier = MOF_Strdup(&state.heap, yytext);
|
933 mike 1.1 return TOK_BOOLEAN;
934 }
|
935 krisbash 1.5 YY_BREAK
|
936 mike 1.1 case 5:
937 YY_RULE_SETUP
|
938 krisbash 1.5 #line 181 "mof.l"
|
939 mike 1.1 {
940 return TOK_SINT8;
941 }
|
942 krisbash 1.5 YY_BREAK
|
943 mike 1.1 case 6:
944 YY_RULE_SETUP
|
945 krisbash 1.5 #line 185 "mof.l"
|
946 mike 1.1 {
947 return TOK_UINT8;
948 }
|
949 krisbash 1.5 YY_BREAK
|
950 mike 1.1 case 7:
951 YY_RULE_SETUP
|
952 krisbash 1.5 #line 189 "mof.l"
|
953 mike 1.1 {
954 return TOK_SINT16;
955 }
|
956 krisbash 1.5 YY_BREAK
|
957 mike 1.1 case 8:
958 YY_RULE_SETUP
|
959 krisbash 1.5 #line 193 "mof.l"
|
960 mike 1.1 {
961 return TOK_UINT16;
962 }
|
963 krisbash 1.5 YY_BREAK
|
964 mike 1.1 case 9:
965 YY_RULE_SETUP
|
966 krisbash 1.5 #line 197 "mof.l"
|
967 mike 1.1 {
968 return TOK_SINT32;
969 }
|
970 krisbash 1.5 YY_BREAK
|
971 mike 1.1 case 10:
972 YY_RULE_SETUP
|
973 krisbash 1.5 #line 201 "mof.l"
|
974 mike 1.1 {
975 return TOK_UINT32;
976 }
|
977 krisbash 1.5 YY_BREAK
|
978 mike 1.1 case 11:
979 YY_RULE_SETUP
|
980 krisbash 1.5 #line 205 "mof.l"
|
981 mike 1.1 {
982 return TOK_SINT64;
983 }
|
984 krisbash 1.5 YY_BREAK
|
985 mike 1.1 case 12:
986 YY_RULE_SETUP
|
987 krisbash 1.5 #line 209 "mof.l"
|
988 mike 1.1 {
989 return TOK_UINT64;
990 }
|
991 krisbash 1.5 YY_BREAK
|
992 mike 1.1 case 13:
993 YY_RULE_SETUP
|
994 krisbash 1.5 #line 213 "mof.l"
|
995 mike 1.1 {
996 return TOK_REAL32;
997 }
|
998 krisbash 1.5 YY_BREAK
|
999 mike 1.1 case 14:
1000 YY_RULE_SETUP
|
1001 krisbash 1.5 #line 217 "mof.l"
|
1002 mike 1.1 {
1003 return TOK_REAL64;
1004 }
|
1005 krisbash 1.5 YY_BREAK
|
1006 mike 1.1 case 15:
1007 YY_RULE_SETUP
|
1008 krisbash 1.5 #line 221 "mof.l"
|
1009 mike 1.1 {
|
1010 krisbash 1.5 yylval.identifier = MOF_Strdup(&state.heap, yytext);
|
1011 mike 1.1 return TOK_DATETIME;
1012 }
|
1013 krisbash 1.5 YY_BREAK
|
1014 mike 1.1 case 16:
1015 YY_RULE_SETUP
|
1016 krisbash 1.5 #line 226 "mof.l"
|
1017 mike 1.1 {
1018 return TOK_CHAR16;
1019 }
|
1020 krisbash 1.5 YY_BREAK
|
1021 mike 1.1 case 17:
1022 YY_RULE_SETUP
|
1023 krisbash 1.5 #line 230 "mof.l"
|
1024 mike 1.1 {
|
1025 krisbash 1.5 yylval.identifier = MOF_Strdup(&state.heap, yytext);
|
1026 mike 1.1 return TOK_STRING;
1027 }
|
1028 krisbash 1.5 YY_BREAK
|
1029 mike 1.1 case 18:
1030 YY_RULE_SETUP
|
1031 krisbash 1.5 #line 235 "mof.l"
|
1032 mike 1.1 {
1033 return TOK_REF;
1034 }
|
1035 krisbash 1.5 YY_BREAK
|
1036 mike 1.1 case 19:
1037 YY_RULE_SETUP
|
1038 krisbash 1.5 #line 239 "mof.l"
|
1039 mike 1.1 {
1040 return TOK_SCOPE;
1041 }
|
1042 krisbash 1.5 YY_BREAK
|
1043 mike 1.1 case 20:
1044 YY_RULE_SETUP
|
1045 krisbash 1.5 #line 243 "mof.l"
|
1046 mike 1.1 {
|
1047 krisbash 1.5 yylval.identifier = MOF_Strdup(&state.heap, yytext);
|
1048 mike 1.1 return TOK_CLASS;
1049 }
|
1050 krisbash 1.5 YY_BREAK
|
1051 mike 1.1 case 21:
1052 YY_RULE_SETUP
|
1053 krisbash 1.5 #line 248 "mof.l"
|
1054 mike 1.1 {
|
1055 krisbash 1.5 yylval.identifier = MOF_Strdup(&state.heap, yytext);
|
1056 mike 1.1 return TOK_ASSOCIATION;
1057 }
|
1058 krisbash 1.5 YY_BREAK
|
1059 mike 1.1 case 22:
1060 YY_RULE_SETUP
|
1061 krisbash 1.5 #line 253 "mof.l"
|
1062 mike 1.1 {
|
1063 krisbash 1.5 yylval.identifier = MOF_Strdup(&state.heap, yytext);
|
1064 mike 1.1 return TOK_INDICATION;
1065 }
|
1066 krisbash 1.5 YY_BREAK
|
1067 mike 1.1 case 23:
1068 YY_RULE_SETUP
|
1069 krisbash 1.5 #line 258 "mof.l"
|
1070 mike 1.1 {
|
1071 krisbash 1.5 yylval.identifier = MOF_Strdup(&state.heap, yytext);
|
1072 mike 1.1 return TOK_QUALIFIER;
1073 }
|
1074 krisbash 1.5 YY_BREAK
|
1075 mike 1.1 case 24:
1076 YY_RULE_SETUP
|
1077 krisbash 1.5 #line 263 "mof.l"
|
1078 mike 1.1 {
|
1079 krisbash 1.5 yylval.identifier = MOF_Strdup(&state.heap, yytext);
|
1080 mike 1.1 return TOK_PROPERTY;
1081 }
|
1082 krisbash 1.5 YY_BREAK
|
1083 mike 1.1 case 25:
1084 YY_RULE_SETUP
|
1085 krisbash 1.5 #line 268 "mof.l"
|
1086 mike 1.1 {
|
1087 krisbash 1.5 yylval.identifier = MOF_Strdup(&state.heap, yytext);
|
1088 mike 1.1 return TOK_REFERENCE;
1089 }
|
1090 krisbash 1.5 YY_BREAK
|
1091 mike 1.1 case 26:
1092 YY_RULE_SETUP
|
1093 krisbash 1.5 #line 273 "mof.l"
|
1094 mike 1.1 {
|
1095 krisbash 1.5 yylval.identifier = MOF_Strdup(&state.heap, yytext);
|
1096 mike 1.1 return TOK_METHOD;
1097 }
|
1098 krisbash 1.5 YY_BREAK
|
1099 mike 1.1 case 27:
1100 YY_RULE_SETUP
|
1101 krisbash 1.5 #line 278 "mof.l"
|
1102 mike 1.1 {
|
1103 krisbash 1.5 yylval.identifier = MOF_Strdup(&state.heap, yytext);
|
1104 mike 1.1 return TOK_PARAMETER;
1105 }
|
1106 krisbash 1.5 YY_BREAK
|
1107 mike 1.1 case 28:
1108 YY_RULE_SETUP
|
1109 krisbash 1.5 #line 283 "mof.l"
|
1110 mike 1.1 {
|
1111 krisbash 1.5 yylval.identifier = MOF_Strdup(&state.heap, yytext);
1112 return TOK_ANY;
|
1113 mike 1.1 }
|
1114 krisbash 1.5 YY_BREAK
|
1115 mike 1.1 case 29:
1116 YY_RULE_SETUP
|
1117 krisbash 1.5 #line 288 "mof.l"
|
1118 mike 1.1 {
|
1119 krisbash 1.5 yylval.identifier = MOF_Strdup(&state.heap, yytext);
|
1120 mike 1.1 return TOK_FLAVOR;
1121 }
|
1122 krisbash 1.5 YY_BREAK
|
1123 mike 1.1 case 30:
1124 YY_RULE_SETUP
|
1125 krisbash 1.5 #line 293 "mof.l"
|
1126 mike 1.1 {
|
1127 krisbash 1.5 yylval.identifier = MOF_Strdup(&state.heap, yytext);
|
1128 mike 1.1 return TOK_ENABLEOVERRIDE;
1129 }
|
1130 krisbash 1.5 YY_BREAK
|
1131 mike 1.1 case 31:
1132 YY_RULE_SETUP
|
1133 krisbash 1.5 #line 298 "mof.l"
|
1134 mike 1.1 {
|
1135 krisbash 1.5 yylval.identifier = MOF_Strdup(&state.heap, yytext);
|
1136 mike 1.1 return TOK_DISABLEOVERRIDE;
1137 }
|
1138 krisbash 1.5 YY_BREAK
|
1139 mike 1.1 case 32:
1140 YY_RULE_SETUP
|
1141 krisbash 1.5 #line 303 "mof.l"
|
1142 mike 1.1 {
|
1143 krisbash 1.5 yylval.identifier = MOF_Strdup(&state.heap, yytext);
|
1144 mike 1.1 return TOK_RESTRICTED;
1145 }
|
1146 krisbash 1.5 YY_BREAK
|
1147 mike 1.1 case 33:
1148 YY_RULE_SETUP
|
1149 krisbash 1.5 #line 308 "mof.l"
|
1150 mike 1.1 {
|
1151 krisbash 1.5 yylval.identifier = MOF_Strdup(&state.heap, yytext);
|
1152 mike 1.1 return TOK_TOSUBCLASS;
1153 }
|
1154 krisbash 1.5 YY_BREAK
|
1155 mike 1.1 case 34:
1156 YY_RULE_SETUP
|
1157 krisbash 1.5 #line 313 "mof.l"
1158 {
1159 yylval.identifier = MOF_Strdup(&state.heap, yytext);
1160 return TOK_TOINSTANCE;
1161 }
1162 YY_BREAK
1163 case 35:
1164 YY_RULE_SETUP
1165 #line 318 "mof.l"
|
1166 mike 1.1 {
|
1167 krisbash 1.5 yylval.identifier = MOF_Strdup(&state.heap, yytext);
|
1168 mike 1.1 return TOK_TRANSLATABLE;
1169 }
|
1170 krisbash 1.5 YY_BREAK
1171 case 36:
|
1172 mike 1.1 YY_RULE_SETUP
|
1173 krisbash 1.5 #line 323 "mof.l"
|
1174 mike 1.1 {
1175 return TOK_INSTANCE;
1176 }
|
1177 krisbash 1.5 YY_BREAK
1178 case 37:
|
1179 mike 1.1 YY_RULE_SETUP
|
1180 krisbash 1.5 #line 327 "mof.l"
|
1181 mike 1.1 {
|
1182 krisbash 1.5 yylval.identifier = MOF_Strdup(&state.heap, yytext);
|
1183 mike 1.1 return TOK_OF;
1184 }
|
1185 krisbash 1.5 YY_BREAK
1186 case 38:
|
1187 mike 1.1 YY_RULE_SETUP
|
1188 krisbash 1.5 #line 332 "mof.l"
|
1189 mike 1.1 {
1190 return TOK_AS;
1191 }
|
1192 krisbash 1.5 YY_BREAK
1193 case 39:
1194 YY_RULE_SETUP
1195 #line 336 "mof.l"
1196 {
1197 return TOK_OBJECT;
1198 }
1199 YY_BREAK
1200 case 40:
|
1201 mike 1.1 YY_RULE_SETUP
|
1202 krisbash 1.5 #line 340 "mof.l"
|
1203 mike 1.1 {
|
1204 krisbash 1.5 yylval.identifier = MOF_Strdup(&state.heap, yytext);
|
1205 mike 1.1 return TOK_PRAGMA;
1206 }
|
1207 krisbash 1.5 YY_BREAK
1208 case 41:
|
1209 mike 1.1 YY_RULE_SETUP
|
1210 krisbash 1.5 #line 345 "mof.l"
|
1211 mike 1.1 {
1212 /* C-sytle comments */
1213 int c;
1214 int prev;
1215
1216 /* Discard C-style comments. Replace with a single space since
1217 * comments may function as token separators.
1218 */
1219
1220 for (c = input(), prev = '\0'; EOF != c; prev = c, c = input())
1221 {
1222 /* Check for closing comment */
1223 if (prev == '*' && c == '/')
1224 break;
1225
1226 /* Increment line counter on newlines */
1227 if (c == '\n')
1228 state.line++;
1229 }
1230
1231 /* Inject a blank character into input */
1232 mike 1.1 unput(' ');
1233 }
|
1234 krisbash 1.5 YY_BREAK
1235 case 42:
|
1236 mike 1.1 YY_RULE_SETUP
|
1237 krisbash 1.5 #line 369 "mof.l"
|
1238 mike 1.1 {
1239 /* C++-style comments */
1240 int c;
1241
1242 /* Discard all characters on this comment line including the newline */
1243
1244 for (c = input(); EOF != c; c = input())
1245 {
1246 /* Increment line counter on newlines */
1247 if (c == '\n')
1248 {
1249 state.line++;
1250 break;
1251 }
1252 }
1253 }
|
1254 krisbash 1.5 YY_BREAK
1255 case 43:
|
1256 mike 1.1 YY_RULE_SETUP
|
1257 krisbash 1.5 #line 386 "mof.l"
|
1258 mike 1.1 {
1259 /* Read a string literal */
1260 int c;
1261 Buffer buf = BUFFER_INITIALIZER;
1262
1263 /* Scan until the closing quote is found */
1264 for (;;)
1265 {
1266 c = input();
1267
1268 if (EOF == c || c == '"')
1269 break;
1270
1271 if (Buffer_AppendChar(&buf, (char)c) != 0)
1272 {
1273 yyerrorf(ID_OUT_OF_MEMORY, "out of memory");
1274 return TOK_ERROR;
1275 }
1276
1277 /* If backslash, get next character */
1278 if (c == '\\')
1279 mike 1.1 {
1280 c = input();
1281
1282 if (EOF == c)
1283 {
1284 yyerrorf(ID_UNTERMINATED_STRING_LITERAL,
1285 "unterminated string literal");
1286 return TOK_ERROR;
1287 }
1288
1289 if (Buffer_AppendChar(&buf, (char)c) != 0)
1290 {
1291 yyerrorf(ID_OUT_OF_MEMORY, "out of memory");
1292 return TOK_ERROR;
1293 }
1294 }
1295 }
1296
1297 /* Append zero-terminator */
1298 if (Buffer_AppendChar(&buf, '\0') != 0)
1299 {
1300 mike 1.1 yyerrorf(ID_OUT_OF_MEMORY, "out of memory");
1301 return TOK_ERROR;
1302 }
1303
1304 /* Return the string */
1305 yylval.string = buf.data;
1306 return TOK_STRING_VALUE;
1307 }
|
1308 krisbash 1.5 YY_BREAK
1309 case 44:
|
1310 mike 1.1 YY_RULE_SETUP
|
1311 krisbash 1.5 #line 437 "mof.l"
|
1312 mike 1.1 {
1313 yylval.character = yytext[1];
1314 return TOK_CHAR_VALUE;
1315 }
|
1316 krisbash 1.5 YY_BREAK
1317 case 45:
|
1318 mike 1.1 YY_RULE_SETUP
|
1319 krisbash 1.5 #line 442 "mof.l"
|
1320 mike 1.1 {
1321
1322 switch (yytext[2])
1323 {
|
1324 krisbash 1.5 case 'r':
1325 yylval.character = '\r';
1326 break;
1327 case 'n':
1328 yylval.character = '\n';
1329 break;
1330 case 't':
1331 yylval.character = '\t';
1332 break;
1333 case 'f':
1334 yylval.character = '\f';
1335 break;
1336 case 'b':
1337 yylval.character = '\b';
1338 break;
1339 case '\"':
1340 yylval.character = '"';
1341 break;
1342 case '\'':
1343 yylval.character = '\'';
1344 break;
1345 krisbash 1.5 case '\\':
1346 yylval.character = '\\';
1347 break;
|
1348 mike 1.1 default:
1349 yyerrorf(ID_INTERNAL_ERROR, "internal error");
1350 return TOK_ERROR;
1351 }
1352
1353 return TOK_CHAR_VALUE;
1354 }
|
1355 krisbash 1.5 YY_BREAK
1356 case 46:
|
1357 mike 1.1 YY_RULE_SETUP
|
1358 krisbash 1.5 #line 478 "mof.l"
|
1359 mike 1.1 {
1360 char* end;
1361
1362 if (yyleng - 4 > 4)
1363 {
1364 yyerrorf(ID_ILLEGAL_HEX_CHARACTER, "illegal hex character");
1365 return TOK_ERROR;
1366 }
1367
1368 yylval.character = (MI_Char16)strtoul(&yytext[3], &end, 16);
1369
1370 if (*end != '\'')
1371 {
1372 yyerrorf(ID_ILLEGAL_HEX_CHARACTER, "illegal hex character");
1373 return TOK_ERROR;
1374 }
1375
1376 return TOK_CHAR_VALUE;
1377 }
|
1378 krisbash 1.5 YY_BREAK
1379 case 47:
|
1380 mike 1.1 YY_RULE_SETUP
|
1381 krisbash 1.5 #line 498 "mof.l"
|
1382 mike 1.1 {
1383 yylval.integer = 0;
1384 return TOK_INTEGER_VALUE;
1385 }
|
1386 krisbash 1.5 YY_BREAK
1387 case 48:
|
1388 mike 1.1 YY_RULE_SETUP
|
1389 krisbash 1.5 #line 503 "mof.l"
|
1390 mike 1.1 {
1391 errno = 0;
1392 if (yytext[0] == '-')
1393 yylval.integer = (MI_Sint64)Strtoll(yytext, NULL, 10);
1394 else
1395 yylval.integer = (MI_Sint64)Strtoull(yytext, NULL, 10);
1396
1397 if (errno == ERANGE)
1398 {
1399 yyerrorf(ID_INTEGER_OVERFLOW, "integer overflow");
1400 return TOK_ERROR;
1401 }
1402 return TOK_INTEGER_VALUE;
1403 }
|
1404 krisbash 1.5 YY_BREAK
1405 case 49:
|
1406 mike 1.1 YY_RULE_SETUP
|
1407 krisbash 1.5 #line 518 "mof.l"
|
1408 mike 1.1 {
1409 yylval.real = (double)strtod(yytext, NULL);
1410 return TOK_REAL_VALUE;
1411 }
|
1412 krisbash 1.5 YY_BREAK
1413 case 50:
|
1414 mike 1.1 YY_RULE_SETUP
|
1415 krisbash 1.5 #line 523 "mof.l"
|
1416 mike 1.1 {
1417 errno = 0;
1418 if (yytext[0] == '-')
1419 yylval.integer = (MI_Sint64)Strtoll(yytext, NULL, 16);
1420 else
1421 yylval.integer = (MI_Sint64)Strtoull(yytext, NULL, 16);
1422
1423 if (errno == ERANGE)
1424 {
1425 yyerrorf(ID_INTEGER_OVERFLOW, "integer overflow");
1426 return TOK_ERROR;
1427 }
1428 return TOK_INTEGER_VALUE;
1429 }
|
1430 krisbash 1.5 YY_BREAK
1431 case 51:
|
1432 mike 1.1 YY_RULE_SETUP
|
1433 krisbash 1.5 #line 538 "mof.l"
|
1434 mike 1.1 {
1435 errno = 0;
1436 if (yytext[0] == '-')
1437 yylval.integer = (MI_Sint64)Strtoll(yytext, NULL, 8);
1438 else
1439 yylval.integer = (MI_Sint64)Strtoull(yytext, NULL, 8);
1440
1441 if (errno == ERANGE)
1442 {
1443 yyerrorf(ID_INTEGER_OVERFLOW, "integer overflow");
1444 return TOK_ERROR;
1445 }
1446 return TOK_INTEGER_VALUE;
1447 }
|
1448 krisbash 1.5 YY_BREAK
1449 case 52:
|
1450 mike 1.1 YY_RULE_SETUP
|
1451 krisbash 1.5 #line 553 "mof.l"
|
1452 mike 1.1 {
1453 char* end;
1454
1455 if (yytext[0] == '-')
1456 yylval.integer = (MI_Sint64)Strtoll(yytext, &end, 2);
1457 else
1458 yylval.integer = (MI_Sint64)Strtoull(yytext, &end, 2);
1459
1460 if (*end != 'B' && *end != 'b')
1461 {
1462 yyerrorf(ID_ILLEGAL_BINARY_LITERAL, "illegal binary literal");
1463 return TOK_ERROR;
1464 }
1465 if (errno == ERANGE)
1466 {
1467 yyerrorf(ID_INTEGER_OVERFLOW, "integer overflow");
1468 return TOK_ERROR;
1469 }
1470
1471 return TOK_INTEGER_VALUE;
1472 }
|
1473 krisbash 1.5 YY_BREAK
1474 case 53:
|
1475 mike 1.1 YY_RULE_SETUP
|
1476 krisbash 1.5 #line 575 "mof.l"
|
1477 mike 1.1 {
1478 yylval.identifier = MOF_Strdup(&state.heap, yytext);
1479 return TOK_IDENT;
1480 }
|
1481 krisbash 1.5 YY_BREAK
1482 case 54:
|
1483 mike 1.1 YY_RULE_SETUP
|
1484 krisbash 1.5 #line 580 "mof.l"
|
1485 mike 1.1 {
1486 yylval.identifier = MOF_Strdup(&state.heap, yytext);
1487 return TOK_ALIAS_IDENTIFIER;
1488 }
|
1489 krisbash 1.5 YY_BREAK
1490 case 55:
|
1491 mike 1.1 YY_RULE_SETUP
|
1492 krisbash 1.5 #line 585 "mof.l"
|
1493 mike 1.1 {
1494 return '=';
1495 }
|
1496 krisbash 1.5 YY_BREAK
1497 case 56:
|
1498 mike 1.1 YY_RULE_SETUP
|
1499 krisbash 1.5 #line 589 "mof.l"
|
1500 mike 1.1 {
1501 return '(';
1502 }
|
1503 krisbash 1.5 YY_BREAK
1504 case 57:
|
1505 mike 1.1 YY_RULE_SETUP
|
1506 krisbash 1.5 #line 593 "mof.l"
|
1507 mike 1.1 {
1508 return ')';
1509 }
|
1510 krisbash 1.5 YY_BREAK
1511 case 58:
|
1512 mike 1.1 YY_RULE_SETUP
|
1513 krisbash 1.5 #line 597 "mof.l"
|
1514 mike 1.1 {
1515 return '[';
1516 }
|
1517 krisbash 1.5 YY_BREAK
1518 case 59:
|
1519 mike 1.1 YY_RULE_SETUP
|
1520 krisbash 1.5 #line 601 "mof.l"
|
1521 mike 1.1 {
1522 return ']';
1523 }
|
1524 krisbash 1.5 YY_BREAK
1525 case 60:
|
1526 mike 1.1 YY_RULE_SETUP
|
1527 krisbash 1.5 #line 605 "mof.l"
|
1528 mike 1.1 {
1529 return '{';
1530 }
|
1531 krisbash 1.5 YY_BREAK
1532 case 61:
|
1533 mike 1.1 YY_RULE_SETUP
|
1534 krisbash 1.5 #line 609 "mof.l"
|
1535 mike 1.1 {
1536 return '}';
1537 }
|
1538 krisbash 1.5 YY_BREAK
1539 case 62:
|
1540 mike 1.1 YY_RULE_SETUP
|
1541 krisbash 1.5 #line 613 "mof.l"
|
1542 mike 1.1 {
1543 return ':';
1544 }
|
1545 krisbash 1.5 YY_BREAK
1546 case 63:
|
1547 mike 1.1 YY_RULE_SETUP
|
1548 krisbash 1.5 #line 617 "mof.l"
|
1549 mike 1.1 {
1550 return ';';
1551 }
|
1552 krisbash 1.5 YY_BREAK
1553 case 64:
|
1554 mike 1.1 YY_RULE_SETUP
|
1555 krisbash 1.5 #line 621 "mof.l"
|
1556 mike 1.1 {
1557 return ',';
1558 }
|
1559 krisbash 1.5 YY_BREAK
1560 case 65:
|
1561 mike 1.1 YY_RULE_SETUP
|
1562 krisbash 1.5 #line 625 "mof.l"
|
1563 mike 1.1 {
1564 /* swallow whiteSpaceChar */
1565 int i;
1566
1567 for (i = 0; i < yyleng; i++)
1568 {
1569 if (yytext[i] == '\n')
1570 state.line++;
1571 }
1572 }
|
1573 krisbash 1.5 YY_BREAK
1574 case 66:
|
1575 mike 1.1 YY_RULE_SETUP
|
1576 krisbash 1.5 #line 636 "mof.l"
|
1577 mike 1.1 {
1578 yyterminate();
1579 }
|
1580 krisbash 1.5 YY_BREAK
1581 case 67:
|
1582 mike 1.1 YY_RULE_SETUP
|
1583 krisbash 1.5 #line 640 "mof.l"
|
1584 mike 1.1 ECHO;
|
1585 krisbash 1.5 YY_BREAK
1586 #line 1587 "lex.yy.c"
1587
1588 case YY_END_OF_BUFFER:
1589 {
1590 /* Amount of text matched not including the EOB char. */
1591 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
1592
1593 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1594 *yy_cp = yy_hold_char;
1595 YY_RESTORE_YY_MORE_OFFSET
1596
1597 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
1598 {
1599 /* We're scanning a new file or input source. It's
1600 * possible that this happened because the user
1601 * just pointed yyin at a new source and called
1602 * yylex(). If so, then we have to assure
1603 * consistency between yy_current_buffer and our
1604 * globals. Here is the right place to do so, because
1605 * this is the first action (other than possibly a
1606 krisbash 1.5 * back-up) that will match for the new input source.
1607 */
1608 yy_n_chars = yy_current_buffer->yy_n_chars;
1609 yy_current_buffer->yy_input_file = yyin;
1610 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
1611 }
1612
1613 /* Note that here we test for yy_c_buf_p "<=" to the position
1614 * of the first EOB in the buffer, since yy_c_buf_p will
1615 * already have been incremented past the NUL character
1616 * (since all states make transitions on EOB to the
1617 * end-of-buffer state). Contrast this with the test
1618 * in input().
1619 */
1620 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1621 { /* This was really a NUL. */
1622 yy_state_type yy_next_state;
1623
1624 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
1625
1626 yy_current_state = yy_get_previous_state();
1627 krisbash 1.5
1628 /* Okay, we're now positioned to make the NUL
1629 * transition. We couldn't have
1630 * yy_get_previous_state() go ahead and do it
1631 * for us because it doesn't know how to deal
1632 * with the possibility of jamming (and we don't
1633 * want to build jamming into it because then it
1634 * will run more slowly).
1635 */
1636
1637 yy_next_state = yy_try_NUL_trans( yy_current_state );
1638
1639 yy_bp = yytext_ptr + YY_MORE_ADJ;
1640
1641 if ( yy_next_state )
1642 {
1643 /* Consume the NUL. */
1644 yy_cp = ++yy_c_buf_p;
1645 yy_current_state = yy_next_state;
1646 goto yy_match;
1647 }
1648 krisbash 1.5
1649 else
1650 {
1651 yy_cp = yy_c_buf_p;
1652 goto yy_find_action;
1653 }
1654 }
1655
1656 else switch ( yy_get_next_buffer() )
1657 {
1658 case EOB_ACT_END_OF_FILE:
1659 {
1660 yy_did_buffer_switch_on_eof = 0;
1661
1662 if ( yywrap() )
1663 {
1664 /* Note: because we've taken care in
1665 * yy_get_next_buffer() to have set up
1666 * yytext, we can now set up
1667 * yy_c_buf_p so that if some total
1668 * hoser (like flex itself) wants to
1669 krisbash 1.5 * call the scanner after we return the
1670 * YY_NULL, it'll still work - another
1671 * YY_NULL will get returned.
1672 */
1673 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
1674
1675 yy_act = YY_STATE_EOF(YY_START);
1676 goto do_action;
1677 }
1678
1679 else
1680 {
1681 if ( ! yy_did_buffer_switch_on_eof )
1682 YY_NEW_FILE;
1683 }
1684 break;
1685 }
1686
1687 case EOB_ACT_CONTINUE_SCAN:
1688 yy_c_buf_p =
1689 yytext_ptr + yy_amount_of_matched_text;
1690 krisbash 1.5
1691 yy_current_state = yy_get_previous_state();
1692
1693 yy_cp = yy_c_buf_p;
1694 yy_bp = yytext_ptr + YY_MORE_ADJ;
1695 goto yy_match;
1696
1697 case EOB_ACT_LAST_MATCH:
1698 yy_c_buf_p =
1699 &yy_current_buffer->yy_ch_buf[yy_n_chars];
1700
1701 yy_current_state = yy_get_previous_state();
1702
1703 yy_cp = yy_c_buf_p;
1704 yy_bp = yytext_ptr + YY_MORE_ADJ;
1705 goto yy_find_action;
1706 }
1707 break;
1708 }
|
1709 mike 1.1
|
1710 krisbash 1.5 default:
1711 YY_FATAL_ERROR(
1712 "fatal flex scanner internal error--no action found" );
1713 } /* end of action switch */
1714 } /* end of scanning one token */
1715 } /* end of yylex */
|
1716 mike 1.1
1717
1718 /* yy_get_next_buffer - try to read in a new buffer
1719 *
1720 * Returns a code representing an action:
|
1721 krisbash 1.5 * EOB_ACT_LAST_MATCH -
1722 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1723 * EOB_ACT_END_OF_FILE - end of file
|
1724 mike 1.1 */
1725
1726 static int yy_get_next_buffer()
|
1727 krisbash 1.5 {
1728 register char *dest = yy_current_buffer->yy_ch_buf;
1729 register char *source = yytext_ptr;
1730 register int number_to_move, i;
1731 int ret_val;
1732
1733 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
1734 YY_FATAL_ERROR(
1735 "fatal flex scanner internal error--end of buffer missed" );
1736
1737 if ( yy_current_buffer->yy_fill_buffer == 0 )
1738 { /* Don't try to fill the buffer, so this is an EOF. */
1739 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
1740 {
1741 /* We matched a single character, the EOB, so
1742 * treat this as a final EOF.
1743 */
1744 return EOB_ACT_END_OF_FILE;
1745 }
1746
1747 else
1748 krisbash 1.5 {
1749 /* We matched some text prior to the EOB, first
1750 * process it.
1751 */
1752 return EOB_ACT_LAST_MATCH;
1753 }
1754 }
1755
1756 /* Try to read more data. */
1757
1758 /* First move last chars to start of buffer. */
1759 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
1760
1761 for ( i = 0; i < number_to_move; ++i )
1762 *(dest++) = *(source++);
1763
1764 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1765 /* don't do the read, it's not guaranteed to return an EOF,
1766 * just force an EOF
1767 */
1768 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
1769 krisbash 1.5
1770 else
1771 {
1772 int num_to_read =
1773 yy_current_buffer->yy_buf_size - number_to_move - 1;
|
1774 mike 1.1
|
1775 krisbash 1.5 while ( num_to_read <= 0 )
1776 { /* Not enough room in the buffer - grow it. */
|
1777 mike 1.1 #ifdef YY_USES_REJECT
|
1778 krisbash 1.5 YY_FATAL_ERROR(
|
1779 mike 1.1 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1780 #else
1781
|
1782 krisbash 1.5 /* just a shorter name for the current buffer */
1783 YY_BUFFER_STATE b = yy_current_buffer;
|
1784 mike 1.1
|
1785 krisbash 1.5 int yy_c_buf_p_offset =
1786 (int) (yy_c_buf_p - b->yy_ch_buf);
|
1787 mike 1.1
|
1788 krisbash 1.5 if ( b->yy_is_our_buffer )
1789 {
1790 int new_size = b->yy_buf_size * 2;
1791
1792 if ( new_size <= 0 )
1793 b->yy_buf_size += b->yy_buf_size / 8;
1794 else
1795 b->yy_buf_size *= 2;
1796
1797 b->yy_ch_buf = (char *)
1798 /* Include room in for 2 EOB chars. */
1799 yy_flex_realloc( (void *) b->yy_ch_buf,
1800 b->yy_buf_size + 2 );
1801 }
1802 else
1803 /* Can't grow it, we don't own it. */
1804 b->yy_ch_buf = 0;
1805
1806 if ( ! b->yy_ch_buf )
1807 YY_FATAL_ERROR(
1808 "fatal error - scanner input buffer overflow" );
1809 krisbash 1.5
1810 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1811
1812 num_to_read = yy_current_buffer->yy_buf_size -
1813 number_to_move - 1;
1814 #endif
1815 }
1816
1817 if ( num_to_read > YY_READ_BUF_SIZE )
1818 num_to_read = YY_READ_BUF_SIZE;
1819
1820 /* Read in more data. */
1821 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1822 yy_n_chars, num_to_read );
1823
1824 yy_current_buffer->yy_n_chars = yy_n_chars;
1825 }
1826
1827 if ( yy_n_chars == 0 )
1828 {
1829 if ( number_to_move == YY_MORE_ADJ )
1830 krisbash 1.5 {
1831 ret_val = EOB_ACT_END_OF_FILE;
1832 yyrestart( yyin );
1833 }
1834
1835 else
1836 {
1837 ret_val = EOB_ACT_LAST_MATCH;
1838 yy_current_buffer->yy_buffer_status =
1839 YY_BUFFER_EOF_PENDING;
1840 }
1841 }
1842
1843 else
1844 ret_val = EOB_ACT_CONTINUE_SCAN;
1845
1846 yy_n_chars += number_to_move;
1847 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1848 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
|
1849 mike 1.1
|
1850 krisbash 1.5 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
|
1851 mike 1.1
|
1852 krisbash 1.5 return ret_val;
1853 }
|
1854 mike 1.1
1855
1856 /* yy_get_previous_state - get the state just before the EOB char was reached */
1857
1858 static yy_state_type yy_get_previous_state()
|
1859 krisbash 1.5 {
1860 register yy_state_type yy_current_state;
1861 register char *yy_cp;
|
1862 mike 1.1
|
1863 krisbash 1.5 yy_current_state = yy_start;
1864
1865 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1866 {
1867 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1868 if ( yy_accept[yy_current_state] )
1869 {
1870 yy_last_accepting_state = yy_current_state;
1871 yy_last_accepting_cpos = yy_cp;
1872 }
1873 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1874 {
1875 yy_current_state = (int) yy_def[yy_current_state];
1876 if ( yy_current_state >= 286 )
1877 yy_c = yy_meta[(unsigned int) yy_c];
1878 }
1879 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1880 }
1881
1882 return yy_current_state;
1883 }
|
1884 mike 1.1
1885
1886 /* yy_try_NUL_trans - try to make a transition on the NUL character
1887 *
1888 * synopsis
|
1889 krisbash 1.5 * next_state = yy_try_NUL_trans( current_state );
|
1890 mike 1.1 */
1891
1892 #ifdef YY_USE_PROTOS
1893 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
1894 #else
1895 static yy_state_type yy_try_NUL_trans( yy_current_state )
1896 yy_state_type yy_current_state;
1897 #endif
|
1898 krisbash 1.5 {
1899 register int yy_is_jam;
1900 register char *yy_cp = yy_c_buf_p;
|
1901 mike 1.1
|
1902 krisbash 1.5 register YY_CHAR yy_c = 1;
1903 if ( yy_accept[yy_current_state] )
1904 {
1905 yy_last_accepting_state = yy_current_state;
1906 yy_last_accepting_cpos = yy_cp;
1907 }
1908 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1909 {
1910 yy_current_state = (int) yy_def[yy_current_state];
1911 if ( yy_current_state >= 286 )
1912 yy_c = yy_meta[(unsigned int) yy_c];
1913 }
1914 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1915 yy_is_jam = (yy_current_state == 285);
1916
1917 return yy_is_jam ? 0 : yy_current_state;
1918 }
|
1919 mike 1.1
1920
1921 #ifndef YY_NO_UNPUT
1922 #ifdef YY_USE_PROTOS
1923 static void yyunput( int c, register char *yy_bp )
1924 #else
1925 static void yyunput( c, yy_bp )
1926 int c;
1927 register char *yy_bp;
1928 #endif
|
1929 krisbash 1.5 {
1930 register char *yy_cp = yy_c_buf_p;
|
1931 mike 1.1
|
1932 krisbash 1.5 /* undo effects of setting up yytext */
1933 *yy_cp = yy_hold_char;
|
1934 mike 1.1
|
1935 krisbash 1.5 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1936 { /* need to shift things up to make room */
1937 /* +2 for EOB chars. */
1938 register int number_to_move = yy_n_chars + 2;
1939 register char *dest = &yy_current_buffer->yy_ch_buf[
1940 yy_current_buffer->yy_buf_size + 2];
1941 register char *source =
1942 &yy_current_buffer->yy_ch_buf[number_to_move];
1943
1944 while ( source > yy_current_buffer->yy_ch_buf )
1945 *--dest = *--source;
1946
1947 yy_cp += (int) (dest - source);
1948 yy_bp += (int) (dest - source);
1949 yy_current_buffer->yy_n_chars =
1950 yy_n_chars = yy_current_buffer->yy_buf_size;
1951
1952 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1953 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1954 }
1955
1956 krisbash 1.5 *--yy_cp = (char) c;
1957
1958
1959 yytext_ptr = yy_bp;
1960 yy_hold_char = *yy_cp;
1961 yy_c_buf_p = yy_cp;
1962 }
1963 #endif /* ifndef YY_NO_UNPUT */
|
1964 mike 1.1
1965
1966 #ifdef __cplusplus
1967 static int yyinput()
1968 #else
1969 static int input()
1970 #endif
|
1971 krisbash 1.5 {
1972 int c;
|
1973 mike 1.1
|
1974 krisbash 1.5 *yy_c_buf_p = yy_hold_char;
|
1975 mike 1.1
|
1976 krisbash 1.5 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1977 {
1978 /* yy_c_buf_p now points to the character we want to return.
1979 * If this occurs *before* the EOB characters, then it's a
1980 * valid NUL; if not, then we've hit the end of the buffer.
1981 */
1982 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1983 /* This was really a NUL. */
1984 *yy_c_buf_p = '\0';
1985
1986 else
1987 { /* need more input */
1988 int offset = yy_c_buf_p - yytext_ptr;
1989 ++yy_c_buf_p;
1990
1991 switch ( yy_get_next_buffer() )
1992 {
1993 case EOB_ACT_LAST_MATCH:
1994 /* This happens because yy_g_n_b()
1995 * sees that we've accumulated a
1996 * token and flags that we need to
1997 krisbash 1.5 * try matching the token before
1998 * proceeding. But for input(),
1999 * there's no matching to consider.
2000 * So convert the EOB_ACT_LAST_MATCH
2001 * to EOB_ACT_END_OF_FILE.
2002 */
2003
2004 /* Reset buffer status. */
2005 yyrestart( yyin );
2006
2007 /* fall through */
2008
2009 case EOB_ACT_END_OF_FILE:
2010 {
2011 if ( yywrap() )
2012 return EOF;
|
2013 mike 1.1
|
2014 krisbash 1.5 if ( ! yy_did_buffer_switch_on_eof )
2015 YY_NEW_FILE;
|
2016 mike 1.1 #ifdef __cplusplus
|
2017 krisbash 1.5 return yyinput();
|
2018 mike 1.1 #else
|
2019 krisbash 1.5 return input();
|
2020 mike 1.1 #endif
|
2021 krisbash 1.5 }
|
2022 mike 1.1
|
2023 krisbash 1.5 case EOB_ACT_CONTINUE_SCAN:
2024 yy_c_buf_p = yytext_ptr + offset;
2025 break;
2026 }
2027 }
2028 }
|
2029 mike 1.1
|
2030 krisbash 1.5 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
2031 *yy_c_buf_p = '\0'; /* preserve yytext */
2032 yy_hold_char = *++yy_c_buf_p;
|
2033 mike 1.1
2034
|
2035 krisbash 1.5 return c;
2036 }
|
2037 mike 1.1
2038
2039 #ifdef YY_USE_PROTOS
2040 void yyrestart( FILE *input_file )
2041 #else
2042 void yyrestart( input_file )
2043 FILE *input_file;
2044 #endif
|
2045 krisbash 1.5 {
2046 if ( ! yy_current_buffer )
2047 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
2048
2049 yy_init_buffer( yy_current_buffer, input_file );
2050 yy_load_buffer_state();
2051 }
|
2052 mike 1.1
2053
2054 #ifdef YY_USE_PROTOS
2055 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
2056 #else
2057 void yy_switch_to_buffer( new_buffer )
2058 YY_BUFFER_STATE new_buffer;
2059 #endif
|
2060 krisbash 1.5 {
2061 if ( yy_current_buffer == new_buffer )
2062 return;
2063
2064 if ( yy_current_buffer )
2065 {
2066 /* Flush out information for old buffer. */
2067 *yy_c_buf_p = yy_hold_char;
2068 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
2069 yy_current_buffer->yy_n_chars = yy_n_chars;
2070 }
2071
2072 yy_current_buffer = new_buffer;
2073 yy_load_buffer_state();
2074
2075 /* We don't actually know whether we did this switch during
2076 * EOF (yywrap()) processing, but the only time this flag
2077 * is looked at is after yywrap() is called, so it's safe
2078 * to go ahead and always set it.
2079 */
2080 yy_did_buffer_switch_on_eof = 1;
2081 krisbash 1.5 }
|
2082 mike 1.1
2083
2084 #ifdef YY_USE_PROTOS
2085 void yy_load_buffer_state( void )
2086 #else
2087 void yy_load_buffer_state()
2088 #endif
|
2089 krisbash 1.5 {
2090 yy_n_chars = yy_current_buffer->yy_n_chars;
2091 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
2092 yyin = yy_current_buffer->yy_input_file;
2093 yy_hold_char = *yy_c_buf_p;
2094 }
|
2095 mike 1.1
2096
2097 #ifdef YY_USE_PROTOS
2098 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
2099 #else
2100 YY_BUFFER_STATE yy_create_buffer( file, size )
2101 FILE *file;
2102 int size;
2103 #endif
|
2104 krisbash 1.5 {
2105 YY_BUFFER_STATE b;
|
2106 mike 1.1
|
2107 krisbash 1.5 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
2108 if ( ! b )
2109 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
|
2110 mike 1.1
|
2111 krisbash 1.5 b->yy_buf_size = size;
|
2112 mike 1.1
|
2113 krisbash 1.5 /* yy_ch_buf has to be 2 characters longer than the size given because
2114 * we need to put in 2 end-of-buffer characters.
2115 */
2116 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
2117 if ( ! b->yy_ch_buf )
2118 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
|
2119 mike 1.1
|
2120 krisbash 1.5 b->yy_is_our_buffer = 1;
|
2121 mike 1.1
|
2122 krisbash 1.5 yy_init_buffer( b, file );
|
2123 mike 1.1
|
2124 krisbash 1.5 return b;
2125 }
|
2126 mike 1.1
2127
2128 #ifdef YY_USE_PROTOS
2129 void yy_delete_buffer( YY_BUFFER_STATE b )
2130 #else
2131 void yy_delete_buffer( b )
2132 YY_BUFFER_STATE b;
2133 #endif
|
2134 krisbash 1.5 {
2135 if ( ! b )
2136 return;
|
2137 mike 1.1
|
2138 krisbash 1.5 if ( b == yy_current_buffer )
2139 yy_current_buffer = (YY_BUFFER_STATE) 0;
|
2140 mike 1.1
|
2141 krisbash 1.5 if ( b->yy_is_our_buffer )
2142 yy_flex_free( (void *) b->yy_ch_buf );
|
2143 mike 1.1
|
2144 krisbash 1.5 yy_flex_free( (void *) b );
2145 }
|
2146 mike 1.1
2147
2148 #ifndef YY_ALWAYS_INTERACTIVE
2149 #ifndef YY_NEVER_INTERACTIVE
2150 extern int isatty YY_PROTO(( int ));
2151 #endif
2152 #endif
2153
2154 #ifdef YY_USE_PROTOS
2155 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
2156 #else
2157 void yy_init_buffer( b, file )
2158 YY_BUFFER_STATE b;
2159 FILE *file;
2160 #endif
2161
2162
|
2163 krisbash 1.5 {
2164 yy_flush_buffer( b );
|
2165 mike 1.1
|
2166 krisbash 1.5 b->yy_input_file = file;
2167 b->yy_fill_buffer = 1;
|
2168 mike 1.1
2169 #if YY_ALWAYS_INTERACTIVE
|
2170 krisbash 1.5 b->yy_is_interactive = 1;
|
2171 mike 1.1 #else
2172 #if YY_NEVER_INTERACTIVE
|
2173 krisbash 1.5 b->yy_is_interactive = 0;
|
2174 mike 1.1 #else
|
2175 krisbash 1.5 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
|
2176 mike 1.1 #endif
2177 #endif
|
2178 krisbash 1.5 }
|
2179 mike 1.1
2180
2181 #ifdef YY_USE_PROTOS
2182 void yy_flush_buffer( YY_BUFFER_STATE b )
2183 #else
2184 void yy_flush_buffer( b )
2185 YY_BUFFER_STATE b;
2186 #endif
2187
|
2188 krisbash 1.5 {
2189 if ( ! b )
2190 return;
2191
2192 b->yy_n_chars = 0;
2193
2194 /* We always need two end-of-buffer characters. The first causes
2195 * a transition to the end-of-buffer state. The second causes
2196 * a jam in that state.
2197 */
2198 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2199 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2200
2201 b->yy_buf_pos = &b->yy_ch_buf[0];
2202
2203 b->yy_at_bol = 1;
2204 b->yy_buffer_status = YY_BUFFER_NEW;
2205
2206 if ( b == yy_current_buffer )
2207 yy_load_buffer_state();
2208 }
|
2209 mike 1.1
2210
2211 #ifndef YY_NO_SCAN_BUFFER
2212 #ifdef YY_USE_PROTOS
2213 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
2214 #else
2215 YY_BUFFER_STATE yy_scan_buffer( base, size )
2216 char *base;
2217 yy_size_t size;
2218 #endif
|
2219 krisbash 1.5 {
2220 YY_BUFFER_STATE b;
|
2221 mike 1.1
|
2222 krisbash 1.5 if ( size < 2 ||
2223 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2224 base[size-1] != YY_END_OF_BUFFER_CHAR )
2225 /* They forgot to leave room for the EOB's. */
2226 return 0;
2227
2228 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
2229 if ( ! b )
2230 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2231
2232 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2233 b->yy_buf_pos = b->yy_ch_buf = base;
2234 b->yy_is_our_buffer = 0;
2235 b->yy_input_file = 0;
2236 b->yy_n_chars = b->yy_buf_size;
2237 b->yy_is_interactive = 0;
2238 b->yy_at_bol = 1;
2239 b->yy_fill_buffer = 0;
2240 b->yy_buffer_status = YY_BUFFER_NEW;
|
2241 mike 1.1
|
2242 krisbash 1.5 yy_switch_to_buffer( b );
|
2243 mike 1.1
|
2244 krisbash 1.5 return b;
2245 }
|
2246 mike 1.1 #endif
2247
2248
2249 #ifndef YY_NO_SCAN_STRING
2250 #ifdef YY_USE_PROTOS
2251 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
2252 #else
2253 YY_BUFFER_STATE yy_scan_string( yy_str )
2254 yyconst char *yy_str;
2255 #endif
|
2256 krisbash 1.5 {
2257 int len;
2258 for ( len = 0; yy_str[len]; ++len )
2259 ;
|
2260 mike 1.1
|
2261 krisbash 1.5 return yy_scan_bytes( yy_str, len );
2262 }
|
2263 mike 1.1 #endif
2264
2265
2266 #ifndef YY_NO_SCAN_BYTES
2267 #ifdef YY_USE_PROTOS
2268 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
2269 #else
2270 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
2271 yyconst char *bytes;
2272 int len;
2273 #endif
|
2274 krisbash 1.5 {
2275 YY_BUFFER_STATE b;
2276 char *buf;
2277 yy_size_t n;
2278 int i;
2279
2280 /* Get memory for full buffer, including space for trailing EOB's. */
2281 n = len + 2;
2282 buf = (char *) yy_flex_alloc( n );
2283 if ( ! buf )
2284 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2285
2286 for ( i = 0; i < len; ++i )
2287 buf[i] = bytes[i];
2288
2289 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
2290
2291 b = yy_scan_buffer( buf, n );
2292 if ( ! b )
2293 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
|
2294 mike 1.1
|
2295 krisbash 1.5 /* It's okay to grow etc. this buffer, and we should throw it
2296 * away when we're done.
2297 */
2298 b->yy_is_our_buffer = 1;
2299
2300 return b;
2301 }
|
2302 mike 1.1 #endif
2303
2304
2305 #ifndef YY_NO_PUSH_STATE
2306 #ifdef YY_USE_PROTOS
2307 static void yy_push_state( int new_state )
2308 #else
2309 static void yy_push_state( new_state )
2310 int new_state;
2311 #endif
|
2312 krisbash 1.5 {
2313 if ( yy_start_stack_ptr >= yy_start_stack_depth )
2314 {
2315 yy_size_t new_size;
|
2316 mike 1.1
|
2317 krisbash 1.5 yy_start_stack_depth += YY_START_STACK_INCR;
2318 new_size = yy_start_stack_depth * sizeof( int );
|
2319 mike 1.1
|
2320 krisbash 1.5 if ( ! yy_start_stack )
2321 yy_start_stack = (int *) yy_flex_alloc( new_size );
2322
2323 else
2324 yy_start_stack = (int *) yy_flex_realloc(
2325 (void *) yy_start_stack, new_size );
2326
2327 if ( ! yy_start_stack )
2328 YY_FATAL_ERROR(
2329 "out of memory expanding start-condition stack" );
2330 }
2331
2332 yy_start_stack[yy_start_stack_ptr++] = YY_START;
2333
2334 BEGIN(new_state);
2335 }
|
2336 mike 1.1 #endif
2337
2338
2339 #ifndef YY_NO_POP_STATE
2340 static void yy_pop_state()
|
2341 krisbash 1.5 {
2342 if ( --yy_start_stack_ptr < 0 )
2343 YY_FATAL_ERROR( "start-condition stack underflow" );
|
2344 mike 1.1
|
2345 krisbash 1.5 BEGIN(yy_start_stack[yy_start_stack_ptr]);
2346 }
|
2347 mike 1.1 #endif
2348
2349
2350 #ifndef YY_NO_TOP_STATE
2351 static int yy_top_state()
|
2352 krisbash 1.5 {
2353 return yy_start_stack[yy_start_stack_ptr - 1];
2354 }
|
2355 mike 1.1 #endif
2356
2357 #ifndef YY_EXIT_FAILURE
2358 #define YY_EXIT_FAILURE 2
2359 #endif
2360
2361 #ifdef YY_USE_PROTOS
2362 static void yy_fatal_error( yyconst char msg[] )
2363 #else
2364 static void yy_fatal_error( msg )
2365 char msg[];
2366 #endif
|
2367 krisbash 1.5 {
2368 (void) fprintf( stderr, "%s\n", msg );
2369 exit( YY_EXIT_FAILURE );
2370 }
|
2371 mike 1.1
2372
2373
2374 /* Redefine yyless() so it works in section 3 code. */
2375
2376 #undef yyless
2377 #define yyless(n) \
|
2378 krisbash 1.5 do \
2379 { \
2380 /* Undo effects of setting up yytext. */ \
2381 yytext[yyleng] = yy_hold_char; \
2382 yy_c_buf_p = yytext + n; \
2383 yy_hold_char = *yy_c_buf_p; \
2384 *yy_c_buf_p = '\0'; \
2385 yyleng = n; \
2386 } \
2387 while ( 0 )
|
2388 mike 1.1
2389
2390 /* Internal utility routines. */
2391
2392 #ifndef yytext_ptr
2393 #ifdef YY_USE_PROTOS
2394 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
2395 #else
2396 static void yy_flex_strncpy( s1, s2, n )
2397 char *s1;
2398 yyconst char *s2;
2399 int n;
2400 #endif
|
2401 krisbash 1.5 {
2402 register int i;
2403 for ( i = 0; i < n; ++i )
2404 s1[i] = s2[i];
2405 }
|
2406 mike 1.1 #endif
2407
2408 #ifdef YY_NEED_STRLEN
2409 #ifdef YY_USE_PROTOS
2410 static int yy_flex_strlen( yyconst char *s )
2411 #else
2412 static int yy_flex_strlen( s )
2413 yyconst char *s;
2414 #endif
|
2415 krisbash 1.5 {
2416 register int n;
2417 for ( n = 0; s[n]; ++n )
2418 ;
|
2419 mike 1.1
|
2420 krisbash 1.5 return n;
2421 }
|
2422 mike 1.1 #endif
2423
2424
2425 #ifdef YY_USE_PROTOS
2426 static void *yy_flex_alloc( yy_size_t size )
2427 #else
2428 static void *yy_flex_alloc( size )
2429 yy_size_t size;
2430 #endif
|
2431 krisbash 1.5 {
2432 return (void *) PAL_Malloc( size );
2433 }
|
2434 mike 1.1
2435 #ifdef YY_USE_PROTOS
2436 static void *yy_flex_realloc( void *ptr, yy_size_t size )
2437 #else
2438 static void *yy_flex_realloc( ptr, size )
2439 void *ptr;
2440 yy_size_t size;
2441 #endif
|
2442 krisbash 1.5 {
2443 /* The cast to (char *) in the following accommodates both
2444 * implementations that use char* generic pointers, and those
2445 * that use void* generic pointers. It works with the latter
2446 * because both ANSI C and C++ allow castless assignment from
2447 * any pointer type to void*, and deal with argument conversions
2448 * as though doing an assignment.
2449 */
2450 return (void *) PAL_Realloc( (char *) ptr, size );
2451 }
|
2452 mike 1.1
2453 #ifdef YY_USE_PROTOS
2454 static void yy_flex_free( void *ptr )
2455 #else
2456 static void yy_flex_free( ptr )
2457 void *ptr;
2458 #endif
|
2459 krisbash 1.5 {
2460 PAL_Free( ptr );
2461 }
|
2462 mike 1.1
2463 #if YY_MAIN
2464 int main()
|
2465 krisbash 1.5 {
2466 yylex();
2467 return 0;
2468 }
|
2469 mike 1.1 #endif
|
2470 krisbash 1.5 #line 640 "mof.l"
|
2471 mike 1.1
2472
2473 /*
2474 **==============================================================================
2475 **
2476 ** Function definitions
2477 **
2478 **==============================================================================
2479 */
2480
2481 int yywrap()
2482 {
2483 /* Return 1 to indicate the end of input */
2484 return 1;
2485 }
2486
2487 static int exists(const char* path)
2488 {
2489 if (access(path, R_OK) != 0)
2490 return -1;
2491
2492 mike 1.1 return 0;
2493 }
2494
2495 static char* findIncludeFile(const char* path)
2496 {
2497 /* First attempt to locate the file relative to the one that included it */
2498 {
2499 Buffer buf = BUFFER_INITIALIZER;
2500 char* p;
2501
2502 p = strrchr(state.path, '/');
2503
2504 if (p)
2505 {
2506 if (Buffer_Append(&buf, state.path, p - state.path + 1) != 0)
2507 return NULL;
2508 }
2509
2510 if (Buffer_Append(&buf, path, strlen(path) + 1) != 0)
2511 return NULL;
2512
2513 mike 1.1 if (exists((const char*)buf.data) == 0)
2514 return (char*)buf.data;
2515 }
2516
2517 /* Attempt to open the file relative to the current directory */
2518 {
2519 if (exists(path) == 0)
2520 return MOF_Strdup(&state.heap, path);
2521 }
2522
2523 /* Search for file using include path array */
2524 {
2525 size_t i;
2526 for (i = 0; i < state.paths.size; i++)
2527 {
2528 const char* p = (const char*)state.paths.data[i];
2529 Buffer buf = BUFFER_INITIALIZER;
2530
2531 if (Buffer_Append(&buf, p, strlen(p)) != 0)
2532 return NULL;
2533
2534 mike 1.1 if (Buffer_AppendChar(&buf, '/') != 0)
2535 return NULL;
2536
2537 if (Buffer_Append(&buf, path, strlen(path) + 1) != 0)
2538 return NULL;
2539
2540 if (exists((char*)buf.data) == 0)
2541 return (char*)buf.data;
2542
2543 MOF_Free(&state.heap, buf.data);
2544 }
2545 }
2546
2547 /* Not found */
2548 return NULL;
2549 }
2550
2551 int openIncludeFile(const char* path_)
2552 {
2553 FILE* is;
2554 char* path;
2555 mike 1.1
2556 if ((path = findIncludeFile(path_)) == NULL)
2557 {
2558 yyerrorf(ID_FAILED_TO_FIND_INCLUDE_FILE,
2559 "failed to find inlude file: \"%s\"", path_);
2560 return -1;
2561 }
2562
2563 /* Check for stack overflow. */
2564 if (s_top >= MOF_STACK_SIZE)
2565 {
2566 yyerrorf(ID_MOF_STACK_OVERFLOW, "MOF file stack overflow");
2567 return -1;
2568 }
2569
2570 /* Open the file */
|
2571 krisbash 1.5 if ((is = File_Open(path, "rb")) == NULL)
|
2572 mike 1.1 {
2573 yyerrorf(ID_FAILED_TO_OPEN_FILE, "failed to open file: \"%s\"", path);
2574 return -1;
2575 }
2576
2577 /* Push current state onto stack. */
2578 s_stack[s_top].file = state.path;
2579 s_stack[s_top].line = state.line;
2580 s_stack[s_top].buffer = YY_CURRENT_BUFFER;
2581 s_top++;
2582
2583 /* Setup state for new file */
2584 yy_switch_to_buffer(yy_create_buffer(is, YY_BUF_SIZE));
2585 state.path = MOF_Strdup(&state.heap, path);
2586 state.line = 1;
2587
2588 return 0;
2589 }
2590
2591 int closeIncludeFile()
2592 {
2593 mike 1.1 /* Check for stack underflow. */
2594 if (s_top == 0)
2595 {
2596 yyerrorf(ID_MOF_STACK_UNDERFLOW, "MOF file stack underflow");
2597 return -1;
2598 }
2599
2600 /* Release current state */
2601 MOF_Free(&state.heap, state.path);
2602 fclose(YY_CURRENT_BUFFER->yy_input_file);
2603 yy_delete_buffer(YY_CURRENT_BUFFER);
2604
2605 /* Restore state from top of stack */
2606 s_top--;
2607 state.path = s_stack[s_top].file;
2608 state.line = s_stack[s_top].line;
2609 yy_switch_to_buffer(s_stack[s_top].buffer);
2610
2611 return 0;
2612 }
2613
2614 mike 1.1 /*
2615 **==============================================================================
2616 **
2617 ** MOF_Parser
2618 **
2619 **==============================================================================
2620 */
2621
2622 MOF_Parser* MOF_Parser_New(
2623 const char* const* paths,
2624 size_t numPaths)
2625 {
|
2626 krisbash 1.5 MOF_Parser* self = (MOF_Parser*)PAL_Calloc(1, sizeof(MOF_Parser));
|
2627 mike 1.1 size_t i;
2628 char* str;
2629
2630 if (!self)
2631 return NULL;
2632
2633 for (i = 0; i < numPaths; i++)
2634 {
2635 str = MOF_Strdup(&self->state.heap, paths[i]);
2636
2637 if (!str)
2638 {
2639 MOF_Release(&self->state.heap);
|
2640 krisbash 1.5 PAL_Free(self);
|
2641 mike 1.1 return NULL;
2642 }
2643
2644 /* PtrArray_Append() uses the global state's heap object to
2645 * obtain memory, so install self->state as the global state
2646 * object temporarily.
2647 */
2648 {
2649 state = self->state;
2650 PtrArray_Append(&state.paths, str);
2651 self->state = state;
2652 memset(&state, 0, sizeof(state));
2653 }
2654 }
2655
2656 return self;
2657 }
2658
2659 void MOF_Parser_SetErrorCallback(
2660 MOF_Parser* self,
2661 void (*callback)(const char* msg, const wchar_t* wmsg, void* data),
2662 mike 1.1 void* data)
2663 {
2664 if (self)
2665 {
2666 self->state.errorCallback = callback;
2667 self->state.errorCallbackData = data;
2668 }
2669 }
2670
2671 void MOF_Parser_SetWarningCallback(
2672 MOF_Parser* self,
2673 void (*callback)(const char* msg, const wchar_t* wmsg, void* data),
2674 void* data)
2675 {
2676 if (self)
2677 {
2678 self->state.warningCallback = callback;
2679 self->state.warningCallbackData = data;
2680 }
2681 }
2682
2683 mike 1.1 void MOF_Parser_SetPragmaCallback(
2684 MOF_Parser* self,
2685 void (*callback)(const char* pragma, const char* value, void* data),
2686 void* data)
2687 {
2688 if (self)
2689 {
2690 self->state.pragmaCallback = callback;
2691 self->state.pragmaCallbackData = data;
2692 }
2693 }
2694
2695 void MOF_Parser_SetClassDeclCallback(
2696 MOF_Parser* self,
2697 void (*callback)(const MI_ClassDecl* decl, void* data),
2698 void* data)
2699 {
2700 if (self)
2701 {
2702 self->state.classDeclCallback = callback;
2703 self->state.classDeclCallbackData = data;
2704 mike 1.1 }
2705 }
2706
2707 void MOF_Parser_SetInstanceDeclCallback(
2708 MOF_Parser* self,
2709 void (*callback)(const MI_InstanceDecl* decl, void* data),
2710 void* data)
2711 {
2712 if (self)
2713 {
2714 self->state.instanceDeclCallback = callback;
2715 self->state.instanceDeclCallbackData = data;
2716 }
2717 }
2718
2719 void MOF_Parser_SetQualifierDeclCallback(
2720 MOF_Parser* self,
2721 void (*callback)(const MI_QualifierDecl* decl, void* data),
2722 void* data)
2723 {
2724 if (self)
2725 mike 1.1 {
2726 self->state.qualifierDeclCallback = callback;
2727 self->state.qualifierDeclCallbackData = data;
2728 }
2729 }
2730
2731 void MOF_Parser_Delete(MOF_Parser* self)
2732 {
2733 if (self)
2734 {
2735 MOF_Release(&self->state.heap);
|
2736 krisbash 1.5 PAL_Free(self);
|
2737 mike 1.1 }
2738 }
2739
2740 /* Handle multiple calls to this function */
2741 int MOF_Parser_Parse(MOF_Parser* self, const char* path)
2742 {
2743 /* Reject null parameters */
2744 if (!self || !path)
2745 return -1;
2746
2747 /* Clear stack */
2748 s_top = 0;
2749
2750 /* Set global state */
2751 state = self->state;
2752
2753 /* Open input */
|
2754 krisbash 1.5 yyin = File_Open(path, "rb");
|
2755 mike 1.1
2756 if (!yyin)
2757 {
2758 yyerrorf(ID_FAILED_TO_OPEN_FILE, "failed to open file: %s", path);
2759 self->state = state;
2760 memset(&state.heap, 0, sizeof(state));
2761 return -1;
2762 }
2763
2764 /* Save path */
2765 state.path = MOF_Strdup(&state.heap, path);
2766
2767 /* Set initialize line number */
2768 state.line = 1;
2769
2770 /* Clear the parser state */
2771 yy_c_buf_p = 0;
2772 yy_last_accepting_cpos = 0;
2773 yy_init = 1;
2774
2775 /* Run the parser */
2776 mike 1.1 if (yyparse() != 0)
2777 {
2778 fclose(yyin);
2779 yy_delete_buffer(YY_CURRENT_BUFFER);
2780 self->state = state;
2781 memset(&state.heap, 0, sizeof(state));
2782 return -1;
2783 }
2784
2785 /* Perform post processing (which requires first pass completion) */
2786 if (PerformPostProcessing() != 0)
2787 {
2788 fclose(yyin);
2789 yy_delete_buffer(YY_CURRENT_BUFFER);
2790 self->state = state;
2791 memset(&state.heap, 0, sizeof(state));
2792 return -1;
2793 }
2794
2795 /* Close stream and release parse buffer */
2796 fclose(yyin);
2797 mike 1.1 yy_delete_buffer(YY_CURRENT_BUFFER);
2798
2799 /* Restore state */
2800 self->state = state;
2801 memset(&state.heap, 0, sizeof(state));
2802
2803 return 0;
2804 }
2805
|
2806 krisbash 1.5 /* Parse a MOF string */
2807 int MOF_Parser_ParseString(MOF_Parser* self, const char* mof_string)
2808 {
2809 YY_BUFFER_STATE bp;
2810
2811 /* Reject null parameters */
2812 if (!self || !mof_string)
2813 return -1;
2814
2815 /* Clear stack */
2816 s_top = 0;
2817
2818 /* Set global state */
2819 state = self->state;
2820
2821 /* Save path */
2822 state.path = MOF_Strdup(&state.heap, "MOF string");
2823
2824 /* Set initialize line number */
2825 state.line = 1;
2826
2827 krisbash 1.5 /* Clear the parser state */
2828 yy_c_buf_p = 0;
2829 yy_last_accepting_cpos = 0;
2830 yy_init = 1;
2831
2832 /* Run the parser */
2833 bp = yy_scan_string(mof_string);
2834 yy_switch_to_buffer(bp);
2835 if (yyparse() != 0)
2836 {
2837 yy_delete_buffer(bp);
2838 self->state = state;
2839 memset(&state.heap, 0, sizeof(state));
2840 return -1;
2841 }
2842
2843 /* Perform post processing (which requires first pass completion) */
2844 if (PerformPostProcessing() != 0)
2845 {
2846 yy_delete_buffer(bp);
2847 self->state = state;
2848 krisbash 1.5 memset(&state.heap, 0, sizeof(state));
2849 return -1;
2850 }
2851
2852 /* Close stream and release parse buffer */
2853 yy_delete_buffer(bp);
2854
2855 /* Restore state */
2856 self->state = state;
2857 memset(&state.heap, 0, sizeof(state));
2858
2859 return 0;
2860 }
2861
|
2862 mike 1.1 void MOF_Parser_Dump(MOF_Parser* self, FILE* file)
2863 {
2864 size_t i;
2865
2866 for (i = 0; i < self->state.qualifierDecls.size; i++)
2867 MOF_PrintQualifierDecl(self->state.qualifierDecls.data[i], file);
2868
2869 for (i = 0; i < self->state.classDecls.size; i++)
2870 MOF_PrintClassDecl(self->state.classDecls.data[i], file);
2871
2872 for (i = 0; i < self->state.instanceDecls.size; i++)
2873 MOF_PrintInstanceDecl(self->state.instanceDecls.data[i], file);
2874 }
|
2875 krisbash 1.5
2876 void MOF_Parser_EnableExtensions(MOF_Parser* self, MI_Boolean enabled)
2877 {
2878 self->state.extensionsEnabled = enabled;
2879 return;
2880 }
|