Ignore:
Timestamp:
Jan 19, 2017, 11:04:27 AM (9 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
2175062
Parents:
5ebb2fbc (diff), 68e6031 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:/u/cforall/software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r5ebb2fbc re9e4e9ee  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Dec 14 21:28:22 2016
    13 // Update Count     : 2090
     12// Last Modified On : Wed Jan 18 15:51:25 2017
     13// Update Count     : 2135
    1414//
    1515
     
    3232//
    3333// 1. designation with and without '=' (use ':' instead)
    34 // 2. attributes not allowed in parenthesis of declarator
    3534//
    3635// All of the syntactic extensions for GCC C are marked with the comment "GCC". The second extensions are for Cforall
     
    136135
    137136%type<tok> identifier  no_01_identifier  no_attr_identifier zero_one
    138 %type<tok> identifier_or_type_name  no_attr_identifier_or_type_name  no_01_identifier_or_type_name
     137%type<tok> identifier_or_type_name  no_attr_identifier_or_type_name  no_01_identifier_or_type_name  attr_name
    139138%type<constant> string_literal
    140139%type<str> string_literal_list
     
    253252%type<decl> variable_abstract_ptr variable_array variable_declarator variable_function variable_ptr
    254253
    255 %type<decl> attribute_list_opt attribute_list attribute
     254%type<decl> attribute_list_opt attribute_list attribute_name_list attribute attribute_name
    256255
    257256// initializers
     
    709708
    710709labeled_statement:
    711                 // labels cannot be identifiers 0 or 1
    712         IDENTIFIER ':' attribute_list_opt statement
    713                 {
    714                         $$ = $4->add_label( $1 );
     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 );
    715714                }
    716715        ;
     
    877876
    878877jump_statement:
    879         GOTO IDENTIFIER ';'
     878        GOTO identifier_or_type_name ';'
    880879                { $$ = new StatementNode( build_branch( $2, BranchStmt::Goto ) ); }
    881880        | GOTO '*' comma_expression ';'                                         // GCC, computed goto
     
    886885                // A semantic check is required to ensure this statement appears only in the body of an iteration statement.
    887886                { $$ = new StatementNode( build_branch( BranchStmt::Continue ) ); }
    888         | CONTINUE IDENTIFIER ';'                                                       // CFA, multi-level continue
     887        | CONTINUE identifier_or_type_name ';'                          // CFA, multi-level continue
    889888                // A semantic check is required to ensure this statement appears only in the body of an iteration statement, and
    890889                // the target of the transfer appears only at the start of an iteration statement.
     
    893892                // A semantic check is required to ensure this statement appears only in the body of an iteration statement.
    894893                { $$ = new StatementNode( build_branch( BranchStmt::Break ) ); }
    895         | BREAK IDENTIFIER ';'                                                          // CFA, multi-level exit
     894        | BREAK identifier_or_type_name ';'                                     // CFA, multi-level exit
    896895                // A semantic check is required to ensure this statement appears only in the body of an iteration statement, and
    897896                // the target of the transfer appears only at the start of an iteration statement.
     
    13261325        type_qualifier_name
    13271326        | attribute
    1328                 //{ $$ = DeclarationNode::newQualifier( DeclarationNode::Attribute ); }
    13291327        ;
    13301328
     
    21772175
    21782176attribute:                                                                                              // GCC
    2179         ATTRIBUTE '(' '(' attribute_parameter_list ')' ')'
    2180         //              { $$ = DeclarationNode::newQualifier( DeclarationNode::Attribute ); }
     2177        ATTRIBUTE '(' '(' attribute_name_list ')' ')'
     2178                { $$ = $4; }
     2179        ;
     2180
     2181attribute_name_list:                                                                    // GCC
     2182        attribute_name
     2183        | attribute_name_list ',' attribute_name
     2184                { $$ = $1->addQualifiers( $3 ); }
     2185        ;
     2186
     2187attribute_name:                                                                                 // GCC
     2188        // empty
    21812189                { $$ = nullptr; }
    2182         ;
    2183 
    2184 attribute_parameter_list:                                                               // GCC
    2185         attrib
    2186         | attribute_parameter_list ',' attrib
    2187         ;
    2188 
    2189 attrib:                                                                                                 // GCC
    2190         // empty
    2191         | any_word
    2192         | any_word '(' comma_expression_opt ')' { delete $3; } // FIX ME: unimplemented
    2193         ;
    2194 
    2195 any_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
     2190        | attr_name
     2191                { $$ = DeclarationNode::newAttribute( $1 ); }
     2192        | attr_name '(' argument_expression_list ')'
     2193                { $$ = DeclarationNode::newAttribute( $1, $3 ); }
     2194        ;
     2195
     2196attr_name:                                                                                              // GCC
     2197        IDENTIFIER
     2198        | TYPEDEFname
     2199        | TYPEGENname
     2200        | CONST
     2201                { $$ = Token{ new string( "__const__" ) }; }
    22002202        ;
    22012203
Note: See TracChangeset for help on using the changeset viewer.