GROOVY-3457: Fixing issues in the replacement StreamingTemplateEngine

This is a follow up on [pull request 503](https://github.com/groovy/groovy-core/pull/503). Fixing the following: 

o The template engine now handles $var style variable reference
o Fixed invalid line numbers in the thrown exception when template errors were encountered
o Fixed failing execution of the example given in the javadoc...doh
o Improved unit test coverage: added the javadoc example as a spock test,
  added tests for $var expressions, improved coverage for other expressions,
  added test for correct line numbers in exception on template errors
o Improved template exception messaging with three lines of
  context so that the exception message contains the erring lines for more visibility.