On Fri, Jan 22, 2010 at 4:01 PM, Stephan Assmus <superstippi@xxxxxx> wrote: > Hi, > > On 2010-01-22 at 21:20:19 [+0100], Stephan Assmus <superstippi@xxxxxx> > wrote: >> Becomes something like this (untested): >> >> const char* begin = fCurrentChar; >> bool expectE = true; >> bool expectPlusOfMinus = false; >> while (*fCurrentChar != 0) { >> if (!isdigit(*fCurrentChar)) { >> if (*fCurrentChar == 'e' || *fCurrentChar == 'E') { >> if (!expectE) >> break; >> expectE = false; >> expectPlusOfMinus = true; >> continue; >> } else if (*fCurrentChar == '+' || *fCurrentChar == '-') { >> if (!expectPlusOfMinus) >> break; >> } else if (!(*fCurrentChar == '.' || *fCurrentChar == ',')) >> break; >> expectPlusOfMinus = false; >> } >> if (*fCurrentChar == ',') >> temp << '.'; >> else >> temp << *fCurrentChar; >> fCurrentChar++; >> } >> >> So while we are already parsing a number, we expect +/- only directly >> after encountering e/E. And we expect to encounter e/C only once (unlike >> before). The actual parsing is still handled by the sscanf() invokation >> and any syntax error in the string (like double ,/.) should cause it to >> throw an error. > > Not quite, but I commited something which seems to work in r35244. Is that > what you needed? > > Best regards, > -Stephan > > I updated the r35246 and I see that the bug has pretty much been fixed, thank you! The only small bug left is if you type something like 1E+6+2 it errors but if you type 1E+6 +2 it works (needs the space) and I think that we all can live with that since 1E+6+2 is fairly ambiguous anyway. John Scipione