Changes in src/Parser/parser.yy [9853d9b0:e307e12]
- File:
-
- 1 edited
-
src/Parser/parser.yy (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r9853d9b0 re307e12 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Dec 12 17:54:22201913 // Update Count : 4 40412 // Last Modified On : Sat Dec 7 10:43:44 2019 13 // Update Count : 4394 14 14 // 15 15 … … 51 51 using namespace std; 52 52 53 #include "SynTree/Declaration.h"54 53 #include "ParseNode.h" 55 54 #include "TypedefTable.h" … … 212 211 } // forCtrl 213 212 213 KeywordCastExpr::Target Aggregate2Target( DeclarationNode::Aggregate aggr ) { 214 KeywordCastExpr::Target target; 215 switch ( aggr ) { 216 case DeclarationNode::Coroutine: target = KeywordCastExpr::Coroutine; break; 217 case DeclarationNode::Monitor: target = KeywordCastExpr::Monitor; break; 218 case DeclarationNode::Thread: target = KeywordCastExpr::Thread; break; 219 default: abort(); 220 } // switch 221 return target; 222 } // Aggregate2Target 223 224 214 225 bool forall = false, yyy = false; // aggregate have one or more forall qualifiers ? 215 226 … … 237 248 ExpressionNode * en; 238 249 DeclarationNode * decl; 239 AggregateDecl::Aggregate aggKey;250 DeclarationNode::Aggregate aggKey; 240 251 DeclarationNode::TypeClass tclass; 241 252 StatementNode * sn; … … 651 662 { $$ = new ExpressionNode( build_fieldSel( $1, build_tuple( $4 ) ) ); } 652 663 | postfix_expression '.' aggregate_control 653 { $$ = new ExpressionNode( build_keyword_cast( $3, $1 ) ); }664 { $$ = new ExpressionNode( build_keyword_cast( Aggregate2Target( $3 ), $1 ) ); } 654 665 | postfix_expression ARROW identifier 655 666 { $$ = new ExpressionNode( build_pfieldSel( $1, build_varref( $3 ) ) ); } … … 796 807 { $$ = new ExpressionNode( build_cast( $2, $4 ) ); } 797 808 | '(' aggregate_control '&' ')' cast_expression // CFA 798 { $$ = new ExpressionNode( build_keyword_cast( $2, $5 ) ); }809 { $$ = new ExpressionNode( build_keyword_cast( Aggregate2Target( $2 ), $5 ) ); } 799 810 // VIRTUAL cannot be opt because of look ahead issues 800 811 | '(' VIRTUAL ')' cast_expression // CFA … … 1190 1201 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), 1191 1202 OperKinds::LThan, $1->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); } 1192 | '=' comma_expression // CFA1193 { $$ = forCtrl( $2, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),1194 OperKinds::LEThan, $2->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }1195 1203 | comma_expression inclexcl comma_expression // CFA 1196 1204 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); } … … 1200 1208 { $$ = forCtrl( $3, $1, new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), 1201 1209 OperKinds::LThan, $3->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); } 1202 | comma_expression ';' '=' comma_expression // CFA1203 { $$ = forCtrl( $4, $1, new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),1204 OperKinds::LEThan, $4->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }1205 1210 | comma_expression ';' comma_expression inclexcl comma_expression // CFA 1206 1211 { $$ = forCtrl( $3, $1, $3->clone(), $4, $5, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); } … … 2066 2071 aggregate_data: 2067 2072 STRUCT 2068 { yyy = true; $$ = AggregateDecl::Struct; }2073 { yyy = true; $$ = DeclarationNode::Struct; } 2069 2074 | UNION 2070 { yyy = true; $$ = AggregateDecl::Union; }2075 { yyy = true; $$ = DeclarationNode::Union; } 2071 2076 | EXCEPTION // CFA 2072 { yyy = true; $$ = AggregateDecl::Exception; }2077 { yyy = true; $$ = DeclarationNode::Exception; } 2073 2078 ; 2074 2079 2075 2080 aggregate_control: // CFA 2076 2081 GENERATOR 2077 { yyy = true; $$ = AggregateDecl::Coroutine; }2082 { yyy = true; $$ = DeclarationNode::Coroutine; } 2078 2083 | COROUTINE 2079 { yyy = true; $$ = AggregateDecl::Coroutine; }2084 { yyy = true; $$ = DeclarationNode::Coroutine; } 2080 2085 | MONITOR 2081 { yyy = true; $$ = AggregateDecl::Monitor; }2086 { yyy = true; $$ = DeclarationNode::Monitor; } 2082 2087 | THREAD 2083 { yyy = true; $$ = AggregateDecl::Thread; }2088 { yyy = true; $$ = DeclarationNode::Thread; } 2084 2089 ; 2085 2090
Note:
See TracChangeset
for help on using the changeset viewer.