Commit 88b4dd35 authored by Roberto Raggi's avatar Roberto Raggi Committed by Roberto Raggi
Browse files

Fixes: Parsing of objc message expressions.

parent 58ff27bd
......@@ -2589,7 +2589,7 @@ bool Parser::parseObjCExpression(ExpressionAST *&node)
return parseObjCSelectorExpression(node);
case T_LBRACKET:
break;
return parseObjCMessageExpression(node);
case T_AT_STRING_LITERAL:
return parseObjCStringLiteral(node);
......@@ -2651,6 +2651,61 @@ bool Parser::parseObjCSelectorExpression(ExpressionAST *&)
return true;
}
bool Parser::parseObjCMessageExpression(ExpressionAST *&)
{
if (LA() != T_LBRACKET)
return false;
/*unsigned lbracket_token = */ consumeToken();
parseObjCMessageReceiver();
parseObjCMessageArguments();
unsigned rbracket_token = 0;
match(T_RBRACKET, &rbracket_token);
return true;
}
bool Parser::parseObjCMessageReceiver()
{
ExpressionAST *expression = 0;
return parseExpression(expression);
}
bool Parser::parseObjCMessageArguments()
{
if (LA() == T_RBRACKET)
return false; // nothing to do.
unsigned start = cursor();
if (parseObjCSelectorArgs()) {
while (LA() == T_COMMA) {
consumeToken(); // skip T_COMMA
ExpressionAST *expression = 0;
parseAssignmentExpression(expression);
}
return true;
}
rewind(start);
parseObjCSelector();
return true;
}
bool Parser::parseObjCSelectorArgs()
{
parseObjCSelector();
if (LA() != T_COLON)
return false;
/*unsigned colon_token = */consumeToken();
ExpressionAST *expression = 0;
parseAssignmentExpression(expression);
return true;
}
bool Parser::parseObjCMethodSignature()
{
if (parseObjCSelector()) {
......
......@@ -223,6 +223,10 @@ public:
bool parseObjCSelectorExpression(ExpressionAST *&node);
bool parseObjCStringLiteral(ExpressionAST *&node);
bool parseObjCMethodSignature();
bool parseObjCMessageExpression(ExpressionAST *&node);
bool parseObjCMessageReceiver();
bool parseObjCMessageArguments();
bool parseObjCSelectorArgs();
bool parseObjCProtocolRefs();
bool parseObjClassInstanceVariables();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment