From a4485484f1169549f51137bfa69b72a3b861d021 Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Tue, 2 Jun 2015 18:27:46 +0100 Subject: [PATCH] eolian: Eolian_Object for docs --- src/lib/eolian/eo_lexer.c | 21 ++++++++++++++------- src/lib/eolian/eo_lexer.h | 8 +------- src/lib/eolian/eolian_database.h | 7 +++++++ 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/lib/eolian/eo_lexer.c b/src/lib/eolian/eo_lexer.c index 0e9548f3cc..69fef679c4 100644 --- a/src/lib/eolian/eo_lexer.c +++ b/src/lib/eolian/eo_lexer.c @@ -253,9 +253,13 @@ cend: } static void -read_doc(Eo_Lexer *ls, Eo_Token *tok) +read_doc(Eo_Lexer *ls, Eo_Token *tok, int line, int column) { - Eo_Doc *doc = calloc(1, sizeof(Eo_Doc)); + Eolian_Documentation *doc = calloc(1, sizeof(Eolian_Documentation)); + doc->base.file = ls->filename; + doc->base.line = line; + doc->base.column = column; + eina_strbuf_reset(ls->buff); skip_ws(ls); @@ -651,11 +655,14 @@ lex(Eo_Lexer *ls, Eo_Token *tok) continue; } case '[': - next_char(ls); - if (ls->current != '[') return '['; - next_char(ls); - read_doc(ls, tok); - return TOK_DOC; + { + int dline = ls->line_number, dcol = ls->column; + next_char(ls); + if (ls->current != '[') return '['; + next_char(ls); + read_doc(ls, tok, dline, dcol); + return TOK_DOC; + } case '\0': return -1; case '=': diff --git a/src/lib/eolian/eo_lexer.h b/src/lib/eolian/eo_lexer.h index f56bc0b61b..713599d1d9 100644 --- a/src/lib/eolian/eo_lexer.h +++ b/src/lib/eolian/eo_lexer.h @@ -81,12 +81,6 @@ enum Numbers NUM_DOUBLE }; -typedef struct _Eo_Doc -{ - Eina_Stringshare *summary; - Eina_Stringshare *description; -} Eo_Doc; - typedef union { char c; @@ -99,7 +93,7 @@ typedef union unsigned long long ull; float f; double d; - Eo_Doc *doc; + Eolian_Documentation *doc; } Eo_Token_Union; /* a token - "token" is the actual token id, "value" is the value of a token diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h index 86b0180947..f315d1ba46 100644 --- a/src/lib/eolian/eolian_database.h +++ b/src/lib/eolian/eolian_database.h @@ -60,6 +60,13 @@ typedef struct _Eolian_Object int column; } Eolian_Object; +typedef struct _Eolian_Documentation +{ + Eolian_Object base; + Eina_Stringshare *summary; + Eina_Stringshare *description; +} Eolian_Documentation; + typedef struct _Eolian_Declaration { Eolian_Declaration_Type type;