
On Mon, Jul 13, 2009 at 10:22 PM, Michael Caisse<boost@objectmodelingdesigns.com> wrote:
OvermindDL1 wrote:
I find this quite interesting. I wonder if I might have the time tonight to make a Spirit2.1 version of this, the code would certainly be a great deal shorter. Just to make sure, from what I gathered looking at the code, you are trying to parse out a number from an ascii string that could potentially be an integer (64-bit, just digits, always base 10), a double (digits as the integer, then a period, then more digits parsed as the integer, OR a whole integer, then a space(s), followed by an int then a / then an int), it looks like that a real number can have a 'g' after it, but what is a g? I know what e's means, but g? I am also confused, it seems your types support int64 as well as double, but you only ever return an int64, why not a variant of both? Should I do this for Spirit2.1? Spirit2.1 naturally wants to use such things anyway so it is actually easier for me to do so, and the user would have a more accurate value too as they would get either an int64 or a double depending on what it parsed, I could also add in other representations like a struct of two int64's for a numerator/denominator as well for best accuracy. What would you prefer? _______________________________________________
I have considered doing this myself on and off. I'm still learning Spirit 2.1 and if you were to throw this together it would be a great example of approaching the problem three different ways.
I am looking forward to seeing your effort.
Spirit2.1 is by far the most easy Spirit to date, as well as the fastest, beats out many hand-written and tuned parsers as well. Should not be hard to do, and I think I would prefer to return a variant of all possible types as I see no point cutting out information, let the user decide what info they want, unless someone tells me they only want anything/everything as an int64, then I can do it that way too. But still, what would the 'g' in a number like 2.4g5 do, I know what e does, but g?