eolian: some dirty janitoring
authorDaniel Kolesa <d.kolesa@samsung.com>
Tue, 1 Jul 2014 17:25:17 +0000 (18:25 +0100)
committerDaniel Kolesa <d.kolesa@samsung.com>
Tue, 1 Jul 2014 17:25:17 +0000 (18:25 +0100)
src/lib/eolian/eo_definitions.c
src/lib/eolian/eo_lexer.c
src/lib/eolian/eo_parser.c
src/lib/eolian/eolian_database.c

index 403b91a..89e89e5 100644 (file)
@@ -9,11 +9,10 @@ eo_definitions_type_free(Eo_Type_Def *tp)
    Eo_Type_Def *stp;
    if (tp->name) eina_stringshare_del(tp->name);
    /* for function types, this will map to arguments and ret_type */
-   if (tp->subtypes)
-      EINA_LIST_FREE(tp->subtypes, stp)
-         eo_definitions_type_free(stp);
+   if (tp->subtypes) EINA_LIST_FREE(tp->subtypes, stp)
+     eo_definitions_type_free(stp);
    if (tp->base_type)
-      eo_definitions_type_free(tp->base_type);
+     eo_definitions_type_free(tp->base_type);
    free(tp);
 }
 
@@ -54,10 +53,10 @@ eo_definitions_accessor_free(Eo_Accessor_Def *accessor)
 
    Eo_Accessor_Param *param;
    EINA_LIST_FREE(accessor->params, param)
-      eo_definitions_accessor_param_free(param);
+     eo_definitions_accessor_param_free(param);
 
    if (accessor->ret)
-      eo_definitions_ret_free(accessor->ret);
+     eo_definitions_ret_free(accessor->ret);
 
    free(accessor);
 }
@@ -72,13 +71,13 @@ eo_definitions_property_def_free(Eo_Property_Def *prop)
      eina_stringshare_del(prop->name);
 
    EINA_LIST_FREE(prop->keys, param)
-      eo_definitions_param_free(param);
+     eo_definitions_param_free(param);
 
    EINA_LIST_FREE(prop->values, param)
-      eo_definitions_param_free(param);
+     eo_definitions_param_free(param);
 
    EINA_LIST_FREE(prop->accessors, accessor)
-      eo_definitions_accessor_free(accessor);
+     eo_definitions_accessor_free(accessor);
 
    free(prop);
 }
@@ -89,7 +88,7 @@ eo_definitions_method_def_free(Eo_Method_Def *meth)
    Eo_Param_Def *param;
 
    if (meth->ret)
-      eo_definitions_ret_free(meth->ret);
+     eo_definitions_ret_free(meth->ret);
 
    if (meth->name)
      eina_stringshare_del(meth->name);
@@ -99,7 +98,7 @@ eo_definitions_method_def_free(Eo_Method_Def *meth)
      eina_stringshare_del(meth->legacy);
 
    EINA_LIST_FREE(meth->params, param)
-      eo_definitions_param_free(param);
+     eo_definitions_param_free(param);
 
    free(meth);
 }
@@ -159,22 +158,22 @@ eo_definitions_class_def_free(Eo_Class_Def *kls)
      eina_stringshare_del(kls->data_type);
 
    EINA_LIST_FREE(kls->inherits, s)
-      if (s) eina_stringshare_del(s);
+     if (s) eina_stringshare_del(s);
 
    EINA_LIST_FREE(kls->implements, impl)
-      eo_definitions_impl_def_free(impl);
+     eo_definitions_impl_def_free(impl);
 
    EINA_LIST_FREE(kls->constructors, meth)
-      eo_definitions_method_def_free(meth);
+     eo_definitions_method_def_free(meth);
 
    EINA_LIST_FREE(kls->properties, prop)
-      eo_definitions_property_def_free(prop);
+     eo_definitions_property_def_free(prop);
 
    EINA_LIST_FREE(kls->methods, meth)
-      eo_definitions_method_def_free(meth);
+     eo_definitions_method_def_free(meth);
 
    EINA_LIST_FREE(kls->events, sgn)
-      eo_definitions_event_def_free(sgn);
+     eo_definitions_event_def_free(sgn);
 
    free(kls);
 }
@@ -187,47 +186,47 @@ eo_definitions_temps_free(Eo_Lexer_Temps *tmp)
    const char *s;
 
    EINA_LIST_FREE(tmp->str_bufs, buf)
-      eina_strbuf_free(buf);
+     eina_strbuf_free(buf);
 
    EINA_LIST_FREE(tmp->params, par)
-      eo_definitions_param_free(par);
+     eo_definitions_param_free(par);
 
    if (tmp->legacy_def)
-      eina_stringshare_del(tmp->legacy_def);
+     eina_stringshare_del(tmp->legacy_def);
 
    if (tmp->kls)
-      eo_definitions_class_def_free(tmp->kls);
+     eo_definitions_class_def_free(tmp->kls);
 
    if (tmp->ret_def)
-      eo_definitions_ret_free(tmp->ret_def);
+     eo_definitions_ret_free(tmp->ret_def);
 
    if (tmp->typedef_def)
-      eo_definitions_typedef_def_free(tmp->typedef_def);
+     eo_definitions_typedef_def_free(tmp->typedef_def);
 
    if (tmp->type_def)
-      eo_definitions_type_free(tmp->type_def);
+     eo_definitions_type_free(tmp->type_def);
 
    if (tmp->prop)
-      eo_definitions_property_def_free(tmp->prop);
+     eo_definitions_property_def_free(tmp->prop);
 
    if (tmp->meth)
