Changeset 7f5566b for src/Parser/parser.yy
- Timestamp:
- Jul 30, 2015, 3:56:18 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 093f1a0
- Parents:
- 51b986f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r51b986f r7f5566b 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 16 16:25:12201513 // Update Count : 1 26712 // Last Modified On : Thu Jul 30 15:29:19 2015 13 // Update Count : 1327 14 14 // 15 15 … … 115 115 StatementNode *sn; 116 116 ConstantNode *constant; 117 LabelNode *label; 117 118 InitializerNode *in; 119 bool flag; 118 120 } 119 121 … … 134 136 %type<en> argument_expression_list argument_expression for_control_expression assignment_opt 135 137 %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 136 142 137 143 // statements … … 378 384 | assignment_expression 379 385 | no_attr_identifier ':' assignment_expression 380 { $$ = $3->set_a sArgName( $1 ); }386 { $$ = $3->set_argName( $1 ); } 381 387 // Only a list of no_attr_identifier_or_type_name is allowed in this context. However, there is insufficient 382 388 // look ahead to distinguish between this list of parameter names and a tuple, so the tuple form must be used 383 389 // with an appropriate semantic check. 384 390 | '[' push assignment_expression pop ']' ':' assignment_expression 385 { $$ = $7->set_a sArgName( $3 ); }391 { $$ = $7->set_argName( $3 ); } 386 392 | '[' push assignment_expression ',' tuple_expression_list pop ']' ':' assignment_expression 387 { $$ = $9->set_a sArgName( new CompositeExprNode( new OperatorNode( OperatorNode::TupleC ), (ExpressionNode *)$3->set_link( flattenCommas( $5 )))); }393 { $$ = $9->set_argName( new CompositeExprNode( new OperatorNode( OperatorNode::TupleC ), (ExpressionNode *)$3->set_link( flattenCommas( $5 )))); } 388 394 ; 389 395 … … 754 760 755 761 fall_through: // CFA 756 FALLTHRU { $$ = new StatementNode( StatementNode::Fallthru , 0, 0); }757 | FALLTHRU ';' { $$ = new StatementNode( StatementNode::Fallthru , 0, 0); }762 FALLTHRU { $$ = new StatementNode( StatementNode::Fallthru ); } 763 | FALLTHRU ';' { $$ = new StatementNode( StatementNode::Fallthru ); } 758 764 ; 759 765 … … 783 789 | CONTINUE ';' 784 790 // A semantic check is required to ensure this statement appears only in the body of an iteration statement. 785 { $$ = new StatementNode( StatementNode::Continue , 0, 0); }791 { $$ = new StatementNode( StatementNode::Continue ); } 786 792 | CONTINUE no_attr_identifier ';' // CFA, multi-level continue 787 793 // A semantic check is required to ensure this statement appears only in the body of an iteration statement, and … … 790 796 | BREAK ';' 791 797 // A semantic check is required to ensure this statement appears only in the body of an iteration statement. 792 { $$ = new StatementNode( StatementNode::Break , 0, 0); }798 { $$ = new StatementNode( StatementNode::Break ); } 793 799 | BREAK no_attr_identifier ';' // CFA, multi-level exit 794 800 // A semantic check is required to ensure this statement appears only in the body of an iteration statement, and … … 800 806 { $$ = new StatementNode( StatementNode::Throw, $2, 0 ); } 801 807 | THROW ';' 802 { $$ = new StatementNode( StatementNode::Throw , 0, 0); }808 { $$ = new StatementNode( StatementNode::Throw ); } 803 809 ; 804 810 … … 863 869 864 870 asm_statement: 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 ); } 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; } 873 888 ; 874 889 875 890 asm_operands_opt: // GCC 876 891 // empty 892 { $$ = 0; } // use default argument 877 893 | asm_operands_list 878 894 ; … … 881 897 asm_operand 882 898 | asm_operands_list ',' asm_operand 899 { $$ = (ExpressionNode *)$1->set_link( $3 ); } 883 900 ; 884 901 885 902 asm_operand: // GCC 886 STRINGliteral '(' constant_expression ')' {} 887 ; 888 889 asm_clobbers_list: // GCC 890 STRINGliteral {} 891 | asm_clobbers_list ',' STRINGliteral 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 ); } 892 923 ; 893 924 … … 929 960 930 961 label_list: // GCC, local label 931 no_attr_identifier_or_type_name {}962 no_attr_identifier_or_type_name {} 932 963 | label_list ',' no_attr_identifier_or_type_name {} 933 964 ;
Note: See TracChangeset
for help on using the changeset viewer.