Re: LPeg: named captures within a named capture ?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: LPeg: named captures within a named capture ?
- From: Roberto Ierusalimschy <roberto@...>
- Date: 2012年6月29日 12:56:05 -0300
> > 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