Coverage Summary for Class: FrontMatterParser (io.heapy.kotmark.ext.front.matter.parser)

Class Method, % Branch, % Line, % Instruction, %
FrontMatterParser$Factory
FrontMatterParser$SeparatorRole 100% (1/1) 100% (2/2) 100% (18/18)
Total 100% (1/1) 100% (2/2) 100% (18/18)


 package io.heapy.kotmark.ext.front.matter.parser
 
 import io.heapy.kotmark.ext.front.matter.YamlFrontMatterBlock
 import io.heapy.kotmark.parser.SourceLine
 
 /** Parses front matter lines and appends child nodes to store the result in [YamlFrontMatterBlock]. */
 interface FrontMatterParser {
     fun onNextLine(block: YamlFrontMatterBlock, line: SourceLine)
 
     /**
      * Called for an unindented `---` or `...` separator, not at end of input.
      * Return [SeparatorRole.BLOCK_END] to close the block, or [SeparatorRole.CONTENT] to continue.
      * When treating the separator as content, this callback must process it: [onNextLine] will not
      * be called for the same line. This allows custom parsers to retain separators inside strings.
      */
     fun onEndingSeparator(block: YamlFrontMatterBlock, separator: SourceLine): SeparatorRole
 
     /** Creates a fresh parser for each front matter block; the factory itself is shared. */
     fun interface Factory {
         fun create(): FrontMatterParser
     }
 
     enum class SeparatorRole {
         BLOCK_END,
         CONTENT,
     }
 }