From a575460b571412b1861ccab6491938812a3cd584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 29 Nov 2013 17:17:27 +0100 Subject: support param prefix in|out|inout --- eo_definitions.h | 6 +++--- 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; -- cgit v1.1-2-g2b99