The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
wfl Namespace Reference

Namespaces

namespace  actions
 
namespace  builtins
 
namespace  gamestate
 
namespace  implementation
 
namespace  tokenizer
 

Classes

class  action_callable
 
class  action_function_symbol_table
 
class  attack_type_callable
 
class  base_breakpoint
 
class  builtin_formula_function
 
struct  call_stack_manager
 Provides debugging information for error messages. More...
 
struct  callable_die_subscriber
 
class  color_callable
 
class  config_callable
 
class  debug_info
 
class  decimal_expression
 
class  dot_callable
 
class  dot_expression
 
class  end_breakpoint
 
class  event_callable
 An object representing the state of the current event; equivalent to Lua's wesnoth.current.event_context. More...
 
class  formula
 
class  formula_callable
 
class  formula_callable_with_backup
 
class  formula_debugger
 
struct  formula_error
 
class  formula_expression
 
class  formula_function
 
class  formula_function_expression
 
struct  formula_input
 
class  formula_variant_callable_with_backup
 
struct  formula_variant_defines
 
class  function_expression
 
class  function_list_expression
 Classes that encapsulate and handle the various formula functions. More...
 
class  function_symbol_table
 
class  gamemap_callable
 
class  gamestate_callable
 An object representing the state of the game, providing access to the map and basic information. More...
 
class  gamestate_function_symbol_table
 
class  identifier_expression
 
class  integer_expression
 
class  key_value_pair
 
class  list_callable
 
class  list_expression
 
class  location_callable
 
class  map_callable
 
class  map_expression
 
class  map_formula_callable
 
class  next_breakpoint
 
class  null_expression
 
class  operator_expression
 
class  safe_call_callable
 
class  safe_call_result
 
class  set_var_callable
 
class  square_bracket_expression
 
class  step_in_breakpoint
 
class  step_out_breakpoint
 
class  string_callable
 
class  string_expression
 
class  team_callable
 
class  terrain_callable
 
struct  type_error
 
class  unary_operator_expression
 
class  unit_callable
 
class  unit_type_callable
 
class  user_formula_function
 
class  variant
 
class  variant_callable
 
class  variant_container
 Generalized interface for container variants. More...
 
class  variant_decimal
 
class  variant_int
 
class  variant_iterator
 Iterator class for the variant. More...
 
class  variant_list
 
class  variant_map
 
class  variant_numeric
 Base class for numeric variant values. More...
 
class  variant_string
 
class  variant_value_base
 Base class for all variant types. More...
 
struct  wfl_variant_visitor
 
class  where_expression
 
class  where_variables
 
class  wrapper_formula
 

Typedefs

using map_formula_callable_ptr = std::shared_ptr< map_formula_callable >
 
using const_map_formula_callable_ptr = std::shared_ptr< const map_formula_callable >
 
using formula_input_vector = std::vector< formula_input >
 
using formula_callable_ptr = std::shared_ptr< formula_callable >
 
using const_formula_callable_ptr = std::shared_ptr< const formula_callable >
 
using formula_seen_stack = std::vector< const_formula_callable_ptr >
 
typedef std::shared_ptr< base_breakpoint > breakpoint_ptr
 
using expr_table = std::map< std::string, expression_ptr >
 
using expr_table_evaluated = std::map< std::string, variant >
 
using expr_table_ptr = std::shared_ptr< expr_table >
 
using expression_ptr = std::shared_ptr< formula_expression >
 
typedef std::shared_ptr< formula > formula_ptr
 
typedef std::shared_ptr< const formula > const_formula_ptr
 
using formula_variant = string_enums::enum_base< formula_variant_defines >
 
typedef std::shared_ptr< function_expression > function_expression_ptr
 
typedef std::shared_ptr< formula_function > formula_function_ptr
 
typedef std::map< std::string, formula_function_ptr > functions_map
 

Enumerations

enum class  formula_access { read_only , write_only , read_write }
 

Functions

template<typename T , typename... Args>
variant make_callable (Args &&... args)
 
template<typename T >
auto callable_cast (const variant &v) -> std::enable_if_t< std::is_pointer_v< T >, std::shared_ptr< const std::remove_pointer_t< T > > >
 
static void msg (const char *act, debug_info &i, const char *to="", const char *result="")
 
