1178825Sdfr 2178825Sdfr#line 3 "slc-lex.c" 3178825Sdfr 4178825Sdfr#define YY_INT_ALIGNED short int 5178825Sdfr 6178825Sdfr/* A lexical scanner generated by flex */ 7178825Sdfr 8178825Sdfr#define FLEX_SCANNER 9178825Sdfr#define YY_FLEX_MAJOR_VERSION 2 10178825Sdfr#define YY_FLEX_MINOR_VERSION 5 11233294Sstas#define YY_FLEX_SUBMINOR_VERSION 35 12178825Sdfr#if YY_FLEX_SUBMINOR_VERSION > 0 13178825Sdfr#define FLEX_BETA 14178825Sdfr#endif 15178825Sdfr 16178825Sdfr/* First, we deal with platform-specific or compiler-specific issues. */ 17178825Sdfr 18178825Sdfr/* begin standard C headers. */ 19178825Sdfr#include <stdio.h> 20178825Sdfr#include <string.h> 21178825Sdfr#include <errno.h> 22178825Sdfr#include <stdlib.h> 23178825Sdfr 24178825Sdfr/* end standard C headers. */ 25178825Sdfr 26178825Sdfr/* flex integer type definitions */ 27178825Sdfr 28178825Sdfr#ifndef FLEXINT_H 29178825Sdfr#define FLEXINT_H 30178825Sdfr 31178825Sdfr/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ 32178825Sdfr 33233294Sstas#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 34178825Sdfr 35178825Sdfr/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, 36178825Sdfr * if you want the limit (max/min) macros for int types. 37178825Sdfr */ 38178825Sdfr#ifndef __STDC_LIMIT_MACROS 39178825Sdfr#define __STDC_LIMIT_MACROS 1 40178825Sdfr#endif 41178825Sdfr 42178825Sdfr#include <inttypes.h> 43178825Sdfrtypedef int8_t flex_int8_t; 44178825Sdfrtypedef uint8_t flex_uint8_t; 45178825Sdfrtypedef int16_t flex_int16_t; 46178825Sdfrtypedef uint16_t flex_uint16_t; 47178825Sdfrtypedef int32_t flex_int32_t; 48178825Sdfrtypedef uint32_t flex_uint32_t; 49178825Sdfr#else 50178825Sdfrtypedef signed char flex_int8_t; 51178825Sdfrtypedef short int flex_int16_t; 52178825Sdfrtypedef int flex_int32_t; 53178825Sdfrtypedef unsigned char flex_uint8_t; 54178825Sdfrtypedef unsigned short int flex_uint16_t; 55178825Sdfrtypedef unsigned int flex_uint32_t; 56178825Sdfr#endif /* ! C99 */ 57178825Sdfr 58178825Sdfr/* Limits of integral types. */ 59178825Sdfr#ifndef INT8_MIN 60178825Sdfr#define INT8_MIN (-128) 61178825Sdfr#endif 62178825Sdfr#ifndef INT16_MIN 63178825Sdfr#define INT16_MIN (-32767-1) 64178825Sdfr#endif 65178825Sdfr#ifndef INT32_MIN 66178825Sdfr#define INT32_MIN (-2147483647-1) 67178825Sdfr#endif 68178825Sdfr#ifndef INT8_MAX 69178825Sdfr#define INT8_MAX (127) 70178825Sdfr#endif 71178825Sdfr#ifndef INT16_MAX 72178825Sdfr#define INT16_MAX (32767) 73178825Sdfr#endif 74178825Sdfr#ifndef INT32_MAX 75178825Sdfr#define INT32_MAX (2147483647) 76178825Sdfr#endif 77178825Sdfr#ifndef UINT8_MAX 78178825Sdfr#define UINT8_MAX (255U) 79178825Sdfr#endif 80178825Sdfr#ifndef UINT16_MAX 81178825Sdfr#define UINT16_MAX (65535U) 82178825Sdfr#endif 83178825Sdfr#ifndef UINT32_MAX 84178825Sdfr#define UINT32_MAX (4294967295U) 85178825Sdfr#endif 86178825Sdfr 87178825Sdfr#endif /* ! FLEXINT_H */ 88178825Sdfr 89178825Sdfr#ifdef __cplusplus 90178825Sdfr 91178825Sdfr/* The "const" storage-class-modifier is valid. */ 92178825Sdfr#define YY_USE_CONST 93178825Sdfr 94178825Sdfr#else /* ! __cplusplus */ 95178825Sdfr 96233294Sstas/* C99 requires __STDC__ to be defined as 1. */ 97233294Sstas#if defined (__STDC__) 98178825Sdfr 99178825Sdfr#define YY_USE_CONST 100178825Sdfr 101233294Sstas#endif /* defined (__STDC__) */ 102178825Sdfr#endif /* ! __cplusplus */ 103178825Sdfr 104178825Sdfr#ifdef YY_USE_CONST 105178825Sdfr#define yyconst const 106178825Sdfr#else 107178825Sdfr#define yyconst 108178825Sdfr#endif 109178825Sdfr 110178825Sdfr/* Returned upon end-of-file. */ 111178825Sdfr#define YY_NULL 0 112178825Sdfr 113178825Sdfr/* Promotes a possibly negative, possibly signed char to an unsigned 114178825Sdfr * integer for use as an array index. If the signed char is negative, 115178825Sdfr * we want to instead treat it as an 8-bit unsigned char, hence the 116178825Sdfr * double cast. 117178825Sdfr */ 118178825Sdfr#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) 119178825Sdfr 120178825Sdfr/* Enter a start condition. This macro really ought to take a parameter, 121178825Sdfr * but we do it the disgusting crufty way forced on us by the ()-less 122178825Sdfr * definition of BEGIN. 123178825Sdfr */ 124178825Sdfr#define BEGIN (yy_start) = 1 + 2 * 125178825Sdfr 126178825Sdfr/* Translate the current start state into a value that can be later handed 127178825Sdfr * to BEGIN to return to the state. The YYSTATE alias is for lex 128178825Sdfr * compatibility. 129178825Sdfr */ 130178825Sdfr#define YY_START (((yy_start) - 1) / 2) 131178825Sdfr#define YYSTATE YY_START 132178825Sdfr 133178825Sdfr/* Action number for EOF rule of a given start state. */ 134178825Sdfr#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) 135178825Sdfr 136178825Sdfr/* Special action meaning "start processing a new file". */ 137178825Sdfr#define YY_NEW_FILE yyrestart(yyin ) 138178825Sdfr 139178825Sdfr#define YY_END_OF_BUFFER_CHAR 0 140178825Sdfr 141178825Sdfr/* Size of default input buffer. */ 142178825Sdfr#ifndef YY_BUF_SIZE 143178825Sdfr#define YY_BUF_SIZE 16384 144178825Sdfr#endif 145178825Sdfr 146178825Sdfr/* The state buf must be large enough to hold one state per character in the main buffer. 147178825Sdfr */ 148178825Sdfr#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) 149178825Sdfr 150178825Sdfr#ifndef YY_TYPEDEF_YY_BUFFER_STATE 151178825Sdfr#define YY_TYPEDEF_YY_BUFFER_STATE 152178825Sdfrtypedef struct yy_buffer_state *YY_BUFFER_STATE; 153178825Sdfr#endif 154178825Sdfr 155233294Sstas#ifndef YY_TYPEDEF_YY_SIZE_T 156233294Sstas#define YY_TYPEDEF_YY_SIZE_T 157233294Sstastypedef size_t yy_size_t; 158233294Sstas#endif 159178825Sdfr 160233294Sstasextern yy_size_t yyleng; 161233294Sstas 162178825Sdfrextern FILE *yyin, *yyout; 163178825Sdfr 164178825Sdfr#define EOB_ACT_CONTINUE_SCAN 0 165178825Sdfr#define EOB_ACT_END_OF_FILE 1 166178825Sdfr#define EOB_ACT_LAST_MATCH 2 167178825Sdfr 168178825Sdfr #define YY_LESS_LINENO(n) 169178825Sdfr 170178825Sdfr/* Return all but the first "n" matched characters back to the input stream. */ 171178825Sdfr#define yyless(n) \ 172178825Sdfr do \ 173178825Sdfr { \ 174178825Sdfr /* Undo effects of setting up yytext. */ \ 175178825Sdfr int yyless_macro_arg = (n); \ 176178825Sdfr YY_LESS_LINENO(yyless_macro_arg);\ 177178825Sdfr *yy_cp = (yy_hold_char); \ 178178825Sdfr YY_RESTORE_YY_MORE_OFFSET \ 179178825Sdfr (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ 180178825Sdfr YY_DO_BEFORE_ACTION; /* set up yytext again */ \ 181178825Sdfr } \ 182178825Sdfr while ( 0 ) 183178825Sdfr 184178825Sdfr#define unput(c) yyunput( c, (yytext_ptr) ) 185178825Sdfr 186178825Sdfr#ifndef YY_STRUCT_YY_BUFFER_STATE 187178825Sdfr#define YY_STRUCT_YY_BUFFER_STATE 188178825Sdfrstruct yy_buffer_state 189178825Sdfr { 190178825Sdfr FILE *yy_input_file; 191178825Sdfr 192178825Sdfr char *yy_ch_buf; /* input buffer */ 193178825Sdfr char *yy_buf_pos; /* current position in input buffer */ 194178825Sdfr 195178825Sdfr /* Size of input buffer in bytes, not including room for EOB 196178825Sdfr * characters. 197178825Sdfr */ 198178825Sdfr yy_size_t yy_buf_size; 199178825Sdfr 200178825Sdfr /* Number of characters read into yy_ch_buf, not including EOB 201178825Sdfr * characters. 202178825Sdfr */ 203233294Sstas yy_size_t yy_n_chars; 204178825Sdfr 205178825Sdfr /* Whether we "own" the buffer - i.e., we know we created it, 206178825Sdfr * and can realloc() it to grow it, and should free() it to 207178825Sdfr * delete it. 208178825Sdfr */ 209178825Sdfr int yy_is_our_buffer; 210178825Sdfr 211178825Sdfr /* Whether this is an "interactive" input source; if so, and 212178825Sdfr * if we're using stdio for input, then we want to use getc() 213178825Sdfr * instead of fread(), to make sure we stop fetching input after 214178825Sdfr * each newline. 215178825Sdfr */ 216178825Sdfr int yy_is_interactive; 217178825Sdfr 218178825Sdfr /* Whether we're considered to be at the beginning of a line. 219178825Sdfr * If so, '^' rules will be active on the next match, otherwise 220178825Sdfr * not. 221178825Sdfr */ 222178825Sdfr int yy_at_bol; 223178825Sdfr 224178825Sdfr int yy_bs_lineno; /**< The line count. */ 225178825Sdfr int yy_bs_column; /**< The column count. */ 226178825Sdfr 227178825Sdfr /* Whether to try to fill the input buffer when we reach the 228178825Sdfr * end of it. 229178825Sdfr */ 230178825Sdfr int yy_fill_buffer; 231178825Sdfr 232178825Sdfr int yy_buffer_status; 233178825Sdfr 234178825Sdfr#define YY_BUFFER_NEW 0 235178825Sdfr#define YY_BUFFER_NORMAL 1 236178825Sdfr /* When an EOF's been seen but there's still some text to process 237178825Sdfr * then we mark the buffer as YY_EOF_PENDING, to indicate that we 238178825Sdfr * shouldn't try reading from the input source any more. We might 239178825Sdfr * still have a bunch of tokens to match, though, because of 240178825Sdfr * possible backing-up. 241178825Sdfr * 242178825Sdfr * When we actually see the EOF, we change the status to "new" 243178825Sdfr * (via yyrestart()), so that the user can continue scanning by 244178825Sdfr * just pointing yyin at a new input file. 245178825Sdfr */ 246178825Sdfr#define YY_BUFFER_EOF_PENDING 2 247178825Sdfr 248178825Sdfr }; 249178825Sdfr#endif /* !YY_STRUCT_YY_BUFFER_STATE */ 250178825Sdfr 251178825Sdfr/* Stack of input buffers. */ 252178825Sdfrstatic size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ 253178825Sdfrstatic size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ 254178825Sdfrstatic YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ 255178825Sdfr 256178825Sdfr/* We provide macros for accessing buffer states in case in the 257178825Sdfr * future we want to put the buffer states in a more general 258178825Sdfr * "scanner state". 259178825Sdfr * 260178825Sdfr * Returns the top of the stack, or NULL. 261178825Sdfr */ 262178825Sdfr#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ 263178825Sdfr ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ 264178825Sdfr : NULL) 265178825Sdfr 266178825Sdfr/* Same as previous macro, but useful when we know that the buffer stack is not 267178825Sdfr * NULL or when we need an lvalue. For internal use only. 268178825Sdfr */ 269178825Sdfr#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] 270178825Sdfr 271178825Sdfr/* yy_hold_char holds the character lost when yytext is formed. */ 272178825Sdfrstatic char yy_hold_char; 273233294Sstasstatic yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ 274233294Sstasyy_size_t yyleng; 275178825Sdfr 276178825Sdfr/* Points to current character in buffer. */ 277178825Sdfrstatic char *yy_c_buf_p = (char *) 0; 278178825Sdfrstatic int yy_init = 0; /* whether we need to initialize */ 279178825Sdfrstatic int yy_start = 0; /* start state number */ 280178825Sdfr 281178825Sdfr/* Flag which is used to allow yywrap()'s to do buffer switches 282178825Sdfr * instead of setting up a fresh yyin. A bit of a hack ... 283178825Sdfr */ 284178825Sdfrstatic int yy_did_buffer_switch_on_eof; 285178825Sdfr 286178825Sdfrvoid yyrestart (FILE *input_file ); 287178825Sdfrvoid yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); 288178825SdfrYY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); 289178825Sdfrvoid yy_delete_buffer (YY_BUFFER_STATE b ); 290178825Sdfrvoid yy_flush_buffer (YY_BUFFER_STATE b ); 291178825Sdfrvoid yypush_buffer_state (YY_BUFFER_STATE new_buffer ); 292178825Sdfrvoid yypop_buffer_state (void ); 293178825Sdfr 294178825Sdfrstatic void yyensure_buffer_stack (void ); 295178825Sdfrstatic void yy_load_buffer_state (void ); 296178825Sdfrstatic void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); 297178825Sdfr 298178825Sdfr#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) 299178825Sdfr 300178825SdfrYY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); 301178825SdfrYY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); 302233294SstasYY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); 303178825Sdfr 304178825Sdfrvoid *yyalloc (yy_size_t ); 305178825Sdfrvoid *yyrealloc (void *,yy_size_t ); 306178825Sdfrvoid yyfree (void * ); 307178825Sdfr 308178825Sdfr#define yy_new_buffer yy_create_buffer 309178825Sdfr 310178825Sdfr#define yy_set_interactive(is_interactive) \ 311178825Sdfr { \ 312178825Sdfr if ( ! YY_CURRENT_BUFFER ){ \ 313178825Sdfr yyensure_buffer_stack (); \ 314178825Sdfr YY_CURRENT_BUFFER_LVALUE = \ 315178825Sdfr yy_create_buffer(yyin,YY_BUF_SIZE ); \ 316178825Sdfr } \ 317178825Sdfr YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ 318178825Sdfr } 319178825Sdfr 320178825Sdfr#define yy_set_bol(at_bol) \ 321178825Sdfr { \ 322178825Sdfr if ( ! YY_CURRENT_BUFFER ){\ 323178825Sdfr yyensure_buffer_stack (); \ 324178825Sdfr YY_CURRENT_BUFFER_LVALUE = \ 325178825Sdfr yy_create_buffer(yyin,YY_BUF_SIZE ); \ 326178825Sdfr } \ 327178825Sdfr YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ 328178825Sdfr } 329178825Sdfr 330178825Sdfr#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) 331178825Sdfr 332178825Sdfr/* Begin user sect3 */ 333178825Sdfr 334178825Sdfrtypedef unsigned char YY_CHAR; 335178825Sdfr 336178825SdfrFILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; 337178825Sdfr 338178825Sdfrtypedef int yy_state_type; 339178825Sdfr 340178825Sdfrextern int yylineno; 341178825Sdfr 342178825Sdfrint yylineno = 1; 343178825Sdfr 344178825Sdfrextern char *yytext; 345178825Sdfr#define yytext_ptr yytext 346178825Sdfr 347178825Sdfrstatic yy_state_type yy_get_previous_state (void ); 348178825Sdfrstatic yy_state_type yy_try_NUL_trans (yy_state_type current_state ); 349178825Sdfrstatic int yy_get_next_buffer (void ); 350178825Sdfrstatic void yy_fatal_error (yyconst char msg[] ); 351178825Sdfr 352178825Sdfr/* Done after the current pattern has been matched and before the 353178825Sdfr * corresponding action - sets up yytext. 354178825Sdfr */ 355178825Sdfr#define YY_DO_BEFORE_ACTION \ 356178825Sdfr (yytext_ptr) = yy_bp; \ 357178825Sdfr yyleng = (size_t) (yy_cp - yy_bp); \ 358178825Sdfr (yy_hold_char) = *yy_cp; \ 359178825Sdfr *yy_cp = '\0'; \ 360178825Sdfr (yy_c_buf_p) = yy_cp; 361178825Sdfr 362178825Sdfr#define YY_NUM_RULES 7 363178825Sdfr#define YY_END_OF_BUFFER 8 364178825Sdfr/* This struct is not used in this scanner, 365178825Sdfr but its presence is necessary. */ 366178825Sdfrstruct yy_trans_info 367178825Sdfr { 368178825Sdfr flex_int32_t yy_verify; 369178825Sdfr flex_int32_t yy_nxt; 370178825Sdfr }; 371178825Sdfrstatic yyconst flex_int16_t yy_accept[14] = 372178825Sdfr { 0, 373178825Sdfr 0, 0, 8, 7, 6, 3, 2, 7, 5, 1, 374178825Sdfr 4, 1, 0 375178825Sdfr } ; 376178825Sdfr 377178825Sdfrstatic yyconst flex_int32_t yy_ec[256] = 378178825Sdfr { 0, 379178825Sdfr 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 380178825Sdfr 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 381178825Sdfr 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 382178825Sdfr 1, 2, 1, 4, 1, 1, 1, 1, 1, 1, 383178825Sdfr 1, 5, 1, 1, 6, 1, 7, 6, 6, 6, 384178825Sdfr 6, 6, 6, 6, 6, 6, 6, 1, 1, 1, 385178825Sdfr 8, 1, 1, 1, 9, 9, 9, 9, 9, 9, 386178825Sdfr 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 387178825Sdfr 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 388178825Sdfr 1, 1, 1, 1, 6, 1, 9, 9, 9, 9, 389178825Sdfr 390178825Sdfr 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 391178825Sdfr 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 392178825Sdfr 9, 9, 8, 1, 8, 1, 1, 1, 1, 1, 393178825Sdfr 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 394178825Sdfr 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 395178825Sdfr 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 396178825Sdfr 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 397178825Sdfr 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 398178825Sdfr 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 399178825Sdfr 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 400178825Sdfr 401178825Sdfr 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 402178825Sdfr 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 403178825Sdfr 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 404178825Sdfr 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 405178825Sdfr 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 406178825Sdfr 1, 1, 1, 1, 1 407178825Sdfr } ; 408178825Sdfr 409178825Sdfrstatic yyconst flex_int32_t yy_meta[10] = 410178825Sdfr { 0, 411178825Sdfr 1, 1, 1, 1, 1, 2, 1, 1, 2 412178825Sdfr } ; 413178825Sdfr 414178825Sdfrstatic yyconst flex_int16_t yy_base[15] = 415178825Sdfr { 0, 416178825Sdfr 0, 0, 12, 13, 13, 13, 13, 6, 13, 0, 417178825Sdfr 13, 0, 13, 8 418178825Sdfr } ; 419178825Sdfr 420178825Sdfrstatic yyconst flex_int16_t yy_def[15] = 421178825Sdfr { 0, 422178825Sdfr 13, 1, 13, 13, 13, 13, 13, 13, 13, 14, 423178825Sdfr 13, 14, 0, 13 424178825Sdfr } ; 425178825Sdfr 426178825Sdfrstatic yyconst flex_int16_t yy_nxt[23] = 427178825Sdfr { 0, 428178825Sdfr 4, 5, 6, 7, 4, 4, 8, 9, 10, 12, 429178825Sdfr 11, 13, 3, 13, 13, 13, 13, 13, 13, 13, 430178825Sdfr 13, 13 431178825Sdfr } ; 432178825Sdfr 433178825Sdfrstatic yyconst flex_int16_t yy_chk[23] = 434178825Sdfr { 0, 435178825Sdfr 1, 1, 1, 1, 1, 1, 1, 1, 1, 14, 436178825Sdfr 8, 3, 13, 13, 13, 13, 13, 13, 13, 13, 437178825Sdfr 13, 13 438178825Sdfr } ; 439178825Sdfr 440178825Sdfrstatic yy_state_type yy_last_accepting_state; 441178825Sdfrstatic char *yy_last_accepting_cpos; 442178825Sdfr 443178825Sdfrextern int yy_flex_debug; 444178825Sdfrint yy_flex_debug = 0; 445178825Sdfr 446178825Sdfr/* The intent behind this definition is that it'll catch 447178825Sdfr * any uses of REJECT which flex missed. 448178825Sdfr */ 449178825Sdfr#define REJECT reject_used_but_not_detected 450178825Sdfr#define yymore() yymore_used_but_not_detected 451178825Sdfr#define YY_MORE_ADJ 0 452178825Sdfr#define YY_RESTORE_YY_MORE_OFFSET 453178825Sdfrchar *yytext; 454178825Sdfr#line 1 "slc-lex.l" 455178825Sdfr#line 2 "slc-lex.l" 456178825Sdfr/* 457233294Sstas * Copyright (c) 2004 Kungliga Tekniska H��gskolan 458233294Sstas * (Royal Institute of Technology, Stockholm, Sweden). 459233294Sstas * All rights reserved. 460178825Sdfr * 461233294Sstas * Redistribution and use in source and binary forms, with or without 462233294Sstas * modification, are permitted provided that the following conditions 463233294Sstas * are met: 464178825Sdfr * 465233294Sstas * 1. Redistributions of source code must retain the above copyright 466233294Sstas * notice, this list of conditions and the following disclaimer. 467178825Sdfr * 468233294Sstas * 2. Redistributions in binary form must reproduce the above copyright 469233294Sstas * notice, this list of conditions and the following disclaimer in the 470233294Sstas * documentation and/or other materials provided with the distribution. 471178825Sdfr * 472233294Sstas * 3. Neither the name of the Institute nor the names of its contributors 473233294Sstas * may be used to endorse or promote products derived from this software 474233294Sstas * without specific prior written permission. 475178825Sdfr * 476233294Sstas * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 477233294Sstas * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 478233294Sstas * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 479233294Sstas * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 480233294Sstas * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 481233294Sstas * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 482233294Sstas * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 483233294Sstas * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 484233294Sstas * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 485233294Sstas * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 486233294Sstas * SUCH DAMAGE. 487178825Sdfr */ 488178825Sdfr 489233294Sstas/* $Id$ */ 490178825Sdfr 491178825Sdfr#undef ECHO 492178825Sdfr 493178825Sdfr#include <stdio.h> 494178825Sdfr#include <string.h> 495178825Sdfr#include <stdarg.h> 496178825Sdfr#include <stdlib.h> 497178825Sdfr#include "slc.h" 498178825Sdfr#include "slc-gram.h" 499178825Sdfrunsigned lineno = 1; 500178825Sdfr 501178825Sdfrstatic void handle_comment(void); 502178825Sdfrstatic char * handle_string(void); 503178825Sdfr 504178825Sdfr#define YY_NO_UNPUT 505178825Sdfr 506178825Sdfr#undef ECHO 507178825Sdfr 508233294Sstas#line 509 "slc-lex.c" 509178825Sdfr 510178825Sdfr#define INITIAL 0 511178825Sdfr 512178825Sdfr#ifndef YY_NO_UNISTD_H 513178825Sdfr/* Special case for "unistd.h", since it is non-ANSI. We include it way 514178825Sdfr * down here because we want the user's section 1 to have been scanned first. 515178825Sdfr * The user has a chance to override it with an option. 516178825Sdfr */ 517178825Sdfr#include <unistd.h> 518178825Sdfr#endif 519178825Sdfr 520178825Sdfr#ifndef YY_EXTRA_TYPE 521178825Sdfr#define YY_EXTRA_TYPE void * 522178825Sdfr#endif 523178825Sdfr 524178825Sdfrstatic int yy_init_globals (void ); 525178825Sdfr 526233294Sstas/* Accessor methods to globals. 527233294Sstas These are made visible to non-reentrant scanners for convenience. */ 528233294Sstas 529233294Sstasint yylex_destroy (void ); 530233294Sstas 531233294Sstasint yyget_debug (void ); 532233294Sstas 533233294Sstasvoid yyset_debug (int debug_flag ); 534233294Sstas 535233294SstasYY_EXTRA_TYPE yyget_extra (void ); 536233294Sstas 537233294Sstasvoid yyset_extra (YY_EXTRA_TYPE user_defined ); 538233294Sstas 539233294SstasFILE *yyget_in (void ); 540233294Sstas 541233294Sstasvoid yyset_in (FILE * in_str ); 542233294Sstas 543233294SstasFILE *yyget_out (void ); 544233294Sstas 545233294Sstasvoid yyset_out (FILE * out_str ); 546233294Sstas 547233294Sstasyy_size_t yyget_leng (void ); 548233294Sstas 549233294Sstaschar *yyget_text (void ); 550233294Sstas 551233294Sstasint yyget_lineno (void ); 552233294Sstas 553233294Sstasvoid yyset_lineno (int line_number ); 554233294Sstas 555178825Sdfr/* Macros after this point can all be overridden by user definitions in 556178825Sdfr * section 1. 557178825Sdfr */ 558178825Sdfr 559178825Sdfr#ifndef YY_SKIP_YYWRAP 560178825Sdfr#ifdef __cplusplus 561178825Sdfrextern "C" int yywrap (void ); 562178825Sdfr#else 563178825Sdfrextern int yywrap (void ); 564178825Sdfr#endif 565178825Sdfr#endif 566178825Sdfr 567178825Sdfr#ifndef yytext_ptr 568178825Sdfrstatic void yy_flex_strncpy (char *,yyconst char *,int ); 569178825Sdfr#endif 570178825Sdfr 571178825Sdfr#ifdef YY_NEED_STRLEN 572178825Sdfrstatic int yy_flex_strlen (yyconst char * ); 573178825Sdfr#endif 574178825Sdfr 575178825Sdfr#ifndef YY_NO_INPUT 576178825Sdfr 577178825Sdfr#ifdef __cplusplus 578178825Sdfrstatic int yyinput (void ); 579178825Sdfr#else 580178825Sdfrstatic int input (void ); 581178825Sdfr#endif 582178825Sdfr 583178825Sdfr#endif 584178825Sdfr 585178825Sdfr/* Amount of stuff to slurp up with each read. */ 586178825Sdfr#ifndef YY_READ_BUF_SIZE 587178825Sdfr#define YY_READ_BUF_SIZE 8192 588178825Sdfr#endif 589178825Sdfr 590178825Sdfr/* Copy whatever the last rule matched to the standard output. */ 591178825Sdfr#ifndef ECHO 592178825Sdfr/* This used to be an fputs(), but since the string might contain NUL's, 593178825Sdfr * we now use fwrite(). 594178825Sdfr */ 595233294Sstas#define ECHO fwrite( yytext, yyleng, 1, yyout ) 596178825Sdfr#endif 597178825Sdfr 598178825Sdfr/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 599178825Sdfr * is returned in "result". 600178825Sdfr */ 601178825Sdfr#ifndef YY_INPUT 602178825Sdfr#define YY_INPUT(buf,result,max_size) \ 603178825Sdfr if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ 604178825Sdfr { \ 605178825Sdfr int c = '*'; \ 606233294Sstas yy_size_t n; \ 607178825Sdfr for ( n = 0; n < max_size && \ 608178825Sdfr (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ 609178825Sdfr buf[n] = (char) c; \ 610178825Sdfr if ( c == '\n' ) \ 611178825Sdfr buf[n++] = (char) c; \ 612178825Sdfr if ( c == EOF && ferror( yyin ) ) \ 613178825Sdfr YY_FATAL_ERROR( "input in flex scanner failed" ); \ 614178825Sdfr result = n; \ 615178825Sdfr } \ 616178825Sdfr else \ 617178825Sdfr { \ 618178825Sdfr errno=0; \ 619178825Sdfr while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ 620178825Sdfr { \ 621178825Sdfr if( errno != EINTR) \ 622178825Sdfr { \ 623178825Sdfr YY_FATAL_ERROR( "input in flex scanner failed" ); \ 624178825Sdfr break; \ 625178825Sdfr } \ 626178825Sdfr errno=0; \ 627178825Sdfr clearerr(yyin); \ 628178825Sdfr } \ 629178825Sdfr }\ 630178825Sdfr\ 631178825Sdfr 632178825Sdfr#endif 633178825Sdfr 634178825Sdfr/* No semi-colon after return; correct usage is to write "yyterminate();" - 635178825Sdfr * we don't want an extra ';' after the "return" because that will cause 636178825Sdfr * some compilers to complain about unreachable statements. 637178825Sdfr */ 638178825Sdfr#ifndef yyterminate 639178825Sdfr#define yyterminate() return YY_NULL 640178825Sdfr#endif 641178825Sdfr 642178825Sdfr/* Number of entries by which start-condition stack grows. */ 643178825Sdfr#ifndef YY_START_STACK_INCR 644178825Sdfr#define YY_START_STACK_INCR 25 645178825Sdfr#endif 646178825Sdfr 647178825Sdfr/* Report a fatal error. */ 648178825Sdfr#ifndef YY_FATAL_ERROR 649178825Sdfr#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) 650178825Sdfr#endif 651178825Sdfr 652178825Sdfr/* end tables serialization structures and prototypes */ 653178825Sdfr 654178825Sdfr/* Default declaration of generated scanner - a define so the user can 655178825Sdfr * easily add parameters. 656178825Sdfr */ 657178825Sdfr#ifndef YY_DECL 658178825Sdfr#define YY_DECL_IS_OURS 1 659178825Sdfr 660178825Sdfrextern int yylex (void); 661178825Sdfr 662178825Sdfr#define YY_DECL int yylex (void) 663178825Sdfr#endif /* !YY_DECL */ 664178825Sdfr 665178825Sdfr/* Code executed at the beginning of each rule, after yytext and yyleng 666178825Sdfr * have been set up. 667178825Sdfr */ 668178825Sdfr#ifndef YY_USER_ACTION 669178825Sdfr#define YY_USER_ACTION 670178825Sdfr#endif 671178825Sdfr 672178825Sdfr/* Code executed at the end of each rule. */ 673178825Sdfr#ifndef YY_BREAK 674178825Sdfr#define YY_BREAK break; 675178825Sdfr#endif 676178825Sdfr 677178825Sdfr#define YY_RULE_SETUP \ 678178825Sdfr YY_USER_ACTION 679178825Sdfr 680178825Sdfr/** The main scanner function which does all the work. 681178825Sdfr */ 682178825SdfrYY_DECL 683178825Sdfr{ 684178825Sdfr register yy_state_type yy_current_state; 685178825Sdfr register char *yy_cp, *yy_bp; 686178825Sdfr register int yy_act; 687178825Sdfr 688233294Sstas#line 58 "slc-lex.l" 689178825Sdfr 690233294Sstas#line 691 "slc-lex.c" 691178825Sdfr 692178825Sdfr if ( !(yy_init) ) 693178825Sdfr { 694178825Sdfr (yy_init) = 1; 695178825Sdfr 696178825Sdfr#ifdef YY_USER_INIT 697178825Sdfr YY_USER_INIT; 698178825Sdfr#endif 699178825Sdfr 700178825Sdfr if ( ! (yy_start) ) 701178825Sdfr (yy_start) = 1; /* first start state */ 702178825Sdfr 703178825Sdfr if ( ! yyin ) 704178825Sdfr yyin = stdin; 705178825Sdfr 706178825Sdfr if ( ! yyout ) 707178825Sdfr yyout = stdout; 708178825Sdfr 709178825Sdfr if ( ! YY_CURRENT_BUFFER ) { 710178825Sdfr yyensure_buffer_stack (); 711178825Sdfr YY_CURRENT_BUFFER_LVALUE = 712178825Sdfr yy_create_buffer(yyin,YY_BUF_SIZE ); 713178825Sdfr } 714178825Sdfr 715178825Sdfr yy_load_buffer_state( ); 716178825Sdfr } 717178825Sdfr 718178825Sdfr while ( 1 ) /* loops until end-of-file is reached */ 719178825Sdfr { 720178825Sdfr yy_cp = (yy_c_buf_p); 721178825Sdfr 722178825Sdfr /* Support of yytext. */ 723178825Sdfr *yy_cp = (yy_hold_char); 724178825Sdfr 725178825Sdfr /* yy_bp points to the position in yy_ch_buf of the start of 726178825Sdfr * the current run. 727178825Sdfr */ 728178825Sdfr yy_bp = yy_cp; 729178825Sdfr 730178825Sdfr yy_current_state = (yy_start); 731178825Sdfryy_match: 732178825Sdfr do 733178825Sdfr { 734178825Sdfr register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; 735178825Sdfr if ( yy_accept[yy_current_state] ) 736178825Sdfr { 737178825Sdfr (yy_last_accepting_state) = yy_current_state; 738178825Sdfr (yy_last_accepting_cpos) = yy_cp; 739178825Sdfr } 740178825Sdfr while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 741178825Sdfr { 742178825Sdfr yy_current_state = (int) yy_def[yy_current_state]; 743178825Sdfr if ( yy_current_state >= 14 ) 744178825Sdfr yy_c = yy_meta[(unsigned int) yy_c]; 745178825Sdfr } 746178825Sdfr yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 747178825Sdfr ++yy_cp; 748178825Sdfr } 749178825Sdfr while ( yy_base[yy_current_state] != 13 ); 750178825Sdfr 751178825Sdfryy_find_action: 752178825Sdfr yy_act = yy_accept[yy_current_state]; 753178825Sdfr if ( yy_act == 0 ) 754178825Sdfr { /* have to back up */ 755178825Sdfr yy_cp = (yy_last_accepting_cpos); 756178825Sdfr yy_current_state = (yy_last_accepting_state); 757178825Sdfr yy_act = yy_accept[yy_current_state]; 758178825Sdfr } 759178825Sdfr 760178825Sdfr YY_DO_BEFORE_ACTION; 761178825Sdfr 762178825Sdfrdo_action: /* This label is used only to access EOF actions. */ 763178825Sdfr 764178825Sdfr switch ( yy_act ) 765178825Sdfr { /* beginning of action switch */ 766178825Sdfr case 0: /* must back up */ 767178825Sdfr /* undo the effects of YY_DO_BEFORE_ACTION */ 768178825Sdfr *yy_cp = (yy_hold_char); 769178825Sdfr yy_cp = (yy_last_accepting_cpos); 770178825Sdfr yy_current_state = (yy_last_accepting_state); 771178825Sdfr goto yy_find_action; 772178825Sdfr 773178825Sdfrcase 1: 774178825SdfrYY_RULE_SETUP 775233294Sstas#line 59 "slc-lex.l" 776178825Sdfr{ 777178825Sdfr yylval.string = strdup ((const char *)yytext); 778178825Sdfr return LITERAL; 779178825Sdfr } 780178825Sdfr YY_BREAK 781178825Sdfrcase 2: 782178825SdfrYY_RULE_SETUP 783233294Sstas#line 63 "slc-lex.l" 784178825Sdfr{ yylval.string = handle_string(); return STRING; } 785178825Sdfr YY_BREAK 786178825Sdfrcase 3: 787178825Sdfr/* rule 3 can match eol */ 788178825SdfrYY_RULE_SETUP 789233294Sstas#line 64 "slc-lex.l" 790178825Sdfr{ ++lineno; } 791178825Sdfr YY_BREAK 792178825Sdfrcase 4: 793178825SdfrYY_RULE_SETUP 794233294Sstas#line 65 "slc-lex.l" 795178825Sdfr{ handle_comment(); } 796178825Sdfr YY_BREAK 797178825Sdfrcase 5: 798178825SdfrYY_RULE_SETUP 799233294Sstas#line 66 "slc-lex.l" 800178825Sdfr{ return *yytext; } 801178825Sdfr YY_BREAK 802178825Sdfrcase 6: 803178825SdfrYY_RULE_SETUP 804233294Sstas#line 67 "slc-lex.l" 805178825Sdfr; 806178825Sdfr YY_BREAK 807178825Sdfrcase 7: 808178825SdfrYY_RULE_SETUP 809233294Sstas#line 68 "slc-lex.l" 810178825SdfrECHO; 811178825Sdfr YY_BREAK 812233294Sstas#line 813 "slc-lex.c" 813178825Sdfrcase YY_STATE_EOF(INITIAL): 814178825Sdfr yyterminate(); 815178825Sdfr 816178825Sdfr case YY_END_OF_BUFFER: 817178825Sdfr { 818178825Sdfr /* Amount of text matched not including the EOB char. */ 819178825Sdfr int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; 820178825Sdfr 821178825Sdfr /* Undo the effects of YY_DO_BEFORE_ACTION. */ 822178825Sdfr *yy_cp = (yy_hold_char); 823178825Sdfr YY_RESTORE_YY_MORE_OFFSET 824178825Sdfr 825178825Sdfr if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) 826178825Sdfr { 827178825Sdfr /* We're scanning a new file or input source. It's 828178825Sdfr * possible that this happened because the user 829178825Sdfr * just pointed yyin at a new source and called 830178825Sdfr * yylex(). If so, then we have to assure 831178825Sdfr * consistency between YY_CURRENT_BUFFER and our 832178825Sdfr * globals. Here is the right place to do so, because 833178825Sdfr * this is the first action (other than possibly a 834178825Sdfr * back-up) that will match for the new input source. 835178825Sdfr */ 836178825Sdfr (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 837178825Sdfr YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; 838178825Sdfr YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; 839178825Sdfr } 840178825Sdfr 841178825Sdfr /* Note that here we test for yy_c_buf_p "<=" to the position 842178825Sdfr * of the first EOB in the buffer, since yy_c_buf_p will 843178825Sdfr * already have been incremented past the NUL character 844178825Sdfr * (since all states make transitions on EOB to the 845178825Sdfr * end-of-buffer state). Contrast this with the test 846178825Sdfr * in input(). 847178825Sdfr */ 848178825Sdfr if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) 849178825Sdfr { /* This was really a NUL. */ 850178825Sdfr yy_state_type yy_next_state; 851178825Sdfr 852178825Sdfr (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; 853178825Sdfr 854178825Sdfr yy_current_state = yy_get_previous_state( ); 855178825Sdfr 856178825Sdfr /* Okay, we're now positioned to make the NUL 857178825Sdfr * transition. We couldn't have 858178825Sdfr * yy_get_previous_state() go ahead and do it 859178825Sdfr * for us because it doesn't know how to deal 860178825Sdfr * with the possibility of jamming (and we don't 861178825Sdfr * want to build jamming into it because then it 862178825Sdfr * will run more slowly). 863178825Sdfr */ 864178825Sdfr 865178825Sdfr yy_next_state = yy_try_NUL_trans( yy_current_state ); 866178825Sdfr 867178825Sdfr yy_bp = (yytext_ptr) + YY_MORE_ADJ; 868178825Sdfr 869178825Sdfr if ( yy_next_state ) 870178825Sdfr { 871178825Sdfr /* Consume the NUL. */ 872178825Sdfr yy_cp = ++(yy_c_buf_p); 873178825Sdfr yy_current_state = yy_next_state; 874178825Sdfr goto yy_match; 875178825Sdfr } 876178825Sdfr 877178825Sdfr else 878178825Sdfr { 879178825Sdfr yy_cp = (yy_c_buf_p); 880178825Sdfr goto yy_find_action; 881178825Sdfr } 882178825Sdfr } 883178825Sdfr 884178825Sdfr else switch ( yy_get_next_buffer( ) ) 885178825Sdfr { 886178825Sdfr case EOB_ACT_END_OF_FILE: 887178825Sdfr { 888178825Sdfr (yy_did_buffer_switch_on_eof) = 0; 889178825Sdfr 890178825Sdfr if ( yywrap( ) ) 891178825Sdfr { 892178825Sdfr /* Note: because we've taken care in 893178825Sdfr * yy_get_next_buffer() to have set up 894178825Sdfr * yytext, we can now set up 895178825Sdfr * yy_c_buf_p so that if some total 896178825Sdfr * hoser (like flex itself) wants to 897178825Sdfr * call the scanner after we return the 898178825Sdfr * YY_NULL, it'll still work - another 899178825Sdfr * YY_NULL will get returned. 900178825Sdfr */ 901178825Sdfr (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; 902178825Sdfr 903178825Sdfr yy_act = YY_STATE_EOF(YY_START); 904178825Sdfr goto do_action; 905178825Sdfr } 906178825Sdfr 907178825Sdfr else 908178825Sdfr { 909178825Sdfr if ( ! (yy_did_buffer_switch_on_eof) ) 910178825Sdfr YY_NEW_FILE; 911178825Sdfr } 912178825Sdfr break; 913178825Sdfr } 914178825Sdfr 915178825Sdfr case EOB_ACT_CONTINUE_SCAN: 916178825Sdfr (yy_c_buf_p) = 917178825Sdfr (yytext_ptr) + yy_amount_of_matched_text; 918178825Sdfr 919178825Sdfr yy_current_state = yy_get_previous_state( ); 920178825Sdfr 921178825Sdfr yy_cp = (yy_c_buf_p); 922178825Sdfr yy_bp = (yytext_ptr) + YY_MORE_ADJ; 923178825Sdfr goto yy_match; 924178825Sdfr 925178825Sdfr case EOB_ACT_LAST_MATCH: 926178825Sdfr (yy_c_buf_p) = 927178825Sdfr &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; 928178825Sdfr 929178825Sdfr yy_current_state = yy_get_previous_state( ); 930178825Sdfr 931178825Sdfr yy_cp = (yy_c_buf_p); 932178825Sdfr yy_bp = (yytext_ptr) + YY_MORE_ADJ; 933178825Sdfr goto yy_find_action; 934178825Sdfr } 935178825Sdfr break; 936178825Sdfr } 937178825Sdfr 938178825Sdfr default: 939178825Sdfr YY_FATAL_ERROR( 940178825Sdfr "fatal flex scanner internal error--no action found" ); 941178825Sdfr } /* end of action switch */ 942178825Sdfr } /* end of scanning one token */ 943178825Sdfr} /* end of yylex */ 944178825Sdfr 945178825Sdfr/* yy_get_next_buffer - try to read in a new buffer 946178825Sdfr * 947178825Sdfr * Returns a code representing an action: 948178825Sdfr * EOB_ACT_LAST_MATCH - 949178825Sdfr * EOB_ACT_CONTINUE_SCAN - continue scanning from current position 950178825Sdfr * EOB_ACT_END_OF_FILE - end of file 951178825Sdfr */ 952178825Sdfrstatic int yy_get_next_buffer (void) 953178825Sdfr{ 954178825Sdfr register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; 955178825Sdfr register char *source = (yytext_ptr); 956178825Sdfr register int number_to_move, i; 957178825Sdfr int ret_val; 958178825Sdfr 959178825Sdfr if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) 960178825Sdfr YY_FATAL_ERROR( 961178825Sdfr "fatal flex scanner internal error--end of buffer missed" ); 962178825Sdfr 963178825Sdfr if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) 964178825Sdfr { /* Don't try to fill the buffer, so this is an EOF. */ 965178825Sdfr if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) 966178825Sdfr { 967178825Sdfr /* We matched a single character, the EOB, so 968178825Sdfr * treat this as a final EOF. 969178825Sdfr */ 970178825Sdfr return EOB_ACT_END_OF_FILE; 971178825Sdfr } 972178825Sdfr 973178825Sdfr else 974178825Sdfr { 975178825Sdfr /* We matched some text prior to the EOB, first 976178825Sdfr * process it. 977178825Sdfr */ 978178825Sdfr return EOB_ACT_LAST_MATCH; 979178825Sdfr } 980178825Sdfr } 981178825Sdfr 982178825Sdfr /* Try to read more data. */ 983178825Sdfr 984178825Sdfr /* First move last chars to start of buffer. */ 985178825Sdfr number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; 986178825Sdfr 987178825Sdfr for ( i = 0; i < number_to_move; ++i ) 988178825Sdfr *(dest++) = *(source++); 989178825Sdfr 990178825Sdfr if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) 991178825Sdfr /* don't do the read, it's not guaranteed to return an EOF, 992178825Sdfr * just force an EOF 993178825Sdfr */ 994178825Sdfr YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; 995178825Sdfr 996178825Sdfr else 997178825Sdfr { 998233294Sstas yy_size_t num_to_read = 999178825Sdfr YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; 1000178825Sdfr 1001178825Sdfr while ( num_to_read <= 0 ) 1002178825Sdfr { /* Not enough room in the buffer - grow it. */ 1003178825Sdfr 1004178825Sdfr /* just a shorter name for the current buffer */ 1005178825Sdfr YY_BUFFER_STATE b = YY_CURRENT_BUFFER; 1006178825Sdfr 1007178825Sdfr int yy_c_buf_p_offset = 1008178825Sdfr (int) ((yy_c_buf_p) - b->yy_ch_buf); 1009178825Sdfr 1010178825Sdfr if ( b->yy_is_our_buffer ) 1011178825Sdfr { 1012233294Sstas yy_size_t new_size = b->yy_buf_size * 2; 1013178825Sdfr 1014178825Sdfr if ( new_size <= 0 ) 1015178825Sdfr b->yy_buf_size += b->yy_buf_size / 8; 1016178825Sdfr else 1017178825Sdfr b->yy_buf_size *= 2; 1018178825Sdfr 1019178825Sdfr b->yy_ch_buf = (char *) 1020178825Sdfr /* Include room in for 2 EOB chars. */ 1021178825Sdfr yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); 1022178825Sdfr } 1023178825Sdfr else 1024178825Sdfr /* Can't grow it, we don't own it. */ 1025178825Sdfr b->yy_ch_buf = 0; 1026178825Sdfr 1027178825Sdfr if ( ! b->yy_ch_buf ) 1028178825Sdfr YY_FATAL_ERROR( 1029178825Sdfr "fatal error - scanner input buffer overflow" ); 1030178825Sdfr 1031178825Sdfr (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; 1032178825Sdfr 1033178825Sdfr num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - 1034178825Sdfr number_to_move - 1; 1035178825Sdfr 1036178825Sdfr } 1037178825Sdfr 1038178825Sdfr if ( num_to_read > YY_READ_BUF_SIZE ) 1039178825Sdfr num_to_read = YY_READ_BUF_SIZE; 1040178825Sdfr 1041178825Sdfr /* Read in more data. */ 1042178825Sdfr YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 1043178825Sdfr (yy_n_chars), num_to_read ); 1044178825Sdfr 1045178825Sdfr YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1046178825Sdfr } 1047178825Sdfr 1048178825Sdfr if ( (yy_n_chars) == 0 ) 1049178825Sdfr { 1050178825Sdfr if ( number_to_move == YY_MORE_ADJ ) 1051178825Sdfr { 1052178825Sdfr ret_val = EOB_ACT_END_OF_FILE; 1053178825Sdfr yyrestart(yyin ); 1054178825Sdfr } 1055178825Sdfr 1056178825Sdfr else 1057178825Sdfr { 1058178825Sdfr ret_val = EOB_ACT_LAST_MATCH; 1059178825Sdfr YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = 1060178825Sdfr YY_BUFFER_EOF_PENDING; 1061178825Sdfr } 1062178825Sdfr } 1063178825Sdfr 1064178825Sdfr else 1065178825Sdfr ret_val = EOB_ACT_CONTINUE_SCAN; 1066178825Sdfr 1067233294Sstas if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { 1068233294Sstas /* Extend the array by 50%, plus the number we really need. */ 1069233294Sstas yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); 1070233294Sstas YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); 1071233294Sstas if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 1072233294Sstas YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); 1073233294Sstas } 1074233294Sstas 1075178825Sdfr (yy_n_chars) += number_to_move; 1076178825Sdfr YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; 1077178825Sdfr YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; 1078178825Sdfr 1079178825Sdfr (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; 1080178825Sdfr 1081178825Sdfr return ret_val; 1082178825Sdfr} 1083178825Sdfr 1084178825Sdfr/* yy_get_previous_state - get the state just before the EOB char was reached */ 1085178825Sdfr 1086178825Sdfr static yy_state_type yy_get_previous_state (void) 1087178825Sdfr{ 1088178825Sdfr register yy_state_type yy_current_state; 1089178825Sdfr register char *yy_cp; 1090178825Sdfr 1091178825Sdfr yy_current_state = (yy_start); 1092178825Sdfr 1093178825Sdfr for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) 1094178825Sdfr { 1095178825Sdfr register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); 1096178825Sdfr if ( yy_accept[yy_current_state] ) 1097178825Sdfr { 1098178825Sdfr (yy_last_accepting_state) = yy_current_state; 1099178825Sdfr (yy_last_accepting_cpos) = yy_cp; 1100178825Sdfr } 1101178825Sdfr while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1102178825Sdfr { 1103178825Sdfr yy_current_state = (int) yy_def[yy_current_state]; 1104178825Sdfr if ( yy_current_state >= 14 ) 1105178825Sdfr yy_c = yy_meta[(unsigned int) yy_c]; 1106178825Sdfr } 1107178825Sdfr yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1108178825Sdfr } 1109178825Sdfr 1110178825Sdfr return yy_current_state; 1111178825Sdfr} 1112178825Sdfr 1113178825Sdfr/* yy_try_NUL_trans - try to make a transition on the NUL character 1114178825Sdfr * 1115178825Sdfr * synopsis 1116178825Sdfr * next_state = yy_try_NUL_trans( current_state ); 1117178825Sdfr */ 1118178825Sdfr static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) 1119178825Sdfr{ 1120178825Sdfr register int yy_is_jam; 1121178825Sdfr register char *yy_cp = (yy_c_buf_p); 1122178825Sdfr 1123178825Sdfr register YY_CHAR yy_c = 1; 1124178825Sdfr if ( yy_accept[yy_current_state] ) 1125178825Sdfr { 1126178825Sdfr (yy_last_accepting_state) = yy_current_state; 1127178825Sdfr (yy_last_accepting_cpos) = yy_cp; 1128178825Sdfr } 1129178825Sdfr while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1130178825Sdfr { 1131178825Sdfr yy_current_state = (int) yy_def[yy_current_state]; 1132178825Sdfr if ( yy_current_state >= 14 ) 1133178825Sdfr yy_c = yy_meta[(unsigned int) yy_c]; 1134178825Sdfr } 1135178825Sdfr yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1136178825Sdfr yy_is_jam = (yy_current_state == 13); 1137178825Sdfr 1138178825Sdfr return yy_is_jam ? 0 : yy_current_state; 1139178825Sdfr} 1140178825Sdfr 1141178825Sdfr#ifndef YY_NO_INPUT 1142178825Sdfr#ifdef __cplusplus 1143178825Sdfr static int yyinput (void) 1144178825Sdfr#else 1145178825Sdfr static int input (void) 1146178825Sdfr#endif 1147178825Sdfr 1148178825Sdfr{ 1149178825Sdfr int c; 1150178825Sdfr 1151178825Sdfr *(yy_c_buf_p) = (yy_hold_char); 1152178825Sdfr 1153178825Sdfr if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) 1154178825Sdfr { 1155178825Sdfr /* yy_c_buf_p now points to the character we want to return. 1156178825Sdfr * If this occurs *before* the EOB characters, then it's a 1157178825Sdfr * valid NUL; if not, then we've hit the end of the buffer. 1158178825Sdfr */ 1159178825Sdfr if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) 1160178825Sdfr /* This was really a NUL. */ 1161178825Sdfr *(yy_c_buf_p) = '\0'; 1162178825Sdfr 1163178825Sdfr else 1164178825Sdfr { /* need more input */ 1165233294Sstas yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); 1166178825Sdfr ++(yy_c_buf_p); 1167178825Sdfr 1168178825Sdfr switch ( yy_get_next_buffer( ) ) 1169178825Sdfr { 1170178825Sdfr case EOB_ACT_LAST_MATCH: 1171178825Sdfr /* This happens because yy_g_n_b() 1172178825Sdfr * sees that we've accumulated a 1173178825Sdfr * token and flags that we need to 1174178825Sdfr * try matching the token before 1175178825Sdfr * proceeding. But for input(), 1176178825Sdfr * there's no matching to consider. 1177178825Sdfr * So convert the EOB_ACT_LAST_MATCH 1178178825Sdfr * to EOB_ACT_END_OF_FILE. 1179178825Sdfr */ 1180178825Sdfr 1181178825Sdfr /* Reset buffer status. */ 1182178825Sdfr yyrestart(yyin ); 1183178825Sdfr 1184178825Sdfr /*FALLTHROUGH*/ 1185178825Sdfr 1186178825Sdfr case EOB_ACT_END_OF_FILE: 1187178825Sdfr { 1188178825Sdfr if ( yywrap( ) ) 1189178825Sdfr return 0; 1190178825Sdfr 1191178825Sdfr if ( ! (yy_did_buffer_switch_on_eof) ) 1192178825Sdfr YY_NEW_FILE; 1193178825Sdfr#ifdef __cplusplus 1194178825Sdfr return yyinput(); 1195178825Sdfr#else 1196178825Sdfr return input(); 1197178825Sdfr#endif 1198178825Sdfr } 1199178825Sdfr 1200178825Sdfr case EOB_ACT_CONTINUE_SCAN: 1201178825Sdfr (yy_c_buf_p) = (yytext_ptr) + offset; 1202178825Sdfr break; 1203178825Sdfr } 1204178825Sdfr } 1205178825Sdfr } 1206178825Sdfr 1207178825Sdfr c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ 1208178825Sdfr *(yy_c_buf_p) = '\0'; /* preserve yytext */ 1209178825Sdfr (yy_hold_char) = *++(yy_c_buf_p); 1210178825Sdfr 1211178825Sdfr return c; 1212178825Sdfr} 1213178825Sdfr#endif /* ifndef YY_NO_INPUT */ 1214178825Sdfr 1215178825Sdfr/** Immediately switch to a different input stream. 1216178825Sdfr * @param input_file A readable stream. 1217178825Sdfr * 1218178825Sdfr * @note This function does not reset the start condition to @c INITIAL . 1219178825Sdfr */ 1220178825Sdfr void yyrestart (FILE * input_file ) 1221178825Sdfr{ 1222178825Sdfr 1223178825Sdfr if ( ! YY_CURRENT_BUFFER ){ 1224178825Sdfr yyensure_buffer_stack (); 1225178825Sdfr YY_CURRENT_BUFFER_LVALUE = 1226178825Sdfr yy_create_buffer(yyin,YY_BUF_SIZE ); 1227178825Sdfr } 1228178825Sdfr 1229178825Sdfr yy_init_buffer(YY_CURRENT_BUFFER,input_file ); 1230178825Sdfr yy_load_buffer_state( ); 1231178825Sdfr} 1232178825Sdfr 1233178825Sdfr/** Switch to a different input buffer. 1234178825Sdfr * @param new_buffer The new input buffer. 1235178825Sdfr * 1236178825Sdfr */ 1237178825Sdfr void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) 1238178825Sdfr{ 1239178825Sdfr 1240178825Sdfr /* TODO. We should be able to replace this entire function body 1241178825Sdfr * with 1242178825Sdfr * yypop_buffer_state(); 1243178825Sdfr * yypush_buffer_state(new_buffer); 1244178825Sdfr */ 1245178825Sdfr yyensure_buffer_stack (); 1246178825Sdfr if ( YY_CURRENT_BUFFER == new_buffer ) 1247178825Sdfr return; 1248178825Sdfr 1249178825Sdfr if ( YY_CURRENT_BUFFER ) 1250178825Sdfr { 1251178825Sdfr /* Flush out information for old buffer. */ 1252178825Sdfr *(yy_c_buf_p) = (yy_hold_char); 1253178825Sdfr YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); 1254178825Sdfr YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1255178825Sdfr } 1256178825Sdfr 1257178825Sdfr YY_CURRENT_BUFFER_LVALUE = new_buffer; 1258178825Sdfr yy_load_buffer_state( ); 1259178825Sdfr 1260178825Sdfr /* We don't actually know whether we did this switch during 1261178825Sdfr * EOF (yywrap()) processing, but the only time this flag 1262178825Sdfr * is looked at is after yywrap() is called, so it's safe 1263178825Sdfr * to go ahead and always set it. 1264178825Sdfr */ 1265178825Sdfr (yy_did_buffer_switch_on_eof) = 1; 1266178825Sdfr} 1267178825Sdfr 1268178825Sdfrstatic void yy_load_buffer_state (void) 1269178825Sdfr{ 1270178825Sdfr (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1271178825Sdfr (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; 1272178825Sdfr yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; 1273178825Sdfr (yy_hold_char) = *(yy_c_buf_p); 1274178825Sdfr} 1275178825Sdfr 1276178825Sdfr/** Allocate and initialize an input buffer state. 1277178825Sdfr * @param file A readable stream. 1278178825Sdfr * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. 1279178825Sdfr * 1280178825Sdfr * @return the allocated buffer state. 1281178825Sdfr */ 1282178825Sdfr YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) 1283178825Sdfr{ 1284178825Sdfr YY_BUFFER_STATE b; 1285178825Sdfr 1286178825Sdfr b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); 1287178825Sdfr if ( ! b ) 1288178825Sdfr YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 1289178825Sdfr 1290178825Sdfr b->yy_buf_size = size; 1291178825Sdfr 1292178825Sdfr /* yy_ch_buf has to be 2 characters longer than the size given because 1293178825Sdfr * we need to put in 2 end-of-buffer characters. 1294178825Sdfr */ 1295178825Sdfr b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); 1296178825Sdfr if ( ! b->yy_ch_buf ) 1297178825Sdfr YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 1298178825Sdfr 1299178825Sdfr b->yy_is_our_buffer = 1; 1300178825Sdfr 1301178825Sdfr yy_init_buffer(b,file ); 1302178825Sdfr 1303178825Sdfr return b; 1304178825Sdfr} 1305178825Sdfr 1306178825Sdfr/** Destroy the buffer. 1307178825Sdfr * @param b a buffer created with yy_create_buffer() 1308178825Sdfr * 1309178825Sdfr */ 1310178825Sdfr void yy_delete_buffer (YY_BUFFER_STATE b ) 1311178825Sdfr{ 1312178825Sdfr 1313178825Sdfr if ( ! b ) 1314178825Sdfr return; 1315178825Sdfr 1316178825Sdfr if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ 1317178825Sdfr YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; 1318178825Sdfr 1319178825Sdfr if ( b->yy_is_our_buffer ) 1320178825Sdfr yyfree((void *) b->yy_ch_buf ); 1321178825Sdfr 1322178825Sdfr yyfree((void *) b ); 1323178825Sdfr} 1324178825Sdfr 1325178825Sdfr#ifndef __cplusplus 1326178825Sdfrextern int isatty (int ); 1327178825Sdfr#endif /* __cplusplus */ 1328178825Sdfr 1329178825Sdfr/* Initializes or reinitializes a buffer. 1330178825Sdfr * This function is sometimes called more than once on the same buffer, 1331178825Sdfr * such as during a yyrestart() or at EOF. 1332178825Sdfr */ 1333178825Sdfr static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) 1334178825Sdfr 1335178825Sdfr{ 1336178825Sdfr int oerrno = errno; 1337178825Sdfr 1338178825Sdfr yy_flush_buffer(b ); 1339178825Sdfr 1340178825Sdfr b->yy_input_file = file; 1341178825Sdfr b->yy_fill_buffer = 1; 1342178825Sdfr 1343178825Sdfr /* If b is the current buffer, then yy_init_buffer was _probably_ 1344178825Sdfr * called from yyrestart() or through yy_get_next_buffer. 1345178825Sdfr * In that case, we don't want to reset the lineno or column. 1346178825Sdfr */ 1347178825Sdfr if (b != YY_CURRENT_BUFFER){ 1348178825Sdfr b->yy_bs_lineno = 1; 1349178825Sdfr b->yy_bs_column = 0; 1350178825Sdfr } 1351178825Sdfr 1352178825Sdfr b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; 1353178825Sdfr 1354178825Sdfr errno = oerrno; 1355178825Sdfr} 1356178825Sdfr 1357178825Sdfr/** Discard all buffered characters. On the next scan, YY_INPUT will be called. 1358178825Sdfr * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. 1359178825Sdfr * 1360178825Sdfr */ 1361178825Sdfr void yy_flush_buffer (YY_BUFFER_STATE b ) 1362178825Sdfr{ 1363178825Sdfr if ( ! b ) 1364178825Sdfr return; 1365178825Sdfr 1366178825Sdfr b->yy_n_chars = 0; 1367178825Sdfr 1368178825Sdfr /* We always need two end-of-buffer characters. The first causes 1369178825Sdfr * a transition to the end-of-buffer state. The second causes 1370178825Sdfr * a jam in that state. 1371178825Sdfr */ 1372178825Sdfr b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; 1373178825Sdfr b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; 1374178825Sdfr 1375178825Sdfr b->yy_buf_pos = &b->yy_ch_buf[0]; 1376178825Sdfr 1377178825Sdfr b->yy_at_bol = 1; 1378178825Sdfr b->yy_buffer_status = YY_BUFFER_NEW; 1379178825Sdfr 1380178825Sdfr if ( b == YY_CURRENT_BUFFER ) 1381178825Sdfr yy_load_buffer_state( ); 1382178825Sdfr} 1383178825Sdfr 1384178825Sdfr/** Pushes the new state onto the stack. The new state becomes 1385178825Sdfr * the current state. This function will allocate the stack 1386178825Sdfr * if necessary. 1387178825Sdfr * @param new_buffer The new state. 1388178825Sdfr * 1389178825Sdfr */ 1390178825Sdfrvoid yypush_buffer_state (YY_BUFFER_STATE new_buffer ) 1391178825Sdfr{ 1392178825Sdfr if (new_buffer == NULL) 1393178825Sdfr return; 1394178825Sdfr 1395178825Sdfr yyensure_buffer_stack(); 1396178825Sdfr 1397178825Sdfr /* This block is copied from yy_switch_to_buffer. */ 1398178825Sdfr if ( YY_CURRENT_BUFFER ) 1399178825Sdfr { 1400178825Sdfr /* Flush out information for old buffer. */ 1401178825Sdfr *(yy_c_buf_p) = (yy_hold_char); 1402178825Sdfr YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); 1403178825Sdfr YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1404178825Sdfr } 1405178825Sdfr 1406178825Sdfr /* Only push if top exists. Otherwise, replace top. */ 1407178825Sdfr if (YY_CURRENT_BUFFER) 1408178825Sdfr (yy_buffer_stack_top)++; 1409178825Sdfr YY_CURRENT_BUFFER_LVALUE = new_buffer; 1410178825Sdfr 1411178825Sdfr /* copied from yy_switch_to_buffer. */ 1412178825Sdfr yy_load_buffer_state( ); 1413178825Sdfr (yy_did_buffer_switch_on_eof) = 1; 1414178825Sdfr} 1415178825Sdfr 1416178825Sdfr/** Removes and deletes the top of the stack, if present. 1417178825Sdfr * The next element becomes the new top. 1418178825Sdfr * 1419178825Sdfr */ 1420178825Sdfrvoid yypop_buffer_state (void) 1421178825Sdfr{ 1422178825Sdfr if (!YY_CURRENT_BUFFER) 1423178825Sdfr return; 1424178825Sdfr 1425178825Sdfr yy_delete_buffer(YY_CURRENT_BUFFER ); 1426178825Sdfr YY_CURRENT_BUFFER_LVALUE = NULL; 1427178825Sdfr if ((yy_buffer_stack_top) > 0) 1428178825Sdfr --(yy_buffer_stack_top); 1429178825Sdfr 1430178825Sdfr if (YY_CURRENT_BUFFER) { 1431178825Sdfr yy_load_buffer_state( ); 1432178825Sdfr (yy_did_buffer_switch_on_eof) = 1; 1433178825Sdfr } 1434178825Sdfr} 1435178825Sdfr 1436178825Sdfr/* Allocates the stack if it does not exist. 1437178825Sdfr * Guarantees space for at least one push. 1438178825Sdfr */ 1439178825Sdfrstatic void yyensure_buffer_stack (void) 1440178825Sdfr{ 1441233294Sstas yy_size_t num_to_alloc; 1442178825Sdfr 1443178825Sdfr if (!(yy_buffer_stack)) { 1444178825Sdfr 1445178825Sdfr /* First allocation is just for 2 elements, since we don't know if this 1446178825Sdfr * scanner will even need a stack. We use 2 instead of 1 to avoid an 1447178825Sdfr * immediate realloc on the next call. 1448178825Sdfr */ 1449178825Sdfr num_to_alloc = 1; 1450178825Sdfr (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc 1451178825Sdfr (num_to_alloc * sizeof(struct yy_buffer_state*) 1452178825Sdfr ); 1453233294Sstas if ( ! (yy_buffer_stack) ) 1454233294Sstas YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); 1455233294Sstas 1456178825Sdfr memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 1457178825Sdfr 1458178825Sdfr (yy_buffer_stack_max) = num_to_alloc; 1459178825Sdfr (yy_buffer_stack_top) = 0; 1460178825Sdfr return; 1461178825Sdfr } 1462178825Sdfr 1463178825Sdfr if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ 1464178825Sdfr 1465178825Sdfr /* Increase the buffer to prepare for a possible push. */ 1466178825Sdfr int grow_size = 8 /* arbitrary grow size */; 1467178825Sdfr 1468178825Sdfr num_to_alloc = (yy_buffer_stack_max) + grow_size; 1469178825Sdfr (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc 1470178825Sdfr ((yy_buffer_stack), 1471178825Sdfr num_to_alloc * sizeof(struct yy_buffer_state*) 1472178825Sdfr ); 1473233294Sstas if ( ! (yy_buffer_stack) ) 1474233294Sstas YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); 1475178825Sdfr 1476178825Sdfr /* zero only the new slots.*/ 1477178825Sdfr memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); 1478178825Sdfr (yy_buffer_stack_max) = num_to_alloc; 1479178825Sdfr } 1480178825Sdfr} 1481178825Sdfr 1482178825Sdfr/** Setup the input buffer state to scan directly from a user-specified character buffer. 1483178825Sdfr * @param base the character buffer 1484178825Sdfr * @param size the size in bytes of the character buffer 1485178825Sdfr * 1486178825Sdfr * @return the newly allocated buffer state object. 1487178825Sdfr */ 1488178825SdfrYY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) 1489178825Sdfr{ 1490178825Sdfr YY_BUFFER_STATE b; 1491178825Sdfr 1492178825Sdfr if ( size < 2 || 1493178825Sdfr base[size-2] != YY_END_OF_BUFFER_CHAR || 1494178825Sdfr base[size-1] != YY_END_OF_BUFFER_CHAR ) 1495178825Sdfr /* They forgot to leave room for the EOB's. */ 1496178825Sdfr return 0; 1497178825Sdfr 1498178825Sdfr b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); 1499178825Sdfr if ( ! b ) 1500178825Sdfr YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); 1501178825Sdfr 1502178825Sdfr b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ 1503178825Sdfr b->yy_buf_pos = b->yy_ch_buf = base; 1504178825Sdfr b->yy_is_our_buffer = 0; 1505178825Sdfr b->yy_input_file = 0; 1506178825Sdfr b->yy_n_chars = b->yy_buf_size; 1507178825Sdfr b->yy_is_interactive = 0; 1508178825Sdfr b->yy_at_bol = 1; 1509178825Sdfr b->yy_fill_buffer = 0; 1510178825Sdfr b->yy_buffer_status = YY_BUFFER_NEW; 1511178825Sdfr 1512178825Sdfr yy_switch_to_buffer(b ); 1513178825Sdfr 1514178825Sdfr return b; 1515178825Sdfr} 1516178825Sdfr 1517178825Sdfr/** Setup the input buffer state to scan a string. The next call to yylex() will 1518178825Sdfr * scan from a @e copy of @a str. 1519233294Sstas * @param yystr a NUL-terminated string to scan 1520178825Sdfr * 1521178825Sdfr * @return the newly allocated buffer state object. 1522178825Sdfr * @note If you want to scan bytes that may contain NUL values, then use 1523178825Sdfr * yy_scan_bytes() instead. 1524178825Sdfr */ 1525178825SdfrYY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) 1526178825Sdfr{ 1527178825Sdfr 1528178825Sdfr return yy_scan_bytes(yystr,strlen(yystr) ); 1529178825Sdfr} 1530178825Sdfr 1531178825Sdfr/** Setup the input buffer state to scan the given bytes. The next call to yylex() will 1532178825Sdfr * scan from a @e copy of @a bytes. 1533178825Sdfr * @param bytes the byte buffer to scan 1534178825Sdfr * @param len the number of bytes in the buffer pointed to by @a bytes. 1535178825Sdfr * 1536178825Sdfr * @return the newly allocated buffer state object. 1537178825Sdfr */ 1538233294SstasYY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) 1539178825Sdfr{ 1540178825Sdfr YY_BUFFER_STATE b; 1541178825Sdfr char *buf; 1542233294Sstas yy_size_t n, i; 1543178825Sdfr 1544178825Sdfr /* Get memory for full buffer, including space for trailing EOB's. */ 1545178825Sdfr n = _yybytes_len + 2; 1546178825Sdfr buf = (char *) yyalloc(n ); 1547178825Sdfr if ( ! buf ) 1548178825Sdfr YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); 1549178825Sdfr 1550178825Sdfr for ( i = 0; i < _yybytes_len; ++i ) 1551178825Sdfr buf[i] = yybytes[i]; 1552178825Sdfr 1553178825Sdfr buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; 1554178825Sdfr 1555178825Sdfr b = yy_scan_buffer(buf,n ); 1556178825Sdfr if ( ! b ) 1557178825Sdfr YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); 1558178825Sdfr 1559178825Sdfr /* It's okay to grow etc. this buffer, and we should throw it 1560178825Sdfr * away when we're done. 1561178825Sdfr */ 1562178825Sdfr b->yy_is_our_buffer = 1; 1563178825Sdfr 1564178825Sdfr return b; 1565178825Sdfr} 1566178825Sdfr 1567178825Sdfr#ifndef YY_EXIT_FAILURE 1568178825Sdfr#define YY_EXIT_FAILURE 2 1569178825Sdfr#endif 1570178825Sdfr 1571178825Sdfrstatic void yy_fatal_error (yyconst char* msg ) 1572178825Sdfr{ 1573178825Sdfr (void) fprintf( stderr, "%s\n", msg ); 1574178825Sdfr exit( YY_EXIT_FAILURE ); 1575178825Sdfr} 1576178825Sdfr 1577178825Sdfr/* Redefine yyless() so it works in section 3 code. */ 1578178825Sdfr 1579178825Sdfr#undef yyless 1580178825Sdfr#define yyless(n) \ 1581178825Sdfr do \ 1582178825Sdfr { \ 1583178825Sdfr /* Undo effects of setting up yytext. */ \ 1584178825Sdfr int yyless_macro_arg = (n); \ 1585178825Sdfr YY_LESS_LINENO(yyless_macro_arg);\ 1586178825Sdfr yytext[yyleng] = (yy_hold_char); \ 1587178825Sdfr (yy_c_buf_p) = yytext + yyless_macro_arg; \ 1588178825Sdfr (yy_hold_char) = *(yy_c_buf_p); \ 1589178825Sdfr *(yy_c_buf_p) = '\0'; \ 1590178825Sdfr yyleng = yyless_macro_arg; \ 1591178825Sdfr } \ 1592178825Sdfr while ( 0 ) 1593178825Sdfr 1594178825Sdfr/* Accessor methods (get/set functions) to struct members. */ 1595178825Sdfr 1596178825Sdfr/** Get the current line number. 1597178825Sdfr * 1598178825Sdfr */ 1599178825Sdfrint yyget_lineno (void) 1600178825Sdfr{ 1601178825Sdfr 1602178825Sdfr return yylineno; 1603178825Sdfr} 1604178825Sdfr 1605178825Sdfr/** Get the input stream. 1606178825Sdfr * 1607178825Sdfr */ 1608178825SdfrFILE *yyget_in (void) 1609178825Sdfr{ 1610178825Sdfr return yyin; 1611178825Sdfr} 1612178825Sdfr 1613178825Sdfr/** Get the output stream. 1614178825Sdfr * 1615178825Sdfr */ 1616178825SdfrFILE *yyget_out (void) 1617178825Sdfr{ 1618178825Sdfr return yyout; 1619178825Sdfr} 1620178825Sdfr 1621178825Sdfr/** Get the length of the current token. 1622178825Sdfr * 1623178825Sdfr */ 1624233294Sstasyy_size_t yyget_leng (void) 1625178825Sdfr{ 1626178825Sdfr return yyleng; 1627178825Sdfr} 1628178825Sdfr 1629178825Sdfr/** Get the current token. 1630178825Sdfr * 1631178825Sdfr */ 1632178825Sdfr 1633178825Sdfrchar *yyget_text (void) 1634178825Sdfr{ 1635178825Sdfr return yytext; 1636178825Sdfr} 1637178825Sdfr 1638178825Sdfr/** Set the current line number. 1639178825Sdfr * @param line_number 1640178825Sdfr * 1641178825Sdfr */ 1642178825Sdfrvoid yyset_lineno (int line_number ) 1643178825Sdfr{ 1644178825Sdfr 1645178825Sdfr yylineno = line_number; 1646178825Sdfr} 1647178825Sdfr 1648178825Sdfr/** Set the input stream. This does not discard the current 1649178825Sdfr * input buffer. 1650178825Sdfr * @param in_str A readable stream. 1651178825Sdfr * 1652178825Sdfr * @see yy_switch_to_buffer 1653178825Sdfr */ 1654178825Sdfrvoid yyset_in (FILE * in_str ) 1655178825Sdfr{ 1656178825Sdfr yyin = in_str ; 1657178825Sdfr} 1658178825Sdfr 1659178825Sdfrvoid yyset_out (FILE * out_str ) 1660178825Sdfr{ 1661178825Sdfr yyout = out_str ; 1662178825Sdfr} 1663178825Sdfr 1664178825Sdfrint yyget_debug (void) 1665178825Sdfr{ 1666178825Sdfr return yy_flex_debug; 1667178825Sdfr} 1668178825Sdfr 1669178825Sdfrvoid yyset_debug (int bdebug ) 1670178825Sdfr{ 1671178825Sdfr yy_flex_debug = bdebug ; 1672178825Sdfr} 1673178825Sdfr 1674178825Sdfrstatic int yy_init_globals (void) 1675178825Sdfr{ 1676178825Sdfr /* Initialization is the same as for the non-reentrant scanner. 1677178825Sdfr * This function is called from yylex_destroy(), so don't allocate here. 1678178825Sdfr */ 1679178825Sdfr 1680178825Sdfr (yy_buffer_stack) = 0; 1681178825Sdfr (yy_buffer_stack_top) = 0; 1682178825Sdfr (yy_buffer_stack_max) = 0; 1683178825Sdfr (yy_c_buf_p) = (char *) 0; 1684178825Sdfr (yy_init) = 0; 1685178825Sdfr (yy_start) = 0; 1686178825Sdfr 1687178825Sdfr/* Defined in main.c */ 1688178825Sdfr#ifdef YY_STDINIT 1689178825Sdfr yyin = stdin; 1690178825Sdfr yyout = stdout; 1691178825Sdfr#else 1692178825Sdfr yyin = (FILE *) 0; 1693178825Sdfr yyout = (FILE *) 0; 1694178825Sdfr#endif 1695178825Sdfr 1696178825Sdfr /* For future reference: Set errno on error, since we are called by 1697178825Sdfr * yylex_init() 1698178825Sdfr */ 1699178825Sdfr return 0; 1700178825Sdfr} 1701178825Sdfr 1702178825Sdfr/* yylex_destroy is for both reentrant and non-reentrant scanners. */ 1703178825Sdfrint yylex_destroy (void) 1704178825Sdfr{ 1705178825Sdfr 1706178825Sdfr /* Pop the buffer stack, destroying each element. */ 1707178825Sdfr while(YY_CURRENT_BUFFER){ 1708178825Sdfr yy_delete_buffer(YY_CURRENT_BUFFER ); 1709178825Sdfr YY_CURRENT_BUFFER_LVALUE = NULL; 1710178825Sdfr yypop_buffer_state(); 1711178825Sdfr } 1712178825Sdfr 1713178825Sdfr /* Destroy the stack itself. */ 1714178825Sdfr yyfree((yy_buffer_stack) ); 1715178825Sdfr (yy_buffer_stack) = NULL; 1716178825Sdfr 1717178825Sdfr /* Reset the globals. This is important in a non-reentrant scanner so the next time 1718178825Sdfr * yylex() is called, initialization will occur. */ 1719178825Sdfr yy_init_globals( ); 1720178825Sdfr 1721178825Sdfr return 0; 1722178825Sdfr} 1723178825Sdfr 1724178825Sdfr/* 1725178825Sdfr * Internal utility routines. 1726178825Sdfr */ 1727178825Sdfr 1728178825Sdfr#ifndef yytext_ptr 1729178825Sdfrstatic void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) 1730178825Sdfr{ 1731178825Sdfr register int i; 1732178825Sdfr for ( i = 0; i < n; ++i ) 1733178825Sdfr s1[i] = s2[i]; 1734178825Sdfr} 1735178825Sdfr#endif 1736178825Sdfr 1737178825Sdfr#ifdef YY_NEED_STRLEN 1738178825Sdfrstatic int yy_flex_strlen (yyconst char * s ) 1739178825Sdfr{ 1740178825Sdfr register int n; 1741178825Sdfr for ( n = 0; s[n]; ++n ) 1742178825Sdfr ; 1743178825Sdfr 1744178825Sdfr return n; 1745178825Sdfr} 1746178825Sdfr#endif 1747178825Sdfr 1748178825Sdfrvoid *yyalloc (yy_size_t size ) 1749178825Sdfr{ 1750178825Sdfr return (void *) malloc( size ); 1751178825Sdfr} 1752178825Sdfr 1753178825Sdfrvoid *yyrealloc (void * ptr, yy_size_t size ) 1754178825Sdfr{ 1755178825Sdfr /* The cast to (char *) in the following accommodates both 1756178825Sdfr * implementations that use char* generic pointers, and those 1757178825Sdfr * that use void* generic pointers. It works with the latter 1758178825Sdfr * because both ANSI C and C++ allow castless assignment from 1759178825Sdfr * any pointer type to void*, and deal with argument conversions 1760178825Sdfr * as though doing an assignment. 1761178825Sdfr */ 1762178825Sdfr return (void *) realloc( (char *) ptr, size ); 1763178825Sdfr} 1764178825Sdfr 1765178825Sdfrvoid yyfree (void * ptr ) 1766178825Sdfr{ 1767178825Sdfr free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ 1768178825Sdfr} 1769178825Sdfr 1770178825Sdfr#define YYTABLES_NAME "yytables" 1771178825Sdfr 1772233294Sstas#line 68 "slc-lex.l" 1773178825Sdfr 1774178825Sdfr 1775178825Sdfr 1776178825Sdfrvoid 1777178825Sdfrerror_message (const char *format, ...) 1778178825Sdfr{ 1779178825Sdfr va_list args; 1780178825Sdfr 1781178825Sdfr va_start (args, format); 1782178825Sdfr fprintf (stderr, "%s:%d: ", filename, lineno); 1783178825Sdfr vfprintf (stderr, format, args); 1784178825Sdfr va_end (args); 1785178825Sdfr error_flag++; 1786178825Sdfr} 1787178825Sdfr 1788178825Sdfrvoid 1789178825Sdfryyerror (char *s) 1790178825Sdfr{ 1791178825Sdfr error_message("%s\n", s); 1792178825Sdfr} 1793178825Sdfr 1794178825Sdfrstatic void 1795178825Sdfrhandle_comment(void) 1796178825Sdfr{ 1797178825Sdfr int c; 1798178825Sdfr int start_lineno = lineno; 1799178825Sdfr int level = 1; 1800178825Sdfr int seen_star = 0; 1801178825Sdfr int seen_slash = 0; 1802178825Sdfr while((c = input()) != EOF) { 1803178825Sdfr if(c == '/') { 1804178825Sdfr if(seen_star) { 1805178825Sdfr if(--level == 0) 1806178825Sdfr return; 1807178825Sdfr seen_star = 0; 1808178825Sdfr continue; 1809178825Sdfr } 1810178825Sdfr seen_slash = 1; 1811178825Sdfr continue; 1812233294Sstas } else if(c == '*') { 1813178825Sdfr if(seen_slash) { 1814178825Sdfr level++; 1815178825Sdfr seen_star = seen_slash = 0; 1816178825Sdfr continue; 1817233294Sstas } 1818178825Sdfr seen_star = 1; 1819178825Sdfr continue; 1820178825Sdfr } 1821178825Sdfr seen_star = seen_slash = 0; 1822178825Sdfr if(c == '\n') { 1823178825Sdfr lineno++; 1824178825Sdfr continue; 1825178825Sdfr } 1826178825Sdfr } 1827178825Sdfr if(c == EOF) 1828178825Sdfr error_message("unterminated comment, possibly started on line %d\n", start_lineno); 1829178825Sdfr} 1830178825Sdfr 1831178825Sdfrstatic char * 1832178825Sdfrhandle_string(void) 1833178825Sdfr{ 1834178825Sdfr char x[1024]; 1835178825Sdfr int i = 0; 1836178825Sdfr int c; 1837178825Sdfr int quote = 0; 1838178825Sdfr while((c = input()) != EOF){ 1839178825Sdfr if(quote) { 1840178825Sdfr x[i++] = '\\'; 1841178825Sdfr x[i++] = c; 1842178825Sdfr quote = 0; 1843178825Sdfr continue; 1844178825Sdfr } 1845178825Sdfr if(c == '\n'){ 1846178825Sdfr error_message("unterminated string"); 1847178825Sdfr lineno++; 1848178825Sdfr break; 1849178825Sdfr } 1850178825Sdfr if(c == '\\'){ 1851178825Sdfr quote++; 1852178825Sdfr continue; 1853178825Sdfr } 1854178825Sdfr if(c == '\"') 1855178825Sdfr break; 1856178825Sdfr x[i++] = c; 1857178825Sdfr } 1858178825Sdfr x[i] = '\0'; 1859178825Sdfr return strdup(x); 1860178825Sdfr} 1861178825Sdfr 1862178825Sdfrint 1863233294Sstasyywrap () 1864178825Sdfr{ 1865178825Sdfr return 1; 1866178825Sdfr} 1867178825Sdfr 1868