[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Matching multibyte alphabetical characters with LPeG
- From: Hinrik Örn Sigurðsson <hinrik.sig@...>
- Date: Sun, 17 Jun 2012 03:40:08 +0000
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?