diff options
author | Daniel Kolesa <d.kolesa@samsung.com> | 2014-06-18 11:25:07 +0100 |
---|---|---|
committer | Daniel Kolesa <d.kolesa@samsung.com> | 2014-06-19 16:04:08 +0100 |
commit | 9b833f1dbd99cd5cd56d6e6f23ae5ae7f52cd46b (patch) | |
tree | 6489952d050e5a668a977675594aa5dae661d6d5 | |
parent | 2056b99e856e8338a2085dd02bef075534c5ba54 (diff) | |
download | efl-9b833f1dbd99cd5cd56d6e6f23ae5ae7f52cd46b.tar.gz |
eolian: introducing a new lexer/parser
This handwritten lexer/parser is more strict and cleaner than the previous Ragel based one,
as well as faster and doesn't leak memory (or shouldn't). It's a recursive descent style
parser with separate lexer part (unlike the previous effort) which is run at the same
stage as the parser (so it doesn't pre-lex).
@feature
-rw-r--r-- | src/Makefile_Eolian.am | 2 | ||||
-rw-r--r-- | src/lib/eolian/eo_lexer.c | 4903 | ||||
-rw-r--r-- | src/lib/eolian/eo_lexer.h | 138 | ||||
-rw-r--r-- | src/lib/eolian/eo_parser.c | 1453 | ||||
-rw-r--r-- | src/lib/eolian/eo_parser.h | 10 | ||||
-rw-r--r-- | src/lib/eolian/eolian.c | 6 | ||||
-rw-r--r-- | src/lib/eolian/eolian_database.c | 4 |
7 files changed, 1811 insertions, 4705 deletions
diff --git a/src/Makefile_Eolian.am b/src/Makefile_Eolian.am index fb76c4d6ba..ecc911989b 100644 --- a/src/Makefile_Eolian.am +++ b/src/Makefile_Eolian.am @@ -11,6 +11,8 @@ lib_eolian_libeolian_la_SOURCES = \ lib/eolian/eo_definitions.h \ lib/eolian/eo_lexer.c \ lib/eolian/eo_lexer.h \ + lib/eolian/eo_parser.c \ + lib/eolian/eo_parser.h \ lib/eolian/eolian.c \ lib/eolian/eolian_database.c \ lib/eolian/eolian_database.h diff --git a/src/lib/eolian/eo_lexer.c b/src/lib/eolian/eo_lexer.c index d56cb414e6..5bc4fbabcc 100644 --- a/src/lib/eolian/eo_lexer.c +++ b/src/lib/eolian/eo_lexer.c @@ -1,4740 +1,349 @@ - -#line 1 "src/lib/eolian/eo_lexer.rl" #include <stdio.h> -#include <stdlib.h> -#include <Eina.h> +#include <ctype.h> + +#include <setjmp.h> +#include <assert.h> -#include "Eolian.h" -# #include "eo_lexer.h" -#include "eolian_database.h" -static int _eo_tokenizer_log_dom = -1; -#ifdef CRITICAL -#undef CRITICAL -#endif -#define CRITICAL(...) EINA_LOG_DOM_CRIT(_eo_tokenizer_log_dom, __VA_ARGS__) +int _eo_lexer_log_dom = -1; -#ifdef ERR -#undef ERR -#endif -#define ERR(...) EINA_LOG_DOM_ERR(_eo_tokenizer_log_dom, __VA_ARGS__) +#define next_char(ls) (ls->current = *(ls->stream++)) -#ifdef WRN -#undef WRN -#endif -#define WRN(...) EINA_LOG_DOM_WARN(_eo_tokenizer_log_dom, __VA_ARGS__) +#define KW(x) #x +#define KWAT(x) "@" #x -#define INF_ENABLED EINA_FALSE -#ifdef INF -#undef INF -#endif -#define INF(...) if (INF_ENABLED) EINA_LOG_DOM_INFO(_eo_tokenizer_log_dom, __VA_ARGS__) +static const char * const tokens[] = +{ + "::", "<comment>", "<eof>", "<value>", -#define DBG_ENABLED EINA_FALSE -#ifdef DBG -#undef DBG -#endif -#define DBG(...) if (DBG_ENABLED) EINA_LOG_DOM_DBG(_eo_tokenizer_log_dom, __VA_ARGS__) + KEYWORDS +}; -#define FUNC_PUBLIC 0 -#define FUNC_PROTECTED 1 +#undef KW +#undef KWAT -static int _init_counter = 0; +static Eina_Hash *keyword_map = NULL; -int -eo_tokenizer_init() +static void +throw(Eo_Lexer *ls, const char *fmt, ...) { - if (!_init_counter) - { - eina_init(); - eina_log_color_disable_set(EINA_FALSE); - _eo_tokenizer_log_dom = eina_log_domain_register("eo_toknz", EINA_COLOR_CYAN); - } - return _init_counter++; + va_list ap; + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + longjmp(ls->err_jmp, EINA_TRUE); } -int -eo_tokenizer_shutdown() +static void +init_hash(void) { - if (_init_counter <= 0) return 0; - _init_counter--; - if (!_init_counter) + unsigned int i; + if (keyword_map) return; + keyword_map = eina_hash_string_superfast_new(NULL); + for (i = 4; i < (sizeof(tokens) / sizeof(const char*)); ++i) { - eina_log_domain_unregister(_eo_tokenizer_log_dom); - _eo_tokenizer_log_dom = -1; - eina_shutdown(); + eina_hash_add(keyword_map, tokens[i], (void*)(size_t)(i - 3)); } - return _init_counter; } static void -_eo_tokenizer_abort(Eo_Lexer *toknz, - const char *file, const char* fct, int line, - const char *fmt, ...) -{ - va_list ap; - va_start (ap, fmt); - eina_log_vprint(_eo_tokenizer_log_dom, EINA_LOG_LEVEL_ERR, - file, fct, line, fmt, ap); - va_end(ap); - fprintf(stderr, "File:%s\n toknz[%d] n:%d l:%d p:%d pe:%d ts:%s te:%s act:%d\n", - toknz->source, - toknz->cs, toknz->current_nesting, toknz->current_line, - (int)(toknz->p - toknz->buf), (int)(toknz->pe - toknz->buf), - toknz->ts, toknz->te, toknz->act); - exit(EXIT_FAILURE); -} -#define ABORT(toknz, ...) \ - _eo_tokenizer_abort(toknz, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__); - -static void _eo_tokenizer_normalize_buf(char *buf) +destroy_hash(void) { - int c; - char *s, *d; - Eina_Bool in_space = EINA_TRUE; - Eina_Bool in_newline = EINA_FALSE; - - /* ' '+ -> ' ' - * '\n' ' '* '*' ' '* -> '\n' - */ - for (s = buf, d = buf; *s != '\0'; s++) + if (keyword_map) { - c = *s; - *d = c; - - if (!in_space || (c != ' ')) - d++; - - if (c == ' ') - in_space = EINA_TRUE; - else - in_space = EINA_FALSE; - - if (c == '\n') - { - in_newline = EINA_TRUE; - in_space = EINA_TRUE; - } - else if (in_newline && c == '*' ) - { - in_space = EINA_TRUE; - in_newline = EINA_FALSE; - d--; - } + eina_hash_free(keyword_map); + keyword_map = NULL; } - /* ' '+$ -> $ */ - d--; - while (*d == ' ') d--; - d++; - if (d < buf) return; - *d = '\0'; -} - -static const char* -_eo_tokenizer_token_get(Eo_Lexer *toknz, char *p) -{ - if (toknz->saved.tok == NULL) ABORT(toknz, "toknz->saved.tok is NULL"); - char d[BUFSIZE]; - int l = (p - toknz->saved.tok); - memcpy(d, toknz->saved.tok, l); - d[l] = '\0'; - _eo_tokenizer_normalize_buf(d); - toknz->saved.tok = NULL; - DBG("token : >%s<", d); - return eina_stringshare_add(d); } -static Eo_Class_Def* -_eo_tokenizer_class_get(Eo_Lexer *toknz, char *p) -{ - Eo_Class_Def *kls = calloc(1, sizeof(Eo_Class_Def)); - if (kls == NULL) ABORT(toknz, "calloc Eo_Class_Def failure"); - - kls->name = _eo_tokenizer_token_get(toknz, p); - - return kls; -} - -static Eo_Type_Def* -_eo_tokenizer_type_get(Eo_Lexer *toknz, char *p) -{ - Eo_Type_Def *def = calloc(1, sizeof(Eo_Type_Def)); - if (def == NULL) ABORT(toknz, "calloc Eo_Type_Def failure"); - - def->type = _eo_tokenizer_token_get(toknz, p); - - return def; -} - -static Eo_Property_Def* -_eo_tokenizer_property_get(Eo_Lexer *toknz, char *p) -{ - Eo_Property_Def *prop = calloc(1, sizeof(Eo_Property_Def)); - if (prop == NULL) ABORT(toknz, "calloc Eo_Property_Def failure"); - - prop->name = _eo_tokenizer_token_get(toknz, p); - prop->scope = toknz->tmp.fscope; - toknz->tmp.fscope = FUNC_PUBLIC; - - return prop; -} - -static Eo_Method_Def* -_eo_tokenizer_method_get(Eo_Lexer *toknz, char *p) -{ - Eo_Method_Def *meth = calloc(1, sizeof(Eo_Method_Def)); - if (meth == NULL) ABORT(toknz, "calloc Eo_Method_Def failure"); - - meth->name = _eo_tokenizer_token_get(toknz, p); - meth->scope = toknz->tmp.fscope; - toknz->tmp.fscope = FUNC_PUBLIC; - - return meth; -} - -static int -_eo_tokenizer_scope_get(Eo_Lexer *toknz, EINA_UNUSED char *p) -{ - if (!strncmp(toknz->saved.tok, "protected ", 10)) - return FUNC_PROTECTED; - - return FUNC_PUBLIC; -} - -static Eo_Param_Def* -_eo_tokenizer_param_get(Eo_Lexer *toknz, char *p) +static void +txt_token(Eo_Lexer *ls, int token, char *buf) { - char *s; - - Eo_Param_Def *param = calloc(1, sizeof(Eo_Param_Def)); - if (param == NULL) ABORT(toknz, "calloc Eo_Param_Def failure"); - - /* The next code part tries to identify the different tags of the - parameter. - First, we set the ';' to '\0', to search only inside this section. - We then strstr the different tags and if found, we update the internal - flag and clear the zone of the text. In this way, during the - determination of the type/variable, we will not be disturbed by the - flags. - We have to put back the ';' at the end. - */ - *p = '\0'; - s = strstr(toknz->saved.tok, "@nonull"); - if (s) - { - param->nonull = EINA_TRUE; - memset(s, ' ', 7); - } - *p = ';'; - s = p - 1; /* Don't look at the character ';' */ - /* Remove any space between the param name and ';'/@nonull - * This loop fixes the case where "char *name ;" becomes the type of the param. - */ - while (*s == ' ') s--; - for (; s >= toknz->saved.tok; s--) - { - if ((*s == ' ') || (*s == '*')) - break; - } - - if (s == toknz->saved.tok) - ABORT(toknz, "wrong parameter: %s", _eo_tokenizer_token_get(toknz, p)); - s++; - - param->way = PARAM_IN; - if (strncmp(toknz->saved.tok, "@in ", 4) == 0) - { - toknz->saved.tok += 3; - param->way = PARAM_IN; - } - else if (strncmp(toknz->saved.tok, "@out ", 5) == 0) - { - toknz->saved.tok += 4; - param->way = PARAM_OUT; - } - else if (strncmp(toknz->saved.tok, "@inout ", 7) == 0) + if (token == TOK_VALUE) { - toknz->saved.tok += 6; - param->way = PARAM_INOUT; + const char *str = eina_strbuf_string_get(ls->buff); + memcpy(buf, str, strlen(str) + 1); } - - param->type = _eo_tokenizer_token_get(toknz, s); - - toknz->saved.tok = s; - param->name = _eo_tokenizer_token_get(toknz, p); - - return param; + else + return eo_lexer_token_to_str(token, buf); } -static Eo_Ret_Def* -_eo_tokenizer_return_get(Eo_Lexer *toknz, char *p) -{ - char *s; - - Eo_Ret_Def *ret = calloc(1, sizeof(Eo_Ret_Def)); - if (ret == NULL) ABORT(toknz, "calloc Eo_Ret_Def failure"); +void eo_lexer_lex_error (Eo_Lexer *ls, const char *msg, int token); +void eo_lexer_syntax_error(Eo_Lexer *ls, const char *msg); - *p = '\0'; - s = strstr(toknz->saved.tok, "@warn_unused"); - if (s) - { - ret->warn_unused = EINA_TRUE; - memset(s, ' ', 12); - } - s = strchr(toknz->saved.tok, '('); - if (s) - { - char *ret_val; - char *end = strchr(s, ')'); - if (!end) - ABORT(toknz, "wrong syntax (missing ')'): %s", - _eo_tokenizer_token_get(toknz, p)); - /* Current values in s and end have to be changed to ' ' to not disturb the next steps (type extraction) */ - *s++ = ' '; - while (*s == ' ') s++; - *end-- = ' '; - while (end > s && *end == ' ') end--; - if (end < s) - ABORT(toknz, "empty default return value: %s", - _eo_tokenizer_token_get(toknz, p)); - ret_val = malloc(end - s + 2); /* string + '\0' */ - memcpy(ret_val, s, end - s + 1); - ret_val[end - s + 1] = '\0'; - ret->dflt_ret_val = eina_stringshare_add(ret_val); - free(ret_val); - memset(s, ' ', end - s + 1); - } - *p = ';'; - s = p - 1; /* Don't look at the character ';' */ - /* Remove any space between the param name and ';' - * This loop fixes the case where "char *name ;" becomes the type of the param. - */ - while (*s == ' ') s--; - - if (s == toknz->saved.tok) - ABORT(toknz, "wrong parameter: %s", _eo_tokenizer_token_get(toknz, p)); - s++; - - ret->type = _eo_tokenizer_token_get(toknz, s); - - return ret; -} - -static Eo_Accessor_Param* -_eo_tokenizer_accessor_param_get(Eo_Lexer *toknz, char *p) +static void next_line(Eo_Lexer *ls) { - Eo_Accessor_Param *param = calloc(1, sizeof(Eo_Accessor_Param)); - if (param == NULL) ABORT(toknz, "calloc Eo_Accessor_Param failure"); - - /* Remove the colon and spaces - we just need the param name */ - while (*p != ':') p--; - p--; - while (*p == ' ') p--; - param->name = _eo_tokenizer_token_get(toknz, p + 1); - - return param; + int old = ls->current; + assert(strchr("\r\n", ls->current)); + next_char(ls); + if (strchr("\r\n", ls->current) && ls->current != old) + next_char(ls); + if (++ls->line_number >= INT_MAX) + eo_lexer_syntax_error(ls, "chunk has too many lines"); } -static Eo_Accessor_Def * -_eo_tokenizer_accessor_get(Eo_Lexer *toknz, Eo_Accessor_Type type) -{ - Eo_Accessor_Def *accessor = calloc(1, sizeof(Eo_Accessor_Def)); - if (accessor == NULL) ABORT(toknz, "calloc Eo_Accessor_Def failure"); - - accessor->type = type; - - return accessor; -} - -static Eo_Event_Def* -_eo_tokenizer_event_get(Eo_Lexer *toknz, char *p) -{ - Eo_Event_Def *sgn = calloc(1, sizeof(Eo_Event_Def)); - if (sgn == NULL) ABORT(toknz, "calloc Eo_Event_Def failure"); - - sgn->name = _eo_tokenizer_token_get(toknz, p); - - return sgn; -} - -static Eo_Implement_Def* -_eo_tokenizer_implement_get(Eo_Lexer *toknz, char *p) -{ - Eo_Implement_Def *impl = calloc(1, sizeof(Eo_Implement_Def)); - if (impl == NULL) ABORT(toknz, "calloc Eo_Implement_Def failure"); - - impl->meth_name = _eo_tokenizer_token_get(toknz, p); - - return impl; -} - - -#line 454 "src/lib/eolian/eo_lexer.rl" - - - -#line 377 "src/lib/eolian/eo_lexer.c" -static const char _eo_tokenizer_actions[] = { - 0, 1, 0, 1, 1, 1, 2, 1, - 7, 1, 11, 1, 17, 1, 19, 1, - 20, 1, 21, 1, 22, 1, 23, 1, - 24, 1, 25, 1, 26, 1, 27, 1, - 28, 1, 29, 1, 30, 1, 31, 1, - 32, 1, 33, 1, 35, 1, 36, 1, - 37, 1, 38, 1, 39, 1, 42, 1, - 43, 1, 44, 1, 45, 1, 46, 1, - 47, 1, 48, 1, 49, 1, 50, 1, - 51, 1, 52, 1, 53, 1, 54, 1, - 55, 1, 56, 1, 57, 1, 58, 1, - 59, 1, 60, 1, 61, 1, 62, 1, - 63, 1, 64, 1, 65, 1, 66, 1, - 67, 1, 68, 1, 69, 1, 70, 1, - 71, 1, 72, 1, 73, 1, 74, 1, - 75, 1, 76, 1, 77, 1, 78, 1, - 79, 1, 80, 1, 83, 1, 84, 1, - 85, 1, 86, 1, 87, 1, 88, 1, - 89, 1, 90, 1, 91, 1, 92, 1, - 93, 1, 94, 1, 95, 1, 96, 1, - 97, 1, 98, 1, 99, 1, 100, 1, - 101, 1, 102, 1, 103, 1, 104, 1, - 105, 1, 106, 1, 107, 1, 108, 1, - 109, 1, 110, 1, 111, 1, 112, 1, - 113, 1, 114, 1, 115, 1, 116, 1, - 117, 1, 118, 1, 120, 1, 121, 1, - 122, 1, 123, 2, 0, 39, 2, 0, - 50, 2, 0, 59, 2, 0, 70, 2, - 0, 79, 2, 0, 91, 2, 0, 100, - 2, 0, 117, 2, 5, 45, 2, 6, - 40, 2, 7, 2, 2, 8, 41, 2, - 9, 54, 2, 11, 0, 2, 11, 71, - 2, 14, 86, 2, 15, 81, 2, 16, - 82, 2, 17, 0, 2, 17, 92, 2, - 19, 0, 2, 20, 0, 2, 20, 118, - 2, 21, 0, 2, 22, 0, 2, 23, - 0, 2, 23, 1, 2, 23, 2, 2, - 27, 0, 2, 32, 0, 2, 32, 118, - 2, 34, 119, 2, 37, 1, 2, 37, - 2, 2, 37, 4, 2, 37, 10, 2, - 37, 13, 3, 3, 12, 2, 3, 3, - 18, 2 -}; - -static const short _eo_tokenizer_key_offsets[] = { - 0, 2, 5, 6, 7, 8, 9, 10, - 11, 12, 15, 22, 38, 42, 50, 55, - 59, 72, 77, 84, 85, 86, 87, 88, - 89, 92, 93, 94, 95, 96, 97, 98, - 99, 102, 103, 104, 105, 108, 109, 110, - 113, 120, 131, 135, 142, 155, 169, 172, - 174, 177, 188, 190, 193, 194, 198, 205, - 212, 224, 235, 247, 259, 271, 283, 294, - 302, 310, 322, 334, 346, 358, 369, 386, - 403, 420, 437, 441, 442, 443, 453, 455, - 458, 474, 476, 479, 480, 494, 498, 499, - 500, 510, 512, 515, 517, 520, 521, 522, - 526, 527, 528, 532, 533, 537, 538, 539, - 540, 541, 545, 547, 550, 551, 555, 566, - 576, 588, 600, 612, 624, 636, 648, 660, - 670, 680, 693, 705, 717, 729, 741, 753, - 765, 777, 784, 796, 808, 820, 832, 844, - 856, 868, 880, 883, 885, 888, 899, 901, - 904, 905, 906, 907, 908, 909, 910, 911, - 912, 913, 916, 923, 931, 932, 933, 934, - 935, 939, 940, 941, 942, 943, 946, 962, - 978, 995, 1012, 1016, 1017, 1018, 1028, 1030, - 1033, 1049, 1051, 1054, 1055, 1059, 1070, 1080, - 1092, 1104, 1116, 1128, 1140, 1152, 1164, 1174, - 1184, 1197, 1209, 1221, 1233, 1245, 1257, 1269, - 1281, 1288, 1300, 1312, 1324, 1336, 1348, 1360, - 1372, 1384, 1387, 1389, 1392, 1403, 1405, 1408, - 1409, 1410, 1411, 1412, 1413, 1414, 1415, 1416, - 1417, 1418, 1419, 1423, 1424, 1425, 1429, 1436, - 1444, 1445, 1446, 1447, 1448, 1449, 1450, 1451, - 1455, 1462, 1470, 1471, 1472, 1473, 1474, 1478, - 1486, 1502, 1506, 1518, 1527, 1529, 1531, 1534, - 1543, 1544, 1546, 1549, 1560, 1562, 1565, 1574, - 1582, 1590, 1602, 1606, 1607, 1608, 1609, 1610, - 1611, 1612, 1613, 1614, 1618, 1626, 1638, 1642, - 1643, 1644, 1645, 1646, 1647, 1648, 1649, 1650, - 1651, 1652, 1653, 1654, 1658, 1665, 1673, 1674, - 1675, 1676, 1677, 1678, 1682, 1683, 1684, 1685, - 1686, 1687, 1688, 1689, 1690, 1694, 1703, 1706, - 1708, 1709, 1710, 1711, 1712, 1713, 1724, 1727, - 1729, 1740, 1752, 1764, 1768, 1768, 1769, 1778, - 1781, 1783, 1796, 1800, 1800, 1801, 1810, 1813, - 1815, 1816, 1817, 1818, 1819, 1820, 1832, 1835, - 1837, 1848, 1861, 1862, 1871, 1874, 1876, 1877, - 1878, 1879, 1880, 1884, 1884, 1885, 1897, 1900, - 1902, 1913, 1926, 1927, 1939, 1942, 1944, 1945, - 1946, 1949, 1951, 1954, 1955, 1956, 1957, 1958, - 1961, 1962, 1963 -}; - -static const char _eo_tokenizer_trans_keys[] = { - 10, 42, 10, 42, 47, 10, 115, 116, - 114, 97, 99, 116, 9, 13, 32, 9, - 13, 32, 65, 90, 97, 122, 9, 10, - 13, 32, 40, 58, 95, 123, 0, 31, - 48, 57, 65, 90, 97, 122, 10, 123, - 0, 32, 9, 10, 13, 32, 40, 123, - 0, 31, 41, 65, 90, 97, 122, 10, - 123, 0, 32, 10, 41, 44, 58, 95, - 0, 32, 48, 57, 65, 90, 97, 122, - 10, 41, 44, 0, 32, 10, 0, 32, - 65, 90, 97, 122, 58, 58, 97, 115, - 115, 9, 13, 32, 116, 101, 114, 102, - 97, 99, 101, 9, 13, 32, 120, 105, - 110, 9, 13, 32, 112, 101, 9, 13, - 32, 9, 13, 32, 65, 90, 97, 122, - 9, 13, 32, 58, 95, 48, 57, 65, - 90, 97, 122, 9, 13, 32, 58, 9, - 13, 32, 64, 90, 97, 122, 9, 13, - 32, 42, 60, 62, 95, 48, 57, 64, - 90, 97, 122, 9, 13, 32, 42, 59, - 60, 62, 95, 48, 57, 64, 90, 97, - 122, 10, 42, 64, 10, 42, 10, 42, - 47, 10, 42, 95, 0, 32, 48, 57, - 64, 90, 97, 122, 10, 42, 10, 42, - 47, 10, 9, 13, 32, 58, 9, 13, - 32, 65, 90, 97, 122, 9, 13, 32, - 65, 90, 97, 122, 9, 13, 32, 44, - 59, 95, 48, 57, 65, 90, 97, 122, - 9, 13, 32, 58, 95, 48, 57, 65, - 90, 97, 122, 9, 13, 32, 58, 95, - 103, 48, 57, 65, 90, 97, 122, 9, - 13, 32, 58, 95, 97, 48, 57, 65, - 90, 98, 122, 9, 13, 32, 58, 95, - 99, 48, 57, 65, 90, 97, 122, 9, - 13, 32, 58, 95, 121, 48, 57, 65, - 90, 97, 122, 9, 13, 32, 58, 95, - 48, 57, 65, 90, 97, 122, 9, 13, - 32, 58, 65, 90, 97, 122, 59, 95, - 48, 57, 65, 90, 97, 122, 9, 13, - 32, 58, 95, 116, 48, 57, 65, 90, - 97, 122, 9, 13, 32, 58, 95, 117, - 48, 57, 65, 90, 97, 122, 9, 13, - 32, 58, 95, 114, 48, 57, 65, 90, - 97, 122, 9, 13, 32, 58, 95, 110, - 48, 57, 65, 90, 97, 122, 9, 13, - 32, 58, 95, 48, 57, 65, 90, 97, - 122, 9, 13, 32, 58, 60, 62, 95, - 40, 42, 45, 46, 48, 57, 64, 90, - 97, 122, 9, 13, 32, 58, 60, 62, - 95, 40, 42, 45, 46, 48, 57, 64, - 90, 97, 122, 9, 13, 32, 58, 59, - 62, 95, 40, 42, 45, 46, 48, 60, - 64, 90, 97, 122, 9, 13, 32, 59, - 60, 62, 95, 40, 42, 45, 46, 48, - 57, 64, 90, 97, 122, 9, 13, 32, - 47, 42, 64, 10, 95, 0, 32, 48, - 57, 64, 90, 97, 122, 10, 42, 10, - 42, 47, 9, 13, 32, 60, 62, 95, - 40, 42, 45, 46, 48, 57, 64, 90, - 97, 122, 10, 42, 10, 42, 47, 10, - 9, 13, 32, 42, 59, 60, 62, 95, - 48, 57, 64, 90, 97, 122, 9, 13, - 32, 47, 42, 64, 10, 95, 0, 32, - 48, 57, 64, 90, 97, 122, 10, 42, - 10, 42, 47, 10, 42, 10, 42, 47, - 10, 116, 10, 123, 0, 32, 121, 115, - 10, 123, 0, 32, 116, 10, 123, 0, - 32, 108, 117, 101, 115, 10, 123, 0, - 32, 10, 42, 10, 42, 47, 10, 10, - 123, 0, 32, 10, 95, 123, 0, 32, - 48, 57, 65, 90, 97, 122, 10, 123, - 0, 32, 48, 57, 65, 90, 97, 122, - 10, 95, 111, 123, 0, 32, 48, 57, - 65, 90, 97, 122, 10, 95, 116, 123, - 0, 32, 48, 57, 65, 90, 97, 122, - 10, 95, 101, 123, 0, 32, 48, 57, - 65, 90, 97, 122, 10, 95, 99, 123, - 0, 32, 48, 57, 65, 90, 97, 122, - 10, 95, 116, 123, 0, 32, 48, 57, - 65, 90, 97, 122, 10, 95, 101, 123, - 0, 32, 48, 57, 65, 90, 97, 122, - 10, 95, 100, 123, 0, 32, 48, 57, - 65, 90, 97, 122, 9, 13, 32, 95, - 48, 57, 65, 90, 97, 122, 9, 13, - 32, 112, 48, 57, 65, 90, 97, 122, - 10, 95, 114, 117, 123, 0, 32, 48, - 57, 65, 90, 97, 122, 10, 95, 111, - 123, 0, 32, 48, 57, 65, 90, 97, - 122, 10, 95, 116, 123, 0, 32, 48, - 57, 65, 90, 97, 122, 10, 95, 101, - 123, 0, 32, 48, 57, 65, 90, 97, - 122, 10, 95, 99, 123, 0, 32, 48, - 57, 65, 90, 97, 122, 10, 95, 116, - 123, 0, 32, 48, 57, 65, 90, 97, - 122, 10, 95, 101, 123, 0, 32, 48, - 57, 65, 90, 97, 122, 10, 95, 100, - 123, 0, 32, 48, 57, 65, 90, 97, - 122, 95, 48, 57, 65, 90, 97, 122, - 10, 95, 98, 123, 0, 32, 48, 57, - 65, 90, 97, 122, 10, 95, 108, 123, - 0, 32, 48, 57, 65, 90, 97, 122, - 10, 95, 105, 123, 0, 32, 48, 57, - 65, 90, 97, 122, 10, 95, 99, 123, - 0, 32, 48, 57, 65, 90, 97, 122, - 10, 95, 98, 123, 0, 32, 48, 57, - 65, 90, 97, 122, 10, 95, 108, 123, - 0, 32, 48, 57, 65, 90, 97, 122, - 10, 95, 105, 123, 0, 32, 48, 57, - 65, 90, 97, 122, 10, 95, 99, 123, - 0, 32, 48, 57, 65, 90, 97, 122, - 10, 42, 64, 10, 42, 10, 42, 47, - 10, 42, 95, 0, 32, 48, 57, 64, - 90, 97, 122, 10, 42, 10, 42, 47, - 10, 110, 115, 116, 59, 103, 97, 99, - 121, 9, 13, 32, 9, 13, 32, 65, - 90, 97, 122, 59, 95, 48, 57, 65, - 90, 97, 122, 114, 97, 109, 115, 10, - 123, 0, 32, 116, 117, 114, 110, 9, - 13, 32, 9, 13, 32, 60, 62, 95, - 40, 42, 45, 46, 48, 57, 64, 90, - 97, 122, 9, 13, 32, 60, 62, 95, - 40, 42, 45, 46, 48, 57, 64, 90, - 97, 122, 9, 13, 32, 59, 60, 62, - 95, 40, 42, 45, 46, 48, 57, 64, - 90, 97, 122, 9, 13, 32, 59, 60, - 62, 95, 40, 42, 45, 46, 48, 57, - 64, 90, 97, 122, 9, 13, 32, 47, - 42, 64, 10, 95, 0, 32, 48, 57, - 64, 90, 97, 122, 10, 42, 10, 42, - 47, 9, 13, 32, 60, 62, 95, 40, - 42, 45, 46, 48, 57, 64, 90, 97, - 122, 10, 42, 10, 42, 47, 10, 10, - 123, 0, 32, 10, 95, 123, 0, 32, - 48, 57, 65, 90, 97, 122, 10, 123, - 0, 32, 48, 57, 65, 90, 97, 122, - 10, 95, 111, 123, 0, 32, 48, 57, - 65, 90, 97, 122, 10, 95, 116, 123, - 0, 32, 48, 57, 65, 90, 97, 122, - 10, 95, 101, 123, 0, 32, 48, 57, - 65, 90, 97, 122, 10, 95, 99, 123, - 0, 32, 48, 57, 65, 90, 97, 122, - 10, 95, 116, 123, 0, 32, 48, 57, - 65, 90, 97, 122, 10, 95, 101, 123, - 0, 32, 48, 57, 65, 90, 97, 122, - 10, 95, 100, 123, 0, 32, 48, 57, - 65, 90, 97, 122, 9, 13, 32, 95, - 48, 57, 65, 90, 97, 122, 9, 13, - 32, 112, 48, 57, 65, 90, 97, 122, - 10, 95, 114, 117, 123, 0, 32, 48, - 57, 65, 90, 97, 122, 10, 95, 111, - 123, 0, 32, 48, 57, 65, 90, 97, - 122, 10, 95, 116, 123, 0, 32, 48, - 57, 65, 90, 97, 122, 10, 95, 101, - 123, 0, 32, 48, 57, 65, 90, 97, - 122, 10, 95, 99, 123, 0, 32, 48, - 57, 65, 90, 97, 122, 10, 95, 116, - 123, 0, 32, 48, 57, 65, 90, 97, - 122, 10, 95, 101, 123, 0, 32, 48, - 57, 65, 90, 97, 122, 10, 95, 100, - 123, 0, 32, 48, 57, 65, 90, 97, - 122, 95, 48, 57, 65, 90, 97, 122, - 10, 95, 98, 123, 0, 32, 48, 57, - 65, 90, 97, 122, 10, 95, 108, 123, - 0, 32, 48, 57, 65, 90, 97, 122, - 10, 95, 105, 123, 0, 32, 48, 57, - 65, 90, 97, 122, 10, 95, 99, 123, - 0, 32, 48, 57, 65, 90, 97, 122, - 10, 95, 98, 123, 0, 32, 48, 57, - 65, 90, 97, 122, 10, 95, 108, 123, - 0, 32, 48, 57, 65, 90, 97, 122, - 10, 95, 105, 123, 0, 32, 48, 57, - 65, 90, 97, 122, 10, 95, 99, 123, - 0, 32, 48, 57, 65, 90, 97, 122, - 10, 42, 64, 10, 42, 10, 42, 47, - 10, 42, 95, 0, 32, 48, 57, 64, - 90, 97, 122, 10, 42, 10, 42, 47, - 10, 110, 115, 116, 114, 117, 99, 116, - 111, 114, 115, 10, 123, 0, 32, 116, - 97, 10, 58, 0, 32, 10, 0, 32, - 65, 90, 97, 122, 59, 95, 48, 57, - 65, 90, 97, 122, 95, 112, 114, 101, - 102, 105, 120, 10, 58, 0, 32, 10, - 0, 32, 65, 90, 97, 122, 59, 95, - 48, 57, 65, 90, 97, 122, 101, 110, - 116, 115, 10, 123, 0, 32, 10, 125, - 0, 32, 65, 90, 97, 122, 9, 10, - 13, 32, 40, 44, 59, 95, 0, 31, - 48, 57, 65, 90, 97, 122, 10, 59, - 0, 32, 9, 10, 13, 32, 47, 125, - 0, 31, 65, 90, 97, 122, 10, 47, - 125, 0, 32, 65, 90, 97, 122, 42, - 47, 10, 42, 10, 42, 47, 10, 47, - 125, 0, 32, 65, 90, 97, 122, 10, - 42, 47, 10, 42, 64, 10, 42, 95, - 0, 32, 48, 57, 64, 90, 97, 122, - 10, 42, 10, 42, 47, 10, 47, 125, - 0, 32, 65, 90, 97, 122, 9, 10, - 13, 32, 40, 59, 0, 31, 9, 13, - 32, 95, 65, 90, 97, 122, 9, 13, - 32, 41, 42, 95, 48, 57, 65, 90, - 97, 122, 10, 59, 0, 32, 112, 108, - 101, 109, 101, 110, 116, 115, 10, 123, - 0, 32, 10, 125, 0, 32, 65, 90, - 97, 122, 10, 58, 59, 95, 0, 32, - 48, 57, 65, 90, 97, 122, 10, 59, - 0, 32, 58, 103, 97, 99, 121, 95, - 112, 114, 101, 102, 105, 120, 10, 58, - 0, 32, 10, 0, 32, 65, 90, 97, - 122, 59, 95, 48, 57, 65, 90, 97, - 122, 116, 104, 111, 100, 115, 10, 123, - 0, 32, 111, 112, 101, 114, 116, 105, - 101, 115, 10, 123, 0, 32, 10, 47, - 97, 99, 105, 109, 116, 0, 32, 10, - 0, 32, 42, 47, 98, 108, 110, 105, - 121, 10, 47, 108, 114, 125, 0, 32, - 65, 90, 97, 122, 10, 0, 32, 42, - 47, 9, 13, 32, 58, 95, 48, 57, - 65, 90, 97, 122, 9, 13, 32, 58, - 95, 101, 48, 57, 65, 90, 97, 122, - 9, 13, 32, 58, 95, 101, 48, 57, - 65, 90, 97, 122, 9, 13, 32, 47, - 59, 10, 47, 125, 0, 32, 64, 90, - 97, 122, 10, 0, 32, 42, 47, 9, - 13, 32, 42, 60, 62, 95, 48, 57, - 64, 90, 97, 122, 9, 13, 32, 47, - 59, 10, 47, 103, 107, 115, 118, 125, - 0, 32, 10, 0, 32, 42, 47, 101, - 101, 101, 97, 59, 10, 47, 112, 125, - 0, 32, 48, 57, 65, 90, 97, 122, - 10, 0, 32, 42, 47, 10, 95, 123, - 0, 32, 48, 57, 65, 90, 97, 122, - 10, 95, 114, 117, 123, 0, 32, 48, - 57, 65, 90, 97, 122, 59, 10, 47, - 99, 108, 112, 114, 125, 0, 32, 10, - 0, 32, 42, 47, 111, 101, 97, 101, - 9, 13, 32, 47, 59, 10, 47, 112, - 125, 0, 32, 48, 57, 65, 90, 97, - 122, 10, 0, 32, 42, 47, 10, 95, - 123, 0, 32, 48, 57, 65, 90, 97, - 122, 10, 95, 114, 117, 123, 0, 32, - 48, 57, 65, 90, 97, 122, 59, 10, - 47, 99, 100, 101, 105, 108, 109, 112, - 125, 0, 32, 10, 0, 32, 42, 47, - 111, 97, 10, 0, 32, 111, 118, 10, - 0, 32, 59, 109, 59, 101, 10, 0, - 32, 101, 114, 59, 0 -}; - -static const char _eo_tokenizer_single_lengths[] = { - 2, 3, 1, 1, 1, 1, 1, 1, - 1, 3, 3, 8, 2, 6, 1, 2, - 5, 3, 1, 1, 1, 1, 1, 1, - 3, 1, 1, 1, 1, 1, 1, 1, - 3, 1, 1, 1, 3, 1, 1, 3, - 3, 5, 4, 3, 7, 8, 3, 2, - 3, 3, 2, 3, 1, 4, 3, 3, - 6, 5, 6, 6, 6, 6, 5, 4, - 2, 6, 6, 6, 6, 5, 7, 7, - 7, 7, 4, 1, 1, 2, 2, 3, - 6, 2, 3, 1, 8, 4, 1, 1, - 2, 2, 3, 2, 3, 1, 1, 2, - 1, 1, 2, 1, 2, 1, 1, 1, - 1, 2, 2, 3, 1, 2, 3, 2, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 5, 4, 4, 4, 4, 4, 4, - 4, 1, 4, 4, 4, 4, 4, 4, - 4, 4, 3, 2, 3, 3, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 3, 3, 2, 1, 1, 1, 1, - 2, 1, 1, 1, 1, 3, 6, 6, - 7, 7, 4, 1, 1, 2, 2, 3, - 6, 2, 3, 1, 2, 3, 2, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 5, 4, 4, 4, 4, 4, 4, 4, - 1, 4, 4, 4, 4, 4, 4, 4, - 4, 3, 2, 3, 3, 2, 3, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 2, 1, 1, 2, 1, 2, - 1, 1, 1, 1, 1, 1, 1, 2, - 1, 2, 1, 1, 1, 1, 2, 2, - 8, 2, 6, 3, 2, 2, 3, 3, - 1, 2, 3, 3, 2, 3, 3, 6, - 4, 6, 2, 1, 1, 1, 1, 1, - 1, 1, 1, 2, 2, 4, 2, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 2, 1, 2, 1, 1, - 1, 1, 1, 2, 1, 1, 1, 1, - 1, 1, 1, 1, 2, 7, 1, 2, - 1, 1, 1, 1, 1, 5, 1, 2, - 5, 6, 6, 4, 0, 1, 3, 1, - 2, 7, 4, 0, 1, 7, 1, 2, - 1, 1, 1, 1, 1, 4, 1, 2, - 3, 5, 1, 7, 1, 2, 1, 1, - 1, 1, 4, 0, 1, 4, 1, 2, - 3, 5, 1, 10, 1, 2, 1, 1, - 1, 2, 1, 1, 1, 1, 1, 1, - 1, 1, 1 -}; - -static const char _eo_tokenizer_range_lengths[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 2, 4, 1, 1, 2, 1, - 4, 1, 3, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 2, 3, 0, 2, 3, 3, 0, 0, - 0, 4, 0, 0, 0, 0, 2, 2, - 3, 3, 3, 3, 3, 3, 3, 2, - 3, 3, 3, 3, 3, 3, 5, 5, - 5, 5, 0, 0, 0, 4, 0, 0, - 5, 0, 0, 0, 3, 0, 0, 0, - 4, 0, 0, 0, 0, 0, 0, 1, - 0, 0, 1, 0, 1, 0, 0, 0, - 0, 1, 0, 0, 0, 1, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 3, - 3, 4, 4, 4, 4, 4, 4, 4, - 4, 3, 4, 4, 4, 4, 4, 4, - 4, 4, 0, 0, 0, 4, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 2, 3, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 5, 5, - 5, 5, 0, 0, 0, 4, 0, 0, - 5, 0, 0, 0, 1, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 3, 3, - 4, 4, 4, 4, 4, 4, 4, 4, - 3, 4, 4, 4, 4, 4, 4, 4, - 4, 0, 0, 0, 4, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 1, 3, 3, - 0, 0, 0, 0, 0, 0, 0, 1, - 3, 3, 0, 0, 0, 0, 1, 3, - 4, 1, 3, 3, 0, 0, 0, 3, - 0, 0, 0, 4, 0, 0, 3, 1, - 2, 3, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 3, 4, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 3, 3, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 0, - 0, 0, 0, 0, 0, 3, 1, 0, - 3, 3, 3, 0, 0, 0, 3, 1, - 0, 3, 0, 0, 0, 1, 1, 0, - 0, 0, 0, 0, 0, 4, 1, 0, - 4, 4, 0, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 4, 1, 0, - 4, 4, 0, 1, 1, 0, 0, 0, - 1, 0, 1, 0, 0, 0, 0, 1, - 0, 0, 0 -}; - -static const short _eo_tokenizer_index_offsets[] = { - 0, 3, 7, 9, 11, 13, 15, 17, - 19, 21, 25, 31, 44, 48, 56, 60, - 64, 74, 79, 84, 86, 88, 90, 92, - 94, 98, 100, 102, 104, 106, 108, 110, - 112, 116, 118, 120, 122, 126, 128, 130, - 134, 140, 149, 154, 160, 171, 183, 187, - 190, 194, 202, 205, 209, 211, 216, 222, - 228, 238, 247, 257, 267, 277, 287, 296, - 303, 309, 319, 329, 339, 349, 358, 371, - 384, 397, 410, 415, 417, 419, 426, 429, - 433, 445, 448, 452, 454, 466, 471, 473, - 475, 482, 485, 489, 492, 496, 498, 500, - 504, 506, 508, 512, 514, 518, 520, 522, - 524, 526, 530, 533, 537, 539, 543, 551, - 558, 567, 576, 585, 594, 603, 612, 621, - 629, 637, 647, 656, 665, 674, 683, 692, - 701, 710, 715, 724, 733, 742, 751, 760, - 769, 778, 787, 791, 794, 798, 806, 809, - 813, 815, 817, 819, 821, 823, 825, 827, - 829, 831, 835, 841, 847, 849, 851, 853, - 855, 859, 861, 863, 865, 867, 871, 883, - 895, 908, 921, 926, 928, 930, 937, 940, - 944, 956, 959, 963, 965, 969, 977, 984, - 993, 1002, 1011, 1020, 1029, 1038, 1047, 1055, - 1063, 1073, 1082, 1091, 1100, 1109, 1118, 1127, - 1136, 1141, 1150, 1159, 1168, 1177, 1186, 1195, - 1204, 1213, 1217, 1220, 1224, 1232, 1235, 1239, - 1241, 1243, 1245, 1247, 1249, 1251, 1253, 1255, - 1257, 1259, 1261, 1265, 1267, 1269, 1273, 1278, - 1284, 1286, 1288, 1290, 1292, 1294, 1296, 1298, - 1302, 1307, 1313, 1315, 1317, 1319, 1321, 1325, - 1331, 1344, 1348, 1358, 1365, 1368, 1371, 1375, - 1382, 1384, 1387, 1391, 1399, 1402, 1406, 1413, - 1421, 1428, 1438, 1442, 1444, 1446, 1448, 1450, - 1452, 1454, 1456, 1458, 1462, 1468, 1477, 1481, - 1483, 1485, 1487, 1489, 1491, 1493, 1495, 1497, - 1499, 1501, 1503, 1505, 1509, 1514, 1520, 1522, - 1524, 1526, 1528, 1530, 1534, 1536, 1538, 1540, - 1542, 1544, 1546, 1548, 1550, 1554, 1563, 1566, - 1569, 1571, 1573, 1575, 1577, 1579, 1588, 1591, - 1594, 1603, 1613, 1623, 1628, 1629, 1631, 1638, - 1641, 1644, 1655, 1660, 1661, 1663, 1672, 1675, - 1678, 1680, 1682, 1684, 1686, 1688, 1697, 1700, - 1703, 1711, 1721, 1723, 1732, 1735, 1738, 1740, - 1742, 1744, 1746, 1751, 1752, 1754, 1763, 1766, - 1769, 1777, 1787, 1789, 1801, 1804, 1807, 1809, - 1811, 1814, 1817, 1820, 1822, 1824, 1826, 1828, - 1831, 1833, 1835 -}; - -static const short _eo_tokenizer_indicies[] = { - 2, 3, 1, 2, 3, 4, 1, 6, - 5, 7, 0, 8, 0, 9, 0, 10, - 0, 11, 0, 12, 0, 13, 13, 13, - 0, 14, 14, 14, 15, 15, 0, 17, - 18, 17, 17, 19, 21, 20, 22, 16, - 20, 20, 20, 0, 24, 25, 23, 0, - 26, 24, 26, 26, 27, 25, 23, 0, - 28, 29, 29, 0, 31, 32, 30, 0, - 34, 35, 36, 38, 37, 33, 37, 37, - 37, 0, 40, 28, 41, 39, 0, 42, - 41, 29, 29, 0, 37, 0, 20, 0, - 43, 0, 44, 0, 45, 0, 46, 46, - 46, 0, 47, 0, 48, 0, 49, 0, - 50, 0, 51, 0, 52, 0, 53, 0, - 54, 54, 54, 0, 55, 0, 56, 0, - 57, 0, 58, 58, 58, 0, 59, 0, - 60, 0, 61, 61, 61, 0, 61, 61, - 61, 62, 62, 0, 63, 63, 63, 65, - 64, 64, 64, 64, 0, 66, 66, 66, - 67, 0, 67, 67, 67, 68, 68, 0, - 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 0, 69, 69, 69, 69, 70, - 69, 69, 69, 69, 69, 69, 0, 73, - 74, 75, 72, 73, 74, 72, 73, 74, - 76, 72, 77, 74, 78, 75, 78, 78, - 78, 72, 80, 81, 79, 80, 81, 82, - 79, 84, 83, 85, 85, 85, 86, 71, - 87, 87, 87, 88, 88, 71, 89, 89, - 89, 90, 90, 71, 91, 91, 91, 91, - 92, 91, 91, 91, 91, 71, 85, 85, - 85, 86, 93, 93, 93, 93, 71, 85, - 85, 85, 86, 93, 94, 93, 93, 93, - 71, 85, 85, 85, 86, 93, 95, 93, - 93, 93, 71, 85, 85, 85, 86, 93, - 96, 93, 93, 93, 71, 85, 85, 85, - 86, 93, 97, 93, 93, 93, 71, 98, - 98, 98, 86, 93, 93, 93, 93, 71, - 98, 98, 98, 86, 99, 99, 71, 101, - 100, 100, 100, 100, 71, 85, 85, 85, - 86, 93, 102, 93, 93, 93, 71, 85, - 85, 85, 86, 93, 103, 93, 93, 93, - 71, 85, 85, 85, 86, 93, 104, 93, - 93, 93, 71, 85, 85, 85, 86, 93, - 105, 93, 93, 93, 71, 106, 106, 106, - 86, 93, 93, 93, 93, 71, 107, 107, - 107, 86, 108, 108, 108, 108, 108, 108, - 108, 108, 71, 109, 109, 109, 86, 110, - 110, 110, 110, 110, 110, 110, 110, 71, - 109, 109, 109, 86, 111, 110, 110, 110, - 110, 110, 110, 110, 71, 112, 112, 112, - 111, 112, 112, 112, 112, 112, 112, 112, - 112, 71, 114, 114, 114, 115, 113, 116, - 113, 117, 113, 118, 119, 117, 119, 119, - 119, 113, 121, 122, 120, 121, 122, 123, - 120, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 112, 112, 71, 126, 127, 125, - 126, 127, 128, 125, 130, 129, 131, 131, - 131, 131, 132, 131, 131, 131, 131, 131, - 131, 124, 134, 134, 134, 135, 133, 136, - 133, 137, 133, 138, 139, 137, 139, 139, - 139, 133, 141, 142, 140, 141, 142, 143, - 140, 146, 147, 145, 146, 147, 148, 145, - 150, 149, 151, 144, 152, 153, 151, 144, - 154, 144, 155, 144, 156, 157, 155, 144, - 158, 144, 159, 160, 158, 144, 161, 144, - 162, 144, 163, 144, 164, 144, 165, 166, - 164, 144, 169, 170, 168, 169, 170, 171, - 168, 173, 172, 175, 176, 174, 167, 178, - 180, 181, 177, 179, 179, 179, 167, 178, - 181, 177, 179, 179, 179, 167, 178, 180, - 182, 181, 177, 179, 179, 179, 167, 178, - 180, 183, 181, 177, 179, 179, 179, 167, - 178, 180, 184, 181, 177, 179, 179, 179, - 167, 178, 180, 185, 181, 177, 179, 179, - 179, 167, 178, 180, 186, 181, 177, 179, - 179, 179, 167, 178, 180, 187, 181, 177, - 179, 179, 179, 167, 178, 180, 188, 181, - 177, 179, 179, 179, 167, 189, 189, 189, - 180, 179, 179, 179, 167, 189, 189, 189, - 191, 190, 190, 190, 167, 178, 180, 192, - 193, 181, 177, 179, 179, 179, 167, 178, - 180, 194, 181, 177, 179, 179, 179, 167, - 178, 180, 195, 181, 177, 179, 179, 179, - 167, 178, 180, 196, 181, 177, 179, 179, - 179, 167, 178, 180, 197, 181, 177, 179, - 179, 179, 167, 178, 180, 198, 181, 177, - 179, 179, 179, 167, 178, 180, 199, 181, - 177, 179, 179, 179, 167, 178, 180, 200, - 181, 177, 179, 179, 179, 167, 180, 179, - 179, 179, 167, 178, 180, 201, 181, 177, - 179, 179, 179, 167, 178, 180, 202, 181, - 177, 179, 179, 179, 167, 178, 180, 203, - 181, 177, 179, 179, 179, 167, 178, 180, - 200, 181, 177, 179, 179, 179, 167, 178, - 180, 204, 181, 177, 179, 179, 179, 167, - 178, 180, 205, 181, 177, 179, 179, 179, - 167, 178, 180, 206, 181, 177, 179, 179, - 179, 167, 178, 180, 188, 181, 177, 179, - 179, 179, 167, 209, 210, 211, 208, 209, - 210, 208, 209, 210, 212, 208, 213, 210, - 214, 211, 214, 214, 214, 208, 216, 217, - 215, 216, 217, 218, 215, 220, 219, 221, - 207, 222, 207, 223, 207, 224, 207, 225, - 207, 226, 207, 227, 207, 228, 207, 229, - 229, 229, 207, 229, 229, 229, 230, 230, - 207, 232, 231, 231, 231, 231, 207, 233, - 207, 234, 207, 235, 207, 236, 207, 237, - 238, 236, 207, 239, 207, 240, 207, 241, - 207, 242, 207, 243, 243, 243, 207, 244, - 244, 244, 245, 245, 245, 245, 245, 245, - 245, 245, 207, 246, 246, 246, 247, 247, - 247, 247, 247, 247, 247, 247, 207, 246, - 246, 246, 248, 247, 247, 247, 247, 247, - 247, 247, 247, 207, 249, 249, 249, 248, - 249, 249, 249, 249, 249, 249, 249, 249, - 207, 251, 251, 251, 252, 250, 253, 250, - 254, 250, 255, 256, 254, 256, 256, 256, - 250, 258, 259, 257, 258, 259, 260, 257, - 249, 249, 249, 249, 249, 249, 249, 249, - 249, 249, 249, 207, 263, 264, 262, 263, - 264, 265, 262, 267, 266, 269, 270, 268, - 261, 272, 274, 275, 271, 273, 273, 273, - 261, 272, 275, 271, 273, 273, 273, 261, - 272, 274, 276, 275, 271, 273, 273, 273, - 261, 272, 274, 277, 275, 271, 273, 273, - 273, 261, 272, 274, 278, 275, 271, 273, - 273, 273, 261, 272, 274, 279, 275, 271, - 273, 273, 273, 261, 272, 274, 280, 275, - 271, 273, 273, 273, 261, 272, 274, 281, - 275, 271, 273, 273, 273, 261, 272, 274, - 282, 275, 271, 273, 273, 273, 261, 283, - 283, 283, 274, 273, 273, 273, 261, 283, - 283, 283, 285, 284, 284, 284, 261, 272, - 274, 286, 287, 275, 271, 273, 273, 273, - 261, 272, 274, 288, 275, 271, 273, 273, - 273, 261, 272, 274, 289, 275, 271, 273, - 273, 273, 261, 272, 274, 290, 275, 271, - 273, 273, 273, 261, 272, 274, 291, 275, - 271, 273, 273, 273, 261, 272, 274, 292, - 275, 271, 273, 273, 273, 261, 272, 274, - 293, 275, 271, 273, 273, 273, 261, 272, - 274, 294, 275, 271, 273, 273, 273, 261, - 274, 273, 273, 273, 261, 272, 274, 295, - 275, 271, 273, 273, 273, 261, 272, 274, - 296, 275, 271, 273, 273, 273, 261, 272, - 274, 297, 275, 271, 273, 273, 273, 261, - 272, 274, 294, 275, 271, 273, 273, 273, - 261, 272, 274, 298, 275, 271, 273, 273, - 273, 261, 272, 274, 299, 275, 271, 273, - 273, 273, 261, 272, 274, 300, 275, 271, - 273, 273, 273, 261, 272, 274, 282, 275, - 271, 273, 273, 273, 261, 303, 304, 305, - 302, 303, 304, 302, 303, 304, 306, 302, - 307, 304, 308, 305, 308, 308, 308, 302, - 310, 311, 309, 310, 311, 312, 309, 314, - 313, 315, 301, 316, 301, 317, 301, 318, - 301, 319, 301, 320, 301, 321, 301, 322, - 301, 323, 301, 324, 301, 325, 326, 324, - 301, 327, 301, 328, 301, 329, 330, 328, - 301, 331, 330, 332, 332, 301, 334, 333, - 333, 333, 333, 301, 335, 301, 336, 301, - 337, 301, 338, 301, 339, 301, 340, 301, - 341, 301, 342, 343, 341, 301, 344, 343, - 345, 345, 301, 347, 346, 346, 346, 346, - 301, 348, 301, 349, 301, 350, 301, 351, - 301, 352, 353, 351, 301, 354, 356, 353, - 355, 355, 301, 358, 359, 358, 358, 360, - 361, 362, 361, 357, 361, 361, 361, 301, - 364, 365, 363, 301, 365, 367, 365, 365, - 368, 356, 366, 355, 355, 301, 367, 369, - 356, 366, 355, 355, 301, 370, 371, 301, - 372, 373, 370, 372, 373, 374, 370, 354, - 369, 356, 353, 355, 355, 301, 375, 371, - 376, 371, 301, 372, 373, 377, 370, 378, - 373, 379, 377, 379, 379, 379, 370, 381, - 382, 380, 381, 382, 383, 380, 385, 386, - 388, 384, 387, 387, 301, 389, 364, 389, - 389, 390, 365, 363, 301, 390, 390, 390, - 391, 391, 391, 301, 392, 392, 392, 393, - 392, 392, 392, 392, 392, 301, 395, 396, - 394, 301, 397, 301, 398, 301, 399, 301, - 400, 301, 401, 301, 402, 301, 403, 301, - 404, 301, 405, 406, 404, 301, 407, 409, - 406, 408, 408, 301, 411, 413, 414, 412, - 410, 412, 412, 412, 301, 416, 406, 415, - 301, 412, 301, 417, 301, 418, 301, 419, - 301, 420, 301, 421, 301, 422, 301, 423, - 301, 424, 301, 425, 301, 426, 301, 427, - 301, 428, 429, 427, 301, 430, 429, 431, - 431, 301, 433, 432, 432, 432, 432, 301, - 434, 301, 435, 301, 436, 301, 437, 301, - 438, 301, 439, 440, 438, 301, 441, 301, - 442, 301, 443, 301, 444, 301, 445, 301, - 446, 301, 447, 301, 448, 301, 449, 450, - 448, 301, 453, 454, 455, 456, 457, 458, - 459, 452, 451, 453, 452, 460, 1, 5, - 461, 462, 461, 463, 461, 464, 461, 465, - 461, 466, 461, 469, 470, 472, 473, 474, - 468, 471, 471, 467, 469, 468, 475, 477, - 83, 476, 85, 85, 85, 86, 93, 93, - 93, 93, 476, 85, 85, 85, 86, 93, - 478, 93, 93, 93, 476, 85, 85, 85, - 86, 93, 479, 93, 93, 93, 476, 114, - 114, 114, 115, 480, 481, 483, 482, 486, - 487, 489, 485, 488, 488, 484, 486, 485, - 490, 125, 129, 491, 131, 131, 131, 131, - 131, 131, 131, 131, 131, 131, 491, 134, - 134, 134, 135, 492, 493, 495, 494, 498, - 499, 500, 501, 502, 503, 504, 497, 496, - 498, 497, 505, 145, 149, 506, 507, 506, - 508, 506, 509, 506, 510, 506, 512, 511, - 515, 516, 518, 519, 514, 517, 517, 517, - 513, 515, 514, 520, 168, 172, 521, 178, - 180, 181, 177, 179, 179, 179, 521, 178, - 180, 522, 523, 181, 177, 179, 179, 179, - 521, 525, 524, 528, 529, 530, 531, 532, - 533, 534, 527, 526, 528, 527, 535, 537, - 219, 536, 538, 536, 539, 536, 540, 536, - 541, 536, 251, 251, 251, 252, 542, 543, - 545, 544, 548, 549, 551, 552, 547, 550, - 550, 550, 546, 548, 547, 553, 262, 266, - 554, 272, 274, 275, 271, 273, 273, 273, - 554, 272, 274, 555, 556, 275, 271, 273, - 273, 273, 554, 558, 557, 561, 562, 563, - 564, 565, 566, 567, 568, 569, 570, 560, - 559, 561, 560, 571, 573, 313, 572, 574, - 572, 575, 572, 578, 577, 576, 579, 580, - 572, 583, 582, 581, 585, 584, 586, 572, - 588, 587, 589, 572, 592, 591, 590, 593, - 572, 594, 572, 596, 595, 0 -}; - -static const short _eo_tokenizer_trans_targs[] = { - 309, 0, 0, 1, 309, 2, 309, 4, - 5, 6, 7, 8, 9, 10, 10, 11, - 12, 13, 12, 14, 11, 20, 309, 12, - 12, 309, 13, 14, 15, 16, 12, 12, - 309, 17, 17, 15, 18, 16, 19, 17, - 17, 18, 18, 22, 23, 24, 10, 26, - 27, 28, 29, 30, 31, 32, 10, 34, - 35, 36, 10, 38, 39, 40, 41, 42, - 41, 43, 42, 43, 44, 45, 309, 317, - 47, 47, 48, 49, 317, 49, 50, 50, - 50, 51, 317, 52, 317, 53, 54, 55, - 56, 55, 56, 56, 317, 57, 59, 60, - 61, 62, 63, 64, 64, 317, 66, 67, - 68, 69, 70, 71, 80, 72, 73, 323, - 73, 317, 74, 75, 76, 77, 77, 78, - 78, 78, 79, 324, 326, 81, 81, 82, - 326, 83, 326, 84, 330, 326, 85, 86, - 87, 88, 88, 89, 89, 89, 90, 331, - 333, 91, 91, 92, 333, 93, 333, 95, - 95, 333, 97, 98, 98, 333, 100, 100, - 333, 102, 103, 104, 105, 105, 333, 341, - 106, 106, 107, 341, 108, 341, 109, 109, - 341, 109, 109, 110, 111, 341, 113, 114, - 115, 116, 117, 118, 119, 120, 110, 121, - 122, 130, 123, 124, 125, 126, 127, 128, - 129, 131, 132, 133, 135, 136, 137, 347, - 139, 139, 140, 141, 347, 141, 142, 142, - 142, 143, 347, 144, 347, 146, 147, 148, - 347, 150, 151, 152, 153, 154, 155, 155, - 347, 157, 158, 159, 160, 160, 347, 162, - 163, 164, 165, 166, 167, 176, 168, 169, - 354, 169, 347, 170, 171, 172, 173, 173, - 174, 174, 174, 175, 355, 357, 177, 177, - 178, 357, 179, 357, 180, 180, 357, 180, - 180, 181, 182, 357, 184, 185, 186, 187, - 188, 189, 190, 191, 181, 192, 193, 201, - 194, 195, 196, 197, 198, 199, 200, 202, - 203, 204, 206, 207, 208, 363, 210, 210, - 211, 212, 363, 212, 213, 213, 213, 214, - 363, 215, 363, 217, 218, 219, 220, 221, - 222, 223, 224, 225, 226, 226, 363, 228, - 229, 229, 230, 230, 231, 231, 368, 233, - 234, 235, 236, 237, 238, 239, 239, 240, - 240, 241, 241, 370, 243, 244, 245, 246, - 246, 247, 247, 248, 371, 249, 263, 249, - 264, 248, 250, 249, 249, 250, 251, 251, - 257, 252, 253, 256, 253, 254, 255, 255, - 258, 259, 259, 260, 260, 260, 261, 262, - 251, 251, 252, 248, 371, 263, 264, 265, - 265, 266, 249, 249, 250, 268, 269, 270, - 271, 272, 273, 274, 275, 275, 276, 276, - 277, 373, 278, 278, 277, 279, 276, 278, - 278, 281, 282, 283, 284, 285, 286, 287, - 288, 289, 290, 291, 291, 292, 292, 293, - 293, 375, 295, 296, 297, 298, 299, 299, - 363, 301, 302, 303, 304, 305, 306, 307, - 308, 308, 363, 309, 310, 310, 311, 312, - 313, 314, 315, 316, 309, 309, 3, 21, - 25, 33, 37, 317, 318, 318, 319, 320, - 321, 322, 325, 317, 317, 46, 58, 65, - 317, 317, 317, 317, 326, 327, 327, 328, - 329, 332, 326, 326, 326, 326, 326, 326, - 333, 334, 334, 335, 336, 337, 338, 339, - 340, 333, 333, 94, 96, 99, 101, 333, - 333, 341, 342, 342, 343, 344, 345, 346, - 341, 341, 112, 134, 341, 341, 347, 348, - 348, 349, 350, 351, 352, 353, 356, 347, - 347, 138, 145, 149, 156, 161, 347, 347, - 347, 347, 357, 358, 358, 359, 360, 361, - 362, 357, 357, 183, 205, 357, 357, 363, - 364, 364, 365, 366, 367, 369, 372, 374, - 376, 377, 378, 363, 363, 209, 216, 227, - 363, 368, 368, 232, 242, 363, 370, 370, - 363, 363, 267, 363, 363, 280, 363, 375, - 375, 294, 300, 363, 363 -}; - -static const short _eo_tokenizer_trans_actions[] = { - 209, 0, 1, 0, 199, 0, 232, 0, - 0, 0, 0, 0, 0, 33, 0, 5, - 39, 39, 298, 39, 0, 0, 301, 0, - 1, 201, 0, 0, 0, 5, 15, 274, - 277, 13, 271, 13, 13, 0, 0, 0, - 1, 0, 1, 0, 0, 0, 31, 0, - 0, 0, 0, 0, 0, 0, 37, 0, - 0, 0, 35, 0, 0, 0, 5, 41, - 0, 41, 0, 0, 5, 0, 304, 67, - 0, 1, 0, 0, 51, 1, 5, 0, - 1, 0, 49, 0, 211, 0, 0, 7, - 241, 0, 5, 0, 244, 0, 0, 0, - 0, 0, 0, 5, 0, 238, 0, 0, - 0, 0, 0, 5, 5, 5, 5, 313, - 0, 65, 0, 0, 0, 0, 1, 5, - 0, 1, 0, 0, 85, 0, 1, 0, - 69, 0, 214, 0, 316, 83, 0, 0, - 0, 0, 1, 5, 0, 1, 0, 0, - 107, 0, 1, 0, 87, 0, 217, 0, - 1, 89, 0, 0, 1, 93, 0, 1, - 91, 0, 0, 0, 0, 1, 95, 123, - 0, 1, 0, 109, 0, 220, 0, 1, - 111, 9, 250, 0, 0, 253, 0, 0, - 0, 0, 0, 0, 0, 0, 322, 322, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 145, - 0, 1, 0, 0, 127, 1, 5, 0, - 1, 0, 125, 0, 223, 0, 0, 0, - 262, 0, 0, 0, 0, 0, 5, 0, - 259, 0, 0, 0, 0, 1, 129, 0, - 0, 0, 0, 0, 5, 5, 5, 5, - 319, 0, 143, 0, 0, 0, 0, 1, - 5, 0, 1, 0, 0, 161, 0, 1, - 0, 147, 0, 226, 0, 1, 149, 11, - 265, 0, 0, 268, 0, 0, 0, 0, - 0, 0, 0, 0, 326, 326, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 197, 0, 1, - 0, 0, 165, 1, 5, 0, 1, 0, - 163, 0, 229, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 171, 0, - 0, 1, 0, 1, 5, 0, 27, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 1, 5, 0, 25, 0, 0, 0, 0, - 1, 0, 1, 5, 0, 17, 17, 280, - 17, 0, 17, 0, 1, 0, 0, 1, - 3, 3, 0, 0, 1, 0, 0, 1, - 0, 0, 1, 5, 0, 1, 0, 0, - 21, 286, 289, 292, 21, 0, 0, 5, - 0, 0, 19, 283, 19, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 1, - 5, 0, 29, 295, 0, 0, 29, 0, - 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 1, 5, - 0, 23, 0, 0, 0, 0, 0, 1, - 175, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 173, 203, 0, 1, 307, 47, - 47, 47, 47, 47, 205, 207, 0, 0, - 0, 0, 0, 55, 0, 1, 307, 310, - 310, 310, 0, 57, 63, 0, 0, 0, - 59, 235, 61, 53, 73, 0, 1, 307, - 310, 0, 75, 81, 77, 247, 79, 71, - 99, 0, 1, 307, 47, 47, 47, 47, - 0, 101, 105, 0, 0, 0, 0, 103, - 97, 115, 0, 1, 307, 310, 310, 0, - 117, 121, 0, 0, 119, 113, 133, 0, - 1, 307, 47, 47, 47, 47, 0, 135, - 141, 0, 0, 0, 0, 0, 137, 256, - 139, 131, 153, 0, 1, 307, 310, 310, - 0, 155, 159, 0, 0, 157, 151, 179, - 0, 1, 307, 47, 47, 47, 47, 47, - 47, 47, 0, 181, 195, 0, 0, 0, - 187, 0, 1, 0, 0, 185, 0, 1, - 191, 169, 0, 189, 167, 0, 183, 0, - 1, 0, 0, 193, 177 -}; - -static const short _eo_tokenizer_to_state_actions[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 43, 0, 0, - 0, 0, 0, 0, 0, 43, 0, 0, - 0, 0, 0, 0, 0, 0, 43, 0, - 0, 0, 0, 0, 0, 43, 0, 0, - 0, 0, 0, 0, 0, 43, 0, 0, - 0, 0, 0, 43, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 43, 0, 0, - 0, 0, 0, 43, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0 -}; - -static const short _eo_tokenizer_from_state_actions[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 45, 0, 0, - 0, 0, 0, 0, 0, 45, 0, 0, - 0, 0, 0, 0, 0, 0, 45, 0, - 0, 0, 0, 0, 0, 45, 0, 0, - 0, 0, 0, 0, 0, 45, 0, 0, - 0, 0, 0, 45, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 45, 0, 0, - 0, 0, 0, 45, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0 -}; - -static const short _eo_tokenizer_eof_trans[] = { - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 72, 72, - 72, 72, 72, 72, 72, 72, 72, 72, - 72, 72, 72, 72, 72, 72, 72, 72, - 72, 72, 72, 72, 72, 72, 72, 72, - 72, 72, 114, 114, 114, 114, 114, 114, - 72, 125, 125, 125, 125, 134, 134, 134, - 134, 134, 134, 145, 145, 145, 145, 145, - 145, 145, 145, 145, 145, 145, 145, 145, - 145, 145, 168, 168, 168, 168, 168, 168, - 168, 168, 168, 168, 168, 168, 168, 168, - 168, 168, 168, 168, 168, 168, 168, 168, - 168, 168, 168, 168, 168, 168, 168, 168, - 168, 168, 208, 208, 208, 208, 208, 208, - 208, 208, 208, 208, 208, 208, 208, 208, - 208, 208, 208, 208, 208, 208, 208, 208, - 208, 208, 208, 208, 208, 208, 208, 208, - 208, 208, 251, 251, 251, 251, 251, 251, - 208, 262, 262, 262, 262, 262, 262, 262, - 262, 262, 262, 262, 262, 262, 262, 262, - 262, 262, 262, 262, 262, 262, 262, 262, - 262, 262, 262, 262, 262, 262, 262, 262, - 262, 302, 302, 302, 302, 302, 302, 302, - 302, 302, 302, 302, 302, 302, 302, 302, - 302, 302, 302, 302, 302, 302, 302, 302, - 302, 302, 302, 302, 302, 302, 302, 302, - 302, 302, 302, 302, 302, 302, 302, 302, - 302, 302, 302, 302, 302, 302, 302, 302, - 302, 302, 302, 302, 302, 302, 302, 302, - 302, 302, 302, 302, 302, 302, 302, 302, - 302, 302, 302, 302, 302, 302, 302, 302, - 302, 302, 302, 302, 302, 302, 302, 302, - 302, 302, 302, 302, 302, 302, 302, 302, - 302, 302, 302, 302, 302, 302, 302, 302, - 302, 302, 302, 302, 302, 0, 461, 462, - 462, 462, 462, 462, 462, 0, 476, 477, - 477, 477, 477, 481, 482, 483, 0, 491, - 492, 492, 493, 494, 495, 0, 506, 507, - 507, 507, 507, 507, 512, 0, 521, 522, - 522, 522, 525, 0, 536, 537, 537, 537, - 537, 537, 543, 544, 545, 0, 554, 555, - 555, 555, 558, 0, 572, 573, 573, 573, - 577, 573, 582, 585, 573, 588, 573, 591, - 573, 573, 596 -}; - -static const int eo_tokenizer_start = 309; -static const int eo_tokenizer_first_final = 309; -static const int eo_tokenizer_error = -1; - -static const int eo_tokenizer_en_tokenize_accessor = 317; -static const int eo_tokenizer_en_tokenize_params = 326; -static const int eo_tokenizer_en_tokenize_property = 333; -static const int eo_tokenizer_en_tokenize_properties = 341; -static const int eo_tokenizer_en_tokenize_method = 347; -static const int eo_tokenizer_en_tokenize_methods = 357; -static const int eo_tokenizer_en_tokenize_class = 363; -static const int eo_tokenizer_en_main = 309; - - -#line 996 "src/lib/eolian/eo_lexer.rl" - - -Eina_Bool -eo_tokenizer_walk(Eo_Lexer *toknz, const char *source) +static void +read_long_comment(Eo_Lexer *ls, const char **value) { - INF("tokenize %s...", source); - toknz->source = eina_stringshare_add(source); - - FILE *stream; - Eina_Bool ret = EINA_TRUE; - - int done = 0; - int have = 0; - int offset = 0; - - stream = fopen(toknz->source, "rb"); - if (!stream) - { - ERR("unable to read in %s", toknz->source); - return EINA_FALSE; - } - - -#line 1456 "src/lib/eolian/eo_lexer.c" - { - toknz->cs = eo_tokenizer_start; - toknz->ts = 0; - toknz->te = 0; - toknz->act = 0; - } - -#line 1019 "src/lib/eolian/eo_lexer.rl" - - while (!done) + eina_strbuf_reset(ls->buff); + for (;;) { - int len; - int space; - - toknz->p = toknz->buf + have; - space = BUFSIZE - have; - - if (space == 0) + if (!ls->current) + eo_lexer_lex_error(ls, "unfinished long comment", TOK_EOF); + if (ls->current == '*') { - fclose(stream); - ABORT(toknz, "out of buffer space"); - } - - len = fread(toknz->p, 1, space, stream); - if (len == 0) break; - toknz->pe = toknz->p + len; - - if (len < space) - { - toknz->eof = toknz->pe; - done = 1; + next_char(ls); + if (ls->current == '/') + { + next_char(ls); + break; + } + eina_strbuf_append_char(ls->buff, '*'); } - - -#line 1491 "src/lib/eolian/eo_lexer.c" - { - int _klen; - unsigned int _trans; - const char *_acts; - unsigned int _nacts; - const char *_keys; - - if ( ( toknz->p) == ( toknz->pe) ) - goto _test_eof; -_resume: - _acts = _eo_tokenizer_actions + _eo_tokenizer_from_state_actions[ toknz->cs]; - _nacts = (unsigned int) *_acts++; - while ( _nacts-- > 0 ) { - switch ( *_acts++ ) { - case 36: -#line 1 "NONE" - { toknz->ts = ( toknz->p);} - break; -#line 1510 "src/lib/eolian/eo_lexer.c" - } - } - - _keys = _eo_tokenizer_trans_keys + _eo_tokenizer_key_offsets[ toknz->cs]; - _trans = _eo_tokenizer_index_offsets[ toknz->cs]; - - _klen = _eo_tokenizer_single_lengths[ toknz->cs]; - if ( _klen > 0 ) { - const char *_lower = _keys; - const char *_mid; - const char *_upper = _keys + _klen - 1; - while (1) { - if ( _upper < _lower ) - break; - - _mid = _lower + ((_upper-_lower) >> 1); - if ( (*( toknz->p)) < *_mid ) - _upper = _mid - 1; - else if ( (*( toknz->p)) > *_mid ) - _lower = _mid + 1; - else { - _trans += (unsigned int)(_mid - _keys); - goto _match; - } - } - _keys += _klen; - _trans += _klen; - } - - _klen = _eo_tokenizer_range_lengths[ toknz->cs]; - if ( _klen > 0 ) { - const char *_lower = _keys; - const char *_mid; - const char *_upper = _keys + (_klen<<1) - 2; - while (1) { - if ( _upper < _lower ) - break; - - _mid = _lower + (((_upper-_lower) >> 1) & ~1); - if ( (*( toknz->p)) < _mid[0] ) - _upper = _mid - 2; - else if ( (*( toknz->p)) > _mid[1] ) - _lower = _mid + 2; - else { - _trans += (unsigned int)((_mid - _keys)>>1); - goto _match; - } - } - _trans += _klen; - } - -_match: - _trans = _eo_tokenizer_indicies[_trans]; -_eof_trans: - toknz->cs = _eo_tokenizer_trans_targs[_trans]; - - if ( _eo_tokenizer_trans_actions[_trans] == 0 ) - goto _again; - - _acts = _eo_tokenizer_actions + _eo_tokenizer_trans_actions[_trans]; - _nacts = (unsigned int) *_acts++; - while ( _nacts-- > 0 ) - { - switch ( *_acts++ ) - { - case 0: -#line 377 "src/lib/eolian/eo_lexer.rl" - { - toknz->current_line += 1; - DBG("inc[%d] %d", toknz->cs, toknz->current_line); - } - break; - case 1: -#line 382 "src/lib/eolian/eo_lexer.rl" - { - toknz->saved.line = toknz->current_line; - DBG("save line[%d] %d", toknz->cs, toknz->current_line); - } - break; - case 2: -#line 387 "src/lib/eolian/eo_lexer.rl" - { - toknz->saved.tok = ( toknz->p); - DBG("save token[%d] %p %c", toknz->cs, ( toknz->p), *( toknz->p)); - } - break; - case 3: -#line 392 "src/lib/eolian/eo_lexer.rl" - { - DBG("move ts %d chars forward", (int)(( toknz->p) - toknz->ts)); - toknz->ts = ( toknz->p); - } - break; - case 4: -#line 472 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.accessor) ABORT(toknz, "No accessor!!!"); - if (toknz->tmp.accessor->ret != NULL) - ABORT(toknz, "accessor has already a return type"); - toknz->tmp.accessor->ret = _eo_tokenizer_return_get(toknz, ( toknz->p)); - } - break; - case 5: -#line 479 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.accessor) ABORT(toknz, "No accessor!!!"); - if (!toknz->tmp.accessor->ret) ABORT(toknz, "No ret!!!"); - if (toknz->tmp.accessor->ret->comment != NULL) - ABORT(toknz, "accessor return type has already a comment"); - toknz->tmp.accessor->ret->comment = _eo_tokenizer_token_get(toknz, ( toknz->p)-2); - INF(" %s", toknz->tmp.accessor->ret->comment); - } - break; - case 6: -#line 488 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.accessor) ABORT(toknz, "No accessor!!!"); - toknz->tmp.accessor->legacy = _eo_tokenizer_token_get(toknz, ( toknz->p)); - } - break; - case 7: -#line 502 "src/lib/eolian/eo_lexer.rl" - { - toknz->tmp.accessor_param = _eo_tokenizer_accessor_param_get(toknz, ( toknz->p)); - } - break; - case 8: -#line 506 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.accessor_param) - ABORT(toknz, "No accessor param!!!"); - toknz->tmp.accessor_param->attrs = _eo_tokenizer_token_get(toknz, ( toknz->p)); - toknz->tmp.accessor->params = - eina_list_append(toknz->tmp.accessor->params, toknz->tmp.accessor_param); - toknz->tmp.accessor_param = NULL; - } - break; - case 9: -#line 535 "src/lib/eolian/eo_lexer.rl" - { - const char *c = _eo_tokenizer_token_get(toknz, ( toknz->p)-2); - if (toknz->tmp.param == NULL) - ABORT(toknz, "no parameter set to associate this comment to: %s", c); - toknz->tmp.param->comment = c; - toknz->tmp.param = NULL; - } - break; - case 10: -#line 543 "src/lib/eolian/eo_lexer.rl" - { - toknz->tmp.param = _eo_tokenizer_param_get(toknz, ( toknz->p)); - if (toknz->tmp.params) - *(toknz->tmp.params) = eina_list_append(*(toknz->tmp.params), toknz->tmp.param); - else - ABORT(toknz, "got a param but there is no property nor method waiting for it"); - INF(" %s : %s", toknz->tmp.param->name, toknz->tmp.param->type); - } - break; - case 11: -#line 642 "src/lib/eolian/eo_lexer.rl" - { - if (toknz->tmp.prop != NULL) - ABORT(toknz, "there is a pending property definition %s", toknz->tmp.prop->name); - toknz->tmp.prop = _eo_tokenizer_property_get(toknz, ( toknz->p)); - } - break; - case 12: -#line 648 "src/lib/eolian/eo_lexer.rl" - { - toknz->tmp.fscope = _eo_tokenizer_scope_get(toknz, ( toknz->p)); - } - break; - case 13: -#line 686 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.meth) ABORT(toknz, "No method!!!"); - if (toknz->tmp.meth->ret != NULL) - ABORT(toknz, "method '%s' has already a return type", toknz->tmp.meth->name); - toknz->tmp.meth->ret = _eo_tokenizer_return_get(toknz, ( toknz->p)); - } - break; - case 14: -#line 693 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.meth) ABORT(toknz, "No method!!!"); - if (toknz->tmp.meth->ret == NULL) ABORT(toknz, "No ret!!!"); - if (toknz->tmp.meth->ret->comment != NULL) - ABORT(toknz, "method '%s' return type has already a comment", toknz->tmp.meth->name); - toknz->tmp.meth->ret->comment = _eo_tokenizer_token_get(toknz, ( toknz->p)-2); - INF(" %s", toknz->tmp.meth->ret->comment); - } - break; - case 15: -#line 702 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.meth) ABORT(toknz, "No method!!!"); - toknz->tmp.meth->legacy = _eo_tokenizer_token_get(toknz, ( toknz->p)); - } - break; - case 16: -#line 707 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.meth) ABORT(toknz, "No method!!!"); - toknz->tmp.meth->obj_const = EINA_TRUE; - INF(" obj const"); - } - break; - case 17: -#line 765 "src/lib/eolian/eo_lexer.rl" - { - if (toknz->tmp.meth != NULL) - ABORT(toknz, "there is a pending method definition %s", toknz->tmp.meth->name); - toknz->tmp.meth = _eo_tokenizer_method_get(toknz, ( toknz->p)); - } - break; - case 18: -#line 771 "src/lib/eolian/eo_lexer.rl" - { - toknz->tmp.fscope = _eo_tokenizer_scope_get(toknz, ( toknz->p)); - } - break; - case 19: -#line 801 "src/lib/eolian/eo_lexer.rl" - { - const char *base = _eo_tokenizer_token_get(toknz, ( toknz->p)); - toknz->tmp.str_items = eina_list_append(toknz->tmp.str_items, base); - } - break; - case 20: -#line 806 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.kls) ABORT(toknz, "No class!!!"); - toknz->tmp.kls->inherits = toknz->tmp.str_items; - toknz->tmp.str_items = NULL; - } - break; - case 21: -#line 850 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.kls) ABORT(toknz, "No class!!!"); - toknz->tmp.event = _eo_tokenizer_event_get(toknz, ( toknz->p)); - toknz->tmp.kls->events = eina_list_append(toknz->tmp.kls->events, toknz->tmp.event); - } - break; - case 22: -#line 856 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.event) ABORT(toknz, "No event!!!"); - if (toknz->tmp.event->type != NULL) - ABORT(toknz, "event %s has already a type %s", toknz->tmp.event->name, toknz->tmp.event->type); - toknz->tmp.event->type = _eo_tokenizer_token_get(toknz, ( toknz->p)-1); - } - break; - case 23: -#line 863 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.event) ABORT(toknz, "No event!!!"); - if (toknz->tmp.event->comment != NULL) - ABORT(toknz, "event %s has already a comment", toknz->tmp.event->name); - toknz->tmp.event->comment = _eo_tokenizer_token_get(toknz, ( toknz->p)-2); - toknz->tmp.event = NULL; - } - break; - case 24: -#line 871 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.kls) ABORT(toknz, "No class!!!"); - if (toknz->tmp.kls->legacy_prefix != NULL) - ABORT(toknz, "A legacy prefix has already been given"); - toknz->tmp.kls->legacy_prefix = _eo_tokenizer_token_get(toknz, ( toknz->p)); - } - break; - case 25: -#line 880 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.kls) ABORT(toknz, "No class!!!"); - if (toknz->tmp.kls->eo_prefix != NULL) - ABORT(toknz, "An Eo prefix has already been given"); - toknz->tmp.kls->eo_prefix = _eo_tokenizer_token_get(toknz, ( toknz->p)); - } - break; - case 26: -#line 889 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.kls) ABORT(toknz, "No class!!!"); - if (toknz->tmp.kls->data_type != NULL) - ABORT(toknz, "A data type has already been given"); - toknz->tmp.kls->data_type = _eo_tokenizer_token_get(toknz, ( toknz->p)); - } - break; - case 27: -#line 902 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.kls) ABORT(toknz, "No class!!!"); - toknz->tmp.impl = _eo_tokenizer_implement_get(toknz, ( toknz->p)); - toknz->tmp.kls->implements = eina_list_append(toknz->tmp.kls->implements, toknz->tmp.impl); - } - break; - case 28: -#line 946 "src/lib/eolian/eo_lexer.rl" - { - toknz->tmp.kls_type = EOLIAN_CLASS_REGULAR; - } - break; - case 29: -#line 949 "src/lib/eolian/eo_lexer.rl" - { - toknz->tmp.kls_type = EOLIAN_CLASS_ABSTRACT; - } - break; - case 30: -#line 952 "src/lib/eolian/eo_lexer.rl" - { - toknz->tmp.kls_type = EOLIAN_CLASS_MIXIN; - } - break; - case 31: -#line 955 "src/lib/eolian/eo_lexer.rl" - { - toknz->tmp.kls_type = EOLIAN_CLASS_INTERFACE; - } - break; - case 32: -#line 959 "src/lib/eolian/eo_lexer.rl" - { - if (toknz->tmp.kls != NULL) - ABORT(toknz, "there is a pending class definition %s", toknz->tmp.kls->name); - toknz->tmp.kls = _eo_tokenizer_class_get(toknz, ( toknz->p)); - toknz->tmp.kls->type = toknz->tmp.kls_type; - } - break; - case 33: -#line 972 "src/lib/eolian/eo_lexer.rl" - { - toknz->tmp.typedef_alias = _eo_tokenizer_token_get(toknz, ( toknz->p)); - } - break; - case 34: -#line 976 "src/lib/eolian/eo_lexer.rl" - { - if (toknz->tmp.typedef_alias == NULL) - ABORT(toknz, "No typedef"); - toknz->tmp.type_def = _eo_tokenizer_type_get(toknz, ( toknz->p)); - toknz->tmp.type_def->alias = toknz->tmp.typedef_alias; - toknz->typedefs = eina_list_append(toknz->typedefs, toknz->tmp.type_def); - } - break; - case 37: -#line 1 "NONE" - { toknz->te = ( toknz->p)+1;} - break; - case 38: -#line 464 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - if (!toknz->tmp.accessor) ABORT(toknz, "No accessor!!!"); - if (toknz->tmp.accessor->comment != NULL) - ABORT(toknz, "accessor has already a comment"); - toknz->tmp.accessor->comment = _eo_tokenizer_token_get(toknz, ( toknz->p)-1); - INF(" %s", toknz->tmp.accessor->comment); - }} - break; - case 39: -#line 397 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("comment[%d] line%03d:%03d", toknz->cs, - toknz->saved.line, toknz->current_line); - }} - break; - case 40: -#line 527 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;} - break; - case 41: -#line 528 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;} - break; - case 42: -#line 493 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - INF(" }"); - if (!toknz->tmp.prop) ABORT(toknz, "No prop!!!"); - toknz->tmp.prop->accessors = eina_list_append(toknz->tmp.prop->accessors, toknz->tmp.accessor); - toknz->tmp.accessor = NULL; - toknz->current_nesting--; - { toknz->cs = 333; goto _again;} - }} - break; - case 43: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 44: -#line 523 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 45: -#line 526 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 46: -#line 493 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - INF(" }"); - if (!toknz->tmp.prop) ABORT(toknz, "No prop!!!"); - toknz->tmp.prop->accessors = eina_list_append(toknz->tmp.prop->accessors, toknz->tmp.accessor); - toknz->tmp.accessor = NULL; - toknz->current_nesting--; - { toknz->cs = 333; goto _again;} - }} - break; - case 47: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 48: -#line 526 "src/lib/eolian/eo_lexer.rl" - {{( toknz->p) = (( toknz->te))-1;}} - break; - case 49: -#line 406 "src/lib/eolian/eo_lexer.rl" - {{( toknz->p) = (( toknz->te))-1;}{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 50: -#line 397 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("comment[%d] line%03d:%03d", toknz->cs, - toknz->saved.line, toknz->current_line); - }} - break; - case 51: -#line 552 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - INF(" }"); - toknz->tmp.param = NULL; - toknz->current_nesting--; - if (toknz->tmp.prop) - { toknz->cs = 333; goto _again;} - else if (toknz->tmp.meth) - { toknz->cs = 347; goto _again;} - else - ABORT(toknz, "leaving tokenize_params but there is no property nor method pending"); - }} - break; - case 52: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 53: -#line 568 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 54: -#line 570 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 55: -#line 552 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - INF(" }"); - toknz->tmp.param = NULL; - toknz->current_nesting--; - if (toknz->tmp.prop) - { toknz->cs = 333; goto _again;} - else if (toknz->tmp.meth) - { toknz->cs = 347; goto _again;} - else - ABORT(toknz, "leaving tokenize_params but there is no property nor method pending"); - }} - break; - case 56: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 57: -#line 570 "src/lib/eolian/eo_lexer.rl" - {{( toknz->p) = (( toknz->te))-1;}} - break; - case 58: -#line 406 "src/lib/eolian/eo_lexer.rl" - {{( toknz->p) = (( toknz->te))-1;}{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 59: -#line 397 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("comment[%d] line%03d:%03d", toknz->cs, - toknz->saved.line, toknz->current_line); - }} - break; - case 60: -#line 577 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - INF(" get {"); - toknz->tmp.accessor = _eo_tokenizer_accessor_get(toknz, GETTER); - toknz->current_nesting++; - { toknz->cs = 317; goto _again;} - }} - break; - case 61: -#line 584 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - INF(" set {"); - toknz->tmp.accessor = _eo_tokenizer_accessor_get(toknz, SETTER); - toknz->current_nesting++; - { toknz->cs = 317; goto _again;} - }} - break; - case 62: -#line 591 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - INF(" keys {"); - toknz->current_nesting++; - toknz->tmp.params = &(toknz->tmp.prop->keys); - { toknz->cs = 326; goto _again;} - }} - break; - case 63: -#line 598 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - INF(" values {"); - toknz->current_nesting++; - toknz->tmp.params = &(toknz->tmp.prop->values); - { toknz->cs = 326; goto _again;} - }} - break; - case 64: -#line 605 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - if (!toknz->tmp.prop) ABORT(toknz, "No property!!!"); - if (eina_list_count(toknz->tmp.prop->accessors) == 0) - WRN("property '%s' has no accessors.", toknz->tmp.prop->name); - INF(" }"); - toknz->tmp.kls->properties = eina_list_append(toknz->tmp.kls->properties, toknz->tmp.prop); - toknz->tmp.prop = NULL; - toknz->tmp.fscope = FUNC_PUBLIC; - toknz->current_nesting--; - { toknz->cs = 341; goto _again;} - }} - break; - case 65: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 66: -#line 623 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 67: -#line 605 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - if (!toknz->tmp.prop) ABORT(toknz, "No property!!!"); - if (eina_list_count(toknz->tmp.prop->accessors) == 0) - WRN("property '%s' has no accessors.", toknz->tmp.prop->name); - INF(" }"); - toknz->tmp.kls->properties = eina_list_append(toknz->tmp.kls->properties, toknz->tmp.prop); - toknz->tmp.prop = NULL; - toknz->tmp.fscope = FUNC_PUBLIC; - toknz->current_nesting--; - { toknz->cs = 341; goto _again;} - }} - break; - case 68: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 69: -#line 406 "src/lib/eolian/eo_lexer.rl" - {{( toknz->p) = (( toknz->te))-1;}{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 70: -#line 397 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("comment[%d] line%03d:%03d", toknz->cs, - toknz->saved.line, toknz->current_line); - }} - break; - case 71: -#line 635 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - if (!toknz->tmp.prop) ABORT(toknz, "No property!!!"); - INF(" %s {", toknz->tmp.prop->name); - toknz->current_nesting++; - { toknz->cs = 333; goto _again;} - }} - break; - case 72: -#line 652 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - INF(" }"); - toknz->current_nesting--; - { toknz->cs = 363; goto _again;} - }} - break; - case 73: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 74: -#line 661 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 75: -#line 652 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - INF(" }"); - toknz->current_nesting--; - { toknz->cs = 363; goto _again;} - }} - break; - case 76: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 77: -#line 406 "src/lib/eolian/eo_lexer.rl" - {{( toknz->p) = (( toknz->te))-1;}{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 78: -#line 670 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - if (!toknz->tmp.meth) ABORT(toknz, "No method!!!"); - if (toknz->tmp.meth->comment != NULL) - ABORT(toknz, "method has already a comment"); - toknz->tmp.meth->comment = _eo_tokenizer_token_get(toknz, ( toknz->p)-1); - INF(" %s", toknz->tmp.meth->comment); - }} - break; - case 79: -#line 397 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("comment[%d] line%03d:%03d", toknz->cs, - toknz->saved.line, toknz->current_line); - }} - break; - case 80: -#line 678 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - if (!toknz->tmp.meth) ABORT(toknz, "No method!!!"); - INF(" params {"); - toknz->current_nesting++; - toknz->tmp.params = &(toknz->tmp.meth->params); - { toknz->cs = 326; goto _again;} - }} - break; - case 81: -#line 750 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;} - break; - case 82: -#line 751 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;} - break; - case 83: -#line 713 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - Eina_List **l = NULL; - if (!toknz->tmp.meth) ABORT(toknz, "No method!!!"); - INF(" }"); - switch (toknz->current_methods_type) { - case METH_CONSTRUCTOR: - l = &toknz->tmp.kls->constructors; - break; - case METH_REGULAR: - l = &toknz->tmp.kls->methods; - break; - default: - ABORT(toknz, "unknown method type %d", toknz->current_methods_type); - } - toknz->tmp.meth->type = toknz->current_methods_type; - *l = eina_list_append(*l, toknz->tmp.meth); - toknz->tmp.meth = NULL; - toknz->tmp.fscope = FUNC_PUBLIC; - toknz->current_nesting--; - { toknz->cs = 357; goto _again;} - }} - break; - case 84: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 85: -#line 745 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 86: -#line 749 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 87: -#line 713 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - Eina_List **l = NULL; - if (!toknz->tmp.meth) ABORT(toknz, "No method!!!"); - INF(" }"); - switch (toknz->current_methods_type) { - case METH_CONSTRUCTOR: - l = &toknz->tmp.kls->constructors; - break; - case METH_REGULAR: - l = &toknz->tmp.kls->methods; - break; - default: - ABORT(toknz, "unknown method type %d", toknz->current_methods_type); - } - toknz->tmp.meth->type = toknz->current_methods_type; - *l = eina_list_append(*l, toknz->tmp.meth); - toknz->tmp.meth = NULL; - toknz->tmp.fscope = FUNC_PUBLIC; - toknz->current_nesting--; - { toknz->cs = 357; goto _again;} - }} - break; - case 88: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 89: -#line 749 "src/lib/eolian/eo_lexer.rl" - {{( toknz->p) = (( toknz->te))-1;}} - break; - case 90: -#line 406 "src/lib/eolian/eo_lexer.rl" - {{( toknz->p) = (( toknz->te))-1;}{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 91: -#line 397 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("comment[%d] line%03d:%03d", toknz->cs, - toknz->saved.line, toknz->current_line); - }} - break; - case 92: -#line 758 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - if (!toknz->tmp.meth) ABORT(toknz, "No method!!!"); - INF(" %s {", toknz->tmp.meth->name); - toknz->current_nesting++; - { toknz->cs = 347; goto _again;} - }} - break; - case 93: -#line 775 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - INF(" }"); - toknz->current_methods_type = METH_TYPE_LAST; - toknz->current_nesting--; - { toknz->cs = 363; goto _again;} - }} - break; - case 94: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 95: -#line 785 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 96: -#line 775 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - INF(" }"); - toknz->current_methods_type = METH_TYPE_LAST; - toknz->current_nesting--; - { toknz->cs = 363; goto _again;} - }} - break; - case 97: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 98: -#line 406 "src/lib/eolian/eo_lexer.rl" - {{( toknz->p) = (( toknz->te))-1;}{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 99: -#line 794 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - if (!toknz->tmp.kls) ABORT(toknz, "No class!!!"); - if (toknz->tmp.kls->comment != NULL) - ABORT(toknz, "class %s has already a comment", toknz->tmp.kls->name); - toknz->tmp.kls->comment = _eo_tokenizer_token_get(toknz, ( toknz->p)-1); - }} - break; - case 100: -#line 397 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("comment[%d] line%03d:%03d", toknz->cs, - toknz->saved.line, toknz->current_line); - }} - break; - case 101: -#line 812 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - }} - break; - case 102: -#line 815 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - }} - break; - case 103: -#line 818 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - INF(" constructors {"); - toknz->current_methods_type = METH_CONSTRUCTOR; - toknz->tmp.fscope = FUNC_PUBLIC; - toknz->current_nesting++; - { toknz->cs = 357; goto _again;} - }} - break; - case 104: -#line 826 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - INF(" properties {"); - toknz->tmp.fscope = FUNC_PUBLIC; - toknz->current_nesting++; - { toknz->cs = 341; goto _again;} - }} - break; - case 105: -#line 833 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - INF(" begin methods"); - toknz->current_methods_type = METH_REGULAR; - toknz->tmp.fscope = FUNC_PUBLIC; - toknz->current_nesting++; - { toknz->cs = 357; goto _again;} - }} - break; - case 106: -#line 841 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - if (!toknz->tmp.kls) ABORT(toknz, "No class!!!"); - INF("end class: %s", toknz->tmp.kls->name); - toknz->classes = eina_list_append(toknz->classes, toknz->tmp.kls); - toknz->tmp.kls = NULL; - toknz->current_nesting--; - { toknz->cs = 309; goto _again;} - }} - break; - case 107: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 108: -#line 922 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 109: -#line 925 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 110: -#line 926 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 111: -#line 927 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 112: -#line 812 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - }} - break; - case 113: -#line 815 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - }} - break; - case 114: -#line 841 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - if (!toknz->tmp.kls) ABORT(toknz, "No class!!!"); - INF("end class: %s", toknz->tmp.kls->name); - toknz->classes = eina_list_append(toknz->classes, toknz->tmp.kls); - toknz->tmp.kls = NULL; - toknz->current_nesting--; - { toknz->cs = 309; goto _again;} - }} - break; - case 115: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 116: -#line 406 "src/lib/eolian/eo_lexer.rl" - {{( toknz->p) = (( toknz->te))-1;}{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 117: -#line 397 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("comment[%d] line%03d:%03d", toknz->cs, - toknz->saved.line, toknz->current_line); - }} - break; - case 118: -#line 939 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - if (!toknz->tmp.kls) ABORT(toknz, "No class!!!"); - INF("begin class: %s", toknz->tmp.kls->name); - toknz->current_nesting++; - { toknz->cs = 363; goto _again;} - }} - break; - case 119: -#line 992 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;} - break; - case 120: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 121: -#line 989 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 122: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 123: -#line 406 "src/lib/eolian/eo_lexer.rl" - {{( toknz->p) = (( toknz->te))-1;}{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; -#line 2795 "src/lib/eolian/eo_lexer.c" - } - } - -_again: - _acts = _eo_tokenizer_actions + _eo_tokenizer_to_state_actions[ toknz->cs]; - _nacts = (unsigned int) *_acts++; - while ( _nacts-- > 0 ) { - switch ( *_acts++ ) { - case 35: -#line 1 "NONE" - { toknz->ts = 0;} - break; -#line 2808 "src/lib/eolian/eo_lexer.c" - } - } - - if ( ++( toknz->p) != ( toknz->pe) ) - goto _resume; - _test_eof: {} - if ( ( toknz->p) == ( toknz->eof) ) - { - if ( _eo_tokenizer_eof_trans[ toknz->cs] > 0 ) { - _trans = _eo_tokenizer_eof_trans[ toknz->cs] - 1; - goto _eof_trans; - } - } - - _out: {} - } - -#line 1045 "src/lib/eolian/eo_lexer.rl" - - if ( toknz->cs == -#line 2829 "src/lib/eolian/eo_lexer.c" --1 -#line 1046 "src/lib/eolian/eo_lexer.rl" - ) + else if (strchr("\r\n", ls->current)) { - ERR("%s: wrong termination", source); - ret = EINA_FALSE; - break; + eina_strbuf_append_char(ls->buff, '\n'); + next_line(ls); } - - if ( toknz->ts == 0 ) - have = 0; else { - DBG("move data and pointers before buffer feed"); - have = toknz->pe - toknz->ts; - offset = toknz->ts - toknz->buf; - memmove(toknz->buf, toknz->ts, have); - toknz->te -= offset; - toknz->ts = toknz->buf; - } - - if (toknz->saved.tok != NULL) - { - if ((have == 0) || ((toknz->saved.tok - offset) < toknz->buf)) - { - WRN("reset lost saved token %p", toknz->saved.tok); - toknz->saved.tok = NULL; - } - else - toknz->saved.tok -= offset; + eina_strbuf_append_char(ls->buff, ls->current); + next_char(ls); } } - - fclose(stream); - - return ret; + if (value) *value = eina_strbuf_string_get(ls->buff); } -static Eina_Bool -eo_tokenizer_mem_walk(Eo_Lexer *toknz, const char *source, char *buffer, unsigned int len) +static int +lex(Eo_Lexer *ls, const char **value, int *kwid, const char *chars) { - INF("tokenize %s...", source); - toknz->source = eina_stringshare_add(source); - - Eina_Bool ret = EINA_TRUE; - - -#line 2877 "src/lib/eolian/eo_lexer.c" - { - toknz->cs = eo_tokenizer_start; - toknz->ts = 0; - toknz->te = 0; - toknz->act = 0; - } - -#line 1091 "src/lib/eolian/eo_lexer.rl" - - toknz->p = buffer; - - toknz->pe = toknz->p + len; - - toknz->eof = toknz->pe; - - -#line 2894 "src/lib/eolian/eo_lexer.c" - { - int _klen; - unsigned int _trans; - const char *_acts; - unsigned int _nacts; - const char *_keys; - - if ( ( toknz->p) == ( toknz->pe) ) - goto _test_eof; -_resume: - _acts = _eo_tokenizer_actions + _eo_tokenizer_from_state_actions[ toknz->cs]; - _nacts = (unsigned int) *_acts++; - while ( _nacts-- > 0 ) { - switch ( *_acts++ ) { - case 36: -#line 1 "NONE" - { toknz->ts = ( toknz->p);} - break; -#line 2913 "src/lib/eolian/eo_lexer.c" - } - } - - _keys = _eo_tokenizer_trans_keys + _eo_tokenizer_key_offsets[ toknz->cs]; - _trans = _eo_tokenizer_index_offsets[ toknz->cs]; - - _klen = _eo_tokenizer_single_lengths[ toknz->cs]; - if ( _klen > 0 ) { - const char *_lower = _keys; - const char *_mid; - const char *_upper = _keys + _klen - 1; - while (1) { - if ( _upper < _lower ) - break; - - _mid = _lower + ((_upper-_lower) >> 1); - if ( (*( toknz->p)) < *_mid ) - _upper = _mid - 1; - else if ( (*( toknz->p)) > *_mid ) - _lower = _mid + 1; - else { - _trans += (unsigned int)(_mid - _keys); - goto _match; - } - } - _keys += _klen; - _trans += _klen; - } - - _klen = _eo_tokenizer_range_lengths[ toknz->cs]; - if ( _klen > 0 ) { - const char *_lower = _keys; - const char *_mid; - const char *_upper = _keys + (_klen<<1) - 2; - while (1) { - if ( _upper < _lower ) - break; - - _mid = _lower + (((_upper-_lower) >> 1) & ~1); - if ( (*( toknz->p)) < _mid[0] ) - _upper = _mid - 2; - else if ( (*( toknz->p)) > _mid[1] ) - _lower = _mid + 2; - else { - _trans += (unsigned int)((_mid - _keys)>>1); - goto _match; - } - } - _trans += _klen; - } - -_match: - _trans = _eo_tokenizer_indicies[_trans]; -_eof_trans: - toknz->cs = _eo_tokenizer_trans_targs[_trans]; - - if ( _eo_tokenizer_trans_actions[_trans] == 0 ) - goto _again; - - _acts = _eo_tokenizer_actions + _eo_tokenizer_trans_actions[_trans]; - _nacts = (unsigned int) *_acts++; - while ( _nacts-- > 0 ) - { - switch ( *_acts++ ) - { - case 0: -#line 377 "src/lib/eolian/eo_lexer.rl" - { - toknz->current_line += 1; - DBG("inc[%d] %d", toknz->cs, toknz->current_line); - } - break; - case 1: -#line 382 "src/lib/eolian/eo_lexer.rl" - { - toknz->saved.line = toknz->current_line; - DBG("save line[%d] %d", toknz->cs, toknz->current_line); - } - break; - case 2: -#line 387 "src/lib/eolian/eo_lexer.rl" - { - toknz->saved.tok = ( toknz->p); - DBG("save token[%d] %p %c", toknz->cs, ( toknz->p), *( toknz->p)); - } - break; - case 3: -#line 392 "src/lib/eolian/eo_lexer.rl" - { - DBG("move ts %d chars forward", (int)(( toknz->p) - toknz->ts)); - toknz->ts = ( toknz->p); - } - break; - case 4: -#line 472 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.accessor) ABORT(toknz, "No accessor!!!"); - if (toknz->tmp.accessor->ret != NULL) - ABORT(toknz, "accessor has already a return type"); - toknz->tmp.accessor->ret = _eo_tokenizer_return_get(toknz, ( toknz->p)); - } - break; - case 5: -#line 479 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.accessor) ABORT(toknz, "No accessor!!!"); - if (!toknz->tmp.accessor->ret) ABORT(toknz, "No ret!!!"); - if (toknz->tmp.accessor->ret->comment != NULL) - ABORT(toknz, "accessor return type has already a comment"); - toknz->tmp.accessor->ret->comment = _eo_tokenizer_token_get(toknz, ( toknz->p)-2); - INF(" %s", toknz->tmp.accessor->ret->comment); - } - break; - case 6: -#line 488 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.accessor) ABORT(toknz, "No accessor!!!"); - toknz->tmp.accessor->legacy = _eo_tokenizer_token_get(toknz, ( toknz->p)); - } - break; - case 7: -#line 502 "src/lib/eolian/eo_lexer.rl" - { - toknz->tmp.accessor_param = _eo_tokenizer_accessor_param_get(toknz, ( toknz->p)); - } - break; - case 8: -#line 506 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.accessor_param) - ABORT(toknz, "No accessor param!!!"); - toknz->tmp.accessor_param->attrs = _eo_tokenizer_token_get(toknz, ( toknz->p)); - toknz->tmp.accessor->params = - eina_list_append(toknz->tmp.accessor->params, toknz->tmp.accessor_param); - toknz->tmp.accessor_param = NULL; - } - break; - case 9: -#line 535 "src/lib/eolian/eo_lexer.rl" - { - const char *c = _eo_tokenizer_token_get(toknz, ( toknz->p)-2); - if (toknz->tmp.param == NULL) - ABORT(toknz, "no parameter set to associate this comment to: %s", c); - toknz->tmp.param->comment = c; - toknz->tmp.param = NULL; - } - break; - case 10: -#line 543 "src/lib/eolian/eo_lexer.rl" - { - toknz->tmp.param = _eo_tokenizer_param_get(toknz, ( toknz->p)); - if (toknz->tmp.params) - *(toknz->tmp.params) = eina_list_append(*(toknz->tmp.params), toknz->tmp.param); - else - ABORT(toknz, "got a param but there is no property nor method waiting for it"); - INF(" %s : %s", toknz->tmp.param->name, toknz->tmp.param->type); - } - break; - case 11: -#line 642 "src/lib/eolian/eo_lexer.rl" - { - if (toknz->tmp.prop != NULL) - ABORT(toknz, "there is a pending property definition %s", toknz->tmp.prop->name); - toknz->tmp.prop = _eo_tokenizer_property_get(toknz, ( toknz->p)); - } - break; - case 12: -#line 648 "src/lib/eolian/eo_lexer.rl" - { - toknz->tmp.fscope = _eo_tokenizer_scope_get(toknz, ( toknz->p)); - } - break; - case 13: -#line 686 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.meth) ABORT(toknz, "No method!!!"); - if (toknz->tmp.meth->ret != NULL) - ABORT(toknz, "method '%s' has already a return type", toknz->tmp.meth->name); - toknz->tmp.meth->ret = _eo_tokenizer_return_get(toknz, ( toknz->p)); - } - break; - case 14: -#line 693 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.meth) ABORT(toknz, "No method!!!"); - if (toknz->tmp.meth->ret == NULL) ABORT(toknz, "No ret!!!"); - if (toknz->tmp.meth->ret->comment != NULL) - ABORT(toknz, "method '%s' return type has already a comment", toknz->tmp.meth->name); - toknz->tmp.meth->ret->comment = _eo_tokenizer_token_get(toknz, ( toknz->p)-2); - INF(" %s", toknz->tmp.meth->ret->comment); - } - break; - case 15: -#line 702 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.meth) ABORT(toknz, "No method!!!"); - toknz->tmp.meth->legacy = _eo_tokenizer_token_get(toknz, ( toknz->p)); - } - break; - case 16: -#line 707 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.meth) ABORT(toknz, "No method!!!"); - toknz->tmp.meth->obj_const = EINA_TRUE; - INF(" obj const"); - } - break; - case 17: -#line 765 "src/lib/eolian/eo_lexer.rl" - { - if (toknz->tmp.meth != NULL) - ABORT(toknz, "there is a pending method definition %s", toknz->tmp.meth->name); - toknz->tmp.meth = _eo_tokenizer_method_get(toknz, ( toknz->p)); - } - break; - case 18: -#line 771 "src/lib/eolian/eo_lexer.rl" - { - toknz->tmp.fscope = _eo_tokenizer_scope_get(toknz, ( toknz->p)); - } - break; - case 19: -#line 801 "src/lib/eolian/eo_lexer.rl" - { - const char *base = _eo_tokenizer_token_get(toknz, ( toknz->p)); - toknz->tmp.str_items = eina_list_append(toknz->tmp.str_items, base); - } - break; - case 20: -#line 806 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.kls) ABORT(toknz, "No class!!!"); - toknz->tmp.kls->inherits = toknz->tmp.str_items; - toknz->tmp.str_items = NULL; - } - break; - case 21: -#line 850 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.kls) ABORT(toknz, "No class!!!"); - toknz->tmp.event = _eo_tokenizer_event_get(toknz, ( toknz->p)); - toknz->tmp.kls->events = eina_list_append(toknz->tmp.kls->events, toknz->tmp.event); - } - break; - case 22: -#line 856 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.event) ABORT(toknz, "No event!!!"); - if (toknz->tmp.event->type != NULL) - ABORT(toknz, "event %s has already a type %s", toknz->tmp.event->name, toknz->tmp.event->type); - toknz->tmp.event->type = _eo_tokenizer_token_get(toknz, ( toknz->p)-1); - } - break; - case 23: -#line 863 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.event) ABORT(toknz, "No event!!!"); - if (toknz->tmp.event->comment != NULL) - ABORT(toknz, "event %s has already a comment", toknz->tmp.event->name); - toknz->tmp.event->comment = _eo_tokenizer_token_get(toknz, ( toknz->p)-2); - toknz->tmp.event = NULL; - } - break; - case 24: -#line 871 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.kls) ABORT(toknz, "No class!!!"); - if (toknz->tmp.kls->legacy_prefix != NULL) - ABORT(toknz, "A legacy prefix has already been given"); - toknz->tmp.kls->legacy_prefix = _eo_tokenizer_token_get(toknz, ( toknz->p)); - } - break; - case 25: -#line 880 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.kls) ABORT(toknz, "No class!!!"); - if (toknz->tmp.kls->eo_prefix != NULL) - ABORT(toknz, "An Eo prefix has already been given"); - toknz->tmp.kls->eo_prefix = _eo_tokenizer_token_get(toknz, ( toknz->p)); - } - break; - case 26: -#line 889 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.kls) ABORT(toknz, "No class!!!"); - if (toknz->tmp.kls->data_type != NULL) - ABORT(toknz, "A data type has already been given"); - toknz->tmp.kls->data_type = _eo_tokenizer_token_get(toknz, ( toknz->p)); - } - break; - case 27: -#line 902 "src/lib/eolian/eo_lexer.rl" - { - if (!toknz->tmp.kls) ABORT(toknz, "No class!!!"); - toknz->tmp.impl = _eo_tokenizer_implement_get(toknz, ( toknz->p)); - toknz->tmp.kls->implements = eina_list_append(toknz->tmp.kls->implements, toknz->tmp.impl); - } - break; - case 28: -#line 946 "src/lib/eolian/eo_lexer.rl" - { - toknz->tmp.kls_type = EOLIAN_CLASS_REGULAR; - } - break; - case 29: -#line 949 "src/lib/eolian/eo_lexer.rl" - { - toknz->tmp.kls_type = EOLIAN_CLASS_ABSTRACT; - } - break; - case 30: -#line 952 "src/lib/eolian/eo_lexer.rl" - { - toknz->tmp.kls_type = EOLIAN_CLASS_MIXIN; - } - break; - case 31: -#line 955 "src/lib/eolian/eo_lexer.rl" - { - toknz->tmp.kls_type = EOLIAN_CLASS_INTERFACE; - } - break; - case 32: -#line 959 "src/lib/eolian/eo_lexer.rl" - { - if (toknz->tmp.kls != NULL) - ABORT(toknz, "there is a pending class definition %s", toknz->tmp.kls->name); - toknz->tmp.kls = _eo_tokenizer_class_get(toknz, ( toknz->p)); - toknz->tmp.kls->type = toknz->tmp.kls_type; - } - break; - case 33: -#line 972 "src/lib/eolian/eo_lexer.rl" - { - toknz->tmp.typedef_alias = _eo_tokenizer_token_get(toknz, ( toknz->p)); - } - break; - case 34: -#line 976 "src/lib/eolian/eo_lexer.rl" - { - if (toknz->tmp.typedef_alias == NULL) - ABORT(toknz, "No typedef"); - toknz->tmp.type_def = _eo_tokenizer_type_get(toknz, ( toknz->p)); - toknz->tmp.type_def->alias = toknz->tmp.typedef_alias; - toknz->typedefs = eina_list_append(toknz->typedefs, toknz->tmp.type_def); - } - break; - case 37: -#line 1 "NONE" - { toknz->te = ( toknz->p)+1;} - break; - case 38: -#line 464 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - if (!toknz->tmp.accessor) ABORT(toknz, "No accessor!!!"); - if (toknz->tmp.accessor->comment != NULL) - ABORT(toknz, "accessor has already a comment"); - toknz->tmp.accessor->comment = _eo_tokenizer_token_get(toknz, ( toknz->p)-1); - INF(" %s", toknz->tmp.accessor->comment); - }} - break; - case 39: -#line 397 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("comment[%d] line%03d:%03d", toknz->cs, - toknz->saved.line, toknz->current_line); - }} - break; - case 40: -#line 527 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;} - break; - case 41: -#line 528 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;} - break; - case 42: -#line 493 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - INF(" }"); - if (!toknz->tmp.prop) ABORT(toknz, "No prop!!!"); - toknz->tmp.prop->accessors = eina_list_append(toknz->tmp.prop->accessors, toknz->tmp.accessor); - toknz->tmp.accessor = NULL; - toknz->current_nesting--; - { toknz->cs = 333; goto _again;} - }} - break; - case 43: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 44: -#line 523 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 45: -#line 526 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 46: -#line 493 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - INF(" }"); - if (!toknz->tmp.prop) ABORT(toknz, "No prop!!!"); - toknz->tmp.prop->accessors = eina_list_append(toknz->tmp.prop->accessors, toknz->tmp.accessor); - toknz->tmp.accessor = NULL; - toknz->current_nesting--; - { toknz->cs = 333; goto _again;} - }} - break; - case 47: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 48: -#line 526 "src/lib/eolian/eo_lexer.rl" - {{( toknz->p) = (( toknz->te))-1;}} - break; - case 49: -#line 406 "src/lib/eolian/eo_lexer.rl" - {{( toknz->p) = (( toknz->te))-1;}{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 50: -#line 397 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("comment[%d] line%03d:%03d", toknz->cs, - toknz->saved.line, toknz->current_line); - }} - break; - case 51: -#line 552 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - INF(" }"); - toknz->tmp.param = NULL; - toknz->current_nesting--; - if (toknz->tmp.prop) - { toknz->cs = 333; goto _again;} - else if (toknz->tmp.meth) - { toknz->cs = 347; goto _again;} - else - ABORT(toknz, "leaving tokenize_params but there is no property nor method pending"); - }} - break; - case 52: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 53: -#line 568 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 54: -#line 570 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 55: -#line 552 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - INF(" }"); - toknz->tmp.param = NULL; - toknz->current_nesting--; - if (toknz->tmp.prop) - { toknz->cs = 333; goto _again;} - else if (toknz->tmp.meth) - { toknz->cs = 347; goto _again;} - else - ABORT(toknz, "leaving tokenize_params but there is no property nor method pending"); - }} - break; - case 56: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 57: -#line 570 "src/lib/eolian/eo_lexer.rl" - {{( toknz->p) = (( toknz->te))-1;}} - break; - case 58: -#line 406 "src/lib/eolian/eo_lexer.rl" - {{( toknz->p) = (( toknz->te))-1;}{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 59: -#line 397 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("comment[%d] line%03d:%03d", toknz->cs, - toknz->saved.line, toknz->current_line); - }} - break; - case 60: -#line 577 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - INF(" get {"); - toknz->tmp.accessor = _eo_tokenizer_accessor_get(toknz, GETTER); - toknz->current_nesting++; - { toknz->cs = 317; goto _again;} - }} - break; - case 61: -#line 584 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - INF(" set {"); - toknz->tmp.accessor = _eo_tokenizer_accessor_get(toknz, SETTER); - toknz->current_nesting++; - { toknz->cs = 317; goto _again;} - }} - break; - case 62: -#line 591 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - INF(" keys {"); - toknz->current_nesting++; - toknz->tmp.params = &(toknz->tmp.prop->keys); - { toknz->cs = 326; goto _again;} - }} - break; - case 63: -#line 598 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - INF(" values {"); - toknz->current_nesting++; - toknz->tmp.params = &(toknz->tmp.prop->values); - { toknz->cs = 326; goto _again;} - }} - break; - case 64: -#line 605 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - if (!toknz->tmp.prop) ABORT(toknz, "No property!!!"); - if (eina_list_count(toknz->tmp.prop->accessors) == 0) - WRN("property '%s' has no accessors.", toknz->tmp.prop->name); - INF(" }"); - toknz->tmp.kls->properties = eina_list_append(toknz->tmp.kls->properties, toknz->tmp.prop); - toknz->tmp.prop = NULL; - toknz->tmp.fscope = FUNC_PUBLIC; - toknz->current_nesting--; - { toknz->cs = 341; goto _again;} - }} - break; - case 65: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 66: -#line 623 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 67: -#line 605 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - if (!toknz->tmp.prop) ABORT(toknz, "No property!!!"); - if (eina_list_count(toknz->tmp.prop->accessors) == 0) - WRN("property '%s' has no accessors.", toknz->tmp.prop->name); - INF(" }"); - toknz->tmp.kls->properties = eina_list_append(toknz->tmp.kls->properties, toknz->tmp.prop); - toknz->tmp.prop = NULL; - toknz->tmp.fscope = FUNC_PUBLIC; - toknz->current_nesting--; - { toknz->cs = 341; goto _again;} - }} - break; - case 68: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 69: -#line 406 "src/lib/eolian/eo_lexer.rl" - {{( toknz->p) = (( toknz->te))-1;}{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 70: -#line 397 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("comment[%d] line%03d:%03d", toknz->cs, - toknz->saved.line, toknz->current_line); - }} - break; - case 71: -#line 635 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - if (!toknz->tmp.prop) ABORT(toknz, "No property!!!"); - INF(" %s {", toknz->tmp.prop->name); - toknz->current_nesting++; - { toknz->cs = 333; goto _again;} - }} - break; - case 72: -#line 652 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - INF(" }"); - toknz->current_nesting--; - { toknz->cs = 363; goto _again;} - }} - break; - case 73: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 74: -#line 661 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 75: -#line 652 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - INF(" }"); - toknz->current_nesting--; - { toknz->cs = 363; goto _again;} - }} - break; - case 76: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 77: -#line 406 "src/lib/eolian/eo_lexer.rl" - {{( toknz->p) = (( toknz->te))-1;}{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 78: -#line 670 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - if (!toknz->tmp.meth) ABORT(toknz, "No method!!!"); - if (toknz->tmp.meth->comment != NULL) - ABORT(toknz, "method has already a comment"); - toknz->tmp.meth->comment = _eo_tokenizer_token_get(toknz, ( toknz->p)-1); - INF(" %s", toknz->tmp.meth->comment); - }} - break; - case 79: -#line 397 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("comment[%d] line%03d:%03d", toknz->cs, - toknz->saved.line, toknz->current_line); - }} - break; - case 80: -#line 678 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - if (!toknz->tmp.meth) ABORT(toknz, "No method!!!"); - INF(" params {"); - toknz->current_nesting++; - toknz->tmp.params = &(toknz->tmp.meth->params); - { toknz->cs = 326; goto _again;} - }} - break; - case 81: -#line 750 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;} - break; - case 82: -#line 751 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;} - break; - case 83: -#line 713 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - Eina_List **l = NULL; - if (!toknz->tmp.meth) ABORT(toknz, "No method!!!"); - INF(" }"); - switch (toknz->current_methods_type) { - case METH_CONSTRUCTOR: - l = &toknz->tmp.kls->constructors; - break; - case METH_REGULAR: - l = &toknz->tmp.kls->methods; - break; - default: - ABORT(toknz, "unknown method type %d", toknz->current_methods_type); - } - toknz->tmp.meth->type = toknz->current_methods_type; - *l = eina_list_append(*l, toknz->tmp.meth); - toknz->tmp.meth = NULL; - toknz->tmp.fscope = FUNC_PUBLIC; - toknz->current_nesting--; - { toknz->cs = 357; goto _again;} - }} - break; - case 84: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 85: -#line 745 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 86: -#line 749 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 87: -#line 713 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - Eina_List **l = NULL; - if (!toknz->tmp.meth) ABORT(toknz, "No method!!!"); - INF(" }"); - switch (toknz->current_methods_type) { - case METH_CONSTRUCTOR: - l = &toknz->tmp.kls->constructors; - break; - case METH_REGULAR: - l = &toknz->tmp.kls->methods; - break; - default: - ABORT(toknz, "unknown method type %d", toknz->current_methods_type); - } - toknz->tmp.meth->type = toknz->current_methods_type; - *l = eina_list_append(*l, toknz->tmp.meth); - toknz->tmp.meth = NULL; - toknz->tmp.fscope = FUNC_PUBLIC; - toknz->current_nesting--; - { toknz->cs = 357; goto _again;} - }} - break; - case 88: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 89: -#line 749 "src/lib/eolian/eo_lexer.rl" - {{( toknz->p) = (( toknz->te))-1;}} - break; - case 90: -#line 406 "src/lib/eolian/eo_lexer.rl" - {{( toknz->p) = (( toknz->te))-1;}{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 91: -#line 397 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("comment[%d] line%03d:%03d", toknz->cs, - toknz->saved.line, toknz->current_line); - }} - break; - case 92: -#line 758 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - if (!toknz->tmp.meth) ABORT(toknz, "No method!!!"); - INF(" %s {", toknz->tmp.meth->name); - toknz->current_nesting++; - { toknz->cs = 347; goto _again;} - }} - break; - case 93: -#line 775 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - INF(" }"); - toknz->current_methods_type = METH_TYPE_LAST; - toknz->current_nesting--; - { toknz->cs = 363; goto _again;} - }} - break; - case 94: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 95: -#line 785 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 96: -#line 775 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - INF(" }"); - toknz->current_methods_type = METH_TYPE_LAST; - toknz->current_nesting--; - { toknz->cs = 363; goto _again;} - }} - break; - case 97: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 98: -#line 406 "src/lib/eolian/eo_lexer.rl" - {{( toknz->p) = (( toknz->te))-1;}{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 99: -#line 794 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - if (!toknz->tmp.kls) ABORT(toknz, "No class!!!"); - if (toknz->tmp.kls->comment != NULL) - ABORT(toknz, "class %s has already a comment", toknz->tmp.kls->name); - toknz->tmp.kls->comment = _eo_tokenizer_token_get(toknz, ( toknz->p)-1); - }} - break; - case 100: -#line 397 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("comment[%d] line%03d:%03d", toknz->cs, - toknz->saved.line, toknz->current_line); - }} - break; - case 101: -#line 812 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - }} - break; - case 102: -#line 815 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - }} - break; - case 103: -#line 818 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - INF(" constructors {"); - toknz->current_methods_type = METH_CONSTRUCTOR; - toknz->tmp.fscope = FUNC_PUBLIC; - toknz->current_nesting++; - { toknz->cs = 357; goto _again;} - }} - break; - case 104: -#line 826 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - INF(" properties {"); - toknz->tmp.fscope = FUNC_PUBLIC; - toknz->current_nesting++; - { toknz->cs = 341; goto _again;} - }} - break; - case 105: -#line 833 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - INF(" begin methods"); - toknz->current_methods_type = METH_REGULAR; - toknz->tmp.fscope = FUNC_PUBLIC; - toknz->current_nesting++; - { toknz->cs = 357; goto _again;} - }} - break; - case 106: -#line 841 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - if (!toknz->tmp.kls) ABORT(toknz, "No class!!!"); - INF("end class: %s", toknz->tmp.kls->name); - toknz->classes = eina_list_append(toknz->classes, toknz->tmp.kls); - toknz->tmp.kls = NULL; - toknz->current_nesting--; - { toknz->cs = 309; goto _again;} - }} - break; - case 107: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 108: -#line 922 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 109: -#line 925 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 110: -#line 926 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 111: -#line 927 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 112: -#line 812 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - }} - break; - case 113: -#line 815 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - }} - break; - case 114: -#line 841 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - if (!toknz->tmp.kls) ABORT(toknz, "No class!!!"); - INF("end class: %s", toknz->tmp.kls->name); - toknz->classes = eina_list_append(toknz->classes, toknz->tmp.kls); - toknz->tmp.kls = NULL; - toknz->current_nesting--; - { toknz->cs = 309; goto _again;} - }} - break; - case 115: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 116: -#line 406 "src/lib/eolian/eo_lexer.rl" - {{( toknz->p) = (( toknz->te))-1;}{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 117: -#line 397 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("comment[%d] line%03d:%03d", toknz->cs, - toknz->saved.line, toknz->current_line); - }} - break; - case 118: -#line 939 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - if (!toknz->tmp.kls) ABORT(toknz, "No class!!!"); - INF("begin class: %s", toknz->tmp.kls->name); - toknz->current_nesting++; - { toknz->cs = 363; goto _again;} - }} - break; - case 119: -#line 992 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;} - break; - case 120: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p)+1;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 121: -#line 989 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;} - break; - case 122: -#line 406 "src/lib/eolian/eo_lexer.rl" - { toknz->te = ( toknz->p);( toknz->p)--;{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; - case 123: -#line 406 "src/lib/eolian/eo_lexer.rl" - {{( toknz->p) = (( toknz->te))-1;}{ - DBG("error[%d]", toknz->cs); - char *s, *d; - char buf[BUFSIZE]; - for (s = ( toknz->p), d = buf; (s <= toknz->pe); s++) - { - if ((*s == '\r') || (*s == '\n')) - break; - *d++ = *s; - } - *d = '\0'; - ERR("error n:%d l:%d c:'%c': %s", - toknz->current_nesting, toknz->current_line, *( toknz->p), buf); - toknz->cs = eo_tokenizer_error; - {( toknz->p)++; goto _out; } /* necessary to stop scanners */ - }} - break; -#line 4198 "src/lib/eolian/eo_lexer.c" - } - } - -_again: - _acts = _eo_tokenizer_actions + _eo_tokenizer_to_state_actions[ toknz->cs]; - _nacts = (unsigned int) *_acts++; - while ( _nacts-- > 0 ) { - switch ( *_acts++ ) { - case 35: -#line 1 "NONE" - { toknz->ts = 0;} - break; -#line 4211 "src/lib/eolian/eo_lexer.c" - } - } - - if ( ++( toknz->p) != ( toknz->pe) ) - goto _resume; - _test_eof: {} - if ( ( toknz->p) == ( toknz->eof) ) - { - if ( _eo_tokenizer_eof_trans[ toknz->cs] > 0 ) { - _trans = _eo_tokenizer_eof_trans[ toknz->cs] - 1; - goto _eof_trans; - } - } - - _out: {} - } - -#line 1099 "src/lib/eolian/eo_lexer.rl" - - if ( toknz->cs == -#line 4232 "src/lib/eolian/eo_lexer.c" --1 -#line 1100 "src/lib/eolian/eo_lexer.rl" - ) + eina_strbuf_reset(ls->buff); + for (;;) { - ERR("%s: wrong termination", source); - ret = EINA_FALSE; + switch (ls->current) + { + case '\n': + case '\r': + next_line(ls); + continue; + case ':': + { + next_char(ls); + if (ls->current != ':') return ':'; + next_char(ls); + return TOK_DBCOLON; + } + 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 && !strchr("\r\n", ls->current)) + next_char(ls); + continue; + } + case '\0': + return TOK_EOF; + default: + { + if (isspace(ls->current)) + { + assert(!strchr("\r\n", ls->current)); + next_char(ls); + continue; + } + if (isalnum(ls->current) || strchr(chars, ls->current)) + { + const char *str; + eina_strbuf_reset(ls->buff); + do + { + eina_strbuf_append_char(ls->buff, ls->current); + next_char(ls); + } while (isalnum( ls->current) + || strchr(chars, ls->current)); + str = eina_strbuf_string_get(ls->buff); + *kwid = (long)eina_hash_find(keyword_map, str); + *value = str; + return TOK_VALUE; + } + else + { + int c = ls->current; + next_char(ls); + return c; + } + } + } } - - return ret; } -Eo_Lexer* -eo_tokenizer_get(void) +static void +eo_lexer_set_input(Eo_Lexer *ls, const char *source) { - Eo_Lexer *toknz = calloc(1, sizeof(Eo_Lexer)); - if (!toknz) return NULL; - - toknz->ts = NULL; - toknz->te = NULL; - /* toknz->top = 0; */ - toknz->source = NULL; - toknz->max_nesting = 10; - toknz->current_line = 1; - toknz->current_nesting = 0; - toknz->current_methods_type = METH_TYPE_LAST; - toknz->saved.tok = NULL; - toknz->saved.line = 0; - toknz->classes = NULL; - toknz->typedefs = NULL; - - return toknz; + Eina_File *f = eina_file_open(source, EINA_FALSE); + if (!f) + throw(ls, "%s\n", strerror(errno)); + ls->lookahead.token = TOK_EOF; + ls->buff = eina_strbuf_new(); + ls->handle = f; + ls->stream = eina_file_map_all(f, EINA_FILE_RANDOM); + ls->source = eina_stringshare_add(source); + ls->line_number = 1; + next_char(ls); } -static char *_accessor_type_str[ACCESSOR_TYPE_LAST] = { "setter", "getter" }; -static char *_param_way_str[PARAM_WAY_LAST] = { "IN", "OUT", "INOUT" }; - void -eo_tokenizer_dump(Eo_Lexer *toknz) +eo_lexer_free(Eo_Lexer *ls) { - const char *s; - Eina_List *k, *l, *m; - Eo_Class_Def *kls; - Eo_Property_Def *prop; - Eo_Method_Def *meth; - Eo_Param_Def *param; - Eo_Accessor_Def *accessor; - Eo_Event_Def *sgn; - /* Eo_Ret_Def *ret; */ + Eo_Type_Def *type; - EINA_LIST_FOREACH(toknz->classes, k, kls) - { - printf("Class: %s (%s)\n", - kls->name, (kls->comment ? kls->comment : "-")); - printf(" inherits from :"); - EINA_LIST_FOREACH(kls->inherits, l, s) - printf(" %s", s); - printf("\n"); - printf(" implements:"); - EINA_LIST_FOREACH(kls->implements, l, s) - printf(" %s", s); - printf("\n"); - printf(" events:\n"); - EINA_LIST_FOREACH(kls->events, l, sgn) - printf(" %s <%s> (%s)\n", sgn->name, sgn->type, sgn->comment); + if (!ls) return; + if (ls->source) eina_stringshare_del(ls->source); + if (ls->buff ) eina_strbuf_free (ls->buff); + if (ls->handle) eina_file_close (ls->handle); - EINA_LIST_FOREACH(kls->constructors, l, meth) - { - printf(" constructors: %s\n", meth->name); - if (meth->ret) - printf(" return: %s (%s)\n", meth->ret->type, meth->ret->comment); - printf(" legacy : %s\n", meth->legacy); - EINA_LIST_FOREACH(meth->params, m, param) - { - printf(" param: %s %s : %s (%s)\n", - _param_way_str[param->way], param->name, - param->type, param->comment); - } - } - - EINA_LIST_FOREACH(kls->properties, l, prop) - { - printf(" property: %s\n", prop->name); - EINA_LIST_FOREACH(prop->keys, m, param) - { - printf(" key: %s : %s (%s)\n", - param->name, param->type, param->comment); - } - EINA_LIST_FOREACH(prop->values, m, param) - { - printf(" value: %s : %s (%s)\n", - param->name, param->type, param->comment); - } - EINA_LIST_FOREACH(prop->accessors, m, accessor) - { - printf(" accessor: %s : %s (%s)\n", - (accessor->ret?accessor->ret->type:""), - _accessor_type_str[accessor->type], - accessor->comment); - printf(" legacy : %s\n", accessor->legacy); - } - } + EINA_LIST_FREE(ls->classes, kls) + eo_definitions_class_def_free(kls); - EINA_LIST_FOREACH(kls->methods, l, meth) - { - printf(" method: %s\n", meth->name); - if (meth->ret) - printf(" return: %s (%s)\n", meth->ret->type, meth->ret->comment); - printf(" legacy : %s\n", meth->legacy); - printf(" obj_const : %s\n", meth->obj_const?"true":"false"); - EINA_LIST_FOREACH(meth->params, m, param) - { - printf(" param: %s %s : %s (%s)\n", - _param_way_str[param->way], param->name, - param->type, param->comment); - } - } + EINA_LIST_FREE(ls->typedefs, type) + eo_definitions_type_def_free(type); - } + eo_definitions_temps_free(&ls->tmp); + free(ls); } -static Eina_Inlist * -_types_extract(const char *buf, int len) +Eo_Lexer * +eo_lexer_new(const char *source) { - const char *save_buf = buf; - Eolian_Type types = NULL; - long depth = 0; - char *tmp_type = malloc(2 * len + 1); - - while (len > 0) + Eo_Lexer *ls = calloc(1, sizeof(Eo_Lexer)); + if (!setjmp(ls->err_jmp)) { - char *d = tmp_type; - Eina_Bool end_type = EINA_FALSE; - Eina_Bool is_own = EINA_FALSE; - char c; - Eina_Bool in_spaces = EINA_TRUE, in_stars = EINA_FALSE; - while (len > 0 && !end_type) - { - switch (c = *buf++) - { - /* @own */ - case '@': - { - if (!strncmp(buf, "own ", 4)) - { - is_own = EINA_TRUE; - buf += 4; len -= 4; - } - break; - } - /* if '*', we have to add a space. We set in_spaces to true in - * case spaces are between stars, to be sure we remove them. - */ - case '*': - { - if (!in_stars && !in_spaces) - { - *d++ = ' '; - in_stars = EINA_TRUE; - in_spaces = EINA_TRUE; - } - *d++ = c; - break; - } - /* Only the first space is inserted. */ - case ' ': - { - if (!in_spaces) *d++ = c; - in_spaces = EINA_TRUE; - break; - } - case '<': - { - if (depth < 0) - { - ERR("%s: Cannot reopen < after >", save_buf); - goto error; - } - depth++; - end_type = EINA_TRUE; - break; - } - case '>': - { - if (depth == 0) - { - ERR("%s: Too much >", save_buf); - goto error; - } - if (depth > 0 && d == tmp_type) - { - ERR("%s: empty type inside <>", save_buf); - goto error; - } - if (depth > 0) depth *= -1; - depth++; - end_type = EINA_TRUE; - break; - } - default: - { - *d++ = c; - in_spaces = EINA_FALSE; - in_stars = EINA_FALSE; - } - } - len--; - } - if (d != tmp_type) - { - *d = '\0'; - types = database_type_append(types, tmp_type, is_own); - } + eo_lexer_set_input(ls, source); + return ls; } - if (depth) - { - ERR("%s: < and > are not well used.", save_buf); - goto error; - } - goto success; -error: - database_type_del(types); - types = NULL; -success: - free(tmp_type); - return types; + eo_lexer_free(ls); + return NULL; } -Eina_Bool -eo_tokenizer_database_fill(const char *filename) +int +eo_lexer_get(Eo_Lexer *ls) { - Eina_Bool ret = EINA_FALSE; - const char *s; - Eina_List *k, *l, *m; + return eo_lexer_get_ident(ls, "@_.+-/\\='\"?!%"); +} - Eo_Class_Def *kls; - Eo_Type_Def *type_def; - Eo_Property_Def *prop; - Eo_Method_Def *meth; - Eo_Param_Def *param; - Eo_Accessor_Def *accessor; - Eo_Event_Def *event; - Eo_Implement_Def *impl; +int +eo_lexer_lookahead(Eo_Lexer *ls) +{ + return eo_lexer_lookahead_ident(ls, "@_.+-/\\='\"?!%"); +} - FILE *stream = NULL; - char *buffer = NULL; +int +eo_lexer_lookahead_ident(Eo_Lexer *ls, const char *chars) +{ + assert (ls->lookahead.token == TOK_EOF); + ls->lookahead.kw = 0; + return (ls->lookahead.token = lex(ls, &ls->lookahead.value, + &ls->lookahead.kw, chars)); +} - Eo_Lexer *toknz = eo_tokenizer_get(); - if (!toknz) +int +eo_lexer_get_ident(Eo_Lexer *ls, const char *chars) +{ + if (ls->lookahead.token != TOK_EOF) { - ERR("can't create eo_tokenizer"); - goto end; + ls->t = ls->lookahead; + ls->lookahead.token = TOK_EOF; + return ls->t.token; } + ls->t.kw = 0; + return (ls->t.token = lex(ls, &ls->t.value, &ls->t.kw, chars)); +} - stream = fopen(filename, "rb"); - if (!stream) - { - ERR("unable to read in %s", filename); - goto end; - } +int +eo_lexer_setjmp(Eo_Lexer *ls) +{ + return setjmp(ls->err_jmp); +} - buffer = malloc(BUFSIZE); - if (!buffer) +void +eo_lexer_lex_error(Eo_Lexer *ls, const char *msg, int token) +{ + if (token) { - ERR("unable to allocate read buffer"); - goto end; + char buf[256]; + txt_token(ls, token, buf); + throw(ls, "%s: %d: %s near '%s'\n", ls->source, ls->line_number, msg, + buf); } + else + throw(ls, "%s: %d: %s\n", ls->source, ls->line_number, msg); +} - unsigned int len = fread(buffer, 1, BUFSIZE, stream); - - if (!len) - { - ERR("%s: is an empty file", filename); - goto end; - } +void +eo_lexer_syntax_error(Eo_Lexer *ls, const char *msg) +{ + eo_lexer_lex_error(ls, msg, ls->t.token); +} - if (len == BUFSIZE) +void +eo_lexer_token_to_str(int token, char *buf) +{ + if (token < START_CUSTOM) { - ERR("%s: buffer(%d) is full, might not be big enough.", filename, len); - goto end; + assert((unsigned char)token == token); + if (iscntrl(token)) + sprintf(buf, "char(%d)", token); + else + sprintf(buf, "%c", token); } - - buffer[len] = '\0'; -#if _WIN32 - { - Eina_Strbuf *str_buffer = eina_strbuf_manage_new(buffer); - if (eina_strbuf_replace_all(str_buffer, "\r\n", "\n")) - len = eina_strbuf_length_get(str_buffer); - buffer = eina_strbuf_string_steal(str_buffer); - eina_strbuf_free(str_buffer); - } -#endif - if (!eo_tokenizer_mem_walk(toknz, filename, buffer, len)) goto end; - - if (!toknz->classes) + else { - ERR("No classes for file %s", filename); - goto end; + const char *v = tokens[token - START_CUSTOM]; + memcpy(buf, v, strlen(v) + 1); } +} - EINA_LIST_FOREACH(toknz->classes, k, kls) - { - Eolian_Class class = database_class_add(kls->name, kls->type); - database_class_file_set(class, filename); - - if (kls->comment) database_class_description_set(class, kls->comment); - - EINA_LIST_FOREACH(kls->inherits, l, s) - database_class_inherit_add(class, s); - - if (kls->legacy_prefix) - { - database_class_legacy_prefix_set(class, kls->legacy_prefix); - } - if (kls->eo_prefix) - { - database_class_eo_prefix_set(class, kls->eo_prefix); - } - if (kls->data_type) - { - database_class_data_type_set(class, kls->data_type); - } - EINA_LIST_FOREACH(kls->constructors, l, meth) - { - Eolian_Function foo_id = database_function_new(meth->name, EOLIAN_CTOR); - database_class_function_add(class, foo_id); - if (meth->ret) database_function_return_comment_set(foo_id, EOLIAN_METHOD, meth->ret->comment); - database_function_data_set(foo_id, EOLIAN_LEGACY, meth->legacy); - EINA_LIST_FOREACH(meth->params, m, param) - { - Eolian_Type type = _types_extract(param->type, strlen(param->type)); - database_method_parameter_add(foo_id, (Eolian_Parameter_Dir)param->way, type, param->name, param->comment); - } - } - - EINA_LIST_FOREACH(kls->properties, l, prop) - { - Eolian_Function foo_id = database_function_new(prop->name, EOLIAN_UNRESOLVED); - database_function_scope_set(foo_id, prop->scope); - EINA_LIST_FOREACH(prop->keys, m, param) - { - Eolian_Type type = _types_extract(param->type, strlen(param->type)); - Eolian_Function_Parameter p = database_property_key_add( - foo_id, type, param->name, param->comment); - database_parameter_nonull_set(p, param->nonull); - } - EINA_LIST_FOREACH(prop->values, m, param) - { - Eolian_Type type = _types_extract(param->type, strlen(param->type)); - Eolian_Function_Parameter p = database_property_value_add( - foo_id, type, param->name, param->comment); - database_parameter_nonull_set(p, param->nonull); - } - EINA_LIST_FOREACH(prop->accessors, m, accessor) - { - database_function_type_set(foo_id, (accessor->type == SETTER?EOLIAN_PROP_SET:EOLIAN_PROP_GET)); - if (accessor->ret && accessor->ret->type) - { - Eolian_Function_Type ftype = - accessor->type == SETTER?EOLIAN_PROP_SET:EOLIAN_PROP_GET; - Eolian_Type types = _types_extract(accessor->ret->type, strlen(accessor->ret->type)); - database_function_return_type_set(foo_id, ftype, types); - database_function_return_comment_set(foo_id, - ftype, accessor->ret->comment); - database_function_return_flag_set_as_warn_unused(foo_id, - ftype, accessor->ret->warn_unused); - database_function_return_dflt_val_set(foo_id, - ftype, accessor->ret->dflt_ret_val); - } - if (accessor->legacy) - { - database_function_data_set(foo_id, - (accessor->type == SETTER?EOLIAN_LEGACY_SET:EOLIAN_LEGACY_GET), - accessor->legacy); - } - database_function_description_set(foo_id, - (accessor->type == SETTER?EOLIAN_COMMENT_SET:EOLIAN_COMMENT_GET), - accessor->comment); - Eo_Accessor_Param *acc_param; - Eina_List *m2; - EINA_LIST_FOREACH(accessor->params, m2, acc_param) - { - Eolian_Function_Parameter desc = eolian_function_parameter_get(foo_id, acc_param->name); - if (!desc) - { - printf("Error - %s not known as parameter of property %s\n", acc_param->name, prop->name); - } - else - if (strstr(acc_param->attrs, "const")) - { - database_parameter_const_attribute_set(desc, accessor->type == GETTER, EINA_TRUE); - } - } - } - if (!prop->accessors) database_function_type_set(foo_id, EOLIAN_PROPERTY); - database_class_function_add(class, foo_id); - } - - EINA_LIST_FOREACH(kls->methods, l, meth) - { - Eolian_Function foo_id = database_function_new(meth->name, EOLIAN_METHOD); - database_function_scope_set(foo_id, meth->scope); - database_class_function_add(class, foo_id); - if (meth->ret) - { - Eolian_Type types = _types_extract(meth->ret->type, strlen(meth->ret->type)); - database_function_return_type_set(foo_id, EOLIAN_METHOD, types); - database_function_return_comment_set(foo_id, EOLIAN_METHOD, meth->ret->comment); - database_function_return_flag_set_as_warn_unused(foo_id, - EOLIAN_METHOD, meth->ret->warn_unused); - database_function_return_dflt_val_set(foo_id, - EOLIAN_METHOD, meth->ret->dflt_ret_val); - } - database_function_description_set(foo_id, EOLIAN_COMMENT, meth->comment); - database_function_data_set(foo_id, EOLIAN_LEGACY, meth->legacy); - database_function_object_set_as_const(foo_id, meth->obj_const); - EINA_LIST_FOREACH(meth->params, m, param) - { - Eolian_Type type = _types_extract(param->type, strlen(param->type)); - Eolian_Function_Parameter p = database_method_parameter_add(foo_id, - (Eolian_Parameter_Dir)param->way, type, param->name, param->comment); - database_parameter_nonull_set(p, param->nonull); - } - } - - EINA_LIST_FOREACH(kls->implements, l, impl) - { - const char *impl_name = impl->meth_name; - if (!strcmp(impl_name, "class::constructor")) - { - database_class_ctor_enable_set(class, EINA_TRUE); - continue; - } - if (!strcmp(impl_name, "class::destructor")) - { - database_class_dtor_enable_set(class, EINA_TRUE); - continue; - } - if (!strncmp(impl_name, "virtual::", 9)) - { - char *virtual_name = strdup(impl_name); - char *func = strstr(virtual_name, "::"); - if (func) *func = '\0'; - func += 2; - Eolian_Function_Type ftype = EOLIAN_UNRESOLVED; - char *type_as_str = strstr(func, "::"); - if (type_as_str) - { - *type_as_str = '\0'; - if (!strcmp(type_as_str+2, "set")) ftype = EOLIAN_PROP_SET; - else if (!strcmp(type_as_str+2, "get")) ftype = EOLIAN_PROP_GET; - } - /* Search the function into the existing functions of the current class */ - Eolian_Function foo_id = eolian_class_function_find_by_name( - class, func, ftype); - free(virtual_name); - if (!foo_id) - { - ERR("Error - %s not known in class %s", impl_name + 9, eolian_class_name_get(class)); - goto end; - } - database_function_set_as_virtual_pure(foo_id, ftype); - continue; - } - Eolian_Implement impl_desc = database_implement_new(impl_name); - database_class_implement_add(class, impl_desc); - } - - EINA_LIST_FOREACH(kls->events, l, event) - { - Eolian_Event ev = database_event_new(event->name, event->type, event->comment); - database_class_event_add(class, ev); - } - - } +static int _init_counter = 0; - EINA_LIST_FOREACH(toknz->typedefs, k, type_def) +int +eo_lexer_init() +{ + if (!_init_counter) { - database_type_add(type_def->alias, _types_extract(type_def->type, strlen(type_def->type))); + eina_init(); + init_hash(); + eina_log_color_disable_set(EINA_FALSE); + _eo_lexer_log_dom = eina_log_domain_register("eo_toknz", EINA_COLOR_CYAN); } - - ret = EINA_TRUE; -end: - if (buffer) free(buffer); - if (stream) fclose(stream); - if (toknz) eo_tokenizer_free(toknz); - return ret; + return _init_counter++; } -void -eo_tokenizer_free(Eo_Lexer *toknz) +int +eo_lexer_shutdown() { - Eo_Class_Def *kls; - Eo_Type_Def *type; - - if (toknz->source) - eina_stringshare_del(toknz->source); - - EINA_LIST_FREE(toknz->classes, kls) - eo_definitions_class_def_free(kls); - - EINA_LIST_FREE(toknz->typedefs, type) - eo_definitions_type_def_free(type); - - free(toknz); + if (_init_counter <= 0) return 0; + _init_counter--; + if (!_init_counter) + { + eina_log_domain_unregister(_eo_lexer_log_dom); + _eo_lexer_log_dom = -1; + destroy_hash(); + eina_shutdown(); + } + return _init_counter; } - diff --git a/src/lib/eolian/eo_lexer.h b/src/lib/eolian/eo_lexer.h index e015d659c3..719b33f85e 100644 --- a/src/lib/eolian/eo_lexer.h +++ b/src/lib/eolian/eo_lexer.h @@ -1,71 +1,103 @@ -#ifndef __EO_TOKENIZER_H__ -#define __EO_TOKENIZER_H__ +#ifndef __EO_LEXER_H__ +#define __EO_LEXER_H__ + +#include <setjmp.h> #include <Eina.h> #include <Eolian.h> #include "eo_definitions.h" -/* TOKENIZER */ +#define START_CUSTOM 257 + +enum Tokens +{ + TOK_DBCOLON = START_CUSTOM, TOK_COMMENT, TOK_EOF, TOK_VALUE +}; + +#define KEYWORDS KW(class), KW(const), KW(private), KW(protected), \ + KW(return), KW(signed), KW(struct), KW(unsigned), KW(virtual), \ + KW(abstract), KW(constructor), KW(constructors), KW(data), \ + KW(destructor), KW(eo_prefix), KW(events), KW(get), KW(implements), \ + KW(interface), KW(keys), KW(legacy), KW(legacy_prefix), KW(methods), \ + KW(mixin), KW(params), KW(properties), KW(set), KW(type), KW(values), \ + KWAT(in), KWAT(inout), KWAT(nonull), KWAT(out), KWAT(own), KWAT(warn_unused) + +#define KW(x) KW_##x +#define KWAT(x) KW_at_##x -#define BUFSIZE 256*1024 +enum Keywords +{ + KW_UNKNOWN = 0, + KEYWORDS, + NUM_KEYWORDS +}; + +#undef KW +#undef KWAT + +typedef struct _Eo_Token +{ + int token; + const char *value; + int kw; +} Eo_Token; -typedef struct _eo_tokenizer +typedef struct _Eo_Lexer { - /* ragel vars */ - int cs; /* current machine state */ - int act; /* last pattern matched */ - char *ts; /* current token match start */ - char *te; /* current token match end */ - char *p; /* data start */ - char *pe; /* data end */ - char *eof; /* eof = (EOF ? pe : NULL) */ - /* int stack[10]; /1* state stack used by fret fcall ... *1/ */ - /* int top; /1* stack pointer *1/ */ - - const char *source; - int current_line; - int current_nesting; - int max_nesting; - Eo_Method_Type current_methods_type; - char buf[BUFSIZE]; - struct { - char *tok; - int line; - } saved; - - Eina_List *classes; - Eina_List *typedefs; - struct { - Eina_List **params; - Eolian_Class_Type kls_type; - const char *typedef_alias; - Eo_Class_Def *kls; - Eo_Type_Def *type_def; - Eo_Property_Def *prop; - Eo_Method_Def *meth; - Eo_Param_Def *param; - Eo_Accessor_Def *accessor; - Eo_Accessor_Param *accessor_param; - Eina_List *str_items; - Eo_Event_Def *event; - Eo_Implement_Def *impl; - int fscope; - } tmp; + int current; + int line_number; + Eo_Token t, lookahead; + Eina_Strbuf *buff; + Eina_File *handle; + const char *source; + const char *stream; + jmp_buf err_jmp; + Eina_List *classes; + Eina_List *typedefs; + Eo_Lexer_Temps tmp; } Eo_Lexer; -int eo_tokenizer_init(); +int eo_lexer_init (void); +int eo_lexer_shutdown (void); +Eo_Lexer *eo_lexer_new (const char *source); +void eo_lexer_free (Eo_Lexer *ls); +int eo_lexer_get (Eo_Lexer *ls); +int eo_lexer_get_ident (Eo_Lexer *ls, const char *chars); +int eo_lexer_lookahead (Eo_Lexer *ls); +int eo_lexer_lookahead_ident(Eo_Lexer *ls, const char *chars); +int eo_lexer_setjmp (Eo_Lexer *ls); +void eo_lexer_lex_error (Eo_Lexer *ls, const char *msg, int token); +void eo_lexer_syntax_error (Eo_Lexer *ls, const char *msg); +void eo_lexer_token_to_str (int token, char *buf); -int eo_tokenizer_shutdown(); +extern int _eo_lexer_log_dom; +#ifdef CRITICAL +#undef CRITICAL +#endif +#define CRITICAL(...) EINA_LOG_DOM_CRIT(_eo_lexer_log_dom, __VA_ARGS__) -Eo_Lexer* eo_tokenizer_get(void); +#ifdef ERR +#undef ERR +#endif +#define ERR(...) EINA_LOG_DOM_ERR(_eo_lexer_log_dom, __VA_ARGS__) -Eina_Bool eo_tokenizer_walk(Eo_Lexer *toknz, const char *source); +#ifdef WRN +#undef WRN +#endif +#define WRN(...) EINA_LOG_DOM_WARN(_eo_lexer_log_dom, __VA_ARGS__) -void eo_tokenizer_dump(Eo_Lexer *toknz); +#define INF_ENABLED EINA_FALSE +#ifdef INF +#undef INF +#endif +#define INF(...) if (INF_ENABLED) EINA_LOG_DOM_INFO(_eo_lexer_log_dom, __VA_ARGS__) -void eo_tokenizer_free(Eo_Lexer *toknz); +#define DBG_ENABLED EINA_FALSE +#ifdef DBG +#undef DBG +#endif +#define DBG(...) if (DBG_ENABLED) EINA_LOG_DOM_DBG(_eo_lexer_log_dom, __VA_ARGS__) -Eina_Bool eo_tokenizer_database_fill(const char *filename); -#endif /* __EO_TOKENIZER_H__ */ +#endif /* __EO_LEXER_H__ */
\ No newline at end of file diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c new file mode 100644 index 0000000000..3e686bd648 --- /dev/null +++ b/src/lib/eolian/eo_parser.c @@ -0,0 +1,1453 @@ +#include "eo_parser.h" +#include "eolian_database.h" + +#define FUNC_PUBLIC 0 +#define FUNC_PROTECTED 1 + +#define eo_lexer_get_event_name(ls) eo_lexer_get_ident(ls, "@_.+-/\\='\"?!%,") + +static void +error_expected(Eo_Lexer *ls, int token) +{ + char buf[256]; + char tbuf[256]; + eo_lexer_token_to_str(token, tbuf); + snprintf(buf, sizeof(buf), "'%s' expected", tbuf); + eo_lexer_syntax_error(ls, buf); +} + +static Eina_Bool +test_next(Eo_Lexer *ls, int token) +{ + if (ls->t.token == token) + { + eo_lexer_get(ls); + return EINA_TRUE; + } + return EINA_FALSE; +} + +static void +check(Eo_Lexer *ls, int token) +{ + if (ls->t.token != 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); +} + +static void +check_next(Eo_Lexer *ls, int token) +{ + check(ls, token); + eo_lexer_get(ls); +} + +static void +check_kw_next(Eo_Lexer *ls, int kw) +{ + check_kw(ls, kw); + eo_lexer_get(ls); +} + +static void +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); + else + { + char buf[256]; + char tbuf[256]; + char vbuf[256]; + eo_lexer_token_to_str(what, tbuf); + eo_lexer_token_to_str(who , vbuf); + snprintf(buf, sizeof(buf), + "'%s' expected (to close '%s' at line %d)", + tbuf, vbuf, where); + eo_lexer_syntax_error(ls, buf); + } + } +} + +static Eina_Strbuf * +push_strbuf(Eo_Lexer *ls) +{ + Eina_Strbuf *buf = eina_strbuf_new(); + ls->tmp.str_bufs = eina_list_prepend(ls->tmp.str_bufs, buf); + return buf; +} + +static void +pop_strbuf(Eo_Lexer *ls) +{ + Eina_Strbuf *buf = eina_list_data_get(ls->tmp.str_bufs); + eina_strbuf_free(buf); + ls->tmp.str_bufs = eina_list_remove_list(ls->tmp.str_bufs, ls->tmp.str_bufs); +} + +static Eina_Strbuf * +parse_name(Eo_Lexer *ls, Eina_Strbuf *buf) +{ + check(ls, TOK_VALUE); + eina_strbuf_reset(buf); + for (;;) + { + eina_strbuf_append(buf, ls->t.value); + eo_lexer_get(ls); + if (ls->t.token != TOK_DBCOLON) break; + eo_lexer_get(ls); + eina_strbuf_append(buf, "::"); + check(ls, TOK_VALUE); + } + return buf; +} + +static Eina_List * +parse_name_list(Eo_Lexer *ls) +{ + Eina_Strbuf *buf = push_strbuf(ls); + ls->tmp.str_items = NULL; + parse_name(ls, buf); + ls->tmp.str_items = eina_list_append(ls->tmp.str_items, + eina_stringshare_add(eina_strbuf_string_get(buf))); + while (test_next(ls, ',')) + { + parse_name(ls, buf); + ls->tmp.str_items = eina_list_append(ls->tmp.str_items, + eina_stringshare_add(eina_strbuf_string_get(buf))); + } + pop_strbuf(ls); + return ls->tmp.str_items; +} + +static void +parse_type(Eo_Lexer *ls, Eina_Strbuf *buf) +{ + Eina_Bool has_struct = EINA_FALSE, need_space = EINA_FALSE; + + if (ls->t.kw == KW_at_own) + { + eina_strbuf_append(buf, "@own"); + eo_lexer_get(ls); + need_space = EINA_TRUE; + } + + if (ls->t.kw == KW_const) + { + if (need_space) eina_strbuf_append_char(buf, ' '); + eina_strbuf_append(buf, "const"); + eo_lexer_get(ls); + need_space = EINA_TRUE; + } + + if (ls->t.kw == KW_unsigned) + { + if (need_space) eina_strbuf_append_char(buf, ' '); + eina_strbuf_append(buf, "unsigned"); + eo_lexer_get(ls); + need_space = EINA_TRUE; + } + else if (ls->t.kw == KW_signed) + { + if (need_space) eina_strbuf_append_char(buf, ' '); + eina_strbuf_append(buf, "signed"); + eo_lexer_get(ls); + need_space = EINA_TRUE; + } + else if (ls->t.kw == KW_struct) + { + if (need_space) eina_strbuf_append_char(buf, ' '); + eina_strbuf_append(buf, "struct"); + eo_lexer_get(ls); + need_space = EINA_TRUE; + } + + if (!has_struct && ls->t.kw == KW_const) + { + if (need_space) eina_strbuf_append_char(buf, ' '); + eina_strbuf_append(buf, "const"); + eo_lexer_get(ls); + need_space = EINA_TRUE; + } + + check(ls, TOK_VALUE); + if (need_space) eina_strbuf_append_char(buf, ' '); + eina_strbuf_append(buf, ls->t.value); + eo_lexer_get(ls); + need_space = EINA_TRUE; + + if (ls->t.kw == KW_const) + { + eina_strbuf_append(buf, " const"); + eo_lexer_get(ls); + } + + if (ls->t.token == '*') + { + eina_strbuf_append_char(buf, ' '); + while (ls->t.token == '*') + { + eina_strbuf_append_char(buf, '*'); + eo_lexer_get(ls); + if (ls->t.kw == KW_const) + { + eina_strbuf_append(buf, " const"); + eo_lexer_get(ls); + } + } + if (ls->t.token == '<') + { + int line = ls->line_number; + eina_strbuf_append(buf, " <"); + eo_lexer_get(ls); + parse_type(ls, buf); + check_match(ls, '>', '<', line); + eina_strbuf_append_char(buf, '>'); + } + } +} + +static void +parse_typedef(Eo_Lexer *ls) +{ + Eina_Strbuf *buf = push_strbuf(ls); + ls->tmp.type_def = calloc(1, sizeof(Eo_Type_Def)); + eo_lexer_get(ls); + check(ls, TOK_VALUE); + ls->tmp.type_def->alias = eina_stringshare_add(ls->t.value); + eo_lexer_get(ls); + test_next(ls, ':'); + parse_type(ls, buf); + ls->tmp.type_def->type = eina_stringshare_add(eina_strbuf_string_get(buf)); + pop_strbuf(ls); + check_next(ls, ';'); +} + +static void +parse_return(Eo_Lexer *ls) +{ + Eo_Ret_Def *ret = calloc(1, sizeof(Eo_Ret_Def)); + Eina_Strbuf *buf = push_strbuf(ls); + ls->tmp.ret_def = ret; + eo_lexer_get(ls); + parse_type(ls, buf); + ret->type = eina_stringshare_add(eina_strbuf_string_get(buf)); + pop_strbuf(ls); + if (ls->t.token == '(') + { + int line = ls->line_number; + eo_lexer_get(ls); + check(ls, TOK_VALUE); + ret->dflt_ret_val = eina_stringshare_add(ls->t.value); + eo_lexer_get(ls); + check_match(ls, ')', '(', line); + } + if (ls->t.kw == KW_at_warn_unused) + { + ret->warn_unused = EINA_TRUE; + eo_lexer_get(ls); + } + check_next(ls, ';'); + if (ls->t.token == TOK_COMMENT) + { + ret->comment = eina_stringshare_add(ls->t.value); + eo_lexer_get(ls); + } +} + +static void +parse_param(Eo_Lexer *ls, Eina_Bool allow_inout) +{ + Eo_Param_Def *par = calloc(1, sizeof(Eo_Param_Def)); + Eina_Strbuf *buf = NULL; + ls->tmp.param = par; + if (allow_inout) + { + if (ls->t.kw == KW_at_in) + { + par->way = PARAM_IN; + eo_lexer_get(ls); + } + else if (ls->t.kw == KW_at_out) + { + par->way = PARAM_OUT; + eo_lexer_get(ls); + } + else if (ls->t.kw == KW_at_inout) + { + par->way = PARAM_INOUT; + eo_lexer_get(ls); + } + else + par->way = PARAM_IN; + } + buf = push_strbuf(ls); + parse_type(ls, buf); + par->type = eina_stringshare_add(eina_strbuf_string_get(buf)); + pop_strbuf(ls); + check(ls, TOK_VALUE); + par->name = eina_stringshare_add(ls->t.value); + eo_lexer_get(ls); + if (ls->t.kw == KW_at_nonull) + { + par->nonull = EINA_TRUE; + eo_lexer_get(ls); + } + check_next(ls, ';'); + if (ls->t.token == TOK_COMMENT) + { + par->comment = eina_stringshare_add(ls->t.value); + eo_lexer_get(ls); + } +} + +static void +parse_legacy(Eo_Lexer *ls) +{ + eo_lexer_get(ls); + check(ls, TOK_VALUE); + ls->tmp.legacy_def = eina_stringshare_add(ls->t.value); + eo_lexer_get(ls); + check_next(ls, ';'); +} + +static void +parse_attrs(Eo_Lexer *ls) +{ + Eina_Strbuf *buf = NULL; + Eo_Accessor_Param *acc = NULL; + Eina_Bool has_const = EINA_FALSE, has_own = EINA_FALSE, + has_nonull = EINA_FALSE, first = EINA_TRUE; + acc = calloc(1, sizeof(Eo_Accessor_Param)); + ls->tmp.accessor_param = acc; + acc->name = eina_stringshare_add(ls->t.value); + eo_lexer_get(ls); + check_next(ls, ':'); + check(ls, TOK_VALUE); + buf = push_strbuf(ls); + for (;;) + { + switch (ls->t.kw) + { + case KW_const: + if (has_const) + eo_lexer_syntax_error(ls, "double const qualifier"); + has_const = EINA_TRUE; + if (!first) eina_strbuf_append_char(buf, ' '); + eina_strbuf_append(buf, "const"); + first = EINA_FALSE; + eo_lexer_get(ls); + break; + case KW_at_own: + if (has_own) + eo_lexer_syntax_error(ls, "double @own qualifier"); + has_own = EINA_TRUE; + if (!first) eina_strbuf_append_char(buf, ' '); + eina_strbuf_append(buf, "@own"); + first = EINA_FALSE; + eo_lexer_get(ls); + break; + case KW_at_nonull: + if (has_nonull) + eo_lexer_syntax_error(ls, "double @nonull qualifier"); + has_nonull = EINA_TRUE; + 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)); + pop_strbuf(ls); + check_next(ls, ';'); +} + +static void +parse_accessor(Eo_Lexer *ls) +{ + int line; + Eo_Accessor_Def *acc = NULL; + Eina_Bool has_return = EINA_FALSE, has_legacy = EINA_FALSE; + acc = calloc(1, sizeof(Eo_Accessor_Def)); + ls->tmp.accessor = acc; + acc->type = (ls->t.kw == KW_get) ? GETTER : SETTER; + eo_lexer_get(ls); + line = ls->line_number; + check_next(ls, '{'); + if (ls->t.token == TOK_COMMENT) + { + acc->comment = eina_stringshare_add(ls->t.value); + eo_lexer_get(ls); + } + for (;;) + { + switch (ls->t.kw) + { + case KW_return: + if (has_return) + eo_lexer_syntax_error(ls, "double return"); + has_return = EINA_TRUE; + parse_return(ls); + acc->ret = ls->tmp.ret_def; + ls->tmp.ret_def = NULL; + break; + case KW_legacy: + if (has_legacy) + eo_lexer_syntax_error(ls, "double legacy name"); + has_legacy = EINA_TRUE; + 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; + } + } +end: + check_match(ls, '}', '{', line); +} + +static void +parse_keys(Eo_Lexer *ls) +{ + int line; + eo_lexer_get(ls); + line = ls->line_number; + check_next(ls, '{'); + while (ls->t.token != '}') + { + parse_param(ls, EINA_FALSE); + ls->tmp.params = eina_list_append(ls->tmp.params, ls->tmp.param); + ls->tmp.param = NULL; + } + check_match(ls, '}', '{', line); +} + +static void +parse_values(Eo_Lexer *ls) +{ + int line; + eo_lexer_get(ls); + line = ls->line_number; + check_next(ls, '{'); + while (ls->t.token != '}') + { + parse_param(ls, EINA_FALSE); + ls->tmp.params = eina_list_append(ls->tmp.params, ls->tmp.param); + ls->tmp.param = NULL; + } + check_match(ls, '}', '{', line); +} + +static void +parse_property(Eo_Lexer *ls) +{ + int line; + Eo_Property_Def *prop = NULL; + Eina_Bool has_get = EINA_FALSE, has_set = EINA_FALSE, + has_keys = EINA_FALSE, has_values = EINA_FALSE; + prop = calloc(1, sizeof(Eo_Property_Def)); + ls->tmp.prop = prop; + if (ls->t.kw == KW_protected) + { + prop->scope = FUNC_PROTECTED; + eo_lexer_get(ls); + } + prop->name = eina_stringshare_add(ls->t.value); + eo_lexer_get(ls); + line = ls->line_number; + check_next(ls, '{'); + for (;;) + { + switch (ls->t.kw) + { + case KW_get: + if (has_get) + eo_lexer_syntax_error(ls, "double get definition"); + has_get = EINA_TRUE; + parse_accessor(ls); + prop->accessors = eina_list_append(prop->accessors, + ls->tmp.accessor); + ls->tmp.accessor = NULL; + break; + case KW_set: + if (has_set) + eo_lexer_syntax_error(ls, "double set definition"); + has_set = EINA_TRUE; + parse_accessor(ls); + prop->accessors = eina_list_append(prop->accessors, + ls->tmp.accessor); + ls->tmp.accessor = NULL; + break; + case KW_keys: + if (has_keys) + eo_lexer_syntax_error(ls, "double keys definition"); + has_keys = EINA_TRUE; + parse_keys(ls); + prop->keys = ls->tmp.params; + ls->tmp.params = NULL; + break; + case KW_values: + if (has_values) + eo_lexer_syntax_error(ls, "double values definition"); + has_values = EINA_TRUE; + parse_values(ls); + prop->values = ls->tmp.params; + ls->tmp.params = NULL; + break; + default: + goto end; + } + } +end: + check_match(ls, '}', '{', line); +} + +static void +parse_params(Eo_Lexer *ls) +{ + int line; + eo_lexer_get(ls); + line = ls->line_number; + check_next(ls, '{'); + while (ls->t.token != '}') + { + parse_param(ls, EINA_TRUE); + ls->tmp.params = eina_list_append(ls->tmp.params, ls->tmp.param); + ls->tmp.param = NULL; + } + check_match(ls, '}', '{', line); +} + +static void +parse_method(Eo_Lexer *ls, Eina_Bool ctor) +{ + int line; + Eo_Method_Def *meth = NULL; + Eina_Bool has_const = EINA_FALSE, has_params = EINA_FALSE, + has_return = EINA_FALSE, has_legacy = EINA_FALSE; + meth = calloc(1, sizeof(Eo_Method_Def)); + ls->tmp.meth = meth; + if (ctor) + { + if (ls->t.token != TOK_VALUE) + eo_lexer_syntax_error(ls, "expected method name"); + meth->type = METH_CONSTRUCTOR; + meth->name = eina_stringshare_add(ls->t.value); + eo_lexer_get(ls); + } + else + { + meth->type = METH_REGULAR; + if (ls->t.kw == KW_protected) + { + meth->scope = FUNC_PROTECTED; + eo_lexer_get(ls); + } + check(ls, TOK_VALUE); + meth->name = eina_stringshare_add(ls->t.value); + eo_lexer_get(ls); + } + line = ls->line_number; + check_next(ls, '{'); + if (ls->t.token == TOK_COMMENT) + { + meth->comment = eina_stringshare_add(ls->t.value); + eo_lexer_get(ls); + } + for (;;) + { + switch (ls->t.kw) + { + case KW_const: + if (has_const) + eo_lexer_syntax_error(ls, "double const qualifier"); + has_const = EINA_TRUE; + meth->obj_const = EINA_TRUE; + eo_lexer_get(ls); + check_next(ls, ';'); + break; + case KW_return: + if (has_return) + eo_lexer_syntax_error(ls, "double return"); + has_return = EINA_TRUE; + parse_return(ls); + meth->ret = ls->tmp.ret_def; + ls->tmp.ret_def = NULL; + break; + case KW_legacy: + if (has_legacy) + eo_lexer_syntax_error(ls, "double legacy name"); + has_legacy = EINA_TRUE; + parse_legacy(ls); + meth->legacy = ls->tmp.legacy_def; + ls->tmp.legacy_def = NULL; + break; + case KW_params: + if (has_params) + eo_lexer_syntax_error(ls, "double params definition"); + has_params = EINA_TRUE; + parse_params(ls); + meth->params = ls->tmp.params; + ls->tmp.params = NULL; + break; + default: + goto end; + } + } +end: + check_match(ls, '}', '{', line); +} + +static void +parse_implement(Eo_Lexer *ls) +{ + Eina_Strbuf *buf = NULL; + Eo_Implement_Def *impl = NULL; + buf = push_strbuf(ls); + impl = calloc(1, sizeof(Eo_Implement_Def)); + ls->tmp.impl = impl; + if (ls->t.kw == KW_class) + { + eina_strbuf_append(buf, "class::"); + eo_lexer_get(ls); + check_next(ls, TOK_DBCOLON); + if (ls->t.kw == KW_destructor) + { + eina_strbuf_append(buf, "destructor"); + eo_lexer_get(ls); + } + else + { + check_kw_next(ls, KW_constructor); + eina_strbuf_append(buf, "constructor"); + } + check_next(ls, ';'); + impl->meth_name = eina_stringshare_add(eina_strbuf_string_get(buf)); + pop_strbuf(ls); + return; + } + else if (ls->t.kw == KW_virtual) + { + eina_strbuf_append(buf, "virtual::"); + eo_lexer_get(ls); + check_next(ls, TOK_DBCOLON); + if ((ls->t.token != TOK_VALUE) || (ls->t.kw == KW_get || ls->t.kw == KW_set)) + eo_lexer_syntax_error(ls, "name expected"); + eina_strbuf_append(buf, ls->t.value); + eo_lexer_get(ls); + if (ls->t.token == TOK_DBCOLON) + { + eo_lexer_get(ls); + if (ls->t.kw == KW_set) + { + eina_strbuf_append(buf, "::set"); + eo_lexer_get(ls); + } + else + { + check_kw_next(ls, KW_get); + eina_strbuf_append(buf, "::get"); + } + } + check_next(ls, ';'); + impl->meth_name = eina_stringshare_add(eina_strbuf_string_get(buf)); + pop_strbuf(ls); + 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"); + eina_strbuf_append(buf, ls->t.value); + eo_lexer_get(ls); + check_next(ls, TOK_DBCOLON); + 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"); + for (;;) + { + switch (ls->t.kw) + { + case KW_constructor: + eina_strbuf_append(buf, "constructor"); + eo_lexer_get(ls); + goto end; + case KW_destructor: + eina_strbuf_append(buf, "destructor"); + eo_lexer_get(ls); + goto end; + case KW_get: + eina_strbuf_append(buf, "get"); + eo_lexer_get(ls); + goto end; + case KW_set: + eina_strbuf_append(buf, "set"); + eo_lexer_get(ls); + goto end; + default: + break; + } + check(ls, TOK_VALUE); + eina_strbuf_append(buf, ls->t.value); + eo_lexer_get(ls); + if (ls->t.token != TOK_DBCOLON) break; + eina_strbuf_append(buf, "::"); + eo_lexer_get(ls); + } +end: + check_next(ls, ';'); + impl->meth_name = eina_stringshare_add(eina_strbuf_string_get(buf)); + pop_strbuf(ls); +} + +static void +parse_event(Eo_Lexer *ls) +{ + Eo_Event_Def *ev = calloc(1, sizeof(Eo_Event_Def)); + ls->tmp.event = ev; + /* code path not in use yet + if (ls->t.kw == KW_private) + { + eo_lexer_get_event_name(ls); + }*/ + check(ls, TOK_VALUE); + ev->name = eina_stringshare_add(ls->t.value); + eo_lexer_get(ls); + if (ls->t.token == '(') + { + Eina_Strbuf *buf; + int line = ls->line_number; + eo_lexer_get(ls); + buf = push_strbuf(ls); + parse_type(ls, buf); + ev->type = eina_stringshare_add(eina_strbuf_string_get(buf)); + pop_strbuf(ls); + check_match(ls, ')', '(', line); + } + check(ls, ';'); + eo_lexer_get_event_name(ls); + if (ls->t.token == TOK_COMMENT) + { + ev->comment = eina_stringshare_add(ls->t.value); + eo_lexer_get_event_name(ls); + } +} + +static void +parse_constructors(Eo_Lexer *ls) +{ + int line; + eo_lexer_get(ls); + line = ls->line_number; + check_next(ls, '{'); + while (ls->t.token != '}') + { + parse_method(ls, EINA_TRUE); + ls->tmp.kls->constructors = eina_list_append(ls->tmp.kls->constructors, + ls->tmp.meth); + ls->tmp.meth = NULL; + } + check_match(ls, '}', '{', line); +} + +static void +parse_methods(Eo_Lexer *ls) +{ + int line; + eo_lexer_get(ls); + line = ls->line_number; + check_next(ls, '{'); + while (ls->t.token != '}') + { + parse_method(ls, EINA_FALSE); + ls->tmp.kls->methods = eina_list_append(ls->tmp.kls->methods, + ls->tmp.meth); + ls->tmp.meth = NULL; + } + check_match(ls, '}', '{', line); +} + +static void +parse_properties(Eo_Lexer *ls) +{ + int line; + eo_lexer_get(ls); + line = ls->line_number; + check_next(ls, '{'); + while (ls->t.token != '}') + { + parse_property(ls); + ls->tmp.kls->properties = eina_list_append(ls->tmp.kls->properties, + ls->tmp.prop); + ls->tmp.prop = NULL; + } + check_match(ls, '}', '{', line); +} + +static void +parse_implements(Eo_Lexer *ls) +{ + int line; + eo_lexer_get(ls); + line = ls->line_number; + check_next(ls, '{'); + while (ls->t.token != '}') + { + parse_implement(ls); + ls->tmp.kls->implements = eina_list_append(ls->tmp.kls->implements, + ls->tmp.impl); + ls->tmp.impl = NULL; + } + check_match(ls, '}', '{', line); +} + +static void +parse_events(Eo_Lexer *ls) +{ + int line; + eo_lexer_get(ls); + line = ls->line_number; + check(ls, '{'); + eo_lexer_get_event_name(ls); + while (ls->t.token != '}') + { + parse_event(ls); + ls->tmp.kls->events = eina_list_append(ls->tmp.kls->events, + ls->tmp.event); + ls->tmp.event = NULL; + } + check_match(ls, '}', '{', line); +} + +static void +parse_class_body(Eo_Lexer *ls, Eina_Bool allow_ctors) +{ + Eina_Bool has_legacy_prefix = EINA_FALSE, + has_eo_prefix = EINA_FALSE, + has_data = EINA_FALSE, + has_constructors = EINA_FALSE, + has_properties = EINA_FALSE, + has_methods = EINA_FALSE, + has_implements = EINA_FALSE, + has_events = EINA_FALSE; + if (ls->t.token == TOK_COMMENT) + { + ls->tmp.kls->comment = eina_stringshare_add(ls->t.value); + eo_lexer_get(ls); + } + for (;;) + { + switch (ls->t.kw) + { + case KW_legacy_prefix: + if (has_legacy_prefix) + eo_lexer_syntax_error(ls, "double legacy prefix definition"); + has_legacy_prefix = EINA_TRUE; + 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: + if (has_eo_prefix) + eo_lexer_syntax_error(ls, "double eo prefix definition"); + has_eo_prefix = EINA_TRUE; + 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: + if (has_data) + eo_lexer_syntax_error(ls, "double data definition"); + has_data = EINA_TRUE; + eo_lexer_get(ls); + check_next(ls, ':'); + check(ls, TOK_VALUE); + 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; + if (has_constructors) + eo_lexer_syntax_error(ls, "double constructors definition"); + has_constructors = EINA_TRUE; + parse_constructors(ls); + break; + case KW_properties: + if (has_properties) + eo_lexer_syntax_error(ls, "double properties definition"); + has_properties = EINA_TRUE; + parse_properties(ls); + break; + case KW_methods: + if (has_methods) + eo_lexer_syntax_error(ls, "double methods definition"); + has_methods = EINA_TRUE; + parse_methods(ls); + break; + case KW_implements: + if (has_implements) + eo_lexer_syntax_error(ls, "double implements definition"); + has_implements = EINA_TRUE; + parse_implements(ls); + break; + case KW_events: + if (has_events) + eo_lexer_syntax_error(ls, "double events definition"); + has_events = EINA_TRUE; + parse_events(ls); + break; + default: + return; + } + } +} + +static void +parse_class(Eo_Lexer *ls, Eina_Bool allow_ctors, Eolian_Class_Type type) +{ + int line; + Eina_Strbuf *buf = push_strbuf(ls); + ls->tmp.kls = calloc(1, sizeof(Eo_Class_Def)); + eo_lexer_get(ls); + ls->tmp.kls->type = type; + parse_name(ls, buf); + ls->tmp.kls->name = eina_stringshare_add(eina_strbuf_string_get(buf)); + pop_strbuf(ls); + line = ls->line_number; + check_next(ls, '('); + if (ls->t.token != ')') + { + ls->tmp.kls->inherits = parse_name_list(ls); + ls->tmp.str_items = NULL; + } + check_match(ls, ')', '(', line); + line = ls->line_number; + check_next(ls, '{'); + parse_class_body(ls, allow_ctors); + check_match(ls, '}', '{', line); +} + +static void +parse_unit(Eo_Lexer *ls) +{ + switch (ls->t.kw) + { + case KW_abstract: + { + parse_class(ls, EINA_TRUE, EOLIAN_CLASS_ABSTRACT); + ls->classes = eina_list_append(ls->classes, ls->tmp.kls); + ls->tmp.kls = NULL; + break; + } + case KW_class: + { + parse_class(ls, EINA_TRUE, EOLIAN_CLASS_REGULAR); + ls->classes = eina_list_append(ls->classes, ls->tmp.kls); + ls->tmp.kls = NULL; + break; + } + case KW_mixin: + { + parse_class(ls, EINA_FALSE, EOLIAN_CLASS_MIXIN); + ls->classes = eina_list_append(ls->classes, ls->tmp.kls); + ls->tmp.kls = NULL; + break; + } + case KW_interface: + { + parse_class(ls, EINA_FALSE, EOLIAN_CLASS_INTERFACE); + ls->classes = eina_list_append(ls->classes, ls->tmp.kls); + ls->tmp.kls = NULL; + break; + } + case KW_type: + { + parse_typedef(ls); + ls->typedefs = eina_list_append(ls->typedefs, ls->tmp.type_def); + ls->tmp.type_def = NULL; + break; + } + default: + { + eo_lexer_syntax_error(ls, "invalid token"); + break; + } + } +} + +static void +parse_chunk(Eo_Lexer *ls) +{ + while (ls->t.token != TOK_EOF) + { + parse_unit(ls); + } +} + +static char *_accessor_type_str[ACCESSOR_TYPE_LAST] = { "setter", "getter" }; +static char * _param_way_str[ PARAM_WAY_LAST] = { "IN", "OUT", "INOUT" }; + +void +eo_parser_dump(Eo_Lexer *ls) +{ + const char *s; + Eina_List *k, *l, *m; + + Eo_Type_Def *type; + Eo_Class_Def *kls; + Eo_Property_Def *prop; + Eo_Method_Def *meth; + Eo_Param_Def *param; + Eo_Accessor_Def *accessor; + Eo_Event_Def *sgn; + Eo_Implement_Def *impl; + + EINA_LIST_FOREACH(ls->classes, k, kls) + { + printf("Class: %s (%s)\n", + kls->name, (kls->comment ? kls->comment : "-")); + printf(" inherits from :"); + EINA_LIST_FOREACH(kls->inherits, l, s) + printf(" %s", s); + printf("\n"); + printf(" implements:"); + EINA_LIST_FOREACH(kls->implements, l, impl) + printf(" %s", impl->meth_name); + printf("\n"); + printf(" events:\n"); + EINA_LIST_FOREACH(kls->events, l, sgn) + printf(" %s <%s> (%s)\n", sgn->name, sgn->type, sgn->comment); + + EINA_LIST_FOREACH(kls->constructors, l, meth) + { + printf(" constructors: %s\n", meth->name); + if (meth->ret) + printf(" return: %s (%s)\n", meth->ret->type, meth->ret->comment); + printf(" legacy : %s\n", meth->legacy); + EINA_LIST_FOREACH(meth->params, m, param) + { + printf(" param: %s %s : %s (%s)\n", + _param_way_str[param->way], param->name, + param->type, param->comment); + } + } + + EINA_LIST_FOREACH(kls->properties, l, prop) + { + printf(" property: %s\n", prop->name); + EINA_LIST_FOREACH(prop->keys, m, param) + { + printf(" key: %s : %s (%s)\n", + param->name, param->type, param->comment); + } + EINA_LIST_FOREACH(prop->values, m, param) + { + printf(" value: %s : %s (%s)\n", + param->name, param->type, param->comment); + } + EINA_LIST_FOREACH(prop->accessors, m, accessor) + { + printf(" accessor: %s : %s (%s)\n", + (accessor->ret?accessor->ret->type:""), + _accessor_type_str[accessor->type], + accessor->comment); + printf(" legacy : %s\n", accessor->legacy); + } + } + + EINA_LIST_FOREACH(kls->methods, l, meth) + { + printf(" method: %s\n", meth->name); + if (meth->ret) + printf(" return: %s (%s)\n", meth->ret->type, meth->ret->comment); + printf(" legacy : %s\n", meth->legacy); + printf(" obj_const : %s\n", meth->obj_const?"true":"false"); + EINA_LIST_FOREACH(meth->params, m, param) + { + printf(" param: %s %s : %s (%s)\n", + _param_way_str[param->way], param->name, + param->type, param->comment); + } + } + } + + EINA_LIST_FOREACH(ls->typedefs, k, type) + { + printf("Typedef: %s (%s)\n", type->alias, type->type); + } +} + +static Eina_Inlist * +_types_extract(const char *buf, int len) +{ + const char *save_buf = buf; + Eolian_Type types = NULL; + long depth = 0; + char *tmp_type = malloc(2 * len + 1); + + while (len > 0) + { + char *d = tmp_type; + Eina_Bool end_type = EINA_FALSE; + Eina_Bool is_own = EINA_FALSE; + char c; + Eina_Bool in_spaces = EINA_TRUE, in_stars = EINA_FALSE; + while (len > 0 && !end_type) + { + switch (c = *buf++) + { + /* @own */ + case '@': + { + if (!strncmp(buf, "own ", 4)) + { + is_own = EINA_TRUE; + buf += 4; len -= 4; + } + break; + } + /* if '*', we have to add a space. We set in_spaces to true in + * case spaces are between stars, to be sure we remove them. + */ + case '*': + { + if (!in_stars && !in_spaces) + { + *d++ = ' '; + in_stars = EINA_TRUE; + in_spaces = EINA_TRUE; + } + *d++ = c; + break; + } + /* Only the first space is inserted. */ + case ' ': + { + if (!in_spaces) *d++ = c; + in_spaces = EINA_TRUE; + break; + } + case '<': + { + if (depth < 0) + { + ERR("%s: Cannot reopen < after >", save_buf); + goto error; + } + depth++; + end_type = EINA_TRUE; + break; + } + case '>': + { + if (depth == 0) + { + ERR("%s: Too much >", save_buf); + goto error; + } + if (depth > 0 && d == tmp_type) + { + ERR("%s: empty type inside <>", save_buf); + goto error; + } + if (depth > 0) depth *= -1; + depth++; + end_type = EINA_TRUE; + break; + } + default: + { + *d++ = c; + in_spaces = EINA_FALSE; + in_stars = EINA_FALSE; + } + } + len--; + } + if (d != tmp_type) + { + *d = '\0'; + types = database_type_append(types, tmp_type, is_own); + } + } + if (depth) + { + ERR("%s: < and > are not well used.", save_buf); + goto error; + } + goto success; +error: + database_type_del(types); + types = NULL; +success: + free(tmp_type); + return types; +} + +Eina_Bool +eo_parser_walk(Eo_Lexer *ls) +{ + if (!eo_lexer_setjmp(ls)) + { + parse_chunk(ls); + return EINA_TRUE; + } + return EINA_FALSE; +} + +Eina_Bool +eo_parser_database_fill(const char *filename) +{ + Eina_Bool ret = EINA_FALSE; + const char *s; + Eina_List *k, *l, *m; + + Eo_Class_Def *kls; + Eo_Type_Def *type_def; + Eo_Property_Def *prop; + Eo_Method_Def *meth; + Eo_Param_Def *param; + Eo_Accessor_Def *accessor; + Eo_Event_Def *event; + Eo_Implement_Def *impl; + + Eo_Lexer *ls = eo_lexer_new(filename); + if (!ls) + { + ERR("unable to create lexer"); + goto end; + } + + /* read first token */ + eo_lexer_get(ls); + + if (!eo_parser_walk(ls)) goto end; + + if (!ls->classes) + { + ERR("No classes for file %s", filename); + goto end; + } + + EINA_LIST_FOREACH(ls->classes, k, kls) + { + Eolian_Class class = database_class_add(kls->name, kls->type); + database_class_file_set(class, filename); + + if (kls->comment) database_class_description_set(class, kls->comment); + + EINA_LIST_FOREACH(kls->inherits, l, s) + database_class_inherit_add(class, s); + + if (kls->legacy_prefix) + { + database_class_legacy_prefix_set(class, kls->legacy_prefix); + } + if (kls->eo_prefix) + { + database_class_eo_prefix_set(class, kls->eo_prefix); + } + if (kls->data_type) + { + database_class_data_type_set(class, kls->data_type); + } + EINA_LIST_FOREACH(kls->constructors, l, meth) + { + Eolian_Function foo_id = database_function_new(meth->name, EOLIAN_CTOR); + database_class_function_add(class, foo_id); + if (meth->ret) database_function_return_comment_set(foo_id, EOLIAN_METHOD, meth->ret->comment); + database_function_data_set(foo_id, EOLIAN_LEGACY, meth->legacy); + EINA_LIST_FOREACH(meth->params, m, param) + { + Eolian_Type type = _types_extract(param->type, strlen(param->type)); + database_method_parameter_add(foo_id, (Eolian_Parameter_Dir)param->way, type, param->name, param->comment); + } + } + + EINA_LIST_FOREACH(kls->properties, l, prop) + { + Eolian_Function foo_id = database_function_new(prop->name, EOLIAN_UNRESOLVED); + database_function_scope_set(foo_id, prop->scope); + EINA_LIST_FOREACH(prop->keys, m, param) + { + Eolian_Type type = _types_extract(param->type, strlen(param->type)); + Eolian_Function_Parameter p = database_property_key_add( + foo_id, type, param->name, param->comment); + database_parameter_nonull_set(p, param->nonull); + } + EINA_LIST_FOREACH(prop->values, m, param) + { + Eolian_Type type = _types_extract(param->type, strlen(param->type)); + Eolian_Function_Parameter p = database_property_value_add( + foo_id, type, param->name, param->comment); + database_parameter_nonull_set(p, param->nonull); + } + EINA_LIST_FOREACH(prop->accessors, m, accessor) + { + database_function_type_set(foo_id, (accessor->type == SETTER?EOLIAN_PROP_SET:EOLIAN_PROP_GET)); + if (accessor->ret && accessor->ret->type) + { + Eolian_Function_Type ftype = + accessor->type == SETTER?EOLIAN_PROP_SET:EOLIAN_PROP_GET; + Eolian_Type types = _types_extract(accessor->ret->type, strlen(accessor->ret->type)); + database_function_return_type_set(foo_id, ftype, types); + database_function_return_comment_set(foo_id, + ftype, accessor->ret->comment); + database_function_return_flag_set_as_warn_unused(foo_id, + ftype, accessor->ret->warn_unused); + database_function_return_dflt_val_set(foo_id, + ftype, accessor->ret->dflt_ret_val); + } + if (accessor->legacy) + { + database_function_data_set(foo_id, + (accessor->type == SETTER?EOLIAN_LEGACY_SET:EOLIAN_LEGACY_GET), + accessor->legacy); + } + database_function_description_set(foo_id, + (accessor->type == SETTER?EOLIAN_COMMENT_SET:EOLIAN_COMMENT_GET), + accessor->comment); + Eo_Accessor_Param *acc_param; + Eina_List *m2; + EINA_LIST_FOREACH(accessor->params, m2, acc_param) + { + Eolian_Function_Parameter desc = eolian_function_parameter_get(foo_id, acc_param->name); + if (!desc) + { + printf("Error - %s not known as parameter of property %s\n", acc_param->name, prop->name); + } + else + if (strstr(acc_param->attrs, "const")) + { + database_parameter_const_attribute_set(desc, accessor->type == GETTER, EINA_TRUE); + } + } + } + if (!prop->accessors) database_function_type_set(foo_id, EOLIAN_PROPERTY); + database_class_function_add(class, foo_id); + } + + EINA_LIST_FOREACH(kls->methods, l, meth) + { + Eolian_Function foo_id = database_function_new(meth->name, EOLIAN_METHOD); + database_function_scope_set(foo_id, meth->scope); + database_class_function_add(class, foo_id); + if (meth->ret) + { + Eolian_Type types = _types_extract(meth->ret->type, strlen(meth->ret->type)); + database_function_return_type_set(foo_id, EOLIAN_METHOD, types); + database_function_return_comment_set(foo_id, EOLIAN_METHOD, meth->ret->comment); + database_function_return_flag_set_as_warn_unused(foo_id, + EOLIAN_METHOD, meth->ret->warn_unused); + database_function_return_dflt_val_set(foo_id, + EOLIAN_METHOD, meth->ret->dflt_ret_val); + } + database_function_description_set(foo_id, EOLIAN_COMMENT, meth->comment); + database_function_data_set(foo_id, EOLIAN_LEGACY, meth->legacy); + database_function_object_set_as_const(foo_id, meth->obj_const); + EINA_LIST_FOREACH(meth->params, m, param) + { + Eolian_Type type = _types_extract(param->type, strlen(param->type)); + Eolian_Function_Parameter p = database_method_parameter_add(foo_id, + (Eolian_Parameter_Dir)param->way, type, param->name, param->comment); + database_parameter_nonull_set(p, param->nonull); + } + } + + EINA_LIST_FOREACH(kls->implements, l, impl) + { + const char *impl_name = impl->meth_name; + if (!strcmp(impl_name, "class::constructor")) + { + database_class_ctor_enable_set(class, EINA_TRUE); + continue; + } + if (!strcmp(impl_name, "class::destructor")) + { + database_class_dtor_enable_set(class, EINA_TRUE); + continue; + } + if (!strncmp(impl_name, "virtual::", 9)) + { + char *virtual_name = strdup(impl_name); + char *func = strstr(virtual_name, "::"); + if (func) *func = '\0'; + func += 2; + Eolian_Function_Type ftype = EOLIAN_UNRESOLVED; + char *type_as_str = strstr(func, "::"); + if (type_as_str) + { + *type_as_str = '\0'; + if (!strcmp(type_as_str+2, "set")) ftype = EOLIAN_PROP_SET; + else if (!strcmp(type_as_str+2, "get")) ftype = EOLIAN_PROP_GET; + } + /* Search the function into the existing functions of the current class */ + Eolian_Function foo_id = eolian_class_function_find_by_name( + class, func, ftype); + free(virtual_name); + if (!foo_id) + { + ERR("Error - %s not known in class %s", impl_name + 9, eolian_class_name_get(class)); + goto end; + } + database_function_set_as_virtual_pure(foo_id, ftype); + continue; + } + Eolian_Implement impl_desc = database_implement_new(impl_name); + database_class_implement_add(class, impl_desc); + } + + EINA_LIST_FOREACH(kls->events, l, event) + { + Eolian_Event ev = database_event_new(event->name, event->type, event->comment); + database_class_event_add(class, ev); + } + + } + + EINA_LIST_FOREACH(ls->typedefs, k, type_def) + { + database_type_add(type_def->alias, _types_extract(type_def->type, strlen(type_def->type))); + } + + ret = EINA_TRUE; +end: + if (ls) eo_lexer_free(ls); + return ret; +} diff --git a/src/lib/eolian/eo_parser.h b/src/lib/eolian/eo_parser.h new file mode 100644 index 0000000000..4d0d048f7c --- /dev/null +++ b/src/lib/eolian/eo_parser.h @@ -0,0 +1,10 @@ +#ifndef __EO_PARSER_H__ +#define __EO_PARSER_H__ + +#include "eo_lexer.h" + +Eina_Bool eo_parser_walk (Eo_Lexer *ls); +void eo_parser_dump (Eo_Lexer *ls); +Eina_Bool eo_parser_database_fill(const char *filename); + +#endif /* __EO_PARSER_H__ */
\ No newline at end of file diff --git a/src/lib/eolian/eolian.c b/src/lib/eolian/eolian.c index 94a00b4a97..7a958e4c38 100644 --- a/src/lib/eolian/eolian.c +++ b/src/lib/eolian/eolian.c @@ -1,4 +1,4 @@ -#include "eo_lexer.h" +#include "eo_parser.h" #include "eolian_database.h" static int _eolian_init_counter = 0; @@ -23,7 +23,7 @@ EAPI int eolian_init(void) INF("Init"); database_init(); - eo_tokenizer_init(); + eo_lexer_init(); return ++_eolian_init_counter; } @@ -43,7 +43,7 @@ EAPI int eolian_shutdown(void) EINA_LOG_STATE_START, EINA_LOG_STATE_SHUTDOWN); - eo_tokenizer_shutdown(); + eo_lexer_shutdown(); database_shutdown(); eina_log_domain_unregister(_eolian_log_dom); diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c index 323f89458f..4572156f4e 100644 --- a/src/lib/eolian/eolian_database.c +++ b/src/lib/eolian/eolian_database.c @@ -1,5 +1,5 @@ #include <Eina.h> -#include "eo_lexer.h" +#include "eo_parser.h" #include "eolian_database.h" #define PROP_GET_RETURN_DFLT_VAL "property_get_return_dflt_val" @@ -1413,7 +1413,7 @@ EAPI Eina_Bool eolian_eo_file_parse(const char *filepath) Eolian_Implement impl; if (!class) { - if (!eo_tokenizer_database_fill(filepath)) return EINA_FALSE; + if (!eo_parser_database_fill(filepath)) return EINA_FALSE; class = eolian_class_find_by_file(filepath); if (!class) { |