2004-07-18 00:24:25 +00:00
|
|
|
/* $Id$ */
|
2001-02-01 20:21:25 +00:00
|
|
|
|
|
|
|
/* This file is #include'd at the bottom of a Lex/Flex scanner
|
|
|
|
for use with the Lemon parser. You must have #define'd:
|
|
|
|
|
|
|
|
MODNAME module name for creating function names:
|
|
|
|
|
|
|
|
Prototypes:
|
|
|
|
|
|
|
|
void MODNAME_scanner_text(char *text);
|
|
|
|
void MODNAME_scanner_cleanup(void);
|
|
|
|
int MODNAME_wrap(void);
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <cppmagic.h>
|
|
|
|
|
|
|
|
#define TEXT_FUNC CONCAT(MODNAME,_scanner_text)
|
|
|
|
#define FILE_FUNC CONCAT(MODNAME,_scanner_file)
|
|
|
|
#define CLEANUP_FUNC CONCAT(MODNAME,_scanner_cleanup)
|
2007-07-31 01:24:26 +00:00
|
|
|
#ifndef YY_SKIP_YYWRAP
|
2001-02-01 20:21:25 +00:00
|
|
|
#define WRAP_FUNC CONCAT(MODNAME,_wrap)
|
2007-07-31 01:24:26 +00:00
|
|
|
#endif
|
2001-02-01 20:21:25 +00:00
|
|
|
|
2004-04-25 04:53:42 +00:00
|
|
|
/* flex 2.5.31 no longer #defines these as yy_* if used with -P. */
|
|
|
|
#ifndef yy_scan_string
|
|
|
|
#define yy_scan_string CONCAT(FLEX_YY_PREFIX, _scan_string)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef yy_create_buffer
|
|
|
|
#define yy_create_buffer CONCAT(FLEX_YY_PREFIX, _create_buffer)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef yy_switch_to_buffer
|
|
|
|
#define yy_switch_to_buffer CONCAT(FLEX_YY_PREFIX, _switch_to_buffer)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef yy_delete_buffer
|
|
|
|
#define yy_delete_buffer CONCAT(FLEX_YY_PREFIX, _delete_buffer)
|
|
|
|
#endif
|
2001-02-01 20:21:25 +00:00
|
|
|
|
|
|
|
/* Resets scanner and assigns the char* argument
|
|
|
|
* as the text to scan
|
|
|
|
*/
|
|
|
|
void
|
2008-04-25 17:24:29 +00:00
|
|
|
TEXT_FUNC (char *text)
|
2001-02-01 20:21:25 +00:00
|
|
|
{
|
|
|
|
yy_scan_string(text);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FILE_FUNC (FILE* fh)
|
|
|
|
{
|
|
|
|
YY_BUFFER_STATE new_buffer;
|
|
|
|
|
|
|
|
new_buffer = yy_create_buffer(fh, YY_BUF_SIZE);
|
|
|
|
yy_switch_to_buffer(new_buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CLEANUP_FUNC (void)
|
|
|
|
{
|
|
|
|
BEGIN(INITIAL);
|
|
|
|
yy_delete_buffer(YY_CURRENT_BUFFER);
|
|
|
|
}
|
|
|
|
|
2007-07-31 01:24:26 +00:00
|
|
|
#ifndef YY_SKIP_YYWRAP
|
2001-02-01 20:21:25 +00:00
|
|
|
/* Flex has an option '%option noyywrap' so that I don't have to
|
|
|
|
* provide this yywrap function, but in order to maintain portability,
|
2007-07-31 01:24:26 +00:00
|
|
|
* I'll just use this yywrap() function if that option wasn't used.
|
2001-02-01 20:21:25 +00:00
|
|
|
*/
|
|
|
|
int
|
2007-07-31 01:24:26 +00:00
|
|
|
WRAP_FUNC (void)
|
2001-02-01 20:21:25 +00:00
|
|
|
{
|
|
|
|
return 1; /* stop at EOF, instead of looking for next file */
|
|
|
|
}
|
2007-07-31 01:24:26 +00:00
|
|
|
#endif
|