A simple scripting language in C++
Ferenc Szontágh
2025-04-12 7d7a1e80c8a8c1e52446453d1b86d3c3b945ec29
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// ScriptFunction.hpp
#ifndef SCRIPT_FUNCTION_HPP
#define SCRIPT_FUNCTION_HPP
 
#include <vector>
 
#include "Token.hpp"
#include "Value.hpp"
 
 
class SScriptInterpreter;
 
class BaseFunction {
  protected:
    std::string name;
  public:
    virtual ~BaseFunction()                                                       = default;
    virtual void  validate(const std::vector<Token> & tokens, size_t & i) const   = 0;
    virtual Value call(const std::vector<Value> & args, bool debug = false) const = 0;
 
    template <typename FuncClass> void registerFunctionTo(SScriptInterpreter & interp) {
        FuncClass::registerTo(interp);
    }
};
 
#endif  // SCRIPT_FUNCTION_HPP