Ignore:
Timestamp:
Dec 14, 2023, 9:05:55 PM (6 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
19a2890
Parents:
21ad568
Message:

second attempt at simplifying SemanticError? messages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ExpressionNode.cc

    r21ad568 rca9d65e  
    99// Author           : Peter A. Buhr
    1010// Created On       : Sat May 16 13:17:07 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Tue Apr  4 11:07:00 2023
    13 // Update Count     : 1083
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Dec 14 18:57:07 2023
     13// Update Count     : 1087
    1414//
    1515
     
    193193
    194194#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() );
    196196#endif // ! __SIZEOF_INT128__
    197197
     
    204204                        } else {                                                                        // hex int128 constant
    205205                                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() );
    207207                                // hex digits < 2^64
    208208                                if ( len > (2 + 16) ) {
     
    219219                        unsigned int len = str.length();
    220220                        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() );
    222222                                str2 = "0b" + str.substr( len - 64 );
    223223                                str = str.substr( 0, len - 64 );
     
    233233                        } else {                                                                        // octal int128 constant
    234234                                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() );
    236236                                char buf[32];
    237237                                if ( len <= 1 + 21 ) {                                  // value < 21 octal digitis
     
    266266                        unsigned int len = str.length();
    267267                        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() );
    269269                        char buf[32];
    270270                        if ( len <= 19 ) {                                                      // value < 19 decimal digitis
     
    502502ast::Expr * build_field_name_FLOATING_FRACTIONconstant(
    503503                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() );
    505505        ast::Expr * ret = build_constantInteger( location,
    506506                *new string( str.substr(1) ) );
     
    511511ast::Expr * build_field_name_FLOATING_DECIMALconstant(
    512512                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() );
    514514        ast::Expr * ret = build_constantInteger(
    515515                location, *new string( str.substr( 0, str.size()-1 ) ) );
Note: See TracChangeset for help on using the changeset viewer.