forked from enlightenment/efl
Eolian/Lexer: support of class types.
Now, .eo format has to supply the class type class, abstract, mixin or interface. Example: class Elm_Button {...
This commit is contained in:
parent
9add4c695c
commit
2f34bcac4b
|
@ -83,7 +83,7 @@ typedef enum
|
||||||
{
|
{
|
||||||
EOLIAN_CLASS_UNKNOWN_TYPE,
|
EOLIAN_CLASS_UNKNOWN_TYPE,
|
||||||
EOLIAN_CLASS_REGULAR,
|
EOLIAN_CLASS_REGULAR,
|
||||||
EOLIAN_CLASS_REGULAR_NON_INSTANT,
|
EOLIAN_CLASS_ABSTRACT,
|
||||||
EOLIAN_CLASS_MIXIN,
|
EOLIAN_CLASS_MIXIN,
|
||||||
EOLIAN_CLASS_INTERFACE
|
EOLIAN_CLASS_INTERFACE
|
||||||
} Eolian_Class_Type;
|
} Eolian_Class_Type;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define __EO_DEFINITIONS_H__
|
#define __EO_DEFINITIONS_H__
|
||||||
|
|
||||||
#include <Eina.h>
|
#include <Eina.h>
|
||||||
|
#include <Eolian.h>
|
||||||
|
|
||||||
/* RET */
|
/* RET */
|
||||||
|
|
||||||
|
@ -134,7 +135,7 @@ typedef struct _eo_implement_def
|
||||||
typedef struct _eo_class_def
|
typedef struct _eo_class_def
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *type; /* Regular, RegularNonInstantiable, Mixin and Interface */
|
Eolian_Class_Type type;
|
||||||
const char *comment;
|
const char *comment;
|
||||||
const char *legacy_prefix;
|
const char *legacy_prefix;
|
||||||
Eina_List *inherits;
|
Eina_List *inherits;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2,6 +2,7 @@
|
||||||
#define __EO_TOKENIZER_H__
|
#define __EO_TOKENIZER_H__
|
||||||
|
|
||||||
#include <Eina.h>
|
#include <Eina.h>
|
||||||
|
#include <Eolian.h>
|
||||||
#include "eo_definitions.h"
|
#include "eo_definitions.h"
|
||||||
|
|
||||||
/* TOKENIZER */
|
/* TOKENIZER */
|
||||||
|
@ -34,6 +35,7 @@ typedef struct _eo_tokenizer
|
||||||
|
|
||||||
Eina_List *classes;
|
Eina_List *classes;
|
||||||
struct {
|
struct {
|
||||||
|
Eolian_Class_Type kls_type;
|
||||||
Eo_Class_Def *kls;
|
Eo_Class_Def *kls;
|
||||||
Eo_Property_Def *prop;
|
Eo_Property_Def *prop;
|
||||||
Eo_Method_Def *meth;
|
Eo_Method_Def *meth;
|
||||||
|
|
|
@ -892,21 +892,32 @@ _eo_tokenizer_implement_get(Eo_Tokenizer *toknz, char *p)
|
||||||
fgoto tokenize_class;
|
fgoto tokenize_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
action class_type_set_to_class {
|
||||||
|
toknz->tmp.kls_type = EOLIAN_CLASS_REGULAR;
|
||||||
|
}
|
||||||
|
action class_type_set_to_abstract {
|
||||||
|
toknz->tmp.kls_type = EOLIAN_CLASS_ABSTRACT;
|
||||||
|
}
|
||||||
|
action class_type_set_to_mixin {
|
||||||
|
toknz->tmp.kls_type = EOLIAN_CLASS_MIXIN;
|
||||||
|
}
|
||||||
|
action class_type_set_to_interface {
|
||||||
|
toknz->tmp.kls_type = EOLIAN_CLASS_INTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
action end_class_name {
|
action end_class_name {
|
||||||
if (toknz->tmp.kls != NULL)
|
if (toknz->tmp.kls != NULL)
|
||||||
ABORT(toknz, "there is a pending class definition %s", toknz->tmp.kls->name);
|
ABORT(toknz, "there is a pending class definition %s", toknz->tmp.kls->name);
|
||||||
toknz->tmp.kls = _eo_tokenizer_class_get(toknz, fpc);
|
toknz->tmp.kls = _eo_tokenizer_class_get(toknz, fpc);
|
||||||
}
|
toknz->tmp.kls->type = toknz->tmp.kls_type;
|
||||||
|
|
||||||
action end_class_type {
|
|
||||||
if (!toknz->tmp.kls)
|
|
||||||
ABORT(toknz, "No pending class definition");
|
|
||||||
toknz->tmp.kls->type = _eo_tokenizer_token_get(toknz, fpc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class_name = ident %end_class_name;
|
class_name = ident %end_class_name;
|
||||||
class_type = ws+ "as" ws+ >save_fpc ("Regular" | "Mixin" | "RegularNonInstantiable" | "Interface") %end_class_type; # class as type(Regular, Mixin...)
|
begin_class = (
|
||||||
begin_class = class_name class_type? ignore* begin_def;
|
"class" %class_type_set_to_class |
|
||||||
|
"mixin" %class_type_set_to_mixin |
|
||||||
|
"abstract" %class_type_set_to_abstract |
|
||||||
|
"interface" %class_type_set_to_interface) ws+ class_name ignore* begin_def;
|
||||||
|
|
||||||
main := |*
|
main := |*
|
||||||
ignore+; #=> show_ignore;
|
ignore+; #=> show_ignore;
|
||||||
|
@ -1145,16 +1156,7 @@ eo_tokenizer_database_fill(const char *filename)
|
||||||
|
|
||||||
EINA_LIST_FOREACH(toknz->classes, k, kls)
|
EINA_LIST_FOREACH(toknz->classes, k, kls)
|
||||||
{
|
{
|
||||||
Eolian_Class_Type type = EOLIAN_CLASS_REGULAR;
|
database_class_add(kls->name, kls->type);
|
||||||
if (kls->type)
|
|
||||||
{
|
|
||||||
if (!strcmp(kls->type, "Regular")) type = EOLIAN_CLASS_REGULAR;
|
|
||||||
else if (!strcmp(kls->type, "RegularNonInstantiable")) type = EOLIAN_CLASS_REGULAR_NON_INSTANT;
|
|
||||||
else if (!strcmp(kls->type, "Mixin")) type = EOLIAN_CLASS_MIXIN;
|
|
||||||
else if (!strcmp(kls->type, "Interface")) type = EOLIAN_CLASS_INTERFACE;
|
|
||||||
else type = EOLIAN_CLASS_UNKNOWN_TYPE;
|
|
||||||
}
|
|
||||||
database_class_add(kls->name, type);
|
|
||||||
database_class_file_set(kls->name, filename);
|
database_class_file_set(kls->name, filename);
|
||||||
|
|
||||||
if (kls->comment) database_class_description_set(kls->name, kls->comment);
|
if (kls->comment) database_class_description_set(kls->name, kls->comment);
|
||||||
|
|
Loading…
Reference in New Issue