Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r2298f728 rfaddbd8  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Sep 24 11:30:40 2016
    13 // Update Count     : 1991
     12// Last Modified On : Wed Oct  5 14:10:46 2016
     13// Update Count     : 2002
    1414//
    1515
     
    196196%type<decl> field_declaration field_declaration_list field_declarator field_declaring_list
    197197%type<en> field field_list
     198%type<tok> field_name
    198199
    199200%type<decl> external_function_definition function_definition function_array function_declarator function_no_ptr function_ptr
     
    378379                { $$ = new ExpressionNode( build_fieldSel( $1, build_varref( $3 ) ) ); }
    379380        | postfix_expression '.' '[' push field_list pop ']' // CFA, tuple field selector
     381        | postfix_expression '.' INTEGERconstant
    380382        | postfix_expression ARROW no_attr_identifier
    381383                { $$ = new ExpressionNode( build_pfieldSel( $1, build_varref( $3 ) ) ); }
     
    390392                {
    391393                        Token fn;
    392                         fn.str = new string( "?{}" );                           // location undefined
    393                         $$ = new ExpressionNode( build_func( new ExpressionNode( build_varref( fn ) ), (ExpressionNode *)( $1 )->set_last( $3 ) ) );
     394                        fn.str = new std::string( "?{}" );                      // location undefined - use location of '{'?
     395                        $$ = new ExpressionNode( new ConstructorExpr( build_func( new ExpressionNode( build_varref( fn ) ), (ExpressionNode *)( $1 )->set_last( $3 ) ) ) );
    394396                }
    395397        ;
     
    413415
    414416field:                                                                                                  // CFA, tuple field selector
    415         no_attr_identifier
    416                 { $$ = new ExpressionNode( build_varref( $1 ) ); }
     417        field_name
    417418                // ambiguity with .0 so space required after field-selection, e.g.
    418419                //   struct S { int 0, 1; } s; s. 0 = 0; s. 1 = 1;
    419         | no_attr_identifier '.' field
     420                { $$ = new ExpressionNode( build_varref( $1 ) ); }
     421        | field_name '.' field
    420422                { $$ = new ExpressionNode( build_fieldSel( $3, build_varref( $1 ) ) ); }
    421         | no_attr_identifier '.' '[' push field_list pop ']'
     423        | field_name '.' '[' push field_list pop ']'
    422424                { $$ = new ExpressionNode( build_fieldSel( $5, build_varref( $1 ) ) ); }
    423         | no_attr_identifier ARROW field
     425        | field_name ARROW field
    424426                { $$ = new ExpressionNode( build_pfieldSel( $3, build_varref( $1 ) ) ); }
    425         | no_attr_identifier ARROW '[' push field_list pop ']'
     427        | field_name ARROW '[' push field_list pop ']'
    426428                { $$ = new ExpressionNode( build_pfieldSel( $5, build_varref( $1 ) ) ); }
     429        ;
     430
     431field_name:
     432        no_attr_identifier
     433        | INTEGERconstant
    427434        ;
    428435
     
    20052012                {
    20062013                        linkageStack.push( linkage );                           // handle nested extern "C"/"Cforall"
    2007                         linkage = LinkageSpec::fromString( *$2 );
     2014                        linkage = LinkageSpec::linkageCheck( $2 );
    20082015                }
    20092016          '{' external_definition_list_opt '}'                          // C++-style linkage specifier
Note: See TracChangeset for help on using the changeset viewer.