is_eo = eina_str_has_suffix(eo_filename, EO_SUFFIX);
- if (!is_eo && !eina_str_has_suffix(eo_filename, EOT_SUFFIX))
- {
- ERR("The input file %s doesn't have a correct extension (.eo/.eot).\n", eo_filename);
- goto end;
- }
-
- if ((is_eo && !eolian_eo_file_parse(eo_filename)) ||
- (!is_eo && !eolian_eot_file_parse(eo_filename)))
+ if (!eolian_file_parse(eo_filename))
{
ERR("Error during parsing file %s\n", eo_filename);
goto end;
}
if (!opts.in_file.empty())
{
- if (!::eolian_eo_file_parse(opts.in_file.c_str()))
+ if (!::eolian_file_parse(opts.in_file.c_str()))
{
EINA_CXX_DOM_LOG_ERR(eolian_cxx::domain)
<< "Failed parsing: " << opts.in_file << ".";
EOLIAN_UNOP_BNOT, /* ~ int */
} Eolian_Unary_Operator;
- Eina_Bool eolian_eo_file_parse(const char *filename);
- Eina_Bool eolian_eot_file_parse(const char *filepath);
+ Eina_Bool eolian_file_parse(const char *filepath);
Eina_Iterator *eolian_all_eo_file_paths_get(void);
Eina_Iterator *eolian_all_eot_file_paths_get(void);
Eina_Iterator *eolian_all_eo_files_get(void);
return eolian.eolian_system_directory_scan() ~= 0
end
-M.all_eo_files_parse = function()
- return eolian.eolian_all_eo_files_parse() ~= 0
+M.file_parse = function(fpath)
+ return eolian.eolian_file_parse(fpath) ~= 0
end
-M.eo_file_parse = function(fname)
- return eolian.eolian_eo_file_parse(fname) ~= 0
+M.all_eo_files_parse = function()
+ return eolian.eolian_all_eo_files_parse() ~= 0
end
M.all_eot_files_parse = function()
return eolian.eolian_database_validate() ~= 0
end
-M.eot_file_parse = function(fname)
- return eolian.eolian_eot_file_parse(fname) ~= 0
-end
-
M.show_class = function(klass)
return eolian.eolian_show_class(klass) ~= 0
end
} Eolian_Unary_Operator;
/*
- * @brief Parse a given .eo file and fill the database.
+ * @brief Parse the given .eo or .eot file and fill the database.
*
- * During parsing, the class described into the .eo file is created with
- * all the information related to this class.
- *
- * @param[in] filename Name of the file to parse.
- * @see eolian_eot_file_parse
- *
- * @ingroup Eolian
- */
-EAPI Eina_Bool eolian_eo_file_parse(const char *filename);
-
-/*
- * @brief Parse a given .eot file and fill the database.
- *
- * @param[in] filename Name of the file to parse.
- * @see eolian_eo_file_parse
+ * @param[in] filepath Path to the file to parse.
*
* @ingroup Eolian
*/
-EAPI Eina_Bool eolian_eot_file_parse(const char *filepath);
+EAPI Eina_Bool eolian_file_parse(const char *filepath);
/*
* @brief Get an iterator to all .eo file names with paths.
snprintf(buf, sizeof(buf), "cyclic dependency '%s'", name);
eo_lexer_syntax_error(ls, buf);
}
- if (!eolian_eo_file_parse(fname))
+ if (!eo_parser_database_fill(fname, EINA_FALSE))
{
char buf[PATH_MAX];
eo_lexer_context_restore(ls);
}
EAPI Eina_Bool
-eolian_eot_file_parse(const char *filepath)
+eolian_file_parse(const char *filepath)
{
+ Eina_Bool is_eo;
if (_database_init_count <= 0)
return EINA_FALSE;
- return eo_parser_database_fill(filepath, EINA_TRUE);
-}
-
-EAPI Eina_Bool
-eolian_eo_file_parse(const char *filepath)
-{
- if (_database_init_count <= 0)
- return EINA_FALSE;
- return eo_parser_database_fill(filepath, EINA_FALSE);
+ is_eo = eina_str_has_suffix(filepath, EO_SUFFIX);
+ if (!is_eo && !eina_str_has_suffix(filepath, EOT_SUFFIX))
+ {
+ fprintf(stderr, "eolian: file '%s' doesn't have a correct extension\n", filepath);
+ return EINA_FALSE;
+ }
+ return eo_parser_database_fill(filepath, !is_eo);
}
static Eina_Bool _tfile_parse(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata)
{
Eina_Bool *ret = fdata;
- if (*ret) *ret = eolian_eot_file_parse(data);
+ if (*ret) *ret = eo_parser_database_fill(data, EINA_TRUE);
return *ret;
}
static Eina_Bool _file_parse(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata)
{
Eina_Bool *ret = fdata;
- if (*ret) *ret = eolian_eo_file_parse(data);
+ if (*ret) *ret = eo_parser_database_fill(data, EINA_FALSE);
return *ret;
}
end
M.generate = function(fname, fstream)
- if not eolian.eo_file_parse(fname) then
+ if not eolian.file_parse(fname) then
error("Failed parsing file: " .. fname)
end
if not eolian.database_validate() then
eolian_init();
/* Parsing */
fail_if(!eolian_directory_scan(PACKAGE_DATA_DIR"/data"));
- fail_if(!eolian_eo_file_parse(PACKAGE_DATA_DIR"/data/nmsp1_class1.eo"));
+ fail_if(!eolian_file_parse(PACKAGE_DATA_DIR"/data/nmsp1_class1.eo"));
/* Classes existence */
fail_if(!(class11 = eolian_class_get_by_name("nmsp1.class1")));
eolian_init();
/* Parsing */
- fail_if(!eolian_eo_file_parse(PACKAGE_DATA_DIR"/data/events.eo"));
+ fail_if(!eolian_file_parse(PACKAGE_DATA_DIR"/data/events.eo"));
/* Class */
fail_if(!(class = eolian_class_get_by_name("Events")));
eolian_init();
/* Parsing */
fail_if(!eolian_directory_scan(PACKAGE_DATA_DIR"/data"));
- fail_if(!eolian_eo_file_parse(PACKAGE_DATA_DIR"/data/override.eo"));
+ fail_if(!eolian_file_parse(PACKAGE_DATA_DIR"/data/override.eo"));
/* Class */
fail_if(!(class = eolian_class_get_by_name("Override")));
START_TEST(eolian_consts)
{
const Eolian_Function *fid = NULL;
- const Eolian_Function_Parameter *param = NULL;
const Eolian_Class *class;
eolian_init();
/* Parsing */
- fail_if(!eolian_eo_file_parse(PACKAGE_DATA_DIR"/data/consts.eo"));
+ fail_if(!eolian_file_parse(PACKAGE_DATA_DIR"/data/consts.eo"));
fail_if(!(class = eolian_class_get_by_name("Consts")));
/* Method */
eolian_init();
/* Parsing */
fail_if(!eolian_directory_scan(PACKAGE_DATA_DIR"/data"));
- fail_if(!eolian_eo_file_parse(PACKAGE_DATA_DIR"/data/ctor_dtor.eo"));
+ fail_if(!eolian_file_parse(PACKAGE_DATA_DIR"/data/ctor_dtor.eo"));
fail_if(!(class = eolian_class_get_by_name("Ctor_Dtor")));
fail_if(!(base = eolian_class_get_by_name("Base")));
eolian_init();
/* Parsing */
- fail_if(!eolian_eo_file_parse(PACKAGE_DATA_DIR"/data/typedef.eo"));
+ fail_if(!eolian_file_parse(PACKAGE_DATA_DIR"/data/typedef.eo"));
/* Check that the class Dummy is still readable */
fail_if(!(class = eolian_class_get_by_name("Typedef")));
eolian_init();
/* Parsing */
- fail_if(!eolian_eo_file_parse(PACKAGE_DATA_DIR"/data/complex_type.eo"));
+ fail_if(!eolian_file_parse(PACKAGE_DATA_DIR"/data/complex_type.eo"));
fail_if(!(class = eolian_class_get_by_name("Complex_Type")));
/* Properties return type */
eolian_init();
/* Parsing */
- fail_if(!eolian_eo_file_parse(PACKAGE_DATA_DIR"/data/scope.eo"));
+ fail_if(!eolian_file_parse(PACKAGE_DATA_DIR"/data/scope.eo"));
fail_if(!(class = eolian_class_get_by_name("Scope")));
/* Property scope */
eolian_init();
/* Parsing */
- fail_if(!eolian_eo_file_parse(PACKAGE_DATA_DIR"/data/class_simple.eo"));
+ fail_if(!eolian_file_parse(PACKAGE_DATA_DIR"/data/class_simple.eo"));
fail_if(!(class = eolian_class_get_by_name("Class_Simple")));
fail_if(eolian_class_get_by_file("class_simple.eo") != class);
fail_if(strcmp(eolian_class_file_get(class), "class_simple.eo"));
eolian_init();
/* Parsing */
- fail_if(!eolian_eo_file_parse(PACKAGE_DATA_DIR"/data/struct.eo"));
+ fail_if(!eolian_file_parse(PACKAGE_DATA_DIR"/data/struct.eo"));
/* Check that the class Dummy is still readable */
fail_if(!(class = eolian_class_get_by_name("Struct")));
eolian_init();
/* Parsing */
- fail_if(!eolian_eo_file_parse(PACKAGE_DATA_DIR"/data/extern.eo"));
+ fail_if(!eolian_file_parse(PACKAGE_DATA_DIR"/data/extern.eo"));
/* Check that the class Dummy is still readable */
fail_if(!(class = eolian_class_get_by_name("Extern")));
eolian_init();
/* Parsing */
- fail_if(!eolian_eo_file_parse(PACKAGE_DATA_DIR"/data/var.eo"));
+ fail_if(!eolian_file_parse(PACKAGE_DATA_DIR"/data/var.eo"));
/* Check that the class Dummy is still readable */
fail_if(!(class = eolian_class_get_by_name("Var")));
eolian_init();
/* Parsing */
- fail_if(!eolian_eo_file_parse(PACKAGE_DATA_DIR"/data/enum.eo"));
+ fail_if(!eolian_file_parse(PACKAGE_DATA_DIR"/data/enum.eo"));
/* Check that the class Dummy is still readable */
fail_if(!(class = eolian_class_get_by_name("Enum")));
eolian_init();
/* Parsing */
- fail_if(!eolian_eo_file_parse(PACKAGE_DATA_DIR"/data/class_funcs.eo"));
+ fail_if(!eolian_file_parse(PACKAGE_DATA_DIR"/data/class_funcs.eo"));
fail_if(!(class = eolian_class_get_by_name("Class_Funcs")));
/* Class properties */
eolian_init();
/* Parsing */
- fail_if(!eolian_eo_file_parse(PACKAGE_DATA_DIR"/data/free_func.eo"));
+ fail_if(!eolian_file_parse(PACKAGE_DATA_DIR"/data/free_func.eo"));
/* Check that the class Dummy is still readable */
fail_if(!(class = eolian_class_get_by_name("Free_Func")));
eolian_init();
/* Parsing */
- fail_if(!eolian_eo_file_parse(PACKAGE_DATA_DIR"/data/null.eo"));
+ fail_if(!eolian_file_parse(PACKAGE_DATA_DIR"/data/null.eo"));
fail_if(!(class = eolian_class_get_by_name("Null")));
fail_if(!(func = eolian_class_function_get_by_name(class, "foo", EOLIAN_METHOD)));
fail_if(!eolian_directory_scan(PACKAGE_DATA_DIR"/data"));
- fail_if(!eolian_eo_file_parse(PACKAGE_DATA_DIR"/data/import.eo"));
+ fail_if(!eolian_file_parse(PACKAGE_DATA_DIR"/data/import.eo"));
fail_if(!(class = eolian_class_get_by_name("Import")));
fail_if(!(type = eolian_type_alias_get_by_name("Imported")));