Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r51b1202 r7f5566b  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Aug 11 16:01:49 2015
    13 // Update Count     : 1350
     12// Last Modified On : Thu Jul 30 15:29:19 2015
     13// Update Count     : 1327
    1414//
    1515
     
    338338        | zero_one
    339339                { $$ = new VarRefNode( $1 ); }
     340        | constant
     341                { $$ = $1; }
     342        | string_literal_list
     343                { $$ = $1; }
    340344        | '(' comma_expression ')'
    341345                { $$ = $2; }
     
    410414unary_expression:
    411415        postfix_expression
    412         // first location where constant/string can have operator applied: sizeof 3/sizeof "abc"
    413         // still requires semantics checks, e.g., ++3, 3--, *3, &&3
    414         | constant
    415                 { $$ = $1; }
    416         | string_literal_list
    417                 { $$ = $1; }
    418416        | ICR unary_expression
    419417                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Incr ), $2 ); }
     
    643641                // requires its own scope
    644642          push push
    645           local_label_declaration_opt                                           // GCC, local labels
     643          label_declaration_opt                                                         // GCC, local labels
    646644          block_item_list pop '}'                                                       // C99, intermix declarations and statements
    647645                { $$ = new CompoundStmtNode( $5 ); }
     
    951949        ;
    952950
    953 local_label_declaration_opt:                                                    // GCC, local label
     951label_declaration_opt:                                                                  // GCC, local label
    954952        // empty
    955         | local_label_declaration_list
    956         ;
    957 
    958 local_label_declaration_list:                                                   // GCC, local label
    959         LABEL local_label_list ';'
    960         | local_label_declaration_list LABEL local_label_list ';'
    961         ;
    962 
    963 local_label_list:                                                                               // GCC, local label
     953        | label_declaration_list
     954        ;
     955
     956label_declaration_list:                                                                 // GCC, local label
     957        LABEL label_list ';'
     958        | label_declaration_list LABEL label_list ';'
     959        ;
     960
     961label_list:                                                                                             // GCC, local label
    964962        no_attr_identifier_or_type_name                         {}
    965         | local_label_list ',' no_attr_identifier_or_type_name {}
     963        | label_list ',' no_attr_identifier_or_type_name {}
    966964        ;
    967965
     
    16931691
    16941692designator:
    1695         // only ".0" and ".1" allowed => semantic check
    1696         FLOATINGconstant
    1697                 { $$ = new DesignatorNode( new VarRefNode( $1 ) ); }
    1698         | '.' no_attr_identifier_or_type_name                           // C99, field name
    1699                 { $$ = new DesignatorNode( new VarRefNode( $2 ) ); }
     1693        '.' no_attr_identifier_or_type_name                                     // C99, field name
     1694                { $$ = new VarRefNode( $2 ); }
    17001695        | '[' push assignment_expression pop ']'                        // C99, single array element
    17011696                // assignment_expression used instead of constant_expression because of shift/reduce conflicts with tuple.
    1702                 { $$ = new DesignatorNode( $3, true ); }
     1697                { $$ = $3; }
    17031698        | '[' push subrange pop ']'                                                     // CFA, multiple array elements
    1704                 { $$ = new DesignatorNode( $3, true ); }
     1699                { $$ = $3; }
    17051700        | '[' push constant_expression ELLIPSIS constant_expression pop ']' // GCC, multiple array elements
    1706                 { $$ = new DesignatorNode( new CompositeExprNode( new OperatorNode( OperatorNode::Range ), $3, $5 ), true ); }
     1701                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Range ), $3, $5 ); }
    17071702        | '.' '[' push field_list pop ']'                                       // CFA, tuple field selector
    1708                 { $$ = new DesignatorNode( $4 ); }
     1703                { $$ = $4; }
    17091704        ;
    17101705
Note: See TracChangeset for help on using the changeset viewer.