summaryrefslogtreecommitdiffstats
path: root/eo_tokenizer.rl
diff options
context:
space:
mode:
Diffstat (limited to 'eo_tokenizer.rl')
-rw-r--r--eo_tokenizer.rl53
1 files changed, 48 insertions, 5 deletions
diff --git a/eo_tokenizer.rl b/eo_tokenizer.rl
index 0f2f2cf..bee773b 100644
--- a/eo_tokenizer.rl
+++ b/eo_tokenizer.rl
@@ -32,6 +32,17 @@ _eo_tokenizer_token_get(Eo_Tokenizer *toknz, char *p)
return eina_stringshare_add(d);
}
+static Eo_Class_Def*
+_eo_tokenizer_class_get(Eo_Tokenizer *toknz, char *p)
+{
+ Eo_Class_Def *kls = calloc(1, sizeof(Eo_Class_Def));
+ if (kls == NULL) ABORT(toknz, "calloc Eo_Class failure");
+
+ kls->name = _eo_tokenizer_token_get(toknz, p);
+
+ return kls;
+}
+
%%{
machine common;
@@ -106,16 +117,48 @@ _eo_tokenizer_token_get(Eo_Tokenizer *toknz, char *p)
machine eo_tokenizer;
include common;
+ write data;
+
+ # TOKENIZE CLASS
+
+ action end_class {
+ INF("end class:%s", toknz->tmp_kls->name);
+ toknz->classes= eina_list_append(toknz->classes, toknz->tmp_kls);
+ toknz->tmp_kls = NULL;
+ toknz->current_nesting--;
+ fgoto main;
+ }
+
+ tokenize_class := |*
+ ignore+; #=> show_ignore;
+ comment => show_comment;
+ end_def => end_class;
+ any => show_error;
+ *|;
+
+ # TOP LEVEL
+
+ action begin_class {
+ INF("begin class: %s", toknz->tmp_kls->name);
+ toknz->current_nesting++;
+ fgoto tokenize_class;
+ }
+
+ action end_class_name {
+ toknz->tmp_kls = _eo_tokenizer_class_get(toknz, fpc);
+ }
+
+ begin_class = alpha_u+ >save_fpc %end_class_name ignore* begin_def;
+
main := |*
- ignore+; #=> show_ignore;
- comment => show_comment;
- any => show_error;
+ ignore+; #=> show_ignore;
+ comment => show_comment;
+ begin_class => begin_class;
+ any => show_error;
*|;
}%%
-%% write data;
-
Eina_Bool
eo_tokenizer_walk(Eo_Tokenizer *toknz, const char *source)
{