summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2013-11-29 17:17:27 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2013-11-29 17:17:27 +0100
commita575460b571412b1861ccab6491938812a3cd584 (patch)
treeb8035a7dbf0df43dc2ca8ee20f48c099fa0f71a9
parentb6974cce3fdb2450eb15b23d70d69690af25ef1b (diff)
support param prefix in|out|inout
-rw-r--r--eo_definitions.h6
-rw-r--r--eo_tokenizer.rl23
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
15 15
16typedef enum _param_way 16typedef enum _param_way
17{ 17{
18 IN, 18 PARAM_IN,
19 OUT, 19 PARAM_OUT,
20 INOUT, 20 PARAM_INOUT,
21 PARAM_WAY_LAST 21 PARAM_WAY_LAST
22} Param_Way; 22} Param_Way;
23 23
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)
117 117
118 if (s == toknz->saved.tok) 118 if (s == toknz->saved.tok)
119 ABORT(toknz, "wrong parameter: %s", _eo_tokenizer_token_get(toknz, p)); 119 ABORT(toknz, "wrong parameter: %s", _eo_tokenizer_token_get(toknz, p));
120 s++;
120 121
121 param->type = _eo_tokenizer_token_get(toknz, s+1); 122 param->way = PARAM_IN;
122 toknz->saved.tok = (s + 1); 123 if (strncmp(toknz->saved.tok, "in ", 3) == 0)
124 {
125 toknz->saved.tok += 3;
126 param->way = PARAM_IN;
127 }
128 else if (strncmp(toknz->saved.tok, "out ", 4) == 0)
129 {
130 toknz->saved.tok += 4;
131 param->way = PARAM_OUT;
132 }
133 else if (strncmp(toknz->saved.tok, "inout ", 6) == 0)
134 {
135 toknz->saved.tok += 6;
136 param->way = PARAM_INOUT;
137 }
138
139 param->type = _eo_tokenizer_token_get(toknz, s);
140
141 toknz->saved.tok = s;
123 param->name = _eo_tokenizer_token_get(toknz, p); 142 param->name = _eo_tokenizer_token_get(toknz, p);
124 143
125 return param; 144 return param;