Commit 58ff27bd authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Fixes: Parsing of objc string literals and selector expressions.

parent debe2a0d
......@@ -2586,13 +2586,13 @@ bool Parser::parseObjCExpression(ExpressionAST *&node)
return parseObjCProtocolExpression(node);
case T_AT_SELECTOR:
break;
return parseObjCSelectorExpression(node);
case T_LBRACKET:
break;
case T_AT_STRING_LITERAL:
break;
return parseObjCStringLiteral(node);
default:
break;
......@@ -2600,6 +2600,21 @@ bool Parser::parseObjCExpression(ExpressionAST *&node)
return false;
}
bool Parser::parseObjCStringLiteral(ExpressionAST *&node)
{
if (LA() != T_AT_STRING_LITERAL)
return false;
StringLiteralAST **ast = reinterpret_cast<StringLiteralAST **> (&node);
while (LA() == T_AT_STRING_LITERAL) {
*ast = new (_pool) StringLiteralAST;
(*ast)->token = consumeToken();
ast = &(*ast)->next;
}
return true;
}
bool Parser::parseObjCEncodeExpression(ExpressionAST *&)
{
if (LA() != T_AT_ENCODE)
......@@ -2623,6 +2638,31 @@ bool Parser::parseObjCProtocolExpression(ExpressionAST *&)
return true;
}
bool Parser::parseObjCSelectorExpression(ExpressionAST *&)
{
if (LA() != T_AT_SELECTOR)
return false;
/*unsigned selector_token = */consumeToken();
unsigned lparen_token = 0, rparen_token = 0;
match(T_LPAREN, &lparen_token);
parseObjCMethodSignature();
match(T_RPAREN, &rparen_token);
return true;
}
bool Parser::parseObjCMethodSignature()
{
if (parseObjCSelector()) {
while (LA() == T_COMMA) {
consumeToken(); // skip T_COMMA
parseObjCSelector();
}
return true;
}
return false;
}
bool Parser::parseNameId(NameAST *&name)
{
unsigned start = cursor();
......
......@@ -220,6 +220,9 @@ public:
bool parseObjCEncodeExpression(ExpressionAST *&node);
bool parseObjCProtocolExpression(ExpressionAST *&node);
bool parseObjCSelectorExpression(ExpressionAST *&node);
bool parseObjCStringLiteral(ExpressionAST *&node);
bool parseObjCMethodSignature();
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