Generated templates can now be typed as a Scala function

- Refactored parsing of LINES and MATRIX meta, the code was very similar
- Refactored mapPosition and mapLine, the code was very similar
- Removed some compiler warnings
    - Added `:Throwable` in catch clauses
    - Added missing `Error` case in `positionalLiteral` of parser
    - Added language feature imports
- Moved big chunks of the `ScalaTemplateCompiler` file to traits
- Refactored `getFunctionMapping` to remove some duplicate code and make it more readable
- Updated `generateCode`
    - making use of string interpolation where possible
    - added an `@scala.deprecated` annotation for the `f` method (not sure about the version that's in there)
    - added implicit `toFunction` methods that can convert the template object to the correct function type
- Cleanup of the `TestCompilerSpec`
    - introduced a `Context` for compiling
    - moved the separate template tests into their own examples
    - compiler helper now returns the template object itself instead of `f`
    - cast is done to structural types