improved function parsing
peg.py: unsuccessful atempt to fix trailing whitespace problem
improved tests