Implements basic numerical tables
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-06-09 20:15:09 +02:00
parent ec2419bc7d
commit 081def0be0
21 changed files with 324 additions and 24 deletions

View File

@@ -1,15 +1,10 @@
#include <utility>
#include <utility>
#include <utility>
#ifndef PORYGONLANG_BOUNDEXPRESSION_HPP
#define PORYGONLANG_BOUNDEXPRESSION_HPP
#include <string>
#include <memory>
#include <utility>
#include "../../ScriptType.hpp"
#include "../BoundOperators.hpp"
#include "../BoundVariables/BoundVariableKey.hpp"
@@ -29,6 +24,7 @@ enum class BoundExpressionKind{
Binary,
FunctionCall,
Index,
NumericalTable,
};
class BoundExpression{
@@ -276,5 +272,28 @@ public:
}
};
class BoundNumericalTableExpression : public BoundExpression{
vector<BoundExpression*> _expressions;
public:
BoundNumericalTableExpression(vector<BoundExpression*> expressions, shared_ptr<ScriptType> type, unsigned int start, unsigned int length)
: BoundExpression(start, length, type){
_expressions = std::move(expressions);
}
~BoundNumericalTableExpression(){
for (auto e: _expressions){
delete e;
}
}
BoundExpressionKind GetKind() final{
return BoundExpressionKind ::NumericalTable;
}
vector<BoundExpression*> GetExpressions(){
return _expressions;
}
};
#endif //PORYGONLANG_BOUNDEXPRESSION_HPP