summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--eo_tokenizer.rl61
1 files changed, 60 insertions, 1 deletions
diff --git a/eo_tokenizer.rl b/eo_tokenizer.rl
index 6709614..f2e0454 100644
--- a/eo_tokenizer.rl
+++ b/eo_tokenizer.rl
@@ -426,12 +426,71 @@ _eo_tokenizer_accessor_get(Eo_Tokenizer *toknz, Eo_Accessor_Type type)
any => show_error;
*|;
+###### TOKENIZE METHOD
+
+ action end_method_comment {
+ if (toknz->tmp.meth->comment != NULL)
+ ABORT(toknz, "method has already a comment");
+ toknz->tmp.meth->comment = _eo_tokenizer_token_get(toknz, fpc-1);
+ INF(" %s", toknz->tmp.meth->comment);
+ }
+
+ action begin_method_params {
+ INF(" params {");
+ toknz->current_nesting++;
+ fgoto tokenize_params;
+ }
+
+ action end_method_rettype {
+ if (toknz->tmp.meth->ret.type != NULL)
+ ABORT(toknz, "method '%s' has already a return type", toknz->tmp.meth->name);
+ toknz->tmp.meth->ret.type = _eo_tokenizer_token_get(toknz, fpc);
+ INF(" %s", toknz->tmp.meth->ret.type);
+ }
+
+ action end_method_rettype_comment {
+ if (toknz->tmp.meth->ret.comment != NULL)
+ ABORT(toknz, "method '%s' return type has already a comment", toknz->tmp.meth->name);
+ toknz->tmp.meth->ret.comment = _eo_tokenizer_token_get(toknz, fpc-2);
+ INF(" %s", toknz->tmp.meth->ret.comment);
+ }
+
+ action end_method_legacy {
+ toknz->tmp.meth->legacy = _eo_tokenizer_token_get(toknz, fpc);
+ }
+
+ action end_method {
+ if (eina_list_count(toknz->tmp.meth->params) == 0)
+ WRN("method '%s' has no parameters.", toknz->tmp.meth->name);
+ INF(" }");
+ toknz->tmp.kls->methods = eina_list_append(toknz->tmp.kls->methods, toknz->tmp.meth);
+ toknz->tmp.meth = NULL;
+ toknz->current_nesting--;
+ fgoto tokenize_methods;
+ }
+
+ meth_params = 'params' ws* begin_def;
+ meth_legacy = 'legacy' ws+ ident %end_method_legacy end_statement;
+ meth_rettype_comment = ws* eo_comment %end_method_rettype_comment;
+ meth_rettype = 'return' ws+ alpha+ >save_fpc (alnum_u | '*' | ws )+ %end_method_rettype end_statement meth_rettype_comment?;
+
+ tokenize_method := |*
+ ignore+; #=> show_ignore;
+ eo_comment => end_method_comment;
+ comment => show_comment;
+ meth_params => begin_method_params;
+ meth_rettype;
+ meth_legacy;
+ end_def => end_method;
+ any => show_error;
+ *|;
+
###### TOKENIZE METHODS
action begin_method {
INF(" %s {", toknz->tmp.meth->name);
toknz->current_nesting++;
- /* fgoto tokenize_method; */
+ fgoto tokenize_method;
}
action end_method_name {