diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2013-11-25 12:03:21 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2013-11-25 12:03:21 +0100 |
commit | 482fecd7e680c5a359783d8099d2cc4695f06d9c (patch) | |
tree | bfb57749b69029bc462bef0b46b212fcd1cab82a | |
parent | 2a2565431c0c13d651d574326b7e9f676dd2896b (diff) | |
download | eo_tokenizer-482fecd7e680c5a359783d8099d2cc4695f06d9c.zip eo_tokenizer-482fecd7e680c5a359783d8099d2cc4695f06d9c.tar.gz |
support class level eo comments (/*@ … */)
-rw-r--r-- | data/02_classes.c | 1 | ||||
-rw-r--r-- | eo_tokenizer.rl | 9 |
2 files changed, 9 insertions, 1 deletions
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); |