]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/parser.cpp
Rearrange operator metadata
[libs/gl.git] / source / glsl / parser.cpp
index 0c3a5e35a57a35033024989aa96076b06bd141cd..7b034a4c671f1d854a06cfabcaad83d94859aa88 100644 (file)
@@ -294,6 +294,8 @@ RefPtr<Statement> Parser::parse_global_declaration()
        }
        else if(is_qualifier(token))
                return parse_variable_declaration();
+       else if(token=="virtual")
+               return parse_function_declaration();
        else if(is_type(token))
        {
                if(tokenizer.peek_token(2)=="(")
@@ -549,10 +551,10 @@ RefPtr<BinaryExpression> Parser::parse_binary(const RefPtr<Expression> &left, co
        binary->left = left;
        binary->oper = &oper;
        tokenizer.expect(oper.token);
-       if(oper.token[0]=='[')
+       if(oper.token2[0])
        {
                binary->right = parse_expression();
-               tokenizer.expect("]");
+               tokenizer.expect(oper.token2);
        }
        else
                binary->right = parse_expression(&oper);
@@ -750,6 +752,7 @@ RefPtr<FunctionDeclaration> Parser::parse_function_declaration()
 {
        RefPtr<FunctionDeclaration> func = create_node<FunctionDeclaration>();
 
+       func->virtua = check("virtual");
        func->return_type = expect_type();
        func->name = expect_identifier();
        tokenizer.expect("(");
@@ -768,6 +771,8 @@ RefPtr<FunctionDeclaration> Parser::parse_function_declaration()
        }
        tokenizer.expect(")");
 
+       func->overrd = check("override");
+
        string token = tokenizer.peek_token();
        if(token=="{")
        {