]> git.tdb.fi Git - libs/gl.git/blobdiff - source/programparser.cpp
Remove an XXX because I no longer remember how to reproduce the issue
[libs/gl.git] / source / programparser.cpp
index e7343547da1f5f736da555d68a1f4edeeef76a42..3b87ea7b58b1a2a16c1a09d3cd6432c53009d73f 100644 (file)
@@ -263,7 +263,7 @@ void ProgramParser::skip_comment_and_whitespace()
                {
                        if(*iter=='/')
                                comment = 0;
-                       else
+                       else if(*iter!='*')
                                comment = 3;
                }
 
@@ -315,7 +315,12 @@ bool ProgramParser::is_interface_qualifier(const string &token)
 
 bool ProgramParser::is_sampling_qualifier(const string &token)
 {
-       return token=="centroid";
+       return (token=="centroid" || token=="sample");
+}
+
+bool ProgramParser::is_interpolation_qualifier(const string &token)
+{
+       return (token=="smooth" || token=="flat" || token=="noperspective");
 }
 
 bool ProgramParser::is_precision_qualifier(const string &token)
@@ -325,7 +330,11 @@ bool ProgramParser::is_precision_qualifier(const string &token)
 
 bool ProgramParser::is_qualifier(const string &token)
 {
-       return (token=="const" || is_interface_qualifier(token) || is_sampling_qualifier(token) || is_precision_qualifier(token));
+       return (token=="const" ||
+               is_interface_qualifier(token) ||
+               is_sampling_qualifier(token) ||
+               is_interpolation_qualifier(token) ||
+               is_precision_qualifier(token));
 }
 
 bool ProgramParser::is_builtin_type(const string &token)
@@ -449,7 +458,7 @@ RefPtr<Node> ProgramParser::parse_global_declaration()
        else if(is_interface_qualifier(token))
        {
                string next = peek_token(1);
-               if(is_type(next) || is_precision_qualifier(next))
+               if(is_type(next) || is_qualifier(next))
                        return parse_variable_declaration();
                else
                        return parse_interface_block();
@@ -718,25 +727,22 @@ RefPtr<VariableDeclaration> ProgramParser::parse_variable_declaration()
        RefPtr<VariableDeclaration> var = new VariableDeclaration;
 
        string token = peek_token();
-       if(is_sampling_qualifier(token))
+       while(is_qualifier(token))
        {
-               var->sampling = parse_token();
-               token = peek_token();
-               if(!is_interface_qualifier(token))
-                       throw runtime_error(format_syntax_error("an interface qualifier"));
-       }
-
-       if(is_interface_qualifier(token))
-               var->interface = parse_token();
-       else if(token=="const")
-       {
-               var->constant = true;
                parse_token();
+               if(is_interface_qualifier(token))
+                       var->interface = token;
+               else if(is_sampling_qualifier(token))
+                       var->sampling = token;
+               else if(is_interpolation_qualifier(token))
+                       var->interpolation = token;
+               else if(is_precision_qualifier(token))
+                       var->precision = token;
+               else if(token=="const")
+                       var->constant = true;
+               token = peek_token();
        }
 
-       if(is_precision_qualifier(token))
-               var->precision = parse_token();
-
        var->type = expect_type();
        var->name = expect_identifier();
 
@@ -770,6 +776,9 @@ RefPtr<FunctionDeclaration> ProgramParser::parse_function_declaration()
                        expect(",");
 
                RefPtr<VariableDeclaration> var = new VariableDeclaration;
+               string token = peek_token();
+               if(token=="in" || token=="out" || token=="inout")
+                       var->interface = parse_token();
                var->type = expect_type();
                var->name = expect_identifier();
                func->parameters.push_back(var);