Removed vec literals tokens and renamed int and float token types

This commit is contained in:
Anthony J. Thibault 2015-11-01 16:01:29 -08:00
parent 4394083138
commit 32c40d37c0
2 changed files with 6 additions and 9 deletions

View file

@ -25,11 +25,8 @@ protected:
enum Type { enum Type {
End = 0, End = 0,
Identifier, Identifier,
LiteralInt, Int,
LiteralFloat, Float,
LiteralVec3,
LiteralVec4,
LiteralQuat,
And, And,
Or, Or,
GreaterThan, GreaterThan,
@ -50,8 +47,8 @@ protected:
}; };
Token(Type type) : type(type) {} Token(Type type) : type(type) {}
Token(const QStringRef& strRef) : type(Type::Identifier), strVal(strRef.toString()) {} Token(const QStringRef& strRef) : type(Type::Identifier), strVal(strRef.toString()) {}
Token(int val) : type(Type::LiteralInt), intVal(val) {} Token(int val) : type(Type::Int), intVal(val) {}
Token(float val) : type(Type::LiteralFloat), floatVal(val) {} Token(float val) : type(Type::Float), floatVal(val) {}
Type type = End; Type type = End;
QString strVal; QString strVal;
int intVal; int intVal;

View file

@ -331,7 +331,7 @@ void AnimTests::testTokenizer() {
AnimExpression::Token token = e.consumeToken(str, iter); AnimExpression::Token token = e.consumeToken(str, iter);
QVERIFY(token.type == AnimExpression::Token::LeftParen); QVERIFY(token.type == AnimExpression::Token::LeftParen);
token = e.consumeToken(str, iter); token = e.consumeToken(str, iter);
QVERIFY(token.type == AnimExpression::Token::LiteralInt); QVERIFY(token.type == AnimExpression::Token::Int);
QVERIFY(token.intVal == 10); QVERIFY(token.intVal == 10);
token = e.consumeToken(str, iter); token = e.consumeToken(str, iter);
QVERIFY(token.type == AnimExpression::Token::Plus); QVERIFY(token.type == AnimExpression::Token::Plus);
@ -343,7 +343,7 @@ void AnimTests::testTokenizer() {
token = e.consumeToken(str, iter); token = e.consumeToken(str, iter);
QVERIFY(token.type == AnimExpression::Token::GreaterThanEqual); QVERIFY(token.type == AnimExpression::Token::GreaterThanEqual);
token = e.consumeToken(str, iter); token = e.consumeToken(str, iter);
QVERIFY(token.type == AnimExpression::Token::LiteralFloat); QVERIFY(token.type == AnimExpression::Token::Float);
QVERIFY(fabsf(token.floatVal - 20.1f) < 0.0001f); QVERIFY(fabsf(token.floatVal - 20.1f) < 0.0001f);
token = e.consumeToken(str, iter); token = e.consumeToken(str, iter);
QVERIFY(token.type == AnimExpression::Token::And); QVERIFY(token.type == AnimExpression::Token::And);