class BlockSource extends SourceFragment
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.
Such a source will be used in multi-pass parsers, where the root parser might strip some markup decoration from each line and then pass the result down to the next recursion. In such a case each line might have a different x-offset from the root input. The use of this instance ensures that the correct position can still be tracked.
- Alphabetic
- By Inheritance
- BlockSource
- SourceFragment
- SourceCursor
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new BlockSource(inputRef: InputString, lines: NonEmptyChain[LineSource], offset: Int, nestLevel: Int)
Type Members
-
type
Self = BlockSource
- Definition Classes
- BlockSource → SourceFragment → SourceCursor
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
atEnd: Boolean
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
- Definition Classes
- BlockSource → SourceCursor
-
def
canConsume(maxChars: Int): Int
- Attributes
- protected
- Definition Classes
- SourceCursor
-
def
capture(numChars: Int): String
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.
- Definition Classes
- BlockSource → SourceCursor
-
def
char: Char
The character at the current offset.
The character at the current offset.
- Definition Classes
- SourceCursor
-
def
charAt(relativeOffset: Int): Char
The character at the specified offset, relative from the current offset.
The character at the specified offset, relative from the current offset.
- Definition Classes
- SourceCursor
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
-
def
consume(numChars: Int): BlockSource
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.- Definition Classes
- BlockSource → SourceCursor
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(obj: Any): Boolean
- Definition Classes
- BlockSource → AnyRef → Any
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
hashCode(): Int
- Definition Classes
- BlockSource → AnyRef → Any
-
lazy val
input: String
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.
- Definition Classes
- BlockSource → SourceCursor
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
length: Int
The length of the input of this cursor.
The length of the input of this cursor.
- Definition Classes
- SourceCursor
- val lines: NonEmptyChain[LineSource]
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
val
nestLevel: Int
The nest level of this cursor in case of recursive parsing.
The nest level of this cursor in case of recursive parsing.
- Definition Classes
- BlockSource → SourceCursor
-
def
nextNestLevel: BlockSource
Create a new instance of this cursor with the nestLevel incremented.
Create a new instance of this cursor with the nestLevel incremented.
- Definition Classes
- BlockSource → SourceCursor
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
val
offset: Int
The offset of this cursor from the start of the source.
The offset of this cursor from the start of the source.
- Definition Classes
- BlockSource → SourceCursor
-
def
path: Option[Path]
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.
- Definition Classes
- SourceCursor
-
lazy val
position: Position
The current position in the input string.
The current position in the input string.
- Definition Classes
- BlockSource → SourceCursor
-
def
remaining: Int
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.
- Definition Classes
- BlockSource → SourceCursor
-
def
reverse: BlockSource
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.- Definition Classes
- BlockSource → SourceCursor
-
lazy val
root: RootSource
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.
- Definition Classes
- BlockSource → SourceCursor
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- BlockSource → AnyRef → Any
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
Deprecated Value Members
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] ) @Deprecated
- Deprecated