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

View file

@ -331,7 +331,7 @@ void AnimTests::testTokenizer() {
AnimExpression::Token token = e.consumeToken(str, iter);
QVERIFY(token.type == AnimExpression::Token::LeftParen);
token = e.consumeToken(str, iter);
QVERIFY(token.type == AnimExpression::Token::LiteralInt);
QVERIFY(token.type == AnimExpression::Token::Int);
QVERIFY(token.intVal == 10);
token = e.consumeToken(str, iter);
QVERIFY(token.type == AnimExpression::Token::Plus);
@ -343,7 +343,7 @@ void AnimTests::testTokenizer() {
token = e.consumeToken(str, iter);
QVERIFY(token.type == AnimExpression::Token::GreaterThanEqual);
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);
token = e.consumeToken(str, iter);
QVERIFY(token.type == AnimExpression::Token::And);