#ifndef __EO_TOKENIZER_H__ #define __EO_TOKENIZER_H__ #include extern int _eo_tokenizer_log_dom; #undef EINA_LOG_DOMAIN_DEFAULT #define EINA_LOG_DOMAIN_DEFAULT _eo_tokenizer_log_dom #ifdef CRITICAL #undef CRITICAL #endif #define CRITICAL(...) EINA_LOG_DOM_CRIT(_eo_tokenizer_log_dom, __VA_ARGS__) #ifdef ERR #undef ERR #endif #define ERR(...) EINA_LOG_DOM_ERR(_eo_tokenizer_log_dom, __VA_ARGS__) #ifdef WRN #undef WRN #endif #define WRN(...) EINA_LOG_DOM_WARN(_eo_tokenizer_log_dom, __VA_ARGS__) #ifdef INF #undef INF #endif #define INF(...) EINA_LOG_DOM_INFO(_eo_tokenizer_log_dom, __VA_ARGS__) #ifdef DBG #undef DBG #endif #define DBG(...) EINA_LOG_DOM_DBG(_eo_tokenizer_log_dom, __VA_ARGS__) /* RET */ typedef struct _eo_ret_def { const char *type; const char *comment; } Eo_Ret_Def; /* PARAMS */ typedef enum _param_way { IN, OUT, INOUT, PARAM_WAY_LAST } Param_Way; typedef struct _eo_param_def { Param_Way way; const char *type; const char *name; const char *comment; } Eo_Param_Def; /* PROPERTIES */ typedef enum _eo_accessor_type { SETTER, GETTER, PROP_TYPE_LAST } Eo_Accessor_Type; typedef struct _eo_accessor_def { Eo_Accessor_Type type; Eo_Ret_Def ret; const char *comment; Eina_List *legacies; } Eo_Accessor_Def; typedef struct _eo_property_def { const char *name; Eina_List *params; Eina_List *accessors; } Eo_Property_Def; /* METHODS */ typedef struct _eo_method_def { Eo_Ret_Def ret; const char *name; const char *comment; Eina_List *params; } Eo_Method_Def; /* CLASSES */ typedef struct _eo_class_def { const char *name; const char *comment; Eina_List *inherits; Eina_List *properties; Eina_List *methods; } Eo_Class_Def; /* TOKENIZER */ #define BUFSIZE 256 typedef struct _eo_tokenizer { /* ragel vars */ int cs; /* current machine state */ int act; /* last pattern matched */ char *ts; /* current token match start */ char *te; /* current token match end */ char *p; /* data start */ char *pe; /* data end */ char *eof; /* eof = (EOF ? pe : NULL) */ /* int stack[10]; /1* state stack used by fret fcall ... *1/ */ /* int top; /1* stack pointer *1/ */ const char *source; int current_line; int current_nesting; int max_nesting; char buf[BUFSIZE]; struct { char *tok; int line; } saved; Eina_List *classes; struct { Eo_Class_Def *kls; Eo_Property_Def *prop; Eo_Method_Def *meth; Eo_Param_Def *param; Eo_Accessor_Def *accessor; } tmp; } Eo_Tokenizer; Eo_Tokenizer* eo_tokenizer_get(void); Eina_Bool eo_tokenizer_walk(Eo_Tokenizer *toknz, const char *source); void eo_tokenizer_dump(Eo_Tokenizer *toknz); void eo_tokenizer_free(Eo_Tokenizer *toknz); #endif /* __EO_TOKENIZER_H__ */