lua-users home
lua-l archive

Re: LPeg: named captures within a named capture ?

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


> How about this:
>
> space = P" "^0
> token = (R"az")^1
> header = Cg(token, "first") * space * Cg(token, "second")
> headerRedundant = Ct(#Cg(header, "whole") * header)
Hello lpeg folks, the proposed code does not return the wanted result.
headerRedundant:match("x y")
Actual:
{
 first = 'x',
 second = 'y'
}
Expected:
{
 first = 'x',
 second = 'y',
 whole = 'x y'
}
Any idea how to achieve the expected results?
Thanks
-- 
-- Philippe

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