diff options
Diffstat (limited to 'eo_tokenizer.rl')
-rw-r--r-- | eo_tokenizer.rl | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/eo_tokenizer.rl b/eo_tokenizer.rl index 1bc1d6c..6709614 100644 --- a/eo_tokenizer.rl +++ b/eo_tokenizer.rl @@ -101,6 +101,17 @@ _eo_tokenizer_property_get(Eo_Tokenizer *toknz, char *p) return prop; } +static Eo_Method_Def* +_eo_tokenizer_method_get(Eo_Tokenizer *toknz, char *p) +{ + Eo_Method_Def *meth = calloc(1, sizeof(Eo_Method_Def)); + if (meth == NULL) ABORT(toknz, "calloc Eo_Method_Def failure"); + + meth->name = _eo_tokenizer_token_get(toknz, p); + + return meth; +} + static Eo_Param_Def* _eo_tokenizer_param_get(Eo_Tokenizer *toknz, char *p) { @@ -415,6 +426,36 @@ _eo_tokenizer_accessor_get(Eo_Tokenizer *toknz, Eo_Accessor_Type type) any => show_error; *|; +###### TOKENIZE METHODS + + action begin_method { + INF(" %s {", toknz->tmp.meth->name); + toknz->current_nesting++; + /* fgoto tokenize_method; */ + } + + action end_method_name { + if (toknz->tmp.meth != NULL) + ABORT(toknz, "there is a pending method definition %s", toknz->tmp.meth->name); + toknz->tmp.meth = _eo_tokenizer_method_get(toknz, fpc); + } + + action end_methods { + INF(" }"); + toknz->current_nesting--; + fgoto tokenize_class; + } + + begin_method = ident %end_method_name ignore* begin_def; + + tokenize_methods := |* + ignore+; #=> show_ignore; + comment => show_comment; + begin_method => begin_method; + end_def => end_methods; + any => show_error; + *|; + ###### TOKENIZE CLASS action end_class_comment { @@ -437,7 +478,7 @@ _eo_tokenizer_accessor_get(Eo_Tokenizer *toknz, Eo_Accessor_Type type) action begin_methods { INF(" begin methods"); toknz->current_nesting++; - /* fgoto tokenize_methods; */ + fgoto tokenize_methods; } action end_class { |