diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2013-11-25 23:00:19 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2013-11-25 23:00:19 +0100 |
commit | 8f68b304d403593a0023b90fc28e5739cf925832 (patch) | |
tree | 6c06394bcab4522b8668e3cf619ea91c683651a4 | |
parent | cf5a58c0cf6f0215b1f39459ce539b24f8a9a579 (diff) | |
download | eo_tokenizer-8f68b304d403593a0023b90fc28e5739cf925832.zip eo_tokenizer-8f68b304d403593a0023b90fc28e5739cf925832.tar.gz |
add and use ident token, complet class tokenization
-rw-r--r-- | eo_tokenizer.rl | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/eo_tokenizer.rl b/eo_tokenizer.rl index 2732136..75ccba1 100644 --- a/eo_tokenizer.rl +++ b/eo_tokenizer.rl @@ -108,6 +108,7 @@ _eo_tokenizer_class_get(Eo_Tokenizer *toknz, char *p) alnum_u = alnum | '_'; alpha_u = alpha | '_'; + ident = alpha+ >save_fpc (alnum | '_' )+; begin_def = '{'; end_def = '};'; @@ -125,11 +126,27 @@ _eo_tokenizer_class_get(Eo_Tokenizer *toknz, char *p) # TOKENIZE CLASS + action end_class_comment { + toknz->tmp.kls->comment = _eo_tokenizer_token_get(toknz, fpc-1); + } + action end_inherit_name { const char *base = _eo_tokenizer_token_get(toknz, fpc); toknz->tmp.kls->inherits = eina_list_append(toknz->tmp.kls->inherits, base); } + action begin_properties { + INF(" begin propeties"); + toknz->current_nesting++; + /* fgoto tokenize_properties; */ + } + + action begin_methods { + INF(" begin methods"); + toknz->current_nesting++; + /* fgoto tokenize_methods; */ + } + action end_class { INF("end class:%s", toknz->tmp.kls->name); toknz->classes= eina_list_append(toknz->classes, toknz->tmp.kls); @@ -138,19 +155,20 @@ _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 = ident %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; + properties = 'properties' ignore* begin_def; + methods = 'methods' ignore* begin_def; + tokenize_class := |* ignore+; #=> show_ignore; - eo_comment => end_eo_comment; + eo_comment => end_class_comment; comment => show_comment; inherits; + properties => begin_properties; + methods => begin_methods; end_def => end_class; any => show_error; *|; @@ -167,7 +185,7 @@ _eo_tokenizer_class_get(Eo_Tokenizer *toknz, char *p) toknz->tmp.kls = _eo_tokenizer_class_get(toknz, fpc); } - begin_class = alpha_u+ >save_fpc %end_class_name ignore* begin_def; + begin_class = ident %end_class_name ignore* begin_def; main := |* ignore+; #=> show_ignore; |