Changes in src/Parser/parser.yy [afe9e45:5c216b4]
- File:
-
- 1 edited
-
src/Parser/parser.yy (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
rafe9e45 r5c216b4 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Feb 25 17:54:56202213 // Update Count : 52 6212 // Last Modified On : Sat Feb 19 09:47:20 2022 13 // Update Count : 5218 14 14 // 15 15 … … 610 610 // | RESUME '(' comma_expression ')' compound_statement 611 611 // { SemanticError( yylloc, "Resume expression is currently unimplemented." ); $$ = nullptr; } 612 | IDENTIFIER IDENTIFIER // syntax error613 {614 SemanticError( yylloc, ::toString( "Adjacent identifiers are not meaningful in an expression. "615 "Possible problem is identifier \"", *$1.str,616 "\" is a misspelled typename or an incorrectly specified type name, "617 "e.g., missing generic parameter or missing struct/union/enum before typename." ) );618 $$ = nullptr;619 }620 | IDENTIFIER direct_type // syntax error621 {622 SemanticError( yylloc, ::toString( "Identifier \"", *$1.str, "\" cannot appear before a type. "623 "Possible problem is misspelled storage or CV qualifier." ) );624 $$ = nullptr;625 }626 612 ; 627 613 … … 1066 1052 identifier_or_type_name ':' attribute_list_opt statement 1067 1053 { $$ = $4->add_label( $1, $3 ); } 1068 | identifier_or_type_name ':' attribute_list_opt error // syntax error 1069 { 1070 SemanticError( yylloc, ::toString( "Label \"", *$1.str, "\" must be associated with a statement, " 1071 "where a declaration, case, or default is not a statement. " 1072 "Move the label or terminate with a semi-colon." ) ); 1073 $$ = nullptr; 1074 } 1054 | identifier_or_type_name ':' attribute_list_opt error 1055 { SemanticError( yylloc, "previous label must be associated with a statement (where a declaration is not a statement). Move the label or terminate with a semi-colon." ); $$ = nullptr; } 1075 1056 ; 1076 1057 … … 1107 1088 | statement_list_nodecl statement 1108 1089 { assert( $1 ); $1->set_last( $2 ); $$ = $1; } 1109 | statement_list_nodecl error // syntax error1110 { SemanticError( yylloc, " Declarations only allowed at the start of the switch body, i.e., after the '{'." ); $$ = nullptr; }1090 | statement_list_nodecl error 1091 { SemanticError( yylloc, "declarations only allowed at the start of the switch body, i.e., after the '{'." ); $$ = nullptr; } 1111 1092 ; 1112 1093 … … 1135 1116 $$ = $7 ? new StatementNode( build_compound( (StatementNode *)((new StatementNode( $7 ))->set_last( sw )) ) ) : sw; 1136 1117 } 1137 | SWITCH '(' comma_expression ')' '{' error '}' // CFA , syntax error1138 { SemanticError( yylloc, " Only declarations can appear before the list of case clauses." ); $$ = nullptr; }1118 | SWITCH '(' comma_expression ')' '{' error '}' // CFA 1119 { SemanticError( yylloc, "only declarations can appear before the list of case clauses." ); $$ = nullptr; } 1139 1120 | CHOOSE '(' comma_expression ')' case_clause // CFA 1140 1121 { $$ = new StatementNode( build_switch( false, $3, $5 ) ); } … … 1144 1125 $$ = $7 ? new StatementNode( build_compound( (StatementNode *)((new StatementNode( $7 ))->set_last( sw )) ) ) : sw; 1145 1126 } 1146 | CHOOSE '(' comma_expression ')' '{' error '}' // CFA , syntax error1147 { SemanticError( yylloc, " Only declarations can appear before the list of case clauses." ); $$ = nullptr; }1127 | CHOOSE '(' comma_expression ')' '{' error '}' // CFA 1128 { SemanticError( yylloc, "only declarations can appear before the list of case clauses." ); $$ = nullptr; } 1148 1129 ; 1149 1130 … … 1184 1165 1185 1166 case_label: // CFA 1186 CASE error // syntax error1187 { SemanticError( yylloc, " Missing case list after case." ); $$ = nullptr; }1167 CASE error 1168 { SemanticError( yylloc, "missing case list after case." ); $$ = nullptr; } 1188 1169 | CASE case_value_list ':' { $$ = $2; } 1189 | CASE case_value_list error // syntax error1190 { SemanticError( yylloc, " Missing colon after case list." ); $$ = nullptr; }1170 | CASE case_value_list error 1171 { SemanticError( yylloc, "missing colon after case list." ); $$ = nullptr; } 1191 1172 | DEFAULT ':' { $$ = new StatementNode( build_default() ); } 1192 1173 // A semantic check is required to ensure only one default clause per switch/choose statement. 1193 | DEFAULT error // syntax error1194 { SemanticError( yylloc, " Missing colon after default." ); $$ = nullptr; }1174 | DEFAULT error 1175 { SemanticError( yylloc, "missing colon after default." ); $$ = nullptr; } 1195 1176 ; 1196 1177 … … 1429 1410 | when_clause_opt ELSE statement 1430 1411 { $$ = build_waitfor_timeout( nullptr, maybe_build_compound( $3 ), $1 ); } 1431 // "else" must be conditional after timeout or timeout is never triggered (i.e., it is meaningless)1432 | when_clause_opt timeout statement WOR ELSE statement // syntax error1412 // "else" must be conditional after timeout or timeout is never triggered (i.e., it is meaningless) 1413 | when_clause_opt timeout statement WOR ELSE statement 1433 1414 { SemanticError( yylloc, "else clause must be conditional after timeout or timeout never triggered." ); $$ = nullptr; } 1434 1415 | when_clause_opt timeout statement WOR when_clause ELSE statement
Note:
See TracChangeset
for help on using the changeset viewer.