home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / flexpp.zip / FLEX / FLEXSKEL.H < prev    next >
C/C++ Source or Header  |  1994-10-24  |  9KB  |  392 lines

  1. /* A lexical scanner header generated by flex */
  2. /* MODIFIED FOR C++ CLASS BY Alain Coetmeur: coetmeur(at)icdc.fr */
  3. /* Note that (at) mean the 'at' symbol that I cannot write */
  4. /* because it is expanded to the class name */
  5. /* made at Informatique-CDC, Research&development department */
  6. /* company from the Caisse Des Depots et Consignations */
  7.  
  8.  
  9. /* Modified to support cheap/builtin linecount, 1994/10/24.
  10. ** by Gregor Buehler 100440.2470(at)compuserve.com
  11. ** Changes: included YY_(at)_LINENO definitions like for YY_(at)_LENG
  12. **          included related member (C++) or static/extern (C) variables
  13. */
  14.  
  15.  
  16. /*********************************************/
  17. /* SYSTEM dependent declaration, includes... */
  18. /*********************************************/
  19. /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
  20. #ifdef c_plusplus
  21. #ifndef __cplusplus
  22. #define __cplusplus
  23. #endif
  24. #endif
  25. #ifdef __cplusplus
  26. #ifndef YY_USE_PROTOS
  27. #define YY_USE_PROTOS
  28. #endif
  29. #ifndef YY_USE_CLASS
  30. #define YY_USE_CLASS
  31. #endif
  32. #else    /* ! __cplusplus */
  33. #ifdef __STDC__
  34. #ifdef __GNUC__
  35. #else
  36. #endif    /* __GNUC__ */
  37. #ifndef YY_USE_PROTOS
  38. #define YY_USE_PROTOS
  39. #endif
  40. #endif    /* __STDC__ */
  41. #endif    /* ! __cplusplus */
  42. /*********************************************/
  43. /* COMPILER DEPENDENT   MACROS               */
  44. /*********************************************/
  45. /* use prototypes in function declarations */
  46. #ifndef YY_PROTO
  47. #ifdef YY_USE_PROTOS
  48. #define YY_PROTO(proto) proto
  49. #else
  50. #define YY_PROTO(proto) ()
  51. #endif
  52. #endif
  53. #include <stdio.h>
  54.  
  55.  
  56.  
  57.  
  58. %% here is the declaration from section1 %header{ 
  59.  
  60. #ifdef YY_USE_CLASS
  61. #ifdef YY_@_IOSTREAM
  62. #include <iostream.h>
  63. #define YY_@_IFILE  istream
  64. #define YY_@_OFILE ostream 
  65. #define YY_@_ERRFILE cerr
  66.  
  67. #ifndef YY_@_IFILE_DEFAULT
  68. #define YY_@_IFILE_DEFAULT &cin
  69. #endif
  70.  
  71. #ifndef YY_@_OFILE_DEFAULT
  72. #define YY_@_OFILE_DEFAULT &cout
  73. #endif
  74.  
  75. #endif
  76. #endif
  77.  
  78. #ifndef YY_@_IFILE
  79. #define YY_@_IFILE FILE 
  80. #endif
  81.  
  82. #ifndef YY_@_OFILE
  83. #define YY_@_OFILE FILE 
  84. #endif
  85.  
  86. #ifndef YY_@_ERRFILE
  87. #define YY_@_ERRFILE stderr
  88. #endif
  89.  
  90. #ifndef YY_@_IFILE_DEFAULT
  91. #define YY_@_IFILE_DEFAULT stdin
  92. #endif
  93.  
  94. #ifndef YY_@_OFILE_DEFAULT
  95. #define YY_@_OFILE_DEFAULT stdout
  96. #endif
  97.  
  98.  
  99.  
  100.  
  101. #ifndef YY_@_TEXT
  102. #define YY_@_TEXT yytext
  103. #endif
  104. #ifndef YY_@_LENG
  105. #define YY_@_LENG yyleng
  106. #endif
  107. #ifndef YY_@_LINENO
  108. #define YY_@_LINENO yylineno
  109. #endif
  110. #ifndef YY_@_IN
  111. #define YY_@_IN yyin
  112. #endif
  113. #ifndef YY_@_OUT
  114. #define YY_@_OUT yyout
  115. #endif
  116.  
  117. #ifndef YY_@_LEX_RETURN
  118. #define YY_@_LEX_RETURN int
  119. #else
  120. #ifndef YY_@_LEX_DEFINED
  121. #define YY_@_LEX_DEFINED 
  122. #endif
  123. #endif
  124.  
  125. #ifndef YY_@_LEX
  126. #define YY_@_LEX yylex
  127. #else
  128. #ifndef YY_@_LEX_DEFINED
  129. #define YY_@_LEX_DEFINED 
  130. #endif
  131. #endif
  132.  
  133. #ifndef YY_@_LEX_PARAM
  134. #ifndef YY_USE_PROTOS
  135. #define YY_@_LEX_PARAM 
  136. #else
  137. #define YY_@_LEX_PARAM void
  138. #endif
  139. #else
  140. #ifndef YY_@_LEX_DEFINED
  141. #define YY_@_LEX_DEFINED 
  142. #endif
  143. #endif
  144.  
  145. #ifndef YY_@_LEX_PARAM_DEF
  146. #define YY_@_LEX_PARAM_DEF
  147. #else
  148. #ifndef YY_@_LEX_DEFINED
  149. #define YY_@_LEX_DEFINED 
  150. #endif
  151. #endif
  152.  
  153. #ifndef YY_@_RESTART
  154. #define YY_@_RESTART yyrestart
  155. #endif
  156. #ifndef YY_@_SWITCH_TO_BUFFER
  157. #define YY_@_SWITCH_TO_BUFFER yy_switch_to_buffer
  158. #endif
  159. #ifndef YY_@_LOAD_BUFFER_STATE
  160. #define YY_@_LOAD_BUFFER_STATE yy_load_buffer_state
  161. #endif
  162.  
  163. #ifndef YY_@_CREATE_BUFFER
  164. #define YY_@_CREATE_BUFFER yy_create_buffer
  165. #ifndef YY_USE_CLASS
  166. #ifndef yy_new_buffer
  167. #define yy_new_buffer yy_create_buffer
  168. #endif
  169. #endif
  170. #endif
  171. #ifndef YY_@_DELETE_BUFFER
  172. #define YY_@_DELETE_BUFFER yy_delete_buffer
  173. #endif
  174. #ifndef YY_@_INIT_BUFFER
  175. #define YY_@_INIT_BUFFER yy_init_buffer
  176. #endif
  177.  
  178.  
  179.  
  180. #ifdef YY_@_FLEX_DEBUG
  181. #ifndef YY_@_DEBUG
  182. #define YY_@_DEBUG 1
  183. #endif
  184. #else
  185. #ifndef YY_@_DEBUG
  186. #define YY_@_DEBUG 0
  187. #endif
  188. #endif
  189.  
  190. #if YY_@_DEBUG != 0
  191. #ifndef YY_@_DEBUG_FLAG
  192. #define YY_@_DEBUG_FLAG yy_flex_debug
  193. #endif
  194. #ifndef YY_@_DEBUG_INIT
  195. #define YY_@_DEBUG_INIT 1
  196. #endif
  197. #endif
  198.  
  199.  
  200.  
  201.  
  202. #ifndef YY_USE_CLASS
  203. #ifndef YY_@_CURRENT_BUFFER
  204. #define YY_@_CURRENT_BUFFER yy_current_buffer
  205. #endif
  206. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  207.  
  208. extern void YY_@_RESTART YY_PROTO(( YY_@_IFILE *input_file ));
  209. extern void YY_@_SWITCH_TO_BUFFER YY_PROTO(( YY_BUFFER_STATE new_buffer ));
  210. extern void YY_@_LOAD_BUFFER_STATE YY_PROTO(( void ));
  211. extern YY_BUFFER_STATE YY_@_CREATE_BUFFER YY_PROTO(( YY_@_IFILE *file, int size ));
  212. extern void YY_@_DELETE_BUFFER YY_PROTO(( YY_BUFFER_STATE b ));
  213. extern void YY_@_INIT_BUFFER YY_PROTO(( YY_BUFFER_STATE b, YY_@_IFILE *file ));
  214.  
  215. #if YY_@_DEBUG != 0
  216. extern int YY_@_DEBUG_FLAG ;
  217. #endif
  218. extern YY_@_CHAR  *YY_@_TEXT;
  219. extern int YY_@_LENG;
  220. extern int YY_@_LINENO;
  221. extern YY_@_IFILE *YY_@_IN;
  222. extern YY_@_OFILE *YY_@_OUT;
  223. #ifdef YY_@_LEX_DEFINED
  224. extern YY_@_LEX_RETURN YY_@_LEX ( YY_@_LEX_PARAM )
  225. YY_@_LEX_PARAM_DEF
  226. #else
  227. #ifndef YY_DECL
  228. extern YY_@_LEX_RETURN YY_@_LEX ( YY_@_LEX_PARAM )
  229. YY_@_LEX_PARAM_DEF
  230. #else
  231. /* no declaration if oldstyle flex */
  232. #endif
  233. #endif
  234. #else
  235.  
  236. #ifndef YY_@_CURRENT_BUFFER
  237. #define YY_@_CURRENT_BUFFER YY_CURRENT_BUFFER
  238. #endif
  239. #ifndef YY_@_CLASS
  240. #define YY_@_CLASS @
  241. #endif
  242. #ifndef YY_@_ECHO
  243. #define YY_@_ECHO yy_echo
  244. #endif
  245. #ifdef YY_@_ECHO_PURE
  246. #define YY_@_ECHO_NOCODE
  247. #endif
  248.  
  249. #ifndef YY_@_ECHO_CODE
  250. #ifndef YY_@_IOSTREAM
  251. #define YY_@_ECHO_CODE fwrite( (char *) YY_@_TEXT, YY_@_LENG, 1, YY_@_OUT );
  252. #else
  253. #define YY_@_ECHO_CODE (YY_@_OUT->write( (char *) YY_@_TEXT, YY_@_LENG));
  254. #endif
  255. #endif
  256.  
  257. #ifndef YY_@_INPUT
  258. #define YY_@_INPUT yy_input
  259. #endif
  260. #ifdef YY_@_INPUT_PURE
  261. #define YY_@_INPUT_NOCODE
  262. #endif
  263.  
  264. #ifndef YY_@_INPUT_CODE
  265. #ifndef YY_@_IOSTREAM
  266. #define YY_@_INPUT_CODE return result= fread(  buffer, 1,max_size,YY_@_IN );
  267. #else
  268. #define YY_@_INPUT_CODE if(YY_@_IN->eof())  result=0;else {YY_@_IN->read(buffer,max_size);result=YY_@_IN->gcount();YY_@_IN->clear(YY_@_IN->rdstate()&(~ios::failbit));if(YY_@_IN->bad()) result= -1;} return result;
  269. #endif
  270. #endif
  271.  
  272. #ifdef YY_@_FATAL_ERROR_PURE
  273. #define YY_@_FATAL_ERRO_NOCODE
  274. #endif
  275. #ifndef YY_@_FATAL_ERROR
  276. #define YY_@_FATAL_ERROR yy_fatal_error
  277. #endif
  278.  
  279. #ifndef YY_@_FATAL_ERROR_CODE
  280. #ifndef YY_@_IOSTREAM
  281. #define YY_@_FATAL_ERROR_CODE fputs( msg, YY_@_ERRFILE );putc( '\n', YY_@_ERRFILE );exit( 1 );
  282. #else
  283. #define YY_@_FATAL_ERROR_CODE YY_@_ERRFILE<< msg <<endl;exit( 1 );
  284. #endif
  285. #endif
  286.  
  287. #ifndef YY_@_WRAP
  288. #define YY_@_WRAP yy_wrap
  289. #endif
  290. #ifdef YY_@_WRAP_PURE
  291. #define YY_@_WRAP_NOCODE
  292. #endif
  293. #ifndef YY_@_WRAP_CODE
  294. #define YY_@_WRAP_CODE return 1;
  295. #endif
  296.  
  297.  
  298. #ifndef YY_@_INHERIT
  299. #define YY_@_INHERIT
  300. #endif
  301. #ifndef YY_@_MEMBERS
  302. #define YY_@_MEMBERS 
  303. #endif
  304. #ifndef YY_@_CONSTRUCTOR_PARAM
  305. #define YY_@_CONSTRUCTOR_PARAM
  306. #endif
  307. #ifndef YY_@_CONSTRUCTOR_CODE
  308. #define YY_@_CONSTRUCTOR_CODE
  309. #endif
  310. #ifndef YY_@_CONSTRUCTOR_INIT
  311. #define YY_@_CONSTRUCTOR_INIT
  312. #endif
  313. #ifndef YY_@_DESTRUCTOR_CODE
  314. #define YY_@_DESTRUCTOR_CODE
  315. #endif
  316. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  317.  
  318. class YY_@_CLASS YY_@_INHERIT
  319. {
  320.  private:/* data */
  321.  YY_@_CHAR  *yy_c_buf_p;
  322.  YY_@_CHAR  yy_hold_char;
  323.  int yy_n_chars;
  324.  int yy_init;
  325.  int yy_start;
  326.  int yy_did_buffer_switch_on_eof;
  327.  private: /* functions */
  328.  void yy_initialize();
  329.  int input();
  330.  int yyinput() {return input();};
  331.  int yy_get_next_buffer();
  332.  void yyunput( YY_@_CHAR  c, YY_@_CHAR  *buf_ptr );
  333.  /* use long instead of yy_state_type because it is undef */
  334.  long yy_get_previous_state_ ( void );
  335.  long yy_try_NUL_trans_  ( long current_state_ );
  336.  protected:/* non virtual */
  337.  YY_BUFFER_STATE YY_@_CURRENT_BUFFER;
  338.  void YY_@_RESTART ( YY_@_IFILE *input_file );
  339.  void YY_@_SWITCH_TO_BUFFER( YY_BUFFER_STATE new_buffer );
  340.  void YY_@_LOAD_BUFFER_STATE( void );
  341.  YY_BUFFER_STATE YY_@_CREATE_BUFFER( YY_@_IFILE *file, int size );
  342.  void YY_@_DELETE_BUFFER( YY_BUFFER_STATE b );
  343.  void YY_@_INIT_BUFFER( YY_BUFFER_STATE b, YY_@_IFILE *file );
  344.  protected: /* virtual */
  345.  virtual void YY_@_ECHO()
  346. #ifdef YY_@_ECHO_PURE
  347.   =0
  348. #endif
  349.   ;
  350.  virtual int  YY_@_INPUT(char  *buf,int &result,int max_size)
  351. #ifdef YY_@_INPUT_PURE
  352.   =0
  353. #endif
  354.   ;
  355.  virtual void  YY_@_FATAL_ERROR(const char *msg)
  356. #ifdef YY_@_FATAL_ERROR_PURE
  357.   =0
  358. #endif
  359.   ;
  360.  virtual int  YY_@_WRAP()
  361. #ifdef YY_@_WRAP_PURE
  362.   =0
  363. #endif
  364.   ;
  365.  private:
  366.  int yy_last_no_of_newline;   /* used for linecount macros */
  367.  
  368.  public:
  369.  YY_@_CHAR  *YY_@_TEXT;
  370.  int YY_@_LENG;
  371.  int YY_@_LINENO;
  372.  YY_@_IFILE *YY_@_IN;
  373.  YY_@_OFILE *YY_@_OUT;
  374.  YY_@_LEX_RETURN YY_@_LEX ( YY_@_LEX_PARAM);
  375.  YY_@_CLASS(YY_@_CONSTRUCTOR_PARAM) ;
  376.  virtual ~YY_@_CLASS() ;
  377. #if YY_@_DEBUG != 0
  378.  int YY_@_DEBUG_FLAG;
  379. #endif
  380.  public: /* added members */
  381.  YY_@_MEMBERS 
  382. };
  383. #endif
  384.  
  385.  
  386.  
  387. /* declaration of externs for public use of yylex scanner */
  388.  
  389. %% here is the declaration from section2 %header{
  390.  
  391. /* end of generated header */
  392.