=begin pod This document is meant to describe in some detail what's going on in C (found in C), since it's quite a big function. It contains a bunch of inner subs to make the process as sane as possible without resorting to a grammar. The phrase "or fails" in statements on return values means it returns a C, something that always presents itself as undefined. The C<$*LAST_CHANCE> dynamic (defined within C) is used to mark a given candidate as the last possible one, even if it isn't the last in the list (see below on C and C). The top-level (first) call to C will set C<$really-no-doubt> to C<$*LAST_CHANCE> as part of the error reporting process. =head2 C The C class is just a hack, because using Cs in a similar way will cause Raku to hang and likely eat all your memory (including on compiling C, the next step after C). Its only similarity to a C is that it always comes out as undefined (so it can be used with C/C/C). Aside from that it's meant to collect the error information as the literal is processed, turning into a C at the end. =head2 C =item C --- Checks for a negative sign at the start of the string =item2 Returns C<1> or C<0>, to match the flag for C =item C --- Checks if the start of string is a C<+> or C<-> =item2 Returns C<1> or C<0>, to match C (though these particular return values aren't otherwise important) =item C --- Check for oh radix prefix (0x, 0d, 0b, 0o) =item2 Returns new radix or fails =item C --- Runs through a sequence of subs in trying to find a literal, or part of one. =item2 Adverb C<:toplevel> sets C<$really-no-doubt> to C<$*LAST_CHANCE> (meant to let the top-level call to C add a measure of doubt to the given error message) =item2 Returns a literal or fails (with the last candidate's C) =item2 In regex terms, similar to C<||> =item C --- Sets C<$*LAST_CHANCE>, thereby telling C that the sub which called this has to be the one that matches the literal. In other words, it's called by a candidate when it knows that the literal "has to be this" candidate. =item2 Returns nothing useful. =item2 In regex terms, similar to C<::> =head2 C =item Bare integer --- C --- C<42>, C<-12>, C<0xF>, etc. =item2 Options: =item3 C<:e> --- used when calling from C =item3 C<:nosign> --- used when calling from C =item2 Requires: =item3 C (unless C<:nosign>) =item3 C (unless C<:e>) =item2 Returns C or fails =item Radix point rational --- C --- C<3.2>, C<-5.4> =item2 Options: =item3 C<:adverb> --- used when calling from C, allows oh radices =item3 C<:nosign> --- passed through for C, and used in here =item2 Requires: =item3 C (for before point portion) =item3 C (unless C<:nosign>) =item3 C (only if C<:adverb>) =item2 Returns C or fails =item Scientific C --- C --- C<1e5>, C<-3.5e-2> =item2 Requires: =item3 C (coefficient) =item3 C (exponent, base of 10 implied) =item2 Returns C or fails =item Adverbial number --- C --- C«:16», C«:11<0o7.7*8**2>», etc. =item2 Options: =item3 C<:nofrac> --- used when calling from C =item3 C<:nosign> --- controls whether a sign can be in front of the adverb =item2 Requires: =item3 C (for radix specifier, integer coeff) =item3 C (non-int coefficient) =item3 C (optional base in :#<> form) =item3 C (optional base in :#<> form) =item3 C (optional exp in :#<> form) =item3 C (optional exp in :#<> form) =item2 Returns: =item3 C if optional base and exponent; =item3 C without base and exponent, non-integral number; =item3 C without base and exponent, integral number; =item3 or fails =item Fractional rational --- C --- C«1/2», C«-3/:16», etc =item2 Requires: =item3 C (for :#<> form numerator) =item3 C (for bare integers in numerator) =item3 C (for :#<> form denominator) =item3 C (for bare integers in numerator) =item2 Returns C or fails =item Complex number --- C --- C<1+2i>, C<-3.5+-1i>, etc =item2 Requires: =item3 C =item3 C =item3 C =item3 C =item2 Returns C or fails =end pod