Changeset 1b8f13f0 for src/Parser
- Timestamp:
- Dec 12, 2018, 3:56:32 PM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- 014bb94
- Parents:
- 515a037
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r515a037 r1b8f13f0 196 196 new ExpressionNode( build_binary_val( compop == OperKinds::LThan || compop == OperKinds::LEThan ? // choose += or -= for upto/downto 197 197 OperKinds::PlusAssn : OperKinds::MinusAssn, new ExpressionNode( build_varref( new string( *index ) ) ), inc ) ) ); 198 <<<<<<< HEAD199 =======200 198 } // forCtrl 201 199 … … 206 204 SemanticError( yylloc, "Expression disallowed. Only loop-index name allowed" ); return nullptr; 207 205 } // if 208 >>>>>>> master209 206 } // forCtrl 210 207 … … 1148 1145 1149 1146 for_control_expression: 1150 <<<<<<< HEAD1151 comma_expression_opt // CFA1152 {1153 if ( ! $1 ) { // => for ( ;; )1154 $$ = new ForCtrl( (ExpressionNode * )nullptr, (ExpressionNode * )nullptr, (ExpressionNode * )nullptr );1155 } else {1156 $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),1157 OperKinds::LThan, $1->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) );1158 } // if1159 }1160 =======1161 1147 comma_expression // CFA 1162 1148 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), 1163 1149 OperKinds::LThan, $1->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); } 1164 >>>>>>> master1165 1150 | constant_expression inclexcl constant_expression // CFA 1166 1151 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); } 1167 1152 | constant_expression inclexcl constant_expression '~' constant_expression // CFA 1168 1153 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, $5 ); } 1169 <<<<<<< HEAD1170 | comma_expression_opt ';' comma_expression // CFA1171 {1172 if ( ! $1 ) {1173 SemanticError( yylloc, "Missing loop index." ); $$ = nullptr;1174 } else if ( ! $3 ) {1175 SemanticError( yylloc, "Missing loop range." ); $$ = nullptr;1176 } else {1177 if ( NameExpr *identifier = dynamic_cast<NameExpr *>($1->get_expr()) ) {1178 $$ = forCtrl( $3, new string( identifier->name ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),1179 OperKinds::LThan, $3->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) );1180 } else {1181 SemanticError( yylloc, "Expression disallowed. Only loop-index name allowed" ); $$ = nullptr;1182 } // if1183 } // if1184 }1185 | comma_expression_opt ';' constant_expression inclexcl constant_expression // CFA1186 {1187 if ( ! $1 ) {1188 SemanticError( yylloc, "Missing loop index." ); $$ = nullptr;1189 } else {1190 if ( NameExpr *identifier = dynamic_cast<NameExpr *>($1->get_expr()) ) {1191 $$ = forCtrl( $3, new string( identifier->name ), $3->clone(), $4, $5, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) );1192 } else {1193 SemanticError( yylloc, "Expression disallowed. Only loop-index name allowed" ); $$ = nullptr;1194 } // if1195 } // if1196 }1197 | comma_expression_opt ';' constant_expression inclexcl constant_expression '~' constant_expression // CFA1198 {1199 if ( ! $1 ) {1200 SemanticError( yylloc, "Missing loop index." ); $$ = nullptr;1201 } else {1202 if ( NameExpr *identifier = dynamic_cast<NameExpr *>($1->get_expr()) ) {1203 $$ = forCtrl( $3, new string( identifier->name ), $3->clone(), $4, $5, $7 );1204 } else {1205 SemanticError( yylloc, "Expression disallowed. Only loop-index name allowed" ); $$ = nullptr;1206 } // if1207 } // if1208 }1209 | comma_expression_opt ';' comma_expression_opt ';' comma_expression_opt1210 =======1211 1154 | comma_expression ';' comma_expression // CFA 1212 1155 { $$ = forCtrl( $3, $1, new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), … … 1217 1160 { $$ = forCtrl( $3, $1, $3->clone(), $4, $5, $7 ); } 1218 1161 | comma_expression ';' comma_expression_opt ';' comma_expression_opt 1219 >>>>>>> master1220 1162 { $$ = new ForCtrl( $1, $3, $5 ); } 1221 1163 | ';' comma_expression_opt ';' comma_expression_opt … … 1886 1828 | TYPEOF '(' comma_expression ')' // GCC: typeof( a+b ) y; 1887 1829 { $$ = DeclarationNode::newTypeof( $3 ); } 1888 <<<<<<< HEAD1889 | BASETYPEOF '(' type ')' // CFA: basetypeof(x) y;1890 { $$ = $3; }1891 | BASETYPEOF '(' comma_expression ')' // CFA: basetypeof(a+b) y;1892 { $$ = DeclarationNode::newTypeof( $3 ); }1893 | ATTR_TYPEGENname '(' type ')' // CFA: e.g., @type(x) y;1894 =======1895 1830 | BASETYPEOF '(' type ')' // CFA: basetypeof( x ) y; 1896 1831 { $$ = DeclarationNode::newTypeof( new ExpressionNode( new TypeExpr( maybeMoveBuildType( $3 ) ) ), true ); } … … 1898 1833 { $$ = DeclarationNode::newTypeof( $3, true ); } 1899 1834 | ATTR_TYPEGENname '(' type ')' // CFA: e.g., @type( x ) y; 1900 >>>>>>> master1901 1835 { $$ = DeclarationNode::newAttr( $1, $3 ); } 1902 1836 | ATTR_TYPEGENname '(' comma_expression ')' // CFA: e.g., @type( a+b ) y;
Note: See TracChangeset
for help on using the changeset viewer.