formula_debugger * add_debug_info (formula_debugger *fdb, int arg_number, const std::string &f_name)
 
variant evaluate_arg_callback (formula_debugger &fdb, const formula_expression &expression, const formula_callable &variables)
 
variant evaluate_formula_callback (formula_debugger &fdb, const formula &f, const formula_callable &variables)
 
variant evaluate_formula_callback (formula_debugger &fdb, const formula &f)
 
static std::string tokens_to_string (const tk::token *i1, const tk::token *i2)
 
expression_ptr parse_expression (const tk::token *i1, const tk::token *i2, function_symbol_table *symbols)
 
static int operator_precedence (const tk::token &t)
 Functions to handle the actual parsing of WFL.
 
static void parse_function_args (const tk::token *&i1, const tk::token *i2, std::vector< std::string > *res)
 
static void parse_args (const tk::token *i1, const tk::token *i2, std::vector< expression_ptr > *res, function_symbol_table *symbols)
 
static void parse_set_args (const tk::token *i1, const tk::token *i2, std::vector< expression_ptr > *res, function_symbol_table *symbols)
 
static void parse_where_clauses (const tk::token *i1, const tk::token *i2, const expr_table_ptr &res, function_symbol_table *symbols)
 
template<typename T >
std::shared_ptr< T > value_cast (const variant &v)
 
variant execute_actions (const variant &execute, const variant &context)
 Executes all action_callables in execute using the provided context.
 

Variables

static thread_local std::deque< std::string > call_stack
 For printing error messages when WFL parsing or evaluation fails, this contains the names of the WFL functions being evaluated.
 

Typedef Documentation

◆ breakpoint_ptr

typedef std::shared_ptr<base_breakpoint> wfl::breakpoint_ptr

Definition at line 38 of file debugger_fwd.hpp.

◆ const_formula_callable_ptr

using wfl::const_formula_callable_ptr = typedef std::shared_ptr<const formula_callable>

Definition at line 44 of file callable_fwd.hpp.

◆ const_formula_ptr

typedef std::shared_ptr<const formula> wfl::const_formula_ptr

Definition at line 24 of file formula_fwd.hpp.

◆ const_map_formula_callable_ptr

using wfl::const_map_formula_callable_ptr = typedef std::shared_ptr<const map_formula_callable>

Definition at line 309 of file callable.hpp.

◆ expr_table

using wfl::expr_table = typedef std::map<std::string, expression_ptr>

Definition at line 61 of file formula.cpp.

◆ expr_table_evaluated

using wfl::expr_table_evaluated = typedef std::map<std::string, variant>

Definition at line 62 of file formula.cpp.

◆ expr_table_ptr

using wfl::expr_table_ptr = typedef std::shared_ptr<expr_table>

Definition at line 63 of file formula.cpp.

◆ expression_ptr

typedef std::shared_ptr< formula_expression > wfl::expression_ptr

Definition at line 29 of file formula.hpp.

◆ formula_callable_ptr

using wfl::formula_callable_ptr = typedef std::shared_ptr<formula_callable>

Definition at line 43 of file callable_fwd.hpp.

◆ formula_function_ptr

typedef std::shared_ptr<formula_function> wfl::formula_function_ptr

Definition at line 230 of file function.hpp.

◆ formula_input_vector

using wfl::formula_input_vector = typedef std::vector<formula_input>

Definition at line 42 of file callable_fwd.hpp.

◆ formula_ptr

typedef std::shared_ptr<formula> wfl::formula_ptr

Definition at line 23 of file formula_fwd.hpp.

◆ formula_seen_stack

Definition at line 45 of file callable_fwd.hpp.

◆ formula_variant

Definition at line 34 of file formula_variant.hpp.

◆ function_expression_ptr

Definition at line 173 of file function.hpp.

◆ functions_map

typedef std::map<std::string, formula_function_ptr> wfl::functions_map

Definition at line 231 of file function.hpp.

◆ map_formula_callable_ptr

using wfl::map_formula_callable_ptr = typedef std::shared_ptr<map_formula_callable>

Definition at line 308 of file callable.hpp.

Enumeration Type Documentation

◆ formula_access

enum class wfl::formula_access
strong
Enumerator
read_only 
write_only 
read_write 

