diff options
author | Daniel Kolesa <d.kolesa@samsung.com> | 2015-02-12 11:14:45 +0000 |
---|---|---|
committer | Daniel Kolesa <d.kolesa@samsung.com> | 2015-02-12 11:14:45 +0000 |
commit | be6415d66208b1037196782319c708a8be1aa6bf (patch) | |
tree | c1745fda2d84288e144b1c0a8df5b6fb02eba58b /src | |
parent | 46829c05fe2edda7bb3951e8f4ef65bb241f0881 (diff) |
eolian: parsing of @nullable and @optional args on func params
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/eolian/eo_lexer.h | 4 | ||||
-rw-r--r-- | src/lib/eolian/eo_parser.c | 25 |
2 files changed, 27 insertions, 2 deletions
diff --git a/src/lib/eolian/eo_lexer.h b/src/lib/eolian/eo_lexer.h index eb1ca97776..5203045be6 100644 --- a/src/lib/eolian/eo_lexer.h +++ b/src/lib/eolian/eo_lexer.h | |||
@@ -31,8 +31,8 @@ enum Tokens | |||
31 | KW(properties), KW(set), KW(type), KW(values), KW(var), KWAT(auto), \ | 31 | KW(properties), KW(set), KW(type), KW(values), KW(var), KWAT(auto), \ |
32 | KWAT(c_only), KWAT(class), KWAT(const), KWAT(const_get), KWAT(const_set), \ | 32 | KWAT(c_only), KWAT(class), KWAT(const), KWAT(const_get), KWAT(const_set), \ |
33 | KWAT(empty), KWAT(extern), KWAT(free), KWAT(in), KWAT(inout), KWAT(nonull), \ | 33 | KWAT(empty), KWAT(extern), KWAT(free), KWAT(in), KWAT(inout), KWAT(nonull), \ |
34 | KWAT(optional), KWAT(out), KWAT(private), KWAT(protected), KWAT(virtual), \ | 34 | KWAT(nullable), KWAT(optional), KWAT(out), KWAT(private), KWAT(protected), \ |
35 | KWAT(warn_unused), \ | 35 | KWAT(virtual), KWAT(warn_unused), \ |
36 | \ | 36 | \ |
37 | KW(byte), KW(ubyte), KW(char), KW(short), KW(ushort), KW(int), KW(uint), \ | 37 | KW(byte), KW(ubyte), KW(char), KW(short), KW(ushort), KW(int), KW(uint), \ |
38 | KW(long), KW(ulong), KW(llong), KW(ullong), \ | 38 | KW(long), KW(ulong), KW(llong), KW(ullong), \ |
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c index f01fe83605..07e37541d5 100644 --- a/src/lib/eolian/eo_parser.c +++ b/src/lib/eolian/eo_parser.c | |||
@@ -1073,6 +1073,8 @@ static void | |||
1073 | parse_param(Eo_Lexer *ls, Eina_List **params, Eina_Bool allow_inout, | 1073 | parse_param(Eo_Lexer *ls, Eina_List **params, Eina_Bool allow_inout, |
1074 | Eina_Bool is_vals) | 1074 | Eina_Bool is_vals) |
1075 | { | 1075 | { |
1076 | Eina_Bool has_nonull = EINA_FALSE, has_optional = EINA_FALSE, | ||
1077 | has_nullable = EINA_FALSE; | ||
1076 | Eolian_Function_Parameter *par = calloc(1, sizeof(Eolian_Function_Parameter)); | 1078 | Eolian_Function_Parameter *par = calloc(1, sizeof(Eolian_Function_Parameter)); |
1077 | par->base.file = eina_stringshare_ref(ls->filename); | 1079 | par->base.file = eina_stringshare_ref(ls->filename); |
1078 | par->base.line = ls->line_number; | 1080 | par->base.line = ls->line_number; |
@@ -1130,6 +1132,29 @@ parse_param(Eo_Lexer *ls, Eina_List **params, Eina_Bool allow_inout, | |||
1130 | eo_lexer_get(ls); | 1132 | eo_lexer_get(ls); |
1131 | } | 1133 | } |
1132 | } | 1134 | } |
1135 | for (;;) switch (ls->t.kw) | ||
1136 | { | ||
1137 | case KW_at_nonull: | ||
1138 | if (has_nullable) | ||
1139 | eo_lexer_syntax_error(ls, "both nullable and nonull specified"); | ||
1140 | CASE_LOCK(ls, nonull, "nonull qualifier") | ||
1141 | par->nonull = EINA_TRUE; | ||
1142 | eo_lexer_get(ls); | ||
1143 | break; | ||
1144 | case KW_at_optional: | ||
1145 | CASE_LOCK(ls, optional, "optional qualifier"); | ||
1146 | eo_lexer_get(ls); | ||
1147 | break; | ||
1148 | case KW_at_nullable: | ||
1149 | if (has_nullable) | ||
1150 | eo_lexer_syntax_error(ls, "both nullable and nonull specified"); | ||
1151 | CASE_LOCK(ls, nullable, "c_only qualifier"); | ||
1152 | eo_lexer_get(ls); | ||
1153 | break; | ||
1154 | default: | ||
1155 | goto end; | ||
1156 | } | ||
1157 | end: | ||
1133 | if (ls->t.kw == KW_at_nonull) | 1158 | if (ls->t.kw == KW_at_nonull) |
1134 | { | 1159 | { |
1135 | par->nonull = EINA_TRUE; | 1160 | par->nonull = EINA_TRUE; |