title: Adding line numbers to parsing errors without extending Positional directly
body: <p>I have (finally) completed a parser, which processes my DSL and translates it to my domain objects. Now I want to add some proper error handling, and I wish to add the line numbers to the errors reported by the parser.</p>
  
  <p>The examples and answers I found <a href="https://wiki.scala-lang.org/plugins/viewsource/viewpagesrc.action?pageId=917624" rel="nofollow noreferrer">here</a> and <a href="https://stackoverflow.com/questions/2906674/how-to-further-improve-error-messages-in-scala-parser-combinator-based-parsers">here</a> seem to indicate that I have to modify my domain objects to extend <code>scala.util.parsing.input.Positional</code>. The example is a bit too simplistic for my case, and (due to my inexperience) it seems my case doesn't quite fit this paradigm. </p>
  
  <p>The main problem I have is that I do not want my domain objects to directly extend <code>Positional</code>. They are used elsewhere in the program that does not have anything to do with the parsing (the parser is just an extension of the program to create a different way to input the data). Also, I don't know how to handle cases which output <code>String</code> (or other classes which I don't have any control of). There is also the issue that my domain objects already extend other objects of the program, I can't simply change the hierarchy that way.</p>
  
  <p>Is there any alternative way to handle this cleanly, without modifying the domain objects and coupling them with the <code>Positional</code>? (Apologies if I am asking something trivial that has to do with implementing traits etc. because I am still new to Scala)</p>