Factor out node-value-symbol
Refactor line number in exec-checked-script
Refactor plan-when and plan-when-not

Refactored so that the flag keyword generation is via a function,
which can be redef'd for testing.  Also fixed the line number on
the generated script.