1223637Sbz#line 1 "tokenizer.c" 2126258Smlaier 3126258Smlaier#line 3 "tokenizer.c" 4126258Smlaier 5130613Smlaier#define YY_INT_ALIGNED short int 6126258Smlaier 7126258Smlaier/* A lexical scanner generated by flex */ 8126258Smlaier 9126258Smlaier#define FLEX_SCANNER 10126258Smlaier#define YY_FLEX_MAJOR_VERSION 2 11126258Smlaier#define YY_FLEX_MINOR_VERSION 6 12126258Smlaier#define YY_FLEX_SUBMINOR_VERSION 4 13126258Smlaier#if YY_FLEX_SUBMINOR_VERSION > 0 14126258Smlaier#define FLEX_BETA 15126258Smlaier#endif 16126258Smlaier 17126258Smlaier/* First, we deal with platform-specific or compiler-specific issues. */ 18126258Smlaier 19126258Smlaier/* begin standard C headers. */ 20126258Smlaier#include <stdio.h> 21126258Smlaier#include <string.h> 22126258Smlaier#include <errno.h> 23126258Smlaier#include <stdlib.h> 24126258Smlaier 25126258Smlaier/* end standard C headers. */ 26126258Smlaier 27126258Smlaier/* flex integer type definitions */ 28126258Smlaier 29126258Smlaier#ifndef FLEXINT_H 30126258Smlaier#define FLEXINT_H 31126258Smlaier 32126258Smlaier/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ 33126258Smlaier 34126258Smlaier#if defined(__FreeBSD__) || \ 35126258Smlaier (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) 36126258Smlaier 37126258Smlaier/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, 38127145Smlaier * if you want the limit (max/min) macros for int types. 39171168Smlaier */ 40171168Smlaier#ifndef __STDC_LIMIT_MACROS 41126261Smlaier#define __STDC_LIMIT_MACROS 1 42189106Sbz#endif 43189106Sbz 44130613Smlaier#include <inttypes.h> 45130613Smlaiertypedef int8_t flex_int8_t; 46153110Srutypedef uint8_t flex_uint8_t; 47230868Sglebiustypedef int16_t flex_int16_t; 48153110Srutypedef uint16_t flex_uint16_t; 49153110Srutypedef int32_t flex_int32_t; 50223637Sbztypedef uint32_t flex_uint32_t; 51153110Sru#else 52223637Sbztypedef signed char flex_int8_t; 53153110Srutypedef short int flex_int16_t; 54153110Srutypedef int flex_int32_t; 55230868Sglebiustypedef unsigned char flex_uint8_t; 56223637Sbztypedef unsigned short int flex_uint16_t; 57130613Smlaiertypedef unsigned int flex_uint32_t; 58230868Sglebius 59130613Smlaier/* Limits of integral types. */ 60126258Smlaier#ifndef INT8_MIN 61126258Smlaier#define INT8_MIN (-128) 62126258Smlaier#endif 63126258Smlaier#ifndef INT16_MIN 64126258Smlaier#define INT16_MIN (-32767-1) 65126258Smlaier#endif 66126258Smlaier#ifndef INT32_MIN 67126258Smlaier#define INT32_MIN (-2147483647-1) 68126258Smlaier#endif 69127145Smlaier#ifndef INT8_MAX 70223637Sbz#define INT8_MAX (127) 71223637Sbz#endif 72129907Smlaier#ifndef INT16_MAX 73126261Smlaier#define INT16_MAX (32767) 74134166Smlaier#endif 75171168Smlaier#ifndef INT32_MAX 76126261Smlaier#define INT32_MAX (2147483647) 77126258Smlaier#endif 78126258Smlaier#ifndef UINT8_MAX 79126261Smlaier#define UINT8_MAX (255U) 80171168Smlaier#endif 81171168Smlaier#ifndef UINT16_MAX 82171168Smlaier#define UINT16_MAX (65535U) 83171168Smlaier#endif 84171168Smlaier#ifndef UINT32_MAX 85171168Smlaier#define UINT32_MAX (4294967295U) 86171168Smlaier#endif 87126258Smlaier 88126258Smlaier#ifndef SIZE_MAX 89126258Smlaier#define SIZE_MAX (~(size_t)0) 90185571Sbz#endif 91185571Sbz 92185571Sbz#endif /* ! C99 */ 93223637Sbz 94126258Smlaier#endif /* ! FLEXINT_H */ 95126258Smlaier 96126258Smlaier/* begin standard C++ headers. */ 97126258Smlaier 98126258Smlaier/* TODO: this is always defined, so inline it */ 99126258Smlaier#define yyconst const 100126258Smlaier 101126258Smlaier#if defined(__GNUC__) && __GNUC__ >= 3 102171168Smlaier#define yynoreturn __attribute__((__noreturn__)) 103171168Smlaier#else 104171168Smlaier#define yynoreturn 105130613Smlaier#endif 106171168Smlaier 107130613Smlaier/* Returned upon end-of-file. */ 108126258Smlaier#define YY_NULL 0 109126258Smlaier 110130613Smlaier/* Promotes a possibly negative, possibly signed char to an 111130613Smlaier * integer in range [0..255] for use as an array index. 112223637Sbz */ 113155337Smlaier#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) 114223637Sbz 115155337Smlaier/* Enter a start condition. This macro really ought to take a parameter, 116126258Smlaier * but we do it the disgusting crufty way forced on us by the ()-less 117126258Smlaier * definition of BEGIN. 118126258Smlaier */ 119126258Smlaier#define BEGIN (yy_start) = 1 + 2 * 120126258Smlaier/* Translate the current start state into a value that can be later handed 121126258Smlaier * to BEGIN to return to the state. The YYSTATE alias is for lex 122126258Smlaier * compatibility. 123126258Smlaier */ 124126258Smlaier#define YY_START (((yy_start) - 1) / 2) 125127145Smlaier#define YYSTATE YY_START 126126261Smlaier/* Action number for EOF rule of a given start state. */ 127126261Smlaier#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) 128126261Smlaier/* Special action meaning "start processing a new file". */ 129126261Smlaier#define YY_NEW_FILE yyrestart( yyin ) 130126261Smlaier#define YY_END_OF_BUFFER_CHAR 0 131126261Smlaier 132127145Smlaier/* Size of default input buffer. */ 133126261Smlaier#ifndef YY_BUF_SIZE 134126261Smlaier#ifdef __ia64__ 135126261Smlaier/* On IA-64, the buffer size is 16k, not 8k. 136126261Smlaier * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. 137126258Smlaier * Ditto for the __ia64__ case accordingly. 138171168Smlaier */ 139145836Smlaier#define YY_BUF_SIZE 32768 140145836Smlaier#else 141126261Smlaier#define YY_BUF_SIZE 16384 142145836Smlaier#endif /* __ia64__ */ 143145836Smlaier#endif 144145836Smlaier 145126258Smlaier/* The state buf must be large enough to hold one state per character in the main buffer. 146126258Smlaier */ 147127145Smlaier#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) 148130585Sphk 149126261Smlaier#ifndef YY_TYPEDEF_YY_BUFFER_STATE 150223637Sbz#define YY_TYPEDEF_YY_BUFFER_STATE 151126261Smlaiertypedef struct yy_buffer_state *YY_BUFFER_STATE; 152130613Smlaier#endif 153130613Smlaier 154130613Smlaier#ifndef YY_TYPEDEF_YY_SIZE_T 155130613Smlaier#define YY_TYPEDEF_YY_SIZE_T 156135352Smlaiertypedef size_t yy_size_t; 157135352Smlaier#endif 158130613Smlaier 159145836Smlaierextern int yyleng; 160145836Smlaier 161171168Smlaierextern FILE *yyin, *yyout; 162171168Smlaier 163171168Smlaier#define EOB_ACT_CONTINUE_SCAN 0 164145836Smlaier#define EOB_ACT_END_OF_FILE 1 165223637Sbz#define EOB_ACT_LAST_MATCH 2 166223637Sbz 167223637Sbz #define YY_LESS_LINENO(n) 168126258Smlaier #define YY_LINENO_REWIND_TO(ptr) 169223637Sbz 170223637Sbz/* Return all but the first "n" matched characters back to the input stream. */ 171127145Smlaier#define yyless(n) \ 172223637Sbz do \ 173223637Sbz { \ 174223637Sbz /* Undo effects of setting up yytext. */ \ 175223637Sbz int yyless_macro_arg = (n); \ 176223637Sbz YY_LESS_LINENO(yyless_macro_arg);\ 177223637Sbz *yy_cp = (yy_hold_char); \ 178126261Smlaier YY_RESTORE_YY_MORE_OFFSET \ 179223637Sbz (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ 180223637Sbz YY_DO_BEFORE_ACTION; /* set up yytext again */ \ 181223637Sbz } \ 182223637Sbz while ( 0 ) 183223637Sbz#define unput(c) yyunput( c, (yytext_ptr) ) 184223637Sbz 185223637Sbz#ifndef YY_STRUCT_YY_BUFFER_STATE 186223637Sbz#define YY_STRUCT_YY_BUFFER_STATE 187223637Sbzstruct yy_buffer_state 188223637Sbz { 189223637Sbz FILE *yy_input_file; 190135352Smlaier 191135352Smlaier char *yy_ch_buf; /* input buffer */ 192135352Smlaier char *yy_buf_pos; /* current position in input buffer */ 193126258Smlaier 194130613Smlaier /* Size of input buffer in bytes, not including room for EOB 195130613Smlaier * characters. 196223637Sbz */ 197126258Smlaier int yy_buf_size; 198130613Smlaier 199130613Smlaier /* Number of characters read into yy_ch_buf, not including EOB 200130613Smlaier * characters. 201223637Sbz */ 202171168Smlaier int yy_n_chars; 203171168Smlaier 204171168Smlaier /* Whether we "own" the buffer - i.e., we know we created it, 205145836Smlaier * and can realloc() it to grow it, and should free() it to 206145836Smlaier * delete it. 207145836Smlaier */ 208130613Smlaier int yy_is_our_buffer; 209223637Sbz 210223637Sbz /* Whether this is an "interactive" input source; if so, and 211223637Sbz * if we're using stdio for input, then we want to use getc() 212126258Smlaier * instead of fread(), to make sure we stop fetching input after 213223637Sbz * each newline. 214126258Smlaier */ 215127145Smlaier int yy_is_interactive; 216223637Sbz 217223637Sbz /* Whether we're considered to be at the beginning of a line. 218126261Smlaier * If so, '^' rules will be active on the next match, otherwise 219126261Smlaier * not. 220126261Smlaier */ 221130613Smlaier int yy_at_bol; 222130613Smlaier 223130613Smlaier int yy_bs_lineno; /**< The line count. */ 224126261Smlaier int yy_bs_column; /**< The column count. */ 225126261Smlaier 226126261Smlaier /* Whether to try to fill the input buffer when we reach the 227126261Smlaier * end of it. 228130613Smlaier */ 229130613Smlaier int yy_fill_buffer; 230130613Smlaier 231221132Sbz int yy_buffer_status; 232126261Smlaier 233223637Sbz#define YY_BUFFER_NEW 0 234126261Smlaier#define YY_BUFFER_NORMAL 1 235223637Sbz /* When an EOF's been seen but there's still some text to process 236221132Sbz * then we mark the buffer as YY_EOF_PENDING, to indicate that we 237127145Smlaier * shouldn't try reading from the input source any more. We might 238126261Smlaier * still have a bunch of tokens to match, though, because of 239223637Sbz * possible backing-up. 240126261Smlaier * 241223637Sbz * When we actually see the EOF, we change the status to "new" 242126261Smlaier * (via yyrestart()), so that the user can continue scanning by 243223637Sbz * just pointing yyin at a new input file. 244223637Sbz */ 245223637Sbz#define YY_BUFFER_EOF_PENDING 2 246223637Sbz 247223637Sbz }; 248223637Sbz#endif /* !YY_STRUCT_YY_BUFFER_STATE */ 249126261Smlaier 250126261Smlaier/* Stack of input buffers. */ 251126261Smlaierstatic size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ 252126261Smlaierstatic size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ 253126261Smlaierstatic YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ 254126261Smlaier 255126261Smlaier/* We provide macros for accessing buffer states in case in the 256223637Sbz * future we want to put the buffer states in a more general 257223637Sbz * "scanner state". 258223637Sbz * 259226801Sglebius * Returns the top of the stack, or NULL. 260126261Smlaier */ 261223637Sbz#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ 262223637Sbz ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ 263223637Sbz : NULL) 264223637Sbz#define yy_current_buffer YY_CURRENT_BUFFER 265223637Sbz/* Same as previous macro, but useful when we know that the buffer stack is not 266223637Sbz * NULL or when we need an lvalue. For internal use only. 267223637Sbz */ 268223637Sbz#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] 269223637Sbz 270223637Sbz/* yy_hold_char holds the character lost when yytext is formed. */ 271223637Sbzstatic char yy_hold_char; 272223637Sbzstatic int yy_n_chars; /* number of characters read into yy_ch_buf */ 273223637Sbzint yyleng; 274171168Smlaier 275223637Sbz/* Points to current character in buffer. */ 276223637Sbzstatic char *yy_c_buf_p = NULL; 277223637Sbzstatic int yy_init = 0; /* whether we need to initialize */ 278223637Sbzstatic int yy_start = 0; /* start state number */ 279223637Sbz 280226801Sglebius/* Flag which is used to allow yywrap()'s to do buffer switches 281126261Smlaier * instead of setting up a fresh yyin. A bit of a hack ... 282126261Smlaier */ 283223637Sbzstatic int yy_did_buffer_switch_on_eof; 284226801Sglebius 285126261Smlaiervoid yyrestart ( FILE *input_file ); 286126261Smlaiervoid yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); 287226801SglebiusYY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); 288126261Smlaiervoid yy_delete_buffer ( YY_BUFFER_STATE b ); 289126261Smlaiervoid yy_flush_buffer ( YY_BUFFER_STATE b ); 290223637Sbzvoid yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); 291226801Sglebiusvoid yypop_buffer_state ( void ); 292126261Smlaier 293126261Smlaierstatic void yyensure_buffer_stack ( void ); 294126261Smlaierstatic void yy_load_buffer_state ( void ); 295126261Smlaierstatic void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); 296223637Sbz#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) 297223637Sbz 298223637SbzYY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); 299223637SbzYY_BUFFER_STATE yy_scan_string ( const char *yy_str ); 300223637SbzYY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); 301237776Sglebius 302126261Smlaiervoid *yyalloc ( yy_size_t ); 303126261Smlaiervoid *yyrealloc ( void *, yy_size_t ); 304126261Smlaiervoid yyfree ( void * ); 305126261Smlaier 306126261Smlaier#define yy_new_buffer yy_create_buffer 307223637Sbz#define yy_set_interactive(is_interactive) \ 308223637Sbz { \ 309223637Sbz if ( ! YY_CURRENT_BUFFER ){ \ 310223637Sbz yyensure_buffer_stack (); \ 311223637Sbz YY_CURRENT_BUFFER_LVALUE = \ 312223637Sbz yy_create_buffer( yyin, YY_BUF_SIZE ); \ 313223637Sbz } \ 314223637Sbz YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ 315223637Sbz } 316223637Sbz#define yy_set_bol(at_bol) \ 317223637Sbz { \ 318223637Sbz if ( ! YY_CURRENT_BUFFER ){\ 319223637Sbz yyensure_buffer_stack (); \ 320237776Sglebius YY_CURRENT_BUFFER_LVALUE = \ 321223637Sbz yy_create_buffer( yyin, YY_BUF_SIZE ); \ 322223637Sbz } \ 323126261Smlaier YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ 324126261Smlaier } 325126261Smlaier#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) 326126261Smlaier 327126261Smlaier/* Begin user sect3 */ 328223637Sbz 329126261Smlaier#define yywrap() (/*CONSTCOND*/1) 330126261Smlaier#define YY_SKIP_YYWRAP 331126261Smlaiertypedef flex_uint8_t YY_CHAR; 332223637Sbz 333223637SbzFILE *yyin = NULL, *yyout = NULL; 334223637Sbz 335223637Sbztypedef int yy_state_type; 336223637Sbz 337223637Sbzextern int yylineno; 338223637Sbzint yylineno = 1; 339223637Sbz 340223637Sbzextern char *yytext; 341237776Sglebius#ifdef yytext_ptr 342223637Sbz#undef yytext_ptr 343223637Sbz#endif 344223637Sbz#define yytext_ptr yytext 345223637Sbz 346223637Sbzstatic yy_state_type yy_get_previous_state ( void ); 347126261Smlaierstatic yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); 348223637Sbzstatic int yy_get_next_buffer ( void ); 349126261Smlaierstatic void yynoreturn yy_fatal_error ( const char* msg ); 350126261Smlaier 351126261Smlaier/* Done after the current pattern has been matched and before the 352126261Smlaier * corresponding action - sets up yytext. 353126261Smlaier */ 354126261Smlaier#define YY_DO_BEFORE_ACTION \ 355126261Smlaier (yytext_ptr) = yy_bp; \ 356130613Smlaier yyleng = (int) (yy_cp - yy_bp); \ 357126261Smlaier (yy_hold_char) = *yy_cp; \ 358126261Smlaier *yy_cp = '\0'; \ 359126261Smlaier (yy_c_buf_p) = yy_cp; 360126261Smlaier#define YY_NUM_RULES 14 361126261Smlaier#define YY_END_OF_BUFFER 15 362126261Smlaier/* This struct is not used in this scanner, 363223637Sbz but its presence is necessary. */ 364223637Sbzstruct yy_trans_info 365223637Sbz { 366223637Sbz flex_int32_t yy_verify; 367223637Sbz flex_int32_t yy_nxt; 368223637Sbz }; 369223637Sbzstatic const flex_int16_t yy_accept[35] = 370223637Sbz { 0, 371223637Sbz 0, 0, 15, 13, 1, 1, 13, 13, 13, 2, 372223637Sbz 2, 13, 13, 13, 13, 1, 9, 10, 12, 2, 373223637Sbz 0, 0, 2, 6, 4, 8, 5, 7, 11, 0, 374223637Sbz 2, 0, 3, 0 375126261Smlaier } ; 376223637Sbz 377223637Sbzstatic const YY_CHAR yy_ec[256] = 378130613Smlaier { 0, 379126261Smlaier 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 380223637Sbz 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 381223637Sbz 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 382223637Sbz 1, 2, 4, 1, 1, 1, 1, 5, 1, 1, 383223637Sbz 1, 6, 1, 1, 1, 1, 1, 7, 8, 8, 384223637Sbz 8, 8, 8, 8, 8, 9, 9, 10, 1, 11, 385223637Sbz 12, 13, 1, 1, 14, 14, 14, 14, 14, 14, 386223637Sbz 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 387126261Smlaier 15, 16, 15, 15, 15, 15, 15, 17, 15, 15, 388223637Sbz 1, 1, 1, 1, 1, 1, 14, 14, 14, 14, 389223637Sbz 390223637Sbz 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 391223637Sbz 15, 15, 15, 16, 15, 15, 15, 15, 15, 17, 392126261Smlaier 15, 15, 1, 18, 1, 1, 1, 1, 1, 1, 393126261Smlaier 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 394145836Smlaier 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 395145836Smlaier 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 396145836Smlaier 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 397145836Smlaier 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 398145836Smlaier 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 399145836Smlaier 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 400145836Smlaier 401145836Smlaier 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 402145836Smlaier 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 403145836Smlaier 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 404145836Smlaier 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 405145836Smlaier 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 406145836Smlaier 1, 1, 1, 1, 1 407145836Smlaier } ; 408145836Smlaier 409145836Smlaierstatic const YY_CHAR yy_meta[19] = 410145836Smlaier { 0, 411145836Smlaier 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 412171168Smlaier 1, 1, 1, 3, 4, 4, 4, 1 413171168Smlaier } ; 414126261Smlaier 415126261Smlaierstatic const flex_int16_t yy_base[39] = 416171168Smlaier { 0, 417223637Sbz 0, 0, 48, 49, 17, 19, 35, 41, 39, 16, 418223637Sbz 0, 14, 32, 15, 25, 27, 49, 49, 49, 27, 419130613Smlaier 0, 0, 0, 49, 49, 49, 49, 49, 49, 32, 420223637Sbz 0, 0, 0, 49, 39, 29, 34, 36 421223637Sbz } ; 422130613Smlaier 423223637Sbzstatic const flex_int16_t yy_def[39] = 424130613Smlaier { 0, 425223637Sbz 34, 1, 34, 34, 34, 34, 34, 34, 34, 34, 426171168Smlaier 35, 34, 34, 34, 34, 34, 34, 34, 34, 34, 427171168Smlaier 36, 37, 35, 34, 34, 34, 34, 34, 34, 36, 428223637Sbz 37, 38, 38, 0, 34, 34, 34, 34 429223637Sbz } ; 430126261Smlaier 431126261Smlaierstatic const flex_int16_t yy_nxt[68] = 432126261Smlaier { 0, 433223637Sbz 4, 5, 6, 7, 8, 9, 10, 11, 11, 4, 434126261Smlaier 12, 13, 14, 4, 4, 4, 4, 15, 16, 16, 435126258Smlaier 16, 16, 20, 20, 24, 25, 27, 28, 16, 16, 436126258Smlaier 30, 21, 22, 20, 20, 31, 31, 33, 33, 33, 437126258Smlaier 23, 32, 29, 26, 19, 18, 17, 34, 3, 34, 438126258Smlaier 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 439126258Smlaier 34, 34, 34, 34, 34, 34, 34 440126258Smlaier } ; 441130613Smlaier 442130613Smlaierstatic const flex_int16_t yy_chk[68] = 443126258Smlaier { 0, 444126258Smlaier 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 445223637Sbz 1, 1, 1, 1, 1, 1, 1, 1, 5, 5, 446223637Sbz 6, 6, 10, 10, 12, 12, 14, 14, 16, 16, 447223637Sbz 36, 10, 10, 20, 20, 37, 37, 38, 38, 38, 448223637Sbz 35, 30, 15, 13, 9, 8, 7, 3, 34, 34, 449126258Smlaier 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 450145836Smlaier 34, 34, 34, 34, 34, 34, 34 451126258Smlaier } ; 452145836Smlaier 453126258Smlaierstatic yy_state_type yy_last_accepting_state; 454130613Smlaierstatic char *yy_last_accepting_cpos; 455126258Smlaier 456126258Smlaierextern int yy_flex_debug; 457130613Smlaierint yy_flex_debug = 0; 458130613Smlaier 459126258Smlaier/* The intent behind this definition is that it'll catch 460223637Sbz * any uses of REJECT which flex missed. 461171168Smlaier */ 462171168Smlaier#define REJECT reject_used_but_not_detected 463171168Smlaier#define yymore() yymore_used_but_not_detected 464130613Smlaier#define YY_MORE_ADJ 0 465145836Smlaier#define YY_RESTORE_YY_MORE_OFFSET 466126258Smlaierchar *yytext; 467126258Smlaier#line 1 "tokenizer.l" 468126258Smlaier#define YY_NO_INPUT 1 469126258Smlaier#line 3 "tokenizer.l" 470126258Smlaier/* $OpenBSD: tokenizer.l,v 1.9 2017/06/15 13:48:42 bcallah Exp $ */ 471126258Smlaier/* 472171168Smlaier * Copyright (c) 2004 Marc Espie <espie@cvs.openbsd.org> 473126258Smlaier * 474126258Smlaier * Permission to use, copy, modify, and distribute this software for any 475126258Smlaier * purpose with or without fee is hereby granted, provided that the above 476126258Smlaier * copyright notice and this permission notice appear in all copies. 477126258Smlaier * 478171168Smlaier * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 479126258Smlaier * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 480126258Smlaier * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 481145836Smlaier * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 482145836Smlaier * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 483145836Smlaier * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 484145836Smlaier * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 485145836Smlaier */ 486145836Smlaier#include "parser.h" 487145836Smlaier#include <assert.h> 488145836Smlaier#include <stdlib.h> 489145836Smlaier#include <errno.h> 490145836Smlaier#include <stdint.h> 491145836Smlaier#include <limits.h> 492145836Smlaier 493145836Smlaierextern void m4_warnx(const char *, ...); 494145836Smlaierextern int mimic_gnu; 495145836Smlaierextern int32_t yylval; 496145836Smlaier 497145836Smlaierint32_t number(void); 498145836Smlaierint32_t parse_radix(void); 499171168Smlaierextern int yylex(void); 500171168Smlaier 501126258Smlaier#define YY_DECL int yylex(void) 502126258Smlaier#line 504 "tokenizer.c" 503130613Smlaier#line 505 "tokenizer.c" 504126258Smlaier 505130613Smlaier#define INITIAL 0 506130613Smlaier 507130613Smlaier#ifndef YY_NO_UNISTD_H 508171168Smlaier/* Special case for "unistd.h", since it is non-ANSI. We include it way 509171168Smlaier * down here because we want the user's section 1 to have been scanned first. 510223637Sbz * The user has a chance to override it with an option. 511126258Smlaier */ 512126258Smlaier#include <unistd.h> 513171168Smlaier#endif 514171168Smlaier 515171168Smlaier#ifndef YY_EXTRA_TYPE 516223637Sbz#define YY_EXTRA_TYPE void * 517171168Smlaier#endif 518171168Smlaier 519187689Sedstatic int yy_init_globals ( void ); 520187689Sed 521223637Sbz/* Accessor methods to globals. 522187689Sed These are made visible to non-reentrant scanners for convenience. */ 523223637Sbz 524187689Sedint yylex_destroy ( void ); 525187689Sed 526187689Sedint yyget_debug ( void ); 527187689Sed 528187689Sedvoid yyset_debug ( int debug_flag ); 529223637Sbz 530187689SedYY_EXTRA_TYPE yyget_extra ( void ); 531223637Sbz 532187689Sedvoid yyset_extra ( YY_EXTRA_TYPE user_defined ); 533187689Sed 534187689SedFILE *yyget_in ( void ); 535223637Sbz 536126258Smlaiervoid yyset_in ( FILE * _in_str ); 537126258Smlaier 538145836SmlaierFILE *yyget_out ( void ); 539145836Smlaier 540145836Smlaiervoid yyset_out ( FILE * _out_str ); 541126258Smlaier 542126258Smlaier int yyget_leng ( void ); 543126258Smlaier 544126258Smlaierchar *yyget_text ( void ); 545126258Smlaier 546145836Smlaierint yyget_lineno ( void ); 547126258Smlaier 548126258Smlaiervoid yyset_lineno ( int _line_number ); 549126258Smlaier 550126258Smlaier/* Macros after this point can all be overridden by user definitions in 551126258Smlaier * section 1. 552126258Smlaier */ 553126258Smlaier 554126258Smlaier#ifndef YY_SKIP_YYWRAP 555126258Smlaier#ifdef __cplusplus 556126258Smlaierextern "C" int yywrap ( void ); 557126258Smlaier#else 558126258Smlaierextern int yywrap ( void ); 559126258Smlaier#endif 560126258Smlaier#endif 561126258Smlaier 562126258Smlaier#ifndef YY_NO_UNPUT 563126258Smlaier 564126258Smlaier#endif 565126258Smlaier 566126258Smlaier#ifndef yytext_ptr 567126258Smlaierstatic void yy_flex_strncpy ( char *, const char *, int ); 568126258Smlaier#endif 569126258Smlaier 570126258Smlaier#ifdef YY_NEED_STRLEN 571126258Smlaierstatic int yy_flex_strlen ( const char * ); 572126258Smlaier#endif 573126258Smlaier 574126258Smlaier#ifndef YY_NO_INPUT 575126258Smlaier#ifdef __cplusplus 576126258Smlaierstatic int yyinput ( void ); 577126258Smlaier#else 578126258Smlaierstatic int input ( void ); 579126258Smlaier#endif 580126258Smlaier 581126258Smlaier#endif 582126258Smlaier 583126258Smlaier/* Amount of stuff to slurp up with each read. */ 584126258Smlaier#ifndef YY_READ_BUF_SIZE 585126258Smlaier#ifdef __ia64__ 586126258Smlaier/* On IA-64, the buffer size is 16k, not 8k */ 587126258Smlaier#define YY_READ_BUF_SIZE 16384 588126258Smlaier#else 589126258Smlaier#define YY_READ_BUF_SIZE 8192 590126258Smlaier#endif /* __ia64__ */ 591126258Smlaier#endif 592126258Smlaier 593126258Smlaier/* Copy whatever the last rule matched to the standard output. */ 594126258Smlaier#ifndef ECHO 595126258Smlaier/* This used to be an fputs(), but since the string might contain NUL's, 596126258Smlaier * we now use fwrite(). 597126258Smlaier */ 598130613Smlaier#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) 599126258Smlaier#endif 600171168Smlaier 601126258Smlaier/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 602223637Sbz * is returned in "result". 603223637Sbz */ 604223637Sbz#ifndef YY_INPUT 605126258Smlaier#define YY_INPUT(buf,result,max_size) \ 606223637Sbz if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ 607126258Smlaier { \ 608126258Smlaier int c = '*'; \ 609126258Smlaier int n; \ 610126258Smlaier for ( n = 0; n < max_size && \ 611126258Smlaier (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ 612126258Smlaier buf[n] = (char) c; \ 613126258Smlaier if ( c == '\n' ) \ 614223637Sbz buf[n++] = (char) c; \ 615126258Smlaier if ( c == EOF && ferror( yyin ) ) \ 616126258Smlaier YY_FATAL_ERROR( "input in flex scanner failed" ); \ 617126258Smlaier result = n; \ 618126258Smlaier } \ 619126258Smlaier else \ 620126258Smlaier { \ 621126258Smlaier errno=0; \ 622145836Smlaier while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ 623145836Smlaier { \ 624126258Smlaier if( errno != EINTR) \ 625126258Smlaier { \ 626126258Smlaier YY_FATAL_ERROR( "input in flex scanner failed" ); \ 627126258Smlaier break; \ 628126258Smlaier } \ 629130613Smlaier errno=0; \ 630223637Sbz clearerr(yyin); \ 631130613Smlaier } \ 632126258Smlaier }\ 633126258Smlaier\ 634126258Smlaier 635130613Smlaier#endif 636130613Smlaier 637130613Smlaier/* No semi-colon after return; correct usage is to write "yyterminate();" - 638130613Smlaier * we don't want an extra ';' after the "return" because that will cause 639130613Smlaier * some compilers to complain about unreachable statements. 640145836Smlaier */ 641145836Smlaier#ifndef yyterminate 642130613Smlaier#define yyterminate() return YY_NULL 643130613Smlaier#endif 644126258Smlaier 645126258Smlaier/* Number of entries by which start-condition stack grows. */ 646126258Smlaier#ifndef YY_START_STACK_INCR 647145836Smlaier#define YY_START_STACK_INCR 25 648145836Smlaier#endif 649126258Smlaier 650171168Smlaier/* Report a fatal error. */ 651145836Smlaier#ifndef YY_FATAL_ERROR 652126258Smlaier#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) 653223637Sbz#endif 654223637Sbz 655223637Sbz/* end tables serialization structures and prototypes */ 656126258Smlaier 657223637Sbz/* Default declaration of generated scanner - a define so the user can 658126258Smlaier * easily add parameters. 659126258Smlaier */ 660171168Smlaier#ifndef YY_DECL 661130613Smlaier#define YY_DECL_IS_OURS 1 662126258Smlaier 663126258Smlaierextern int yylex (void); 664126258Smlaier 665126258Smlaier#define YY_DECL int yylex (void) 666130613Smlaier#endif /* !YY_DECL */ 667126258Smlaier 668126258Smlaier/* Code executed at the beginning of each rule, after yytext and yyleng 669126258Smlaier * have been set up. 670126258Smlaier */ 671126258Smlaier#ifndef YY_USER_ACTION 672126258Smlaier#define YY_USER_ACTION 673126258Smlaier#endif 674126258Smlaier 675126258Smlaier/* Code executed at the end of each rule. */ 676126258Smlaier#ifndef YY_BREAK 677126258Smlaier#define YY_BREAK /*LINTED*/break; 678126258Smlaier#endif 679130613Smlaier 680130613Smlaier#define YY_RULE_SETUP \ 681126258Smlaier YY_USER_ACTION 682126258Smlaier 683126258Smlaier/** The main scanner function which does all the work. 684126258Smlaier */ 685126258SmlaierYY_DECL 686126258Smlaier{ 687126258Smlaier yy_state_type yy_current_state; 688223637Sbz char *yy_cp, *yy_bp; 689126258Smlaier int yy_act; 690126258Smlaier 691126258Smlaier if ( !(yy_init) ) 692126258Smlaier { 693126258Smlaier (yy_init) = 1; 694126258Smlaier 695126258Smlaier#ifdef YY_USER_INIT 696126258Smlaier YY_USER_INIT; 697126258Smlaier#endif 698130613Smlaier 699126258Smlaier if ( ! (yy_start) ) 700126258Smlaier (yy_start) = 1; /* first start state */ 701126258Smlaier 702126258Smlaier if ( ! yyin ) 703171168Smlaier yyin = stdin; 704130613Smlaier 705126258Smlaier if ( ! yyout ) 706126258Smlaier yyout = stdout; 707126258Smlaier 708130613Smlaier if ( ! YY_CURRENT_BUFFER ) { 709126258Smlaier yyensure_buffer_stack (); 710126258Smlaier YY_CURRENT_BUFFER_LVALUE = 711126258Smlaier yy_create_buffer( yyin, YY_BUF_SIZE ); 712126258Smlaier } 713126258Smlaier 714126258Smlaier yy_load_buffer_state( ); 715171168Smlaier } 716130613Smlaier 717126258Smlaier { 718126258Smlaier#line 48 "tokenizer.l" 719126258Smlaier 720126258Smlaier#line 722 "tokenizer.c" 721126258Smlaier 722126258Smlaier while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ 723130613Smlaier { 724126258Smlaier yy_cp = (yy_c_buf_p); 725126258Smlaier 726126258Smlaier /* Support of yytext. */ 727130613Smlaier *yy_cp = (yy_hold_char); 728126258Smlaier 729126258Smlaier /* yy_bp points to the position in yy_ch_buf of the start of 730126258Smlaier * the current run. 731126258Smlaier */ 732126258Smlaier yy_bp = yy_cp; 733126258Smlaier 734126258Smlaier yy_current_state = (yy_start); 735130613Smlaieryy_match: 736130613Smlaier do 737130613Smlaier { 738223637Sbz YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; 739223637Sbz if ( yy_accept[yy_current_state] ) 740223637Sbz { 741130613Smlaier (yy_last_accepting_state) = yy_current_state; 742223637Sbz (yy_last_accepting_cpos) = yy_cp; 743130613Smlaier } 744130613Smlaier while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 745130613Smlaier { 746130613Smlaier yy_current_state = (int) yy_def[yy_current_state]; 747130613Smlaier if ( yy_current_state >= 35 ) 748223637Sbz yy_c = yy_meta[yy_c]; 749223637Sbz } 750223637Sbz yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; 751171168Smlaier ++yy_cp; 752223637Sbz } 753130613Smlaier while ( yy_base[yy_current_state] != 49 ); 754130613Smlaier 755130613Smlaieryy_find_action: 756145836Smlaier yy_act = yy_accept[yy_current_state]; 757145836Smlaier if ( yy_act == 0 ) 758145836Smlaier { /* have to back up */ 759145836Smlaier yy_cp = (yy_last_accepting_cpos); 760223637Sbz yy_current_state = (yy_last_accepting_state); 761223637Sbz yy_act = yy_accept[yy_current_state]; 762223637Sbz } 763145836Smlaier 764223637Sbz YY_DO_BEFORE_ACTION; 765145836Smlaier 766145836Smlaierdo_action: /* This label is used only to access EOF actions. */ 767145836Smlaier 768145836Smlaier switch ( yy_act ) 769145836Smlaier { /* beginning of action switch */ 770145836Smlaier case 0: /* must back up */ 771145836Smlaier /* undo the effects of YY_DO_BEFORE_ACTION */ 772130613Smlaier *yy_cp = (yy_hold_char); 773130613Smlaier yy_cp = (yy_last_accepting_cpos); 774223637Sbz yy_current_state = (yy_last_accepting_state); 775223637Sbz goto yy_find_action; 776223637Sbz 777171168Smlaiercase 1: 778223637Sbz/* rule 1 can match eol */ 779130613SmlaierYY_RULE_SETUP 780130613Smlaier#line 49 "tokenizer.l" 781145836Smlaier{/* just skip it */} 782145836Smlaier YY_BREAK 783145836Smlaiercase 2: 784145836SmlaierYY_RULE_SETUP 785145836Smlaier#line 50 "tokenizer.l" 786145836Smlaier{ yylval = number(); return(NUMBER); } 787145836Smlaier YY_BREAK 788145836Smlaiercase 3: 789145836SmlaierYY_RULE_SETUP 790145836Smlaier#line 51 "tokenizer.l" 791145836Smlaier{ if (mimic_gnu) { 792145836Smlaier yylval = parse_radix(); return(NUMBER); 793145836Smlaier } else { 794145836Smlaier return(ERROR); 795145836Smlaier } 796145836Smlaier } 797145836Smlaier YY_BREAK 798145836Smlaiercase 4: 799145836SmlaierYY_RULE_SETUP 800145836Smlaier#line 57 "tokenizer.l" 801145836Smlaier{ return(LE); } 802145836Smlaier YY_BREAK 803145836Smlaiercase 5: 804145836SmlaierYY_RULE_SETUP 805145836Smlaier#line 58 "tokenizer.l" 806145836Smlaier{ return(GE); } 807145836Smlaier YY_BREAK 808145836Smlaiercase 6: 809145836SmlaierYY_RULE_SETUP 810145836Smlaier#line 59 "tokenizer.l" 811145836Smlaier{ return(LSHIFT); } 812145836Smlaier YY_BREAK 813145836Smlaiercase 7: 814145836SmlaierYY_RULE_SETUP 815145836Smlaier#line 60 "tokenizer.l" 816145836Smlaier{ return(RSHIFT); } 817145836Smlaier YY_BREAK 818145836Smlaiercase 8: 819145836SmlaierYY_RULE_SETUP 820145836Smlaier#line 61 "tokenizer.l" 821145836Smlaier{ return(EQ); } 822145836Smlaier YY_BREAK 823145836Smlaiercase 9: 824145836SmlaierYY_RULE_SETUP 825145836Smlaier#line 62 "tokenizer.l" 826145836Smlaier{ return(NE); } 827130613Smlaier YY_BREAK 828130613Smlaiercase 10: 829130613SmlaierYY_RULE_SETUP 830130613Smlaier#line 63 "tokenizer.l" 831223637Sbz{ return(LAND); } 832223637Sbz YY_BREAK 833223637Sbzcase 11: 834130613SmlaierYY_RULE_SETUP 835223637Sbz#line 64 "tokenizer.l" 836130613Smlaier{ return(LOR); } 837130613Smlaier YY_BREAK 838130613Smlaiercase 12: 839130613SmlaierYY_RULE_SETUP 840130613Smlaier#line 65 "tokenizer.l" 841223637Sbz{ if (mimic_gnu) { return (EXPONENT); } } 842223637Sbz YY_BREAK 843223637Sbzcase 13: 844171168SmlaierYY_RULE_SETUP 845223637Sbz#line 66 "tokenizer.l" 846130613Smlaier{ return yytext[0]; } 847130613Smlaier YY_BREAK 848130613Smlaiercase 14: 849130613SmlaierYY_RULE_SETUP 850130613Smlaier#line 67 "tokenizer.l" 851223637SbzECHO; 852223637Sbz YY_BREAK 853223637Sbz#line 855 "tokenizer.c" 854171168Smlaiercase YY_STATE_EOF(INITIAL): 855223637Sbz yyterminate(); 856130613Smlaier 857130613Smlaier case YY_END_OF_BUFFER: 858130613Smlaier { 859130613Smlaier /* Amount of text matched not including the EOB char. */ 860130613Smlaier int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; 861130613Smlaier 862130613Smlaier /* Undo the effects of YY_DO_BEFORE_ACTION. */ 863130613Smlaier *yy_cp = (yy_hold_char); 864130613Smlaier YY_RESTORE_YY_MORE_OFFSET 865177700Smlaier 866223637Sbz if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) 867223637Sbz { 868177700Smlaier /* We're scanning a new file or input source. It's 869177700Smlaier * possible that this happened because the user 870177700Smlaier * just pointed yyin at a new source and called 871223637Sbz * yylex(). If so, then we have to assure 872223637Sbz * consistency between YY_CURRENT_BUFFER and our 873130613Smlaier * globals. Here is the right place to do so, because 874177700Smlaier * this is the first action (other than possibly a 875130613Smlaier * back-up) that will match for the new input source. 876130613Smlaier */ 877130613Smlaier (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 878130613Smlaier YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; 879223637Sbz YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; 880223637Sbz } 881223637Sbz 882130613Smlaier /* Note that here we test for yy_c_buf_p "<=" to the position 883223637Sbz * of the first EOB in the buffer, since yy_c_buf_p will 884130613Smlaier * already have been incremented past the NUL character 885130613Smlaier * (since all states make transitions on EOB to the 886130613Smlaier * end-of-buffer state). Contrast this with the test 887223637Sbz * in input(). 888223637Sbz */ 889223637Sbz if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) 890223637Sbz { /* This was really a NUL. */ 891130613Smlaier yy_state_type yy_next_state; 892130613Smlaier 893223637Sbz (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; 894130613Smlaier 895130613Smlaier yy_current_state = yy_get_previous_state( ); 896130613Smlaier 897130613Smlaier /* Okay, we're now positioned to make the NUL 898130613Smlaier * transition. We couldn't have 899130613Smlaier * yy_get_previous_state() go ahead and do it 900130613Smlaier * for us because it doesn't know how to deal 901130613Smlaier * with the possibility of jamming (and we don't 902130613Smlaier * want to build jamming into it because then it 903223637Sbz * will run more slowly). 904223637Sbz */ 905223637Sbz 906223637Sbz yy_next_state = yy_try_NUL_trans( yy_current_state ); 907223637Sbz 908223637Sbz yy_bp = (yytext_ptr) + YY_MORE_ADJ; 909223637Sbz 910223637Sbz if ( yy_next_state ) 911223637Sbz { 912130613Smlaier /* Consume the NUL. */ 913130613Smlaier yy_cp = ++(yy_c_buf_p); 914130613Smlaier yy_current_state = yy_next_state; 915130613Smlaier goto yy_match; 916130613Smlaier } 917130613Smlaier 918177700Smlaier else 919130613Smlaier { 920130613Smlaier yy_cp = (yy_c_buf_p); 921130613Smlaier goto yy_find_action; 922130613Smlaier } 923223637Sbz } 924223637Sbz 925223637Sbz else switch ( yy_get_next_buffer( ) ) 926130613Smlaier { 927223637Sbz case EOB_ACT_END_OF_FILE: 928130613Smlaier { 929223637Sbz (yy_did_buffer_switch_on_eof) = 0; 930223637Sbz 931223637Sbz if ( yywrap( ) ) 932130613Smlaier { 933223637Sbz /* Note: because we've taken care in 934130613Smlaier * yy_get_next_buffer() to have set up 935130613Smlaier * yytext, we can now set up 936130613Smlaier * yy_c_buf_p so that if some total 937130613Smlaier * hoser (like flex itself) wants to 938130613Smlaier * call the scanner after we return the 939130613Smlaier * YY_NULL, it'll still work - another 940130613Smlaier * YY_NULL will get returned. 941130613Smlaier */ 942130613Smlaier (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; 943130613Smlaier 944223637Sbz yy_act = YY_STATE_EOF(YY_START); 945223637Sbz goto do_action; 946223637Sbz } 947130613Smlaier 948223637Sbz else 949130613Smlaier { 950130613Smlaier if ( ! (yy_did_buffer_switch_on_eof) ) 951130613Smlaier YY_NEW_FILE; 952130613Smlaier } 953223637Sbz break; 954223637Sbz } 955223637Sbz 956223637Sbz case EOB_ACT_CONTINUE_SCAN: 957223637Sbz (yy_c_buf_p) = 958223637Sbz (yytext_ptr) + yy_amount_of_matched_text; 959130613Smlaier 960130613Smlaier yy_current_state = yy_get_previous_state( ); 961130613Smlaier 962130613Smlaier yy_cp = (yy_c_buf_p); 963223637Sbz yy_bp = (yytext_ptr) + YY_MORE_ADJ; 964130613Smlaier goto yy_match; 965130613Smlaier 966177700Smlaier case EOB_ACT_LAST_MATCH: 967223637Sbz (yy_c_buf_p) = 968223637Sbz &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; 969223637Sbz 970177700Smlaier yy_current_state = yy_get_previous_state( ); 971223637Sbz 972130613Smlaier yy_cp = (yy_c_buf_p); 973177700Smlaier yy_bp = (yytext_ptr) + YY_MORE_ADJ; 974130613Smlaier goto yy_find_action; 975130613Smlaier } 976223637Sbz break; 977223637Sbz } 978223637Sbz 979135352Smlaier default: 980223637Sbz YY_FATAL_ERROR( 981135352Smlaier "fatal flex scanner internal error--no action found" ); 982135352Smlaier } /* end of action switch */ 983130613Smlaier } /* end of scanning one token */ 984130613Smlaier } /* end of user's declarations */ 985130613Smlaier} /* end of yylex */ 986130613Smlaier 987130613Smlaier/* yy_get_next_buffer - try to read in a new buffer 988130613Smlaier * 989130613Smlaier * Returns a code representing an action: 990177700Smlaier * EOB_ACT_LAST_MATCH - 991223637Sbz * EOB_ACT_CONTINUE_SCAN - continue scanning from current position 992223637Sbz * EOB_ACT_END_OF_FILE - end of file 993177700Smlaier */ 994177700Smlaierstatic int yy_get_next_buffer (void) 995177700Smlaier{ 996223637Sbz char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; 997223637Sbz char *source = (yytext_ptr); 998130613Smlaier int number_to_move, i; 999177700Smlaier int ret_val; 1000130613Smlaier 1001223637Sbz if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) 1002223637Sbz YY_FATAL_ERROR( 1003223637Sbz "fatal flex scanner internal error--end of buffer missed" ); 1004135352Smlaier 1005223637Sbz if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) 1006135352Smlaier { /* Don't try to fill the buffer, so this is an EOF. */ 1007130613Smlaier if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) 1008130613Smlaier { 1009130613Smlaier /* We matched a single character, the EOB, so 1010130613Smlaier * treat this as a final EOF. 1011130613Smlaier */ 1012130613Smlaier return EOB_ACT_END_OF_FILE; 1013130613Smlaier } 1014130613Smlaier 1015223637Sbz else 1016223637Sbz { 1017223637Sbz /* We matched some text prior to the EOB, first 1018130613Smlaier * process it. 1019223637Sbz */ 1020130613Smlaier return EOB_ACT_LAST_MATCH; 1021130613Smlaier } 1022130613Smlaier } 1023223637Sbz 1024223637Sbz /* Try to read more data. */ 1025223637Sbz 1026130613Smlaier /* First move last chars to start of buffer. */ 1027223637Sbz number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); 1028130613Smlaier 1029130613Smlaier for ( i = 0; i < number_to_move; ++i ) 1030135352Smlaier *(dest++) = *(source++); 1031135352Smlaier 1032135352Smlaier if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) 1033135352Smlaier /* don't do the read, it's not guaranteed to return an EOF, 1034135352Smlaier * just force an EOF 1035135352Smlaier */ 1036135352Smlaier YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; 1037135352Smlaier 1038135352Smlaier else 1039135352Smlaier { 1040135352Smlaier int num_to_read = 1041135352Smlaier YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; 1042135352Smlaier 1043135352Smlaier while ( num_to_read <= 0 ) 1044135352Smlaier { /* Not enough room in the buffer - grow it. */ 1045135352Smlaier 1046135352Smlaier /* just a shorter name for the current buffer */ 1047135352Smlaier YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; 1048171168Smlaier 1049135352Smlaier int yy_c_buf_p_offset = 1050135352Smlaier (int) ((yy_c_buf_p) - b->yy_ch_buf); 1051135352Smlaier 1052135352Smlaier if ( b->yy_is_our_buffer ) 1053135352Smlaier { 1054135352Smlaier int new_size = b->yy_buf_size * 2; 1055145836Smlaier 1056135352Smlaier if ( new_size <= 0 ) 1057135352Smlaier b->yy_buf_size += b->yy_buf_size / 8; 1058135352Smlaier else 1059135352Smlaier b->yy_buf_size *= 2; 1060135352Smlaier 1061135352Smlaier b->yy_ch_buf = (char *) 1062135352Smlaier /* Include room in for 2 EOB chars. */ 1063135352Smlaier yyrealloc( (void *) b->yy_ch_buf, 1064135352Smlaier (yy_size_t) (b->yy_buf_size + 2) ); 1065135352Smlaier } 1066135352Smlaier else 1067135352Smlaier /* Can't grow it, we don't own it. */ 1068135352Smlaier b->yy_ch_buf = NULL; 1069135352Smlaier 1070135352Smlaier if ( ! b->yy_ch_buf ) 1071135352Smlaier YY_FATAL_ERROR( 1072135352Smlaier "fatal error - scanner input buffer overflow" ); 1073135352Smlaier 1074135352Smlaier (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; 1075135352Smlaier 1076135352Smlaier num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - 1077135352Smlaier number_to_move - 1; 1078135352Smlaier 1079135352Smlaier } 1080135352Smlaier 1081135352Smlaier if ( num_to_read > YY_READ_BUF_SIZE ) 1082135352Smlaier num_to_read = YY_READ_BUF_SIZE; 1083135352Smlaier 1084171168Smlaier /* Read in more data. */ 1085135352Smlaier YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 1086135352Smlaier (yy_n_chars), num_to_read ); 1087135352Smlaier 1088135352Smlaier YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1089135352Smlaier } 1090135352Smlaier 1091135352Smlaier if ( (yy_n_chars) == 0 ) 1092135352Smlaier { 1093135352Smlaier if ( number_to_move == YY_MORE_ADJ ) 1094135352Smlaier { 1095135352Smlaier ret_val = EOB_ACT_END_OF_FILE; 1096135352Smlaier yyrestart( yyin ); 1097177700Smlaier } 1098177700Smlaier 1099177700Smlaier else 1100177700Smlaier { 1101177700Smlaier ret_val = EOB_ACT_LAST_MATCH; 1102223637Sbz YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = 1103223637Sbz YY_BUFFER_EOF_PENDING; 1104223637Sbz } 1105223637Sbz } 1106177700Smlaier 1107177700Smlaier else 1108223637Sbz ret_val = EOB_ACT_CONTINUE_SCAN; 1109223637Sbz 1110223637Sbz if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { 1111223637Sbz /* Extend the array by 50%, plus the number we really need. */ 1112177700Smlaier int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); 1113177700Smlaier YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( 1114223637Sbz (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); 1115177700Smlaier if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 1116177700Smlaier YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); 1117177700Smlaier /* "- 2" to take care of EOB's */ 1118177700Smlaier YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); 1119177700Smlaier } 1120177700Smlaier 1121223637Sbz (yy_n_chars) += number_to_move; 1122223637Sbz YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; 1123223637Sbz YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; 1124223637Sbz 1125177700Smlaier (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; 1126177700Smlaier 1127223637Sbz return ret_val; 1128177700Smlaier} 1129177700Smlaier 1130177700Smlaier/* yy_get_previous_state - get the state just before the EOB char was reached */ 1131177700Smlaier 1132177700Smlaier static yy_state_type yy_get_previous_state (void) 1133177700Smlaier{ 1134177700Smlaier yy_state_type yy_current_state; 1135177700Smlaier char *yy_cp; 1136177700Smlaier 1137223637Sbz yy_current_state = (yy_start); 1138223637Sbz 1139223637Sbz for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) 1140177700Smlaier { 1141223637Sbz YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); 1142177700Smlaier if ( yy_accept[yy_current_state] ) 1143177700Smlaier { 1144177700Smlaier (yy_last_accepting_state) = yy_current_state; 1145223637Sbz (yy_last_accepting_cpos) = yy_cp; 1146223637Sbz } 1147223637Sbz while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1148177700Smlaier { 1149223637Sbz yy_current_state = (int) yy_def[yy_current_state]; 1150177700Smlaier if ( yy_current_state >= 35 ) 1151177700Smlaier yy_c = yy_meta[yy_c]; 1152177700Smlaier } 1153177700Smlaier yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; 1154177700Smlaier } 1155177700Smlaier 1156177700Smlaier return yy_current_state; 1157177700Smlaier} 1158177700Smlaier 1159177700Smlaier/* yy_try_NUL_trans - try to make a transition on the NUL character 1160177700Smlaier * 1161177700Smlaier * synopsis 1162177700Smlaier * next_state = yy_try_NUL_trans( current_state ); 1163177700Smlaier */ 1164177700Smlaier static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) 1165177700Smlaier{ 1166177700Smlaier int yy_is_jam; 1167223637Sbz char *yy_cp = (yy_c_buf_p); 1168223637Sbz 1169223637Sbz YY_CHAR yy_c = 1; 1170177700Smlaier if ( yy_accept[yy_current_state] ) 1171223637Sbz { 1172177700Smlaier (yy_last_accepting_state) = yy_current_state; 1173177700Smlaier (yy_last_accepting_cpos) = yy_cp; 1174177700Smlaier } 1175223637Sbz while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1176223637Sbz { 1177223637Sbz yy_current_state = (int) yy_def[yy_current_state]; 1178177700Smlaier if ( yy_current_state >= 35 ) 1179223637Sbz yy_c = yy_meta[yy_c]; 1180177700Smlaier } 1181177700Smlaier yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; 1182177700Smlaier yy_is_jam = (yy_current_state == 34); 1183177700Smlaier 1184223637Sbz return yy_is_jam ? 0 : yy_current_state; 1185223637Sbz} 1186223637Sbz 1187177700Smlaier#ifndef YY_NO_UNPUT 1188223637Sbz 1189177700Smlaier#endif 1190177700Smlaier 1191177700Smlaier#ifndef YY_NO_INPUT 1192177700Smlaier#ifdef __cplusplus 1193177700Smlaier static int yyinput (void) 1194177700Smlaier#else 1195223637Sbz static int input (void) 1196177700Smlaier#endif 1197130613Smlaier 1198130613Smlaier{ 1199130613Smlaier int c; 1200145836Smlaier 1201130613Smlaier *(yy_c_buf_p) = (yy_hold_char); 1202130613Smlaier 1203130613Smlaier if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) 1204130613Smlaier { 1205130613Smlaier /* yy_c_buf_p now points to the character we want to return. 1206130613Smlaier * If this occurs *before* the EOB characters, then it's a 1207145836Smlaier * valid NUL; if not, then we've hit the end of the buffer. 1208130613Smlaier */ 1209130613Smlaier if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) 1210171168Smlaier /* This was really a NUL. */ 1211130613Smlaier *(yy_c_buf_p) = '\0'; 1212171168Smlaier 1213171168Smlaier else 1214130613Smlaier { /* need more input */ 1215130613Smlaier int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); 1216130613Smlaier ++(yy_c_buf_p); 1217130613Smlaier 1218130613Smlaier switch ( yy_get_next_buffer( ) ) 1219130613Smlaier { 1220145836Smlaier case EOB_ACT_LAST_MATCH: 1221130613Smlaier /* This happens because yy_g_n_b() 1222130613Smlaier * sees that we've accumulated a 1223130613Smlaier * token and flags that we need to 1224130613Smlaier * try matching the token before 1225130613Smlaier * proceeding. But for input(), 1226130613Smlaier * there's no matching to consider. 1227145836Smlaier * So convert the EOB_ACT_LAST_MATCH 1228130613Smlaier * to EOB_ACT_END_OF_FILE. 1229130613Smlaier */ 1230130613Smlaier 1231171168Smlaier /* Reset buffer status. */ 1232130613Smlaier yyrestart( yyin ); 1233171168Smlaier 1234171168Smlaier /*FALLTHROUGH*/ 1235130613Smlaier 1236130613Smlaier case EOB_ACT_END_OF_FILE: 1237130613Smlaier { 1238130613Smlaier if ( yywrap( ) ) 1239171168Smlaier return 0; 1240171168Smlaier 1241171168Smlaier if ( ! (yy_did_buffer_switch_on_eof) ) 1242171168Smlaier YY_NEW_FILE; 1243171168Smlaier#ifdef __cplusplus 1244171168Smlaier return yyinput(); 1245171168Smlaier#else 1246171168Smlaier return input(); 1247171168Smlaier#endif 1248171168Smlaier } 1249171168Smlaier 1250171168Smlaier case EOB_ACT_CONTINUE_SCAN: 1251171168Smlaier (yy_c_buf_p) = (yytext_ptr) + offset; 1252171168Smlaier break; 1253171168Smlaier } 1254171168Smlaier } 1255171168Smlaier } 1256171168Smlaier 1257171168Smlaier c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ 1258171168Smlaier *(yy_c_buf_p) = '\0'; /* preserve yytext */ 1259171168Smlaier (yy_hold_char) = *++(yy_c_buf_p); 1260171168Smlaier 1261171168Smlaier return c; 1262171168Smlaier} 1263171168Smlaier#endif /* ifndef YY_NO_INPUT */ 1264171168Smlaier 1265171168Smlaier/** Immediately switch to a different input stream. 1266171168Smlaier * @param input_file A readable stream. 1267171168Smlaier * 1268171168Smlaier * @note This function does not reset the start condition to @c INITIAL . 1269171168Smlaier */ 1270171168Smlaier void yyrestart (FILE * input_file ) 1271171168Smlaier{ 1272171168Smlaier 1273171168Smlaier if ( ! YY_CURRENT_BUFFER ){ 1274171168Smlaier yyensure_buffer_stack (); 1275171168Smlaier YY_CURRENT_BUFFER_LVALUE = 1276171168Smlaier yy_create_buffer( yyin, YY_BUF_SIZE ); 1277171168Smlaier } 1278171168Smlaier 1279171168Smlaier yy_init_buffer( YY_CURRENT_BUFFER, input_file ); 1280171168Smlaier yy_load_buffer_state( ); 1281171168Smlaier} 1282171168Smlaier 1283171168Smlaier/** Switch to a different input buffer. 1284171168Smlaier * @param new_buffer The new input buffer. 1285171168Smlaier * 1286171168Smlaier */ 1287171168Smlaier void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) 1288171168Smlaier{ 1289171168Smlaier 1290171168Smlaier /* TODO. We should be able to replace this entire function body 1291171168Smlaier * with 1292171168Smlaier * yypop_buffer_state(); 1293171168Smlaier * yypush_buffer_state(new_buffer); 1294171168Smlaier */ 1295171168Smlaier yyensure_buffer_stack (); 1296171168Smlaier if ( YY_CURRENT_BUFFER == new_buffer ) 1297171168Smlaier return; 1298171168Smlaier 1299171168Smlaier if ( YY_CURRENT_BUFFER ) 1300171168Smlaier { 1301171168Smlaier /* Flush out information for old buffer. */ 1302171168Smlaier *(yy_c_buf_p) = (yy_hold_char); 1303171168Smlaier YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); 1304171168Smlaier YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1305171168Smlaier } 1306171168Smlaier 1307171168Smlaier YY_CURRENT_BUFFER_LVALUE = new_buffer; 1308171168Smlaier yy_load_buffer_state( ); 1309171168Smlaier 1310171168Smlaier /* We don't actually know whether we did this switch during 1311171168Smlaier * EOF (yywrap()) processing, but the only time this flag 1312171168Smlaier * is looked at is after yywrap() is called, so it's safe 1313171168Smlaier * to go ahead and always set it. 1314171168Smlaier */ 1315171168Smlaier (yy_did_buffer_switch_on_eof) = 1; 1316171168Smlaier} 1317171168Smlaier 1318171168Smlaierstatic void yy_load_buffer_state (void) 1319171168Smlaier{ 1320171168Smlaier (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1321171168Smlaier (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; 1322130613Smlaier yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; 1323145836Smlaier (yy_hold_char) = *(yy_c_buf_p); 1324130613Smlaier} 1325130613Smlaier 1326171168Smlaier/** Allocate and initialize an input buffer state. 1327130613Smlaier * @param file A readable stream. 1328171168Smlaier * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. 1329171168Smlaier * 1330130613Smlaier * @return the allocated buffer state. 1331130613Smlaier */ 1332130613Smlaier YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) 1333145836Smlaier{ 1334130613Smlaier YY_BUFFER_STATE b; 1335130613Smlaier 1336130613Smlaier b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); 1337130613Smlaier if ( ! b ) 1338171168Smlaier YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 1339171168Smlaier 1340171168Smlaier b->yy_buf_size = size; 1341171168Smlaier 1342171168Smlaier /* yy_ch_buf has to be 2 characters longer than the size given because 1343171168Smlaier * we need to put in 2 end-of-buffer characters. 1344171168Smlaier */ 1345130613Smlaier b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); 1346130613Smlaier if ( ! b->yy_ch_buf ) 1347130613Smlaier YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 1348171168Smlaier 1349171168Smlaier b->yy_is_our_buffer = 1; 1350171168Smlaier 1351130613Smlaier yy_init_buffer( b, file ); 1352130613Smlaier 1353171168Smlaier return b; 1354171168Smlaier} 1355171168Smlaier 1356171168Smlaier/** Destroy the buffer. 1357130613Smlaier * @param b a buffer created with yy_create_buffer() 1358171168Smlaier * 1359171168Smlaier */ 1360171168Smlaier void yy_delete_buffer (YY_BUFFER_STATE b ) 1361130613Smlaier{ 1362130613Smlaier 1363130613Smlaier if ( ! b ) 1364130613Smlaier return; 1365171168Smlaier 1366130613Smlaier if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ 1367130613Smlaier YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; 1368130613Smlaier 1369171168Smlaier if ( b->yy_is_our_buffer ) 1370171168Smlaier yyfree( (void *) b->yy_ch_buf ); 1371171168Smlaier 1372171168Smlaier yyfree( (void *) b ); 1373130613Smlaier} 1374130613Smlaier 1375130613Smlaier/* Initializes or reinitializes a buffer. 1376130613Smlaier * This function is sometimes called more than once on the same buffer, 1377130613Smlaier * such as during a yyrestart() or at EOF. 1378130613Smlaier */ 1379171168Smlaier static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) 1380171168Smlaier 1381171168Smlaier{ 1382171168Smlaier int oerrno = errno; 1383171168Smlaier 1384171168Smlaier yy_flush_buffer( b ); 1385171168Smlaier 1386171168Smlaier b->yy_input_file = file; 1387171168Smlaier b->yy_fill_buffer = 1; 1388171168Smlaier 1389171168Smlaier /* If b is the current buffer, then yy_init_buffer was _probably_ 1390171168Smlaier * called from yyrestart() or through yy_get_next_buffer. 1391171168Smlaier * In that case, we don't want to reset the lineno or column. 1392171168Smlaier */ 1393171168Smlaier if (b != YY_CURRENT_BUFFER){ 1394171168Smlaier b->yy_bs_lineno = 1; 1395171168Smlaier b->yy_bs_column = 0; 1396171168Smlaier } 1397171168Smlaier 1398171168Smlaier b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; 1399171168Smlaier 1400171168Smlaier errno = oerrno; 1401171168Smlaier} 1402171168Smlaier 1403171168Smlaier/** Discard all buffered characters. On the next scan, YY_INPUT will be called. 1404171168Smlaier * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. 1405171168Smlaier * 1406171168Smlaier */ 1407171168Smlaier void yy_flush_buffer (YY_BUFFER_STATE b ) 1408171168Smlaier{ 1409171168Smlaier if ( ! b ) 1410171168Smlaier return; 1411171168Smlaier 1412171168Smlaier b->yy_n_chars = 0; 1413171168Smlaier 1414171168Smlaier /* We always need two end-of-buffer characters. The first causes 1415223637Sbz * a transition to the end-of-buffer state. The second causes 1416223637Sbz * a jam in that state. 1417223637Sbz */ 1418171168Smlaier b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; 1419223637Sbz b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; 1420171168Smlaier 1421171168Smlaier b->yy_buf_pos = &b->yy_ch_buf[0]; 1422171168Smlaier 1423171168Smlaier b->yy_at_bol = 1; 1424223637Sbz b->yy_buffer_status = YY_BUFFER_NEW; 1425223637Sbz 1426223637Sbz if ( b == YY_CURRENT_BUFFER ) 1427223637Sbz yy_load_buffer_state( ); 1428223637Sbz} 1429223637Sbz 1430223637Sbz/** Pushes the new state onto the stack. The new state becomes 1431223637Sbz * the current state. This function will allocate the stack 1432223637Sbz * if necessary. 1433223637Sbz * @param new_buffer The new state. 1434223637Sbz * 1435223637Sbz */ 1436223637Sbzvoid yypush_buffer_state (YY_BUFFER_STATE new_buffer ) 1437223637Sbz{ 1438223637Sbz if (new_buffer == NULL) 1439223637Sbz return; 1440223637Sbz 1441223637Sbz yyensure_buffer_stack(); 1442223637Sbz 1443127145Smlaier /* This block is copied from yy_switch_to_buffer. */ 1444130585Sphk if ( YY_CURRENT_BUFFER ) 1445126261Smlaier { 1446171168Smlaier /* Flush out information for old buffer. */ 1447126261Smlaier *(yy_c_buf_p) = (yy_hold_char); 1448126258Smlaier YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); 1449126258Smlaier YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1450126258Smlaier } 1451145836Smlaier 1452126258Smlaier /* Only push if top exists. Otherwise, replace top. */ 1453145836Smlaier if (YY_CURRENT_BUFFER) 1454126258Smlaier (yy_buffer_stack_top)++; 1455126258Smlaier YY_CURRENT_BUFFER_LVALUE = new_buffer; 1456223637Sbz 1457223637Sbz /* copied from yy_switch_to_buffer. */ 1458126258Smlaier yy_load_buffer_state( ); 1459134166Smlaier (yy_did_buffer_switch_on_eof) = 1; 1460140494Sdhartmei} 1461134166Smlaier 1462126258Smlaier/** Removes and deletes the top of the stack, if present. 1463134166Smlaier * The next element becomes the new top. 1464126258Smlaier * 1465126258Smlaier */ 1466126258Smlaiervoid yypop_buffer_state (void) 1467126258Smlaier{ 1468126258Smlaier if (!YY_CURRENT_BUFFER) 1469126258Smlaier return; 1470126258Smlaier 1471126258Smlaier yy_delete_buffer(YY_CURRENT_BUFFER ); 1472126258Smlaier YY_CURRENT_BUFFER_LVALUE = NULL; 1473126258Smlaier if ((yy_buffer_stack_top) > 0) 1474126258Smlaier --(yy_buffer_stack_top); 1475126258Smlaier 1476126258Smlaier if (YY_CURRENT_BUFFER) { 1477126258Smlaier yy_load_buffer_state( ); 1478126258Smlaier (yy_did_buffer_switch_on_eof) = 1; 1479126258Smlaier } 1480126258Smlaier} 1481126258Smlaier 1482126258Smlaier/* Allocates the stack if it does not exist. 1483126258Smlaier * Guarantees space for at least one push. 1484126258Smlaier */ 1485126258Smlaierstatic void yyensure_buffer_stack (void) 1486126258Smlaier{ 1487126258Smlaier yy_size_t num_to_alloc; 1488126258Smlaier 1489126258Smlaier if (!(yy_buffer_stack)) { 1490126258Smlaier 1491126258Smlaier /* First allocation is just for 2 elements, since we don't know if this 1492126258Smlaier * scanner will even need a stack. We use 2 instead of 1 to avoid an 1493126258Smlaier * immediate realloc on the next call. 1494126258Smlaier */ 1495126258Smlaier num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ 1496130613Smlaier (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc 1497130613Smlaier (num_to_alloc * sizeof(struct yy_buffer_state*) 1498130613Smlaier ); 1499127145Smlaier if ( ! (yy_buffer_stack) ) 1500126261Smlaier YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); 1501126261Smlaier 1502145836Smlaier memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 1503145836Smlaier 1504126258Smlaier (yy_buffer_stack_max) = num_to_alloc; 1505130613Smlaier (yy_buffer_stack_top) = 0; 1506130613Smlaier return; 1507130613Smlaier } 1508130613Smlaier 1509130613Smlaier if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ 1510130613Smlaier 1511130613Smlaier /* Increase the buffer to prepare for a possible push. */ 1512130613Smlaier yy_size_t grow_size = 8 /* arbitrary grow size */; 1513126258Smlaier 1514126258Smlaier num_to_alloc = (yy_buffer_stack_max) + grow_size; 1515126258Smlaier (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc 1516126258Smlaier ((yy_buffer_stack), 1517126258Smlaier num_to_alloc * sizeof(struct yy_buffer_state*) 1518126258Smlaier ); 1519126258Smlaier if ( ! (yy_buffer_stack) ) 1520126258Smlaier YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); 1521126258Smlaier 1522126258Smlaier /* zero only the new slots.*/ 1523126258Smlaier memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); 1524126258Smlaier (yy_buffer_stack_max) = num_to_alloc; 1525126258Smlaier } 1526126258Smlaier} 1527126258Smlaier 1528126258Smlaier/** Setup the input buffer state to scan directly from a user-specified character buffer. 1529126258Smlaier * @param base the character buffer 1530126258Smlaier * @param size the size in bytes of the character buffer 1531126258Smlaier * 1532171168Smlaier * @return the newly allocated buffer state object. 1533126258Smlaier */ 1534126258SmlaierYY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) 1535126258Smlaier{ 1536126258Smlaier YY_BUFFER_STATE b; 1537126258Smlaier 1538126258Smlaier if ( size < 2 || 1539130613Smlaier base[size-2] != YY_END_OF_BUFFER_CHAR || 1540130613Smlaier base[size-1] != YY_END_OF_BUFFER_CHAR ) 1541127145Smlaier /* They forgot to leave room for the EOB's. */ 1542126261Smlaier return NULL; 1543126261Smlaier 1544126258Smlaier b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); 1545130613Smlaier if ( ! b ) 1546130613Smlaier YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); 1547130613Smlaier 1548130613Smlaier b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ 1549130613Smlaier b->yy_buf_pos = b->yy_ch_buf = base; 1550130613Smlaier b->yy_is_our_buffer = 0; 1551130613Smlaier b->yy_input_file = NULL; 1552130613Smlaier b->yy_n_chars = b->yy_buf_size; 1553130613Smlaier b->yy_is_interactive = 0; 1554130613Smlaier b->yy_at_bol = 1; 1555171168Smlaier b->yy_fill_buffer = 0; 1556171168Smlaier b->yy_buffer_status = YY_BUFFER_NEW; 1557130613Smlaier 1558171168Smlaier yy_switch_to_buffer( b ); 1559130613Smlaier 1560171168Smlaier return b; 1561223637Sbz} 1562223637Sbz 1563171168Smlaier/** Setup the input buffer state to scan a string. The next call to yylex() will 1564171168Smlaier * scan from a @e copy of @a str. 1565126258Smlaier * @param yystr a NUL-terminated string to scan 1566126258Smlaier * 1567126258Smlaier * @return the newly allocated buffer state object. 1568126258Smlaier * @note If you want to scan bytes that may contain NUL values, then use 1569171168Smlaier * yy_scan_bytes() instead. 1570127145Smlaier */ 1571223637SbzYY_BUFFER_STATE yy_scan_string (const char * yystr ) 1572171168Smlaier{ 1573223637Sbz 1574171168Smlaier return yy_scan_bytes( yystr, (int) strlen(yystr) ); 1575171168Smlaier} 1576171168Smlaier 1577171168Smlaier/** Setup the input buffer state to scan the given bytes. The next call to yylex() will 1578171168Smlaier * scan from a @e copy of @a bytes. 1579171168Smlaier * @param yybytes the byte buffer to scan 1580171168Smlaier * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. 1581126261Smlaier * 1582145836Smlaier * @return the newly allocated buffer state object. 1583145836Smlaier */ 1584126261SmlaierYY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) 1585126258Smlaier{ 1586126258Smlaier YY_BUFFER_STATE b; 1587126258Smlaier char *buf; 1588223637Sbz yy_size_t n; 1589223637Sbz int i; 1590223637Sbz 1591126258Smlaier /* Get memory for full buffer, including space for trailing EOB's. */ 1592223637Sbz n = (yy_size_t) (_yybytes_len + 2); 1593126258Smlaier buf = (char *) yyalloc( n ); 1594126258Smlaier if ( ! buf ) 1595127145Smlaier YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); 1596126261Smlaier 1597126261Smlaier for ( i = 0; i < _yybytes_len; ++i ) 1598126261Smlaier buf[i] = yybytes[i]; 1599126261Smlaier 1600126261Smlaier buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; 1601126261Smlaier 1602126261Smlaier b = yy_scan_buffer( buf, n ); 1603126261Smlaier if ( ! b ) 1604223637Sbz YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); 1605223637Sbz 1606223637Sbz /* It's okay to grow etc. this buffer, and we should throw it 1607223637Sbz * away when we're done. 1608223637Sbz */ 1609223637Sbz b->yy_is_our_buffer = 1; 1610223637Sbz 1611223637Sbz return b; 1612126258Smlaier} 1613126261Smlaier 1614223637Sbz#ifndef YY_EXIT_FAILURE 1615130613Smlaier#define YY_EXIT_FAILURE 2 1616130613Smlaier#endif 1617130613Smlaier 1618130613Smlaierstatic void yynoreturn yy_fatal_error (const char* msg ) 1619223637Sbz{ 1620126258Smlaier fprintf( stderr, "%s\n", msg ); 1621126258Smlaier exit( YY_EXIT_FAILURE ); 1622126258Smlaier} 1623126258Smlaier 1624126258Smlaier/* Redefine yyless() so it works in section 3 code. */ 1625223637Sbz 1626223637Sbz#undef yyless 1627126258Smlaier#define yyless(n) \ 1628126258Smlaier do \ 1629223637Sbz { \ 1630126261Smlaier /* Undo effects of setting up yytext. */ \ 1631126261Smlaier int yyless_macro_arg = (n); \ 1632126261Smlaier YY_LESS_LINENO(yyless_macro_arg);\ 1633126261Smlaier yytext[yyleng] = (yy_hold_char); \ 1634223637Sbz (yy_c_buf_p) = yytext + yyless_macro_arg; \ 1635126261Smlaier (yy_hold_char) = *(yy_c_buf_p); \ 1636223637Sbz *(yy_c_buf_p) = '\0'; \ 1637126261Smlaier yyleng = yyless_macro_arg; \ 1638223637Sbz } \ 1639223637Sbz while ( 0 ) 1640223637Sbz 1641223637Sbz/* Accessor methods (get/set functions) to struct members. */ 1642223637Sbz 1643223637Sbz/** Get the current line number. 1644223637Sbz * 1645145836Smlaier */ 1646126258Smlaierint yyget_lineno (void) 1647126258Smlaier{ 1648126258Smlaier 1649126258Smlaier return yylineno; 1650126258Smlaier} 1651126258Smlaier 1652126258Smlaier/** Get the input stream. 1653126258Smlaier * 1654126258Smlaier */ 1655126258SmlaierFILE *yyget_in (void) 1656126258Smlaier{ 1657145836Smlaier return yyin; 1658145836Smlaier} 1659126258Smlaier 1660126258Smlaier/** Get the output stream. 1661126258Smlaier * 1662126258Smlaier */ 1663126258SmlaierFILE *yyget_out (void) 1664126258Smlaier{ 1665126258Smlaier return yyout; 1666126258Smlaier} 1667126258Smlaier 1668126258Smlaier/** Get the length of the current token. 1669126258Smlaier * 1670126258Smlaier */ 1671126258Smlaierint yyget_leng (void) 1672126258Smlaier{ 1673158486Smlaier return yyleng; 1674158486Smlaier} 1675158486Smlaier 1676158486Smlaier/** Get the current token. 1677158486Smlaier * 1678126258Smlaier */ 1679126258Smlaier 1680126258Smlaierchar *yyget_text (void) 1681158486Smlaier{ 1682223637Sbz return yytext; 1683158486Smlaier} 1684158486Smlaier 1685223637Sbz/** Set the current line number. 1686223637Sbz * @param _line_number line number 1687223637Sbz * 1688158486Smlaier */ 1689126258Smlaiervoid yyset_lineno (int _line_number ) 1690126258Smlaier{ 1691126258Smlaier 1692223637Sbz yylineno = _line_number; 1693223637Sbz} 1694223637Sbz 1695223637Sbz/** Set the input stream. This does not discard the current 1696223637Sbz * input buffer. 1697126258Smlaier * @param _in_str A readable stream. 1698126258Smlaier * 1699126258Smlaier * @see yy_switch_to_buffer 1700126258Smlaier */ 1701126258Smlaiervoid yyset_in (FILE * _in_str ) 1702171168Smlaier{ 1703171168Smlaier yyin = _in_str ; 1704171168Smlaier} 1705171168Smlaier 1706171168Smlaiervoid yyset_out (FILE * _out_str ) 1707171168Smlaier{ 1708171168Smlaier yyout = _out_str ; 1709126258Smlaier} 1710130613Smlaier 1711126258Smlaierint yyget_debug (void) 1712126258Smlaier{ 1713223637Sbz return yy_flex_debug; 1714130613Smlaier} 1715126258Smlaier 1716126258Smlaiervoid yyset_debug (int _bdebug ) 1717126258Smlaier{ 1718223637Sbz yy_flex_debug = _bdebug ; 1719223637Sbz} 1720223637Sbz 1721126258Smlaierstatic int yy_init_globals (void) 1722223637Sbz{ 1723126258Smlaier /* Initialization is the same as for the non-reentrant scanner. 1724126258Smlaier * This function is called from yylex_destroy(), so don't allocate here. 1725126258Smlaier */ 1726126258Smlaier 1727126258Smlaier (yy_buffer_stack) = NULL; 1728126258Smlaier (yy_buffer_stack_top) = 0; 1729223637Sbz (yy_buffer_stack_max) = 0; 1730223637Sbz (yy_c_buf_p) = NULL; 1731223637Sbz (yy_init) = 0; 1732126258Smlaier (yy_start) = 0; 1733223637Sbz 1734126258Smlaier/* Defined in main.c */ 1735126258Smlaier#ifdef YY_STDINIT 1736126258Smlaier yyin = stdin; 1737126258Smlaier yyout = stdout; 1738126258Smlaier#else 1739126258Smlaier yyin = NULL; 1740126258Smlaier yyout = NULL; 1741126258Smlaier#endif 1742126258Smlaier 1743126258Smlaier /* For future reference: Set errno on error, since we are called by 1744126258Smlaier * yylex_init() 1745171168Smlaier */ 1746130613Smlaier return 0; 1747223637Sbz} 1748223637Sbz 1749223637Sbz/* yylex_destroy is for both reentrant and non-reentrant scanners. */ 1750126258Smlaierint yylex_destroy (void) 1751223637Sbz{ 1752126258Smlaier 1753126258Smlaier /* Pop the buffer stack, destroying each element. */ 1754126258Smlaier while(YY_CURRENT_BUFFER){ 1755171168Smlaier yy_delete_buffer( YY_CURRENT_BUFFER ); 1756126258Smlaier YY_CURRENT_BUFFER_LVALUE = NULL; 1757126258Smlaier yypop_buffer_state(); 1758180788Sjulian } 1759232292Sbz 1760171168Smlaier /* Destroy the stack itself. */ 1761171168Smlaier yyfree((yy_buffer_stack) ); 1762171168Smlaier (yy_buffer_stack) = NULL; 1763171168Smlaier 1764171168Smlaier /* Reset the globals. This is important in a non-reentrant scanner so the next time 1765130613Smlaier * yylex() is called, initialization will occur. */ 1766130613Smlaier yy_init_globals( ); 1767130613Smlaier 1768130613Smlaier return 0; 1769130613Smlaier} 1770130613Smlaier 1771130613Smlaier/* 1772130613Smlaier * Internal utility routines. 1773130613Smlaier */ 1774130613Smlaier 1775130613Smlaier#ifndef yytext_ptr 1776130613Smlaierstatic void yy_flex_strncpy (char* s1, const char * s2, int n ) 1777130613Smlaier{ 1778126258Smlaier 1779126258Smlaier int i; 1780126258Smlaier for ( i = 0; i < n; ++i ) 1781126258Smlaier s1[i] = s2[i]; 1782126258Smlaier} 1783126258Smlaier#endif 1784126258Smlaier 1785126258Smlaier#ifdef YY_NEED_STRLEN 1786126258Smlaierstatic int yy_flex_strlen (const char * s ) 1787171168Smlaier{ 1788171168Smlaier int n; 1789171168Smlaier for ( n = 0; s[n]; ++n ) 1790171168Smlaier ; 1791171168Smlaier 1792171168Smlaier return n; 1793145836Smlaier} 1794145836Smlaier#endif 1795145836Smlaier 1796223637Sbzvoid *yyalloc (yy_size_t size ) 1797126258Smlaier{ 1798223637Sbz return malloc(size); 1799126258Smlaier} 1800145836Smlaier 1801145836Smlaiervoid *yyrealloc (void * ptr, yy_size_t size ) 1802223637Sbz{ 1803223637Sbz 1804223637Sbz /* The cast to (char *) in the following accommodates both 1805126258Smlaier * implementations that use char* generic pointers, and those 1806223637Sbz * that use void* generic pointers. It works with the latter 1807126258Smlaier * because both ANSI C and C++ allow castless assignment from 1808126258Smlaier * any pointer type to void*, and deal with argument conversions 1809126258Smlaier * as though doing an assignment. 1810145836Smlaier */ 1811145836Smlaier return realloc(ptr, size); 1812223637Sbz} 1813145836Smlaier 1814145836Smlaiervoid yyfree (void * ptr ) 1815145836Smlaier{ 1816145836Smlaier free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ 1817145836Smlaier} 1818145836Smlaier 1819223637Sbz#define YYTABLES_NAME "yytables" 1820223637Sbz 1821223637Sbz#line 67 "tokenizer.l" 1822126258Smlaier 1823223637Sbz 1824126258Smlaierint32_t 1825145836Smlaiernumber(void) 1826126258Smlaier{ 1827126258Smlaier long l; 1828126258Smlaier 1829126258Smlaier errno = 0; 1830126258Smlaier l = strtol(yytext, NULL, 0); 1831126258Smlaier if (((l == LONG_MAX || l == LONG_MIN) && errno == ERANGE) || 1832126258Smlaier l > INT32_MAX || l < INT32_MIN) { 1833126258Smlaier m4_warnx("numeric overflow in expr: %s", yytext); 1834171168Smlaier } 1835171168Smlaier return l; 1836223637Sbz} 1837171168Smlaier 1838171168Smlaierint32_t 1839171168Smlaierparse_radix(void) 1840223637Sbz{ 1841171168Smlaier long base; 1842171168Smlaier char *next; 1843126258Smlaier long l; 1844171168Smlaier int d; 1845171168Smlaier 1846126258Smlaier l = 0; 1847126258Smlaier base = strtol(yytext+2, &next, 0); 1848171168Smlaier if (base > 36 || next == NULL) { 1849126258Smlaier m4_warnx("error in number %s", yytext); 1850126258Smlaier } else { 1851126258Smlaier next++; 1852126258Smlaier while (*next != 0) { 1853126258Smlaier if (*next >= '0' && *next <= '9') 1854126258Smlaier d = *next - '0'; 1855126258Smlaier else if (*next >= 'a' && *next <= 'z') 1856126258Smlaier d = *next - 'a' + 10; 1857126258Smlaier else { 1858145836Smlaier assert(*next >= 'A' && *next <= 'Z'); 1859145836Smlaier d = *next - 'A' + 10; 1860126258Smlaier } 1861126258Smlaier if (d >= base) { 1862126258Smlaier m4_warnx("error in number %s", yytext); 1863126258Smlaier return 0; 1864126258Smlaier } 1865126258Smlaier l = base * l + d; 1866126258Smlaier next++; 1867126258Smlaier } 1868126258Smlaier } 1869126258Smlaier return l; 1870126258Smlaier} 1871126258Smlaier 1872126258Smlaier 1873126258Smlaier