lua-users home
lua-l archive

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


> Mainly "last complete outermost group capture" and "immediate
> evaluation of all its nested captures", in:

"complete" is defined in the text you sent; "outermost" idem; "last"
means "most recent" (also defined in the text); "group capture" is
defined somewhere else. I really don't know what else we should
explain.

In your example:

  (lpeg.C(1):Cg"c" * (lpeg.C(1):Cg"d" * lpeg.Cb"c")):match"ab"

When it matches lpeg.Cb"c", the match with "lpeg.C(1):Cg"c" is complete.
That group pattern is also not inside another complete capture that does
not contain the back capture itself, so it is outermost. It is the last
group capture with that given name ("c"). So, its value is used in the
back capture.

Counter-examples:

  - lpeg.Cg(lpeg.Cb"c", "c")
  When it matches lpeg.Cb"c", the group capture is not complete, so
  it cannot be used.

  - (lpeg.Cg(1, "c") / "x") * lpeg.Cb("c")
  The group capture is inside another complete capture (the string
  capture) that does not contain the back capture, so it is not
  "outermost", and therefore cannot be used.

(Actually, it seems that "that does not contain the back capture itself"
is redundant. If the capture is complete, it cannot contain the back
capture.)


I also fail to see what is not clear in "immediate evaluation".
(It means the evaluation of those captures are not postponed or
avoided.)

-- Roberto