86 lines
1.7 KiB
C++
86 lines
1.7 KiB
C++
/// AUTOGENERATED COPYRIGHT HEADER START
|
|
// Copyright (C) 2024 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
|
|
// AUTOGENERATED COPYRIGHT HEADER END
|
|
#pragma once
|
|
#include "ast.hpp"
|
|
#include "lexer.hpp"
|
|
#include <inttypes.h>
|
|
#include <float.h>
|
|
#include <math.h>
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
namespace blitz {
|
|
namespace ast {
|
|
enum class ValueType : int8_t {
|
|
UNKNOWN,
|
|
INTEGER,
|
|
REAL,
|
|
STRING,
|
|
TYPE,
|
|
};
|
|
|
|
class ValueExpression : public expression {
|
|
public:
|
|
virtual ValueType GetType() = 0;
|
|
};
|
|
|
|
class ConstExpression : public ValueExpression {
|
|
public:
|
|
ConstExpression(std::string& name, std::unique_ptr<ValueExpression> value);
|
|
virtual ~ConstExpression();
|
|
|
|
virtual ValueType GetType() override;
|
|
|
|
private:
|
|
std::string m_name;
|
|
std::unique_ptr<ValueExpression> m_value;
|
|
};
|
|
|
|
class VariableExpression : public ValueExpression {
|
|
public:
|
|
VariableExpression(std::string& name, ValueType type = ValueType::INTEGER);
|
|
virtual ~VariableExpression();
|
|
|
|
virtual ValueType GetType() override;
|
|
|
|
private:
|
|
std::string m_name;
|
|
ValueType m_type;
|
|
};
|
|
|
|
class NumberExpression : public ValueExpression {
|
|
public:
|
|
NumberExpression(int32_t value);
|
|
virtual ~NumberExpression();
|
|
|
|
virtual ValueType GetType() override;
|
|
|
|
private:
|
|
int32_t value;
|
|
};
|
|
|
|
class DecimalExpression : public ValueExpression {
|
|
public:
|
|
DecimalExpression(float_t value);
|
|
virtual ~DecimalExpression();
|
|
|
|
virtual ValueType GetType() override;
|
|
|
|
private:
|
|
float_t value;
|
|
};
|
|
|
|
class StringExpression : public ValueExpression {
|
|
public:
|
|
StringExpression(std::string value);
|
|
virtual ~StringExpression();
|
|
|
|
virtual ValueType GetType() override;
|
|
|
|
private:
|
|
std::string value;
|
|
};
|
|
}
|
|
}
|