source: heimdal/trunk/lib/sl/slc-lex.c@ 3

Last change on this file since 3 was 1, checked in by Paul Smedley, 10 years ago

Initial commit of Heimdal 1.5.3

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