Classes | |
class | class_error_container |
Container of errors, which are generated while schema generator tool is parsing source files. More... | |
class | class_key |
class_key is used to save the information about one key. More... | |
class | class_source_parser |
class | class_tag |
Stores information about tag. More... | |
class | schema_validator |
Realization of serialization/validator.hpp abstract validator. More... | |
Functions | |
static std::string | at (const std::string &file, int line) |
static void | print_output (const std::string &message, bool flag_exception=false) |
static void | extra_tag_error (const std::string &file, int line, const std::string &name, int n, const std::string &parent, bool flag_exception) |
static void | wrong_tag_error (const std::string &file, int line, const std::string &name, const std::string &parent, bool flag_exception) |
static void | missing_tag_error (const std::string &file, int line, const std::string &name, int n, const std::string &parent, bool flag_exception) |
static void | extra_key_error (const std::string &file, int line, const std::string &tag, const std::string &key, bool flag_exception) |
static void | missing_key_error (const std::string &file, int line, const std::string &tag, const std::string &key, bool flag_exception) |
static void | wrong_value_error (const std::string &file, int line, const std::string &tag, const std::string &key, const std::string &value, bool flag_exception) |
static std::string | sub (const std::string &s) |
Private function to surround an argument with brackets. More... | |
static std::string | quote (const std::string &s) |
Private function to surround argument with not mandatory quotes. More... | |
static std::string | property (const std::string &name, const std::string &value="") |
Creates a property template. More... | |
const std::string & | get_valid () |
A few regex templates. More... | |
const std::string & | get_wiki () |
Template to check line is beginnnig of Wiki block. More... | |
const std::string & | get_parent_begin () |
Template to check begining of parent block. More... | |
const std::string & | get_parent_end () |
Template to check closing of parent block. More... | |
const std::string & | get_tag_begin () |
Template to check if line contains opening of tag block. More... | |
const std::string & | get_tag_end () |
Template to check end of tag block. More... | |
const std::string & | get_allow_link () |
Template to check allow{link} block. More... | |
const std::string & | get_allow_global () |
Template to check allow{global} block. More... | |
static const std::string & | get_allow_type () |
static const std::string & | get_remove_type () |
static const std::string & | get_remove_key () |
const std::string & | get_table_key_begin () |
Template to check begining of table{config} storing key values. More... | |
const std::string & | get_table_end () |
Template to check if table is closed. More... | |
const std::string & | get_key_value () |
Template to get key value. More... | |
void | test_regex (std::ostream &f) |
Writes to the file regex templates list. More... | |
Variables | |
static lg::log_domain | log_validation ("validation") |
const std::string | valid = "^\\s*\\*\\s*" |
Little parts of regex templates used to parse Wml annoations. More... | |
const std::string | wiki_begin ="^\\s*/\\*(?:WIKI|SCHEMA)" |
begining of wiki block More... | |
const std::string | space ="\\s*" |
whitespace is possible More... | |
const std::string | equals ="=" |
sigh "=" More... | |
const std::string | quote_symbol ="\"?" |
non-mandatory sign " More... | |
const std::string | block_begin ="@begin" |
begining of the block. More... | |
const std::string | block_end ="@end" |
end of block More... | |
const std::string | allow ="@allow" |
allow directive More... | |
const std::string | remove ="@remove" |
remove directive More... | |
const std::string | property_open ="\\{" |
sign "{" - curly bracket More... | |
const std::string | property_close = "\\}" |
sign "}" - another curly bracket More... | |
const std::string | name_type = "[a-z][a-zA-Z0-9_-]*" |
type of possible name identificator More... | |
const std::string | parent_type = "/|(?:[a-z][a-zA-Z0-9_-]*/)+" |
type of possible parent indentificator More... | |
const std::string | link_type ="(?:[a-z][a-zA-Z0-9_-]*/)*(?:[a-z][a-zA-Z0-9_-]*)" |
type of possible link indentificator More... | |
const std::string | number ="\\d*" |
template to number regex More... | |
const std::string | sign ="-?" |
sign "-" - hyphen-minus used to set sign of signed integer More... | |
const std::string | eol =".*$" |
end of line + possible various character before. More... | |
|
static |
Definition at line 32 of file schema_validator.cpp.
References lineno_string().
Referenced by wb::move::calculate_new_route(), wb::move::check_validity(), extra_key_error(), extra_tag_error(), wb::future_visible_unit(), gui2::team_mode_controller::handle_stuff_list_selection(), impl_unit_attacks_get(), missing_key_error(), missing_tag_error(), wb::recall::recall(), wb::highlighter::set_mouseover_hex(), gui2::side_controller::show_nicks_list(), gui2::tmp_change_control::controller::show_sides_list(), unit_weapons(), wb::manager::update_plan_hiding(), wrong_tag_error(), and wrong_value_error().
|
static |
Definition at line 82 of file schema_validator.cpp.
References at(), and print_output().
Referenced by schema_validation::schema_validator::print().
|
static |
Definition at line 52 of file schema_validator.cpp.
References at(), and print_output().
Referenced by schema_validation::schema_validator::print().
const std::string & schema_validation::get_allow_global | ( | ) |
Template to check allow{global} block.
Definition at line 150 of file sourceparser.cpp.
References eol, property(), and sub().
Referenced by schema_validation::class_source_parser::check_allow_global(), and test_regex().
const std::string & schema_validation::get_allow_link | ( | ) |
Template to check allow{link} block.
Definition at line 144 of file sourceparser.cpp.
References eol, property(), and sub().
Referenced by schema_validation::class_source_parser::check_allow_link(), and test_regex().
|
static |
Definition at line 156 of file sourceparser.cpp.
References eol, property(), and sub().
Referenced by schema_validation::class_source_parser::check_allow_type(), and test_regex().
const std::string & schema_validation::get_key_value | ( | ) |
Template to get key value.
Definition at line 189 of file sourceparser.cpp.
References eol, quote(), and sub().
Referenced by schema_validation::class_source_parser::parse_keys(), and test_regex().
const std::string & schema_validation::get_parent_begin | ( | ) |
Template to check begining of parent block.
Definition at line 109 of file sourceparser.cpp.
References eol, property(), and sub().
Referenced by schema_validation::class_source_parser::check_parent_begin(), and test_regex().
const std::string & schema_validation::get_parent_end | ( | ) |
Template to check closing of parent block.
Definition at line 117 of file sourceparser.cpp.
References eol, property(), and sub().
Referenced by schema_validation::class_source_parser::check_parent_end(), and test_regex().
|
static |
Definition at line 169 of file sourceparser.cpp.
References eol, property(), and sub().
Referenced by schema_validation::class_source_parser::check_remove_key().
|
static |
Definition at line 163 of file sourceparser.cpp.
References eol, property(), and sub().
Referenced by schema_validation::class_source_parser::check_remove_type().
const std::string & schema_validation::get_table_end | ( | ) |
Template to check if table is closed.
Definition at line 182 of file sourceparser.cpp.
References eol, and property().
Referenced by schema_validation::class_source_parser::check_keys_end(), and test_regex().
const std::string & schema_validation::get_table_key_begin | ( | ) |
Template to check begining of table{config} storing key values.
Definition at line 176 of file sourceparser.cpp.
References eol, and property().
Referenced by schema_validation::class_source_parser::check_keys_begin(), and test_regex().
const std::string & schema_validation::get_tag_begin | ( | ) |
Template to check if line contains opening of tag block.
Definition at line 123 of file sourceparser.cpp.
References eol, property(), and sub().
Referenced by schema_validation::class_source_parser::check_tag_begin(), and test_regex().
const std::string & schema_validation::get_tag_end | ( | ) |
Template to check end of tag block.
Definition at line 137 of file sourceparser.cpp.
References eol, property(), and sub().
Referenced by schema_validation::class_source_parser::check_tag_end(), and test_regex().
const std::string & schema_validation::get_valid | ( | ) |
A few regex templates.
Please notice, that adding any regex template, schould be called in test_regexes()Template to check line of beeing valid
Definition at line 100 of file sourceparser.cpp.
References valid.
Referenced by schema_validation::class_source_parser::check_valid(), and test_regex().
const std::string & schema_validation::get_wiki | ( | ) |
Template to check line is beginnnig of Wiki block.
Definition at line 104 of file sourceparser.cpp.
References eol.
Referenced by schema_validation::class_source_parser::check_wiki(), and test_regex().
|
static |
Definition at line 92 of file schema_validator.cpp.
References at(), and print_output().
Referenced by schema_validation::schema_validator::print().
|
static |
Definition at line 72 of file schema_validator.cpp.
References at(), and print_output().
Referenced by schema_validation::schema_validator::print().
|
static |
Definition at line 38 of file schema_validator.cpp.
References ERR_VL.
Referenced by extra_key_error(), extra_tag_error(), missing_key_error(), missing_tag_error(), wrong_tag_error(), and wrong_value_error().
|
static |
Creates a property template.
name | Name of property |
value | Type of property value If value is empty creates simple property like {table} Else creates a named property like {name="[name_type_template]"} |
Definition at line 91 of file sourceparser.cpp.
References property_close, and quote().
Referenced by get_allow_global(), get_allow_link(), get_allow_type(), get_parent_begin(), get_parent_end(), get_remove_key(), get_remove_type(), get_table_end(), get_table_key_begin(), get_tag_begin(), and get_tag_end().
|
static |
Private function to surround argument with not mandatory quotes.
Is used when creating properties
Definition at line 80 of file sourceparser.cpp.
References quote_symbol.
Referenced by get_key_value(), and property().
|
static |
Private function to surround an argument with brackets.
This allows substitutions :-)
Definition at line 73 of file sourceparser.cpp.
Referenced by schema_validation::class_source_parser::check_allow_global(), schema_validation::class_source_parser::check_allow_link(), schema_validation::class_source_parser::check_allow_type(), schema_validation::class_source_parser::check_parent_begin(), schema_validation::class_source_parser::check_parent_end(), schema_validation::class_source_parser::check_remove_key(), schema_validation::class_source_parser::check_remove_type(), schema_validation::class_source_parser::check_tag_begin(), schema_validation::class_source_parser::check_tag_end(), unit_abilities::effect::effect(), get_allow_global(), get_allow_link(), get_allow_type(), get_key_value(), get_parent_begin(), get_parent_end(), get_remove_key(), get_remove_type(), get_tag_begin(), get_tag_end(), map_location::parse_direction(), schema_validation::class_source_parser::parse_keys(), split_text(), and schema_validation::schema_validator::validate_key().
void schema_validation::test_regex | ( | std::ostream & | f | ) |
Writes to the file regex templates list.
Definition at line 197 of file sourceparser.cpp.
References get_allow_global(), get_allow_link(), get_allow_type(), get_key_value(), get_parent_begin(), get_parent_end(), get_table_end(), get_table_key_begin(), get_tag_begin(), get_tag_end(), get_valid(), and get_wiki().
Referenced by main().
|
static |
Definition at line 62 of file schema_validator.cpp.
References at(), and print_output().
Referenced by schema_validation::schema_validator::open_tag(), and schema_validation::schema_validator::print().
|
static |
Definition at line 102 of file schema_validator.cpp.
References at(), and print_output().
Referenced by schema_validation::schema_validator::print().
const std::string schema_validation::allow ="@allow" |
allow directive
Definition at line 44 of file sourceparser.cpp.
const std::string schema_validation::block_begin ="@begin" |
begining of the block.
Definition at line 40 of file sourceparser.cpp.
const std::string schema_validation::block_end ="@end" |
end of block
Definition at line 42 of file sourceparser.cpp.
const std::string schema_validation::eol =".*$" |
end of line + possible various character before.
Used to close template. ".*" is used cause I dont want to get error every misprint whitespace after annotation element
Definition at line 68 of file sourceparser.cpp.
Referenced by get_allow_global(), get_allow_link(), get_allow_type(), get_key_value(), get_parent_begin(), get_parent_end(), get_remove_key(), get_remove_type(), get_table_end(), get_table_key_begin(), get_tag_begin(), get_tag_end(), get_wiki(), print_option(), and display::refresh_report().
const std::string schema_validation::equals ="=" |
sigh "="
Definition at line 36 of file sourceparser.cpp.
const std::string schema_validation::link_type ="(?:[a-z][a-zA-Z0-9_-]*/)*(?:[a-z][a-zA-Z0-9_-]*)" |
type of possible link indentificator
Definition at line 56 of file sourceparser.cpp.
|
static |
const std::string schema_validation::name_type = "[a-z][a-zA-Z0-9_-]*" |
type of possible name identificator
Definition at line 52 of file sourceparser.cpp.
Referenced by default_map_generator_job::default_generate_map().
const std::string schema_validation::number ="\\d*" |
template to number regex
Definition at line 58 of file sourceparser.cpp.
Referenced by utils::apply_modifier(), wb::draw_numbers(), ai::default_recruitment::recruitment::get_most_important_job(), wb::side_actions::get_numbers(), lua_gui2::intf_remove_dialog_item(), ai::default_recruitment::recruitment::limit_ok(), wesnothd::ban_manager::parse_time(), and t_translation::string_to_builder_number_().
const std::string schema_validation::parent_type = "/|(?:[a-z][a-zA-Z0-9_-]*/)+" |
type of possible parent indentificator
Definition at line 54 of file sourceparser.cpp.
const std::string schema_validation::property_close = "\\}" |
sign "}" - another curly bracket
Definition at line 50 of file sourceparser.cpp.
Referenced by property().
const std::string schema_validation::property_open ="\\{" |
sign "{" - curly bracket
Definition at line 48 of file sourceparser.cpp.
const std::string schema_validation::quote_symbol ="\"?" |
const std::string schema_validation::remove ="@remove" |
remove directive
Definition at line 46 of file sourceparser.cpp.
Referenced by preferences::editor::add_recent_files_entry(), BOOST_AUTO_TEST_CASE(), network_worker_pool::close_socket(), hotkey::del_hotkey(), filesystem::delete_directory(), filesystem::delete_file(), network_worker_pool::detect_error(), wb::highlighter::find_secondary_highlights(), help::generate_about_text(), mp::ui::handle_key_event(), wesnothd::game::remove_player(), preferences::editor::remove_recent_files_entry(), fake_unit_manager::remove_temporary_unit(), ai::ai_default_rca::get_villages_phase::remove_village(), gamemap::set_terrain(), terrain_type::terrain_type(), wesnothd::game::transfer_side_control(), wesnothd::game::unban_user(), gui2::unit_test_mark_as_tested(), gui2::unit_test_mark_popup_as_tested(), wesnothd::game::unmute_observer(), and events::pump_monitor::~pump_monitor().
const std::string schema_validation::sign ="-?" |
sign "-" - hyphen-minus used to set sign of signed integer
Definition at line 60 of file sourceparser.cpp.
Referenced by gui::slider::set_value().
const std::string schema_validation::space ="\\s*" |
whitespace is possible
Definition at line 34 of file sourceparser.cpp.
Referenced by events::console_handler::get_command_flags_description(), and mp::lobby::layout_children().
const std::string schema_validation::valid = "^\\s*\\*\\s*" |
Little parts of regex templates used to parse Wml annoations.
For details, look http://wiki.wesnoth.org/WML_Annotation_Format , pleaseline is valid
Definition at line 30 of file sourceparser.cpp.
Referenced by pathfind::a_star_search(), archive_dir(), attack_info(), ai::cfun_ai_is_dst_src_enemy_valid(), ai::cfun_ai_is_dst_src_valid(), ai::cfun_ai_is_src_dst_enemy_valid(), ai::cfun_ai_is_src_dst_valid(), unit_type::check_id(), schema_validation::class_source_parser::check_valid(), ai::lua_sticky_candidate_action_wrapper::evaluate(), get_valid(), display::scroll_to_tiles(), gamemap::set_special_location(), game_board::team_is_defeated(), verify_and_clear_global_variable(), verify_and_get_global_variable(), and verify_and_set_global_variable().
const std::string schema_validation::wiki_begin ="^\\s*/\\*(?:WIKI|SCHEMA)" |
begining of wiki block
Definition at line 32 of file sourceparser.cpp.