lua-users home
lua-l archive

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

I noticed that when matching the following pattern:

  patt1 / func1 * lpeg.P(func2) * patt2 * patt3

func2 is called before func1, moreover, if func2() returns nil,
then func1 isn't called at all. While this behavior seems
reasonable, I fail to find it mentioned somewhere in the manual.

And the question is: how to make results of func2() depend on
the captures of patt1 ? For example, when matching
  "if" * expression * "then" * block * "end",
one needs to know the value of expression before matching block.