The parser would have to be changed. The parts that parse numbers and identifiers could probably be combined into one. Perhaps anything that starts with '0-9', 'A-Za-z', and '_', and that contains any of those and '.' could be stored into a temporary string. Then the string would be split at any '.'. If there are more than one '.', or if any part contains anything other than numbers, it would be an identifier token. If it only contains zero or one '.' and each part only has numbers, it would be treated as a number token.
Version 3 would probably be easier to make the change, in addition it supports structure-like identifiers (like color.red)
5 + 0t = number + identifier
5 + 0.4.5 = number + identifier (more than one '.')
5 + x.5 = number + identifier (one part has non-digits)
5 + 0.2 = number + number
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=1033354
Originator: NO
The parser would have to be changed. The parts that parse numbers and identifiers could probably be combined into one. Perhaps anything that starts with '0-9', 'A-Za-z', and '_', and that contains any of those and '.' could be stored into a temporary string. Then the string would be split at any '.'. If there are more than one '.', or if any part contains anything other than numbers, it would be an identifier token. If it only contains zero or one '.' and each part only has numbers, it would be treated as a number token.
Version 3 would probably be easier to make the change, in addition it supports structure-like identifiers (like color.red)
5 + 0t = number + identifier
5 + 0.4.5 = number + identifier (more than one '.')
5 + x.5 = number + identifier (one part has non-digits)
5 + 0.2 = number + number