diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:45:01 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:01 +0300 |
commit | 2d37894b1b037cf24231090eda8589bbb44fb6fc (patch) | |
tree | be835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/tools/ragel6/parsedata.cpp | |
parent | 718c552901d703c502ccbefdfc3c9028d608b947 (diff) | |
download | ydb-2d37894b1b037cf24231090eda8589bbb44fb6fc.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/tools/ragel6/parsedata.cpp')
-rw-r--r-- | contrib/tools/ragel6/parsedata.cpp | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/contrib/tools/ragel6/parsedata.cpp b/contrib/tools/ragel6/parsedata.cpp index 3a4d611eb7..eafe73e524 100644 --- a/contrib/tools/ragel6/parsedata.cpp +++ b/contrib/tools/ragel6/parsedata.cpp @@ -126,49 +126,49 @@ Key makeFsmKeyHex( char *str, const InputLoc &loc, ParseData *pd ) Key makeFsmKeyDec( char *str, const InputLoc &loc, ParseData *pd ) { - if ( keyOps->alphType->isSigned ) { - /* Convert the number to a decimal. First reset errno so we can check - * for overflow or underflow. */ - errno = 0; - long long minVal = keyOps->alphType->sMinVal; - long long maxVal = keyOps->alphType->sMaxVal; - - long long ll = strtoll( str, 0, 10 ); - - /* Check for underflow. */ - if ( ( errno == ERANGE && ll < 0 ) || ll < minVal) { - error(loc) << "literal " << str << " underflows the alphabet type" << endl; - ll = minVal; - } - /* Check for overflow. */ - else if ( ( errno == ERANGE && ll > 0 ) || ll > maxVal ) { - error(loc) << "literal " << str << " overflows the alphabet type" << endl; - ll = maxVal; - } - - return Key( (long)ll ); + if ( keyOps->alphType->isSigned ) { + /* Convert the number to a decimal. First reset errno so we can check + * for overflow or underflow. */ + errno = 0; + long long minVal = keyOps->alphType->sMinVal; + long long maxVal = keyOps->alphType->sMaxVal; + + long long ll = strtoll( str, 0, 10 ); + + /* Check for underflow. */ + if ( ( errno == ERANGE && ll < 0 ) || ll < minVal) { + error(loc) << "literal " << str << " underflows the alphabet type" << endl; + ll = minVal; + } + /* Check for overflow. */ + else if ( ( errno == ERANGE && ll > 0 ) || ll > maxVal ) { + error(loc) << "literal " << str << " overflows the alphabet type" << endl; + ll = maxVal; + } + + return Key( (long)ll ); } - else { - /* Convert the number to a decimal. First reset errno so we can check - * for overflow or underflow. */ - errno = 0; - unsigned long long minVal = keyOps->alphType->uMinVal; - unsigned long long maxVal = keyOps->alphType->uMaxVal; - - unsigned long long ull = strtoull( str, 0, 10 ); - - /* Check for underflow. */ - if ( ( errno == ERANGE && ull < 0 ) || ull < minVal) { - error(loc) << "literal " << str << " underflows the alphabet type" << endl; - ull = minVal; - } - /* Check for overflow. */ - else if ( ( errno == ERANGE && ull > 0 ) || ull > maxVal ) { - error(loc) << "literal " << str << " overflows the alphabet type" << endl; - ull = maxVal; - } - - return Key( (unsigned long)ull ); + else { + /* Convert the number to a decimal. First reset errno so we can check + * for overflow or underflow. */ + errno = 0; + unsigned long long minVal = keyOps->alphType->uMinVal; + unsigned long long maxVal = keyOps->alphType->uMaxVal; + + unsigned long long ull = strtoull( str, 0, 10 ); + + /* Check for underflow. */ + if ( ( errno == ERANGE && ull < 0 ) || ull < minVal) { + error(loc) << "literal " << str << " underflows the alphabet type" << endl; + ull = minVal; + } + /* Check for overflow. */ + else if ( ( errno == ERANGE && ull > 0 ) || ull > maxVal ) { + error(loc) << "literal " << str << " overflows the alphabet type" << endl; + ull = maxVal; + } + + return Key( (unsigned long)ull ); } } |