From your explanation, parsetoken is certainly the wrong name.
Parsetoken is what you
would expect a function that served in the front end of a compiler or
interpreter which
determined what type each word of the source code was, number, symbol,
reserved
word, op, etc.
Stavros Macrakis wrote:
> Speaking of misleading names, contrib/stringproc has a routine called
> parsetoken which reads an integer or float from a string (using the
> Lisp reader, as it happens), e.g.
>
> parsetoken("2.3") => 2.3
> parsetoken("2/3") => 2/3 (I just fixed this case; previously
> it returned a CL rational)
>
> Useful functionality. But, as its documentation says, it only works
> on numbers, not tokens in general:
>
> parsetoken("foo") => false
> parsetoken("*") => false
>
> And not all Maxima numbers:
>
> parsetoken("2.3b0") => false
>
> (Incidentally, t also works on a lot of things that aren't numbers in
> Maxima syntax, like 2.3s0, #C(23 0), and `````,,,23 (but not ,,,23).
> -- but let's not worry about that... The speed advantage of the Lisp
> reader is handy sometimes....)
>
> Shouldn't we call this something like parse_number? Even that is
> misleading, because it doesn't handle bfloats.