-      eo_definitions_method_def_free(tmp->meth);
+     eo_definitions_method_def_free(tmp->meth);
 
    if (tmp->param)
-      eo_definitions_param_free(tmp->param);
+     eo_definitions_param_free(tmp->param);
 
    if (tmp->accessor)
-      eo_definitions_accessor_free(tmp->accessor);
+     eo_definitions_accessor_free(tmp->accessor);
 
    if (tmp->accessor_param)
-      eo_definitions_accessor_param_free(tmp->accessor_param);
+     eo_definitions_accessor_param_free(tmp->accessor_param);
 
    EINA_LIST_FREE(tmp->str_items, s)
-      if (s) eina_stringshare_del(s);
+     if (s) eina_stringshare_del(s);
 
    if (tmp->event)
-      eo_definitions_event_def_free(tmp->event);
+     eo_definitions_event_def_free(tmp->event);
 
    if (tmp->impl)
-      eo_definitions_impl_def_free(tmp->impl);
+     eo_definitions_impl_def_free(tmp->impl);
 }
index 5d5f9b6..7cdbeef 100644 (file)
@@ -100,9 +100,9 @@ static void next_line(Eo_Lexer *ls)
    assert(is_newline(ls->current));
    next_char(ls);
    if (is_newline(ls->current) && ls->current != old)
-      next_char(ls);
+     next_char(ls);
    if (++ls->line_number >= INT_MAX)
-      eo_lexer_syntax_error(ls, "chunk has too many lines");
+     eo_lexer_syntax_error(ls, "chunk has too many lines");
 }
 
 /* go to next line and strip leading whitespace */
@@ -119,12 +119,12 @@ read_long_comment(Eo_Lexer *ls, const char **value)
    eina_strbuf_reset(ls->buff);
 
    if (is_newline(ls->current))
-      next_line_ws(ls);
+     next_line_ws(ls);
 
    for (;;)
      {
         if (!ls->current)
-             eo_lexer_lex_error(ls, "unfinished long comment", TOK_EOF);
+          eo_lexer_lex_error(ls, "unfinished long comment", TOK_EOF);
         if (ls->current == '*')
           {
              next_char(ls);
@@ -154,74 +154,69 @@ static int
 lex(Eo_Lexer *ls, const char **value, int *kwid, const char *chars)
 {
    eina_strbuf_reset(ls->buff);
-   for (;;)
+   for (;;) switch (ls->current)
      {
-        switch (ls->current)
+      case '\n':
+      case '\r':
+        next_line(ls);
+        continue;
+      case '/':
+        next_char(ls);
+        if (ls->current == '*')
           {
-             case '\n':
-             case '\r':
-                next_line(ls);
+             Eina_Bool doc;
+             next_char(ls);
+             if ((doc = (ls->current == '@')))
+               next_char(ls);
+             read_long_comment(ls, doc ? value : NULL);
+             if (doc)
+               return TOK_COMMENT;
+             else
+               continue;
+          }
+        else if (ls->current != '/') return '/';
+        while (ls->current && !is_newline(ls->current))
+          next_char(ls);
+        continue;
+      case '\0':
+        return TOK_EOF;
+      default:
+        {
+           if (isspace(ls->current))
+             {
+                assert(!is_newline(ls->current));
+                next_char(ls);
                 continue;
-             case '/':
-               {
-                  next_char(ls);
-                  if (ls->current == '*')
-                    {
-                       Eina_Bool doc;
-                       next_char(ls);
-                       if ((doc = (ls->current == '@')))
-                          next_char(ls);
-                       read_long_comment(ls, doc ? value : NULL);
-                       if (doc)
-                          return TOK_COMMENT;
-                       else
-                          continue;
-                    }
-                  else if (ls->current != '/') return '/';
-                  while (ls->current && !is_newline(ls->current))
+             }
+           if (ls->current && (isalnum(ls->current)
+               || ls->current == '@'
+               || strchr(chars, ls->current)))
+             {
+                Eina_Bool at_kw = (ls->current == '@');
+                const char *str;
+                eina_strbuf_reset(ls->buff);
+                do
+                  {
+                     eina_strbuf_append_char(ls->buff, ls->current);
                      next_char(ls);
-                  continue;
-               }
-             case '\0':
-               return TOK_EOF;
-             default:
-               {
-                  if (isspace(ls->current))
-                    {
-                       assert(!is_newline(ls->current));
-                       next_char(ls);
-                       continue;
-                    }
-                  if (ls->current && (isalnum(ls->current)
-                      || ls->current == '@'
-                      || strchr(chars, ls->current)))
-                    {
-                       Eina_Bool at_kw = (ls->current == '@');
-                       const char *str;
-                       eina_strbuf_reset(ls->buff);
-                       do
-                         {
-                            eina_strbuf_append_char(ls->buff, ls->current);
-                            next_char(ls);
-                         }
-                       while (ls->current && (isalnum(ls->current)
-                                     || strchr(chars, ls->current)));
-                       str    = eina_strbuf_string_get(ls->buff);
-                       *kwid  = (int)(uintptr_t)eina_hash_find(keyword_map,
-                                                               str);
-                       if (at_kw && *kwid == 0)
-                         eo_lexer_syntax_error(ls, "invalid keyword");
-                       *value = str;
-                       return TOK_VALUE;
-                    }
-                  else
-                    {
-                       int c = ls->current;
-                       next_char(ls);
-                       return c;
-                    }
-               }
-          }
+                  }
+                while (ls->current && (isalnum(ls->current)
+                              || strchr(chars, ls->current)));
+                str    = eina_strbuf_string_get(ls->buff);
+                *kwid  = (int)(uintptr_t)eina_hash_find(keyword_map,
+                                                        str);
+                if (at_kw && *kwid == 0)
+                  eo_lexer_syntax_error(ls, "invalid keyword");
+                *value = str;
+                return TOK_VALUE;
+             }
+           else
+             {
+                int c = ls->current;
+                next_char(ls);
+                return c;
+             }
+        }
      }
 }
 
@@ -275,7 +270,7 @@ eo_lexer_set_input(Eo_Lexer *ls, const char *source)
 {
    Eina_File *f = eina_file_open(source, EINA_FALSE);
    if (!f)
-      throw(ls, "%s\n", strerror(errno));
+     throw(ls, "%s\n", strerror(errno));
    ls->lookahead.token = TOK_EOF;
    ls->buff            = eina_strbuf_new();
    ls->handle          = f;
@@ -300,14 +295,14 @@ eo_lexer_free(Eo_Lexer *ls)
      {
         switch (nd->type)
           {
-             case NODE_CLASS:
-                eo_definitions_class_def_free(nd->def_class);
-                break;
-             case NODE_TYPEDEF:
-                eo_definitions_typedef_def_free(nd->def_typedef);
-                break;
-             default:
-                break;
+           case NODE_CLASS:
+             eo_definitions_class_def_free(nd->def_class);
+             break;
+           case NODE_TYPEDEF:
+             eo_definitions_typedef_def_free(nd->def_typedef);
+             break;
+           default:
+             break;
           }
        free(nd);
      }
@@ -389,7 +384,7 @@ eo_lexer_lex_error(Eo_Lexer *ls, const char *msg, int token)
               buf);
      }
    else
