Improve error messages

v8's JSON.parse() is notorious for producing useless error messages, so
one will often see errors such as "Unexpected token E". This patch
enhances these errors to provide the context of the line that caused the
error, as well as any further lines that may have been buffered up
already.

[1] https://code.google.com/p/v8/issues/detail?id=1480