summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--eo_tokenizer.rl63
1 files changed, 62 insertions, 1 deletions
diff --git a/eo_tokenizer.rl b/eo_tokenizer.rl
index e92163b..f340e89 100644
--- a/eo_tokenizer.rl
+++ b/eo_tokenizer.rl
@@ -57,6 +57,31 @@ _eo_tokenizer_property_get(Eo_Tokenizer *toknz, char *p)
return prop;
}
+static Eo_Param_Def*
+_eo_tokenizer_param_get(Eo_Tokenizer *toknz, char *p)
+{
+ char *s;
+ char buf[BUFSIZE];
+
+ Eo_Param_Def *param = calloc(1, sizeof(Eo_Param_Def));
+ if (param == NULL) ABORT(toknz, "calloc Eo_Param_Def failure");
+
+ for (s = p; s >= toknz->saved.tok; s--)
+ {
+ if ((*s == ' ') || (*s == '*'))
+ break;
+ }
+
+ if (s == toknz->saved.tok)
+ ABORT(toknz, "wrong parameter: %s", _eo_tokenizer_token_get(toknz, p));
+
+ param->type = _eo_tokenizer_token_get(toknz, s+1);
+ toknz->saved.tok = (s + 1);
+ param->name = _eo_tokenizer_token_get(toknz, p);
+
+ return param;
+}
+
static Eo_Accessor_Def *
_eo_tokenizer_accessor_get(Eo_Tokenizer *toknz, Eo_Accessor_Type type)
{
@@ -147,6 +172,42 @@ _eo_tokenizer_accessor_get(Eo_Tokenizer *toknz, Eo_Accessor_Type type)
write data;
+###### TOKENIZE PARAMS
+
+ action end_param_comment {
+ const char *c = _eo_tokenizer_token_get(toknz, fpc-2);
+ if (toknz->tmp.param == NULL)
+ ABORT(toknz, "no parameter set to associate this comment to: %s", c);
+ toknz->tmp.param->comment = c;
+ toknz->tmp.prop->params = eina_list_append(toknz->tmp.prop->params, toknz->tmp.param);
+ toknz->tmp.param = NULL;
+ }
+
+ action end_param {
+ toknz->tmp.param = _eo_tokenizer_param_get(toknz, fpc);
+ INF(" %s : %s", toknz->tmp.param->name, toknz->tmp.param->type);
+ }
+
+ action end_params {
+ INF(" }");
+ if (toknz->tmp.param != NULL)
+ toknz->tmp.prop->params = eina_list_append(toknz->tmp.prop->params, toknz->tmp.param);
+ toknz->tmp.param = NULL;
+ toknz->current_nesting--;
+ fgoto tokenize_property;
+ }
+
+ param_comment = ws* eo_comment %end_param_comment;
+ param = alpha+ >save_fpc (alnum_u | '*' | ws )+ %end_param end_statement param_comment?;
+
+ tokenize_params := |*
+ ignore+; #=> show_ignore;
+ comment => show_comment;
+ param;
+ end_def => end_params;
+ any => show_error;
+ *|;
+
###### TOKENIZE PROPERTY
action begin_property_get {
@@ -166,7 +227,7 @@ _eo_tokenizer_accessor_get(Eo_Tokenizer *toknz, Eo_Accessor_Type type)
action begin_property_params {
INF(" params {");
toknz->current_nesting++;
- #fgoto tokenize_params;
+ fgoto tokenize_params;
}
action end_property {