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]


> > 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.
Predicates (or look aheads) do not produce captures.
> Expected:
> {
> first = 'x',
> second = 'y',
> whole = 'x y'
> }
> 
> Any idea how to achieve the expected results?
I do not think this is possible without some external processing. (It
would be easier if you give up the keys.)
-- Roberto

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