A simple scripting language in C++
Ferenc Szontágh
2025-04-18 3bb117e4fee72c4d4019c575bf0cb21043584954
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// FunctionSymbol.hpp
#ifndef FUNCTION_SYMBOL_HPP
#define FUNCTION_SYMBOL_HPP
 
#include <vector>
 
#include "BaseSymbol.hpp"
#include "Lexer/Token.hpp"
#include "Symbols/ParameterContainer.hpp"
#include "Symbols/VariableTypes.hpp"
 
namespace Symbols {
 
class FunctionSymbol : public Symbol {
    // store the variables name and type
    FunctionParameterInfo             parameters_;
    Symbols::Variables::Type          returnType_;
    std::string                       plainBody_;
    std::vector<Lexer::Tokens::Token> tokens_;
 
  public:
    FunctionSymbol(const std::string & name, const std::string & context, const FunctionParameterInfo & parameters,
                   const std::string &      plainbody  = "",
                   Symbols::Variables::Type returnType = Symbols::Variables::Type::NULL_TYPE) :
        Symbol(name, {}, context, Symbols::Kind::Function),
        parameters_(parameters),
        plainBody_(plainbody),
        returnType_(returnType) {}
 
    Symbols::Kind kind() const override { return Symbols::Kind::Function; }
 
    Symbols::Variables::Type returnType() const { return returnType_; }
 
    const FunctionParameterInfo & parameters() const { return parameters_; }
 
    const std::string & plainBody() const { return plainBody_; }
};
 
}  // namespace Symbols
 
#endif