ChaiScript
chaiscript_common.hpp
1 // This file is distributed under the BSD License.
2 // See "license.txt" for details.
3 // Copyright 2009-2012, Jonathan Turner (jonathan@emptycrate.com)
4 // Copyright 2009-2018, Jason Turner (jason@emptycrate.com)
5 // http://www.chaiscript.com
6 
7 // This is an open source non-commercial project. Dear PVS-Studio, please check it.
8 // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
9 
10 #ifndef CHAISCRIPT_COMMON_HPP_
11 #define CHAISCRIPT_COMMON_HPP_
12 
13 #include <algorithm>
14 #include <memory>
15 #include <sstream>
16 #include <stdexcept>
17 #include <string>
18 #include <vector>
19 
20 #include "../chaiscript_defines.hpp"
21 #include "../dispatchkit/boxed_value.hpp"
22 #include "../dispatchkit/dispatchkit.hpp"
23 #include "../dispatchkit/proxy_functions.hpp"
24 #include "../dispatchkit/type_info.hpp"
25 #include <unordered_set>
26 
27 namespace chaiscript {
28  struct AST_Node;
29  struct AST_Node_Trace;
30  namespace exception {
31  struct eval_error;
32  }
33 } // namespace chaiscript
34 
35 namespace chaiscript {
36  struct Name_Validator {
37  template<typename T>
38  static bool is_reserved_word(const T &s) noexcept {
39  const static std::unordered_set<std::uint32_t>
40  words{utility::hash("def"), utility::hash("fun"), utility::hash("while"), utility::hash("for"), utility::hash("if"), utility::hash("else"), utility::hash("&&"), utility::hash("||"), utility::hash(","), utility::hash("auto"), utility::hash("return"), utility::hash("break"), utility::hash("true"), utility::hash("false"), utility::hash("class"), utility::hash("attr"), utility::hash("var"), utility::hash("global"), utility::hash("GLOBAL"), utility::hash("_"), utility::hash("__LINE__"), utility::hash("__FILE__"), utility::hash("__FUNC__"), utility::hash("__CLASS__")};
41 
42  return words.count(utility::hash(s)) == 1;
43  }
44 
45  template<typename T>
46  static bool valid_object_name(const T &name) noexcept {
47  return name.find("::") == std::string::npos && !is_reserved_word(name);
48  }
49 
50  template<typename T>
51  static void validate_object_name(const T &name) {
52  if (is_reserved_word(name)) {
53  throw exception::reserved_word_error(std::string(name));
54  }
55 
56  if (name.find("::") != std::string::npos) {
57  throw exception::illegal_name_error(std::string(name));
58  }
59  }
60  };
61 
64 
66  enum class AST_Node_Type {
67  Id,
68  Fun_Call,
69  Unused_Return_Fun_Call,
70  Arg_List,
71  Equation,
72  Var_Decl,
73  Assign_Decl,
74  Array_Call,
75  Dot_Access,
76  Lambda,
77  Block,
78  Scopeless_Block,
79  Def,
80  While,
81  If,
82  For,
83  Ranged_For,
84  Inline_Array,
85  Inline_Map,
86  Return,
87  File,
88  Prefix,
89  Break,
90  Continue,
91  Map_Pair,
92  Value_Range,
93  Inline_Range,
94  Try,
95  Catch,
96  Finally,
97  Method,
98  Attr_Decl,
99  Logical_And,
100  Logical_Or,
101  Reference,
102  Switch,
103  Case,
104  Default,
105  Noop,
106  Class,
107  Binary,
108  Arg,
109  Global_Decl,
110  Constant,
111  Compiled
112  };
113 
114  enum class Operator_Precedence {
115  Ternary_Cond,
116  Logical_Or,
117  Logical_And,
118  Bitwise_Or,
119  Bitwise_Xor,
120  Bitwise_And,
121  Equality,
122  Comparison,
123  Shift,
124  Addition,
125  Multiplication,
126  Prefix
127  };
128 
129  namespace {
131  constexpr const char *ast_node_type_to_string(AST_Node_Type ast_node_type) noexcept {
132  constexpr const char *const ast_node_types[] = {"Id", "Fun_Call", "Unused_Return_Fun_Call", "Arg_List", "Equation", "Var_Decl", "Assign_Decl", "Array_Call", "Dot_Access", "Lambda", "Block", "Scopeless_Block", "Def", "While", "If", "For", "Ranged_For", "Inline_Array", "Inline_Map", "Return", "File", "Prefix", "Break", "Continue", "Map_Pair", "Value_Range", "Inline_Range", "Try", "Catch", "Finally", "Method", "Attr_Decl", "Logical_And", "Logical_Or", "Reference", "Switch", "Case", "Default", "Noop", "Class", "Binary", "Arg", "Global_Decl", "Constant", "Compiled"};
133 
134  return ast_node_types[static_cast<int>(ast_node_type)];
135  }
136  } // namespace
137 
139  struct File_Position {
140  int line = 0;
141  int column = 0;
142 
143  constexpr File_Position(int t_file_line, int t_file_column) noexcept
144  : line(t_file_line)
145  , column(t_file_column) {
146  }
147 
148  constexpr File_Position() noexcept = default;
149  };
150 
151  struct Parse_Location {
152  Parse_Location(std::string t_fname = "", const int t_start_line = 0, const int t_start_col = 0, const int t_end_line = 0, const int t_end_col = 0)
153  : start(t_start_line, t_start_col)
154  , end(t_end_line, t_end_col)
155  , filename(std::make_shared<std::string>(std::move(t_fname))) {
156  }
157 
158  Parse_Location(std::shared_ptr<std::string> t_fname,
159  const int t_start_line = 0,
160  const int t_start_col = 0,
161  const int t_end_line = 0,
162  const int t_end_col = 0)
163  : start(t_start_line, t_start_col)
164  , end(t_end_line, t_end_col)
165  , filename(std::move(t_fname)) {
166  }
167 
168  File_Position start;
169  File_Position end;
170  std::shared_ptr<std::string> filename;
171  };
172 
174  struct AST_Node {
175  public:
176  const AST_Node_Type identifier;
177  const std::string text;
178  Parse_Location location;
179 
180  const std::string &filename() const noexcept { return *location.filename; }
181 
182  const File_Position &start() const noexcept { return location.start; }
183 
184  const File_Position &end() const noexcept { return location.end; }
185 
186  std::string pretty_print() const {
187  std::ostringstream oss;
188 
189  oss << text;
190 
191  for (auto &elem : get_children()) {
192  oss << elem.get().pretty_print() << ' ';
193  }
194 
195  return oss.str();
196  }
197 
198  virtual std::vector<std::reference_wrapper<AST_Node>> get_children() const = 0;
199  virtual Boxed_Value eval(const chaiscript::detail::Dispatch_State &t_e) const = 0;
200 
202  std::string to_string(const std::string &t_prepend = "") const {
203  std::ostringstream oss;
204 
205  oss << t_prepend << "(" << ast_node_type_to_string(this->identifier) << ") " << this->text << " : " << this->location.start.line
206  << ", " << this->location.start.column << '\n';
207 
208  for (auto &elem : get_children()) {
209  oss << elem.get().to_string(t_prepend + " ");
210  }
211  return oss.str();
212  }
213 
214  static inline bool get_bool_condition(const Boxed_Value &t_bv, const chaiscript::detail::Dispatch_State &t_ss);
215 
216  virtual ~AST_Node() noexcept = default;
217  AST_Node(AST_Node &&) = default;
218  AST_Node &operator=(AST_Node &&) = delete;
219  AST_Node(const AST_Node &) = delete;
220  AST_Node &operator=(const AST_Node &) = delete;
221 
222  protected:
223  AST_Node(std::string t_ast_node_text, AST_Node_Type t_id, Parse_Location t_loc)
224  : identifier(t_id)
225  , text(std::move(t_ast_node_text))
226  , location(std::move(t_loc)) {
227  }
228  };
229 
231  using AST_NodePtr = std::unique_ptr<AST_Node>;
232  using AST_NodePtr_Const = std::unique_ptr<const AST_Node>;
233 
234  struct AST_Node_Trace {
235  const AST_Node_Type identifier;
236  const std::string text;
237  Parse_Location location;
238 
239  const std::string &filename() const noexcept { return *location.filename; }
240 
241  const File_Position &start() const noexcept { return location.start; }
242 
243  const File_Position &end() const noexcept { return location.end; }
244 
245  std::string pretty_print() const {
246  std::ostringstream oss;
247 
248  oss << text;
249 
250  for (const auto &elem : children) {
251  oss << elem.pretty_print() << ' ';
252  }
253 
254  return oss.str();
255  }
256 
257  std::vector<AST_Node_Trace> get_children(const AST_Node &node) {
258  const auto node_children = node.get_children();
259  return std::vector<AST_Node_Trace>(node_children.begin(), node_children.end());
260  }
261 
262  AST_Node_Trace(const AST_Node &node)
263  : identifier(node.identifier)
264  , text(node.text)
265  , location(node.location)
266  , children(get_children(node)) {
267  }
268 
269  std::vector<AST_Node_Trace> children;
270  };
271 
273  namespace exception {
275  struct load_module_error : std::runtime_error {
276  explicit load_module_error(const std::string &t_reason)
277  : std::runtime_error(t_reason) {
278  }
279 
280  load_module_error(const std::string &t_name, const std::vector<load_module_error> &t_errors)
281  : std::runtime_error(format_error(t_name, t_errors)) {
282  }
283 
284  load_module_error(const load_module_error &) = default;
285  ~load_module_error() noexcept override = default;
286 
287  static std::string format_error(const std::string &t_name, const std::vector<load_module_error> &t_errors) {
288  std::stringstream ss;
289  ss << "Error loading module '" << t_name << "'\n"
290  << " The following locations were searched:\n";
291 
292  for (const auto &err : t_errors) {
293  ss << " " << err.what() << "\n";
294  }
295 
296  return ss.str();
297  }
298  };
299 
301  struct eval_error : std::runtime_error {
302  std::string reason;
303  File_Position start_position;
304  std::string filename;
305  std::string detail;
306  std::vector<AST_Node_Trace> call_stack;
307 
308  eval_error(const std::string &t_why,
309  const File_Position &t_where,
310  const std::string &t_fname,
311  const std::vector<Boxed_Value> &t_parameters,
312  const std::vector<chaiscript::Const_Proxy_Function> &t_functions,
313  bool t_dot_notation,
314  const chaiscript::detail::Dispatch_Engine &t_ss) noexcept
315  : std::runtime_error(format(t_why, t_where, t_fname, t_parameters, t_dot_notation, t_ss))
316  , reason(t_why)
317  , start_position(t_where)
318  , filename(t_fname)
319  , detail(format_detail(t_functions, t_dot_notation, t_ss)) {
320  }
321 
322  eval_error(const std::string &t_why,
323  const std::vector<Boxed_Value> &t_parameters,
324  const std::vector<chaiscript::Const_Proxy_Function> &t_functions,
325  bool t_dot_notation,
326  const chaiscript::detail::Dispatch_Engine &t_ss) noexcept
327  : std::runtime_error(format(t_why, t_parameters, t_dot_notation, t_ss))
328  , reason(t_why)
329  , detail(format_detail(t_functions, t_dot_notation, t_ss)) {
330  }
331 
332  eval_error(const std::string &t_why, const File_Position &t_where, const std::string &t_fname) noexcept
333  : std::runtime_error(format(t_why, t_where, t_fname))
334  , reason(t_why)
335  , start_position(t_where)
336  , filename(t_fname) {
337  }
338 
339  explicit eval_error(const std::string &t_why) noexcept
340  : std::runtime_error("Error: \"" + t_why + "\" ")
341  , reason(t_why) {
342  }
343 
344  eval_error(const eval_error &) = default;
345 
346  std::string pretty_print() const {
347  std::ostringstream ss;
348 
349  ss << what();
350  if (!call_stack.empty()) {
351  ss << "during evaluation at (" << fname(call_stack[0]) << " " << startpos(call_stack[0]) << ")\n";
352  ss << '\n'
353  << detail << '\n';
354  ss << " " << fname(call_stack[0]) << " (" << startpos(call_stack[0]) << ") '" << pretty(call_stack[0]) << "'";
355  for (size_t j = 1; j < call_stack.size(); ++j) {
356  if (id(call_stack[j]) != chaiscript::AST_Node_Type::Block && id(call_stack[j]) != chaiscript::AST_Node_Type::File) {
357  ss << '\n';
358  ss << " from " << fname(call_stack[j]) << " (" << startpos(call_stack[j]) << ") '" << pretty(call_stack[j]) << "'";
359  }
360  }
361  }
362  ss << '\n';
363  return ss.str();
364  }
365 
366  ~eval_error() noexcept override = default;
367 
368  private:
369  template<typename T>
370  static AST_Node_Type id(const T &t) noexcept {
371  return t.identifier;
372  }
373 
374  template<typename T>
375  static std::string pretty(const T &t) {
376  return t.pretty_print();
377  }
378 
379  template<typename T>
380  static const std::string &fname(const T &t) noexcept {
381  return t.filename();
382  }
383 
384  template<typename T>
385  static std::string startpos(const T &t) {
386  std::ostringstream oss;
387  oss << t.start().line << ", " << t.start().column;
388  return oss.str();
389  }
390 
391  static std::string format_why(const std::string &t_why) { return "Error: \"" + t_why + "\""; }
392 
393  static std::string format_types(const Const_Proxy_Function &t_func, bool t_dot_notation, const chaiscript::detail::Dispatch_Engine &t_ss) {
394  assert(t_func);
395  int arity = t_func->get_arity();
396  std::vector<Type_Info> types = t_func->get_param_types();
397 
398  std::string retval;
399  if (arity == -1) {
400  retval = "(...)";
401  if (t_dot_notation) {
402  retval = "(Object)." + retval;
403  }
404  } else if (types.size() <= 1) {
405  retval = "()";
406  } else {
407  std::stringstream ss;
408  ss << "(";
409 
410  std::string paramstr;
411 
412  for (size_t index = 1; index != types.size(); ++index) {
413  paramstr += (types[index].is_const() ? "const " : "");
414  paramstr += t_ss.get_type_name(types[index]);
415 
416  if (index == 1 && t_dot_notation) {
417  paramstr += ").(";
418  if (types.size() == 2) {
419  paramstr += ", ";
420  }
421  } else {
422  paramstr += ", ";
423  }
424  }
425 
426  ss << paramstr.substr(0, paramstr.size() - 2);
427 
428  ss << ")";
429  retval = ss.str();
430  }
431 
432  std::shared_ptr<const dispatch::Dynamic_Proxy_Function> dynfun
433  = std::dynamic_pointer_cast<const dispatch::Dynamic_Proxy_Function>(t_func);
434 
435  if (dynfun && dynfun->has_parse_tree()) {
436  Proxy_Function f = dynfun->get_guard();
437 
438  if (f) {
439  auto dynfunguard = std::dynamic_pointer_cast<const dispatch::Dynamic_Proxy_Function>(f);
440  if (dynfunguard && dynfunguard->has_parse_tree()) {
441  retval += " : " + format_guard(dynfunguard->get_parse_tree());
442  }
443  }
444 
445  retval += "\n Defined at " + format_location(dynfun->get_parse_tree());
446  }
447 
448  return retval;
449  }
450 
451  template<typename T>
452  static std::string format_guard(const T &t) {
453  return t.pretty_print();
454  }
455 
456  template<typename T>
457  static std::string format_location(const T &t) {
458  std::ostringstream oss;
459  oss << "(" << t.filename() << " " << t.start().line << ", " << t.start().column << ")";
460  return oss.str();
461  }
462 
463  static std::string format_detail(const std::vector<chaiscript::Const_Proxy_Function> &t_functions,
464  bool t_dot_notation,
466  std::stringstream ss;
467  if (t_functions.size() == 1) {
468  assert(t_functions[0]);
469  ss << " Expected: " << format_types(t_functions[0], t_dot_notation, t_ss) << '\n';
470  } else {
471  ss << " " << t_functions.size() << " overloads available:\n";
472 
473  for (const auto &t_function : t_functions) {
474  ss << " " << format_types((t_function), t_dot_notation, t_ss) << '\n';
475  }
476  }
477 
478  return ss.str();
479  }
480 
481  static std::string
482  format_parameters(const std::vector<Boxed_Value> &t_parameters, bool t_dot_notation, const chaiscript::detail::Dispatch_Engine &t_ss) {
483  std::stringstream ss;
484  ss << "(";
485 
486  if (!t_parameters.empty()) {
487  std::string paramstr;
488 
489  for (auto itr = t_parameters.begin(); itr != t_parameters.end(); ++itr) {
490  paramstr += (itr->is_const() ? "const " : "");
491  paramstr += t_ss.type_name(*itr);
492 
493  if (itr == t_parameters.begin() && t_dot_notation) {
494  paramstr += ").(";
495  if (t_parameters.size() == 1) {
496  paramstr += ", ";
497  }
498  } else {
499  paramstr += ", ";
500  }
501  }
502 
503  ss << paramstr.substr(0, paramstr.size() - 2);
504  }
505  ss << ")";
506 
507  return ss.str();
508  }
509 
510  static std::string format_filename(const std::string &t_fname) {
511  std::stringstream ss;
512 
513  if (t_fname != "__EVAL__") {
514  ss << "in '" << t_fname << "' ";
515  } else {
516  ss << "during evaluation ";
517  }
518 
519  return ss.str();
520  }
521 
522  static std::string format_location(const File_Position &t_where) {
523  std::stringstream ss;
524  ss << "at (" << t_where.line << ", " << t_where.column << ")";
525  return ss.str();
526  }
527 
528  static std::string format(const std::string &t_why,
529  const File_Position &t_where,
530  const std::string &t_fname,
531  const std::vector<Boxed_Value> &t_parameters,
532  bool t_dot_notation,
534  std::stringstream ss;
535 
536  ss << format_why(t_why);
537  ss << " ";
538 
539  ss << "With parameters: " << format_parameters(t_parameters, t_dot_notation, t_ss);
540  ss << " ";
541 
542  ss << format_filename(t_fname);
543  ss << " ";
544 
545  ss << format_location(t_where);
546 
547  return ss.str();
548  }
549 
550  static std::string format(const std::string &t_why,
551  const std::vector<Boxed_Value> &t_parameters,
552  bool t_dot_notation,
554  std::stringstream ss;
555 
556  ss << format_why(t_why);
557  ss << " ";
558 
559  ss << "With parameters: " << format_parameters(t_parameters, t_dot_notation, t_ss);
560  ss << " ";
561 
562  return ss.str();
563  }
564 
565  static std::string format(const std::string &t_why, const File_Position &t_where, const std::string &t_fname) {
566  std::stringstream ss;
567 
568  ss << format_why(t_why);
569  ss << " ";
570 
571  ss << format_filename(t_fname);
572  ss << " ";
573 
574  ss << format_location(t_where);
575 
576  return ss.str();
577  }
578  };
579 
581  struct file_not_found_error : std::runtime_error {
582  explicit file_not_found_error(const std::string &t_filename)
583  : std::runtime_error("File Not Found: " + t_filename)
584  , filename(t_filename) {
585  }
586 
587  file_not_found_error(const file_not_found_error &) = default;
588  ~file_not_found_error() noexcept override = default;
589 
590  std::string filename;
591  };
592 
593  } // namespace exception
594 
595  //static
596  bool AST_Node::get_bool_condition(const Boxed_Value &t_bv, const chaiscript::detail::Dispatch_State &t_ss) {
597  try {
598  return t_ss->boxed_cast<bool>(t_bv);
599  } catch (const exception::bad_boxed_cast &) {
600  throw exception::eval_error("Condition not boolean");
601  }
602  }
603 
604  namespace parser {
606  public:
607  virtual AST_NodePtr parse(const std::string &t_input, const std::string &t_fname) = 0;
608  virtual void debug_print(const AST_Node &t, std::string prepend = "") const = 0;
609  virtual void *get_tracer_ptr() = 0;
610  virtual ~ChaiScript_Parser_Base() = default;
611  ChaiScript_Parser_Base() = default;
613  ChaiScript_Parser_Base &operator=(ChaiScript_Parser_Base &&) = delete;
614  ChaiScript_Parser_Base &operator=(const ChaiScript_Parser_Base &&) = delete;
615 
616  template<typename T>
617  T &get_tracer() noexcept {
618  // to do type check this somehow?
619  return *static_cast<T *>(get_tracer_ptr());
620  }
621 
622  protected:
624  };
625  } // namespace parser
626 
627  namespace eval {
628  namespace detail {
630  struct Return_Value {
631  Boxed_Value retval;
632  };
633 
635  struct Break_Loop {
636  };
637 
639  struct Continue_Loop {
640  };
641 
643  struct Scope_Push_Pop {
644  Scope_Push_Pop(Scope_Push_Pop &&) = default;
645  Scope_Push_Pop &operator=(Scope_Push_Pop &&) = delete;
646  Scope_Push_Pop(const Scope_Push_Pop &) = delete;
647  Scope_Push_Pop &operator=(const Scope_Push_Pop &) = delete;
648 
650  : m_ds(t_ds) {
651  m_ds->new_scope(m_ds.stack_holder());
652  }
653 
654  ~Scope_Push_Pop() { m_ds->pop_scope(m_ds.stack_holder()); }
655 
656  private:
658  };
659 
662  Function_Push_Pop(Function_Push_Pop &&) = default;
663  Function_Push_Pop &operator=(Function_Push_Pop &&) = delete;
664  Function_Push_Pop(const Function_Push_Pop &) = delete;
665  Function_Push_Pop &operator=(const Function_Push_Pop &) = delete;
666 
668  : m_ds(t_ds) {
669  m_ds->new_function_call(m_ds.stack_holder(), m_ds.conversion_saves());
670  }
671 
672  ~Function_Push_Pop() { m_ds->pop_function_call(m_ds.stack_holder(), m_ds.conversion_saves()); }
673 
674  void save_params(const Function_Params &t_params) { m_ds->save_function_params(t_params); }
675 
676  private:
678  };
679 
681  struct Stack_Push_Pop {
682  Stack_Push_Pop(Stack_Push_Pop &&) = default;
683  Stack_Push_Pop &operator=(Stack_Push_Pop &&) = delete;
684  Stack_Push_Pop(const Stack_Push_Pop &) = delete;
685  Stack_Push_Pop &operator=(const Stack_Push_Pop &) = delete;
686 
688  : m_ds(t_ds) {
689  m_ds->new_stack(m_ds.stack_holder());
690  }
691 
692  ~Stack_Push_Pop() { m_ds->pop_stack(m_ds.stack_holder()); }
693 
694  private:
696  };
697  } // namespace detail
698  } // namespace eval
699 } // namespace chaiscript
700 
701 #endif /* _CHAISCRIPT_COMMON_HPP */
Thrown if an error occurs while attempting to load a binary module.
Definition: chaiscript_common.hpp:275
Creates a new scope then pops it on destruction.
Definition: chaiscript_common.hpp:681
Special type indicating a call to &#39;continue&#39;.
Definition: chaiscript_common.hpp:639
Creates a new function call and pops it on destruction.
Definition: chaiscript_common.hpp:661
Exception thrown in the case that an object name is invalid because it is a reserved word...
Definition: dispatchkit.hpp:61
Namespace chaiscript contains every API call that the average user will be concerned with...
Definition: function_params.hpp:16
Definition: catch.hpp:96
std::shared_ptr< Module > ModulePtr
Convenience typedef for Module objects to be added to the ChaiScript runtime.
Definition: dispatchkit.hpp:220
Convenience type for file positions.
Definition: chaiscript_common.hpp:139
Definition: chaiscript_common.hpp:605
AST_Node_Type
Types of AST nodes available to the parser and eval.
Definition: chaiscript_common.hpp:66
A wrapper for holding any valid C++ type.
Definition: boxed_value.hpp:24
Thrown in the event that a Boxed_Value cannot be cast to the desired type.
Definition: bad_boxed_cast.hpp:31
std::string get_type_name(const Type_Info &ti) const
Returns the registered name of a known type_info object compares the "bare_type_info" for the broades...
Definition: dispatchkit.hpp:582
ModulePtr(*)() Create_Module_Func
Signature of module entry point that all binary loadable modules must implement.
Definition: chaiscript_common.hpp:63
Creates a new scope then pops it on destruction.
Definition: chaiscript_common.hpp:643
Special type indicating a call to &#39;break&#39;.
Definition: chaiscript_common.hpp:635
Definition: chaiscript_common.hpp:36
Struct that doubles as both a parser ast_node and an AST node.
Definition: chaiscript_common.hpp:174
std::shared_ptr< const dispatch::Proxy_Function_Base > Const_Proxy_Function
Const version of Proxy_Function.
Definition: proxy_functions.hpp:281
Definition: chaiscript_common.hpp:151
std::shared_ptr< dispatch::Proxy_Function_Base > Proxy_Function
Common typedef used for passing of any registered function in ChaiScript.
Definition: proxy_functions.hpp:277
Special type for returned values.
Definition: chaiscript_common.hpp:630
decltype(auto) boxed_cast(const Boxed_Value &bv) const
casts an object while applying any Dynamic_Conversion available
Definition: dispatchkit.hpp:375
Definition: chaiscript_common.hpp:234
std::string to_string(const std::string &t_prepend="") const
Prints the contents of an AST node, including its children, recursively.
Definition: chaiscript_common.hpp:202
Definition: dispatchkit.hpp:1166
Errors generated during parsing or evaluation.
Definition: chaiscript_common.hpp:301
Exception thrown in the case that an object name is invalid because it contains illegal characters...
Definition: dispatchkit.hpp:79
Main class for the dispatchkit.
Definition: dispatchkit.hpp:354
std::unique_ptr< AST_Node > AST_NodePtr
Typedef for pointers to AST_Node objects. Used in building of the AST_Node tree.
Definition: proxy_functions.hpp:42
A Proxy_Function implementation that is not type safe, the called function is expecting a vector<Boxe...
Definition: proxy_functions.hpp:300
Errors generated when loading a file.
Definition: chaiscript_common.hpp:581