• Wang Hoi's avatar
    C: Parser: Support parsing of c99 designated initializers · c56b999f
    Wang Hoi authored
    In case:
    
        int a[6] = { [4] = 29, [2] = 15 };
        struct point { int x, y; };
        struct point p = { .y = 3, .x = 2 };
    
    Grammar change when c99 language feature is enabled:
    old grammar:
    
        braced-init-list :: '{' initializer-list '}'
    
    new grammar:
    
        braced-init-list :: '{' designated-initializer-list '}'
        designated-initializer-list :: designated-initializer (',' designated-initializer )*
        designated-initializer :: designator* initializer-clause
        designator :: '.' identifier
                    | '[' constant-expression ']'
    
    Task-number: QTCREATORBUG-1902
    Change-Id: Ib99d6f553f8d0f50ba3eff86f3a2e86d73372426
    Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
    c56b999f
ASTVisit.cpp 28.8 KB