Num -package:haha -package:linear-base -package:svg-tree package:pretty-simple
We could store this as a
Rational, say, instead of a
String. However, we will never need to use its value for
anything. Indeed, the only thing we will be doing with it is turning
it
back into a string at some stage, so we might as well cut
out the middle man and store it directly like this.
Color to use for numbers.
Parses integers and reals, like
123 and
45.67.
To be more precise, any numbers matching the regex
\d+(\.\d+)? should get parsed by this function.
>>> parseNumberLit '3' "456hello world []"
("3456","hello world []")
>>> parseNumberLit '0' ".12399880 foobar"
("0.12399880"," foobar")