From 482fecd7e680c5a359783d8099d2cc4695f06d9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 25 Nov 2013 12:03:21 +0100 Subject: =?UTF-8?q?support=20class=20level=20eo=20comments=20(/*@=20?= =?UTF-8?q?=E2=80=A6=20*/)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/02_classes.c | 1 + eo_tokenizer.rl | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/data/02_classes.c b/data/02_classes.c index 73461f9..5d8cdc8 100644 --- a/data/02_classes.c +++ b/data/02_classes.c @@ -16,6 +16,7 @@ } C_class_D { + /*@ This is a comment for class C_class_D. */ // haha inherits { Eo_Another, Evas_Common_Interface } diff --git a/eo_tokenizer.rl b/eo_tokenizer.rl index 1f98b89..44e344e 100644 --- a/eo_tokenizer.rl +++ b/eo_tokenizer.rl @@ -100,6 +100,7 @@ _eo_tokenizer_class_get(Eo_Tokenizer *toknz, char *p) newline = cr @inc_line; ignore = (0x00..0x20 - cr)+ newline?; + eo_comment = "/*@" ignore* %save_fpc ( any | '\n' @inc_line )* :>> "*/"; c_comment = "/*" ( any | '\n' @inc_line )* :>> "*/"; cpp_comment = "//" (any - cr)* newline; comment = ( c_comment | cpp_comment ) > save_line; @@ -137,12 +138,17 @@ _eo_tokenizer_class_get(Eo_Tokenizer *toknz, char *p) fgoto main; } + action end_eo_comment { + toknz->tmp_kls->comment = _eo_tokenizer_token_get(toknz, fpc-1); + } + inherit_item = alpha_u+ >save_fpc %end_inherit_name ignore*; inherit_item_next = list_separator ignore* inherit_item; inherits = 'inherits' ignore* begin_def ignore* (inherit_item inherit_item_next*)? end_def; tokenize_class := |* ignore+; #=> show_ignore; + eo_comment => end_eo_comment; comment => show_comment; inherits; end_def => end_class; @@ -283,7 +289,8 @@ eo_tokenizer_dump(Eo_Tokenizer *toknz) EINA_LIST_FOREACH(toknz->classes, k, kls) { - printf("Class: %s\n", kls->name); + printf("Class: %s (%s)\n", + kls->name, (kls->comment ? kls->comment : "-")); printf(" inherits from :"); EINA_LIST_FOREACH(kls->inherits, l, s) printf(" %s", s); -- cgit v1.1-2-g2b99