Changeset 4fee301
- Timestamp:
- Aug 23, 2022, 6:39:46 AM (2 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation
- Children:
- 0c40bfe
- Parents:
- e116db3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
re116db3 r4fee301 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Aug 12 07:59:58202213 // Update Count : 56 4912 // Last Modified On : Mon Aug 22 23:05:55 2022 13 // Update Count : 5651 14 14 // 15 15 … … 200 200 #define NEW_ONE new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) 201 201 #define UPDOWN( compop, left, right ) (compop == OperKinds::LThan || compop == OperKinds::LEThan ? left : right) 202 #define MISSING_ANON_FIELD "Missing loop fields with an anonymous loop index is meaningless as loop index is unavailable in loop body." 203 #define MISSING_LOW "Missing low value for up-to range so index is uninitialized." 204 #define MISSING_HIGH "Missing high value for down-to range so index is uninitialized." 202 205 203 206 ForCtrl * forCtrl( DeclarationNode * index, ExpressionNode * start, enum OperKinds compop, ExpressionNode * comp, ExpressionNode * inc ) { … … 1331 1334 | '@' updowneq comma_expression // CFA 1332 1335 { 1333 if ( $2 == OperKinds::LThan || $2 == OperKinds::LEThan ) { SemanticError( yylloc, "Missing start value so cannot compare."); $$ = nullptr; }1336 if ( $2 == OperKinds::LThan || $2 == OperKinds::LEThan ) { SemanticError( yylloc, MISSING_LOW ); $$ = nullptr; } 1334 1337 else $$ = forCtrl( $3, new string( DeclarationNode::anonymous.newName() ), $3->clone(), $2, nullptr, NEW_ONE ); 1335 1338 } 1336 1339 | comma_expression updowneq '@' // CFA 1337 1340 { 1338 if ( $2 == OperKinds::LThan || $2 == OperKinds::LEThan ) { SemanticError( yylloc, "Missing comparison ('@') with an anonymous loop index is meaningless."); $$ = nullptr; }1339 else { SemanticError( yylloc, "Missing start value so cannot compare."); $$ = nullptr; }1341 if ( $2 == OperKinds::LThan || $2 == OperKinds::LEThan ) { SemanticError( yylloc, MISSING_ANON_FIELD ); $$ = nullptr; } 1342 else { SemanticError( yylloc, MISSING_HIGH ); $$ = nullptr; } 1340 1343 } 1341 1344 | comma_expression updowneq comma_expression '~' comma_expression // CFA … … 1343 1346 | '@' updowneq comma_expression '~' comma_expression // CFA 1344 1347 { 1345 if ( $2 == OperKinds::LThan || $2 == OperKinds::LEThan ) { SemanticError( yylloc, "Missing start value so cannot compare."); $$ = nullptr; }1348 if ( $2 == OperKinds::LThan || $2 == OperKinds::LEThan ) { SemanticError( yylloc, MISSING_LOW ); $$ = nullptr; } 1346 1349 else $$ = forCtrl( $3, new string( DeclarationNode::anonymous.newName() ), $3->clone(), $2, nullptr, $5 ); 1347 1350 } 1348 1351 | comma_expression updowneq '@' '~' comma_expression // CFA 1349 1352 { 1350 if ( $2 == OperKinds::LThan || $2 == OperKinds::LEThan ) { SemanticError( yylloc, "Missing comparison ('@') with an anonymous loop index is meaningless."); $$ = nullptr; }1351 else { SemanticError( yylloc, "Missing start value so cannot compare."); $$ = nullptr; }1353 if ( $2 == OperKinds::LThan || $2 == OperKinds::LEThan ) { SemanticError( yylloc, MISSING_ANON_FIELD ); $$ = nullptr; } 1354 else { SemanticError( yylloc, MISSING_HIGH ); $$ = nullptr; } 1352 1355 } 1353 1356 | comma_expression updowneq comma_expression '~' '@' // CFA, error 1354 { SemanticError( yylloc, "Missing increment ('@') with an anonymous loop index is meaningless." ); $$ = nullptr; } 1357 { SemanticError( yylloc, MISSING_ANON_FIELD ); $$ = nullptr; } 1358 | '@' updowneq '@' // CFA, error 1359 { SemanticError( yylloc, MISSING_ANON_FIELD ); $$ = nullptr; } 1355 1360 | '@' updowneq comma_expression '~' '@' // CFA, error 1356 { SemanticError( yylloc, "Missing loop fields ('@') with an anonymous loop index is meaningless."); $$ = nullptr; }1361 { SemanticError( yylloc, MISSING_ANON_FIELD ); $$ = nullptr; } 1357 1362 | comma_expression updowneq '@' '~' '@' // CFA, error 1358 { SemanticError( yylloc, "Missing loop fields ('@') with an anonymous loop index is meaningless."); $$ = nullptr; }1363 { SemanticError( yylloc, MISSING_ANON_FIELD ); $$ = nullptr; } 1359 1364 | '@' updowneq '@' '~' '@' // CFA, error 1360 { SemanticError( yylloc, "Missing loop fields ('@') with an anonymous loop index is meaningless."); $$ = nullptr; }1365 { SemanticError( yylloc, MISSING_ANON_FIELD ); $$ = nullptr; } 1361 1366 1362 1367 | comma_expression ';' comma_expression // CFA … … 1369 1374 | comma_expression ';' '@' updowneq comma_expression // CFA 1370 1375 { 1371 if ( $4 == OperKinds::LThan || $4 == OperKinds::LEThan ) { SemanticError( yylloc, "Missing start value so cannot compare."); $$ = nullptr; }1376 if ( $4 == OperKinds::LThan || $4 == OperKinds::LEThan ) { SemanticError( yylloc, MISSING_LOW ); $$ = nullptr; } 1372 1377 else $$ = forCtrl( $5, $1, $5->clone(), $4, nullptr, NEW_ONE ); 1373 1378 } 1374 1379 | comma_expression ';' comma_expression updowneq '@' // CFA 1375 1380 { 1376 if ( $4 == OperKinds::GThan || $4 == OperKinds::GEThan ) { SemanticError( yylloc, "Missing start value so cannot compare."); $$ = nullptr; }1377 else if ( $4 == OperKinds::LEThan ) { SemanticError( yylloc, "Equality with missing comparisonis meaningless. Use \"~\"." ); $$ = nullptr; }1381 if ( $4 == OperKinds::GThan || $4 == OperKinds::GEThan ) { SemanticError( yylloc, MISSING_HIGH ); $$ = nullptr; } 1382 else if ( $4 == OperKinds::LEThan ) { SemanticError( yylloc, "Equality with missing high value is meaningless. Use \"~\"." ); $$ = nullptr; } 1378 1383 else $$ = forCtrl( $3, $1, $3->clone(), $4, nullptr, NEW_ONE ); 1379 1384 } 1380 1385 | comma_expression ';' '@' updowneq '@' // CFA, error 1381 { SemanticError( yylloc, "Missing start value so cannot compare." ); $$ = nullptr; }1386 { SemanticError( yylloc, "Missing low/high value for up/down-to range so index is uninitialized." ); $$ = nullptr; } 1382 1387 1383 1388 | comma_expression ';' comma_expression updowneq comma_expression '~' comma_expression // CFA … … 1385 1390 | comma_expression ';' '@' updowneq comma_expression '~' comma_expression // CFA, error 1386 1391 { 1387 if ( $4 == OperKinds::LThan || $4 == OperKinds::LEThan ) { SemanticError( yylloc, "Missing start value so cannot compare."); $$ = nullptr; }1392 if ( $4 == OperKinds::LThan || $4 == OperKinds::LEThan ) { SemanticError( yylloc, MISSING_LOW ); $$ = nullptr; } 1388 1393 else $$ = forCtrl( $5, $1, $5->clone(), $4, nullptr, $7 ); 1389 1394 } 1390 1395 | comma_expression ';' comma_expression updowneq '@' '~' comma_expression // CFA 1391 1396 { 1392 if ( $4 == OperKinds::GThan || $4 == OperKinds::GEThan ) { SemanticError( yylloc, "Missing start value so cannot compare."); $$ = nullptr; }1393 else if ( $4 == OperKinds::LEThan ) { SemanticError( yylloc, "Equality with missing comparisonis meaningless. Use \"~\"." ); $$ = nullptr; }1397 if ( $4 == OperKinds::GThan || $4 == OperKinds::GEThan ) { SemanticError( yylloc, MISSING_HIGH ); $$ = nullptr; } 1398 else if ( $4 == OperKinds::LEThan ) { SemanticError( yylloc, "Equality with missing high value is meaningless. Use \"~\"." ); $$ = nullptr; } 1394 1399 else $$ = forCtrl( $3, $1, $3->clone(), $4, nullptr, $7 ); 1395 1400 } … … 1398 1403 | comma_expression ';' '@' updowneq comma_expression '~' '@' // CFA, error 1399 1404 { 1400 if ( $4 == OperKinds::LThan || $4 == OperKinds::LEThan ) { SemanticError( yylloc, "Missing start value so cannot compare."); $$ = nullptr; }1405 if ( $4 == OperKinds::LThan || $4 == OperKinds::LEThan ) { SemanticError( yylloc, MISSING_LOW ); $$ = nullptr; } 1401 1406 else $$ = forCtrl( $5, $1, $5->clone(), $4, nullptr, nullptr ); 1402 1407 } 1403 1408 | comma_expression ';' comma_expression updowneq '@' '~' '@' // CFA 1404 1409 { 1405 if ( $4 == OperKinds::GThan || $4 == OperKinds::GEThan ) { SemanticError( yylloc, "Missing start value so cannot compare."); $$ = nullptr; }1406 else if ( $4 == OperKinds::LEThan ) { SemanticError( yylloc, "Equality with missing comparisonis meaningless. Use \"~\"." ); $$ = nullptr; }1410 if ( $4 == OperKinds::GThan || $4 == OperKinds::GEThan ) { SemanticError( yylloc, MISSING_HIGH ); $$ = nullptr; } 1411 else if ( $4 == OperKinds::LEThan ) { SemanticError( yylloc, "Equality with missing high value is meaningless. Use \"~\"." ); $$ = nullptr; } 1407 1412 else $$ = forCtrl( $3, $1, $3->clone(), $4, nullptr, nullptr ); 1408 1413 } 1409 1414 | comma_expression ';' '@' updowneq '@' '~' '@' // CFA 1410 { SemanticError( yylloc, "Missing start value so cannot compare." ); $$ = nullptr; }1415 { SemanticError( yylloc, "Missing low/high value for up/down-to range so index is uninitialized." ); $$ = nullptr; } 1411 1416 1412 1417 | declaration comma_expression // CFA … … 1419 1424 | declaration '@' updowneq comma_expression // CFA 1420 1425 { 1421 if ( $3 == OperKinds::LThan || $3 == OperKinds::LEThan ) { SemanticError( yylloc, "Missing start value so cannot compare."); $$ = nullptr; }1426 if ( $3 == OperKinds::LThan || $3 == OperKinds::LEThan ) { SemanticError( yylloc, MISSING_LOW ); $$ = nullptr; } 1422 1427 else $$ = forCtrl( $1, $4, $3, nullptr, NEW_ONE ); 1423 1428 } 1424 1429 | declaration comma_expression updowneq '@' // CFA 1425 1430 { 1426 if ( $3 == OperKinds::GThan || $3 == OperKinds::GEThan ) { SemanticError( yylloc, "Missing start value so cannot compare."); $$ = nullptr; }1427 else if ( $3 == OperKinds::LEThan ) { SemanticError( yylloc, "Equality with missing comparisonis meaningless. Use \"~\"." ); $$ = nullptr; }1431 if ( $3 == OperKinds::GThan || $3 == OperKinds::GEThan ) { SemanticError( yylloc, MISSING_HIGH ); $$ = nullptr; } 1432 else if ( $3 == OperKinds::LEThan ) { SemanticError( yylloc, "Equality with missing high value is meaningless. Use \"~\"." ); $$ = nullptr; } 1428 1433 else $$ = forCtrl( $1, $2, $3, nullptr, NEW_ONE ); 1429 1434 } … … 1433 1438 | declaration '@' updowneq comma_expression '~' comma_expression // CFA 1434 1439 { 1435 if ( $3 == OperKinds::LThan || $3 == OperKinds::LEThan ) { SemanticError( yylloc, "Missing start value so cannot compare."); $$ = nullptr; }1440 if ( $3 == OperKinds::LThan || $3 == OperKinds::LEThan ) { SemanticError( yylloc, MISSING_LOW ); $$ = nullptr; } 1436 1441 else $$ = forCtrl( $1, $4, $3, nullptr, $6 ); 1437 1442 } 1438 1443 | declaration comma_expression updowneq '@' '~' comma_expression // CFA 1439 1444 { 1440 if ( $3 == OperKinds::GThan || $3 == OperKinds::GEThan ) { SemanticError( yylloc, "Missing start value so cannot compare."); $$ = nullptr; }1441 else if ( $3 == OperKinds::LEThan ) { SemanticError( yylloc, "Equality with missing comparisonis meaningless. Use \"~\"." ); $$ = nullptr; }1445 if ( $3 == OperKinds::GThan || $3 == OperKinds::GEThan ) { SemanticError( yylloc, MISSING_HIGH ); $$ = nullptr; } 1446 else if ( $3 == OperKinds::LEThan ) { SemanticError( yylloc, "Equality with missing high value is meaningless. Use \"~\"." ); $$ = nullptr; } 1442 1447 else $$ = forCtrl( $1, $2, $3, nullptr, $6 ); 1443 1448 } … … 1446 1451 | declaration '@' updowneq comma_expression '~' '@' // CFA 1447 1452 { 1448 if ( $3 == OperKinds::LThan || $3 == OperKinds::LEThan ) { SemanticError( yylloc, "Missing start value so cannot compare."); $$ = nullptr; }1453 if ( $3 == OperKinds::LThan || $3 == OperKinds::LEThan ) { SemanticError( yylloc, MISSING_LOW ); $$ = nullptr; } 1449 1454 else $$ = forCtrl( $1, $4, $3, nullptr, nullptr ); 1450 1455 } 1451 1456 | declaration comma_expression updowneq '@' '~' '@' // CFA 1452 1457 { 1453 if ( $3 == OperKinds::GThan || $3 == OperKinds::GEThan ) { SemanticError( yylloc, "Missing start value so cannot compare."); $$ = nullptr; }1454 else if ( $3 == OperKinds::LEThan ) { SemanticError( yylloc, "Equality with missing comparisonis meaningless. Use \"~\"." ); $$ = nullptr; }1458 if ( $3 == OperKinds::GThan || $3 == OperKinds::GEThan ) { SemanticError( yylloc, MISSING_HIGH ); $$ = nullptr; } 1459 else if ( $3 == OperKinds::LEThan ) { SemanticError( yylloc, "Equality with missing high value is meaningless. Use \"~\"." ); $$ = nullptr; } 1455 1460 else $$ = forCtrl( $1, $2, $3, nullptr, nullptr ); 1456 1461 } 1457 1462 | declaration '@' updowneq '@' '~' '@' // CFA, error 1458 { SemanticError( yylloc, "Missing start value so cannot compare." ); $$ = nullptr; }1463 { SemanticError( yylloc, "Missing low/high value for up/down-to range so index is uninitialized." ); $$ = nullptr; } 1459 1464 1460 1465 | comma_expression ';' TYPEDEFname // CFA, array type
Note: See TracChangeset
for help on using the changeset viewer.