Apparently Windows does not handle 'long' the same as Unix.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
86d6d5a9cb
commit
2d4d3d8856
|
@ -76,9 +76,9 @@ namespace Porygon::Binder {
|
||||||
};
|
};
|
||||||
|
|
||||||
class BoundLiteralIntegerExpression : public BoundExpression {
|
class BoundLiteralIntegerExpression : public BoundExpression {
|
||||||
const long _value;
|
const int64_t _value;
|
||||||
public:
|
public:
|
||||||
BoundLiteralIntegerExpression(long value, unsigned int start, unsigned int length)
|
BoundLiteralIntegerExpression(int64_t value, unsigned int start, unsigned int length)
|
||||||
: BoundExpression(start, length, make_shared<NumericScriptType>(true, false)),
|
: BoundExpression(start, length, make_shared<NumericScriptType>(true, false)),
|
||||||
_value(value) {
|
_value(value) {
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ namespace Porygon::Binder {
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline long GetValue() const {
|
inline int64_t GetValue() const {
|
||||||
return _value;
|
return _value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace Porygon::Evaluation {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EvalValue *CreateIntegerEvalValue(long l) {
|
EvalValue *CreateIntegerEvalValue(int64_t l) {
|
||||||
return new IntegerEvalValue(l);
|
return new IntegerEvalValue(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace Porygon::Evaluation {
|
||||||
virtual EvalValue* Clone() const = 0;
|
virtual EvalValue* Clone() const = 0;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
virtual long EvaluateInteger() const {
|
virtual int64_t EvaluateInteger() const {
|
||||||
throw EvaluationException("Can't evaluate this EvalValue as integer.");
|
throw EvaluationException("Can't evaluate this EvalValue as integer.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,10 @@ namespace Porygon::Evaluation{
|
||||||
class EvalValueHelper{
|
class EvalValueHelper{
|
||||||
public:
|
public:
|
||||||
inline static EvalValue* Create(unsigned char i){
|
inline static EvalValue* Create(unsigned char i){
|
||||||
return new IntegerEvalValue((long)i);
|
return new IntegerEvalValue((int64_t )i);
|
||||||
}
|
}
|
||||||
inline static EvalValue* Create(signed char i){
|
inline static EvalValue* Create(signed char i){
|
||||||
return new IntegerEvalValue((long)i);
|
return new IntegerEvalValue((int64_t )i);
|
||||||
}
|
}
|
||||||
inline static EvalValue* Create(short int i){
|
inline static EvalValue* Create(short int i){
|
||||||
return new IntegerEvalValue(i);
|
return new IntegerEvalValue(i);
|
||||||
|
@ -26,10 +26,10 @@ namespace Porygon::Evaluation{
|
||||||
inline static EvalValue* Create(unsigned int i){
|
inline static EvalValue* Create(unsigned int i){
|
||||||
return new IntegerEvalValue(i);
|
return new IntegerEvalValue(i);
|
||||||
}
|
}
|
||||||
inline static EvalValue* Create(signed long l){
|
inline static EvalValue* Create(int64_t l){
|
||||||
return new IntegerEvalValue(l);
|
return new IntegerEvalValue(l);
|
||||||
}
|
}
|
||||||
inline static EvalValue* Create(unsigned long l){
|
inline static EvalValue* Create(uint64_t l){
|
||||||
return new IntegerEvalValue(l);
|
return new IntegerEvalValue(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace Porygon::Evaluation {
|
||||||
class NumericEvalValue : public EvalValue {
|
class NumericEvalValue : public EvalValue {
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
virtual long GetIntegerValue() const = 0;
|
virtual int64_t GetIntegerValue() const = 0;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
virtual double GetFloatValue() const = 0;
|
virtual double GetFloatValue() const = 0;
|
||||||
|
@ -44,10 +44,10 @@ namespace Porygon::Evaluation {
|
||||||
};
|
};
|
||||||
|
|
||||||
class IntegerEvalValue : public NumericEvalValue {
|
class IntegerEvalValue : public NumericEvalValue {
|
||||||
const long _value;
|
const int64_t _value;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
long GetIntegerValue() const final { return _value; }
|
int64_t GetIntegerValue() const final { return _value; }
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
double GetFloatValue() const final {
|
double GetFloatValue() const final {
|
||||||
|
@ -55,7 +55,7 @@ namespace Porygon::Evaluation {
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit IntegerEvalValue(long value) : _value(value) {
|
explicit IntegerEvalValue(int64_t value) : _value(value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
|
@ -64,7 +64,7 @@ namespace Porygon::Evaluation {
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline long EvaluateInteger() const final {
|
inline int64_t EvaluateInteger() const final {
|
||||||
return _value;
|
return _value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ namespace Porygon::Evaluation {
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline std::size_t GetHashCode() const final {
|
inline std::size_t GetHashCode() const final {
|
||||||
return std::hash<long>{}(_value);
|
return std::hash<int64_t >{}(_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
|
@ -104,8 +104,8 @@ namespace Porygon::Evaluation {
|
||||||
const double _value;
|
const double _value;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline long GetIntegerValue() const final {
|
inline int64_t GetIntegerValue() const final {
|
||||||
throw EvaluationException("Attempting to retrieve float from int eval value.");
|
return _value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
|
@ -128,8 +128,8 @@ namespace Porygon::Evaluation {
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline long EvaluateInteger() const final {
|
inline int64_t EvaluateInteger() const final {
|
||||||
return static_cast<long>(_value);
|
return static_cast<int64_t >(_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
|
@ -168,13 +168,13 @@ namespace Porygon::Evaluation {
|
||||||
auto rightVal = right->EvaluateInteger();
|
auto rightVal = right->EvaluateInteger();
|
||||||
switch (operation) {
|
switch (operation) {
|
||||||
case Binder::BoundBinaryOperation::Addition:
|
case Binder::BoundBinaryOperation::Addition:
|
||||||
return new IntegerEvalValue((long) _value + rightVal);
|
return new IntegerEvalValue((int64_t ) _value + rightVal);
|
||||||
case Binder::BoundBinaryOperation::Subtraction:
|
case Binder::BoundBinaryOperation::Subtraction:
|
||||||
return new IntegerEvalValue((long) _value - rightVal);
|
return new IntegerEvalValue((int64_t ) _value - rightVal);
|
||||||
case Binder::BoundBinaryOperation::Multiplication:
|
case Binder::BoundBinaryOperation::Multiplication:
|
||||||
return new IntegerEvalValue((long) _value * rightVal);
|
return new IntegerEvalValue((int64_t ) _value * rightVal);
|
||||||
case Binder::BoundBinaryOperation::Division:
|
case Binder::BoundBinaryOperation::Division:
|
||||||
return new IntegerEvalValue((long) _value / rightVal);
|
return new IntegerEvalValue((int64_t ) _value / rightVal);
|
||||||
case Binder::BoundBinaryOperation::LessThan:
|
case Binder::BoundBinaryOperation::LessThan:
|
||||||
return new BooleanEvalValue(_value < rightVal);
|
return new BooleanEvalValue(_value < rightVal);
|
||||||
case Binder::BoundBinaryOperation::LessThanEquals:
|
case Binder::BoundBinaryOperation::LessThanEquals:
|
||||||
|
|
|
@ -140,9 +140,9 @@ namespace Porygon::Evaluation {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Evaluator::EvaluateNumericalForStatement(const BoundNumericalForStatement *statement) {
|
void Evaluator::EvaluateNumericalForStatement(const BoundNumericalForStatement *statement) {
|
||||||
long start = this->EvaluateExpression(statement -> GetStart()) -> EvaluateInteger();
|
int64_t start = this->EvaluateExpression(statement -> GetStart()) -> EvaluateInteger();
|
||||||
long end = this->EvaluateExpression(statement -> GetEnd()) -> EvaluateInteger();
|
int64_t end = this->EvaluateExpression(statement -> GetEnd()) -> EvaluateInteger();
|
||||||
long step = 1;
|
int64_t step = 1;
|
||||||
auto stepExp = statement -> GetStep();
|
auto stepExp = statement -> GetStep();
|
||||||
if (stepExp != nullptr){
|
if (stepExp != nullptr){
|
||||||
step = this -> EvaluateExpression(stepExp) -> EvaluateInteger();
|
step = this -> EvaluateExpression(stepExp) -> EvaluateInteger();
|
||||||
|
@ -152,7 +152,7 @@ namespace Porygon::Evaluation {
|
||||||
auto block = (BoundBlockStatement*)statement -> GetBlock();
|
auto block = (BoundBlockStatement*)statement -> GetBlock();
|
||||||
auto statements = *block -> GetStatements();
|
auto statements = *block -> GetStatements();
|
||||||
if (step >= 0){
|
if (step >= 0){
|
||||||
for (long i = start; i <= end; i += step){
|
for (int64_t i = start; i <= end; i += step){
|
||||||
this -> _evaluationScope -> SetVariable(identifier, new IntegerEvalValue(i));
|
this -> _evaluationScope -> SetVariable(identifier, new IntegerEvalValue(i));
|
||||||
for (auto s: statements) {
|
for (auto s: statements) {
|
||||||
this->EvaluateStatement(s);
|
this->EvaluateStatement(s);
|
||||||
|
@ -163,7 +163,7 @@ namespace Porygon::Evaluation {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else{
|
} else{
|
||||||
for (long i = start; i >= end; i += step){
|
for (int64_t i = start; i >= end; i += step){
|
||||||
this -> _evaluationScope -> SetVariable(identifier, new IntegerEvalValue(i));
|
this -> _evaluationScope -> SetVariable(identifier, new IntegerEvalValue(i));
|
||||||
for (auto s: statements) {
|
for (auto s: statements) {
|
||||||
this->EvaluateStatement(s);
|
this->EvaluateStatement(s);
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace Porygon::Evaluation{
|
||||||
class NumericalKeyIterator : public Iterator{
|
class NumericalKeyIterator : public Iterator{
|
||||||
const shared_ptr<vector<EvalValuePointer>> _vec;
|
const shared_ptr<vector<EvalValuePointer>> _vec;
|
||||||
const size_t _size;
|
const size_t _size;
|
||||||
long _position = 0;
|
size_t _position = 0;
|
||||||
public:
|
public:
|
||||||
explicit NumericalKeyIterator(const NumericalTableEvalValue* table)
|
explicit NumericalKeyIterator(const NumericalTableEvalValue* table)
|
||||||
: _vec(table->GetTable()), _size(_vec->size() + 1){}
|
: _vec(table->GetTable()), _size(_vec->size() + 1){}
|
||||||
|
|
|
@ -154,7 +154,7 @@ namespace Porygon::Parser {
|
||||||
}
|
}
|
||||||
|
|
||||||
Token *Lexer::LexNumber(char16_t c) {
|
Token *Lexer::LexNumber(char16_t c) {
|
||||||
long int_value = CharToInt(c);
|
int64_t int_value = CharToInt(c);
|
||||||
double float_value = 0;
|
double float_value = 0;
|
||||||
short decimal_index = 0;
|
short decimal_index = 0;
|
||||||
bool has_point = false;
|
bool has_point = false;
|
||||||
|
|
|
@ -66,7 +66,7 @@ namespace Porygon::Parser {
|
||||||
};
|
};
|
||||||
|
|
||||||
class LiteralIntegerExpression : public ParsedExpression {
|
class LiteralIntegerExpression : public ParsedExpression {
|
||||||
const long _value;
|
const int64_t _value;
|
||||||
public:
|
public:
|
||||||
inline const ParsedExpressionKind GetKind() const final {
|
inline const ParsedExpressionKind GetKind() const final {
|
||||||
return ParsedExpressionKind::LiteralInteger;
|
return ParsedExpressionKind::LiteralInteger;
|
||||||
|
@ -77,7 +77,7 @@ namespace Porygon::Parser {
|
||||||
_value(token->GetValue()) {
|
_value(token->GetValue()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const long GetValue() const {
|
inline const int64_t GetValue() const {
|
||||||
return _value;
|
return _value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -50,10 +50,10 @@ namespace Porygon::Parser {
|
||||||
};
|
};
|
||||||
|
|
||||||
class IntegerToken : public Token {
|
class IntegerToken : public Token {
|
||||||
const long _value;
|
const int64_t _value;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
explicit IntegerToken(long value, unsigned int position, unsigned int length)
|
explicit IntegerToken(int64_t value, unsigned int position, unsigned int length)
|
||||||
: Token(position, length),
|
: Token(position, length),
|
||||||
_value(value) {
|
_value(value) {
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ namespace Porygon::Parser {
|
||||||
return TokenKind::Integer;
|
return TokenKind::Integer;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] inline long GetValue() const {
|
[[nodiscard]] inline int64_t GetValue() const {
|
||||||
return _value;
|
return _value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace Porygon::Utilities {
|
||||||
_rng.seed(new_seed);
|
_rng.seed(new_seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline long Get() {
|
static inline int64_t Get() {
|
||||||
return _rng.operator()();
|
return _rng.operator()();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace Porygon::Utilities{
|
||||||
private:
|
private:
|
||||||
static std::wstring_convert<std::codecvt_utf8_utf16<char16_t, 0x10ffff, std::little_endian>, char16_t> to_16;
|
static std::wstring_convert<std::codecvt_utf8_utf16<char16_t, 0x10ffff, std::little_endian>, char16_t> to_16;
|
||||||
public:
|
public:
|
||||||
inline static std::u16string IntToString(long const &i) {
|
inline static std::u16string IntToString(int64_t const &i) {
|
||||||
return to_16.from_bytes(std::to_string(i));
|
return to_16.from_bytes(std::to_string(i));
|
||||||
}
|
}
|
||||||
inline static std::u16string FloatToString(double const &i) {
|
inline static std::u16string FloatToString(double const &i) {
|
||||||
|
|
Loading…
Reference in New Issue