Changeset b1f2007 for src/Parser
- Timestamp:
- Dec 13, 2023, 9:17:13 AM (11 months ago)
- Branches:
- master
- Children:
- 4c2fe47
- Parents:
- c40157e
- Location:
- src/Parser
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ParseNode.h
rc40157e rb1f2007 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:28:16 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Mon Apr 3 17:55:00202313 // Update Count : 94 211 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Dec 9 17:39:34 2023 13 // Update Count : 945 14 14 // 15 15 … … 37 37 class ExpressionNode; 38 38 struct StatementNode; 39 39 40 40 41 //############################################################################## … … 97 98 std::ostream & operator<<( std::ostream & out, const ParseNode * node ); 98 99 100 __attribute__((noreturn)) static inline void SemanticError( const ParseNode * obj, const std::string & error ) { 101 SemanticError( obj->location, toString( error, obj ) ); 102 } 103 99 104 // Local Variables: // 100 105 // tab-width: 4 // -
src/Parser/TypeData.cc
rc40157e rb1f2007 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 15:12:51 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Tue Apr 4 13:39:00202313 // Update Count : 68 011 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Nov 26 15:51:05 2023 13 // Update Count : 681 14 14 // 15 15 … … 864 864 865 865 static string genTSError( string msg, DeclarationNode::BasicType basictype ) { 866 SemanticError( yylloc, string( "invalid type specifier \"" ) + msg + "\" for type \"" + DeclarationNode::basicTypeNames[basictype] + "\".");866 SemanticError( yylloc, "invalid type specifier \"%s\" for type \"%s\".", msg.c_str(), DeclarationNode::basicTypeNames[basictype] ); 867 867 } // genTSError 868 868 … … 1507 1507 } // for 1508 1508 // declaration type still set => type not moved to a matching parameter so there is a missing parameter name 1509 if ( decl->type ) SemanticError( decl->location, string( "missing name in parameter list " ) + *decl->name);1509 if ( decl->type ) SemanticError( decl->location, "missing name in parameter list %s", decl->name->c_str() ); 1510 1510 } // for 1511 1511 -
src/Parser/parser.yy
rc40157e rb1f2007 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Oct 3 17:14:12202313 // Update Count : 639 612 // Last Modified On : Sun Nov 26 13:18:06 2023 13 // Update Count : 6398 14 14 // 15 15 … … 260 260 } // if 261 261 } else { 262 SemanticError( yylloc, "syntax error, loop-index name missing. Expression disallowed. ." ); return nullptr;262 SemanticError( yylloc, "syntax error, loop-index name missing. Expression disallowed." ); return nullptr; 263 263 } // if 264 264 } // forCtrl 265 265 266 266 static void IdentifierBeforeIdentifier( string & identifier1, string & identifier2, const char * kind ) { 267 SemanticError( yylloc, ::toString( "syntax error, adjacent identifiers \"", identifier1, "\" and \"", identifier2, "\" are not meaningful in a", kind, ".\n" 268 "Possible cause is misspelled type name or missing generic parameter." ) ); 267 SemanticError( yylloc, "syntax error, adjacent identifiers \"%s\" and \"%s\" are not meaningful in an %s.\n" 268 "Possible cause is misspelled type name or missing generic parameter.", 269 identifier1.c_str(), identifier2.c_str(), kind ); 269 270 } // IdentifierBeforeIdentifier 270 271 271 272 static void IdentifierBeforeType( string & identifier, const char * kind ) { 272 SemanticError( yylloc, ::toString( "syntax error, identifier \"", identifier, "\" cannot appear before a ", kind, ".\n" 273 "Possible cause is misspelled storage/CV qualifier, misspelled typename, or missing generic parameter." ) ); 273 SemanticError( yylloc, "syntax error, identifier \"%s\" cannot appear before a %s.\n" 274 "Possible cause is misspelled storage/CV qualifier, misspelled typename, or missing generic parameter.", 275 identifier.c_str(), kind ); 274 276 } // IdentifierBeforeType 275 277 … … 689 691 // { SemanticError( yylloc, "Resume expression is currently unimplemented." ); $$ = nullptr; } 690 692 | IDENTIFIER IDENTIFIER // invalid syntax rule 691 { IdentifierBeforeIdentifier( *$1.str, *$2.str, " nexpression" ); $$ = nullptr; }693 { IdentifierBeforeIdentifier( *$1.str, *$2.str, "expression" ); $$ = nullptr; } 692 694 | IDENTIFIER type_qualifier // invalid syntax rule 693 695 { IdentifierBeforeType( *$1.str, "type qualifier" ); $$ = nullptr; } … … 1155 1157 | identifier_or_type_name ':' attribute_list_opt error // invalid syntax rule 1156 1158 { 1157 SemanticError( yylloc, ::toString( "syntx error, label \"", *$1.str, "\" must be associated with a statement, "1158 "where a declaration, case, or default is not a statement."1159 "Move the label or terminate with a semi-colon.") );1159 SemanticError( yylloc, "syntx error, label \"%s\" must be associated with a statement, " 1160 "where a declaration, case, or default is not a statement.\n" 1161 "Move the label or terminate with a semicolon.", $1.str->c_str() ); 1160 1162 $$ = nullptr; 1161 1163 } … … 2101 2103 | sue_declaration_specifier invalid_types // invalid syntax rule 2102 2104 { 2103 SemanticError( yylloc, ::toString( "syntax error, expecting ';' at end of ", 2104 $1->type->enumeration.name ? "enum" : ast::AggregateDecl::aggrString( $1->type->aggregate.kind ), 2105 " declaration." ) ); 2105 SemanticError( yylloc, "syntax error, expecting ';' at end of \"%s\" declaration.", 2106 $1->type->enumeration.name ? "enum" : ast::AggregateDecl::aggrString( $1->type->aggregate.kind ) ); 2106 2107 $$ = nullptr; 2107 2108 } … … 2161 2162 type_qualifier: 2162 2163 type_qualifier_name 2163 | attribute // trick handles most at rribute locations2164 | attribute // trick handles most attribute locations 2164 2165 ; 2165 2166 … … 2585 2586 | type_specifier field_declaring_list_opt '}' // invalid syntax rule 2586 2587 { 2587 SemanticError( yylloc, ::toString( "syntax error, expecting ';' at end of previous declaration." ));2588 SemanticError( yylloc, "syntax error, expecting ';' at end of previous declaration." ); 2588 2589 $$ = nullptr; 2589 2590 }
Note: See TracChangeset
for help on using the changeset viewer.