Changeset 52a2248


Ignore:
Timestamp:
Mar 16, 2023, 2:20:01 PM (21 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, master
Children:
1fd3d85
Parents:
360bfe41
Message:

This should get some of the Parser changes working on older compilers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ExpressionNode.cc

    r360bfe41 r52a2248  
    164164        } else {
    165165                // At least one digit in integer constant, so safe to backup while looking for suffix.
     166                // This declaration and the comma expressions in the conditions mimic
     167                // the declare and check pattern allowed in later compiler versions.
     168                // (Only some early compilers/C++ standards do not support it.)
    166169                string::size_type posn;
    167170                // pointer value
    168                 if ( posn = str.find_last_of( "pP" ); posn != string::npos ) {
     171                if ( posn = str.find_last_of( "pP" ), posn != string::npos ) {
    169172                        ltype = 5; str.erase( posn, 1 );
    170173                // size_t
    171                 } else if ( posn = str.find_last_of( "zZ" ); posn != string::npos ) {
     174                } else if ( posn = str.find_last_of( "zZ" ), posn != string::npos ) {
    172175                        Unsigned = true; type = 2; ltype = 4; str.erase( posn, 1 );
    173176                // signed char
    174                 } else if ( posn = str.rfind( "hh" ); posn != string::npos ) {
     177                } else if ( posn = str.rfind( "hh" ), posn != string::npos ) {
    175178                        type = 1; str.erase( posn, 2 );
    176179                // signed char
    177                 } else if ( posn = str.rfind( "HH" ); posn != string::npos ) {
     180                } else if ( posn = str.rfind( "HH" ), posn != string::npos ) {
    178181                        type = 1; str.erase( posn, 2 );
    179182                // short
    180                 } else if ( posn = str.find_last_of( "hH" ); posn != string::npos ) {
     183                } else if ( posn = str.find_last_of( "hH" ), posn != string::npos ) {
    181184                        type = 0; str.erase( posn, 1 );
    182185                // int (natural number)
    183                 } else if ( posn = str.find_last_of( "nN" ); posn != string::npos ) {
     186                } else if ( posn = str.find_last_of( "nN" ), posn != string::npos ) {
    184187                        type = 2; str.erase( posn, 1 );
    185188                } else if ( str.rfind( "ll" ) != string::npos || str.rfind( "LL" ) != string::npos ) {
Note: See TracChangeset for help on using the changeset viewer.