* 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-861f7616d084master
parent
4b1ecee02b
commit
f35270ab17
|
@ -36,25 +36,7 @@
|
||||||
#define YYLMAX 255
|
#define YYLMAX 255
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct buffer
|
#include "lib/framework/lexer_input.h"
|
||||||
{
|
|
||||||
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; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef yyextra
|
#ifndef yyextra
|
||||||
# define yyextra yyget_extra()
|
# define yyextra yyget_extra()
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "lib/framework/listmacs.h"
|
#include "lib/framework/listmacs.h"
|
||||||
#include "levels.h"
|
#include "levels.h"
|
||||||
#include "levelint.h"
|
#include "levelint.h"
|
||||||
|
#include "lib/framework/lexer_input.h"
|
||||||
#include "level_lexer.lex.h"
|
#include "level_lexer.lex.h"
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -325,11 +326,11 @@ BOOL levParse(const char* buffer, size_t size, searchPathMode datadir)
|
||||||
{
|
{
|
||||||
BOOL retval;
|
BOOL retval;
|
||||||
parser_context context;
|
parser_context context;
|
||||||
struct
|
lexerinput_t input;
|
||||||
{
|
|
||||||
const char* begin;
|
input.type = LEXINPUT_BUFFER;
|
||||||
const char* end;
|
input.input.buffer.begin = buffer;
|
||||||
} input = { buffer, &buffer[size] };
|
input.input.buffer.end = &buffer[size];
|
||||||
|
|
||||||
context.datadir = datadir;
|
context.datadir = datadir;
|
||||||
context.dataset = NULL;
|
context.dataset = NULL;
|
||||||
|
|
Loading…
Reference in New Issue