Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r44a81853 r8f60f0b  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jan 18 15:51:25 2017
    13 // Update Count     : 2135
     12// Last Modified On : Wed Dec 14 21:28:22 2016
     13// Update Count     : 2090
    1414//
    1515
     
    3232//
    3333// 1. designation with and without '=' (use ':' instead)
     34// 2. attributes not allowed in parenthesis of declarator
    3435//
    3536// All of the syntactic extensions for GCC C are marked with the comment "GCC". The second extensions are for Cforall
     
    135136
    136137%type<tok> identifier  no_01_identifier  no_attr_identifier zero_one
    137 %type<tok> identifier_or_type_name  no_attr_identifier_or_type_name  no_01_identifier_or_type_name  attr_name
     138%type<tok> identifier_or_type_name  no_attr_identifier_or_type_name  no_01_identifier_or_type_name
    138139%type<constant> string_literal
    139140%type<str> string_literal_list
     
    252253%type<decl> variable_abstract_ptr variable_array variable_declarator variable_function variable_ptr
    253254
    254 %type<decl> attribute_list_opt attribute_list attribute_name_list attribute attribute_name
     255%type<decl> attribute_list_opt attribute_list attribute
    255256
    256257// initializers
     
    708709
    709710labeled_statement:
    710                 // labels cannot be identifiers 0 or 1 or ATTR_IDENTIFIER
    711         identifier_or_type_name ':' attribute_list_opt statement
    712                 {
    713                         $$ = $4->add_label( $1, $3 );
     711                // labels cannot be identifiers 0 or 1
     712        IDENTIFIER ':' attribute_list_opt statement
     713                {
     714                        $$ = $4->add_label( $1 );
    714715                }
    715716        ;
     
    876877
    877878jump_statement:
    878         GOTO identifier_or_type_name ';'
     879        GOTO IDENTIFIER ';'
    879880                { $$ = new StatementNode( build_branch( $2, BranchStmt::Goto ) ); }
    880881        | GOTO '*' comma_expression ';'                                         // GCC, computed goto
     
    885886                // A semantic check is required to ensure this statement appears only in the body of an iteration statement.
    886887                { $$ = new StatementNode( build_branch( BranchStmt::Continue ) ); }
    887         | CONTINUE identifier_or_type_name ';'                          // CFA, multi-level continue
     888        | CONTINUE IDENTIFIER ';'                                                       // CFA, multi-level continue
    888889                // A semantic check is required to ensure this statement appears only in the body of an iteration statement, and
    889890                // the target of the transfer appears only at the start of an iteration statement.
     
    892893                // A semantic check is required to ensure this statement appears only in the body of an iteration statement.
    893894                { $$ = new StatementNode( build_branch( BranchStmt::Break ) ); }
    894         | BREAK identifier_or_type_name ';'                                     // CFA, multi-level exit
     895        | BREAK IDENTIFIER ';'                                                          // CFA, multi-level exit
    895896                // A semantic check is required to ensure this statement appears only in the body of an iteration statement, and
    896897                // the target of the transfer appears only at the start of an iteration statement.
     
    13251326        type_qualifier_name
    13261327        | attribute
     1328                //{ $$ = DeclarationNode::newQualifier( DeclarationNode::Attribute ); }
    13271329        ;
    13281330
     
    21752177
    21762178attribute:                                                                                              // GCC
    2177         ATTRIBUTE '(' '(' attribute_name_list ')' ')'
    2178                 { $$ = $4; }
    2179         ;
    2180 
    2181 attribute_name_list:                                                                    // GCC
    2182         attribute_name
    2183         | attribute_name_list ',' attribute_name
    2184                 { $$ = $1->addQualifiers( $3 ); }
    2185         ;
    2186 
    2187 attribute_name:                                                                                 // GCC
     2179        ATTRIBUTE '(' '(' attribute_parameter_list ')' ')'
     2180        //              { $$ = DeclarationNode::newQualifier( DeclarationNode::Attribute ); }
     2181                { $$ = nullptr; }
     2182        ;
     2183
     2184attribute_parameter_list:                                                               // GCC
     2185        attrib
     2186        | attribute_parameter_list ',' attrib
     2187        ;
     2188
     2189attrib:                                                                                                 // GCC
    21882190        // empty
    2189                 { $$ = nullptr; }
    2190         | attr_name
    2191                 { $$ = DeclarationNode::newAttribute( $1 ); }
    2192         | attr_name '(' argument_expression_list ')'
    2193                 { $$ = DeclarationNode::newAttribute( $1, $3 ); }
    2194         ;
    2195 
    2196 attr_name:                                                                                              // GCC
    2197         IDENTIFIER
    2198         | TYPEDEFname
    2199         | TYPEGENname
    2200         | CONST
    2201                 { $$ = Token{ new string( "__const__" ) }; }
     2191        | any_word
     2192        | any_word '(' comma_expression_opt ')' { delete $3; } // FIX ME: unimplemented
     2193        ;
     2194
     2195any_word:                                                                                               // GCC
     2196        identifier_or_type_name { delete $1; }                          // FIX ME: unimplemented
     2197        | storage_class { delete $1; }                                          // FIX ME: unimplemented
     2198        | basic_type_name { delete $1; }                                        // FIX ME: unimplemented
     2199        | type_qualifier { delete $1; }                                         // FIX ME: unimplemented
    22022200        ;
    22032201
Note: See TracChangeset for help on using the changeset viewer.