in reply to Re^2: Parse::RecDescent trouble
in thread Parse::RecDescent trouble

Particularly I had no idea I can add a closure to the grammar and use it as part of a virtual main package

It's not really a closure. The block is inlined at the start of the generated parser code. You should check out Grammar.pm after executing:

use Parse::RecDescent my $grammar = ...; Parse::RecDescent->Precompile($grammar, "Grammar");

That block is documented as Start-up Actions.

I particularly do not understand the '' construct. it will always match right?

Yes, but remember that P::RD removes /$skip/ from the input before every terminal in the grammar. The current value of skip is '\\s*', so '' removes all leading whitespace.

That whole thing allows blank lines between key_value, but not within key_value.