1 /* A lexical scanner generated by flex */
2
3 /* Scanner skeleton version:
4 * $Header: /home/cvs/master/neXtaw/X11/neXtaw/laylex.c,v 1.1.1.1 2003/01/15 15:50:49 ulric Exp $
5 */
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
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 #else /* ! __cplusplus */
34
35 #if __STDC__
36
37 #define YY_USE_PROTOS
38 #define YY_USE_CONST
39
40 #endif /* __STDC__ */
41 #endif /* ! __cplusplus */
42
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 LayYYconst const
54 #else
55 #define LayYYconst
56 #endif
57
58
59 #ifdef YY_USE_PROTOS
60 #define YY_PROTO(proto) proto
61 #else
62 #define YY_PROTO(proto) ()
63 #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 LayYY_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 */
85 #define YY_START ((LayYY_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 LayYYrestart( LayYYin )
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 LayYY_buffer_state *YY_BUFFER_STATE;
100
101 extern int LayYYleng;
102 extern FILE *LayYYin, *LayYYout;
103
104 #define EOB_ACT_CONTINUE_SCAN 0
105 #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 * if ( condition_holds )
113 * LayYYless( 5 );
114 * else
115 * do_something_else();
116 *
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 LayYYless() call.
120 */
121
122 /* Return all but the first 'n' matched characters back to the input stream. */
123
124 #define LayYYless(n) \
125 do \
126 { \
127 /* Undo effects of setting up LayYYtext. */ \
128 *LayYY_cp = LayYY_hold_char; \
129 YY_RESTORE_YY_MORE_OFFSET \
130 LayYY_c_buf_p = LayYY_cp = LayYY_bp + n - YY_MORE_ADJ; \
131 YY_DO_BEFORE_ACTION; /* set up LayYYtext again */ \
132 } \
133 while ( 0 )
134
135 #define unput(c) LayYYunput( c, LayYYtext_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 LayYY_size_t;
142
143
144 struct LayYY_buffer_state
145 {
146 FILE *LayYY_input_file;
147
148 char *LayYY_ch_buf; /* input buffer */
149 char *LayYY_buf_pos; /* current position in input buffer */
150
151 /* Size of input buffer in bytes, not including room for EOB
152 * characters.
153 */
154 LayYY_size_t LayYY_buf_size;
155
156 /* Number of characters read into LayYY_ch_buf, not including EOB
157 * characters.
158 */
159 int LayYY_n_chars;
160
161 /* Whether we "own" the buffer - i.e., we know we created it,
162 * and can realloc() it to grow it, and should free() it to
163 * delete it.
164 */
165 int LayYY_is_our_buffer;
166
167 /* 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 LayYY_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 LayYY_at_bol;
179
180 /* Whether to try to fill the input buffer when we reach the
181 * end of it.
182 */
183 int LayYY_fill_buffer;
184
185 int LayYY_buffer_status;
186 #define YY_BUFFER_NEW 0
187 #define YY_BUFFER_NORMAL 1
188 /* 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 LayYYrestart()), so that the user can continue scanning by
196 * just pointing LayYYin at a new input file.
197 */
198 #define YY_BUFFER_EOF_PENDING 2
199 };
200
201 static YY_BUFFER_STATE LayYY_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 LayYY_current_buffer
208
209
210 /* LayYY_hold_char holds the character lost when LayYYtext is formed. */
211 static char LayYY_hold_char;
212
213 static int LayYY_n_chars; /* number of characters read into LayYY_ch_buf */
214
215
216 int LayYYleng;
217
218 /* Points to current character in buffer. */
219 static char *LayYY_c_buf_p = (char *) 0;
220 static int LayYY_init = 1; /* whether we need to initialize */
221 static int LayYY_start = 0; /* start state number */
222
223 /* Flag which is used to allow LayYYwrap()'s to do buffer switches
224 * instead of setting up a fresh LayYYin. A bit of a hack ...
225 */
226 static int LayYY_did_buffer_switch_on_eof;
227
228 void LayYYrestart YY_PROTO(( FILE *input_file ));
229
230 void LayYY_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
231 void LayYY_load_buffer_state YY_PROTO(( void ));
232 YY_BUFFER_STATE LayYY_create_buffer YY_PROTO(( FILE *file, int size ));
233 void LayYY_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
234 void LayYY_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
235 void LayYY_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
236 #define YY_FLUSH_BUFFER LayYY_flush_buffer( LayYY_current_buffer )
237
238 YY_BUFFER_STATE LayYY_scan_buffer YY_PROTO(( char *base, LayYY_size_t size ));
239 YY_BUFFER_STATE LayYY_scan_string YY_PROTO(( LayYYconst char *LayYY_str ));
240 YY_BUFFER_STATE LayYY_scan_bytes YY_PROTO(( LayYYconst char *bytes, int len ));
241
242 static void *LayYY_flex_alloc YY_PROTO(( LayYY_size_t ));
243 static void *LayYY_flex_realloc YY_PROTO(( void *, LayYY_size_t ));
244 static void LayYY_flex_free YY_PROTO(( void * ));
245
246 #define LayYY_new_buffer LayYY_create_buffer
247
248 #define LayYY_set_interactive(is_interactive) \
249 { \
250 if ( ! LayYY_current_buffer ) \
251 LayYY_current_buffer = LayYY_create_buffer( LayYYin, YY_BUF_SIZE ); \
252 LayYY_current_buffer->LayYY_is_interactive = is_interactive; \
253 }
254
255 #define LayYY_set_bol(at_bol) \
256 { \
257 if ( ! LayYY_current_buffer ) \
258 LayYY_current_buffer = LayYY_create_buffer( LayYYin, YY_BUF_SIZE ); \
259 LayYY_current_buffer->LayYY_at_bol = at_bol; \
260 }
261
262 #define YY_AT_BOL() (LayYY_current_buffer->LayYY_at_bol)
263
264
265 #define YY_USES_REJECT
266 typedef unsigned char YY_CHAR;
267 FILE *LayYYin = (FILE *) 0, *LayYYout = (FILE *) 0;
268 typedef int LayYY_state_type;
269 #define YY_FLEX_LEX_COMPAT
270 extern int LayYYlineno;
271 int LayYYlineno = 1;
272 extern char LayYYtext[];
273
274
275 static LayYY_state_type LayYY_get_previous_state YY_PROTO(( void ));
276 static LayYY_state_type LayYY_try_NUL_trans YY_PROTO(( LayYY_state_type current_state ));
277 static int LayYY_get_next_buffer YY_PROTO(( void ));
278 static void LayYY_fatal_error YY_PROTO(( LayYYconst char msg[] ));
279
280 /* Done after the current pattern has been matched and before the
281 * corresponding action - sets up LayYYtext.
282 */
283 #define YY_DO_BEFORE_ACTION \
284 LayYYtext_ptr = LayYY_bp; \
285 LayYYleng = (int) (LayYY_cp - LayYY_bp); \
286 LayYY_hold_char = *LayYY_cp; \
287 *LayYY_cp = '\0'; \
288 if ( LayYYleng + LayYY_more_offset >= YYLMAX ) \
289 YY_FATAL_ERROR( "token too large, exceeds YYLMAX" ); \
290 LayYY_flex_strncpy( &LayYYtext[LayYY_more_offset], LayYYtext_ptr, LayYYleng + 1 ); \
291 LayYYleng += LayYY_more_offset; \
292 LayYY_prev_more_offset = LayYY_more_offset; \
293 LayYY_more_offset = 0; \
294 LayYY_c_buf_p = LayYY_cp;
295
296 #define YY_NUM_RULES 28
297 #define YY_END_OF_BUFFER 29
298 static LayYYconst short int LayYY_acclist[116] =
299 { 0,
300 29, 27, 28, 25, 27, 28, 26, 28, 24, 27,
301 28, 13, 27, 28, 18, 27, 28, 5, 27, 28,
302 6, 27, 28, 16, 27, 28, 14, 27, 28, 15,
303 27, 28, 17, 27, 28, 11, 27, 28, 7, 27,
304 28, 12, 27, 28, 8, 27, 28, 23, 27, 28,
305 27, 28, 23, 27, 28, 23, 27, 28, 23, 27,
306 28, 23, 27, 28, 3, 27, 28, 4, 27, 28,
307 11, 23, 22, 23, 23, 23, 23, 23, 19, 22,
308 23, 23, 10, 23, 23, 23, 23, 23, 10, 23,
309 23, 23, 23, 23, 23, 23, 23, 20, 23, 21,
310
311 23, 23, 23, 23, 23, 23, 23, 23, 9, 23,
312 1, 23, 23, 2, 23
313 } ;
314
315 static LayYYconst short int LayYY_accept[70] =
316 { 0,
317 1, 1, 1, 2, 4, 7, 9, 12, 15, 18,
318 21, 24, 27, 30, 33, 36, 39, 42, 45, 48,
319 51, 53, 56, 59, 62, 65, 68, 71, 71, 71,
320 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
321 82, 83, 85, 86, 87, 88, 89, 91, 92, 93,
322 94, 95, 96, 97, 98, 100, 102, 103, 104, 105,
323 106, 107, 108, 109, 111, 113, 114, 116, 116
324 } ;
325
326 static LayYYconst int LayYY_ec[256] =
327 { 0,
328 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
329 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
330 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
331 1, 4, 1, 1, 1, 5, 6, 1, 1, 7,
332 8, 9, 10, 1, 11, 1, 12, 13, 13, 13,
333 13, 13, 13, 13, 13, 13, 13, 1, 1, 14,
334 15, 16, 1, 1, 17, 17, 17, 17, 17, 17,
335 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
336 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
337 1, 18, 1, 1, 17, 1, 19, 17, 20, 21,
338
339 22, 23, 24, 25, 26, 17, 17, 27, 17, 28,
340 29, 17, 17, 30, 17, 31, 17, 32, 33, 17,
341 34, 35, 36, 1, 37, 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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
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
350 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
351 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
352 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
353 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
354 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
355 1, 1, 1, 1, 1
356 } ;
357
358 static LayYYconst int LayYY_meta[38] =
359 { 0,
360 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
361 1, 1, 2, 1, 1, 1, 3, 1, 3, 3,
362 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
363 3, 3, 3, 3, 3, 1, 1
364 } ;
365
366 static LayYYconst short int LayYY_base[72] =
367 { 0,
368 0, 0, 88, 89, 89, 89, 89, 89, 36, 89,
369 89, 89, 89, 89, 89, 74, 89, 89, 89, 0,
370 0, 19, 58, 63, 58, 89, 89, 40, 60, 69,
371 0, 0, 55, 50, 56, 48, 56, 89, 0, 52,
372 49, 23, 43, 37, 42, 31, 41, 35, 36, 36,
373 29, 30, 32, 37, 0, 0, 28, 24, 35, 22,
374 18, 24, 31, 0, 0, 20, 0, 89, 68, 42,
375 70
376 } ;
377
378 static LayYYconst short int LayYY_def[72] =
379 { 0,
380 68, 1, 68, 68, 68, 68, 68, 68, 68, 68,
381 68, 68, 68, 68, 68, 68, 68, 68, 68, 69,
382 70, 69, 69, 69, 69, 68, 68, 68, 68, 68,
383 69, 71, 69, 69, 69, 69, 69, 68, 71, 69,
384 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
385 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
386 69, 69, 69, 69, 69, 69, 69, 0, 68, 68,
387 68
388 } ;
389
390 static LayYYconst short int LayYY_nxt[127] =
391 { 0,
392 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
393 14, 15, 16, 17, 18, 19, 20, 21, 20, 20,
394 20, 20, 20, 20, 22, 23, 20, 20, 20, 20,
395 20, 24, 25, 20, 20, 26, 27, 28, 28, 28,
396 33, 28, 28, 28, 32, 47, 67, 34, 48, 66,
397 65, 64, 63, 62, 61, 60, 59, 58, 57, 56,
398 55, 54, 53, 47, 29, 52, 51, 50, 29, 31,
399 31, 39, 39, 49, 46, 45, 44, 43, 42, 41,
400 40, 30, 38, 37, 36, 35, 30, 68, 3, 68,
401 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
402
403 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
404 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
405 68, 68, 68, 68, 68, 68
406 } ;
407
408 static LayYYconst short int LayYY_chk[127] =
409 { 0,
410 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
411 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
412 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
413 1, 1, 1, 1, 1, 1, 1, 9, 9, 9,
414 22, 28, 28, 28, 70, 42, 66, 22, 42, 63,
415 62, 61, 60, 59, 58, 57, 54, 53, 52, 51,
416 50, 49, 48, 47, 9, 46, 45, 44, 28, 69,
417 69, 71, 71, 43, 41, 40, 37, 36, 35, 34,
418 33, 30, 29, 25, 24, 23, 16, 3, 68, 68,
419 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
420
421 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
422 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
423 68, 68, 68, 68, 68, 68
424 } ;
425
426 static LayYY_state_type LayYY_state_buf[YY_BUF_SIZE + 2], *LayYY_state_ptr;
427 static char *LayYY_full_match;
428 static int LayYY_lp;
429 #define REJECT \
430 { \
431 *LayYY_cp = LayYY_hold_char; /* undo effects of setting up LayYYtext */ \
432 LayYY_cp = LayYY_full_match; /* restore poss. backed-over text */ \
433 ++LayYY_lp; \
434 goto find_rule; \
435 }
436 static int LayYY_more_offset = 0;
437 static int LayYY_prev_more_offset = 0;
438 #define LayYYmore() (LayYY_more_offset = LayYY_flex_strlen( LayYYtext ))
439 #define YY_NEED_STRLEN
440 #define YY_MORE_ADJ 0
441 #define YY_RESTORE_YY_MORE_OFFSET \
442 { \
443 LayYY_more_offset = LayYY_prev_more_offset; \
444 LayYYleng -= LayYY_more_offset; \
445 }
446 #ifndef YYLMAX
447 #define YYLMAX 8192
448 #endif
449
450 char LayYYtext[YYLMAX];
451 char *LayYYtext_ptr;
452 #line 1 "laylex.l"
453 #define INITIAL 0
454 #line 3 "laylex.l"
455 #ifndef FLEX_SCANNER
456 #undef input
457 #undef unput
458 #endif
459
460 #include <X11/Xlib.h>
461 #include <X11/Xresource.h>
462 #include <X11/IntrinsicP.h>
463 #include <X11/StringDefs.h>
464
465 #include "LayoutP.h"
466 #include "laygram.h"
467 static char *LayYYsourcebase, *LayYYsource;
468
469 #ifndef FLEX_SCANNER
470 #define input() (*LayYYsource++)
471 #define unput(c) (--LayYYsource)
472 #else
473 #include <string.h>
474 static void my_LayYYinput(char *buf, int *result, int max_size);
475 #define YY_INPUT(buf, res, max) my_LayYYinput(buf, &(res), max)
476 #endif
477
478 #ifdef __STDC__
479 static int count ();
480 #endif
481 #line 482 "lex.LayYY.c"
482
483 /* Macros after this point can all be overridden by user definitions in
484 * section 1.
485 */
486
487 #ifndef YY_SKIP_YYWRAP
488 #ifdef __cplusplus
489 extern "C" int LayYYwrap YY_PROTO(( void ));
490 #else
491 extern int LayYYwrap YY_PROTO(( void ));
492 #endif
493 #endif
494
495 #ifndef YY_NO_UNPUT
496 static void LayYYunput YY_PROTO(( int c, char *buf_ptr ));
497 #endif
498
499 #ifndef LayYYtext_ptr
500 static void LayYY_flex_strncpy YY_PROTO(( char *, LayYYconst char *, int ));
501 #endif
502
503 #ifdef YY_NEED_STRLEN
504 static int LayYY_flex_strlen YY_PROTO(( LayYYconst char * ));
505 #endif
506
507 #ifndef YY_NO_INPUT
508 #ifdef __cplusplus
509 static int LayYYinput YY_PROTO(( void ));
510 #else
511 static int input YY_PROTO(( void ));
512 #endif
513 #endif
514
515 #if YY_STACK_USED
516 static int LayYY_start_stack_ptr = 0;
517 static int LayYY_start_stack_depth = 0;
518 static int *LayYY_start_stack = 0;
519 #ifndef YY_NO_PUSH_STATE
520 static void LayYY_push_state YY_PROTO(( int new_state ));
521 #endif
522 #ifndef YY_NO_POP_STATE
523 static void LayYY_pop_state YY_PROTO(( void ));
524 #endif
525 #ifndef YY_NO_TOP_STATE
526 static int LayYY_top_state YY_PROTO(( void ));
527 #endif
528
529 #else
530 #define YY_NO_PUSH_STATE 1
531 #define YY_NO_POP_STATE 1
532 #define YY_NO_TOP_STATE 1
533 #endif
534
535 #ifdef YY_MALLOC_DECL
536 YY_MALLOC_DECL
537 #else
538 #if __STDC__
539 #ifndef __cplusplus
540 #include <stdlib.h>
541 #endif
542 #else
543 /* Just try to get by without declaring the routines. This will fail
544 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
545 * or sizeof(void*) != sizeof(int).
546 */
547 #endif
548 #endif
549
550 /* Amount of stuff to slurp up with each read. */
551 #ifndef YY_READ_BUF_SIZE
552 #define YY_READ_BUF_SIZE 8192
553 #endif
554
555 /* Copy whatever the last rule matched to the standard output. */
556
557 #ifndef ECHO
558 /* This used to be an fputs(), but since the string might contain NUL's,
559 * we now use fwrite().
560 */
561 #define ECHO (void) fwrite( LayYYtext, LayYYleng, 1, LayYYout )
562 #endif
563
564 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
565 * is returned in "result".
566 */
567 #ifndef YY_INPUT
568 #define YY_INPUT(buf,result,max_size) \
569 if ( LayYY_current_buffer->LayYY_is_interactive ) \
570 { \
571 int c = '*', n; \
572 for ( n = 0; n < max_size && \
573 (c = getc( LayYYin )) != EOF && c != '\n'; ++n ) \
574 buf[n] = (char) c; \
575 if ( c == '\n' ) \
576 buf[n++] = (char) c; \
577 if ( c == EOF && ferror( LayYYin ) ) \
578 YY_FATAL_ERROR( "input in flex scanner failed" ); \
579 result = n; \
580 } \
581 else if ( ((result = fread( buf, 1, max_size, LayYYin )) == 0) \
582 && ferror( LayYYin ) ) \
583 YY_FATAL_ERROR( "input in flex scanner failed" );
584 #endif
585
586 /* No semi-colon after return; correct usage is to write "LayYYterminate();" -
587 * we don't want an extra ';' after the "return" because that will cause
588 * some compilers to complain about unreachable statements.
589 */
590 #ifndef LayYYterminate
591 #define LayYYterminate() return YY_NULL
592 #endif
593
594 /* Number of entries by which start-condition stack grows. */
595 #ifndef YY_START_STACK_INCR
596 #define YY_START_STACK_INCR 25
597 #endif
598
599 /* Report a fatal error. */
600 #ifndef YY_FATAL_ERROR
601 #define YY_FATAL_ERROR(msg) LayYY_fatal_error( msg )
602 #endif
603
604 /* Default declaration of generated scanner - a define so the user can
605 * easily add parameters.
606 */
607 #ifndef YY_DECL
608 #define YY_DECL int LayYYlex YY_PROTO(( void ))
609 #endif
610
611 /* Code executed at the beginning of each rule, after LayYYtext and LayYYleng
612 * have been set up.
613 */
614 #ifndef YY_USER_ACTION
615 #define YY_USER_ACTION
616 #endif
617
618 /* Code executed at the end of each rule. */
619 #ifndef YY_BREAK
620 #define YY_BREAK break;
621 #endif
622
623 #define YY_RULE_SETUP \
624 YY_USER_ACTION
625
626 YY_DECL
627 {
628 register LayYY_state_type LayYY_current_state;
629 register char *LayYY_cp, *LayYY_bp;
630 register int LayYY_act;
631
632 #line 30 "laylex.l"
633
634 #line 635 "lex.LayYY.c"
635
636 if ( LayYY_init )
637 {
638 LayYY_init = 0;
639
640 #ifdef YY_USER_INIT
641 YY_USER_INIT;
642 #endif
643
644 if ( ! LayYY_start )
645 LayYY_start = 1; /* first start state */
646
647 if ( ! LayYYin )
648 LayYYin = stdin;
649
650 if ( ! LayYYout )
651 LayYYout = stdout;
652
653 if ( ! LayYY_current_buffer )
654 LayYY_current_buffer =
655 LayYY_create_buffer( LayYYin, YY_BUF_SIZE );
656
657 LayYY_load_buffer_state();
658 }
659
660 while ( 1 ) /* loops until end-of-file is reached */
661 {
662 LayYY_cp = LayYY_c_buf_p;
663
664 /* Support of LayYYtext. */
665 *LayYY_cp = LayYY_hold_char;
666
667 /* LayYY_bp points to the position in LayYY_ch_buf of the start of
668 * the current run.
669 */
670 LayYY_bp = LayYY_cp;
671
672 LayYY_current_state = LayYY_start;
673 LayYY_state_ptr = LayYY_state_buf;
674 *LayYY_state_ptr++ = LayYY_current_state;
675 LayYY_match:
676 do
677 {
678 register YY_CHAR LayYY_c = LayYY_ec[YY_SC_TO_UI(*LayYY_cp)];
679 while ( LayYY_chk[LayYY_base[LayYY_current_state] + LayYY_c] != LayYY_current_state )
680 {
681 LayYY_current_state = (int) LayYY_def[LayYY_current_state];
682 if ( LayYY_current_state >= 69 )
683 LayYY_c = LayYY_meta[(unsigned int) LayYY_c];
684 }
685 LayYY_current_state = LayYY_nxt[LayYY_base[LayYY_current_state] + (unsigned int) LayYY_c];
686 *LayYY_state_ptr++ = LayYY_current_state;
687 ++LayYY_cp;
688 }
689 while ( LayYY_base[LayYY_current_state] != 89 );
690
691 LayYY_find_action:
692 LayYY_current_state = *--LayYY_state_ptr;
693 LayYY_lp = LayYY_accept[LayYY_current_state];
694 find_rule: /* we branch to this label when backing up */
695 for ( ; ; ) /* until we find what rule we matched */
696 {
697 if ( LayYY_lp && LayYY_lp < LayYY_accept[LayYY_current_state + 1] )
698 {
699 LayYY_act = LayYY_acclist[LayYY_lp];
700 {
701 LayYY_full_match = LayYY_cp;
702 break;
703 }
704 }
705 --LayYY_cp;
706 LayYY_current_state = *--LayYY_state_ptr;
707 LayYY_lp = LayYY_accept[LayYY_current_state];
708 }
709
710 YY_DO_BEFORE_ACTION;
711
712 if ( LayYY_act != YY_END_OF_BUFFER )
713 {
714 int LayYYl;
715 for ( LayYYl = 0; LayYYl < LayYYleng; ++LayYYl )
716 if ( LayYYtext[LayYYl] == '\n' )
717 ++LayYYlineno;
718 }
719
720 do_action: /* This label is used only to access EOF actions. */
721
722
723 switch ( LayYY_act )
724 { /* beginning of action switch */
725 case 1:
726 YY_RULE_SETUP
727 #line 31 "laylex.l"
728 return VERTICAL;
729 YY_BREAK
730 case 2:
731 YY_RULE_SETUP
732 #line 32 "laylex.l"
733 return HORIZONTAL;
734 YY_BREAK
735 case 3:
736 YY_RULE_SETUP
737 #line 33 "laylex.l"
738 return OC;
739 YY_BREAK
740 case 4:
741 YY_RULE_SETUP
742 #line 34 "laylex.l"
743 return CC;
744 YY_BREAK
745 case 5:
746 YY_RULE_SETUP
747 #line 35 "laylex.l"
748 return OP;
749 YY_BREAK
750 case 6:
751 YY_RULE_SETUP
752 #line 36 "laylex.l"
753 return CP;
754 YY_BREAK
755 case 7:
756 YY_RULE_SETUP
757 #line 37 "laylex.l"
758 return OA;
759 YY_BREAK
760 case 8:
761 YY_RULE_SETUP
762 #line 38 "laylex.l"
763 return CA;
764 YY_BREAK
765 case 9:
766 YY_RULE_SETUP
767 #line 39 "laylex.l"
768 { LayYYlval.ival = 1; return INFINITY; }
769 YY_BREAK
770 case 10:
771 YY_RULE_SETUP
772 #line 40 "laylex.l"
773 { LayYYlval.ival = count(LayYYtext, 'f'); return INFINITY; }
774 YY_BREAK
775 case 11:
776 YY_RULE_SETUP
777 #line 41 "laylex.l"
778 { LayYYlval.ival = atoi(LayYYtext); return NUMBER; }
779 YY_BREAK
780 case 12:
781 YY_RULE_SETUP
782 #line 42 "laylex.l"
783 { return EQUAL; }
784 YY_BREAK
785 case 13:
786 YY_RULE_SETUP
787 #line 43 "laylex.l"
788 { return DOLLAR; }
789 YY_BREAK
790 case 14:
791 YY_RULE_SETUP
792 #line 44 "laylex.l"
793 { LayYYlval.oval = Plus; return PLUS; }
794 YY_BREAK
795 case 15:
796 YY_RULE_SETUP
797 #line 45 "laylex.l"
798 { LayYYlval.oval = Minus; return MINUS; }
799 YY_BREAK
800 case 16:
801 YY_RULE_SETUP
802 #line 46 "laylex.l"
803 { LayYYlval.oval = Times; return TIMES; }
804 YY_BREAK
805 case 17:
806 YY_RULE_SETUP
807 #line 47 "laylex.l"
808 { LayYYlval.oval = Divide; return DIVIDE; }
809 YY_BREAK
810 case 18:
811 YY_RULE_SETUP
812 #line 48 "laylex.l"
813 { LayYYlval.oval = Percent; return PERCENT; }
814 YY_BREAK
815 case 19:
816 YY_RULE_SETUP
817 #line 49 "laylex.l"
818 { LayYYlval.oval = Percent; return PERCENTOF; }
819 YY_BREAK
820 case 20:
821 YY_RULE_SETUP
822 #line 50 "laylex.l"
823 return WIDTH;
824 YY_BREAK
825 case 21:
826 YY_RULE_SETUP
827 #line 51 "laylex.l"
828 return HEIGHT;
829 YY_BREAK
830 case 22:
831 YY_RULE_SETUP
832 #line 52 "laylex.l"
833 {
834 #ifdef FLEX_SCANNER
835 LayYYtext[LayYYleng] = '\0';
836 #else
837 LayYYtext[LayYYleng-1] = '\0';
838 #endif
839 LayYYlval.qval = XrmStringToQuark (LayYYtext+1);
840 return NAME;
841 }
842 YY_BREAK
843 case 23:
844 YY_RULE_SETUP
845 #line 62 "laylex.l"
846 {
847 #ifdef FLEX_SCANNER
848 LayYYtext[LayYYleng] = '\0';
849 #else
850 LayYYtext[LayYYleng-1] = '\0';
851 #endif
852 LayYYlval.qval = XrmStringToQuark (LayYYtext);
853 return NAME;
854 }
855 YY_BREAK
856 case 24:
857 YY_RULE_SETUP
858 #line 71 "laylex.l"
859 ;
860 YY_BREAK
861 case 25:
862 YY_RULE_SETUP
863 #line 72 "laylex.l"
864 ;
865 YY_BREAK
866 case 26:
867 YY_RULE_SETUP
868 #line 73 "laylex.l"
869 ;
870 YY_BREAK
871 case 27:
872 YY_RULE_SETUP
873 #line 74 "laylex.l"
874 fprintf (stderr, "ignoring %c\n", *LayYYtext);
875 YY_BREAK
876 case 28:
877 YY_RULE_SETUP
878 #line 75 "laylex.l"
879 ECHO;
880 YY_BREAK
881 #line 882 "lex.LayYY.c"
882 case YY_STATE_EOF(INITIAL):
883 LayYYterminate();
884
885 case YY_END_OF_BUFFER:
886 {
887 /* Amount of text matched not including the EOB char. */
888 int LayYY_amount_of_matched_text = (int) (LayYY_cp - LayYYtext_ptr) - 1;
889
890 /* Undo the effects of YY_DO_BEFORE_ACTION. */
891 *LayYY_cp = LayYY_hold_char;
892 YY_RESTORE_YY_MORE_OFFSET
893
894 if ( LayYY_current_buffer->LayYY_buffer_status == YY_BUFFER_NEW )
895 {
896 /* We're scanning a new file or input source. It's
897 * possible that this happened because the user
898 * just pointed LayYYin at a new source and called
899 * LayYYlex(). If so, then we have to assure
900 * consistency between LayYY_current_buffer and our
901 * globals. Here is the right place to do so, because
902 * this is the first action (other than possibly a
903 * back-up) that will match for the new input source.
904 */
905 LayYY_n_chars = LayYY_current_buffer->LayYY_n_chars;
906 LayYY_current_buffer->LayYY_input_file = LayYYin;
907 LayYY_current_buffer->LayYY_buffer_status = YY_BUFFER_NORMAL;
908 }
909
910 /* Note that here we test for LayYY_c_buf_p "<=" to the position
911 * of the first EOB in the buffer, since LayYY_c_buf_p will
912 * already have been incremented past the NUL character
913 * (since all states make transitions on EOB to the
914 * end-of-buffer state). Contrast this with the test
915 * in input().
916 */
917 if ( LayYY_c_buf_p <= &LayYY_current_buffer->LayYY_ch_buf[LayYY_n_chars] )
918 { /* This was really a NUL. */
919 LayYY_state_type LayYY_next_state;
920
921 LayYY_c_buf_p = LayYYtext_ptr + LayYY_amount_of_matched_text;
922
923 LayYY_current_state = LayYY_get_previous_state();
924
925 /* Okay, we're now positioned to make the NUL
926 * transition. We couldn't have
927 * LayYY_get_previous_state() go ahead and do it
928 * for us because it doesn't know how to deal
929 * with the possibility of jamming (and we don't
930 * want to build jamming into it because then it
931 * will run more slowly).
932 */
933
934 LayYY_next_state = LayYY_try_NUL_trans( LayYY_current_state );
935
936 LayYY_bp = LayYYtext_ptr + YY_MORE_ADJ;
937
938 if ( LayYY_next_state )
939 {
940 /* Consume the NUL. */
941 LayYY_cp = ++LayYY_c_buf_p;
942 LayYY_current_state = LayYY_next_state;
943 goto LayYY_match;
944 }
945
946 else
947 {
948 LayYY_cp = LayYY_c_buf_p;
949 goto LayYY_find_action;
950 }
951 }
952
953 else switch ( LayYY_get_next_buffer() )
954 {
955 case EOB_ACT_END_OF_FILE:
956 {
957 LayYY_did_buffer_switch_on_eof = 0;
958
959 if ( LayYYwrap() )
960 {
961 /* Note: because we've taken care in
962 * LayYY_get_next_buffer() to have set up
963 * LayYYtext, we can now set up
964 * LayYY_c_buf_p so that if some total
965 * hoser (like flex itself) wants to
966 * call the scanner after we return the
967 * YY_NULL, it'll still work - another
968 * YY_NULL will get returned.
969 */
970 LayYY_c_buf_p = LayYYtext_ptr + YY_MORE_ADJ;
971
972 LayYY_act = YY_STATE_EOF(YY_START);
973 goto do_action;
974 }
975
976 else
977 {
978 if ( ! LayYY_did_buffer_switch_on_eof )
979 YY_NEW_FILE;
980 }
981 break;
982 }
983
984 case EOB_ACT_CONTINUE_SCAN:
985 LayYY_c_buf_p =
986 LayYYtext_ptr + LayYY_amount_of_matched_text;
987
988 LayYY_current_state = LayYY_get_previous_state();
989
990 LayYY_cp = LayYY_c_buf_p;
991 LayYY_bp = LayYYtext_ptr + YY_MORE_ADJ;
992 goto LayYY_match;
993
994 case EOB_ACT_LAST_MATCH:
995 LayYY_c_buf_p =
996 &LayYY_current_buffer->LayYY_ch_buf[LayYY_n_chars];
997
998 LayYY_current_state = LayYY_get_previous_state();
999
1000 LayYY_cp = LayYY_c_buf_p;
1001 LayYY_bp = LayYYtext_ptr + YY_MORE_ADJ;
1002 goto LayYY_find_action;
1003 }
1004 break;
1005 }
1006
1007 default:
1008 YY_FATAL_ERROR(
1009 "fatal flex scanner internal error--no action found" );
1010 } /* end of action switch */
1011 } /* end of scanning one token */
1012 } /* end of LayYYlex */
1013
1014
1015 /* LayYY_get_next_buffer - try to read in a new buffer
1016 *
1017 * Returns a code representing an action:
1018 * EOB_ACT_LAST_MATCH -
1019 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1020 * EOB_ACT_END_OF_FILE - end of file
1021 */
1022
LayYY_get_next_buffer()1023 static int LayYY_get_next_buffer()
1024 {
1025 register char *dest = LayYY_current_buffer->LayYY_ch_buf;
1026 register char *source = LayYYtext_ptr;
1027 register int number_to_move, i;
1028 int ret_val;
1029
1030 if ( LayYY_c_buf_p > &LayYY_current_buffer->LayYY_ch_buf[LayYY_n_chars + 1] )
1031 YY_FATAL_ERROR(
1032 "fatal flex scanner internal error--end of buffer missed" );
1033
1034 if ( LayYY_current_buffer->LayYY_fill_buffer == 0 )
1035 { /* Don't try to fill the buffer, so this is an EOF. */
1036 if ( LayYY_c_buf_p - LayYYtext_ptr - YY_MORE_ADJ == 1 )
1037 {
1038 /* We matched a single character, the EOB, so
1039 * treat this as a final EOF.
1040 */
1041 return EOB_ACT_END_OF_FILE;
1042 }
1043
1044 else
1045 {
1046 /* We matched some text prior to the EOB, first
1047 * process it.
1048 */
1049 return EOB_ACT_LAST_MATCH;
1050 }
1051 }
1052
1053 /* Try to read more data. */
1054
1055 /* First move last chars to start of buffer. */
1056 number_to_move = (int) (LayYY_c_buf_p - LayYYtext_ptr) - 1;
1057
1058 for ( i = 0; i < number_to_move; ++i )
1059 *(dest++) = *(source++);
1060
1061 if ( LayYY_current_buffer->LayYY_buffer_status == YY_BUFFER_EOF_PENDING )
1062 /* don't do the read, it's not guaranteed to return an EOF,
1063 * just force an EOF
1064 */
1065 LayYY_current_buffer->LayYY_n_chars = LayYY_n_chars = 0;
1066
1067 else
1068 {
1069 int num_to_read =
1070 LayYY_current_buffer->LayYY_buf_size - number_to_move - 1;
1071
1072 while ( num_to_read <= 0 )
1073 { /* Not enough room in the buffer - grow it. */
1074 #ifdef YY_USES_REJECT
1075 YY_FATAL_ERROR(
1076 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1077 #else
1078
1079 /* just a shorter name for the current buffer */
1080 YY_BUFFER_STATE b = LayYY_current_buffer;
1081
1082 int LayYY_c_buf_p_offset =
1083 (int) (LayYY_c_buf_p - b->LayYY_ch_buf);
1084
1085 if ( b->LayYY_is_our_buffer )
1086 {
1087 int new_size = b->LayYY_buf_size * 2;
1088
1089 if ( new_size <= 0 )
1090 b->LayYY_buf_size += b->LayYY_buf_size / 8;
1091 else
1092 b->LayYY_buf_size *= 2;
1093
1094 b->LayYY_ch_buf = (char *)
1095 /* Include room in for 2 EOB chars. */
1096 LayYY_flex_realloc( (void *) b->LayYY_ch_buf,
1097 b->LayYY_buf_size + 2 );
1098 }
1099 else
1100 /* Can't grow it, we don't own it. */
1101 b->LayYY_ch_buf = 0;
1102
1103 if ( ! b->LayYY_ch_buf )
1104 YY_FATAL_ERROR(
1105 "fatal error - scanner input buffer overflow" );
1106
1107 LayYY_c_buf_p = &b->LayYY_ch_buf[LayYY_c_buf_p_offset];
1108
1109 num_to_read = LayYY_current_buffer->LayYY_buf_size -
1110 number_to_move - 1;
1111 #endif
1112 }
1113
1114 if ( num_to_read > YY_READ_BUF_SIZE )
1115 num_to_read = YY_READ_BUF_SIZE;
1116
1117 /* Read in more data. */
1118 YY_INPUT( (&LayYY_current_buffer->LayYY_ch_buf[number_to_move]),
1119 LayYY_n_chars, num_to_read );
1120
1121 LayYY_current_buffer->LayYY_n_chars = LayYY_n_chars;
1122 }
1123
1124 if ( LayYY_n_chars == 0 )
1125 {
1126 if ( number_to_move == YY_MORE_ADJ )
1127 {
1128 ret_val = EOB_ACT_END_OF_FILE;
1129 LayYYrestart( LayYYin );
1130 }
1131
1132 else
1133 {
1134 ret_val = EOB_ACT_LAST_MATCH;
1135 LayYY_current_buffer->LayYY_buffer_status =
1136 YY_BUFFER_EOF_PENDING;
1137 }
1138 }
1139
1140 else
1141 ret_val = EOB_ACT_CONTINUE_SCAN;
1142
1143 LayYY_n_chars += number_to_move;
1144 LayYY_current_buffer->LayYY_ch_buf[LayYY_n_chars] = YY_END_OF_BUFFER_CHAR;
1145 LayYY_current_buffer->LayYY_ch_buf[LayYY_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1146
1147 LayYYtext_ptr = &LayYY_current_buffer->LayYY_ch_buf[0];
1148
1149 return ret_val;
1150 }
1151
1152
1153 /* LayYY_get_previous_state - get the state just before the EOB char was reached */
1154
LayYY_get_previous_state()1155 static LayYY_state_type LayYY_get_previous_state()
1156 {
1157 register LayYY_state_type LayYY_current_state;
1158 register char *LayYY_cp;
1159
1160 LayYY_current_state = LayYY_start;
1161 LayYY_state_ptr = LayYY_state_buf;
1162 *LayYY_state_ptr++ = LayYY_current_state;
1163
1164 for ( LayYY_cp = LayYYtext_ptr + YY_MORE_ADJ; LayYY_cp < LayYY_c_buf_p; ++LayYY_cp )
1165 {
1166 register YY_CHAR LayYY_c = (*LayYY_cp ? LayYY_ec[YY_SC_TO_UI(*LayYY_cp)] : 1);
1167 while ( LayYY_chk[LayYY_base[LayYY_current_state] + LayYY_c] != LayYY_current_state )
1168 {
1169 LayYY_current_state = (int) LayYY_def[LayYY_current_state];
1170 if ( LayYY_current_state >= 69 )
1171 LayYY_c = LayYY_meta[(unsigned int) LayYY_c];
1172 }
1173 LayYY_current_state = LayYY_nxt[LayYY_base[LayYY_current_state] + (unsigned int) LayYY_c];
1174 *LayYY_state_ptr++ = LayYY_current_state;
1175 }
1176
1177 return LayYY_current_state;
1178 }
1179
1180
1181 /* LayYY_try_NUL_trans - try to make a transition on the NUL character
1182 *
1183 * synopsis
1184 * next_state = LayYY_try_NUL_trans( current_state );
1185 */
1186
1187 #ifdef YY_USE_PROTOS
LayYY_try_NUL_trans(LayYY_state_type LayYY_current_state)1188 static LayYY_state_type LayYY_try_NUL_trans( LayYY_state_type LayYY_current_state )
1189 #else
1190 static LayYY_state_type LayYY_try_NUL_trans( LayYY_current_state )
1191 LayYY_state_type LayYY_current_state;
1192 #endif
1193 {
1194 register int LayYY_is_jam;
1195
1196 register YY_CHAR LayYY_c = 1;
1197 while ( LayYY_chk[LayYY_base[LayYY_current_state] + LayYY_c] != LayYY_current_state )
1198 {
1199 LayYY_current_state = (int) LayYY_def[LayYY_current_state];
1200 if ( LayYY_current_state >= 69 )
1201 LayYY_c = LayYY_meta[(unsigned int) LayYY_c];
1202 }
1203 LayYY_current_state = LayYY_nxt[LayYY_base[LayYY_current_state] + (unsigned int) LayYY_c];
1204 LayYY_is_jam = (LayYY_current_state == 68);
1205 if ( ! LayYY_is_jam )
1206 *LayYY_state_ptr++ = LayYY_current_state;
1207
1208 return LayYY_is_jam ? 0 : LayYY_current_state;
1209 }
1210
1211
1212 #ifndef YY_NO_UNPUT
1213 #ifdef YY_USE_PROTOS
LayYYunput(int c,register char * LayYY_bp)1214 static void LayYYunput( int c, register char *LayYY_bp )
1215 #else
1216 static void LayYYunput( c, LayYY_bp )
1217 int c;
1218 register char *LayYY_bp;
1219 #endif
1220 {
1221 register char *LayYY_cp = LayYY_c_buf_p;
1222
1223 /* undo effects of setting up LayYYtext */
1224 *LayYY_cp = LayYY_hold_char;
1225
1226 if ( LayYY_cp < LayYY_current_buffer->LayYY_ch_buf + 2 )
1227 { /* need to shift things up to make room */
1228 /* +2 for EOB chars. */
1229 register int number_to_move = LayYY_n_chars + 2;
1230 register char *dest = &LayYY_current_buffer->LayYY_ch_buf[
1231 LayYY_current_buffer->LayYY_buf_size + 2];
1232 register char *source =
1233 &LayYY_current_buffer->LayYY_ch_buf[number_to_move];
1234
1235 while ( source > LayYY_current_buffer->LayYY_ch_buf )
1236 *--dest = *--source;
1237
1238 LayYY_cp += (int) (dest - source);
1239 LayYY_bp += (int) (dest - source);
1240 LayYY_current_buffer->LayYY_n_chars =
1241 LayYY_n_chars = LayYY_current_buffer->LayYY_buf_size;
1242
1243 if ( LayYY_cp < LayYY_current_buffer->LayYY_ch_buf + 2 )
1244 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1245 }
1246
1247 *--LayYY_cp = (char) c;
1248
1249 if ( c == '\n' )
1250 --LayYYlineno;
1251
1252 LayYYtext_ptr = LayYY_bp;
1253 LayYY_hold_char = *LayYY_cp;
1254 LayYY_c_buf_p = LayYY_cp;
1255 }
1256 #endif /* ifndef YY_NO_UNPUT */
1257
1258
1259 #ifdef __cplusplus
LayYYinput()1260 static int LayYYinput()
1261 #else
1262 static int input()
1263 #endif
1264 {
1265 int c;
1266
1267 *LayYY_c_buf_p = LayYY_hold_char;
1268
1269 if ( *LayYY_c_buf_p == YY_END_OF_BUFFER_CHAR )
1270 {
1271 /* LayYY_c_buf_p now points to the character we want to return.
1272 * If this occurs *before* the EOB characters, then it's a
1273 * valid NUL; if not, then we've hit the end of the buffer.
1274 */
1275 if ( LayYY_c_buf_p < &LayYY_current_buffer->LayYY_ch_buf[LayYY_n_chars] )
1276 /* This was really a NUL. */
1277 *LayYY_c_buf_p = '\0';
1278
1279 else
1280 { /* need more input */
1281 int offset = LayYY_c_buf_p - LayYYtext_ptr;
1282 ++LayYY_c_buf_p;
1283
1284 switch ( LayYY_get_next_buffer() )
1285 {
1286 case EOB_ACT_LAST_MATCH:
1287 /* This happens because LayYY_g_n_b()
1288 * sees that we've accumulated a
1289 * token and flags that we need to
1290 * try matching the token before
1291 * proceeding. But for input(),
1292 * there's no matching to consider.
1293 * So convert the EOB_ACT_LAST_MATCH
1294 * to EOB_ACT_END_OF_FILE.
1295 */
1296
1297 /* Reset buffer status. */
1298 LayYYrestart( LayYYin );
1299
1300 /* fall through */
1301
1302 case EOB_ACT_END_OF_FILE:
1303 {
1304 if ( LayYYwrap() )
1305 return EOF;
1306
1307 if ( ! LayYY_did_buffer_switch_on_eof )
1308 YY_NEW_FILE;
1309 #ifdef __cplusplus
1310 return LayYYinput();
1311 #else
1312 return input();
1313 #endif
1314 }
1315
1316 case EOB_ACT_CONTINUE_SCAN:
1317 LayYY_c_buf_p = LayYYtext_ptr + offset;
1318 break;
1319 }
1320 }
1321 }
1322
1323 c = *(unsigned char *) LayYY_c_buf_p; /* cast for 8-bit char's */
1324 *LayYY_c_buf_p = '\0'; /* preserve LayYYtext */
1325 LayYY_hold_char = *++LayYY_c_buf_p;
1326
1327 if ( c == '\n' )
1328 ++LayYYlineno;
1329
1330 return c;
1331 }
1332
1333
1334 #ifdef YY_USE_PROTOS
LayYYrestart(FILE * input_file)1335 void LayYYrestart( FILE *input_file )
1336 #else
1337 void LayYYrestart( input_file )
1338 FILE *input_file;
1339 #endif
1340 {
1341 if ( ! LayYY_current_buffer )
1342 LayYY_current_buffer = LayYY_create_buffer( LayYYin, YY_BUF_SIZE );
1343
1344 LayYY_init_buffer( LayYY_current_buffer, input_file );
1345 LayYY_load_buffer_state();
1346 }
1347
1348
1349 #ifdef YY_USE_PROTOS
LayYY_switch_to_buffer(YY_BUFFER_STATE new_buffer)1350 void LayYY_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1351 #else
1352 void LayYY_switch_to_buffer( new_buffer )
1353 YY_BUFFER_STATE new_buffer;
1354 #endif
1355 {
1356 if ( LayYY_current_buffer == new_buffer )
1357 return;
1358
1359 if ( LayYY_current_buffer )
1360 {
1361 /* Flush out information for old buffer. */
1362 *LayYY_c_buf_p = LayYY_hold_char;
1363 LayYY_current_buffer->LayYY_buf_pos = LayYY_c_buf_p;
1364 LayYY_current_buffer->LayYY_n_chars = LayYY_n_chars;
1365 }
1366
1367 LayYY_current_buffer = new_buffer;
1368 LayYY_load_buffer_state();
1369
1370 /* We don't actually know whether we did this switch during
1371 * EOF (LayYYwrap()) processing, but the only time this flag
1372 * is looked at is after LayYYwrap() is called, so it's safe
1373 * to go ahead and always set it.
1374 */
1375 LayYY_did_buffer_switch_on_eof = 1;
1376 }
1377
1378
1379 #ifdef YY_USE_PROTOS
LayYY_load_buffer_state(void)1380 void LayYY_load_buffer_state( void )
1381 #else
1382 void LayYY_load_buffer_state()
1383 #endif
1384 {
1385 LayYY_n_chars = LayYY_current_buffer->LayYY_n_chars;
1386 LayYYtext_ptr = LayYY_c_buf_p = LayYY_current_buffer->LayYY_buf_pos;
1387 LayYYin = LayYY_current_buffer->LayYY_input_file;
1388 LayYY_hold_char = *LayYY_c_buf_p;
1389 }
1390
1391
1392 #ifdef YY_USE_PROTOS
LayYY_create_buffer(FILE * file,int size)1393 YY_BUFFER_STATE LayYY_create_buffer( FILE *file, int size )
1394 #else
1395 YY_BUFFER_STATE LayYY_create_buffer( file, size )
1396 FILE *file;
1397 int size;
1398 #endif
1399 {
1400 YY_BUFFER_STATE b;
1401
1402 b = (YY_BUFFER_STATE) LayYY_flex_alloc( sizeof( struct LayYY_buffer_state ) );
1403 if ( ! b )
1404 YY_FATAL_ERROR( "out of dynamic memory in LayYY_create_buffer()" );
1405
1406 b->LayYY_buf_size = size;
1407
1408 /* LayYY_ch_buf has to be 2 characters longer than the size given because
1409 * we need to put in 2 end-of-buffer characters.
1410 */
1411 b->LayYY_ch_buf = (char *) LayYY_flex_alloc( b->LayYY_buf_size + 2 );
1412 if ( ! b->LayYY_ch_buf )
1413 YY_FATAL_ERROR( "out of dynamic memory in LayYY_create_buffer()" );
1414
1415 b->LayYY_is_our_buffer = 1;
1416
1417 LayYY_init_buffer( b, file );
1418
1419 return b;
1420 }
1421
1422
1423 #ifdef YY_USE_PROTOS
LayYY_delete_buffer(YY_BUFFER_STATE b)1424 void LayYY_delete_buffer( YY_BUFFER_STATE b )
1425 #else
1426 void LayYY_delete_buffer( b )
1427 YY_BUFFER_STATE b;
1428 #endif
1429 {
1430 if ( ! b )
1431 return;
1432
1433 if ( b == LayYY_current_buffer )
1434 LayYY_current_buffer = (YY_BUFFER_STATE) 0;
1435
1436 if ( b->LayYY_is_our_buffer )
1437 LayYY_flex_free( (void *) b->LayYY_ch_buf );
1438
1439 LayYY_flex_free( (void *) b );
1440 }
1441
1442
1443 #ifndef YY_ALWAYS_INTERACTIVE
1444 #ifndef YY_NEVER_INTERACTIVE
1445 extern int isatty YY_PROTO(( int ));
1446 #endif
1447 #endif
1448
1449 #ifdef YY_USE_PROTOS
LayYY_init_buffer(YY_BUFFER_STATE b,FILE * file)1450 void LayYY_init_buffer( YY_BUFFER_STATE b, FILE *file )
1451 #else
1452 void LayYY_init_buffer( b, file )
1453 YY_BUFFER_STATE b;
1454 FILE *file;
1455 #endif
1456
1457
1458 {
1459 LayYY_flush_buffer( b );
1460
1461 b->LayYY_input_file = file;
1462 b->LayYY_fill_buffer = 1;
1463
1464 #if YY_ALWAYS_INTERACTIVE
1465 b->LayYY_is_interactive = 1;
1466 #else
1467 #if YY_NEVER_INTERACTIVE
1468 b->LayYY_is_interactive = 0;
1469 #else
1470 b->LayYY_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1471 #endif
1472 #endif
1473 }
1474
1475
1476 #ifdef YY_USE_PROTOS
LayYY_flush_buffer(YY_BUFFER_STATE b)1477 void LayYY_flush_buffer( YY_BUFFER_STATE b )
1478 #else
1479 void LayYY_flush_buffer( b )
1480 YY_BUFFER_STATE b;
1481 #endif
1482
1483 {
1484 if ( ! b )
1485 return;
1486
1487 b->LayYY_n_chars = 0;
1488
1489 /* We always need two end-of-buffer characters. The first causes
1490 * a transition to the end-of-buffer state. The second causes
1491 * a jam in that state.
1492 */
1493 b->LayYY_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1494 b->LayYY_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1495
1496 b->LayYY_buf_pos = &b->LayYY_ch_buf[0];
1497
1498 b->LayYY_at_bol = 1;
1499 b->LayYY_buffer_status = YY_BUFFER_NEW;
1500
1501 if ( b == LayYY_current_buffer )
1502 LayYY_load_buffer_state();
1503 }
1504
1505
1506 #ifndef YY_NO_SCAN_BUFFER
1507 #ifdef YY_USE_PROTOS
LayYY_scan_buffer(char * base,LayYY_size_t size)1508 YY_BUFFER_STATE LayYY_scan_buffer( char *base, LayYY_size_t size )
1509 #else
1510 YY_BUFFER_STATE LayYY_scan_buffer( base, size )
1511 char *base;
1512 LayYY_size_t size;
1513 #endif
1514 {
1515 YY_BUFFER_STATE b;
1516
1517 if ( size < 2 ||
1518 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1519 base[size-1] != YY_END_OF_BUFFER_CHAR )
1520 /* They forgot to leave room for the EOB's. */
1521 return 0;
1522
1523 b = (YY_BUFFER_STATE) LayYY_flex_alloc( sizeof( struct LayYY_buffer_state ) );
1524 if ( ! b )
1525 YY_FATAL_ERROR( "out of dynamic memory in LayYY_scan_buffer()" );
1526
1527 b->LayYY_buf_size = size - 2; /* "- 2" to take care of EOB's */
1528 b->LayYY_buf_pos = b->LayYY_ch_buf = base;
1529 b->LayYY_is_our_buffer = 0;
1530 b->LayYY_input_file = 0;
1531 b->LayYY_n_chars = b->LayYY_buf_size;
1532 b->LayYY_is_interactive = 0;
1533 b->LayYY_at_bol = 1;
1534 b->LayYY_fill_buffer = 0;
1535 b->LayYY_buffer_status = YY_BUFFER_NEW;
1536
1537 LayYY_switch_to_buffer( b );
1538
1539 return b;
1540 }
1541 #endif
1542
1543
1544 #ifndef YY_NO_SCAN_STRING
1545 #ifdef YY_USE_PROTOS
LayYY_scan_string(LayYYconst char * LayYY_str)1546 YY_BUFFER_STATE LayYY_scan_string( LayYYconst char *LayYY_str )
1547 #else
1548 YY_BUFFER_STATE LayYY_scan_string( LayYY_str )
1549 LayYYconst char *LayYY_str;
1550 #endif
1551 {
1552 int len;
1553 for ( len = 0; LayYY_str[len]; ++len )
1554 ;
1555
1556 return LayYY_scan_bytes( LayYY_str, len );
1557 }
1558 #endif
1559
1560
1561 #ifndef YY_NO_SCAN_BYTES
1562 #ifdef YY_USE_PROTOS
LayYY_scan_bytes(LayYYconst char * bytes,int len)1563 YY_BUFFER_STATE LayYY_scan_bytes( LayYYconst char *bytes, int len )
1564 #else
1565 YY_BUFFER_STATE LayYY_scan_bytes( bytes, len )
1566 LayYYconst char *bytes;
1567 int len;
1568 #endif
1569 {
1570 YY_BUFFER_STATE b;
1571 char *buf;
1572 LayYY_size_t n;
1573 int i;
1574
1575 /* Get memory for full buffer, including space for trailing EOB's. */
1576 n = len + 2;
1577 buf = (char *) LayYY_flex_alloc( n );
1578 if ( ! buf )
1579 YY_FATAL_ERROR( "out of dynamic memory in LayYY_scan_bytes()" );
1580
1581 for ( i = 0; i < len; ++i )
1582 buf[i] = bytes[i];
1583
1584 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1585
1586 b = LayYY_scan_buffer( buf, n );
1587 if ( ! b )
1588 YY_FATAL_ERROR( "bad buffer in LayYY_scan_bytes()" );
1589
1590 /* It's okay to grow etc. this buffer, and we should throw it
1591 * away when we're done.
1592 */
1593 b->LayYY_is_our_buffer = 1;
1594
1595 return b;
1596 }
1597 #endif
1598
1599
1600 #ifndef YY_NO_PUSH_STATE
1601 #ifdef YY_USE_PROTOS
LayYY_push_state(int new_state)1602 static void LayYY_push_state( int new_state )
1603 #else
1604 static void LayYY_push_state( new_state )
1605 int new_state;
1606 #endif
1607 {
1608 if ( LayYY_start_stack_ptr >= LayYY_start_stack_depth )
1609 {
1610 LayYY_size_t new_size;
1611
1612 LayYY_start_stack_depth += YY_START_STACK_INCR;
1613 new_size = LayYY_start_stack_depth * sizeof( int );
1614
1615 if ( ! LayYY_start_stack )
1616 LayYY_start_stack = (int *) LayYY_flex_alloc( new_size );
1617
1618 else
1619 LayYY_start_stack = (int *) LayYY_flex_realloc(
1620 (void *) LayYY_start_stack, new_size );
1621
1622 if ( ! LayYY_start_stack )
1623 YY_FATAL_ERROR(
1624 "out of memory expanding start-condition stack" );
1625 }
1626
1627 LayYY_start_stack[LayYY_start_stack_ptr++] = YY_START;
1628
1629 BEGIN(new_state);
1630 }
1631 #endif
1632
1633
1634 #ifndef YY_NO_POP_STATE
LayYY_pop_state()1635 static void LayYY_pop_state()
1636 {
1637 if ( --LayYY_start_stack_ptr < 0 )
1638 YY_FATAL_ERROR( "start-condition stack underflow" );
1639
1640 BEGIN(LayYY_start_stack[LayYY_start_stack_ptr]);
1641 }
1642 #endif
1643
1644
1645 #ifndef YY_NO_TOP_STATE
LayYY_top_state()1646 static int LayYY_top_state()
1647 {
1648 return LayYY_start_stack[LayYY_start_stack_ptr - 1];
1649 }
1650 #endif
1651
1652 #ifndef YY_EXIT_FAILURE
1653 #define YY_EXIT_FAILURE 2
1654 #endif
1655
1656 #ifdef YY_USE_PROTOS
LayYY_fatal_error(LayYYconst char msg[])1657 static void LayYY_fatal_error( LayYYconst char msg[] )
1658 #else
1659 static void LayYY_fatal_error( msg )
1660 char msg[];
1661 #endif
1662 {
1663 (void) fprintf( stderr, "%s\n", msg );
1664 exit( YY_EXIT_FAILURE );
1665 }
1666
1667
1668
1669 /* Redefine LayYYless() so it works in section 3 code. */
1670
1671 #undef LayYYless
1672 #define LayYYless(n) \
1673 do \
1674 { \
1675 /* Undo effects of setting up LayYYtext. */ \
1676 LayYYtext[LayYYleng] = LayYY_hold_char; \
1677 LayYY_c_buf_p = LayYYtext + n; \
1678 LayYY_hold_char = *LayYY_c_buf_p; \
1679 *LayYY_c_buf_p = '\0'; \
1680 LayYYleng = n; \
1681 } \
1682 while ( 0 )
1683
1684
1685 /* Internal utility routines. */
1686
1687 #ifndef LayYYtext_ptr
1688 #ifdef YY_USE_PROTOS
LayYY_flex_strncpy(char * s1,LayYYconst char * s2,int n)1689 static void LayYY_flex_strncpy( char *s1, LayYYconst char *s2, int n )
1690 #else
1691 static void LayYY_flex_strncpy( s1, s2, n )
1692 char *s1;
1693 LayYYconst char *s2;
1694 int n;
1695 #endif
1696 {
1697 register int i;
1698 for ( i = 0; i < n; ++i )
1699 s1[i] = s2[i];
1700 }
1701 #endif
1702
1703 #ifdef YY_NEED_STRLEN
1704 #ifdef YY_USE_PROTOS
LayYY_flex_strlen(LayYYconst char * s)1705 static int LayYY_flex_strlen( LayYYconst char *s )
1706 #else
1707 static int LayYY_flex_strlen( s )
1708 LayYYconst char *s;
1709 #endif
1710 {
1711 register int n;
1712 for ( n = 0; s[n]; ++n )
1713 ;
1714
1715 return n;
1716 }
1717 #endif
1718
1719
1720 #ifdef YY_USE_PROTOS
LayYY_flex_alloc(LayYY_size_t size)1721 static void *LayYY_flex_alloc( LayYY_size_t size )
1722 #else
1723 static void *LayYY_flex_alloc( size )
1724 LayYY_size_t size;
1725 #endif
1726 {
1727 return (void *) malloc( size );
1728 }
1729
1730 #ifdef YY_USE_PROTOS
LayYY_flex_realloc(void * ptr,LayYY_size_t size)1731 static void *LayYY_flex_realloc( void *ptr, LayYY_size_t size )
1732 #else
1733 static void *LayYY_flex_realloc( ptr, size )
1734 void *ptr;
1735 LayYY_size_t size;
1736 #endif
1737 {
1738 /* The cast to (char *) in the following accommodates both
1739 * implementations that use char* generic pointers, and those
1740 * that use void* generic pointers. It works with the latter
1741 * because both ANSI C and C++ allow castless assignment from
1742 * any pointer type to void*, and deal with argument conversions
1743 * as though doing an assignment.
1744 */
1745 return (void *) realloc( (char *) ptr, size );
1746 }
1747
1748 #ifdef YY_USE_PROTOS
LayYY_flex_free(void * ptr)1749 static void LayYY_flex_free( void *ptr )
1750 #else
1751 static void LayYY_flex_free( ptr )
1752 void *ptr;
1753 #endif
1754 {
1755 free( ptr );
1756 }
1757
1758 #if YY_MAIN
main()1759 int main()
1760 {
1761 LayYYlex();
1762 return 0;
1763 }
1764 #endif
1765 #line 75 "laylex.l"
1766
1767
1768 static int
count(s,c)1769 count (s, c)
1770 char *s;
1771 char c;
1772 {
1773 int i = 0;
1774 while (*s)
1775 if (*s++ == c)
1776 i++;
1777 return i;
1778 }
1779
LayYYsetsource(s)1780 LayYYsetsource(s)
1781 char *s;
1782 {
1783 LayYYsourcebase = LayYYsource = s;
1784 }
1785
LayYYerror(s)1786 LayYYerror(s)
1787 char *s;
1788 {
1789 char *t;
1790
1791 fprintf (stderr, "%s\n", s);
1792 t = LayYYsource - 50;
1793 if (t < LayYYsourcebase)
1794 t = LayYYsourcebase;
1795 while (*t && t < LayYYsource + 50) {
1796 if (t == LayYYsource)
1797 putc ('@', stderr);
1798 putc (*t++, stderr);
1799 }
1800 if (t == LayYYsource)
1801 putc ('@', stderr);
1802 if (!*t)
1803 fprintf (stderr, "<EOF>");
1804 fprintf (stderr, "\n");
1805 }
1806
1807 #ifdef FLEX_SCANNER
1808 static void
my_LayYYinput(buf,result,max_size)1809 my_LayYYinput(buf, result, max_size)
1810 char *buf; int *result; int max_size;
1811 {
1812 int size = max_size < strlen(LayYYsource) ? max_size : strlen(LayYYsource);
1813
1814 strncpy(buf, LayYYsource, size);
1815 LayYYsource += size;
1816 *result = size;
1817 }
1818 #endif
1819