q66 pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=be6415d66208b1037196782319c708a8be1aa6bf

commit be6415d66208b1037196782319c708a8be1aa6bf
Author: Daniel Kolesa <[email protected]>
Date:   Thu Feb 12 11:14:45 2015 +0000

    eolian: parsing of @nullable and @optional args on func params
---
 src/lib/eolian/eo_lexer.h  |  4 ++--
 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 eb1ca97..5203045 100644
--- a/src/lib/eolian/eo_lexer.h
+++ b/src/lib/eolian/eo_lexer.h
@@ -31,8 +31,8 @@ enum Tokens
     KW(properties), KW(set), KW(type), KW(values), KW(var), KWAT(auto), \
     KWAT(c_only), KWAT(class), KWAT(const), KWAT(const_get), KWAT(const_set), \
     KWAT(empty), KWAT(extern), KWAT(free), KWAT(in), KWAT(inout), 
KWAT(nonull), \
-    KWAT(optional), KWAT(out), KWAT(private), KWAT(protected), KWAT(virtual), \
-    KWAT(warn_unused), \
+    KWAT(nullable), KWAT(optional), KWAT(out), KWAT(private), KWAT(protected), 
\
+    KWAT(virtual), KWAT(warn_unused), \
     \
     KW(byte), KW(ubyte), KW(char), KW(short), KW(ushort), KW(int), KW(uint), \
     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 f01fe83..07e3754 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -1073,6 +1073,8 @@ static void
 parse_param(Eo_Lexer *ls, Eina_List **params, Eina_Bool allow_inout,
             Eina_Bool is_vals)
 {
+   Eina_Bool has_nonull   = EINA_FALSE, has_optional = EINA_FALSE,
+             has_nullable = EINA_FALSE;
    Eolian_Function_Parameter *par = calloc(1, 
sizeof(Eolian_Function_Parameter));
    par->base.file = eina_stringshare_ref(ls->filename);
    par->base.line = ls->line_number;
@@ -1130,6 +1132,29 @@ parse_param(Eo_Lexer *ls, Eina_List **params, Eina_Bool 
allow_inout,
              eo_lexer_get(ls);
           }
      }
+   for (;;) switch (ls->t.kw)
+     {
+      case KW_at_nonull:
+        if (has_nullable)
+          eo_lexer_syntax_error(ls, "both nullable and nonull specified");
+        CASE_LOCK(ls, nonull, "nonull qualifier")
+        par->nonull = EINA_TRUE;
+        eo_lexer_get(ls);
+        break;
+      case KW_at_optional:
+        CASE_LOCK(ls, optional, "optional qualifier");
+        eo_lexer_get(ls);
+        break;
+      case KW_at_nullable:
+        if (has_nullable)
+          eo_lexer_syntax_error(ls, "both nullable and nonull specified");
+        CASE_LOCK(ls, nullable, "c_only qualifier");
+        eo_lexer_get(ls);
+        break;
+      default:
+        goto end;
+     }
+end:
    if (ls->t.kw == KW_at_nonull)
      {
         par->nonull = EINA_TRUE;

-- 


Reply via email to