Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r8780e30 r3a2128f  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Oct 26 17:35:53 2016
    13 // Update Count     : 2066
     12// Last Modified On : Tue Nov 29 11:35:52 2016
     13// Update Count     : 2069
    1414//
    1515
     
    7878%token RESTRICT                                                                                 // C99
    7979%token FORALL LVALUE                                                                    // CFA
    80 %token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED
     80%token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED ZERO_T ONE_T
    8181%token VALIST                                                                                   // GCC
    8282%token BOOL COMPLEX IMAGINARY                                                   // C99
     
    199199
    200200%type<decl> field_declaration field_declaration_list field_declarator field_declaring_list
    201 %type<en> field field_list field_name fraction_constants
     201%type<en> field field_list
     202%type<tok> field_name
    202203
    203204%type<decl> external_function_definition function_definition function_array function_declarator function_no_ptr function_ptr
     
    383384                { $$ = new ExpressionNode( build_fieldSel( $1, build_varref( $3 ) ) ); }
    384385        | postfix_expression '.' '[' push field_list pop ']' // CFA, tuple field selector
    385                 { $$ = new ExpressionNode( build_fieldSel( $1, build_tuple( $5 ) ) ); }
    386386        | postfix_expression REALFRACTIONconstant                       // CFA, tuple index
    387                 { $$ = new ExpressionNode( build_fieldSel( $1, build_field_name_REALFRACTIONconstant( *$2 ) ) ); }
    388387        | postfix_expression ARROW no_attr_identifier
    389388                { $$ = new ExpressionNode( build_pfieldSel( $1, build_varref( $3 ) ) ); }
    390389        | postfix_expression ARROW '[' push field_list pop ']' // CFA, tuple field selector
    391                         { $$ = new ExpressionNode( build_pfieldSel( $1, build_tuple( $5 ) ) ); }
    392390        | postfix_expression ICR
    393391                { $$ = new ExpressionNode( build_unary_ptr( OperKinds::IncrPost, $1 ) ); }
     
    423421field:                                                                                                  // CFA, tuple field selector
    424422        field_name
     423                { $$ = new ExpressionNode( build_varref( $1 ) ); }
    425424        | REALDECIMALconstant field
    426                 { $$ = new ExpressionNode( build_fieldSel( new ExpressionNode( build_field_name_REALDECIMALconstant( *$1 ) ), maybeMoveBuild<Expression>( $2 ) ) ); }
     425                { $$ = new ExpressionNode( build_fieldSel( $2, build_varref( $1 ) ) ); }
    427426        | REALDECIMALconstant '[' push field_list pop ']'
    428                 { $$ = new ExpressionNode( build_fieldSel( new ExpressionNode( build_field_name_REALDECIMALconstant( *$1 ) ), build_tuple( $4 ) ) ); }
     427                { $$ = new ExpressionNode( build_fieldSel( $4, build_varref( $1 ) ) ); }
    429428        | field_name '.' field
    430                 { $$ = new ExpressionNode( build_fieldSel( $1, maybeMoveBuild<Expression>( $3 ) ) ); }
     429                { $$ = new ExpressionNode( build_fieldSel( $3, build_varref( $1 ) ) ); }
    431430        | field_name '.' '[' push field_list pop ']'
    432                 { $$ = new ExpressionNode( build_fieldSel( $1, build_tuple( $5 ) ) ); }
     431                { $$ = new ExpressionNode( build_fieldSel( $5, build_varref( $1 ) ) ); }
    433432        | field_name ARROW field
    434                 { $$ = new ExpressionNode( build_pfieldSel( $1, maybeMoveBuild<Expression>( $3 ) ) ); }
     433                { $$ = new ExpressionNode( build_pfieldSel( $3, build_varref( $1 ) ) ); }
    435434        | field_name ARROW '[' push field_list pop ']'
    436                 { $$ = new ExpressionNode( build_pfieldSel( $1, build_tuple( $5 ) ) ); }
     435                { $$ = new ExpressionNode( build_pfieldSel( $5, build_varref( $1 ) ) ); }
    437436        ;
    438437
    439438field_name:
    440439        INTEGERconstant fraction_constants
    441                 { $$ = new ExpressionNode( build_field_name_fraction_constants( build_constantInteger( *$1 ), $2 ) ); }
     440                { $$ = $1; }
    442441        | FLOATINGconstant fraction_constants
    443                 { $$ = new ExpressionNode( build_field_name_fraction_constants( build_field_name_FLOATINGconstant( *$1 ), $2 ) ); }
     442                { $$ = $1; }
    444443        | no_attr_identifier fraction_constants
    445                 { $$ = new ExpressionNode( build_field_name_fraction_constants( build_varref( $1 ), $2 ) ); }
     444                { $$ = $1; }
    446445        ;
    447446
    448447fraction_constants:
    449448        // empty
    450                 { $$ = nullptr; }
    451449        | fraction_constants REALFRACTIONconstant
    452                 {
    453                         Expression * constant = build_field_name_REALFRACTIONconstant( *$2 );
    454                         $$ = $1 != nullptr ? new ExpressionNode( build_fieldSel( $1,  constant ) ) : new ExpressionNode( constant );
    455                 }
    456450        ;
    457451
     
    714708        | '{'
    715709                // Two scopes are necessary because the block itself has a scope, but every declaration within the block also
    716                 // requires its own scope
     710                // requires its own scope.
    717711          push push
    718712          local_label_declaration_opt                                           // GCC, local labels
     
    14101404        | VALIST                                                                                        // GCC, __builtin_va_list
    14111405                { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); }
     1406        | ZERO_T
     1407                { $$ = DeclarationNode::newBasicType( DeclarationNode::Char ); }
     1408        | ONE_T
     1409                { $$ = DeclarationNode::newBasicType( DeclarationNode::Char ); }
    14121410        ;
    14131411
Note: See TracChangeset for help on using the changeset viewer.