[opengtl-commits] [254] parse vectors types |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/opengtl-commits Archives
]
Revision: 254
Author: cyrille
Date: 2008-06-27 22:37:48 +0200 (Fri, 27 Jun 2008)
Log Message:
-----------
parse vectors types
Modified Paths:
--------------
trunk/OpenGTL/OpenShiva/OpenShiva/Parser_p.cpp
trunk/OpenGTL/OpenShiva/OpenShiva/Parser_p.h
Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Parser_p.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Parser_p.cpp 2008-06-27 20:37:36 UTC (rev 253)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Parser_p.cpp 2008-06-27 20:37:48 UTC (rev 254)
@@ -26,6 +26,7 @@
#include <GTLCore/AST/Statement.h>
#include <GTLCore/AST/Tree.h>
+#include <GTLCore/TypeManager.h>
namespace AST = GTLCore::AST;
using namespace OpenShiva;
@@ -149,3 +150,33 @@
return 0;
}
}
+
+const GTLCore::Type* Parser::parseType()
+{
+ switch( currentToken().type )
+ {
+ case GTLCore::Token::BOOL2:
+ getNextToken();
+ return typeManager()->getVector( GTLCore::Type::Boolean, 2 );
+ case GTLCore::Token::BOOL3:
+ case GTLCore::Token::BOOL4:
+ getNextToken();
+ return typeManager()->getVector( GTLCore::Type::Boolean, 4 );
+ case GTLCore::Token::INT2:
+ getNextToken();
+ return typeManager()->getVector( GTLCore::Type::Integer32, 2 );
+ case GTLCore::Token::INT3:
+ case GTLCore::Token::INT4:
+ getNextToken();
+ return typeManager()->getVector( GTLCore::Type::Integer32, 4 );
+ case GTLCore::Token::FLOAT2:
+ getNextToken();
+ return typeManager()->getVector( GTLCore::Type::Float, 2 );
+ case GTLCore::Token::FLOAT3:
+ case GTLCore::Token::FLOAT4:
+ getNextToken();
+ return typeManager()->getVector( GTLCore::Type::Float, 4 );
+ default:
+ return GTLCore::ParserBase::parseType();
+ }
+}
Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Parser_p.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Parser_p.h 2008-06-27 20:37:36 UTC (rev 253)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Parser_p.h 2008-06-27 20:37:48 UTC (rev 254)
@@ -39,6 +39,7 @@
protected:
virtual GTLCore::AST::Tree* tree();
virtual GTLCore::AST::Statement* parseStatement();
+ virtual const GTLCore::Type* parseType();
private:
void parseKernelBody();
private: