cmLex.c: Fixed bug where a '-' with no following digits was interpretted as a integer.

This commit is contained in:
kevin 2013-02-25 11:40:37 -08:00
parent c9a0a1b2dc
commit 18fc1b0a12

View File

@ -200,10 +200,14 @@ unsigned _cmLexRealMatcher( cmLex* p, const cmChar_t* cp, unsigned cn, const cm
unsigned _cmLexIntMatcher( cmLex* p, const cmChar_t* cp, unsigned cn, const cmChar_t* keyStr ) unsigned _cmLexIntMatcher( cmLex* p, const cmChar_t* cp, unsigned cn, const cmChar_t* keyStr )
{ {
unsigned i = 0; unsigned i = 0;
bool signFl = false;
for(; i<cn; ++i) for(; i<cn; ++i)
{ {
if( i==0 && cp[i]=='-' ) if( i==0 && cp[i]=='-' )
{
signFl = true;
continue; continue;
}
if( !isdigit(cp[i]) ) if( !isdigit(cp[i]) )
break; break;
@ -220,7 +224,7 @@ unsigned _cmLexIntMatcher( cmLex* p, const cmChar_t* cp, unsigned cn, const cm
// containing a decimal point as reals. // containing a decimal point as reals.
return i; return signFl && i==1 ? 0 : i;
} }
unsigned _cmLexHexMatcher( cmLex* p, const cmChar_t* cp, unsigned cn, const cmChar_t* keyStr ) unsigned _cmLexHexMatcher( cmLex* p, const cmChar_t* cp, unsigned cn, const cmChar_t* keyStr )