Parse and interpret block parameters

Blocks accept parameters, which requires some lookahead to establish
whether an identifier is a parameter or an expression. Block bodies
behave in a very similar fashion to method requests.
Rethrow errors in synchronous mode

The external interpreter mistakenly applied a callback whether or not it
existed when an error occurred, resulting in useless errors in
synchronous mode. If the callback is undefined, it now just rethrows the
error.
Add patterns to var and def

Var and Def AST nodes now accept patterns, and the parser consumes and
builds them. As with other patterns, they are not checked, as runtime
patterns do not yet exist.
Variable redefinitions report correct name

The 'put' method in the interpreter used the identifying name of a
method for both identifying and reporting. This wasn't an issue for
variables, as their identifying and pretty names are the same, but it
meant that an error from creating a method whose name already existed
were not correct.

On the theme of ensuring requests are consistent, this commit also
includes some request tests for def and var.
Methods re-clone the scope stack when requested

Method definitions clone the scope stack to maintain the surrounding
closure, but would previously use that same stack for every call,
meaning nested calls would all inhabit the same scope. Now a method
request clones the scope again, so that nested calls have their own
scope.
Parse and interpret direct and indirect returns

The lexer, parser and AST now support return statements. The interpreter
implements returns by storing the callback of a method in the scope
stack, and executes a return by finding the nearest callback in scope
and calling it, passing the return's expression if it has one. It does
this without executing its own callback, effectively jumping from its
current location to the end of the method execution.
Add module object to interpreter

The top-level module object now exists in the interpreter, with a self
property at the front of the scope stack. The method which retrieves the
direct self value of the current scope now returns null instead of
undefined when there is no self value directly available.
Hoist methods, getters, and setters into self

Methods and variables directly in object definitions are available
immediately, rather than after their definition site. During the
hoisting, methods are interpreted as usual, but getters and setters
remain undefined, so they have temporary definitions that throw if
called.
Differentiate Grace and JS objects on request

Default JavaScript methods are now not available on Grace objects.
Conversely, standard JavaScript objects will appear to have the default
Grace methods, as well as support for getting and setting properties
that are not functions. The REPL now gets any object to mimic the
behaviour of asString if it's implementation is the same as the default
JavaScript toString.
Support more complicated whitespace parsing

Newlines may now appear in the middle of a separate parse, so long as
they are indented further than the start of the actual line. This
involves updates to the lexer as well as the parser, as consecutive
newlines are now mashed together, and the final line remembers how much
space appears after it.

The parser also keeps track of general indentation, enforcing indents on
newlines following open braces and ensuring that indentation remains
consistent across lines that should be at the same indentation. The
parser is no longer context-free, and though this could be maintained by
performing rewriting in the lexer, it seems more sensible to make the
parser smart if it keeps the lexer dumb.
Parse and interpret inherits clause

Inheritance can now be achieved with an inherits clause, which is
strictly parsed to contain a request. Methods which tail-return an
object have an inherit method that is called instead of the method
itself. The inherit method splits the body and interprets the last node
with a predetermined self value. Future work requires clarifying the
lookup semantics, and whether inherited methods can be requested
unqualified.
Use setImmediate instead of custom async

The existing solution for asynchronous behaviour didn't use the native
but poorly supported setImmediate function, and fell back on setTimeout
when no other solution worked. This implementation now uses a separate
package that chooses the best available function.
Test for failure, and in both sync and async modes

The test harness has been updated to handle both 'run' and 'fail' tests,
which allows testing for expected failure. Regular JavaScript errors
still cause any test to fail. The harness now also runs each test in
both synchronous and asynchronous modes, to ensure the behaviours of the
two modes are consistent.

The command-line tool now also runs in synchronous mode by default, but
can be changed back to asynchronous by passing the --async (-a) flag.
Handle late returns correctly

Methods that had returned were leaving their callback behind in the
stack, and late returns in blocks were finding that callback and
reapplying the exit of the method. Now methods set the callback to null
when exiting, so late returns recognise that they are returning from an
already exited method. The previous error case remains, but indicates
that the return was never inside another method.

A few method names have also been changed in the interpreter.
Add self to request search path

An unqualified request will now search in the local self definition
before searching through the stack. This causes inherited methods to be
in scope in an object constructor.
Prevent return inside an object

Returns used to pass through an object constructor (and class) boundary
when searching for the surrounding method callback. Now, if the search
encounters 'self' while looking for the callback, the return is
erroneous.
Add sync mode change to REPL

The REPL now respects the --async (-a) flag. The interpret method of an
Interpreter can handle no callback if the Interpreter isn't running in
asynchronous mode.
Curry multipart methods

The underlying implementation of methods took lists of arguments to each
part of a method's signature, which was easy to process but meant that
single-part methods were not exposed as regular Javascript functions.
This change identifies arguments for each part by taking the arguments
for one part, and then returning a function that will take the next.
Once all arguments are given, the method runs. Single-part methods now
behave like regular JavaScript functions, as they run the method
straight away.
Operator precedence and prefix operators

Chaining operators is now left associative, and mixing different
operators is not allowed. Math operators have their own precedence
rules. Prefix operators can now be declared and used in expressions.
Simple runtime primitive values

Booleans, numbers, and strings are now supported. Booleans are
implemented simply as variables in the top scope, and numbers and
strings create new references for each literal encountered. Each has a
simple set of methods.