mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 03:40:20 +02:00
Added comma token
This commit is contained in:
parent
7f0fc4f6eb
commit
4394083138
2 changed files with 2 additions and 81 deletions
|
@ -14,83 +14,6 @@
|
||||||
#include "AnimExpression.h"
|
#include "AnimExpression.h"
|
||||||
#include "AnimationLogging.h"
|
#include "AnimationLogging.h"
|
||||||
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
void AnimExpression::Token::dump() {
|
|
||||||
switch (type) {
|
|
||||||
case End:
|
|
||||||
qCDebug(animation) << " End";
|
|
||||||
break;
|
|
||||||
case Identifier:
|
|
||||||
qCDebug(animation) << " Identifer =" << strVal;
|
|
||||||
break;
|
|
||||||
case LiteralInt:
|
|
||||||
qCDebug(animation) << " LiteralInt =" << intVal;
|
|
||||||
break;
|
|
||||||
case LiteralFloat:
|
|
||||||
qCDebug(animation) << " LiteralFloat" << floatVal;
|
|
||||||
break;
|
|
||||||
case LiteralVec3:
|
|
||||||
qCDebug(animation) << " LiteralVec3" << vec3Val;
|
|
||||||
break;
|
|
||||||
case LiteralVec4:
|
|
||||||
qCDebug(animation) << " LiteralVec4" << vec4Val;
|
|
||||||
break;
|
|
||||||
case LiteralQuat:
|
|
||||||
qCDebug(animation) << " LiteralQuat" << quatVal;
|
|
||||||
break;
|
|
||||||
case And:
|
|
||||||
qCDebug(animation) << " And";
|
|
||||||
break;
|
|
||||||
case Or:
|
|
||||||
qCDebug(animation) << " Or";
|
|
||||||
break;
|
|
||||||
case GreaterThan:
|
|
||||||
qCDebug(animation) << " GreaterThan";
|
|
||||||
break;
|
|
||||||
case GreaterThanEqual:
|
|
||||||
qCDebug(animation) << " GreaterThanEqual";
|
|
||||||
break;
|
|
||||||
case LessThan:
|
|
||||||
qCDebug(animation) << " LessThan";
|
|
||||||
break;
|
|
||||||
case LessThanEqual:
|
|
||||||
qCDebug(animation) << " LessThanEqual";
|
|
||||||
break;
|
|
||||||
case Equal:
|
|
||||||
qCDebug(animation) << " Equal";
|
|
||||||
break;
|
|
||||||
case NotEqual:
|
|
||||||
qCDebug(animation) << " NotEqual";
|
|
||||||
break;
|
|
||||||
case LeftParen:
|
|
||||||
qCDebug(animation) << " LeftParen";
|
|
||||||
break;
|
|
||||||
case RightParen:
|
|
||||||
qCDebug(animation) << " RightParen";
|
|
||||||
break;
|
|
||||||
case Not:
|
|
||||||
qCDebug(animation) << " Not";
|
|
||||||
break;
|
|
||||||
case Minus:
|
|
||||||
qCDebug(animation) << " Minus";
|
|
||||||
break;
|
|
||||||
case Plus:
|
|
||||||
qCDebug(animation) << " Plus";
|
|
||||||
break;
|
|
||||||
case Multiply:
|
|
||||||
qCDebug(animation) << " Multiply";
|
|
||||||
break;
|
|
||||||
case Modulus:
|
|
||||||
qCDebug(animation) << " Modulus";
|
|
||||||
break;
|
|
||||||
case Error:
|
|
||||||
qCDebug(animation) << " Error";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
AnimExpression::AnimExpression(const QString& str) :
|
AnimExpression::AnimExpression(const QString& str) :
|
||||||
_expression(str) {
|
_expression(str) {
|
||||||
parseExpression(_expression);
|
parseExpression(_expression);
|
||||||
|
@ -130,6 +53,7 @@ AnimExpression::Token AnimExpression::consumeToken(const QString& str, QString::
|
||||||
case '+': ++iter; return Token(Token::Plus);
|
case '+': ++iter; return Token(Token::Plus);
|
||||||
case '*': ++iter; return Token(Token::Multiply);
|
case '*': ++iter; return Token(Token::Multiply);
|
||||||
case '%': ++iter; return Token(Token::Modulus);
|
case '%': ++iter; return Token(Token::Modulus);
|
||||||
|
case ',': ++iter; return Token(Token::Comma);
|
||||||
default:
|
default:
|
||||||
qCCritical(animation) << "AnimExpression: unexpected char" << *iter << "at index " << (int)(iter - str.begin());
|
qCCritical(animation) << "AnimExpression: unexpected char" << *iter << "at index " << (int)(iter - str.begin());
|
||||||
return Token(Token::Error);
|
return Token(Token::Error);
|
||||||
|
@ -261,4 +185,3 @@ AnimExpression::Token AnimExpression::consumeNot(const QString& str, QString::co
|
||||||
return Token(Token::Not);
|
return Token(Token::Not);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ protected:
|
||||||
Plus,
|
Plus,
|
||||||
Multiply,
|
Multiply,
|
||||||
Modulus,
|
Modulus,
|
||||||
|
Comma,
|
||||||
Error
|
Error
|
||||||
};
|
};
|
||||||
Token(Type type) : type(type) {}
|
Token(Type type) : type(type) {}
|
||||||
|
@ -58,9 +59,6 @@ protected:
|
||||||
glm::vec3 vec3Val;
|
glm::vec3 vec3Val;
|
||||||
glm::vec4 vec4Val;
|
glm::vec4 vec4Val;
|
||||||
glm::quat quatVal;
|
glm::quat quatVal;
|
||||||
#ifndef NDEBUG
|
|
||||||
void dump();
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
bool parseExpression(const QString& str);
|
bool parseExpression(const QString& str);
|
||||||
Token consumeToken(const QString& str, QString::const_iterator& iter) const;
|
Token consumeToken(const QString& str, QString::const_iterator& iter) const;
|
||||||
|
|
Loading…
Reference in a new issue