"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ragel/parsedata.cpp" between
ragel-6.9.tar.gz and ragel-6.10.tar.gz

About: Ragel compiles executable finite state machines from regular languages (C, C++, Obj-C, C#, D, Java, Go and Ruby).

parsedata.cpp  (ragel-6.9):parsedata.cpp  (ragel-6.10)
skipping to change at line 125 skipping to change at line 125
} }
if ( unusedBits && keyOps->alphType->isSigned && ul >> (size * 8 - 1) ) if ( unusedBits && keyOps->alphType->isSigned && ul >> (size * 8 - 1) )
ul |= ( -1L >> (size*8) ) << (size*8); ul |= ( -1L >> (size*8) ) << (size*8);
return Key( (long)ul ); return Key( (long)ul );
} }
Key makeFsmKeyDec( char *str, const InputLoc &loc, ParseData *pd ) Key makeFsmKeyDec( char *str, const InputLoc &loc, ParseData *pd )
{ {
/* Convert the number to a decimal. First reset errno so we can check if ( keyOps->alphType->isSigned ) {
* for overflow or underflow. */ /* Convert the number to a decimal. First reset errno so we can c
errno = 0; heck
long long minVal = keyOps->alphType->minVal; * for overflow or underflow. */
long long maxVal = keyOps->alphType->maxVal; errno = 0;
long long minVal = keyOps->alphType->sMinVal;
long long ll = strtoll( str, 0, 10 ); long long maxVal = keyOps->alphType->sMaxVal;
/* Check for underflow. */ long long ll = strtoll( str, 0, 10 );
if ( ( errno == ERANGE && ll < 0 ) || ll < minVal) {
error(loc) << "literal " << str << " underflows the alphabet type /* Check for underflow. */
" << endl; if ( ( errno == ERANGE && ll < 0 ) || ll < minVal) {
ll = minVal; error(loc) << "literal " << str << " underflows the alpha
} bet type" << endl;
/* Check for overflow. */ ll = minVal;
else if ( ( errno == ERANGE && ll > 0 ) || ll > maxVal ) { }
error(loc) << "literal " << str << " overflows the alphabet type" /* Check for overflow. */
<< endl; else if ( ( errno == ERANGE && ll > 0 ) || ll > maxVal ) {
ll = maxVal; error(loc) << "literal " << str << " overflows the alphab
} et type" << endl;
ll = maxVal;
}
if ( keyOps->alphType->isSigned )
return Key( (long)ll ); return Key( (long)ll );
else }
return Key( (unsigned long)ll ); else {
/* Convert the number to a decimal. First reset errno so we can c
heck
* 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 alpha
bet type" << endl;
ull = minVal;
}
/* Check for overflow. */
else if ( ( errno == ERANGE && ull > 0 ) || ull > maxVal ) {
error(loc) << "literal " << str << " overflows the alphab
et type" << endl;
ull = maxVal;
}
return Key( (unsigned long)ull );
}
} }
/* Make an fsm key in int format (what the fsm graph uses) from an alphabet /* Make an fsm key in int format (what the fsm graph uses) from an alphabet
* number returned by the parser. Validates that the number doesn't overflow * number returned by the parser. Validates that the number doesn't overflow
* the alphabet type. */ * the alphabet type. */
Key makeFsmKeyNum( char *str, const InputLoc &loc, ParseData *pd ) Key makeFsmKeyNum( char *str, const InputLoc &loc, ParseData *pd )
{ {
/* Switch on hex/decimal format. */ /* Switch on hex/decimal format. */
if ( str[0] == '0' && str[1] == 'x' ) if ( str[0] == '0' && str[1] == 'x' )
return makeFsmKeyHex( str, loc, pd ); return makeFsmKeyHex( str, loc, pd );
 End of changes. 3 change blocks. 
23 lines changed or deleted 48 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS