1 /* $NetBSD: slc-lex.c,v 1.3 2023/06/19 21:41:45 christos Exp $ */
2
3
4 #line 2 "slc-lex.c"
5
6 #define YY_INT_ALIGNED short int
7
8 /* A lexical scanner generated by flex */
9
10 #define FLEX_SCANNER
11 #define YY_FLEX_MAJOR_VERSION 2
12 #define YY_FLEX_MINOR_VERSION 6
13 #define YY_FLEX_SUBMINOR_VERSION 4
14 #if YY_FLEX_SUBMINOR_VERSION > 0
15 #define FLEX_BETA
16 #endif
17
18 /* First, we deal with platform-specific or compiler-specific issues. */
19
20 /* begin standard C headers. */
21 #include <stdio.h>
22 #include <string.h>
23 #include <errno.h>
24 #include <stdlib.h>
25
26 /* end standard C headers. */
27
28 /* flex integer type definitions */
29
30 #ifndef FLEXINT_H
31 #define FLEXINT_H
32
33 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
34
35 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
36
37 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
38 * if you want the limit (max/min) macros for int types.
39 */
40 #ifndef __STDC_LIMIT_MACROS
41 #define __STDC_LIMIT_MACROS 1
42 #endif
43
44 #include <inttypes.h>
45 typedef int8_t flex_int8_t;
46 typedef uint8_t flex_uint8_t;
47 typedef int16_t flex_int16_t;
48 typedef uint16_t flex_uint16_t;
49 typedef int32_t flex_int32_t;
50 typedef uint32_t flex_uint32_t;
51 #else
52 typedef signed char flex_int8_t;
53 typedef short int flex_int16_t;
54 typedef int flex_int32_t;
55 typedef unsigned char flex_uint8_t;
56 typedef unsigned short int flex_uint16_t;
57 typedef unsigned int flex_uint32_t;
58
59 /* Limits of integral types. */
60 #ifndef INT8_MIN
61 #define INT8_MIN (-128)
62 #endif
63 #ifndef INT16_MIN
64 #define INT16_MIN (-32767-1)
65 #endif
66 #ifndef INT32_MIN
67 #define INT32_MIN (-2147483647-1)
68 #endif
69 #ifndef INT8_MAX
70 #define INT8_MAX (127)
71 #endif
72 #ifndef INT16_MAX
73 #define INT16_MAX (32767)
74 #endif
75 #ifndef INT32_MAX
76 #define INT32_MAX (2147483647)
77 #endif
78 #ifndef UINT8_MAX
79 #define UINT8_MAX (255U)
80 #endif
81 #ifndef UINT16_MAX
82 #define UINT16_MAX (65535U)
83 #endif
84 #ifndef UINT32_MAX
85 #define UINT32_MAX (4294967295U)
86 #endif
87
88 #ifndef SIZE_MAX
89 #define SIZE_MAX (~(size_t)0)
90 #endif
91
92 #endif /* ! C99 */
93
94 #endif /* ! FLEXINT_H */
95
96 /* begin standard C++ headers. */
97
98 /* TODO: this is always defined, so inline it */
99 #define yyconst const
100
101 #if defined(__GNUC__) && __GNUC__ >= 3
102 #define yynoreturn __attribute__((__noreturn__))
103 #else
104 #define yynoreturn
105 #endif
106
107 /* Returned upon end-of-file. */
108 #define YY_NULL 0
109
110 /* Promotes a possibly negative, possibly signed char to an
111 * integer in range [0..255] for use as an array index.
112 */
113 #define YY_SC_TO_UI(c) ((YY_CHAR) (c))
114
115 /* Enter a start condition. This macro really ought to take a parameter,
116 * but we do it the disgusting crufty way forced on us by the ()-less
117 * definition of BEGIN.
118 */
119 #define BEGIN (yy_start) = 1 + 2 *
120 /* Translate the current start state into a value that can be later handed
121 * to BEGIN to return to the state. The YYSTATE alias is for lex
122 * compatibility.
123 */
124 #define YY_START (((yy_start) - 1) / 2)
125 #define YYSTATE YY_START
126 /* Action number for EOF rule of a given start state. */
127 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
128 /* Special action meaning "start processing a new file". */
129 #define YY_NEW_FILE yyrestart( yyin )
130 #define YY_END_OF_BUFFER_CHAR 0
131
132 /* Size of default input buffer. */
133 #ifndef YY_BUF_SIZE
134 #ifdef __ia64__
135 /* On IA-64, the buffer size is 16k, not 8k.
136 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
137 * Ditto for the __ia64__ case accordingly.
138 */
139 #define YY_BUF_SIZE 32768
140 #else
141 #define YY_BUF_SIZE 16384
142 #endif /* __ia64__ */
143 #endif
144
145 /* The state buf must be large enough to hold one state per character in the main buffer.
146 */
147 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
148
149 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
150 #define YY_TYPEDEF_YY_BUFFER_STATE
151 typedef struct yy_buffer_state *YY_BUFFER_STATE;
152 #endif
153
154 #ifndef YY_TYPEDEF_YY_SIZE_T
155 #define YY_TYPEDEF_YY_SIZE_T
156 typedef size_t yy_size_t;
157 #endif
158
159 extern int yyleng;
160
161 extern FILE *yyin, *yyout;
162
163 #define EOB_ACT_CONTINUE_SCAN 0
164 #define EOB_ACT_END_OF_FILE 1
165 #define EOB_ACT_LAST_MATCH 2
166
167 #define YY_LESS_LINENO(n)
168 #define YY_LINENO_REWIND_TO(ptr)
169
170 /* Return all but the first "n" matched characters back to the input stream. */
171 #define yyless(n) \
172 do \
173 { \
174 /* Undo effects of setting up yytext. */ \
175 int yyless_macro_arg = (n); \
176 YY_LESS_LINENO(yyless_macro_arg);\
177 *yy_cp = (yy_hold_char); \
178 YY_RESTORE_YY_MORE_OFFSET \
179 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
180 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
181 } \
182 while ( 0 )
183 #define unput(c) yyunput( c, (yytext_ptr) )
184
185 #ifndef YY_STRUCT_YY_BUFFER_STATE
186 #define YY_STRUCT_YY_BUFFER_STATE
187 struct yy_buffer_state
188 {
189 FILE *yy_input_file;
190
191 char *yy_ch_buf; /* input buffer */
192 char *yy_buf_pos; /* current position in input buffer */
193
194 /* Size of input buffer in bytes, not including room for EOB
195 * characters.
196 */
197 int yy_buf_size;
198
199 /* Number of characters read into yy_ch_buf, not including EOB
200 * characters.
201 */
202 int yy_n_chars;
203
204 /* Whether we "own" the buffer - i.e., we know we created it,
205 * and can realloc() it to grow it, and should free() it to
206 * delete it.
207 */
208 int yy_is_our_buffer;
209
210 /* Whether this is an "interactive" input source; if so, and
211 * if we're using stdio for input, then we want to use getc()
212 * instead of fread(), to make sure we stop fetching input after
213 * each newline.
214 */
215 int yy_is_interactive;
216
217 /* Whether we're considered to be at the beginning of a line.
218 * If so, '^' rules will be active on the next match, otherwise
219 * not.
220 */
221 int yy_at_bol;
222
223 int yy_bs_lineno; /**< The line count. */
224 int yy_bs_column; /**< The column count. */
225
226 /* Whether to try to fill the input buffer when we reach the
227 * end of it.
228 */
229 int yy_fill_buffer;
230
231 int yy_buffer_status;
232
233 #define YY_BUFFER_NEW 0
234 #define YY_BUFFER_NORMAL 1
235 /* When an EOF's been seen but there's still some text to process
236 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
237 * shouldn't try reading from the input source any more. We might
238 * still have a bunch of tokens to match, though, because of
239 * possible backing-up.
240 *
241 * When we actually see the EOF, we change the status to "new"
242 * (via yyrestart()), so that the user can continue scanning by
243 * just pointing yyin at a new input file.
244 */
245 #define YY_BUFFER_EOF_PENDING 2
246
247 };
248 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
249
250 /* Stack of input buffers. */
251 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
252 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
253 static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
254
255 /* We provide macros for accessing buffer states in case in the
256 * future we want to put the buffer states in a more general
257 * "scanner state".
258 *
259 * Returns the top of the stack, or NULL.
260 */
261 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
262 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
263 : NULL)
264 /* Same as previous macro, but useful when we know that the buffer stack is not
265 * NULL or when we need an lvalue. For internal use only.
266 */
267 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
268
269 /* yy_hold_char holds the character lost when yytext is formed. */
270 static char yy_hold_char;
271 static int yy_n_chars; /* number of characters read into yy_ch_buf */
272 int yyleng;
273
274 /* Points to current character in buffer. */
275 static char *yy_c_buf_p = NULL;
276 static int yy_init = 0; /* whether we need to initialize */
277 static int yy_start = 0; /* start state number */
278
279 /* Flag which is used to allow yywrap()'s to do buffer switches
280 * instead of setting up a fresh yyin. A bit of a hack ...
281 */
282 static int yy_did_buffer_switch_on_eof;
283
284 void yyrestart ( FILE *input_file );
285 void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer );
286 YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size );
287 void yy_delete_buffer ( YY_BUFFER_STATE b );
288 void yy_flush_buffer ( YY_BUFFER_STATE b );
289 void yypush_buffer_state ( YY_BUFFER_STATE new_buffer );
290 void yypop_buffer_state ( void );
291
292 static void yyensure_buffer_stack ( void );
293 static void yy_load_buffer_state ( void );
294 static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file );
295 #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER )
296
297 YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size );
298 YY_BUFFER_STATE yy_scan_string ( const char *yy_str );
299 YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len );
300
301 void *yyalloc ( yy_size_t );
302 void *yyrealloc ( void *, yy_size_t );
303 void yyfree ( void * );
304
305 #define yy_new_buffer yy_create_buffer
306 #define yy_set_interactive(is_interactive) \
307 { \
308 if ( ! YY_CURRENT_BUFFER ){ \
309 yyensure_buffer_stack (); \
310 YY_CURRENT_BUFFER_LVALUE = \
311 yy_create_buffer( yyin, YY_BUF_SIZE ); \
312 } \
313 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
314 }
315 #define yy_set_bol(at_bol) \
316 { \
317 if ( ! YY_CURRENT_BUFFER ){\
318 yyensure_buffer_stack (); \
319 YY_CURRENT_BUFFER_LVALUE = \
320 yy_create_buffer( yyin, YY_BUF_SIZE ); \
321 } \
322 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
323 }
324 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
325
326 /* Begin user sect3 */
327 typedef flex_uint8_t YY_CHAR;
328
329 FILE *yyin = NULL, *yyout = NULL;
330
331 typedef int yy_state_type;
332
333 extern int yylineno;
334 int yylineno = 1;
335
336 extern char *yytext;
337 #ifdef yytext_ptr
338 #undef yytext_ptr
339 #endif
340 #define yytext_ptr yytext
341
342 static yy_state_type yy_get_previous_state ( void );
343 static yy_state_type yy_try_NUL_trans ( yy_state_type current_state );
344 static int yy_get_next_buffer ( void );
345 static void yynoreturn yy_fatal_error ( const char* msg );
346
347 /* Done after the current pattern has been matched and before the
348 * corresponding action - sets up yytext.
349 */
350 #define YY_DO_BEFORE_ACTION \
351 (yytext_ptr) = yy_bp; \
352 yyleng = (int) (yy_cp - yy_bp); \
353 (yy_hold_char) = *yy_cp; \
354 *yy_cp = '\0'; \
355 (yy_c_buf_p) = yy_cp;
356 #define YY_NUM_RULES 7
357 #define YY_END_OF_BUFFER 8
358 /* This struct is not used in this scanner,
359 but its presence is necessary. */
360 struct yy_trans_info
361 {
362 flex_int32_t yy_verify;
363 flex_int32_t yy_nxt;
364 };
365 static const flex_int16_t yy_accept[14] =
366 { 0,
367 0, 0, 8, 7, 6, 3, 2, 7, 5, 1,
368 4, 1, 0
369 } ;
370
371 static const YY_CHAR yy_ec[256] =
372 { 0,
373 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
374 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
375 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
376 1, 2, 1, 4, 1, 1, 1, 1, 1, 1,
377 1, 5, 1, 1, 6, 1, 7, 6, 6, 6,
378 6, 6, 6, 6, 6, 6, 6, 1, 1, 1,
379 8, 1, 1, 1, 9, 9, 9, 9, 9, 9,
380 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
381 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
382 1, 1, 1, 1, 6, 1, 9, 9, 9, 9,
383
384 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
385 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
386 9, 9, 8, 1, 8, 1, 1, 1, 1, 1,
387 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
388 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
389 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
390 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
391 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
392 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
393 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
394
395 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
396 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
397 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
398 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
399 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
400 1, 1, 1, 1, 1
401 } ;
402
403 static const YY_CHAR yy_meta[10] =
404 { 0,
405 1, 1, 1, 1, 1, 2, 1, 1, 2
406 } ;
407
408 static const flex_int16_t yy_base[15] =
409 { 0,
410 0, 0, 12, 13, 13, 13, 13, 6, 13, 0,
411 13, 0, 13, 8
412 } ;
413
414 static const flex_int16_t yy_def[15] =
415 { 0,
416 13, 1, 13, 13, 13, 13, 13, 13, 13, 14,
417 13, 14, 0, 13
418 } ;
419
420 static const flex_int16_t yy_nxt[23] =
421 { 0,
422 4, 5, 6, 7, 4, 4, 8, 9, 10, 12,
423 11, 13, 3, 13, 13, 13, 13, 13, 13, 13,
424 13, 13
425 } ;
426
427 static const flex_int16_t yy_chk[23] =
428 { 0,
429 1, 1, 1, 1, 1, 1, 1, 1, 1, 14,
430 8, 3, 13, 13, 13, 13, 13, 13, 13, 13,
431 13, 13
432 } ;
433
434 static yy_state_type yy_last_accepting_state;
435 static char *yy_last_accepting_cpos;
436
437 extern int yy_flex_debug;
438 int yy_flex_debug = 0;
439
440 /* The intent behind this definition is that it'll catch
441 * any uses of REJECT which flex missed.
442 */
443 #define REJECT reject_used_but_not_detected
444 #define yymore() yymore_used_but_not_detected
445 #define YY_MORE_ADJ 0
446 #define YY_RESTORE_YY_MORE_OFFSET
447 char *yytext;
448 #line 1 "slc-lex.l"
449 #line 2 "slc-lex.l"
450 /*
451 * Copyright (c) 2004 Kungliga Tekniska Högskolan
452 * (Royal Institute of Technology, Stockholm, Sweden).
453 * All rights reserved.
454 *
455 * Redistribution and use in source and binary forms, with or without
456 * modification, are permitted provided that the following conditions
457 * are met:
458 *
459 * 1. Redistributions of source code must retain the above copyright
460 * notice, this list of conditions and the following disclaimer.
461 *
462 * 2. Redistributions in binary form must reproduce the above copyright
463 * notice, this list of conditions and the following disclaimer in the
464 * documentation and/or other materials provided with the distribution.
465 *
466 * 3. Neither the name of the Institute nor the names of its contributors
467 * may be used to endorse or promote products derived from this software
468 * without specific prior written permission.
469 *
470 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
471 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
472 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
473 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
474 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
475 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
476 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
477 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
478 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
479 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
480 * SUCH DAMAGE.
481 */
482
483 /* Id */
484
485 #undef ECHO
486
487 #include <stdio.h>
488 #include <string.h>
489 #include <stdarg.h>
490 #include <stdlib.h>
491 #include "slc.h"
492 #include "slc-gram.h"
493 unsigned lineno = 1;
494
495 static void handle_comment(void);
496 static char * handle_string(void);
497
498 #define YY_NO_UNPUT
499
500 #undef ECHO
501
502 #line 500 "slc-lex.c"
503 #line 501 "slc-lex.c"
504
505 #define INITIAL 0
506
507 #ifndef YY_NO_UNISTD_H
508 /* Special case for "unistd.h", since it is non-ANSI. We include it way
509 * down here because we want the user's section 1 to have been scanned first.
510 * The user has a chance to override it with an option.
511 */
512 #include <unistd.h>
513 #endif
514
515 #ifndef YY_EXTRA_TYPE
516 #define YY_EXTRA_TYPE void *
517 #endif
518
519 static int yy_init_globals ( void );
520
521 /* Accessor methods to globals.
522 These are made visible to non-reentrant scanners for convenience. */
523
524 int yylex_destroy ( void );
525
526 int yyget_debug ( void );
527
528 void yyset_debug ( int debug_flag );
529
530 YY_EXTRA_TYPE yyget_extra ( void );
531
532 void yyset_extra ( YY_EXTRA_TYPE user_defined );
533
534 FILE *yyget_in ( void );
535
536 void yyset_in ( FILE * _in_str );
537
538 FILE *yyget_out ( void );
539
540 void yyset_out ( FILE * _out_str );
541
542 int yyget_leng ( void );
543
544 char *yyget_text ( void );
545
546 int yyget_lineno ( void );
547
548 void yyset_lineno ( int _line_number );
549
550 /* Macros after this point can all be overridden by user definitions in
551 * section 1.
552 */
553
554 #ifndef YY_SKIP_YYWRAP
555 #ifdef __cplusplus
556 extern "C" int yywrap ( void );
557 #else
558 extern int yywrap ( void );
559 #endif
560 #endif
561
562 #ifndef YY_NO_UNPUT
563
564 #endif
565
566 #ifndef yytext_ptr
567 static void yy_flex_strncpy ( char *, const char *, int );
568 #endif
569
570 #ifdef YY_NEED_STRLEN
571 static int yy_flex_strlen ( const char * );
572 #endif
573
574 #ifndef YY_NO_INPUT
575 #ifdef __cplusplus
576 static int yyinput ( void );
577 #else
578 static int input ( void );
579 #endif
580
581 #endif
582
583 /* Amount of stuff to slurp up with each read. */
584 #ifndef YY_READ_BUF_SIZE
585 #ifdef __ia64__
586 /* On IA-64, the buffer size is 16k, not 8k */
587 #define YY_READ_BUF_SIZE 16384
588 #else
589 #define YY_READ_BUF_SIZE 8192
590 #endif /* __ia64__ */
591 #endif
592
593 /* Copy whatever the last rule matched to the standard output. */
594 #ifndef ECHO
595 /* This used to be an fputs(), but since the string might contain NUL's,
596 * we now use fwrite().
597 */
598 #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
599 #endif
600
601 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
602 * is returned in "result".
603 */
604 #ifndef YY_INPUT
605 #define YY_INPUT(buf,result,max_size) \
606 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
607 { \
608 int c = '*'; \
609 int n; \
610 for ( n = 0; n < max_size && \
611 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
612 buf[n] = (char) c; \
613 if ( c == '\n' ) \
614 buf[n++] = (char) c; \
615 if ( c == EOF && ferror( yyin ) ) \
616 YY_FATAL_ERROR( "input in flex scanner failed" ); \
617 result = n; \
618 } \
619 else \
620 { \
621 errno=0; \
622 while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
623 { \
624 if( errno != EINTR) \
625 { \
626 YY_FATAL_ERROR( "input in flex scanner failed" ); \
627 break; \
628 } \
629 errno=0; \
630 clearerr(yyin); \
631 } \
632 }\
633 \
634
635 #endif
636
637 /* No semi-colon after return; correct usage is to write "yyterminate();" -
638 * we don't want an extra ';' after the "return" because that will cause
639 * some compilers to complain about unreachable statements.
640 */
641 #ifndef yyterminate
642 #define yyterminate() return YY_NULL
643 #endif
644
645 /* Number of entries by which start-condition stack grows. */
646 #ifndef YY_START_STACK_INCR
647 #define YY_START_STACK_INCR 25
648 #endif
649
650 /* Report a fatal error. */
651 #ifndef YY_FATAL_ERROR
652 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
653 #endif
654
655 /* end tables serialization structures and prototypes */
656
657 /* Default declaration of generated scanner - a define so the user can
658 * easily add parameters.
659 */
660 #ifndef YY_DECL
661 #define YY_DECL_IS_OURS 1
662
663 extern int yylex (void);
664
665 #define YY_DECL int yylex (void)
666 #endif /* !YY_DECL */
667
668 /* Code executed at the beginning of each rule, after yytext and yyleng
669 * have been set up.
670 */
671 #ifndef YY_USER_ACTION
672 #define YY_USER_ACTION
673 #endif
674
675 /* Code executed at the end of each rule. */
676 #ifndef YY_BREAK
677 #define YY_BREAK /*LINTED*/break;
678 #endif
679
680 #define YY_RULE_SETUP \
681 YY_USER_ACTION
682
683 /** The main scanner function which does all the work.
684 */
685 YY_DECL
686 {
687 yy_state_type yy_current_state;
688 char *yy_cp, *yy_bp;
689 int yy_act;
690
691 if ( !(yy_init) )
692 {
693 (yy_init) = 1;
694
695 #ifdef YY_USER_INIT
696 YY_USER_INIT;
697 #endif
698
699 if ( ! (yy_start) )
700 (yy_start) = 1; /* first start state */
701
702 if ( ! yyin )
703 yyin = stdin;
704
705 if ( ! yyout )
706 yyout = stdout;
707
708 if ( ! YY_CURRENT_BUFFER ) {
709 yyensure_buffer_stack ();
710 YY_CURRENT_BUFFER_LVALUE =
711 yy_create_buffer( yyin, YY_BUF_SIZE );
712 }
713
714 yy_load_buffer_state( );
715 }
716
717 {
718 #line 58 "slc-lex.l"
719
720 #line 718 "slc-lex.c"
721
722 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
723 {
724 yy_cp = (yy_c_buf_p);
725
726 /* Support of yytext. */
727 *yy_cp = (yy_hold_char);
728
729 /* yy_bp points to the position in yy_ch_buf of the start of
730 * the current run.
731 */
732 yy_bp = yy_cp;
733
734 yy_current_state = (yy_start);
735 yy_match:
736 do
737 {
738 YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
739 if ( yy_accept[yy_current_state] )
740 {
741 (yy_last_accepting_state) = yy_current_state;
742 (yy_last_accepting_cpos) = yy_cp;
743 }
744 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
745 {
746 yy_current_state = (int) yy_def[yy_current_state];
747 if ( yy_current_state >= 14 )
748 yy_c = yy_meta[yy_c];
749 }
750 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
751 ++yy_cp;
752 }
753 while ( yy_base[yy_current_state] != 13 );
754
755 yy_find_action:
756 yy_act = yy_accept[yy_current_state];
757 if ( yy_act == 0 )
758 { /* have to back up */
759 yy_cp = (yy_last_accepting_cpos);
760 yy_current_state = (yy_last_accepting_state);
761 yy_act = yy_accept[yy_current_state];
762 }
763
764 YY_DO_BEFORE_ACTION;
765
766 do_action: /* This label is used only to access EOF actions. */
767
768 switch ( yy_act )
769 { /* beginning of action switch */
770 case 0: /* must back up */
771 /* undo the effects of YY_DO_BEFORE_ACTION */
772 *yy_cp = (yy_hold_char);
773 yy_cp = (yy_last_accepting_cpos);
774 yy_current_state = (yy_last_accepting_state);
775 goto yy_find_action;
776
777 case 1:
778 YY_RULE_SETUP
779 #line 59 "slc-lex.l"
780 {
781 yylval.string = strdup ((const char *)yytext);
782 return LITERAL;
783 }
784 YY_BREAK
785 case 2:
786 YY_RULE_SETUP
787 #line 63 "slc-lex.l"
788 { yylval.string = handle_string(); return STRING; }
789 YY_BREAK
790 case 3:
791 /* rule 3 can match eol */
792 YY_RULE_SETUP
793 #line 64 "slc-lex.l"
794 { ++lineno; }
795 YY_BREAK
796 case 4:
797 YY_RULE_SETUP
798 #line 65 "slc-lex.l"
799 { handle_comment(); }
800 YY_BREAK
801 case 5:
802 YY_RULE_SETUP
803 #line 66 "slc-lex.l"
804 { return *yytext; }
805 YY_BREAK
806 case 6:
807 YY_RULE_SETUP
808 #line 67 "slc-lex.l"
809 ;
810 YY_BREAK
811 case 7:
812 YY_RULE_SETUP
813 #line 68 "slc-lex.l"
814 ECHO;
815 YY_BREAK
816 #line 814 "slc-lex.c"
817 case YY_STATE_EOF(INITIAL):
818 yyterminate();
819
820 case YY_END_OF_BUFFER:
821 {
822 /* Amount of text matched not including the EOB char. */
823 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
824
825 /* Undo the effects of YY_DO_BEFORE_ACTION. */
826 *yy_cp = (yy_hold_char);
827 YY_RESTORE_YY_MORE_OFFSET
828
829 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
830 {
831 /* We're scanning a new file or input source. It's
832 * possible that this happened because the user
833 * just pointed yyin at a new source and called
834 * yylex(). If so, then we have to assure
835 * consistency between YY_CURRENT_BUFFER and our
836 * globals. Here is the right place to do so, because
837 * this is the first action (other than possibly a
838 * back-up) that will match for the new input source.
839 */
840 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
841 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
842 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
843 }
844
845 /* Note that here we test for yy_c_buf_p "<=" to the position
846 * of the first EOB in the buffer, since yy_c_buf_p will
847 * already have been incremented past the NUL character
848 * (since all states make transitions on EOB to the
849 * end-of-buffer state). Contrast this with the test
850 * in input().
851 */
852 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
853 { /* This was really a NUL. */
854 yy_state_type yy_next_state;
855
856 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
857
858 yy_current_state = yy_get_previous_state( );
859
860 /* Okay, we're now positioned to make the NUL
861 * transition. We couldn't have
862 * yy_get_previous_state() go ahead and do it
863 * for us because it doesn't know how to deal
864 * with the possibility of jamming (and we don't
865 * want to build jamming into it because then it
866 * will run more slowly).
867 */
868
869 yy_next_state = yy_try_NUL_trans( yy_current_state );
870
871 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
872
873 if ( yy_next_state )
874 {
875 /* Consume the NUL. */
876 yy_cp = ++(yy_c_buf_p);
877 yy_current_state = yy_next_state;
878 goto yy_match;
879 }
880
881 else
882 {
883 yy_cp = (yy_c_buf_p);
884 goto yy_find_action;
885 }
886 }
887
888 else switch ( yy_get_next_buffer( ) )
889 {
890 case EOB_ACT_END_OF_FILE:
891 {
892 (yy_did_buffer_switch_on_eof) = 0;
893
894 if ( yywrap( ) )
895 {
896 /* Note: because we've taken care in
897 * yy_get_next_buffer() to have set up
898 * yytext, we can now set up
899 * yy_c_buf_p so that if some total
900 * hoser (like flex itself) wants to
901 * call the scanner after we return the
902 * YY_NULL, it'll still work - another
903 * YY_NULL will get returned.
904 */
905 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
906
907 yy_act = YY_STATE_EOF(YY_START);
908 goto do_action;
909 }
910
911 else
912 {
913 if ( ! (yy_did_buffer_switch_on_eof) )
914 YY_NEW_FILE;
915 }
916 break;
917 }
918
919 case EOB_ACT_CONTINUE_SCAN:
920 (yy_c_buf_p) =
921 (yytext_ptr) + yy_amount_of_matched_text;
922
923 yy_current_state = yy_get_previous_state( );
924
925 yy_cp = (yy_c_buf_p);
926 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
927 goto yy_match;
928
929 case EOB_ACT_LAST_MATCH:
930 (yy_c_buf_p) =
931 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
932
933 yy_current_state = yy_get_previous_state( );
934
935 yy_cp = (yy_c_buf_p);
936 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
937 goto yy_find_action;
938 }
939 break;
940 }
941
942 default:
943 YY_FATAL_ERROR(
944 "fatal flex scanner internal error--no action found" );
945 } /* end of action switch */
946 } /* end of scanning one token */
947 } /* end of user's declarations */
948 } /* end of yylex */
949
950 /* yy_get_next_buffer - try to read in a new buffer
951 *
952 * Returns a code representing an action:
953 * EOB_ACT_LAST_MATCH -
954 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
955 * EOB_ACT_END_OF_FILE - end of file
956 */
yy_get_next_buffer(void)957 static int yy_get_next_buffer (void)
958 {
959 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
960 char *source = (yytext_ptr);
961 int number_to_move, i;
962 int ret_val;
963
964 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
965 YY_FATAL_ERROR(
966 "fatal flex scanner internal error--end of buffer missed" );
967
968 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
969 { /* Don't try to fill the buffer, so this is an EOF. */
970 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
971 {
972 /* We matched a single character, the EOB, so
973 * treat this as a final EOF.
974 */
975 return EOB_ACT_END_OF_FILE;
976 }
977
978 else
979 {
980 /* We matched some text prior to the EOB, first
981 * process it.
982 */
983 return EOB_ACT_LAST_MATCH;
984 }
985 }
986
987 /* Try to read more data. */
988
989 /* First move last chars to start of buffer. */
990 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1);
991
992 for ( i = 0; i < number_to_move; ++i )
993 *(dest++) = *(source++);
994
995 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
996 /* don't do the read, it's not guaranteed to return an EOF,
997 * just force an EOF
998 */
999 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1000
1001 else
1002 {
1003 int num_to_read =
1004 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1005
1006 while ( num_to_read <= 0 )
1007 { /* Not enough room in the buffer - grow it. */
1008
1009 /* just a shorter name for the current buffer */
1010 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1011
1012 int yy_c_buf_p_offset =
1013 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1014
1015 if ( b->yy_is_our_buffer )
1016 {
1017 int new_size = b->yy_buf_size * 2;
1018
1019 if ( new_size <= 0 )
1020 b->yy_buf_size += b->yy_buf_size / 8;
1021 else
1022 b->yy_buf_size *= 2;
1023
1024 b->yy_ch_buf = (char *)
1025 /* Include room in for 2 EOB chars. */
1026 yyrealloc( (void *) b->yy_ch_buf,
1027 (yy_size_t) (b->yy_buf_size + 2) );
1028 }
1029 else
1030 /* Can't grow it, we don't own it. */
1031 b->yy_ch_buf = NULL;
1032
1033 if ( ! b->yy_ch_buf )
1034 YY_FATAL_ERROR(
1035 "fatal error - scanner input buffer overflow" );
1036
1037 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1038
1039 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1040 number_to_move - 1;
1041
1042 }
1043
1044 if ( num_to_read > YY_READ_BUF_SIZE )
1045 num_to_read = YY_READ_BUF_SIZE;
1046
1047 /* Read in more data. */
1048 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1049 (yy_n_chars), num_to_read );
1050
1051 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1052 }
1053
1054 if ( (yy_n_chars) == 0 )
1055 {
1056 if ( number_to_move == YY_MORE_ADJ )
1057 {
1058 ret_val = EOB_ACT_END_OF_FILE;
1059 yyrestart( yyin );
1060 }
1061
1062 else
1063 {
1064 ret_val = EOB_ACT_LAST_MATCH;
1065 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1066 YY_BUFFER_EOF_PENDING;
1067 }
1068 }
1069
1070 else
1071 ret_val = EOB_ACT_CONTINUE_SCAN;
1072
1073 if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1074 /* Extend the array by 50%, plus the number we really need. */
1075 int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1076 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1077 (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size );
1078 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1079 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1080 /* "- 2" to take care of EOB's */
1081 YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
1082 }
1083
1084 (yy_n_chars) += number_to_move;
1085 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1086 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1087
1088 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1089
1090 return ret_val;
1091 }
1092
1093 /* yy_get_previous_state - get the state just before the EOB char was reached */
1094
yy_get_previous_state(void)1095 static yy_state_type yy_get_previous_state (void)
1096 {
1097 yy_state_type yy_current_state;
1098 char *yy_cp;
1099
1100 yy_current_state = (yy_start);
1101
1102 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1103 {
1104 YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1105 if ( yy_accept[yy_current_state] )
1106 {
1107 (yy_last_accepting_state) = yy_current_state;
1108 (yy_last_accepting_cpos) = yy_cp;
1109 }
1110 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1111 {
1112 yy_current_state = (int) yy_def[yy_current_state];
1113 if ( yy_current_state >= 14 )
1114 yy_c = yy_meta[yy_c];
1115 }
1116 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1117 }
1118
1119 return yy_current_state;
1120 }
1121
1122 /* yy_try_NUL_trans - try to make a transition on the NUL character
1123 *
1124 * synopsis
1125 * next_state = yy_try_NUL_trans( current_state );
1126 */
yy_try_NUL_trans(yy_state_type yy_current_state)1127 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1128 {
1129 int yy_is_jam;
1130 char *yy_cp = (yy_c_buf_p);
1131
1132 YY_CHAR yy_c = 1;
1133 if ( yy_accept[yy_current_state] )
1134 {
1135 (yy_last_accepting_state) = yy_current_state;
1136 (yy_last_accepting_cpos) = yy_cp;
1137 }
1138 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1139 {
1140 yy_current_state = (int) yy_def[yy_current_state];
1141 if ( yy_current_state >= 14 )
1142 yy_c = yy_meta[yy_c];
1143 }
1144 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1145 yy_is_jam = (yy_current_state == 13);
1146
1147 return yy_is_jam ? 0 : yy_current_state;
1148 }
1149
1150 #ifndef YY_NO_UNPUT
1151
1152 #endif
1153
1154 #ifndef YY_NO_INPUT
1155 #ifdef __cplusplus
yyinput(void)1156 static int yyinput (void)
1157 #else
1158 static int input (void)
1159 #endif
1160
1161 {
1162 int c;
1163
1164 *(yy_c_buf_p) = (yy_hold_char);
1165
1166 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1167 {
1168 /* yy_c_buf_p now points to the character we want to return.
1169 * If this occurs *before* the EOB characters, then it's a
1170 * valid NUL; if not, then we've hit the end of the buffer.
1171 */
1172 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1173 /* This was really a NUL. */
1174 *(yy_c_buf_p) = '\0';
1175
1176 else
1177 { /* need more input */
1178 int offset = (int) ((yy_c_buf_p) - (yytext_ptr));
1179 ++(yy_c_buf_p);
1180
1181 switch ( yy_get_next_buffer( ) )
1182 {
1183 case EOB_ACT_LAST_MATCH:
1184 /* This happens because yy_g_n_b()
1185 * sees that we've accumulated a
1186 * token and flags that we need to
1187 * try matching the token before
1188 * proceeding. But for input(),
1189 * there's no matching to consider.
1190 * So convert the EOB_ACT_LAST_MATCH
1191 * to EOB_ACT_END_OF_FILE.
1192 */
1193
1194 /* Reset buffer status. */
1195 yyrestart( yyin );
1196
1197 /*FALLTHROUGH*/
1198
1199 case EOB_ACT_END_OF_FILE:
1200 {
1201 if ( yywrap( ) )
1202 return 0;
1203
1204 if ( ! (yy_did_buffer_switch_on_eof) )
1205 YY_NEW_FILE;
1206 #ifdef __cplusplus
1207 return yyinput();
1208 #else
1209 return input();
1210 #endif
1211 }
1212
1213 case EOB_ACT_CONTINUE_SCAN:
1214 (yy_c_buf_p) = (yytext_ptr) + offset;
1215 break;
1216 }
1217 }
1218 }
1219
1220 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1221 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1222 (yy_hold_char) = *++(yy_c_buf_p);
1223
1224 return c;
1225 }
1226 #endif /* ifndef YY_NO_INPUT */
1227
1228 /** Immediately switch to a different input stream.
1229 * @param input_file A readable stream.
1230 *
1231 * @note This function does not reset the start condition to @c INITIAL .
1232 */
yyrestart(FILE * input_file)1233 void yyrestart (FILE * input_file )
1234 {
1235
1236 if ( ! YY_CURRENT_BUFFER ){
1237 yyensure_buffer_stack ();
1238 YY_CURRENT_BUFFER_LVALUE =
1239 yy_create_buffer( yyin, YY_BUF_SIZE );
1240 }
1241
1242 yy_init_buffer( YY_CURRENT_BUFFER, input_file );
1243 yy_load_buffer_state( );
1244 }
1245
1246 /** Switch to a different input buffer.
1247 * @param new_buffer The new input buffer.
1248 *
1249 */
yy_switch_to_buffer(YY_BUFFER_STATE new_buffer)1250 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1251 {
1252
1253 /* TODO. We should be able to replace this entire function body
1254 * with
1255 * yypop_buffer_state();
1256 * yypush_buffer_state(new_buffer);
1257 */
1258 yyensure_buffer_stack ();
1259 if ( YY_CURRENT_BUFFER == new_buffer )
1260 return;
1261
1262 if ( YY_CURRENT_BUFFER )
1263 {
1264 /* Flush out information for old buffer. */
1265 *(yy_c_buf_p) = (yy_hold_char);
1266 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1267 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1268 }
1269
1270 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1271 yy_load_buffer_state( );
1272
1273 /* We don't actually know whether we did this switch during
1274 * EOF (yywrap()) processing, but the only time this flag
1275 * is looked at is after yywrap() is called, so it's safe
1276 * to go ahead and always set it.
1277 */
1278 (yy_did_buffer_switch_on_eof) = 1;
1279 }
1280
yy_load_buffer_state(void)1281 static void yy_load_buffer_state (void)
1282 {
1283 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1284 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1285 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1286 (yy_hold_char) = *(yy_c_buf_p);
1287 }
1288
1289 /** Allocate and initialize an input buffer state.
1290 * @param file A readable stream.
1291 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1292 *
1293 * @return the allocated buffer state.
1294 */
yy_create_buffer(FILE * file,int size)1295 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1296 {
1297 YY_BUFFER_STATE b;
1298
1299 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
1300 if ( ! b )
1301 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1302
1303 b->yy_buf_size = size;
1304
1305 /* yy_ch_buf has to be 2 characters longer than the size given because
1306 * we need to put in 2 end-of-buffer characters.
1307 */
1308 b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) );
1309 if ( ! b->yy_ch_buf )
1310 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1311
1312 b->yy_is_our_buffer = 1;
1313
1314 yy_init_buffer( b, file );
1315
1316 return b;
1317 }
1318
1319 /** Destroy the buffer.
1320 * @param b a buffer created with yy_create_buffer()
1321 *
1322 */
yy_delete_buffer(YY_BUFFER_STATE b)1323 void yy_delete_buffer (YY_BUFFER_STATE b )
1324 {
1325
1326 if ( ! b )
1327 return;
1328
1329 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1330 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1331
1332 if ( b->yy_is_our_buffer )
1333 yyfree( (void *) b->yy_ch_buf );
1334
1335 yyfree( (void *) b );
1336 }
1337
1338 /* Initializes or reinitializes a buffer.
1339 * This function is sometimes called more than once on the same buffer,
1340 * such as during a yyrestart() or at EOF.
1341 */
yy_init_buffer(YY_BUFFER_STATE b,FILE * file)1342 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1343
1344 {
1345 int oerrno = errno;
1346
1347 yy_flush_buffer( b );
1348
1349 b->yy_input_file = file;
1350 b->yy_fill_buffer = 1;
1351
1352 /* If b is the current buffer, then yy_init_buffer was _probably_
1353 * called from yyrestart() or through yy_get_next_buffer.
1354 * In that case, we don't want to reset the lineno or column.
1355 */
1356 if (b != YY_CURRENT_BUFFER){
1357 b->yy_bs_lineno = 1;
1358 b->yy_bs_column = 0;
1359 }
1360
1361 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1362
1363 errno = oerrno;
1364 }
1365
1366 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1367 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1368 *
1369 */
yy_flush_buffer(YY_BUFFER_STATE b)1370 void yy_flush_buffer (YY_BUFFER_STATE b )
1371 {
1372 if ( ! b )
1373 return;
1374
1375 b->yy_n_chars = 0;
1376
1377 /* We always need two end-of-buffer characters. The first causes
1378 * a transition to the end-of-buffer state. The second causes
1379 * a jam in that state.
1380 */
1381 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1382 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1383
1384 b->yy_buf_pos = &b->yy_ch_buf[0];
1385
1386 b->yy_at_bol = 1;
1387 b->yy_buffer_status = YY_BUFFER_NEW;
1388
1389 if ( b == YY_CURRENT_BUFFER )
1390 yy_load_buffer_state( );
1391 }
1392
1393 /** Pushes the new state onto the stack. The new state becomes
1394 * the current state. This function will allocate the stack
1395 * if necessary.
1396 * @param new_buffer The new state.
1397 *
1398 */
yypush_buffer_state(YY_BUFFER_STATE new_buffer)1399 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1400 {
1401 if (new_buffer == NULL)
1402 return;
1403
1404 yyensure_buffer_stack();
1405
1406 /* This block is copied from yy_switch_to_buffer. */
1407 if ( YY_CURRENT_BUFFER )
1408 {
1409 /* Flush out information for old buffer. */
1410 *(yy_c_buf_p) = (yy_hold_char);
1411 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1412 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1413 }
1414
1415 /* Only push if top exists. Otherwise, replace top. */
1416 if (YY_CURRENT_BUFFER)
1417 (yy_buffer_stack_top)++;
1418 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1419
1420 /* copied from yy_switch_to_buffer. */
1421 yy_load_buffer_state( );
1422 (yy_did_buffer_switch_on_eof) = 1;
1423 }
1424
1425 /** Removes and deletes the top of the stack, if present.
1426 * The next element becomes the new top.
1427 *
1428 */
yypop_buffer_state(void)1429 void yypop_buffer_state (void)
1430 {
1431 if (!YY_CURRENT_BUFFER)
1432 return;
1433
1434 yy_delete_buffer(YY_CURRENT_BUFFER );
1435 YY_CURRENT_BUFFER_LVALUE = NULL;
1436 if ((yy_buffer_stack_top) > 0)
1437 --(yy_buffer_stack_top);
1438
1439 if (YY_CURRENT_BUFFER) {
1440 yy_load_buffer_state( );
1441 (yy_did_buffer_switch_on_eof) = 1;
1442 }
1443 }
1444
1445 /* Allocates the stack if it does not exist.
1446 * Guarantees space for at least one push.
1447 */
yyensure_buffer_stack(void)1448 static void yyensure_buffer_stack (void)
1449 {
1450 yy_size_t num_to_alloc;
1451
1452 if (!(yy_buffer_stack)) {
1453
1454 /* First allocation is just for 2 elements, since we don't know if this
1455 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1456 * immediate realloc on the next call.
1457 */
1458 num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
1459 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1460 (num_to_alloc * sizeof(struct yy_buffer_state*)
1461 );
1462 if ( ! (yy_buffer_stack) )
1463 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1464
1465 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1466
1467 (yy_buffer_stack_max) = num_to_alloc;
1468 (yy_buffer_stack_top) = 0;
1469 return;
1470 }
1471
1472 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1473
1474 /* Increase the buffer to prepare for a possible push. */
1475 yy_size_t grow_size = 8 /* arbitrary grow size */;
1476
1477 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1478 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1479 ((yy_buffer_stack),
1480 num_to_alloc * sizeof(struct yy_buffer_state*)
1481 );
1482 if ( ! (yy_buffer_stack) )
1483 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1484
1485 /* zero only the new slots.*/
1486 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1487 (yy_buffer_stack_max) = num_to_alloc;
1488 }
1489 }
1490
1491 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1492 * @param base the character buffer
1493 * @param size the size in bytes of the character buffer
1494 *
1495 * @return the newly allocated buffer state object.
1496 */
yy_scan_buffer(char * base,yy_size_t size)1497 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1498 {
1499 YY_BUFFER_STATE b;
1500
1501 if ( size < 2 ||
1502 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1503 base[size-1] != YY_END_OF_BUFFER_CHAR )
1504 /* They forgot to leave room for the EOB's. */
1505 return NULL;
1506
1507 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
1508 if ( ! b )
1509 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1510
1511 b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
1512 b->yy_buf_pos = b->yy_ch_buf = base;
1513 b->yy_is_our_buffer = 0;
1514 b->yy_input_file = NULL;
1515 b->yy_n_chars = b->yy_buf_size;
1516 b->yy_is_interactive = 0;
1517 b->yy_at_bol = 1;
1518 b->yy_fill_buffer = 0;
1519 b->yy_buffer_status = YY_BUFFER_NEW;
1520
1521 yy_switch_to_buffer( b );
1522
1523 return b;
1524 }
1525
1526 /** Setup the input buffer state to scan a string. The next call to yylex() will
1527 * scan from a @e copy of @a str.
1528 * @param yystr a NUL-terminated string to scan
1529 *
1530 * @return the newly allocated buffer state object.
1531 * @note If you want to scan bytes that may contain NUL values, then use
1532 * yy_scan_bytes() instead.
1533 */
yy_scan_string(const char * yystr)1534 YY_BUFFER_STATE yy_scan_string (const char * yystr )
1535 {
1536
1537 return yy_scan_bytes( yystr, (int) strlen(yystr) );
1538 }
1539
1540 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1541 * scan from a @e copy of @a bytes.
1542 * @param yybytes the byte buffer to scan
1543 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1544 *
1545 * @return the newly allocated buffer state object.
1546 */
yy_scan_bytes(const char * yybytes,int _yybytes_len)1547 YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len )
1548 {
1549 YY_BUFFER_STATE b;
1550 char *buf;
1551 yy_size_t n;
1552 int i;
1553
1554 /* Get memory for full buffer, including space for trailing EOB's. */
1555 n = (yy_size_t) (_yybytes_len + 2);
1556 buf = (char *) yyalloc( n );
1557 if ( ! buf )
1558 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1559
1560 for ( i = 0; i < _yybytes_len; ++i )
1561 buf[i] = yybytes[i];
1562
1563 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1564
1565 b = yy_scan_buffer( buf, n );
1566 if ( ! b )
1567 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1568
1569 /* It's okay to grow etc. this buffer, and we should throw it
1570 * away when we're done.
1571 */
1572 b->yy_is_our_buffer = 1;
1573
1574 return b;
1575 }
1576
1577 #ifndef YY_EXIT_FAILURE
1578 #define YY_EXIT_FAILURE 2
1579 #endif
1580
yy_fatal_error(const char * msg)1581 static void yynoreturn yy_fatal_error (const char* msg )
1582 {
1583 fprintf( stderr, "%s\n", msg );
1584 exit( YY_EXIT_FAILURE );
1585 }
1586
1587 /* Redefine yyless() so it works in section 3 code. */
1588
1589 #undef yyless
1590 #define yyless(n) \
1591 do \
1592 { \
1593 /* Undo effects of setting up yytext. */ \
1594 int yyless_macro_arg = (n); \
1595 YY_LESS_LINENO(yyless_macro_arg);\
1596 yytext[yyleng] = (yy_hold_char); \
1597 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1598 (yy_hold_char) = *(yy_c_buf_p); \
1599 *(yy_c_buf_p) = '\0'; \
1600 yyleng = yyless_macro_arg; \
1601 } \
1602 while ( 0 )
1603
1604 /* Accessor methods (get/set functions) to struct members. */
1605
1606 /** Get the current line number.
1607 *
1608 */
yyget_lineno(void)1609 int yyget_lineno (void)
1610 {
1611
1612 return yylineno;
1613 }
1614
1615 /** Get the input stream.
1616 *
1617 */
yyget_in(void)1618 FILE *yyget_in (void)
1619 {
1620 return yyin;
1621 }
1622
1623 /** Get the output stream.
1624 *
1625 */
yyget_out(void)1626 FILE *yyget_out (void)
1627 {
1628 return yyout;
1629 }
1630
1631 /** Get the length of the current token.
1632 *
1633 */
yyget_leng(void)1634 int yyget_leng (void)
1635 {
1636 return yyleng;
1637 }
1638
1639 /** Get the current token.
1640 *
1641 */
1642
yyget_text(void)1643 char *yyget_text (void)
1644 {
1645 return yytext;
1646 }
1647
1648 /** Set the current line number.
1649 * @param _line_number line number
1650 *
1651 */
yyset_lineno(int _line_number)1652 void yyset_lineno (int _line_number )
1653 {
1654
1655 yylineno = _line_number;
1656 }
1657
1658 /** Set the input stream. This does not discard the current
1659 * input buffer.
1660 * @param _in_str A readable stream.
1661 *
1662 * @see yy_switch_to_buffer
1663 */
yyset_in(FILE * _in_str)1664 void yyset_in (FILE * _in_str )
1665 {
1666 yyin = _in_str ;
1667 }
1668
yyset_out(FILE * _out_str)1669 void yyset_out (FILE * _out_str )
1670 {
1671 yyout = _out_str ;
1672 }
1673
yyget_debug(void)1674 int yyget_debug (void)
1675 {
1676 return yy_flex_debug;
1677 }
1678
yyset_debug(int _bdebug)1679 void yyset_debug (int _bdebug )
1680 {
1681 yy_flex_debug = _bdebug ;
1682 }
1683
yy_init_globals(void)1684 static int yy_init_globals (void)
1685 {
1686 /* Initialization is the same as for the non-reentrant scanner.
1687 * This function is called from yylex_destroy(), so don't allocate here.
1688 */
1689
1690 (yy_buffer_stack) = NULL;
1691 (yy_buffer_stack_top) = 0;
1692 (yy_buffer_stack_max) = 0;
1693 (yy_c_buf_p) = NULL;
1694 (yy_init) = 0;
1695 (yy_start) = 0;
1696
1697 /* Defined in main.c */
1698 #ifdef YY_STDINIT
1699 yyin = stdin;
1700 yyout = stdout;
1701 #else
1702 yyin = NULL;
1703 yyout = NULL;
1704 #endif
1705
1706 /* For future reference: Set errno on error, since we are called by
1707 * yylex_init()
1708 */
1709 return 0;
1710 }
1711
1712 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
yylex_destroy(void)1713 int yylex_destroy (void)
1714 {
1715
1716 /* Pop the buffer stack, destroying each element. */
1717 while(YY_CURRENT_BUFFER){
1718 yy_delete_buffer( YY_CURRENT_BUFFER );
1719 YY_CURRENT_BUFFER_LVALUE = NULL;
1720 yypop_buffer_state();
1721 }
1722
1723 /* Destroy the stack itself. */
1724 yyfree((yy_buffer_stack) );
1725 (yy_buffer_stack) = NULL;
1726
1727 /* Reset the globals. This is important in a non-reentrant scanner so the next time
1728 * yylex() is called, initialization will occur. */
1729 yy_init_globals( );
1730
1731 return 0;
1732 }
1733
1734 /*
1735 * Internal utility routines.
1736 */
1737
1738 #ifndef yytext_ptr
yy_flex_strncpy(char * s1,const char * s2,int n)1739 static void yy_flex_strncpy (char* s1, const char * s2, int n )
1740 {
1741
1742 int i;
1743 for ( i = 0; i < n; ++i )
1744 s1[i] = s2[i];
1745 }
1746 #endif
1747
1748 #ifdef YY_NEED_STRLEN
yy_flex_strlen(const char * s)1749 static int yy_flex_strlen (const char * s )
1750 {
1751 int n;
1752 for ( n = 0; s[n]; ++n )
1753 ;
1754
1755 return n;
1756 }
1757 #endif
1758
yyalloc(yy_size_t size)1759 void *yyalloc (yy_size_t size )
1760 {
1761 return malloc(size);
1762 }
1763
yyrealloc(void * ptr,yy_size_t size)1764 void *yyrealloc (void * ptr, yy_size_t size )
1765 {
1766
1767 /* The cast to (char *) in the following accommodates both
1768 * implementations that use char* generic pointers, and those
1769 * that use void* generic pointers. It works with the latter
1770 * because both ANSI C and C++ allow castless assignment from
1771 * any pointer type to void*, and deal with argument conversions
1772 * as though doing an assignment.
1773 */
1774 return realloc(ptr, size);
1775 }
1776
yyfree(void * ptr)1777 void yyfree (void * ptr )
1778 {
1779 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
1780 }
1781
1782 #define YYTABLES_NAME "yytables"
1783
1784 #line 68 "slc-lex.l"
1785
1786
1787 void
error_message(const char * format,...)1788 error_message (const char *format, ...)
1789 {
1790 va_list args;
1791
1792 va_start (args, format);
1793 fprintf (stderr, "%s:%d: ", filename, lineno);
1794 vfprintf (stderr, format, args);
1795 va_end (args);
1796 error_flag++;
1797 }
1798
1799 void
yyerror(char * s)1800 yyerror (char *s)
1801 {
1802 error_message("%s\n", s);
1803 }
1804
1805 static void
handle_comment(void)1806 handle_comment(void)
1807 {
1808 int c;
1809 int start_lineno = lineno;
1810 int level = 1;
1811 int seen_star = 0;
1812 int seen_slash = 0;
1813 while((c = input()) != EOF) {
1814 if(c == '/') {
1815 if(seen_star) {
1816 if(--level == 0)
1817 return;
1818 seen_star = 0;
1819 continue;
1820 }
1821 seen_slash = 1;
1822 continue;
1823 } else if(c == '*') {
1824 if(seen_slash) {
1825 level++;
1826 seen_star = seen_slash = 0;
1827 continue;
1828 }
1829 seen_star = 1;
1830 continue;
1831 }
1832 seen_star = seen_slash = 0;
1833 if(c == '\n') {
1834 lineno++;
1835 continue;
1836 }
1837 }
1838 if(c == EOF)
1839 error_message("unterminated comment, possibly started on line %d\n", start_lineno);
1840 }
1841
1842 static char *
handle_string(void)1843 handle_string(void)
1844 {
1845 char x[1024];
1846 int i = 0;
1847 int c;
1848 int quote = 0;
1849 while((c = input()) != EOF){
1850 if(quote) {
1851 x[i++] = '\\';
1852 x[i++] = c;
1853 quote = 0;
1854 continue;
1855 }
1856 if(c == '\n'){
1857 error_message("unterminated string");
1858 lineno++;
1859 break;
1860 }
1861 if(c == '\\'){
1862 quote++;
1863 continue;
1864 }
1865 if(c == '\"')
1866 break;
1867 x[i++] = c;
1868 }
1869 x[i] = '\0';
1870 return strdup(x);
1871 }
1872
1873 int
yywrap()1874 yywrap ()
1875 {
1876 return 1;
1877 }
1878
1879