A simple scripting language in C++
Ferenc Szontágh
2025-04-12 0489092ac538610a3db7dee2e000bc63db11be67
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 ScriptInterpreter;
 
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(ScriptInterpreter & interp) {
        FuncClass::registerTo(interp);
    }
};
 
#endif  // SCRIPT_FUNCTION_HPP