Mark |parse| and |SyntaxError| as internal identifiers

The |parse| function and the |SyntaxError| exception were meant as
internal, so let's mark them as such.
Expose the parser object in action/predicate code

The action/predicate code didn't have access to the parser object. This
was mostly a side effect actions/predicates being implemented as nested
functions, in which |this| is a reference to the global object (an ugly
JavaScript quirk). The initializer, being implemented differently, had
access to the parser object via |this|, but this was not documented.

Because having access to the parser object can be useful, this commits
introduces a new |parser| variable which holds a reference to it, is
visible in action/predicate/initializer code, and is properly
documented.

See also:

  https://groups.google.com/forum/#!topic/pegjs/Na7YWnz6Bmg
Clarify initializer documentation

Make it clear that there is only one initializer in the whole grammar.
The previous formulation could have been understood to mean that there
can be an initializer for every rule in the grammar.

Fixes #82.
Update example arithmetics.pegjs, make it work
Merge pull request #252 from chunpu/patch-1

Update example arithmetics.pegjs, make it work
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.
Change module exporting style

Modules now generally store the exported object in a named variable or
function first and only assign |module.exports| at the very end. This is
a difference when compared to style used until now, where most modules
started with a |module.exports| assignment.

I think the explicit name helps readability and understandability.
Utility functions cleanup: Split lib/utils.js

Split lib/utils.js into multiple files. Some of the functions were
generic, these were moved into files in lib/utils. Other funtions were
specific for the compiler, these were moved to files in lib/compiler.

This commit only moves functions around -- there is no renaming and
cleanup performed. Both will come later.
Utility functions cleanup: Cleanup lib/utils/arrays.js
Utility functions cleanup: Cleanup lib/utils/objects.js
Utility functions cleanup: Cleanup lib/utils/classes.js
Utility functions cleanup: Cleanup lib/compiler/asts.js
Utility functions cleanup: Cleanup lib/compiler/visitor.js
Utility functions cleanup: Cleanup lib/compiler/javascript.js
Fix a bug in |stringEscape|

The |stringEscape| function both in lib/compiler/javascript.js and in
generated parsers didn't escape characters in the U+0100..U+107F and
U+1000..U+107F ranges.
generate-javascript.js: s/generateJavaScript/generateJavascript/

This makes the variable name in sync with pass name in lib/compiler.js.
Formatting