Startet work on a lexer to replace COM_Parse

This commit is contained in:
Walter Julius Hennecke 2013-04-22 21:41:34 +02:00
parent a6725bea60
commit 9b0c16d7ba
3 changed files with 47 additions and 0 deletions

43
code/game/bg_lex.h Normal file
View file

@ -0,0 +1,43 @@
#ifndef G_LEX_H_
#define G_LEX_H_
#include "q_shared.h"
typedef enum {
MTYPE_VECTOR,
MTYPE_NUMBER,
MTYPE_STRING,
MTYPE_KEYWORD,
MTYPE_BRACE_OPEN,
MTYPE_BRACE_CLOSE,
MTYPE_SQBRACE_OPEN,
MTYPE_SQBRACE_CLOSE,
MTYPE_CUBRACE_OPEN,
MTYPE_CUBRACE_CLOSE,
MTYPE_MAX
} morphType;
typedef struct morph_s morph_t;
struct morph_s {
morphType type;
union val
{
vec3_t vector;
double number;
char* string;
char* keyword;
} value;
};
typedef struct lex_s lex_t;
struct lex_s {
void* yylex;
morph_t morph;
};
extern lex_t* lex_create(void);
extern morphType lex(lex_t* lexer);
#endif /* G_LEX_H_ */

View file

@ -490,6 +490,7 @@
<ClInclude Include="be_ai_move.h" />
<ClInclude Include="be_ai_weap.h" />
<ClInclude Include="be_ea.h" />
<ClInclude Include="bg_lex.h" />
<ClInclude Include="bg_lib.h" />
<ClInclude Include="bg_local.h" />
<ClInclude Include="bg_public.h" />

View file

@ -467,6 +467,9 @@
<ClInclude Include="sqlite3.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="bg_lex.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="game.def">