Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r7f5566b r1db21619  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul 30 15:29:19 2015
    13 // Update Count     : 1327
     12// Last Modified On : Thu Jul 16 16:25:12 2015
     13// Update Count     : 1267
    1414//
    1515
     
    115115        StatementNode *sn;
    116116        ConstantNode *constant;
    117         LabelNode *label;
    118117        InitializerNode *in;
    119         bool flag;
    120118}
    121119
     
    136134%type<en> argument_expression_list              argument_expression                     for_control_expression          assignment_opt
    137135%type<en> subrange
    138 %type<en> asm_operands_opt asm_operands_list asm_operand
    139 %type<label> label_list
    140 %type<constant> asm_clobbers_list_opt
    141 %type<flag> asm_volatile_opt
    142136
    143137// statements
     
    384378        | assignment_expression
    385379        | no_attr_identifier ':' assignment_expression
    386                 { $$ = $3->set_argName( $1 ); }
     380                { $$ = $3->set_asArgName( $1 ); }
    387381                // Only a list of no_attr_identifier_or_type_name is allowed in this context. However, there is insufficient
    388382                // look ahead to distinguish between this list of parameter names and a tuple, so the tuple form must be used
    389383                // with an appropriate semantic check.
    390384        | '[' push assignment_expression pop ']' ':' assignment_expression
    391                 { $$ = $7->set_argName( $3 ); }
     385                { $$ = $7->set_asArgName( $3 ); }
    392386        | '[' push assignment_expression ',' tuple_expression_list pop ']' ':' assignment_expression
    393                 { $$ = $9->set_argName( new CompositeExprNode( new OperatorNode( OperatorNode::TupleC ), (ExpressionNode *)$3->set_link( flattenCommas( $5 )))); }
     387                { $$ = $9->set_asArgName( new CompositeExprNode( new OperatorNode( OperatorNode::TupleC ), (ExpressionNode *)$3->set_link( flattenCommas( $5 )))); }
    394388        ;
    395389
     
    760754
    761755fall_through:                                                                                   // CFA
    762         FALLTHRU                                                                        { $$ = new StatementNode( StatementNode::Fallthru ); }
    763         | FALLTHRU ';'                                                          { $$ = new StatementNode( StatementNode::Fallthru ); }
     756        FALLTHRU                                                                        { $$ = new StatementNode( StatementNode::Fallthru, 0, 0 ); }
     757        | FALLTHRU ';'                                                          { $$ = new StatementNode( StatementNode::Fallthru, 0, 0 ); }
    764758        ;
    765759
     
    789783        | CONTINUE ';'
    790784                // A semantic check is required to ensure this statement appears only in the body of an iteration statement.
    791                 { $$ = new StatementNode( StatementNode::Continue ); }
     785                { $$ = new StatementNode( StatementNode::Continue, 0, 0 ); }
    792786        | CONTINUE no_attr_identifier ';'                                       // CFA, multi-level continue
    793787                // A semantic check is required to ensure this statement appears only in the body of an iteration statement, and
     
    796790        | BREAK ';'
    797791                // A semantic check is required to ensure this statement appears only in the body of an iteration statement.
    798                 { $$ = new StatementNode( StatementNode::Break ); }
     792                { $$ = new StatementNode( StatementNode::Break, 0, 0 ); }
    799793        | BREAK no_attr_identifier ';'                                          // CFA, multi-level exit
    800794                // A semantic check is required to ensure this statement appears only in the body of an iteration statement, and
     
    806800                { $$ = new StatementNode( StatementNode::Throw, $2, 0 ); }
    807801        | THROW ';'
    808                 { $$ = new StatementNode( StatementNode::Throw ); }
     802                { $$ = new StatementNode( StatementNode::Throw, 0, 0 ); }
    809803        ;
    810804
     
    869863
    870864asm_statement:
    871         ASM asm_volatile_opt '(' string_literal_list ')' ';'
    872                 { $$ = new AsmStmtNode( StatementNode::Asm, $2, $4, 0 ); }
    873         | ASM asm_volatile_opt '(' string_literal_list ':' asm_operands_opt ')' ';' // remaining GCC
    874                 { $$ = new AsmStmtNode( StatementNode::Asm, $2, $4, $6 ); }
    875         | ASM asm_volatile_opt '(' string_literal_list ':' asm_operands_opt ':' asm_operands_opt ')' ';'
    876                 { $$ = new AsmStmtNode( StatementNode::Asm, $2, $4, $6, $8 ); }
    877         | ASM asm_volatile_opt '(' string_literal_list ':' asm_operands_opt ':' asm_operands_opt ':' asm_clobbers_list_opt ')' ';'
    878                 { $$ = new AsmStmtNode( StatementNode::Asm, $2, $4, $6, $8, $10 ); }
    879         | ASM asm_volatile_opt GOTO '(' string_literal_list ':' ':' asm_operands_opt ':' asm_clobbers_list_opt ':' label_list ')' ';'
    880         { $$ = new AsmStmtNode( StatementNode::Asm, $2, $5, 0, $8, $10, $12 ); }
    881         ;
    882 
    883 asm_volatile_opt:                                                                               // GCC
    884         // empty
    885                 { $$ = false; }
    886         | VOLATILE
    887                 { $$ = true; }
     865        ASM type_qualifier_list_opt '(' constant_expression ')' ';'
     866                { $$ = new StatementNode( StatementNode::Asm, 0, 0 ); }
     867        | ASM type_qualifier_list_opt '(' constant_expression ':' asm_operands_opt ')' ';' // remaining GCC
     868                { $$ = new StatementNode( StatementNode::Asm, 0, 0 ); }
     869        | ASM type_qualifier_list_opt '(' constant_expression ':' asm_operands_opt ':' asm_operands_opt ')' ';'
     870                { $$ = new StatementNode( StatementNode::Asm, 0, 0 ); }
     871        | ASM type_qualifier_list_opt '(' constant_expression ':' asm_operands_opt ':' asm_operands_opt ':' asm_clobbers_list ')' ';'
     872                { $$ = new StatementNode( StatementNode::Asm, 0, 0 ); }
    888873        ;
    889874
    890875asm_operands_opt:                                                                               // GCC
    891876        // empty
    892                 { $$ = 0; }                                                                             // use default argument
    893877        | asm_operands_list
    894878        ;
     
    897881        asm_operand
    898882        | asm_operands_list ',' asm_operand
    899                 { $$ = (ExpressionNode *)$1->set_link( $3 ); }
    900883        ;
    901884
    902885asm_operand:                                                                                    // GCC
    903         string_literal_list '(' constant_expression ')'
    904                 { $$ = new AsmExprNode( 0, $1, $3 ); }
    905         | '[' constant_expression ']' string_literal_list '(' constant_expression ')'
    906                 { $$ = new AsmExprNode( $2, $4, $6 ); }
    907         ;
    908 
    909 asm_clobbers_list_opt:                                                                          // GCC
    910         // empty
    911                 { $$ = 0; }                                                                             // use default argument
    912         | string_literal_list
    913                 { $$ = $1; }
    914         | asm_clobbers_list_opt ',' string_literal_list
    915                 { $$ = (ConstantNode *)$1->set_link( $3 ); }
    916         ;
    917 
    918 label_list:
    919         no_attr_identifier
    920                 { $$ = new LabelNode(); $$->append_label( $1 ); }
    921         | label_list ',' no_attr_identifier
    922                 { $$ = $1; $1->append_label( $3 ); }
     886        STRINGliteral '(' constant_expression ')'       {}
     887        ;
     888
     889asm_clobbers_list:                                                                              // GCC
     890        STRINGliteral                                                           {}
     891        | asm_clobbers_list ',' STRINGliteral
    923892        ;
    924893
     
    960929
    961930label_list:                                                                                             // GCC, local label
    962         no_attr_identifier_or_type_name                         {}
     931        no_attr_identifier_or_type_name                 {}
    963932        | label_list ',' no_attr_identifier_or_type_name {}
    964933        ;
Note: See TracChangeset for help on using the changeset viewer.