StreamingMarkdownFile

Mutable AST node that accept appending chunks.

THIS INSTANCE IS NOT CONCURRENT SAFE. NEVER ACCESS IT CONCURRENTLY.

When append is called, only the unstableTail part will be reparsed. The only way to update its state is to invoke append. Then endOffset, stableChildren, unstableTail and children will be updated.

To avoid memory leak, it doesn't hold the whole original Markdown string. The caller may accumulate the original string outside the StreamingMarkdownFile.

After each append, StreamingMarkdownFile represents a complete Markdown document ending at the current offset.

Properties

Link copied to clipboard
open override val children: List<ASTNode>
Link copied to clipboard
abstract override val endOffset: Int
Link copied to clipboard
open override val parent: Nothing?
Link copied to clipboard
abstract val stableChildren: List<ASTNode>

The accumulated stable part of the Markdown file.

Link copied to clipboard
open override val startOffset: Int
Link copied to clipboard
open override val type: IElementType
Link copied to clipboard
abstract val unstableTail: List<ASTNode>

The unstable part of the Markdown file. It may be updated by append. Every append will reparse this part. If some part of unstableTail gets stable, it will be removed and appended to stableChildren.

Functions

Link copied to clipboard
fun ASTNode.accept(visitor: Visitor)
Link copied to clipboard
Link copied to clipboard
abstract fun append(chunk: CharSequence)

Appends a chunk of text to the current Markdown document.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard