Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    rddfd945 r861799c7  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 16 08:36:17 2017
    13 // Update Count     : 2310
     12// Last Modified On : Sun Mar  5 15:48:24 2017
     13// Update Count     : 2227
    1414//
    1515
     
    104104%token TYPEOF LABEL                                                                             // GCC
    105105%token ENUM STRUCT UNION
    106 %token COROUTINE MONITOR THREAD                                                 // CFA
    107106%token OTYPE FTYPE DTYPE TTYPE TRAIT                                    // CFA
    108107%token SIZEOF OFFSETOF
     
    224223%type<decl> external_function_definition function_definition function_array function_declarator function_no_ptr function_ptr
    225224
    226 %type<decl> identifier_parameter_declarator identifier_parameter_ptr identifier_parameter_array identifier_parameter_function
    227 %type<decl> identifier_list
     225%type<decl> identifier_parameter_array identifier_parameter_declarator identifier_parameter_function
     226%type<decl> identifier_parameter_ptr identifier_list
    228227
    229228%type<decl> cfa_abstract_array cfa_abstract_declarator_no_tuple cfa_abstract_declarator_tuple
     
    271270%type<en> type_name_list
    272271
    273 %type<decl> type_qualifier type_qualifier_name type_qualifier_list_opt type_qualifier_list
    274 %type<decl> type_specifier type_specifier_nobody
     272%type<decl> type_qualifier type_qualifier_name type_qualifier_list type_qualifier_list_opt type_specifier type_specifier_nobody
    275273
    276274%type<decl> variable_declarator variable_ptr variable_array variable_function
     
    412410                { $$ = new ExpressionNode( build_fieldSel( $1, build_field_name_REALFRACTIONconstant( *$2 ) ) ); }
    413411        | postfix_expression ARROW no_attr_identifier
    414                 { $$ = new ExpressionNode( build_pfieldSel( $1, build_varref( $3 ) ) ); }
     412                {
     413                        $$ = new ExpressionNode( build_pfieldSel( $1, *$3 == "0" || *$3 == "1" ? build_constantInteger( *$3 ) : build_varref( $3 ) ) );
     414                }
    415415        | postfix_expression ARROW '[' push field_list pop ']' // CFA, tuple field selector
    416416                        { $$ = new ExpressionNode( build_pfieldSel( $1, build_tuple( $5 ) ) ); }
     417        | postfix_expression ARROW INTEGERconstant                      // CFA, tuple index
     418                { $$ = new ExpressionNode( build_pfieldSel( $1, build_constantInteger( *$3 ) ) ); }
    417419        | postfix_expression ICR
    418420                { $$ = new ExpressionNode( build_unary_ptr( OperKinds::IncrPost, $1 ) ); }
     
    437439argument_expression:
    438440        // empty
    439                 { $$ = nullptr; }
    440         // | '@'                                                                                                // use default argument
    441         //      { $$ = new ExpressionNode( build_constantInteger( *new string( "2" ) ) ); }
     441                { $$ = nullptr; }                                                               // use default argument
    442442        | assignment_expression
    443443        ;
     
    14061406type_qualifier_name:
    14071407        CONST
    1408                 { $$ = DeclarationNode::newTypeQualifier( Type::Const ); }
     1408                { $$ = DeclarationNode::newTypeQualifier( DeclarationNode::Const ); }
    14091409        | RESTRICT
    1410                 { $$ = DeclarationNode::newTypeQualifier( Type::Restrict ); }
     1410                { $$ = DeclarationNode::newTypeQualifier( DeclarationNode::Restrict ); }
    14111411        | VOLATILE
    1412                 { $$ = DeclarationNode::newTypeQualifier( Type::Volatile ); }
     1412                { $$ = DeclarationNode::newTypeQualifier( DeclarationNode::Volatile ); }
    14131413        | LVALUE                                                                                        // CFA
    1414                 { $$ = DeclarationNode::newTypeQualifier( Type::Lvalue ); }
     1414                { $$ = DeclarationNode::newTypeQualifier( DeclarationNode::Lvalue ); }
    14151415        | MUTEX
    1416                 { $$ = DeclarationNode::newTypeQualifier( Type::Mutex ); }
     1416                { $$ = DeclarationNode::newTypeQualifier( DeclarationNode::Mutex ); }
    14171417        | ATOMIC
    1418                 { $$ = DeclarationNode::newTypeQualifier( Type::Atomic ); }
     1418                { $$ = DeclarationNode::newTypeQualifier( DeclarationNode::Atomic ); }
    14191419        | FORALL '('
    14201420                {
     
    14491449storage_class:
    14501450        EXTERN
    1451                 { $$ = DeclarationNode::newStorageClass( Type::Extern ); }
     1451                { $$ = DeclarationNode::newStorageClass( DeclarationNode::Extern ); }
    14521452        | STATIC
    1453                 { $$ = DeclarationNode::newStorageClass( Type::Static ); }
     1453                { $$ = DeclarationNode::newStorageClass( DeclarationNode::Static ); }
    14541454        | AUTO
    1455                 { $$ = DeclarationNode::newStorageClass( Type::Auto ); }
     1455                { $$ = DeclarationNode::newStorageClass( DeclarationNode::Auto ); }
    14561456        | REGISTER
    1457                 { $$ = DeclarationNode::newStorageClass( Type::Register ); }
     1457                { $$ = DeclarationNode::newStorageClass( DeclarationNode::Register ); }
    14581458        | THREADLOCAL                                                                           // C11
    1459                 { $$ = DeclarationNode::newStorageClass( Type::Threadlocal ); }
     1459                { $$ = DeclarationNode::newStorageClass( DeclarationNode::Threadlocal ); }
    14601460                // Put function specifiers here to simplify parsing rules, but separate them semantically.
    14611461        | INLINE                                                                                        // C99
    1462                 { $$ = DeclarationNode::newFuncSpecifier( Type::Inline ); }
     1462                { $$ = DeclarationNode::newFuncSpecifier( DeclarationNode::Inline ); }
    14631463        | FORTRAN                                                                                       // C99
    1464                 { $$ = DeclarationNode::newFuncSpecifier( Type::Fortran ); }
     1464                { $$ = DeclarationNode::newFuncSpecifier( DeclarationNode::Fortran ); }
    14651465        | NORETURN                                                                                      // C11
    1466                 { $$ = DeclarationNode::newFuncSpecifier( Type::Noreturn ); }
     1466                { $$ = DeclarationNode::newFuncSpecifier( DeclarationNode::Noreturn ); }
    14671467        ;
    14681468
     
    16331633        | UNION
    16341634                { $$ = DeclarationNode::Union; }
    1635         | COROUTINE
    1636                 { $$ = DeclarationNode::Struct; }
    1637         | MONITOR
    1638                 { $$ = DeclarationNode::Struct; }
    1639         | THREAD
    1640                 { $$ = DeclarationNode::Struct; }
    16411635        ;
    16421636
     
    16841678        // empty
    16851679                { $$ = DeclarationNode::newName( 0 ); /* XXX */ } // CFA, no field name
    1686         // '@' // empty
    1687         //      { $$ = DeclarationNode::newName( 0 ); /* XXX */ } // CFA, no field name
    16881680        | bit_subrange_size                                                                     // no field name
    16891681                { $$ = DeclarationNode::newBitfield( $1 ); }
Note: See TracChangeset for help on using the changeset viewer.