A simple scripting language in C++
Ferenc Szontágh
2025-04-18 4abeb5f8a6ad77b32496f3e8b20e1fd1b6f428fb
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
// ConstantSymbol.hpp
#ifndef CONSTANT_SYMBOL_HPP
#define CONSTANT_SYMBOL_HPP
 
#include <stdexcept>
 
#include "BaseSymbol.hpp"
#include "VariableTypes.hpp"
 
namespace Symbols {
 
class ConstantSymbol : public Symbol {
  protected:
    Symbols::Variables::Type _vartype;
  public:
    ConstantSymbol(const std::string & name, const Symbols::Value & value, const std::string & context) :
        Symbol(name, value, context, Symbols::Kind::Constant) {}
 
    Symbols::Kind kind() const override { return Symbols::Kind::Constant; }
 
    void setValue(const Symbols::Value & /*value*/) override {
        throw std::logic_error("Cannot modify a constant symbol");
    }
};
 
}  // namespace Symbols
 
#endif