LineSource

object LineSource

Companion for creating LineSource instances.

Companion:
class
class Object
trait Matchable
class Any

Value members

Concrete methods

def apply(input: String, parent: SourceCursor): LineSource

Creates a new instance for the specified input and parent source. The input is used by parsers whereas the parent source is only used for error messages.

Creates a new instance for the specified input and parent source. The input is used by parsers whereas the parent source is only used for error messages.

There are some expectations which are not enforced to allow for the necessary freedom to handle edge cases:

  • The parent source is expected to be at an offset that corresponds to the beginning of the input of this new instance.
  • The input of the parent is expected to contain the full input of this source at its current offset, to ensure position tracking is accurate in case of errors.

Some minor deviations from these rules can be allowed, if they do not diminish the accuracy of position tracking. For example, if this input has all line breaks replaced by spaces, but the parent does not, the positions would still align.