Implement parsing of casts, implementing Parser/statements.c:test6

llvm-svn: 38868
This commit is contained in:
Chris Lattner 2006-08-11 01:38:28 +00:00
parent eddbcb2b12
commit a092cd1f1b
1 changed files with 7 additions and 4 deletions

View File

@ -21,6 +21,10 @@ void Parser::ParseInitializer() {
// FIXME: STUB. // FIXME: STUB.
if (Tok.getKind() == tok::l_brace) { if (Tok.getKind() == tok::l_brace) {
ConsumeBrace(); ConsumeBrace();
if (Tok.getKind() == tok::numeric_constant)
ConsumeToken();
// FIXME: initializer-list // FIXME: initializer-list
// Match the '}'. // Match the '}'.
MatchRHSPunctuation(tok::r_brace, Tok.getLocation(), "{", MatchRHSPunctuation(tok::r_brace, Tok.getLocation(), "{",
@ -53,7 +57,7 @@ void Parser::ParseCastExpression() {
if (Tok.getKind() != tok::l_paren) if (Tok.getKind() != tok::l_paren)
return ParseUnaryExpression(); return ParseUnaryExpression();
ParenParseOption ParenExprType = CompoundLiteral; ParenParseOption ParenExprType = CastExpr;
ParseParenExpression(ParenExprType); ParseParenExpression(ParenExprType);
switch (ParenExprType) { switch (ParenExprType) {
@ -62,7 +66,8 @@ void Parser::ParseCastExpression() {
case CompoundLiteral: case CompoundLiteral:
// We parsed '(' type-name ')' '{' ... '}'. If any suffixes of // We parsed '(' type-name ')' '{' ... '}'. If any suffixes of
// postfix-expression exist, parse them now. // postfix-expression exist, parse them now.
assert(0 && "FIXME"); //Diag(Tok, diag::err_parse_error);
//assert(0 && "FIXME");
break; break;
case CastExpr: case CastExpr:
// We parsed '(' type-name ')' and the thing after it wasn't a '{'. Parse // We parsed '(' type-name ')' and the thing after it wasn't a '{'. Parse
@ -70,8 +75,6 @@ void Parser::ParseCastExpression() {
ParseCastExpression(); ParseCastExpression();
break; break;
} }
// If ParenExprType could have a postfix expr after it, handle it now.
assert(0);
} }
/// ParseUnaryExpression /// ParseUnaryExpression