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