lua-users home
lua-l archive

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

Hi list,

I know that I can examine the internal representation of (compiled)
lpeg patterns by compiling lpeg with -DLPEG_DEBUG and then running
some methods like :pcode() and :ptree(), as in the code below... but
these methods use printfs, and so they send their output to stdout.

People, do you have any tricks - wrappers, maybe? - to display these
debugging outputs in other ways?

Here is some code that works, but that is clumsy:

rm -Rv /tmp/lpeg-1.0.2*
cd     /tmp/
tar -xvzf   lpeg-1.0.2.tar.gz
cd     /tmp/lpeg-1.0.2/
make LUADIR=/usr/include/lua5.1 COPT="-O2 -DLPEG_DEBUG"

cat > o.lua <<'%%%'
require "lpeg"
AlphaNumeric = lpeg.R("AZ", "az", "09")
AnchorChar = AlphaNumeric + lpeg.S("!#$%()*+,-./:;=?@^_{|}~")

lua5.1 o.lua | tee o.out

  Thanks in advance!
  Eduardo Ochs