lua-users home
lua-l archive

Re: Cosmo, Lpeg and EBCDIC

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


On Thu, Feb 13, 2014 at 2:55 AM, David Crayford <dcrayford@gmail.com> 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

AltStyle によって変換されたページ (->オリジナル) /