Changeset ca9d65e for src/Parser
- Timestamp:
- Dec 14, 2023, 9:05:55 PM (22 months ago)
- Branches:
- master
- Children:
- 19a2890
- Parents:
- 21ad568
- Location:
- src/Parser
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
r21ad568 rca9d65e 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jun 17 14:41:48202313 // Update Count : 140 512 // Last Modified On : Thu Dec 14 19:05:17 2023 13 // Update Count : 1407 14 14 // 15 15 … … 632 632 dst->basictype = src->basictype; 633 633 } else if ( src->basictype != DeclarationNode::NoBasicType ) 634 SemanticError( yylloc, string( "multiple declaration types \"" ) + DeclarationNode::basicTypeNames[ dst->basictype ] +635 "\" and \"" + DeclarationNode::basicTypeNames[ src->basictype ] + "\"." );636 634 SemanticError( yylloc, "multiple declaration types \"%s\" and \"%s\".", 635 DeclarationNode::basicTypeNames[ dst->basictype ], 636 DeclarationNode::basicTypeNames[ src->basictype ] ); 637 637 if ( dst->complextype == DeclarationNode::NoComplexType ) { 638 638 dst->complextype = src->complextype; 639 639 } else if ( src->complextype != DeclarationNode::NoComplexType ) 640 SemanticError( yylloc, string( "multiple declaration types \"" ) + DeclarationNode::complexTypeNames[ src->complextype ] +641 "\" and \"" + DeclarationNode::complexTypeNames[ src->complextype ] + "\"." );642 640 SemanticError( yylloc, "multiple declaration types \"%s\" and \"%s\".", 641 DeclarationNode::complexTypeNames[ src->complextype ], 642 DeclarationNode::complexTypeNames[ src->complextype ] ); 643 643 if ( dst->signedness == DeclarationNode::NoSignedness ) { 644 644 dst->signedness = src->signedness; 645 645 } else if ( src->signedness != DeclarationNode::NoSignedness ) 646 SemanticError( yylloc, string( "conflicting type specifier \"" ) + DeclarationNode::signednessNames[ dst->signedness ] +647 "\" and \"" + DeclarationNode::signednessNames[ src->signedness ] + "\"." );648 646 SemanticError( yylloc, "conflicting type specifier \"%s\" and \"%s\".", 647 DeclarationNode::signednessNames[ dst->signedness ], 648 DeclarationNode::signednessNames[ src->signedness ] ); 649 649 if ( dst->length == DeclarationNode::NoLength ) { 650 650 dst->length = src->length; … … 652 652 dst->length = DeclarationNode::LongLong; 653 653 } else if ( src->length != DeclarationNode::NoLength ) 654 SemanticError( yylloc, string( "conflicting type specifier \"" ) + DeclarationNode::lengthNames[ dst->length ] + 655 "\" and \"" + DeclarationNode::lengthNames[ src->length ] + "\"." ); 654 SemanticError( yylloc, "conflicting type specifier \"%s\" and \"%s\".", 655 DeclarationNode::lengthNames[ dst->length ], 656 DeclarationNode::lengthNames[ src->length ] ); 656 657 } // if 657 658 break; -
src/Parser/ExpressionNode.cc
r21ad568 rca9d65e 9 9 // Author : Peter A. Buhr 10 10 // Created On : Sat May 16 13:17:07 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : T ue Apr 4 11:07:00202313 // Update Count : 108 311 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Dec 14 18:57:07 2023 13 // Update Count : 1087 14 14 // 15 15 … … 193 193 194 194 #if ! defined(__SIZEOF_INT128__) 195 if ( type == 5 ) SemanticError( yylloc, "int128 constant is not supported on this target " + str);195 if ( type == 5 ) SemanticError( yylloc, "int128 constant is not supported on this target \"%s\"", str.c_str() ); 196 196 #endif // ! __SIZEOF_INT128__ 197 197 … … 204 204 } else { // hex int128 constant 205 205 unsigned int len = str.length(); 206 if ( len > (2 + 16 + 16) ) SemanticError( yylloc, "128-bit hexadecimal constant to large " + str);206 if ( len > (2 + 16 + 16) ) SemanticError( yylloc, "128-bit hexadecimal constant to large \"%s\"", str.c_str() ); 207 207 // hex digits < 2^64 208 208 if ( len > (2 + 16) ) { … … 219 219 unsigned int len = str.length(); 220 220 if ( type == 5 && len > 2 + 64 ) { 221 if ( len > 2 + 64 + 64 ) SemanticError( yylloc, "128-bit binary constant to large " + str);221 if ( len > 2 + 64 + 64 ) SemanticError( yylloc, "128-bit binary constant to large \"%s\".", str.c_str() ); 222 222 str2 = "0b" + str.substr( len - 64 ); 223 223 str = str.substr( 0, len - 64 ); … … 233 233 } else { // octal int128 constant 234 234 unsigned int len = str.length(); 235 if ( len > 1 + 43 || (len == 1 + 43 && str[0] > '3') ) SemanticError( yylloc, "128-bit octal constant to large " + str);235 if ( len > 1 + 43 || (len == 1 + 43 && str[0] > '3') ) SemanticError( yylloc, "128-bit octal constant to large \"%s\"", str.c_str() ); 236 236 char buf[32]; 237 237 if ( len <= 1 + 21 ) { // value < 21 octal digitis … … 266 266 unsigned int len = str.length(); 267 267 if ( str.length() == 39 && str > (Unsigned ? "340282366920938463463374607431768211455" : "170141183460469231731687303715884105727") ) 268 SemanticError( yylloc, "128-bit decimal constant to large " + str);268 SemanticError( yylloc, "128-bit decimal constant to large \"%s\".", str.c_str() ); 269 269 char buf[32]; 270 270 if ( len <= 19 ) { // value < 19 decimal digitis … … 502 502 ast::Expr * build_field_name_FLOATING_FRACTIONconstant( 503 503 const CodeLocation & location, const string & str ) { 504 if ( str.find_first_not_of( "0123456789", 1 ) != string::npos ) SemanticError( yylloc, "invalid tuple index " + str);504 if ( str.find_first_not_of( "0123456789", 1 ) != string::npos ) SemanticError( yylloc, "invalid tuple index \"%s\".", str.c_str() ); 505 505 ast::Expr * ret = build_constantInteger( location, 506 506 *new string( str.substr(1) ) ); … … 511 511 ast::Expr * build_field_name_FLOATING_DECIMALconstant( 512 512 const CodeLocation & location, const string & str ) { 513 if ( str[str.size() - 1] != '.' ) SemanticError( yylloc, "invalid tuple index " + str);513 if ( str[str.size() - 1] != '.' ) SemanticError( yylloc, "invalid tuple index \"%s\".", str.c_str() ); 514 514 ast::Expr * ret = build_constantInteger( 515 515 location, *new string( str.substr( 0, str.size()-1 ) ) ); -
src/Parser/TypeData.cc
r21ad568 rca9d65e 10 10 // Created On : Sat May 16 15:12:51 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Nov 26 15:51:05202313 // Update Count : 68 112 // Last Modified On : Thu Dec 14 18:59:12 2023 13 // Update Count : 684 14 14 // 15 15 … … 1496 1496 // type set => parameter name already transformed by a declaration names so there is a duplicate 1497 1497 // declaration name attempting a second transformation 1498 if ( param->type ) SemanticError( param->location, string( "duplicate declaration name " ) + *param->name);1498 if ( param->type ) SemanticError( param->location, "duplicate declaration name \"%s\".", param->name->c_str() ); 1499 1499 // declaration type reset => declaration already transformed by a parameter name so there is a duplicate 1500 1500 // parameter name attempting a second transformation 1501 if ( ! decl->type ) SemanticError( param->location, string( "duplicate parameter name " ) + *param->name);1501 if ( ! decl->type ) SemanticError( param->location, "duplicate parameter name \"%s\".", param->name->c_str() ); 1502 1502 param->type = decl->type; // set copy declaration type to parameter type 1503 1503 decl->type = nullptr; // reset declaration type
Note:
See TracChangeset
for help on using the changeset viewer.