* Use lexer_input.[ch] instead of our own custom YY_INPUT implementation for level_lexer

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5017 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2008-05-10 15:08:32 +00:00
parent 4b1ecee02b
commit f35270ab17
2 changed files with 7 additions and 24 deletions

View File

@ -36,25 +36,7 @@
#define YYLMAX 255
#endif
struct buffer
{
const char* begin;
const char* end;
};
#define YY_EXTRA_TYPE struct buffer *
#define YY_INPUT(buf, result, max_size) \
if (yyextra->begin != yyextra->end) \
{ \
buf[0] = *(yyextra->begin++); \
result = 1; \
} \
else \
{ \
buf[0] = EOF; \
result = YY_NULL; \
}
#include "lib/framework/lexer_input.h"
#ifndef yyextra
# define yyextra yyget_extra()

View File

@ -26,6 +26,7 @@
#include "lib/framework/listmacs.h"
#include "levels.h"
#include "levelint.h"
#include "lib/framework/lexer_input.h"
#include "level_lexer.lex.h"
typedef struct
@ -325,11 +326,11 @@ BOOL levParse(const char* buffer, size_t size, searchPathMode datadir)
{
BOOL retval;
parser_context context;
struct
{
const char* begin;
const char* end;
} input = { buffer, &buffer[size] };
lexerinput_t input;
input.type = LEXINPUT_BUFFER;
input.input.buffer.begin = buffer;
input.input.buffer.end = &buffer[size];
context.datadir = datadir;
context.dataset = NULL;