Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    rdc2b4d6 r578e6037  
    99// Author           : Peter A. Buhr
    1010// Created On       : Sat Sep  1 20:22:55 2001
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Jul 17 12:17:00 2017
    13 // Update Count     : 2455
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Jul 13 14:38:54 2017
     13// Update Count     : 2431
    1414//
    1515
     
    151151%token ELLIPSIS                                                                                 // ...
    152152
    153 %token EXPassign        MULTassign      DIVassign       MODassign       // \=   *=      /=      %=
     153%token MULTassign       DIVassign       MODassign                               // *=   /=      %=/
    154154%token PLUSassign       MINUSassign                                                     // +=   -=
    155155%token LSassign         RSassign                                                        // <<=  >>=
     
    168168%type<op> ptrref_operator                               unary_operator                          assignment_operator
    169169%type<en> primary_expression                    postfix_expression                      unary_expression
    170 %type<en> cast_expression                               exponential_expression          multiplicative_expression       additive_expression
    171 %type<en> shift_expression                              relational_expression           equality_expression
    172 %type<en> AND_expression                                exclusive_OR_expression         inclusive_OR_expression
    173 %type<en> logical_AND_expression                logical_OR_expression
    174 %type<en> conditional_expression                constant_expression                     assignment_expression           assignment_expression_opt
     170%type<en> cast_expression                               multiplicative_expression       additive_expression                     shift_expression
     171%type<en> relational_expression                 equality_expression                     AND_expression                          exclusive_OR_expression
     172%type<en> inclusive_OR_expression               logical_AND_expression          logical_OR_expression           conditional_expression
     173%type<en> constant_expression                   assignment_expression           assignment_expression_opt
    175174%type<en> comma_expression                              comma_expression_opt
    176 %type<en> argument_expression_list              argument_expression                     default_initialize_opt
     175%type<en> argument_expression_list              argument_expression                     assignment_opt
    177176%type<fctl> for_control_expression
    178177%type<en> subrange
     
    574573        ;
    575574
    576 exponential_expression:
     575multiplicative_expression:
    577576        cast_expression
    578         | exponential_expression '\\' cast_expression
    579                 { $$ = new ExpressionNode( build_binary_val( OperKinds::Exp, $1, $3 ) ); }
    580         ;
    581 
    582 multiplicative_expression:
    583         exponential_expression
    584         | multiplicative_expression '*' exponential_expression
     577        | multiplicative_expression '*' cast_expression
    585578                { $$ = new ExpressionNode( build_binary_val( OperKinds::Mul, $1, $3 ) ); }
    586         | multiplicative_expression '/' exponential_expression
     579        | multiplicative_expression '/' cast_expression
    587580                { $$ = new ExpressionNode( build_binary_val( OperKinds::Div, $1, $3 ) ); }
    588         | multiplicative_expression '%' exponential_expression
     581        | multiplicative_expression '%' cast_expression
    589582                { $$ = new ExpressionNode( build_binary_val( OperKinds::Mod, $1, $3 ) ); }
    590583        ;
     
    685678        '='                                                                                     { $$ = OperKinds::Assign; }
    686679        | ATassign                                                                      { $$ = OperKinds::AtAssn; }
    687         | EXPassign                                                                     { $$ = OperKinds::ExpAssn; }
    688680        | MULTassign                                                            { $$ = OperKinds::MulAssn; }
    689681        | DIVassign                                                                     { $$ = OperKinds::DivAssn; }
     
    980972                { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, nullptr, new ExpressionNode( build_constantInteger( *$6 ) ), $9 ) ) ); }
    981973
    982         | handler_key '(' push push exception_declaration pop handler_predicate_opt ')' compound_statement pop
    983                 { $$ = new StatementNode( build_catch( $1, $5, nullptr, $9 ) ); }
    984         | handler_clause handler_key '(' push push exception_declaration pop handler_predicate_opt ')' compound_statement pop
    985                 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, $6, nullptr, $10 ) ) ); }
    986         ;
    987 
    988 handler_predicate_opt:
    989         //empty
    990         | ';' conditional_expression
     974        | handler_key '(' push push exception_declaration pop ')' compound_statement pop
     975                { $$ = new StatementNode( build_catch( $1, $5, nullptr, $8 ) ); }
     976        | handler_clause handler_key '(' push push exception_declaration pop ')' compound_statement pop
     977                { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, $6, nullptr, $9 ) ) ); }
    991978        ;
    992979
     
    16801667        | aggregate_key attribute_list_opt typegen_name         // CFA
    16811668                { $$ = $3->addQualifiers( $2 ); }
    1682 
    1683 // Temp, testing TreeStruct
    1684     | STRUCT TRY attribute_list_opt no_attr_identifier_or_type_name
    1685         {
    1686             typedefTable.makeTypedef( *$4 );            // create typedef
    1687             if ( forall ) typedefTable.changeKind( *$4, TypedefTable::TG ); // $
    1688             forall = false;                             // reset
    1689         }
    1690       '{' field_declaration_list '}'
    1691         {
    1692             $$ = DeclarationNode::newTreeStruct( DeclarationNode::Struct,
    1693                 $4, nullptr, nullptr, $7, true )->addQualifiers( $3 );
    1694         }
    1695     | STRUCT TRY attribute_list_opt no_attr_identifier_or_type_name TYPEDEFname
    1696         {
    1697             typedefTable.makeTypedef( *$4 );            // create typedef
    1698             if ( forall ) typedefTable.changeKind( *$4, TypedefTable::TG ); // $
    1699             forall = false;                             // reset
    1700         }
    1701       '{' field_declaration_list '}'
    1702         {
    1703             $$ = DeclarationNode::newTreeStruct( DeclarationNode::Struct,
    1704                 $4, $5, nullptr, $8, true )->addQualifiers( $3 );
    1705         }
    17061669        ;
    17071670
     
    18821845cfa_parameter_declaration:                                                              // CFA, new & old style parameter declaration
    18831846        parameter_declaration
    1884         | cfa_identifier_parameter_declarator_no_tuple identifier_or_type_name default_initialize_opt
     1847        | cfa_identifier_parameter_declarator_no_tuple identifier_or_type_name assignment_opt
    18851848                { $$ = $1->addName( $2 ); }
    1886         | cfa_abstract_tuple identifier_or_type_name default_initialize_opt
     1849        | cfa_abstract_tuple identifier_or_type_name assignment_opt
    18871850                // To obtain LR(1), these rules must be duplicated here (see cfa_abstract_declarator).
    18881851                { $$ = $1->addName( $2 ); }
    1889         | type_qualifier_list cfa_abstract_tuple identifier_or_type_name default_initialize_opt
     1852        | type_qualifier_list cfa_abstract_tuple identifier_or_type_name assignment_opt
    18901853                { $$ = $2->addName( $3 )->addQualifiers( $1 ); }
    18911854        | cfa_function_specifier
     
    19041867parameter_declaration:
    19051868                // No SUE declaration in parameter list.
    1906         declaration_specifier_nobody identifier_parameter_declarator default_initialize_opt
     1869        declaration_specifier_nobody identifier_parameter_declarator assignment_opt
    19071870                {
    19081871                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    19091872                        $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr );
    19101873                }
    1911         | declaration_specifier_nobody type_parameter_redeclarator default_initialize_opt
     1874        | declaration_specifier_nobody type_parameter_redeclarator assignment_opt
    19121875                {
    19131876                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    19171880
    19181881abstract_parameter_declaration:
    1919         declaration_specifier_nobody default_initialize_opt
     1882        declaration_specifier_nobody assignment_opt
    19201883                { $$ = $1->addInitializer( $2 ? new InitializerNode( $2 ) : nullptr ); }
    1921         | declaration_specifier_nobody abstract_parameter_declarator default_initialize_opt
     1884        | declaration_specifier_nobody abstract_parameter_declarator assignment_opt
    19221885                { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); }
    19231886        ;
     
    30823045        ;
    30833046
    3084 default_initialize_opt:
     3047assignment_opt:
    30853048        // empty
    30863049                { $$ = nullptr; }
Note: See TracChangeset for help on using the changeset viewer.