Changes in src/Parser/parser.yy [7f5566b:1db21619]
- File:
-
- 1 edited
-
src/Parser/parser.yy (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r7f5566b r1db21619 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jul 30 15:29:19201513 // Update Count : 1 32712 // Last Modified On : Thu Jul 16 16:25:12 2015 13 // Update Count : 1267 14 14 // 15 15 … … 115 115 StatementNode *sn; 116 116 ConstantNode *constant; 117 LabelNode *label;118 117 InitializerNode *in; 119 bool flag;120 118 } 121 119 … … 136 134 %type<en> argument_expression_list argument_expression for_control_expression assignment_opt 137 135 %type<en> subrange 138 %type<en> asm_operands_opt asm_operands_list asm_operand139 %type<label> label_list140 %type<constant> asm_clobbers_list_opt141 %type<flag> asm_volatile_opt142 136 143 137 // statements … … 384 378 | assignment_expression 385 379 | no_attr_identifier ':' assignment_expression 386 { $$ = $3->set_a rgName( $1 ); }380 { $$ = $3->set_asArgName( $1 ); } 387 381 // Only a list of no_attr_identifier_or_type_name is allowed in this context. However, there is insufficient 388 382 // look ahead to distinguish between this list of parameter names and a tuple, so the tuple form must be used 389 383 // with an appropriate semantic check. 390 384 | '[' push assignment_expression pop ']' ':' assignment_expression 391 { $$ = $7->set_a rgName( $3 ); }385 { $$ = $7->set_asArgName( $3 ); } 392 386 | '[' push assignment_expression ',' tuple_expression_list pop ']' ':' assignment_expression 393 { $$ = $9->set_a rgName( 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 )))); } 394 388 ; 395 389 … … 760 754 761 755 fall_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 ); } 764 758 ; 765 759 … … 789 783 | CONTINUE ';' 790 784 // 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 ); } 792 786 | CONTINUE no_attr_identifier ';' // CFA, multi-level continue 793 787 // A semantic check is required to ensure this statement appears only in the body of an iteration statement, and … … 796 790 | BREAK ';' 797 791 // 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 ); } 799 793 | BREAK no_attr_identifier ';' // CFA, multi-level exit 800 794 // A semantic check is required to ensure this statement appears only in the body of an iteration statement, and … … 806 800 { $$ = new StatementNode( StatementNode::Throw, $2, 0 ); } 807 801 | THROW ';' 808 { $$ = new StatementNode( StatementNode::Throw ); }802 { $$ = new StatementNode( StatementNode::Throw, 0, 0 ); } 809 803 ; 810 804 … … 869 863 870 864 asm_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 ); } 888 873 ; 889 874 890 875 asm_operands_opt: // GCC 891 876 // empty 892 { $$ = 0; } // use default argument893 877 | asm_operands_list 894 878 ; … … 897 881 asm_operand 898 882 | asm_operands_list ',' asm_operand 899 { $$ = (ExpressionNode *)$1->set_link( $3 ); }900 883 ; 901 884 902 885 asm_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 889 asm_clobbers_list: // GCC 890 STRINGliteral {} 891 | asm_clobbers_list ',' STRINGliteral 923 892 ; 924 893 … … 960 929 961 930 label_list: // GCC, local label 962 no_attr_identifier_or_type_name {}931 no_attr_identifier_or_type_name {} 963 932 | label_list ',' no_attr_identifier_or_type_name {} 964 933 ;
Note:
See TracChangeset
for help on using the changeset viewer.