A block source represents the source for a block level element where each individual line might have a different x-offset to the root source.
This type of source is essential to preserve position tracking in recursive block parsing. For block level markup the first passes have to identify the type of block and remove their markup decoration. The remaining inline markup is then passed to inline parsers, but the input to those parsers is no longer a consecutive substring of the root input, making it hard to provide exact positions in error messages.
This type of source cursor solves this issue by providing a view to parsers that looks like a consecutive string of inline markup without the stripped decoration, while maintaining the x- and y-offsets of each line in relation to the root source.
Attributes
- Companion
- object
- Source
- SourceCursor.scala
- Graph
-
- Supertypes
Members list
Type members
Types
Attributes
- Source
- SourceCursor.scala
Value members
Concrete methods
Indicates whether this contexts offset is behind the last character of the input string
Indicates whether this contexts offset is behind the last character of the input string
Attributes
- Source
- SourceCursor.scala
Captures a string containing the specified number of characters from the current offset.
Captures a string containing the specified number of characters from the current offset. If the number of remaining characters is less than the specified number, all remaining characters will be returned.
Attributes
- Source
- SourceCursor.scala
Consumes the specified number of characters, returning a new SourceCursor
with the new offset.
Consumes the specified number of characters, returning a new SourceCursor
with the new offset.
Attributes
- Source
- SourceCursor.scala
Compares the receiver object (this
) with the argument object (that
) for equivalence.
Compares the receiver object (this
) with the argument object (that
) for equivalence.
Any implementation of this method should be an equivalence relation:
- It is reflexive: for any instance x
of type Any
, x.equals(x)
should return true
. - It is symmetric: for any instances x
and y
of type Any
, x.equals(y)
should return true
if and only if y.equals(x)
returns true
. - It is transitive: for any instances x
, y
, and z
of type Any
if x.equals(y)
returns true
and y.equals(z)
returns true
, then x.equals(z)
should return true
.
If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is usually necessary to override hashCode
to ensure that objects which are "equal" (o1.equals(o2)
returns true
) hash to the same scala.Int. (o1.hashCode.equals(o2.hashCode)
).
Value parameters
- that
-
the object to compare against this object for equality.
Attributes
- Returns
-
true
if the receiver object is equivalent to the argument;false
otherwise. - Definition Classes
-
Any
- Source
- SourceCursor.scala
Calculate a hash code value for the object.
Calculate a hash code value for the object.
The default hashing algorithm is platform dependent.
Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)
) yet not be equal (o1.equals(o2)
returns false
). A degenerate implementation could always return 0
. However, it is required that if two objects are equal (o1.equals(o2)
returns true
) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)
). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals
method.
Attributes
- Returns
-
the hash code value for this object.
- Definition Classes
-
Any
- Source
- SourceCursor.scala
Create a new instance of this cursor with the nestLevel incremented.
Create a new instance of this cursor with the nestLevel incremented.
Attributes
- Source
- SourceCursor.scala
Indicates the number of characters remaining in the input string after the current offset.
Indicates the number of characters remaining in the input string after the current offset.
Attributes
- Source
- SourceCursor.scala
Returns a new SourceCursor
with the input string being reversed, but pointing to the same character as this context.
Returns a new SourceCursor
with the input string being reversed, but pointing to the same character as this context.
This is a low-level optimization for parsers that look for strings like email addresses where the first character is not significant, so that parsing backwards from any @
encountered in the input provided better performance.
Attributes
- Source
- SourceCursor.scala
Returns a string representation of the object.
Returns a string representation of the object.
The default representation is platform dependent.
Attributes
- Returns
-
a string representation of the object.
- Definition Classes
-
Any
- Source
- SourceCursor.scala
Inherited methods
The character at the current offset.
The character at the current offset.
Attributes
- Inherited from:
- SourceCursor
- Source
- SourceCursor.scala
The character at the specified offset, relative from the current offset.
The character at the specified offset, relative from the current offset.
Attributes
- Inherited from:
- SourceCursor
- Source
- SourceCursor.scala
The length of the input of this cursor.
The length of the input of this cursor.
Attributes
- Inherited from:
- SourceCursor
- Source
- SourceCursor.scala
The (virtual) path of the document this input originates from; may be empty in case of generated sources.
The (virtual) path of the document this input originates from; may be empty in case of generated sources.
Attributes
- Inherited from:
- SourceCursor
- Source
- SourceCursor.scala
Concrete fields
The full input string, containing the string portions before and after the current offset.
The full input string, containing the string portions before and after the current offset.
Attributes
- Source
- SourceCursor.scala
Attributes
- Source
- SourceCursor.scala
The nest level of this cursor in case of recursive parsing.
The offset of this cursor from the start of the source.
The current position in the input string.
The source for the root input, positioned to match the offset of this (potentially nested) source.
The source for the root input, positioned to match the offset of this (potentially nested) source.
Attributes
- Source
- SourceCursor.scala