lua-users home
lua-l archive

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


I've been making a parser with LPeG and I've run into the issue that I can't
match non-ASCII words even though I'm using a utf8 locale. It seems that
"alpha" (and "alnum", etc) from lpeg.locale() don't match anything beyond ASCII.
See the following code:

    local lpeg = require 'lpeg'
    local locale = lpeg.locale()
    print(lpeg.match(lpeg.C(lpeg.P("æ")), "æ"))    --> æ
    print(lpeg.match(lpeg.C(locale.alpha), "æ"))   --> nil

Is there an easy way to match non-ASCII alphabetical characters with LPeG?
If not, can LPeG be patched to support it?