2013-04-27 15:56:57 +00:00
|
|
|
#ifndef BG_LEX_H
|
|
|
|
#define BG_LEX_H
|
2013-04-22 19:41:34 +00:00
|
|
|
|
|
|
|
#include "q_shared.h"
|
|
|
|
|
2013-04-28 17:22:27 +00:00
|
|
|
#define LEX_DEBUG
|
|
|
|
#ifdef LEX_DEBUG
|
|
|
|
extern char *yyget_text (void* yyscanner);
|
|
|
|
#endif
|
|
|
|
|
2013-04-22 19:41:34 +00:00
|
|
|
typedef enum {
|
2013-04-27 23:27:32 +00:00
|
|
|
LSYM_OBRACE, /* ( */
|
|
|
|
LSYM_OBRACEC, /* { */
|
|
|
|
LSYM_OBRACESQ, /* [ */
|
|
|
|
LSYM_CBRACE, /* ) */
|
|
|
|
LSYM_CBRACEC, /* } */
|
|
|
|
LSYM_CBRACESQ, /* ] */
|
2013-04-28 17:29:44 +00:00
|
|
|
LSYM_TRUE,
|
|
|
|
LSYM_FALSE,
|
2013-04-27 23:27:32 +00:00
|
|
|
LSYM_SERVER_CHANGE_CONFIG,
|
|
|
|
LSYM_SERVER,
|
|
|
|
LSYM_HOLODECK_DATA,
|
|
|
|
LSYM_PROGRAM,
|
|
|
|
LSYM_MAP_CHANGE_CONFIG,
|
|
|
|
LSYM_MAP,
|
|
|
|
LSYM_LOCATIONS_LIST,
|
|
|
|
LSYM_LOCATIONS_LIST_2,
|
|
|
|
LSYM_MESSAGE,
|
|
|
|
LSYM_CONSOLE_NAME,
|
|
|
|
LSYM_FORMAL_NAME,
|
|
|
|
LSYM_RADAR_COLOR,
|
|
|
|
LSYM_ICON_COLOR,
|
|
|
|
LSYM_NULL,
|
|
|
|
LSYM_MODEL_SKIN,
|
|
|
|
LSYM_WEAPONS,
|
|
|
|
LSYM_HAS_RANKS,
|
|
|
|
LSYM_TEAL,
|
|
|
|
LSYM_MEDICAL,
|
|
|
|
LSYM_GOLD,
|
|
|
|
LSYM_GREEN,
|
|
|
|
LSYM_MARINE,
|
|
|
|
LSYM_RED,
|
|
|
|
LSYM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LSYM_SEMICOLON,
|
2013-04-27 23:27:32 +00:00
|
|
|
|
|
|
|
LSYM_UNKNOWN
|
2013-04-27 15:56:57 +00:00
|
|
|
} bgLexSymbol;
|
2013-04-22 19:41:34 +00:00
|
|
|
|
2013-04-27 15:56:57 +00:00
|
|
|
typedef enum {
|
2013-04-28 13:52:52 +00:00
|
|
|
LMT_STRING = 1,
|
2013-04-27 23:27:32 +00:00
|
|
|
LMT_INT,
|
|
|
|
LMT_DOUBLE,
|
|
|
|
LMT_VECTOR3,
|
|
|
|
LMT_VECTOR4,
|
|
|
|
LMT_SYMBOL,
|
|
|
|
LMT_IGNORE
|
2013-04-27 15:56:57 +00:00
|
|
|
} bgLexMorphemType;
|
2013-04-22 19:41:34 +00:00
|
|
|
|
2013-04-27 21:32:21 +00:00
|
|
|
typedef struct bgLexMorphemData_s bgLexMorphemData;
|
|
|
|
struct bgLexMorphemData_s {
|
2013-04-27 23:27:32 +00:00
|
|
|
char* str;
|
|
|
|
bgLexSymbol symbol;
|
|
|
|
int numInteger;
|
|
|
|
double numDouble;
|
|
|
|
vec3_t vector3;
|
|
|
|
vec4_t vector4;
|
2013-04-27 21:32:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct bgLexMorphem_s bgLexMorphem;
|
|
|
|
struct bgLexMorphem_s {
|
2013-04-27 23:27:32 +00:00
|
|
|
bgLexMorphemType type;
|
|
|
|
bgLexMorphemData data;
|
|
|
|
int line;
|
|
|
|
int column;
|
2013-04-22 19:41:34 +00:00
|
|
|
};
|
|
|
|
|
2013-04-27 15:56:57 +00:00
|
|
|
typedef struct bgLex_s bgLex;
|
|
|
|
struct bgLex_s {
|
2013-04-27 23:27:32 +00:00
|
|
|
void* lex;
|
|
|
|
bgLexMorphem* morphem;
|
|
|
|
void* buf;
|
2013-04-27 15:56:57 +00:00
|
|
|
};
|
2013-04-22 19:41:34 +00:00
|
|
|
|
2013-04-27 15:56:57 +00:00
|
|
|
bgLex* bgLex_create(char* data);
|
2013-05-24 20:11:53 +00:00
|
|
|
void bgLex_destroy(/*@only@*/ /*@out@*/ /*@null@*/ bgLex* lex);
|
2013-04-27 15:56:57 +00:00
|
|
|
int bgLex_lex(bgLex* lex);
|
|
|
|
bgLexSymbol bgLex_textToSymbol(char* text);
|
|
|
|
void bgLexFatalError(const char* msg, void* lex);
|
2013-04-22 19:41:34 +00:00
|
|
|
|
2013-04-27 15:56:57 +00:00
|
|
|
#endif /* BG_LEX_H */
|