eolian: Eo_Tokenizer -> Eo_Lexer

This commit is contained in:
Daniel Kolesa 2014-06-18 10:08:43 +01:00
parent 8a4849b1eb
commit 44afa93503
3 changed files with 45 additions and 45 deletions

View File

@ -69,7 +69,7 @@ eo_tokenizer_shutdown()
} }
static void static void
_eo_tokenizer_abort(Eo_Tokenizer *toknz, _eo_tokenizer_abort(Eo_Lexer *toknz,
const char *file, const char* fct, int line, const char *file, const char* fct, int line,
const char *fmt, ...) const char *fmt, ...)
{ {
@ -132,7 +132,7 @@ static void _eo_tokenizer_normalize_buf(char *buf)
} }
static const char* static const char*
_eo_tokenizer_token_get(Eo_Tokenizer *toknz, char *p) _eo_tokenizer_token_get(Eo_Lexer *toknz, char *p)
{ {
if (toknz->saved.tok == NULL) ABORT(toknz, "toknz->saved.tok is NULL"); if (toknz->saved.tok == NULL) ABORT(toknz, "toknz->saved.tok is NULL");
char d[BUFSIZE]; char d[BUFSIZE];
@ -146,7 +146,7 @@ _eo_tokenizer_token_get(Eo_Tokenizer *toknz, char *p)
} }
static Eo_Class_Def* static Eo_Class_Def*
_eo_tokenizer_class_get(Eo_Tokenizer *toknz, char *p) _eo_tokenizer_class_get(Eo_Lexer *toknz, char *p)
{ {
Eo_Class_Def *kls = calloc(1, sizeof(Eo_Class_Def)); Eo_Class_Def *kls = calloc(1, sizeof(Eo_Class_Def));
if (kls == NULL) ABORT(toknz, "calloc Eo_Class_Def failure"); if (kls == NULL) ABORT(toknz, "calloc Eo_Class_Def failure");
@ -157,7 +157,7 @@ _eo_tokenizer_class_get(Eo_Tokenizer *toknz, char *p)
} }
static Eo_Type_Def* static Eo_Type_Def*
_eo_tokenizer_type_get(Eo_Tokenizer *toknz, char *p) _eo_tokenizer_type_get(Eo_Lexer *toknz, char *p)
{ {
Eo_Type_Def *def = calloc(1, sizeof(Eo_Type_Def)); Eo_Type_Def *def = calloc(1, sizeof(Eo_Type_Def));
if (def == NULL) ABORT(toknz, "calloc Eo_Type_Def failure"); if (def == NULL) ABORT(toknz, "calloc Eo_Type_Def failure");
@ -168,7 +168,7 @@ _eo_tokenizer_type_get(Eo_Tokenizer *toknz, char *p)
} }
static Eo_Property_Def* static Eo_Property_Def*
_eo_tokenizer_property_get(Eo_Tokenizer *toknz, char *p) _eo_tokenizer_property_get(Eo_Lexer *toknz, char *p)
{ {
Eo_Property_Def *prop = calloc(1, sizeof(Eo_Property_Def)); Eo_Property_Def *prop = calloc(1, sizeof(Eo_Property_Def));
if (prop == NULL) ABORT(toknz, "calloc Eo_Property_Def failure"); if (prop == NULL) ABORT(toknz, "calloc Eo_Property_Def failure");
@ -181,7 +181,7 @@ _eo_tokenizer_property_get(Eo_Tokenizer *toknz, char *p)
} }
static Eo_Method_Def* static Eo_Method_Def*
_eo_tokenizer_method_get(Eo_Tokenizer *toknz, char *p) _eo_tokenizer_method_get(Eo_Lexer *toknz, char *p)
{ {
Eo_Method_Def *meth = calloc(1, sizeof(Eo_Method_Def)); Eo_Method_Def *meth = calloc(1, sizeof(Eo_Method_Def));
if (meth == NULL) ABORT(toknz, "calloc Eo_Method_Def failure"); if (meth == NULL) ABORT(toknz, "calloc Eo_Method_Def failure");
@ -194,7 +194,7 @@ _eo_tokenizer_method_get(Eo_Tokenizer *toknz, char *p)
} }
static int static int
_eo_tokenizer_scope_get(Eo_Tokenizer *toknz, EINA_UNUSED char *p) _eo_tokenizer_scope_get(Eo_Lexer *toknz, EINA_UNUSED char *p)
{ {
if (!strncmp(toknz->saved.tok, "protected ", 10)) if (!strncmp(toknz->saved.tok, "protected ", 10))
return FUNC_PROTECTED; return FUNC_PROTECTED;
@ -203,7 +203,7 @@ _eo_tokenizer_scope_get(Eo_Tokenizer *toknz, EINA_UNUSED char *p)
} }
static Eo_Param_Def* static Eo_Param_Def*
_eo_tokenizer_param_get(Eo_Tokenizer *toknz, char *p) _eo_tokenizer_param_get(Eo_Lexer *toknz, char *p)
{ {
char *s; char *s;
@ -268,7 +268,7 @@ _eo_tokenizer_param_get(Eo_Tokenizer *toknz, char *p)
} }
static Eo_Ret_Def* static Eo_Ret_Def*
_eo_tokenizer_return_get(Eo_Tokenizer *toknz, char *p) _eo_tokenizer_return_get(Eo_Lexer *toknz, char *p)
{ {
char *s; char *s;
@ -321,7 +321,7 @@ _eo_tokenizer_return_get(Eo_Tokenizer *toknz, char *p)
} }
static Eo_Accessor_Param* static Eo_Accessor_Param*
_eo_tokenizer_accessor_param_get(Eo_Tokenizer *toknz, char *p) _eo_tokenizer_accessor_param_get(Eo_Lexer *toknz, char *p)
{ {
Eo_Accessor_Param *param = calloc(1, sizeof(Eo_Accessor_Param)); Eo_Accessor_Param *param = calloc(1, sizeof(Eo_Accessor_Param));
if (param == NULL) ABORT(toknz, "calloc Eo_Accessor_Param failure"); if (param == NULL) ABORT(toknz, "calloc Eo_Accessor_Param failure");
@ -336,7 +336,7 @@ _eo_tokenizer_accessor_param_get(Eo_Tokenizer *toknz, char *p)
} }
static Eo_Accessor_Def * static Eo_Accessor_Def *
_eo_tokenizer_accessor_get(Eo_Tokenizer *toknz, Eo_Accessor_Type type) _eo_tokenizer_accessor_get(Eo_Lexer *toknz, Eo_Accessor_Type type)
{ {
Eo_Accessor_Def *accessor = calloc(1, sizeof(Eo_Accessor_Def)); Eo_Accessor_Def *accessor = calloc(1, sizeof(Eo_Accessor_Def));
if (accessor == NULL) ABORT(toknz, "calloc Eo_Accessor_Def failure"); if (accessor == NULL) ABORT(toknz, "calloc Eo_Accessor_Def failure");
@ -347,7 +347,7 @@ _eo_tokenizer_accessor_get(Eo_Tokenizer *toknz, Eo_Accessor_Type type)
} }
static Eo_Event_Def* static Eo_Event_Def*
_eo_tokenizer_event_get(Eo_Tokenizer *toknz, char *p) _eo_tokenizer_event_get(Eo_Lexer *toknz, char *p)
{ {
Eo_Event_Def *sgn = calloc(1, sizeof(Eo_Event_Def)); Eo_Event_Def *sgn = calloc(1, sizeof(Eo_Event_Def));
if (sgn == NULL) ABORT(toknz, "calloc Eo_Event_Def failure"); if (sgn == NULL) ABORT(toknz, "calloc Eo_Event_Def failure");
@ -358,7 +358,7 @@ _eo_tokenizer_event_get(Eo_Tokenizer *toknz, char *p)
} }
static Eo_Implement_Def* static Eo_Implement_Def*
_eo_tokenizer_implement_get(Eo_Tokenizer *toknz, char *p) _eo_tokenizer_implement_get(Eo_Lexer *toknz, char *p)
{ {
Eo_Implement_Def *impl = calloc(1, sizeof(Eo_Implement_Def)); Eo_Implement_Def *impl = calloc(1, sizeof(Eo_Implement_Def));
if (impl == NULL) ABORT(toknz, "calloc Eo_Implement_Def failure"); if (impl == NULL) ABORT(toknz, "calloc Eo_Implement_Def failure");
@ -1432,7 +1432,7 @@ static const int eo_tokenizer_en_main = 309;
Eina_Bool Eina_Bool
eo_tokenizer_walk(Eo_Tokenizer *toknz, const char *source) eo_tokenizer_walk(Eo_Lexer *toknz, const char *source)
{ {
INF("tokenize %s...", source); INF("tokenize %s...", source);
toknz->source = eina_stringshare_add(source); toknz->source = eina_stringshare_add(source);
@ -2865,7 +2865,7 @@ _again:
} }
static Eina_Bool static Eina_Bool
eo_tokenizer_mem_walk(Eo_Tokenizer *toknz, const char *source, char *buffer, unsigned int len) eo_tokenizer_mem_walk(Eo_Lexer *toknz, const char *source, char *buffer, unsigned int len)
{ {
INF("tokenize %s...", source); INF("tokenize %s...", source);
toknz->source = eina_stringshare_add(source); toknz->source = eina_stringshare_add(source);
@ -4240,10 +4240,10 @@ _again:
return ret; return ret;
} }
Eo_Tokenizer* Eo_Lexer*
eo_tokenizer_get(void) eo_tokenizer_get(void)
{ {
Eo_Tokenizer *toknz = calloc(1, sizeof(Eo_Tokenizer)); Eo_Lexer *toknz = calloc(1, sizeof(Eo_Lexer));
if (!toknz) return NULL; if (!toknz) return NULL;
toknz->ts = NULL; toknz->ts = NULL;
@ -4266,7 +4266,7 @@ static char *_accessor_type_str[ACCESSOR_TYPE_LAST] = { "setter", "getter" };
static char *_param_way_str[PARAM_WAY_LAST] = { "IN", "OUT", "INOUT" }; static char *_param_way_str[PARAM_WAY_LAST] = { "IN", "OUT", "INOUT" };
void void
eo_tokenizer_dump(Eo_Tokenizer *toknz) eo_tokenizer_dump(Eo_Lexer *toknz)
{ {
const char *s; const char *s;
Eina_List *k, *l, *m; Eina_List *k, *l, *m;
@ -4477,7 +4477,7 @@ eo_tokenizer_database_fill(const char *filename)
FILE *stream = NULL; FILE *stream = NULL;
char *buffer = NULL; char *buffer = NULL;
Eo_Tokenizer *toknz = eo_tokenizer_get(); Eo_Lexer *toknz = eo_tokenizer_get();
if (!toknz) if (!toknz)
{ {
ERR("can't create eo_tokenizer"); ERR("can't create eo_tokenizer");
@ -4720,7 +4720,7 @@ end:
} }
void void
eo_tokenizer_free(Eo_Tokenizer *toknz) eo_tokenizer_free(Eo_Lexer *toknz)
{ {
Eo_Class_Def *kls; Eo_Class_Def *kls;
Eo_Type_Def *type; Eo_Type_Def *type;

View File

@ -53,19 +53,19 @@ typedef struct _eo_tokenizer
int fscope; int fscope;
} tmp; } tmp;
} Eo_Tokenizer; } Eo_Lexer;
int eo_tokenizer_init(); int eo_tokenizer_init();
int eo_tokenizer_shutdown(); int eo_tokenizer_shutdown();
Eo_Tokenizer* eo_tokenizer_get(void); Eo_Lexer* eo_tokenizer_get(void);
Eina_Bool eo_tokenizer_walk(Eo_Tokenizer *toknz, const char *source); Eina_Bool eo_tokenizer_walk(Eo_Lexer *toknz, const char *source);
void eo_tokenizer_dump(Eo_Tokenizer *toknz); void eo_tokenizer_dump(Eo_Lexer *toknz);
void eo_tokenizer_free(Eo_Tokenizer *toknz); void eo_tokenizer_free(Eo_Lexer *toknz);
Eina_Bool eo_tokenizer_database_fill(const char *filename); Eina_Bool eo_tokenizer_database_fill(const char *filename);

View File

@ -67,7 +67,7 @@ eo_tokenizer_shutdown()
} }
static void static void
_eo_tokenizer_abort(Eo_Tokenizer *toknz, _eo_tokenizer_abort(Eo_Lexer *toknz,
const char *file, const char* fct, int line, const char *file, const char* fct, int line,
const char *fmt, ...) const char *fmt, ...)
{ {
@ -130,7 +130,7 @@ static void _eo_tokenizer_normalize_buf(char *buf)
} }
static const char* static const char*
_eo_tokenizer_token_get(Eo_Tokenizer *toknz, char *p) _eo_tokenizer_token_get(Eo_Lexer *toknz, char *p)
{ {
if (toknz->saved.tok == NULL) ABORT(toknz, "toknz->saved.tok is NULL"); if (toknz->saved.tok == NULL) ABORT(toknz, "toknz->saved.tok is NULL");
char d[BUFSIZE]; char d[BUFSIZE];
@ -144,7 +144,7 @@ _eo_tokenizer_token_get(Eo_Tokenizer *toknz, char *p)
} }
static Eo_Class_Def* static Eo_Class_Def*
_eo_tokenizer_class_get(Eo_Tokenizer *toknz, char *p) _eo_tokenizer_class_get(Eo_Lexer *toknz, char *p)
{ {
Eo_Class_Def *kls = calloc(1, sizeof(Eo_Class_Def)); Eo_Class_Def *kls = calloc(1, sizeof(Eo_Class_Def));
if (kls == NULL) ABORT(toknz, "calloc Eo_Class_Def failure"); if (kls == NULL) ABORT(toknz, "calloc Eo_Class_Def failure");
@ -155,7 +155,7 @@ _eo_tokenizer_class_get(Eo_Tokenizer *toknz, char *p)
} }
static Eo_Type_Def* static Eo_Type_Def*
_eo_tokenizer_type_get(Eo_Tokenizer *toknz, char *p) _eo_tokenizer_type_get(Eo_Lexer *toknz, char *p)
{ {
Eo_Type_Def *def = calloc(1, sizeof(Eo_Type_Def)); Eo_Type_Def *def = calloc(1, sizeof(Eo_Type_Def));
if (def == NULL) ABORT(toknz, "calloc Eo_Type_Def failure"); if (def == NULL) ABORT(toknz, "calloc Eo_Type_Def failure");
@ -166,7 +166,7 @@ _eo_tokenizer_type_get(Eo_Tokenizer *toknz, char *p)
} }
static Eo_Property_Def* static Eo_Property_Def*
_eo_tokenizer_property_get(Eo_Tokenizer *toknz, char *p) _eo_tokenizer_property_get(Eo_Lexer *toknz, char *p)
{ {
Eo_Property_Def *prop = calloc(1, sizeof(Eo_Property_Def)); Eo_Property_Def *prop = calloc(1, sizeof(Eo_Property_Def));
if (prop == NULL) ABORT(toknz, "calloc Eo_Property_Def failure"); if (prop == NULL) ABORT(toknz, "calloc Eo_Property_Def failure");
@ -179,7 +179,7 @@ _eo_tokenizer_property_get(Eo_Tokenizer *toknz, char *p)
} }
static Eo_Method_Def* static Eo_Method_Def*
_eo_tokenizer_method_get(Eo_Tokenizer *toknz, char *p) _eo_tokenizer_method_get(Eo_Lexer *toknz, char *p)
{ {
Eo_Method_Def *meth = calloc(1, sizeof(Eo_Method_Def)); Eo_Method_Def *meth = calloc(1, sizeof(Eo_Method_Def));
if (meth == NULL) ABORT(toknz, "calloc Eo_Method_Def failure"); if (meth == NULL) ABORT(toknz, "calloc Eo_Method_Def failure");
@ -192,7 +192,7 @@ _eo_tokenizer_method_get(Eo_Tokenizer *toknz, char *p)
} }
static int static int
_eo_tokenizer_scope_get(Eo_Tokenizer *toknz, EINA_UNUSED char *p) _eo_tokenizer_scope_get(Eo_Lexer *toknz, EINA_UNUSED char *p)
{ {
if (!strncmp(toknz->saved.tok, "protected ", 10)) if (!strncmp(toknz->saved.tok, "protected ", 10))
return FUNC_PROTECTED; return FUNC_PROTECTED;
@ -201,7 +201,7 @@ _eo_tokenizer_scope_get(Eo_Tokenizer *toknz, EINA_UNUSED char *p)
} }
static Eo_Param_Def* static Eo_Param_Def*
_eo_tokenizer_param_get(Eo_Tokenizer *toknz, char *p) _eo_tokenizer_param_get(Eo_Lexer *toknz, char *p)
{ {
char *s; char *s;
@ -266,7 +266,7 @@ _eo_tokenizer_param_get(Eo_Tokenizer *toknz, char *p)
} }
static Eo_Ret_Def* static Eo_Ret_Def*
_eo_tokenizer_return_get(Eo_Tokenizer *toknz, char *p) _eo_tokenizer_return_get(Eo_Lexer *toknz, char *p)
{ {
char *s; char *s;
@ -319,7 +319,7 @@ _eo_tokenizer_return_get(Eo_Tokenizer *toknz, char *p)
} }
static Eo_Accessor_Param* static Eo_Accessor_Param*
_eo_tokenizer_accessor_param_get(Eo_Tokenizer *toknz, char *p) _eo_tokenizer_accessor_param_get(Eo_Lexer *toknz, char *p)
{ {
Eo_Accessor_Param *param = calloc(1, sizeof(Eo_Accessor_Param)); Eo_Accessor_Param *param = calloc(1, sizeof(Eo_Accessor_Param));
if (param == NULL) ABORT(toknz, "calloc Eo_Accessor_Param failure"); if (param == NULL) ABORT(toknz, "calloc Eo_Accessor_Param failure");
@ -334,7 +334,7 @@ _eo_tokenizer_accessor_param_get(Eo_Tokenizer *toknz, char *p)
} }
static Eo_Accessor_Def * static Eo_Accessor_Def *
_eo_tokenizer_accessor_get(Eo_Tokenizer *toknz, Eo_Accessor_Type type) _eo_tokenizer_accessor_get(Eo_Lexer *toknz, Eo_Accessor_Type type)
{ {
Eo_Accessor_Def *accessor = calloc(1, sizeof(Eo_Accessor_Def)); Eo_Accessor_Def *accessor = calloc(1, sizeof(Eo_Accessor_Def));
if (accessor == NULL) ABORT(toknz, "calloc Eo_Accessor_Def failure"); if (accessor == NULL) ABORT(toknz, "calloc Eo_Accessor_Def failure");
@ -345,7 +345,7 @@ _eo_tokenizer_accessor_get(Eo_Tokenizer *toknz, Eo_Accessor_Type type)
} }
static Eo_Event_Def* static Eo_Event_Def*
_eo_tokenizer_event_get(Eo_Tokenizer *toknz, char *p) _eo_tokenizer_event_get(Eo_Lexer *toknz, char *p)
{ {
Eo_Event_Def *sgn = calloc(1, sizeof(Eo_Event_Def)); Eo_Event_Def *sgn = calloc(1, sizeof(Eo_Event_Def));
if (sgn == NULL) ABORT(toknz, "calloc Eo_Event_Def failure"); if (sgn == NULL) ABORT(toknz, "calloc Eo_Event_Def failure");
@ -356,7 +356,7 @@ _eo_tokenizer_event_get(Eo_Tokenizer *toknz, char *p)
} }
static Eo_Implement_Def* static Eo_Implement_Def*
_eo_tokenizer_implement_get(Eo_Tokenizer *toknz, char *p) _eo_tokenizer_implement_get(Eo_Lexer *toknz, char *p)
{ {
Eo_Implement_Def *impl = calloc(1, sizeof(Eo_Implement_Def)); Eo_Implement_Def *impl = calloc(1, sizeof(Eo_Implement_Def));
if (impl == NULL) ABORT(toknz, "calloc Eo_Implement_Def failure"); if (impl == NULL) ABORT(toknz, "calloc Eo_Implement_Def failure");
@ -996,7 +996,7 @@ _eo_tokenizer_implement_get(Eo_Tokenizer *toknz, char *p)
}%% }%%
Eina_Bool Eina_Bool
eo_tokenizer_walk(Eo_Tokenizer *toknz, const char *source) eo_tokenizer_walk(Eo_Lexer *toknz, const char *source)
{ {
INF("tokenize %s...", source); INF("tokenize %s...", source);
toknz->source = eina_stringshare_add(source); toknz->source = eina_stringshare_add(source);
@ -1080,7 +1080,7 @@ eo_tokenizer_walk(Eo_Tokenizer *toknz, const char *source)
} }
static Eina_Bool static Eina_Bool
eo_tokenizer_mem_walk(Eo_Tokenizer *toknz, const char *source, char *buffer, unsigned int len) eo_tokenizer_mem_walk(Eo_Lexer *toknz, const char *source, char *buffer, unsigned int len)
{ {
INF("tokenize %s...", source); INF("tokenize %s...", source);
toknz->source = eina_stringshare_add(source); toknz->source = eina_stringshare_add(source);
@ -1106,10 +1106,10 @@ eo_tokenizer_mem_walk(Eo_Tokenizer *toknz, const char *source, char *buffer, uns
return ret; return ret;
} }
Eo_Tokenizer* Eo_Lexer*
eo_tokenizer_get(void) eo_tokenizer_get(void)
{ {
Eo_Tokenizer *toknz = calloc(1, sizeof(Eo_Tokenizer)); Eo_Lexer *toknz = calloc(1, sizeof(Eo_Lexer));
if (!toknz) return NULL; if (!toknz) return NULL;
toknz->ts = NULL; toknz->ts = NULL;
@ -1132,7 +1132,7 @@ static char *_accessor_type_str[ACCESSOR_TYPE_LAST] = { "setter", "getter" };
static char *_param_way_str[PARAM_WAY_LAST] = { "IN", "OUT", "INOUT" }; static char *_param_way_str[PARAM_WAY_LAST] = { "IN", "OUT", "INOUT" };
void void
eo_tokenizer_dump(Eo_Tokenizer *toknz) eo_tokenizer_dump(Eo_Lexer *toknz)
{ {
const char *s; const char *s;
Eina_List *k, *l, *m; Eina_List *k, *l, *m;
@ -1343,7 +1343,7 @@ eo_tokenizer_database_fill(const char *filename)
FILE *stream = NULL; FILE *stream = NULL;
char *buffer = NULL; char *buffer = NULL;
Eo_Tokenizer *toknz = eo_tokenizer_get(); Eo_Lexer *toknz = eo_tokenizer_get();
if (!toknz) if (!toknz)
{ {
ERR("can't create eo_tokenizer"); ERR("can't create eo_tokenizer");
@ -1586,7 +1586,7 @@ end:
} }
void void
eo_tokenizer_free(Eo_Tokenizer *toknz) eo_tokenizer_free(Eo_Lexer *toknz)
{ {
Eo_Class_Def *kls; Eo_Class_Def *kls;
Eo_Type_Def *type; Eo_Type_Def *type;