diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2013-11-29 17:17:27 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2013-11-29 17:17:27 +0100 |
commit | a575460b571412b1861ccab6491938812a3cd584 (patch) | |
tree | b8035a7dbf0df43dc2ca8ee20f48c099fa0f71a9 | |
parent | b6974cce3fdb2450eb15b23d70d69690af25ef1b (diff) | |
download | eo_tokenizer-a575460b571412b1861ccab6491938812a3cd584.zip eo_tokenizer-a575460b571412b1861ccab6491938812a3cd584.tar.gz |
support param prefix in|out|inout
-rw-r--r-- | eo_definitions.h | 6 | ||||
-rw-r--r-- | eo_tokenizer.rl | 23 |
2 files changed, 24 insertions, 5 deletions
diff --git a/eo_definitions.h b/eo_definitions.h index 209cf7e..16f2f9c 100644 --- a/eo_definitions.h +++ b/eo_definitions.h @@ -15,9 +15,9 @@ typedef struct _eo_ret_def typedef enum _param_way { - IN, - OUT, - INOUT, + PARAM_IN, + PARAM_OUT, + PARAM_INOUT, PARAM_WAY_LAST } Param_Way; diff --git a/eo_tokenizer.rl b/eo_tokenizer.rl index 9c94e46..1bc1d6c 100644 --- a/eo_tokenizer.rl +++ b/eo_tokenizer.rl @@ -117,9 +117,28 @@ _eo_tokenizer_param_get(Eo_Tokenizer *toknz, char *p) if (s == toknz->saved.tok) ABORT(toknz, "wrong parameter: %s", _eo_tokenizer_token_get(toknz, p)); + s++; - param->type = _eo_tokenizer_token_get(toknz, s+1); - toknz->saved.tok = (s + 1); + param->way = PARAM_IN; + if (strncmp(toknz->saved.tok, "in ", 3) == 0) + { + toknz->saved.tok += 3; + param->way = PARAM_IN; + } + else if (strncmp(toknz->saved.tok, "out ", 4) == 0) + { + toknz->saved.tok += 4; + param->way = PARAM_OUT; + } + else if (strncmp(toknz->saved.tok, "inout ", 6) == 0) + { + toknz->saved.tok += 6; + param->way = PARAM_INOUT; + } + + param->type = _eo_tokenizer_token_get(toknz, s); + + toknz->saved.tok = s; param->name = _eo_tokenizer_token_get(toknz, p); return param; |