X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fprogramparser.cpp;h=f003a835b56b0352e7abe2387bcaff24792d87ce;hb=2b073e0a3808f8ece4b93669395e4b812214cf5d;hp=36cc6e081b1da26d5ef745b9bd7a66e8ff7099b5;hpb=7cd066816f7faab6f8f0eba1fca4dee67ee5dc3b;p=libs%2Fgl.git diff --git a/source/programparser.cpp b/source/programparser.cpp index 36cc6e08..f003a835 100644 --- a/source/programparser.cpp +++ b/source/programparser.cpp @@ -522,7 +522,7 @@ Expression *ProgramParser::parse_expression(unsigned precedence) BinaryExpression *ProgramParser::parse_binary(Expression *left, const Operator *oper) { - RefPtr binary = new BinaryExpression; + RefPtr binary = (oper->precedence==16 ? new Assignment : new BinaryExpression); binary->left = left; binary->oper = parse_token(); if(binary->oper=="[") @@ -533,7 +533,6 @@ BinaryExpression *ProgramParser::parse_binary(Expression *left, const Operator * } else binary->right = parse_expression(oper->precedence+(oper->assoc==RIGHT_TO_LEFT)); - binary->assignment = (oper->precedence==16); return binary.release(); } @@ -650,7 +649,16 @@ InterfaceBlock *ProgramParser::parse_interface_block() iface->name = expect_identifier(); parse_block(iface->members, true); - expect(";"); + if(!check(";")) + { + iface->instance_name = expect_identifier(); + if(check("[")) + { + iface->array = true; + expect("]"); + } + expect(";"); + } return iface.release(); }