Wrap initializer code in generated parsers into |{...}|

Initializer code is usually indented and this indentation is carried
over to generated code. This resulted in a piece of indented code in the
middle of the parser.

This commit wraps initializer code in |{...}|, which makes indentation
in generated parsers look a bit more natural.
Inline functions extracted just because of JSHint

Rather than extracting functions just because JSHint complained about
defining functions inside a loop, let's inline then and silence the
warning.
Standardize on 3 spaces before // comments
s/head/first/ & s/tail/rest/ in a testcase

Makes the testcase in sync with example grammars.