I’d like to get position information using the positional parser and Positional trait. I’d like to read the file Im parsing into a string (or something I can convert to a string) and then parse it while retaining the position information. Here’s what I’ve found on ‘positional’:
https://wiki.scala-lang.org/display/SW/Parsing
…which off-handedly mentions StreamReader and CharArrayReader. Are there other options? Reading my file into something that can be used with a CharArrayReader may be what I need. If so, how does that work? If not, what should I be doing?
(FYI, StreamReader is out because I want to read and keep the file long before I parse it, not because I want to waste memory.)
Direct your favorite browser to the ScalaDoc HTML and navigate to the package
scala.util.parsing.inputwhere you’ll find the available positioned readers:CharArrayReaderCharSequenceReaderPagedSeqReaderStreamReaderAddendum
Creating one of these readers,
CharArrayReader, e.g., is simple:Now you have the
Readerto feed your parser.