]> git.tdb.fi Git - libs/gl.git/blobdiff - source/programparser.cpp
Add getter for Animation::looping
[libs/gl.git] / source / programparser.cpp
index b607e1cfb8f063abfec2127b7c57247809677a81..4f08b97718d26afe4ab1b41b60af3ee5f737d70b 100644 (file)
@@ -3,6 +3,8 @@
 #include <msp/strings/regex.h>
 #include "programparser.h"
 
+#undef interface
+
 using namespace std;
 
 namespace Msp {
@@ -484,7 +486,9 @@ RefPtr<Node> ProgramParser::parse_statement()
        if(token=="if")
                return parse_conditional();
        else if(token=="for")
-               return parse_iteration();
+               return parse_for();
+       else if(token=="while")
+               return parse_while();
        else if(token=="passthrough")
                return parse_passthrough();
        else if(token=="return")
@@ -843,7 +847,7 @@ RefPtr<Conditional> ProgramParser::parse_conditional()
        return cond;
 }
 
-RefPtr<Iteration> ProgramParser::parse_iteration()
+RefPtr<Iteration> ProgramParser::parse_for()
 {
        expect("for");
        expect("(");
@@ -873,6 +877,19 @@ RefPtr<Iteration> ProgramParser::parse_iteration()
        return loop;
 }
 
+RefPtr<Iteration> ProgramParser::parse_while()
+{
+       expect("while");
+       expect("(");
+       RefPtr<Iteration> loop = new Iteration;
+       loop->condition = parse_expression();
+       expect(")");
+
+       parse_block(loop->body, false);
+
+       return loop;
+}
+
 RefPtr<Passthrough> ProgramParser::parse_passthrough()
 {
        expect("passthrough");