Changeset 644

Show
Ignore:
Timestamp:
08/28/10 16:38:24 (1 year ago)
Author:
walter
Message:

Issue 2477 - Trailing comma in array literal sometimes accepted, sometimes not

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/parse.c

    r633 r644  
    17071707    {   int isvariadic = 0; 
    17081708 
    1709         while (1
     1709        while (token.value != TOKrparen
    17101710        {   TemplateParameter *tp; 
    17111711            Identifier *tp_ident = NULL; 
     
    19601960 
    19611961    // Get TemplateArgumentList 
    1962     if (token.value != endtok) 
    1963     { 
    1964         while (1) 
    1965         { 
     1962    while (token.value != endtok) 
     1963    { 
    19661964            // See if it is an Expression or a Type 
    19671965            if (isDeclaration(&token, 0, TOKreserved, NULL)) 
     
    20272025                break; 
    20282026            nextToken(); 
    2029         } 
    20302027    } 
    20312028    check(endtok, "template argument list"); 
     
    52665263 
    52675264            nextToken(); 
    5268             if (token.value != TOKrbracket) 
    5269             { 
    5270                 while (token.value != TOKeof) 
    5271                 { 
     5265            while (token.value != TOKrbracket && token.value != TOKeof) 
     5266            { 
    52725267                    Expression *e = parseAssignExp(); 
    52735268                    if (token.value == TOKcolon && (keys || values->dim == 0)) 
     
    52875282                        break; 
    52885283                    check(TOKcomma); 
    5289                 } 
    5290             } 
    5291             check(TOKrbracket); 
     5284            } 
     5285            check(loc, TOKrbracket); 
    52925286 
    52935287            if (keys) 
     
    54445438                        { 
    54455439                            nextToken(); 
    5446                             while (1) 
    5447                             {   Expression *arg; 
    5448  
    5449                                 arg = parseAssignExp(); 
     5440                            while (token.value != TOKrbracket && token.value != TOKeof) 
     5441                            { 
     5442                                Expression *arg = parseAssignExp(); 
    54505443                                arguments->push(arg); 
    54515444                                if (token.value == TOKrbracket) 
     
    61466139    { 
    61476140        nextToken(); 
    6148         if (token.value != endtok) 
     6141        while (token.value != endtok) 
    61496142        { 
    6150             while (1) 
    6151             { 
    61526143                arg = parseAssignExp(); 
    61536144                arguments->push(arg); 
     
    61556146                    break; 
    61566147                check(TOKcomma); 
    6157             } 
    61586148        } 
    61596149        check(endtok);