Hello. I am coding tokenizer which split expression( for example 123+45 123, + , 45)for calculator. It works correctly excpet float/dobule numbers beacuse I dont know how to put dot between digits.
What do you think about this code?
I found it easier to handle everything else, then what is left is either a number or an error.
I did that with a switch default but you can do with if/else ... the final else would be what is left, and check if its a valid number in there. Don't forget to figure out a scheme for when - is subtraction and when - is part of a negative number. I did that by saying if the token is length 1 and "-" then its subtraction else its part of number (or error).
dunno if this helps you or not.