lua-users home
lua-l archive

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

On Thu, Feb 13, 2014 at 2:55 AM, David Crayford <> wrote:
> To get Cosmo to work on my system (and IBM mainframe) I had to change the
> following cosmo code in grammar.lua.
> --local alpha =  lpeg.R('__','az','AZ','\127\255')
> local alpha =  lpeg.R('__','az','AZ')
> Obviously, the \127\255 range isn't going to work on an EBCDIC machine. I
> modified Lpeg to handle EBCDIC ranges simply by converting the EBCDIC chars
> to ASCII, which is a common hack. My question is what impact is that going
> to have on my altered version Cosmo? I wouldn't have considered ASCII
> \127\255 to be alphas. Is there a better way of doing this, possibly using
> locales?

Notice that this is the range from 127 to 255, not just these two
codes. Including this range in the definition of alpha is a hack to
allow UTF-8 encoded names in Cosmo, so I do not think it is going to
impact your program.

You can try replacing these hardcoded patterns with the ones returned
by lpeg.locale(), which use isalpha, isalnum, etc.

Fabio Mascarenhas