WML preprocessor. More...
#include "serialization/preprocessor.hpp"#include "buffered_istream.hpp"#include "config.hpp"#include "log.hpp"#include "serialization/binary_or_text.hpp"#include "serialization/parser.hpp"#include "serialization/string_utils.hpp"#include "game_version.hpp"#include "wesconfig.h"#include "deprecation.hpp"#include <stdexcept>#include <deque>Go to the source code of this file.
Classes | |
| class | preprocessor |
| Base class for preprocessing an input. More... | |
| class | preprocessor_streambuf |
| Target for sending preprocessed output. More... | |
| class | preprocessor_file |
| Specialized preprocessor for handling a file or a set of files. More... | |
| class | preprocessor_data |
| Specialized preprocessor for handling any kind of input stream. More... | |
| struct | preprocessor_data::token_desc |
| Description of a preprocessing chunk. More... | |
| class | preprocessor_istream |
Macros | |
| #define | ERR_PREPROC LOG_STREAM(err, log_preprocessor) |
| #define | WRN_PREPROC LOG_STREAM(warn, log_preprocessor) |
| #define | LOG_PREPROC LOG_STREAM(info, log_preprocessor) |
| #define | DBG_PREPROC LOG_STREAM(debug, log_preprocessor) |
Functions | |
| static std::string | get_filename (const std::string &file_code) |
| static std::string | get_file_code (const std::string &filename) |
| static std::string | get_location (const std::string &loc) |
| std::ostream & | operator<< (std::ostream &stream, const preproc_define &def) |
| std::ostream & | operator<< (std::ostream &stream, const preproc_map::value_type &def) |
| std::string | lineno_string (const std::string &lineno) |
| bool | operator== (preprocessor_data::token_desc::token_type, char) |
| bool | operator== (char lhs, preprocessor_data::token_desc::token_type rhs) |
| bool | operator!= (preprocessor_data::token_desc::token_type rhs, char lhs) |
| bool | operator!= (char lhs, preprocessor_data::token_desc::token_type rhs) |
| filesystem::scoped_istream | preprocess_file (const std::string &fname, preproc_map &defines) |
| Function to use the WML preprocessor on a file. More... | |
| filesystem::scoped_istream | preprocess_file (const std::string &fname) |
| filesystem::scoped_istream | preprocess_string (const std::string &contents, const std::string &textdomain) |
| filesystem::scoped_istream | preprocess_string (const std::string &contents, const std::string &textdomain, preproc_map &defines) |
| Function to use the WML preprocessor on a string. More... | |
| void | preprocess_resource (const std::string &res_name, preproc_map *defines_map, bool write_cfg, bool write_plain_cfg, const std::string &parent_directory) |
Variables | |
| static lg::log_domain | log_preprocessor ("preprocessor") |
| static const std::string | current_file_str = "CURRENT_FILE" |
| static const std::string | current_dir_str = "CURRENT_DIRECTORY" |
| static const std::string | left_curly_str = "LEFT_BRACE" |
| static const std::string | right_curly_str = "RIGHT_BRACE" |
| static std::map< std::string, int > | file_number_map |
| static bool | encode_filename = true |
| static std::string | preprocessor_error_detail_prefix = "\n " |
WML preprocessor.
Definition in file preprocessor.cpp.
| #define DBG_PREPROC LOG_STREAM(debug, log_preprocessor) |
Definition at line 41 of file preprocessor.cpp.
| #define ERR_PREPROC LOG_STREAM(err, log_preprocessor) |
Definition at line 38 of file preprocessor.cpp.
| #define LOG_PREPROC LOG_STREAM(info, log_preprocessor) |
Definition at line 40 of file preprocessor.cpp.
| #define WRN_PREPROC LOG_STREAM(warn, log_preprocessor) |
Definition at line 39 of file preprocessor.cpp.
|
static |
Definition at line 77 of file preprocessor.cpp.
References encode_filename, utils::escape(), file_number_map, and filename.
Referenced by preprocessor_data::preprocessor_data().
|
static |
Definition at line 56 of file preprocessor.cpp.
References encode_filename, file_number_map, n, p, and s.
Referenced by preprocessor_data::get_chunk(), preprocessor_streambuf::get_current_file(), get_location(), lineno_string(), editor::context_manager::load_map(), and editor::context_manager::set_window_title().
|
static |
Definition at line 98 of file preprocessor.cpp.
References get_filename(), i, loc, and utils::quoted_split().
Referenced by preprocessor_data::get_chunk(), and preproc_define::write().
| std::string lineno_string | ( | const std::string & | lineno | ) |
Definition at line 521 of file preprocessor.cpp.
References get_filename(), i, draw::line(), preprocessor_error_detail_prefix, and utils::quoted_split().
Referenced by schema_validation::at(), preprocessor_streambuf::error(), preprocessor_data::get_chunk(), and preprocessor_streambuf::warning().
| bool operator!= | ( | char | lhs, |
| preprocessor_data::token_desc::token_type | rhs | ||
| ) |
Definition at line 762 of file preprocessor.cpp.
| bool operator!= | ( | preprocessor_data::token_desc::token_type | rhs, |
| char | lhs | ||
| ) |
Definition at line 757 of file preprocessor.cpp.
| std::ostream& operator<< | ( | std::ostream & | stream, |
| const preproc_define & | def | ||
| ) |
Definition at line 234 of file preprocessor.cpp.
References preproc_define::location, and preproc_define::value.
| std::ostream& operator<< | ( | std::ostream & | stream, |
| const preproc_map::value_type & | def | ||
| ) |
Definition at line 239 of file preprocessor.cpp.
| bool operator== | ( | char | lhs, |
| preprocessor_data::token_desc::token_type | rhs | ||
| ) |
Definition at line 752 of file preprocessor.cpp.
| bool operator== | ( | preprocessor_data::token_desc::token_type | , |
| char | |||
| ) |
Definition at line 747 of file preprocessor.cpp.
| filesystem::scoped_istream preprocess_file | ( | const std::string & | fname | ) |
Definition at line 1742 of file preprocessor.cpp.
References log_scope.
| filesystem::scoped_istream preprocess_file | ( | const std::string & | fname, |
| preproc_map & | defines | ||
| ) |
Function to use the WML preprocessor on a file.
| defines | A map of symbols defined. |
| fname | The file to be preprocessed. |
Definition at line 1733 of file preprocessor.cpp.
References log_scope.
Referenced by BOOST_AUTO_TEST_CASE(), gui2::dialogs::editor_edit_unit::editor_edit_unit(), ai::configuration::get_side_config_from_file(), handle_validate_command(), ng::create_engine::init_all_levels(), lua_wml::intf_load_wml(), font::load_font_config(), load_language_list(), editor::map_context::load_scenario(), gui2::dialogs::editor_edit_pbl::pre_show(), preprocess_and_parse(), preprocess_resource(), achievements::read_achievements_file(), wesnothd::server::read_config(), schema_validation::schema_validator::read_config_file(), game_config::config_cache::read_configs(), editor::map_context::save_schedule(), and editor::map_context::to_config().
| void preprocess_resource | ( | const std::string & | res_name, |
| preproc_map * | defines_map, | ||
| bool | write_cfg, | ||
| bool | write_plain_cfg, | ||
| const std::string & | parent_directory | ||
| ) |
Definition at line 1775 of file preprocessor.cpp.
References filesystem::base_name(), cfg, filesystem::create_directory_if_missing_recursive(), filesystem::directory_name(), filesystem::DO_REORDER, encode_filename, filesystem::ENTIRE_FILE_PATH, filesystem::get_files_in_dir(), filesystem::is_cfg(), filesystem::is_directory(), LOG_PREPROC, filesystem::ostream_file(), preprocess_file(), io::read(), filesystem::SKIP_MEDIA_DIR, io::write(), and filesystem::write_file().
Referenced by handle_preprocess_command().
| filesystem::scoped_istream preprocess_string | ( | const std::string & | contents, |
| const std::string & | textdomain | ||
| ) |
Definition at line 1751 of file preprocessor.cpp.
References log_scope, and game_config::path.
Referenced by handle_preprocess_string(), and editor::map_context::to_config().
| filesystem::scoped_istream preprocess_string | ( | const std::string & | contents, |
| const std::string & | textdomain, | ||
| preproc_map & | defines | ||
| ) |
Function to use the WML preprocessor on a string.
| defines | A map of symbols defined. |
| contents | The string to be preprocessed. |
| textdomain | The textdomain to associate the contents. |
Definition at line 1763 of file preprocessor.cpp.
References log_scope, and game_config::path.
|
static |
Definition at line 44 of file preprocessor.cpp.
Referenced by preprocessor_data::get_chunk().
|
static |
Definition at line 43 of file preprocessor.cpp.
Referenced by preprocessor_data::get_chunk().
|
static |
Definition at line 51 of file preprocessor.cpp.
Referenced by get_file_code(), get_filename(), and preprocess_resource().
|
static |
Definition at line 49 of file preprocessor.cpp.
Referenced by get_file_code(), and get_filename().
|
static |
Definition at line 45 of file preprocessor.cpp.
Referenced by preprocessor_data::get_chunk().
|
static |
|
static |
Definition at line 53 of file preprocessor.cpp.
Referenced by lineno_string().
|
static |
Definition at line 46 of file preprocessor.cpp.
Referenced by preprocessor_data::get_chunk().