X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fparser.cpp;h=a2e3296d81b9c52ff70139a3cf91f747aed03485;hb=a4cd67f1c9f1f375bacacfbb421d40f78a22644b;hp=0c3a5e35a57a35033024989aa96076b06bd141cd;hpb=3a1fe833ea04df75449706f1d773f6e65521a392;p=libs%2Fgl.git diff --git a/source/glsl/parser.cpp b/source/glsl/parser.cpp index 0c3a5e35..a2e3296d 100644 --- a/source/glsl/parser.cpp +++ b/source/glsl/parser.cpp @@ -294,6 +294,8 @@ RefPtr 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)=="(") @@ -494,10 +496,8 @@ RefPtr Parser::parse_expression(const Operator *outer_oper) if(token=="(") { tokenizer.parse_token(); - RefPtr parexpr = create_node(); - parexpr->expression = parse_expression(); + left = parse_expression(); tokenizer.expect(")"); - left = parexpr; } else if(isdigit(token[0]) || token=="true" || token=="false") left = parse_literal(); @@ -549,10 +549,10 @@ RefPtr Parser::parse_binary(const RefPtr &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 +750,7 @@ RefPtr Parser::parse_function_declaration() { RefPtr func = create_node(); + func->virtua = check("virtual"); func->return_type = expect_type(); func->name = expect_identifier(); tokenizer.expect("("); @@ -768,6 +769,8 @@ RefPtr Parser::parse_function_declaration() } tokenizer.expect(")"); + func->overrd = check("override"); + string token = tokenizer.peek_token(); if(token=="{") {