Definition at line 32 of file callable_fwd.hpp.

Function Documentation

◆ add_debug_info()

formula_debugger * wfl::add_debug_info ( formula_debugger *  fdb,
int  arg_number,
const std::string &  f_name 
)

◆ callable_cast()

template<typename T >
auto wfl::callable_cast ( const variant &  v) -> std::enable_if_t<std::is_pointer_v<T>, std::shared_ptr<const std::remove_pointer_t<T>>>

Definition at line 323 of file callable.hpp.

◆ evaluate_arg_callback()

variant wfl::evaluate_arg_callback ( formula_debugger &  fdb,
const formula_expression &  expression,
const formula_callable &  variables 
)

◆ evaluate_formula_callback() [1/2]

variant wfl::evaluate_formula_callback ( formula_debugger &  fdb,
const formula &  f 
)

Definition at line 49 of file debugger_fwd.cpp.

References wfl::formula_debugger::evaluate_formula_callback(), and f.

◆ evaluate_formula_callback() [2/2]

variant wfl::evaluate_formula_callback ( formula_debugger &  fdb,
const formula &  f,
const formula_callable &  variables 
)

◆ execute_actions()

variant wfl::execute_actions ( const variant &  execute,
const variant &  context 
)

Executes all action_callables in execute using the provided context.

Definition at line 696 of file variant.cpp.

References wfl::variant::as_list(), wfl::variant::is_list(), and WRN_SF.

Referenced by gui2::image_shape::draw(), gui2::text_shape::draw(), and wfl::safe_call_callable::execute_self().

◆ make_callable()

template<typename T , typename... Args>
variant wfl::make_callable ( Args &&...  args)

Definition at line 312 of file callable.hpp.

◆ msg()

static void wfl::msg ( const char *  act,
debug_info &  i,
const char *  to = "",
const char *  result = "" 
)
static

◆ operator_precedence()

static int wfl::operator_precedence ( const tk::token &  t)
static

Functions to handle the actual parsing of WFL.

Definition at line 1054 of file formula.cpp.

References n, and t.

Referenced by parse_expression().

◆ parse_args()

static void wfl::parse_args ( const tk::token *  i1,
const tk::token *  i2,
std::vector< expression_ptr > *  res,
function_symbol_table *  symbols 
)
static

Definition at line 1120 of file formula.cpp.

References parse_expression(), and wfl::tokenizer::token::type.

Referenced by parse_expression().

◆ parse_expression()

expression_ptr wfl::parse_expression ( const tk::token *  i1,
const tk::token *  i2,
function_symbol_table *  symbols 
)

◆ parse_function_args()

static void wfl::parse_function_args ( const tk::token *&  i1,
const tk::token *  i2,
std::vector< std::string > *  res 
)
static

◆ parse_set_args()

static void wfl::parse_set_args ( const tk::token *  i1,
const tk::token *  i2,
std::vector< expression_ptr > *  res,
function_symbol_table *  symbols 
)
static

◆ parse_where_clauses()

static void wfl::parse_where_clauses ( const tk::token *  i1,
const tk::token *  i2,
const expr_table_ptr &  res,
function_symbol_table *  symbols 
)
static

◆ tokens_to_string()

static std::string wfl::tokens_to_string ( const tk::token *  i1,
const tk::token *  i2 
)
static

◆ value_cast()

template<typename T >
std::shared_ptr< T > wfl::value_cast ( const variant &  v)

Definition at line 77 of file variant.cpp.

Variable Documentation

◆ call_stack

thread_local std::deque<std::string> wfl::call_stack
static

For printing error messages when WFL parsing or evaluation fails, this contains the names of the WFL functions being evaluated.

Two C++ threads might be evaluating WFL at the same; declaring this thread_local is a quick bugfix which should probably be replaced by having a context-object for each WFL evaluation.

Definition at line 51 of file function.cpp.

Referenced by wfl::call_stack_manager::call_stack_manager(), wfl::call_stack_manager::get(), wfl::end_breakpoint::is_break_now(), wfl::step_in_breakpoint::is_break_now(), wfl::step_out_breakpoint::is_break_now(), wfl::next_breakpoint::is_break_now(), and wfl::call_stack_manager::~call_stack_manager().