00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00018
00019
00020
00022
00051 #ifndef FLEX_BOTTOM_PART
00052
00053 #define YY_NO_UNPUT
00054
00067
00068
00069 #define PI_TOK() do { yyextra->_pi_tok(yyleng); } while(0)
00070
00071 #define PI_TOKL(l) do { yyextra->_pi_tok(l); } while(0)
00072
00073 #define PI_TAB() do { yyextra->_pi_tab(); } while(0)
00074
00075 #define PI_LINE() do { yyextra->_pi_line(); } while(0)
00076
00077 #define PI_CHAR(c) do { yyextra->_pi_char(c); } while(0)
00078
00080 #define PI_STR(str,len) do { yyextra->_pi_str(str,len); } while(0)
00081
00083 #define PI_START() do { yyextra->_pi_start(); } while(0)
00084
00085 #define PI_EOF() do { yyextra->_pi_eof(); } while(0)
00086
00088 #define YY_INPUT(buf,result,max_size) \
00089 { \
00090 _InternalFlexScannerBase::LexerInput *inp= \
00091 (_InternalFlexScannerBase::LexerInput*)yyin; \
00092 ssize_t res=inp->read(buf,max_size); \
00093 if(res<0) \
00094 { abort(); } \
00095 result=res; \
00096 }
00097
00098
00099
00100 #define YY_SCANNER_MAGIC \
00101 yyscan_t yyscanner=scanner; \
00102 \
00103 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
00104
00105
00106 #else
00107
00108
00109 int PREFIX_FlexScannerBase::_lex(void *scanner)
00110 {
00111 return(PREFIX_lex(scanner));
00112 }
00113
00114 int PREFIX_FlexScannerBase::_lex_init(void **scanner_p)
00115 {
00116 int rv=PREFIX_lex_init(scanner_p);
00117 if(!rv)
00118 { PREFIX_set_extra(this,scanner); }
00119 return(rv);
00120 }
00121
00122 void PREFIX_FlexScannerBase::_lex_destroy(void *scanner)
00123 {
00124 PREFIX_lex_destroy(scanner);
00125 }
00126
00127
00128 int PREFIX_FlexScannerBase::_wrap()
00129 {
00130 Assert(magic==MyMagic);
00131 Assert(scanner);
00132
00133 YY_SCANNER_MAGIC
00134
00135
00136
00137 if(YY_CURRENT_BUFFER==NULL)
00138 { Assert(!top_inp); return(1); }
00139
00140
00141
00142
00143
00144 bool must_pop_state=0;
00145 if(yyin)
00146 {
00147 LexerInput *inp=(LexerInput*)yyin;
00148 Assert(top_inp==inp);
00149 Assert(read_inp!=inp);
00150
00151 must_pop_state=inp->must_pop_state;
00152 if(inp->must_pop_pos_arch)
00153 {
00154 Assert(pos_arch);
00155 pos_arch->EndFile();
00156 }
00157
00158
00159 for(TokenEntry *_i=inp->prev_toks.first(); _i; )
00160 {
00161 TokenEntry *i=_i;
00162 _i=_i->next;
00163
00164 if(!i->MayBeCleared())
00165 {
00166 zombie_list.append(inp->prev_toks.dequeue(i));
00167 ++zombie_list_nents;
00168 }
00169 }
00170 _TidyUpZombieList();
00171
00172
00173 if(inp->prev_toks.count()>cfg.old_toks_wanted+1)
00174 { Error("OOPS: ~TokenInput: %d tokens left in prev_toks.",
00175 inp->prev_toks.count()); }
00176
00177 delete inp;
00178 yyin=NULL;
00179 top_inp=NULL;
00180 }
00181 else Assert(top_inp==NULL);
00182
00183
00184
00185 PREFIX_pop_buffer_state(scanner);
00186 --file_depth;
00187
00188
00189 int retval;
00190 if(YY_CURRENT_BUFFER==NULL)
00191 {
00192
00193 Assert(yyin==NULL);
00194 Assert(!file_depth);
00195 retval=1;
00196
00197 }
00198 else
00199 {
00200
00201 Assert(yyin!=NULL);
00202 Assert(file_depth>0);
00203 top_inp=(LexerInput*)yyin;
00204
00205
00206 p1=top_inp->saved;
00207
00208
00209 if(must_pop_state)
00210 { yy_pop_state(scanner); }
00211
00212 retval=0;
00213
00214
00215 }
00216
00217 return(retval);
00218 }
00219
00220
00221 int PREFIX_FlexScannerBase::_SetInputBH(LexerInput *inp,bool included,
00222 XYPos alt_pos,SourcePositionArchive *alt_pos_arch)
00223 {
00224 bool need_push=included;
00225
00226
00227 YY_SCANNER_MAGIC
00228 if(YY_CURRENT_BUFFER==NULL)
00229 { need_push=0; }
00230
00231
00232 size_t needlen=YY_BUF_SIZE;
00233
00234 YY_BUFFER_STATE buf=PREFIX_create_buffer((FILE*)inp,needlen,scanner);
00235 if(!buf) _AllocFailure(needlen);
00236
00237
00238 if(top_inp)
00239 { top_inp->saved=p1; }
00240
00241
00242 p0=alt_pos;
00243 p1=alt_pos;
00244 if(need_push)
00245 {
00246 Assert(pos_arch);
00247 Assert(!alt_pos_arch);
00248
00249 PREFIX_push_buffer_state(buf,scanner);
00250 ++file_depth;
00251 }
00252 else
00253 {
00254 Assert(!pos_arch);
00255
00256 const TLString &file_name=inp->fp_path;
00257
00258 if(alt_pos_arch)
00259 {
00260 pos_arch=alt_pos_arch;
00261 pos_arch_allocated=0;
00262
00263
00264 if(pos_arch->CurrentFile()->path()!=file_name)
00265 { Assert(0); }
00266 }
00267 else
00268 {
00269
00270 pos_arch=new SourcePositionArchive(file_name);
00271 pos_arch_allocated=1;
00272 }
00273
00274 PREFIX_switch_to_buffer(buf,scanner);
00275
00276 Assert(file_depth==0);
00277 file_depth=1;
00278 }
00279
00280
00281
00282
00283 return(0);
00284 }
00285
00286
00287 PREFIX_FlexScannerBase::PREFIX_FlexScannerBase() :
00288 _InternalFlexScannerBase()
00289 {
00290
00291 _InternalFlexScannerBase::_reset(1);
00292 }
00293
00294 PREFIX_FlexScannerBase::~PREFIX_FlexScannerBase()
00295 {
00296
00297 _InternalFlexScannerBase::_reset(1);
00298 }
00299
00300 #endif