-      throw(ls, "%s:%d: %s\n", ls->source, ls->line_number, msg);
+     throw(ls, "%s:%d: %s\n", ls->source, ls->line_number, msg);
 }
 
 void
@@ -405,9 +400,9 @@ eo_lexer_token_to_str(int token, char *buf)
      {
         assert((unsigned char)token == token);
         if (iscntrl(token))
-           sprintf(buf, "char(%d)", token);
+          sprintf(buf, "char(%d)", token);
         else
-           sprintf(buf, "%c", token);
+          sprintf(buf, "%c", token);
      }
    else
      {
index 56be673..4fe9881 100644 (file)
@@ -3,7 +3,7 @@
 
 #define CASE_LOCK(ls, var, msg) \
    if (has_##var) \
-      eo_lexer_syntax_error(ls, "double " msg); \
+     eo_lexer_syntax_error(ls, "double " msg); \
    has_##var = EINA_TRUE;
 
 #define PARSE_SECTION \
@@ -38,14 +38,14 @@ static void
 check(Eo_Lexer *ls, int token)
 {
    if (ls->t.token != token)
-      error_expected(ls, token);
+     error_expected(ls, token);
 }
 
 static void
 check_kw(Eo_Lexer *ls, int kw)
 {
    if (ls->t.kw != kw)
-      error_expected(ls, TOK_VALUE + kw);
+     error_expected(ls, TOK_VALUE + kw);
 }
 
 static void
@@ -68,7 +68,7 @@ check_match(Eo_Lexer *ls, int what, int who, int where)
    if (!test_next(ls, what))
      {
         if (where == ls->line_number)
-           error_expected(ls, what);
+          error_expected(ls, what);
         else
           {
              char  buf[256];
@@ -167,16 +167,16 @@ parse_function_type(Eo_Lexer *ls)
    ls->tmp.type_def = def;
    eo_lexer_get(ls);
    if (ls->t.kw == KW_void)
-      eo_lexer_get(ls);
+     eo_lexer_get(ls);
    else
-      def->ret_type = parse_type_void(ls);
+     def->ret_type = parse_type_void(ls);
    line = ls->line_number;
    check_next(ls, '(');
    if (ls->t.token != ')')
      {
         def->arguments = eina_list_append(def->arguments, parse_type(ls));
         while (test_next(ls, ','))
-           def->arguments = eina_list_append(def->arguments, parse_type(ls));
+          def->arguments = eina_list_append(def->arguments, parse_type(ls));
      }
    check_match(ls, ')', '(', line);
    return def;
@@ -190,41 +190,41 @@ parse_type_void(Eo_Lexer *ls)
    const char  *ctype;
    switch (ls->t.kw)
      {
-        case KW_const:
-          {
-             int line;
-             eo_lexer_get(ls);
-             line = ls->line_number;
-             check_next(ls, '(');
-             def = parse_type_void(ls);
-             def->is_const = EINA_TRUE;
-             check_match(ls, ')', '(', line);
-             goto parse_ptr;
-          }
-        case KW_own:
-          {
-             int sline = ls->line_number, line;
-             eo_lexer_get(ls);
-             line = ls->line_number;
-             check_next(ls, '(');
-             def = parse_type_void(ls);
-             if (def->type != EOLIAN_TYPE_POINTER)
-               {
-                  ls->line_number = sline;
-                  eo_lexer_syntax_error(ls, "pointer type expected");
-               }
-             def->is_own = EINA_TRUE;
-             check_match(ls, ')', '(', line);
-             goto parse_ptr;
-          }
-        case KW_struct:
-          eo_lexer_get(ls);
-          has_struct = EINA_TRUE;
-          break;
-        case KW_func:
-          return parse_function_type(ls);
-        default:
-          break;
+      case KW_const:
+        {
+           int line;
+           eo_lexer_get(ls);
+           line = ls->line_number;
+           check_next(ls, '(');
+           def = parse_type_void(ls);
+           def->is_const = EINA_TRUE;
+           check_match(ls, ')', '(', line);
+           goto parse_ptr;
+        }
+      case KW_own:
+        {
+           int sline = ls->line_number, line;
+           eo_lexer_get(ls);
+           line = ls->line_number;
+           check_next(ls, '(');
+           def = parse_type_void(ls);
+           if (def->type != EOLIAN_TYPE_POINTER)
+             {
+                ls->line_number = sline;
+                eo_lexer_syntax_error(ls, "pointer type expected");
+             }
+           def->is_own = EINA_TRUE;
+           check_match(ls, ')', '(', line);
+           goto parse_ptr;
+        }
+      case KW_struct:
+        eo_lexer_get(ls);
+        has_struct = EINA_TRUE;
+        break;
+      case KW_func:
+        return parse_function_type(ls);
+      default:
+        break;
      }
    def = calloc(1, sizeof(Eo_Type_Def));
    ls->tmp.type_def = def;
@@ -293,9 +293,9 @@ parse_return(Eo_Lexer *ls, Eina_Bool allow_void)
    ls->tmp.ret_def = ret;
    eo_lexer_get(ls);
    if (allow_void)
-      ret->type = parse_type_void(ls);
+     ret->type = parse_type_void(ls);
    else
-      ret->type = parse_type(ls);
+     ret->type = parse_type(ls);
    ls->tmp.type_def = NULL;
    if (ls->t.token == '(')
      {
@@ -388,35 +388,32 @@ parse_attrs(Eo_Lexer *ls)
    check_next(ls, ':');
    check(ls, TOK_VALUE);
    buf = push_strbuf(ls);
-   for (;;)
+   for (;;) switch (ls->t.kw)
      {
-        switch (ls->t.kw)
-          {
-             case KW_const:
-                CASE_LOCK(ls, const, "const qualifier")
-                if (!first) eina_strbuf_append_char(buf, ' ');
-                eina_strbuf_append(buf, "const");
-                first = EINA_FALSE;
-                eo_lexer_get(ls);
-                break;
-             case KW_own:
-                CASE_LOCK(ls, own, "own qualifier")
-                if (!first) eina_strbuf_append_char(buf, ' ');
-                eina_strbuf_append(buf, "@own");
-                first = EINA_FALSE;
-                eo_lexer_get(ls);
-                break;
-             case KW_at_nonull:
-                CASE_LOCK(ls, nonull, "@nonull qualifier")
-                if (!first) eina_strbuf_append_char(buf, ' ');
-                eina_strbuf_append(buf, "@nonull");
-                first = EINA_FALSE;
-                eo_lexer_get(ls);
-                break;
-             default:
-                if (first) eo_lexer_syntax_error(ls, "attribute expected");
-                goto end;
-          }
+      case KW_const:
+        CASE_LOCK(ls, const, "const qualifier")
+        if (!first) eina_strbuf_append_char(buf, ' ');
+        eina_strbuf_append(buf, "const");
+        first = EINA_FALSE;
+        eo_lexer_get(ls);
+        break;
+      case KW_own:
+        CASE_LOCK(ls, own, "own qualifier")
+        if (!first) eina_strbuf_append_char(buf, ' ');
+        eina_strbuf_append(buf, "@own");
+        first = EINA_FALSE;
+        eo_lexer_get(ls);
+        break;
+      case KW_at_nonull:
+        CASE_LOCK(ls, nonull, "@nonull qualifier")
+        if (!first) eina_strbuf_append_char(buf, ' ');
+        eina_strbuf_append(buf, "@nonull");
+        first = EINA_FALSE;
+        eo_lexer_get(ls);
+        break;
+      default:
+        if (first) eo_lexer_syntax_error(ls, "attribute expected");
+        goto end;
      }
 end:
    acc->attrs = eina_stringshare_add(eina_strbuf_string_get(buf));
@@ -441,41 +438,38 @@ parse_accessor(Eo_Lexer *ls)
         acc->comment = eina_stringshare_add(ls->t.value);
         eo_lexer_get(ls);
      }
-   for (;;)
+   for (;;) switch (ls->t.kw)
      {
-        switch (ls->t.kw)
+      case KW_return:
+        CASE_LOCK(ls, return, "return")
+        parse_return(ls, acc->type == GETTER);
+        acc->ret = ls->tmp.ret_def;
+        ls->tmp.ret_def = NULL;
+        break;
+      case KW_legacy:
+        CASE_LOCK(ls, legacy, "legacy name")
+        parse_legacy(ls);
+        acc->legacy = ls->tmp.legacy_def;
+        ls->tmp.legacy_def = NULL;
+        break;
+      default:
+        if (ls->t.token != '}')
           {
-             case KW_return:
-                CASE_LOCK(ls, return, "return")
-                parse_return(ls, acc->type == GETTER);
-                acc->ret = ls->tmp.ret_def;
-                ls->tmp.ret_def = NULL;
-                break;
-             case KW_legacy:
-                CASE_LOCK(ls, legacy, "legacy name")
-                parse_legacy(ls);
-                acc->legacy = ls->tmp.legacy_def;
-                ls->tmp.legacy_def = NULL;
-                break;
-             default:
-                if (ls->t.token != '}')
-                  {
-                     check(ls, TOK_VALUE);
-                     parse_attrs(ls);
-                     acc->params = eina_list_append(acc->params,
-                                                    ls->tmp.accessor_param);
-                     ls->tmp.accessor_param = NULL;
-                     /* this code path is disabled for the time being,
-                      * it's not used in regular eolian yet either...
-                     eo_lexer_lookahead(ls);
-                     if (ls->lookahead.token == ':')
-                        parse_attrs(ls);
-                     else
-                        parse_param(ls, EINA_TRUE);*/
-                  }
-                else
-                   goto end;
+             check(ls, TOK_VALUE);
+             parse_attrs(ls);
+             acc->params = eina_list_append(acc->params,
+                                            ls->tmp.accessor_param);
+             ls->tmp.accessor_param = NULL;
+             /* this code path is disabled for the time being,
+              * it's not used in regular eolian yet either...
+             eo_lexer_lookahead(ls);
+             if (ls->lookahead.token == ':')
+               parse_attrs(ls);
+             else
+               parse_param(ls, EINA_TRUE);*/
           }
+        else
+          goto end;
      }
 end:
    check_match(ls, '}', '{', line);
@@ -511,39 +505,36 @@ parse_property(Eo_Lexer *ls)
    eo_lexer_get(ls);
    line = ls->line_number;
    check_next(ls, '{');
-   for (;;)
+   for (;;) switch (ls->t.kw)
      {
-        switch (ls->t.kw)
-          {
-             case KW_get:
-                CASE_LOCK(ls, get, "get definition")
-                parse_accessor(ls);
-                prop->accessors = eina_list_append(prop->accessors,
-                                                   ls->tmp.accessor);
-                ls->tmp.accessor = NULL;
-                break;
-             case KW_set:
-                CASE_LOCK(ls, set, "set definition")
-                parse_accessor(ls);
-                prop->accessors = eina_list_append(prop->accessors,
-                                                   ls->tmp.accessor);
-                ls->tmp.accessor = NULL;
-                break;
-             case KW_keys:
-                CASE_LOCK(ls, keys, "keys definition")
-                parse_params(ls, EINA_FALSE);
-                prop->keys = ls->tmp.params;
-                ls->tmp.params = NULL;
-                break;
-             case KW_values:
-                CASE_LOCK(ls, values, "values definition")
-                parse_params(ls, EINA_FALSE);
-                prop->values = ls->tmp.params;
-                ls->tmp.params = NULL;
-                break;
-             default:
-                goto end;
-          }
+      case KW_get:
+        CASE_LOCK(ls, get, "get definition")
+        parse_accessor(ls);
+        prop->accessors = eina_list_append(prop->accessors,
+                                           ls->tmp.accessor);
+        ls->tmp.accessor = NULL;
+        break;
+      case KW_set:
+        CASE_LOCK(ls, set, "set definition")
+        parse_accessor(ls);
+        prop->accessors = eina_list_append(prop->accessors,
+                                           ls->tmp.accessor);
+        ls->tmp.accessor = NULL;
+        break;
+      case KW_keys:
+        CASE_LOCK(ls, keys, "keys definition")
+        parse_params(ls, EINA_FALSE);
+        prop->keys = ls->tmp.params;
+        ls->tmp.params = NULL;
+        break;
+      case KW_values:
+        CASE_LOCK(ls, values, "values definition")
+        parse_params(ls, EINA_FALSE);
+        prop->values = ls->tmp.params;
+        ls->tmp.params = NULL;
+        break;
+      default:
+        goto end;
      }
 end:
    check_match(ls, '}', '{', line);
@@ -561,7 +552,7 @@ parse_method(Eo_Lexer *ls, Eina_Bool ctor)
    if (ctor)
      {
         if (ls->t.token != TOK_VALUE)
-           eo_lexer_syntax_error(ls, "expected method name");
+          eo_lexer_syntax_error(ls, "expected method name");
         meth->type = METH_CONSTRUCTOR;
         meth->name = eina_stringshare_add(ls->t.value);
         eo_lexer_get(ls);
@@ -585,37 +576,34 @@ parse_method(Eo_Lexer *ls, Eina_Bool ctor)
         meth->comment = eina_stringshare_add(ls->t.value);
         eo_lexer_get(ls);
      }
-   for (;;)
+   for (;;) switch (ls->t.kw)
      {
-        switch (ls->t.kw)
-          {
-             case KW_const:
-                CASE_LOCK(ls, const, "const qualifier")
-                meth->obj_const = EINA_TRUE;
-                eo_lexer_get(ls);
-                check_next(ls, ';');
-                break;
-             case KW_return:
-                CASE_LOCK(ls, return, "return")
-                parse_return(ls, EINA_FALSE);
-                meth->ret = ls->tmp.ret_def;
-                ls->tmp.ret_def = NULL;
-                break;
-             case KW_legacy:
-                CASE_LOCK(ls, legacy, "legacy name")
-                parse_legacy(ls);
-                meth->legacy = ls->tmp.legacy_def;
-                ls->tmp.legacy_def = NULL;
-                break;
-             case KW_params:
-                CASE_LOCK(ls, params, "params definition")
-                parse_params(ls, EINA_TRUE);
-                meth->params = ls->tmp.params;
-                ls->tmp.params = NULL;
-                break;
-             default:
-                goto end;
-          }
+      case KW_const:
+        CASE_LOCK(ls, const, "const qualifier")
+        meth->obj_const = EINA_TRUE;
+        eo_lexer_get(ls);
+        check_next(ls, ';');
+        break;
+      case KW_return:
+        CASE_LOCK(ls, return, "return")
+        parse_return(ls, EINA_FALSE);
+        meth->ret = ls->tmp.ret_def;
+        ls->tmp.ret_def = NULL;
+        break;
+      case KW_legacy:
+        CASE_LOCK(ls, legacy, "legacy name")
+        parse_legacy(ls);
+        meth->legacy = ls->tmp.legacy_def;
+        ls->tmp.legacy_def = NULL;
+        break;
+      case KW_params:
+        CASE_LOCK(ls, params, "params definition")
+        parse_params(ls, EINA_TRUE);
+        meth->params = ls->tmp.params;
+        ls->tmp.params = NULL;
+        break;
+      default:
+        goto end;
      }
 end:
    check_match(ls, '}', '{', line);
@@ -630,7 +618,7 @@ parse_implement(Eo_Lexer *ls, Eina_Bool iface)
    impl = calloc(1, sizeof(Eo_Implement_Def));
    ls->tmp.impl = impl;
    if (iface)
-      check_kw(ls, KW_class);
+     check_kw(ls, KW_class);
    if (ls->t.kw == KW_class)
      {
         eina_strbuf_append(buf, "class.");
@@ -657,7 +645,7 @@ parse_implement(Eo_Lexer *ls, Eina_Bool iface)
         eo_lexer_get(ls);
         check_next(ls, '.');
         if ((ls->t.token != TOK_VALUE) || (ls->t.kw == KW_get || ls->t.kw == KW_set))
-           eo_lexer_syntax_error(ls, "name expected");
+          eo_lexer_syntax_error(ls, "name expected");
         eina_strbuf_append(buf, ls->t.value);
         eo_lexer_get(ls);
         if (ls->t.token == '.')
@@ -680,26 +668,26 @@ parse_implement(Eo_Lexer *ls, Eina_Bool iface)
         return;
      }
    if ((ls->t.token != TOK_VALUE) || (ls->t.kw == KW_get || ls->t.kw == KW_set))
-      eo_lexer_syntax_error(ls, "class name expected");
+     eo_lexer_syntax_error(ls, "class name expected");
    eina_strbuf_append(buf, ls->t.value);
    eo_lexer_get(ls);
    check_next(ls, '.');
    eina_strbuf_append(buf, ".");
    if ((ls->t.token != TOK_VALUE) || (ls->t.kw == KW_get || ls->t.kw == KW_set))
-      eo_lexer_syntax_error(ls, "name or constructor/destructor expected");
+     eo_lexer_syntax_error(ls, "name or constructor/destructor expected");
    for (;;)
      {
         switch (ls->t.kw)
           {
-             case KW_constructor:
-             case KW_destructor:
-             case KW_get:
-             case KW_set:
-                eina_strbuf_append(buf, eo_lexer_keyword_str_get(ls->t.kw));
-                eo_lexer_get(ls);
-                goto end;
-             default:
-                break;
+           case KW_constructor:
+           case KW_destructor:
+           case KW_get:
+           case KW_set:
+             eina_strbuf_append(buf, eo_lexer_keyword_str_get(ls->t.kw));
+             eo_lexer_get(ls);
+             goto end;
+           default:
+             break;
           }
         check(ls, TOK_VALUE);
         eina_strbuf_append(buf, ls->t.value);
@@ -830,62 +818,59 @@ parse_class_body(Eo_Lexer *ls, Eina_Bool allow_ctors, Eolian_Class_Type type)
         ls->tmp.kls->comment = eina_stringshare_add(ls->t.value);
         eo_lexer_get(ls);
      }
-   for (;;)
+   for (;;) switch (ls->t.kw)
      {
-        switch (ls->t.kw)
-          {
-             case KW_legacy_prefix:
-                CASE_LOCK(ls, legacy_prefix, "legacy prefix definition")
-                eo_lexer_get(ls);
-                check_next(ls, ':');
-                check(ls, TOK_VALUE);
-                ls->tmp.kls->legacy_prefix = eina_stringshare_add(ls->t.value);
-                eo_lexer_get(ls);
-                check_next(ls, ';');
-                break;
-             case KW_eo_prefix:
-                CASE_LOCK(ls, eo_prefix, "eo prefix definition")
-                eo_lexer_get(ls);
-                check_next(ls, ':');
-                check(ls, TOK_VALUE);
-                ls->tmp.kls->eo_prefix = eina_stringshare_add(ls->t.value);
-                eo_lexer_get(ls);
-                check_next(ls, ';');
-                break;
-             case KW_data:
-                CASE_LOCK(ls, data, "data definition")
-                eo_lexer_get(ls);
-                check(ls, ':');
-                eo_lexer_get_until(ls, ';');
-                ls->tmp.kls->data_type = eina_stringshare_add(ls->t.value);
-                eo_lexer_get(ls);
-                check_next(ls, ';');
-                break;
-             case KW_constructors:
-                if (!allow_ctors)
-                   return;
-                CASE_LOCK(ls, constructors, "constructors definition")
-                parse_constructors(ls);
-                break;
-             case KW_properties:
-                CASE_LOCK(ls, properties, "properties definition")
-                parse_properties(ls);
-                break;
-             case KW_methods:
-                CASE_LOCK(ls, methods, "methods definition")
-                parse_methods(ls);
-                break;
-             case KW_implements:
-                CASE_LOCK(ls, implements, "implements definition")
-                parse_implements(ls, type == EOLIAN_CLASS_INTERFACE);
-                break;
-             case KW_events:
-                CASE_LOCK(ls, events, "events definition")
-                parse_events(ls);
-                break;
-             default:
-                return;
-          }
+      case KW_legacy_prefix:
+        CASE_LOCK(ls, legacy_prefix, "legacy prefix definition")
+        eo_lexer_get(ls);
+        check_next(ls, ':');
+        check(ls, TOK_VALUE);
+        ls->tmp.kls->legacy_prefix = eina_stringshare_add(ls->t.value);
+        eo_lexer_get(ls);
+        check_next(ls, ';');
+        break;
+      case KW_eo_prefix:
+        CASE_LOCK(ls, eo_prefix, "eo prefix definition")
+        eo_lexer_get(ls);
+        check_next(ls, ':');
+        check(ls, TOK_VALUE);
+        ls->tmp.kls->eo_prefix = eina_stringshare_add(ls->t.value);
+        eo_lexer_get(ls);
+        check_next(ls, ';');
+        break;
+      case KW_data:
+        CASE_LOCK(ls, data, "data definition")
+        eo_lexer_get(ls);
+        check(ls, ':');
+        eo_lexer_get_until(ls, ';');
+        ls->tmp.kls->data_type = eina_stringshare_add(ls->t.value);
+        eo_lexer_get(ls);
+        check_next(ls, ';');
+        break;
+      case KW_constructors:
+        if (!allow_ctors)
+          return;
+        CASE_LOCK(ls, constructors, "constructors definition")
+        parse_constructors(ls);
+        break;
+      case KW_properties:
+        CASE_LOCK(ls, properties, "properties definition")
+        parse_properties(ls);
+        break;
+      case KW_methods:
+        CASE_LOCK(ls, methods, "methods definition")
+        parse_methods(ls);
+        break;
+      case KW_implements:
+        CASE_LOCK(ls, implements, "implements definition")
+        parse_implements(ls, type == EOLIAN_CLASS_INTERFACE);
+        break;
+      case KW_events:
+        CASE_LOCK(ls, events, "events definition")
+        parse_events(ls);
+        break;
+      default:
+        return;
      }
 }
 
@@ -922,33 +907,33 @@ parse_unit(Eo_Lexer *ls, Eina_Bool eot)
 {
    switch (ls->t.kw)
      {
-        case KW_abstract:
-           if (eot) goto def;
-           parse_class(ls, EINA_TRUE, EOLIAN_CLASS_ABSTRACT);
-           goto found_class;
-        case KW_class:
-           if (eot) goto def;
-           parse_class(ls, EINA_TRUE, EOLIAN_CLASS_REGULAR);
-           goto found_class;
-        case KW_mixin:
-           if (eot) goto def;
-           parse_class(ls, EINA_FALSE, EOLIAN_CLASS_MIXIN);
-           goto found_class;
-        case KW_interface:
-           if (eot) goto def;
-           parse_class(ls, EINA_FALSE, EOLIAN_CLASS_INTERFACE);
-           goto found_class;
-        case KW_type:
-          {
-             parse_typedef(ls);
-             append_node(ls, NODE_TYPEDEF, ls->tmp.typedef_def);
-             ls->tmp.typedef_def = NULL;
-             break;
-          }
-        def:
-        default:
-           eo_lexer_syntax_error(ls, "invalid token");
+      case KW_abstract:
+        if (eot) goto def;
+        parse_class(ls, EINA_TRUE, EOLIAN_CLASS_ABSTRACT);
+        goto found_class;
+      case KW_class:
+        if (eot) goto def;
+        parse_class(ls, EINA_TRUE, EOLIAN_CLASS_REGULAR);
+        goto found_class;
+      case KW_mixin:
+        if (eot) goto def;
+        parse_class(ls, EINA_FALSE, EOLIAN_CLASS_MIXIN);
+        goto found_class;
+      case KW_interface:
+        if (eot) goto def;
+        parse_class(ls, EINA_FALSE, EOLIAN_CLASS_INTERFACE);
+        goto found_class;
+      case KW_type:
+        {
+           parse_typedef(ls);
+           append_node(ls, NODE_TYPEDEF, ls->tmp.typedef_def);
+           ls->tmp.typedef_def = NULL;
            break;
+        }
+      def:
+      default:
+        eo_lexer_syntax_error(ls, "invalid token");
+        break;
      }
    return;
 found_class:
@@ -960,7 +945,7 @@ static void
 parse_chunk(Eo_Lexer *ls, Eina_Bool eot)
 {
    while (ls->t.token != TOK_EOF)
-      parse_unit(ls, eot);
+     parse_unit(ls, eot);
 }
 
 static char *_accessor_type_str[ACCESSOR_TYPE_LAST] = { "setter", "getter"   };
@@ -979,11 +964,11 @@ _print_type(FILE *f, Eo_Type_Def *tp)
    Eina_List *l;
    Eo_Type_Def *stp;
    if (tp->is_own)
-      fputs("@own(", f);
+     fputs("@own(", f);
    if (tp->is_const)
-      fputs("const(", f);
+     fputs("const(", f);
    if (tp->type == EOLIAN_TYPE_REGULAR)
-      fputs(tp->name, f);
+     fputs(tp->name, f);
    else if (tp->type == EOLIAN_TYPE_POINTER)
      {
         _print_type(f, tp->base_type);
@@ -1008,9 +993,9 @@ _print_type(FILE *f, Eo_Type_Def *tp)
         fputc(')', f);
      }
    if (tp->is_own)
-      fputc(')', f);
+     fputc(')', f);
    if (tp->is_const)
-      fputc(')', f);
+     fputc(')', f);
 }
 
 static void
@@ -1120,14 +1105,14 @@ eo_parser_dump(Eo_Lexer *ls)
      {
         switch (nd->type)
           {
-             case NODE_CLASS:
-                _dump_class(nd->def_class);
-                break;
-             case NODE_TYPEDEF:
-                _dump_type(nd->def_typedef);
-                break;
-             default:
-                break;
+           case NODE_CLASS:
+             _dump_class(nd->def_class);
+             break;
+           case NODE_TYPEDEF:
+             _dump_type(nd->def_typedef);
+             break;
+           default:
+             break;
           }
      }
 }
@@ -1392,16 +1377,16 @@ nodeloop:
      {
         switch (nd->type)
           {
-             case NODE_CLASS:
-                if (!_db_fill_class(nd->def_class, filename))
-                   goto error;
-                break;
-             case NODE_TYPEDEF:
-                if (!_db_fill_type(nd->def_typedef))
-                   goto error;
-                break;
-             default:
-                break;
+           case NODE_CLASS:
+             if (!_db_fill_class(nd->def_class, filename))
+               goto error;
+             break;
+           case NODE_TYPEDEF:
+             if (!_db_fill_type(nd->def_typedef))
+               goto error;
+             break;
+           default:
+             break;
           }
      }
 
index 1c53e53..55f59a6 100644 (file)
@@ -1204,9 +1204,9 @@ _ftype_to_str(Eolian_Type tp, Eina_Strbuf *buf, const char *name)
    Eolian_Type stp;
    Eina_Bool first = EINA_TRUE;
    if (tpp->ret_type)
-      _type_to_str(tpp->ret_type, buf, NULL);
+     _type_to_str(tpp->ret_type, buf, NULL);
    else
-      eina_strbuf_append(buf, "void");
+     eina_strbuf_append(buf, "void");
    eina_strbuf_append(buf, " (*");
    if (name) eina_strbuf_append(buf, name);
    eina_strbuf_append(buf, ")(");
@@ -1231,9 +1231,9 @@ _type_to_str(Eolian_Type tp, Eina_Strbuf *buf, const char *name)
      && tpp->is_const)
       eina_strbuf_append(buf, "const ");
    if (tpp->type == EOLIAN_TYPE_REGULAR)
-      eina_strbuf_append(buf, tpp->name);
+     eina_strbuf_append(buf, tpp->name);
    else if (tpp->type == EOLIAN_TYPE_VOID)
-      eina_strbuf_append(buf, "void");
+     eina_strbuf_append(buf, "void");
    else
      {
         _Parameter_Type *btpp = (_Parameter_Type*)tpp->base_type;
@@ -1292,10 +1292,10 @@ _implements_print(Eolian_Implement impl, int nb_spaces)
       case EOLIAN_PROP_GET: t = "GET"; break;
       case EOLIAN_METHOD: t = "METHOD"; break;
       case EOLIAN_UNRESOLVED:
-           {
-              t = "Type is the same as function being overriden";
-              break;
-           }
+        {
+           t = "Type is the same as function being overriden";
+           break;
+        }
       default:
          return;
      }
@@ -1318,11 +1318,11 @@ _type_print(Eolian_Type tp, Eina_Strbuf *buf)
    Eina_List *l;
    Eolian_Type stp;
    if (tpp->is_own)
-      eina_strbuf_append(buf, "@own(");
+     eina_strbuf_append(buf, "@own(");
    if (tpp->is_const)
-      eina_strbuf_append(buf, "const(");
+     eina_strbuf_append(buf, "const(");
    if (tpp->type == EOLIAN_TYPE_REGULAR)
-      eina_strbuf_append(buf, tpp->name);
+     eina_strbuf_append(buf, tpp->name);
    else if (tpp->type == EOLIAN_TYPE_POINTER)
      {
         _type_print(tpp->base_type, buf);
@@ -1347,9 +1347,9 @@ _type_print(Eolian_Type tp, Eina_Strbuf *buf)
         eina_strbuf_append_char(buf, ')');
      }
    if (tpp->is_own)
-      eina_strbuf_append_char(buf, ')');
+     eina_strbuf_append_char(buf, ')');
    if (tpp->is_const)
-       eina_strbuf_append_char(buf, ')');
+      eina_strbuf_append_char(buf, ')');
 }
 
 static Eina_Bool _function_print(const _Function_Id *fid, int nb_spaces)
