lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, Sep 10, 2021 at 5:58 PM Parke <parke.nexus@gmail.com> wrote:
> The comment preceding the read_numeral() function in version 5.4.3 of
> Lua's lexer says:
>
> >  Roughly, [read_numeral()] accepts the following pattern:
> >
> >  %d(%x|%.|([Ee][+-]?))* | 0[Xx](%x|%.|([Pp][+-]?))*

Fwiw, I suspect a Lua numeral will exactly match one of the following:

'0[Xx]%.%x+'      followed optionally by  '[Pp][+-]?%d+'                
'0[Xx]%x+%.?%x*'  followed optionally by  '[Pp][+-]?%d+'                
'%d+%.?%d*'       followed optionally by  '[Ee][+-]?%d+'                
'%.%d+'           followed optionally by  '[Ee][+-]?%d+'                

Additionally, certain characters are not allowed to follow after a numeral.  (As just one example, the letters G through Z.)