[opengtl-commits] [639] support declaration of multiple dependent on the same line

[ Thread Index | Date Index | More lists.tuxfamily.org/opengtl-commits Archives ]


Revision: 639
Author:   cyrille
Date:     2009-03-16 17:47:02 +0100 (Mon, 16 Mar 2009)

Log Message:
-----------
support declaration of multiple dependent on the same line

Modified Paths:
--------------
    trunk/OpenGTL/OpenShiva/OpenShiva/Parser_p.cpp
    trunk/OpenGTL/OpenShiva/tests/parse/CMakeLists.txt

Added Paths:
-----------
    trunk/OpenGTL/OpenShiva/tests/parse/multipledependent.shiva


Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Parser_p.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Parser_p.cpp	2009-03-16 16:22:02 UTC (rev 638)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Parser_p.cpp	2009-03-16 16:47:02 UTC (rev 639)
@@ -270,15 +270,14 @@
 {
   getNextToken();
   const GTLCore::Type* type = parseType();
-  if( isOfType( currentToken(), GTLCore::Token::IDENTIFIER ) )
+  while(true)
   {
-    GTLCore::String name = currentToken().string;
-    getNextToken();
-    std::list<int> memberArraySize = expressionsListToIntegersList( parseArraySize(true) );
-    type = d->compiler->typesManager()->getArray( type, memberArraySize.size() );
-    if( isOfType( currentToken(), GTLCore::Token::SEMI ) )
+    if( isOfType( currentToken(), GTLCore::Token::IDENTIFIER ) )
     {
-      getNextToken();
+      GTLCore::String name = currentToken().string;
+      GTL_DEBUG("Dependent: " << name);
+      std::list<int> memberArraySize = expressionsListToIntegersList( parseArraySize(true) );
+      type = d->compiler->typesManager()->getArray( type, memberArraySize.size() );
       GTLCore::ScopedName scopedName( nameSpace(), name );
       if( tree()->containsGlobalConstant( scopedName ) )
       {
@@ -289,12 +288,20 @@
         d->dependents.push_back( gcd->variable() );
         tree()->append( gcd );
       }
+      getNextToken();
+    } else {
+      GTL_DEBUG("Unexpected");
+      reportUnexpected( currentToken() );
+      reachNextSemi();
     }
-  } else {
-    GTL_DEBUG("Unexpected");
-    reportUnexpected( currentToken() );
-    reachNextSemi();
+    if( currentToken().type == GTLCore::Token::COMA ) {
+      getNextToken();
+    } else {
+      break;
+    }
   }
+  isOfType( currentToken(), GTLCore::Token::SEMI );
+  getNextToken();
 }
 
 void Parser::startParsingFunction( const GTLCore::String& _name )

Modified: trunk/OpenGTL/OpenShiva/tests/parse/CMakeLists.txt
===================================================================
--- trunk/OpenGTL/OpenShiva/tests/parse/CMakeLists.txt	2009-03-16 16:22:02 UTC (rev 638)
+++ trunk/OpenGTL/OpenShiva/tests/parse/CMakeLists.txt	2009-03-16 16:47:02 UTC (rev 639)
@@ -5,6 +5,7 @@
   for.shiva
   region.shiva
   import.shiva
+  multipledependent.shiva
   )
 
 FOREACH( TEST_FILE ${TESTS_FILES} )

Added: trunk/OpenGTL/OpenShiva/tests/parse/multipledependent.shiva
===================================================================
--- trunk/OpenGTL/OpenShiva/tests/parse/multipledependent.shiva	                        (rev 0)
+++ trunk/OpenGTL/OpenShiva/tests/parse/multipledependent.shiva	2009-03-16 16:47:02 UTC (rev 639)
@@ -0,0 +1,10 @@
+kernel MyKernel
+{
+  dependent float     r1, r2, p1, p2, w, h, alphaThreshold;
+  dependent float2    _shift, _center, _rotate, _zoom, xBounds, yBounds, xyMiddle, minDimension;
+  dependent bool      showPoles, hyperDroste, tileBasedOnTransparency, transparentPointsIn, twist;
+  void evaluatePixel(output pixel result)
+  {
+    
+  }
+}


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/