@@ -1432,14 +1432,14 @@ static Eina_Bool _function_print(const _Function_Id *fid, int nb_spaces)
         switch (param->param_dir)
           {
            case EOLIAN_IN_PARAM:
-              param_dir = "IN";
-              break;
+             param_dir = "IN";
+             break;
            case EOLIAN_OUT_PARAM:
-              param_dir = "OUT";
-              break;
+             param_dir = "OUT";
+             break;
            case EOLIAN_INOUT_PARAM:
-              param_dir = "INOUT";
-              break;
+             param_dir = "INOUT";
+             break;
           }
          Eina_Strbuf *type_buf = eina_strbuf_new();
          _type_print(param->type, type_buf);
@@ -1463,7 +1463,7 @@ _class_print(const Eolian_Class class)
    EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE);
    printf("Class %s:\n", cl->name);
    if (cl->description)
-      printf("  description: <%s>\n", cl->description);
+     printf("  description: <%s>\n", cl->description);
 
    printf("  type: %s\n", types[cl->type]);
 
@@ -1473,9 +1473,7 @@ _class_print(const Eolian_Class class)
         printf("  inherits: ");
         char *word;
         EINA_LIST_FOREACH(cl->inherits, itr, word)
-          {
-             printf("%s ", word);
-          }
+          printf("%s ", word);
         printf("\n");
      }
 
@@ -1546,7 +1544,7 @@ eolian_show(const Eolian_Class class)
         Eina_List *itr;
         Eolian_Class cl;
         EINA_LIST_FOREACH(_classes, itr, cl)
-           _class_print(cl);
+          _class_print(cl);
      }
    else
      {