Interface ParserState

All Superinterfaces:
BlockParserTracker, BlockTracker
All Known Implementing Classes:
DocumentParser

public interface ParserState extends BlockTracker, BlockParserTracker
State of the parser that is used in block parsers.

This interface is not intended to be implemented by clients.

  • Method Details

    • getLine

      BasedSequence getLine()
      Returns:
      the current line
    • getLineWithEOL

      BasedSequence getLineWithEOL()
      Returns:
      the current line with EOL
    • getIndex

      int getIndex()
      Returns:
      the current index within the line (0-based)
    • getNextNonSpaceIndex

      int getNextNonSpaceIndex()
      Returns:
      the index of the next non-space character starting from getIndex() (may be the same) (0-based)
    • getColumn

      int getColumn()
      The column is the position within the line after tab characters have been processed as 4-space tab stops. If the line doesn't contain any tabs, it's the same as the getIndex(). If the line starts with a tab, followed by text, then the column for the first character of the text is 4 (the index is 1).
      Returns:
      the current column within the line (0-based)
    • getIndent

      int getIndent()
      Returns:
      the indentation in columns (either by spaces or tab stop of 4), starting from getColumn()
    • isBlank

      boolean isBlank()
      Returns:
      true if the current line is blank starting from the index
    • isBlankLine

      boolean isBlankLine()
      Returns:
      true if the current line is blank starting from the index
    • getActiveBlockParser

      BlockParser getActiveBlockParser()
      Returns:
      the deepest open block parser
    • getActiveBlockParsers

      List<BlockParser> getActiveBlockParsers()
      Returns:
      the current list of active block parsers, deepest is last
    • getActiveBlockParser

      BlockParser getActiveBlockParser(Block node)
      Parameters:
      node - block node for which to get the active block parser
      Returns:
      an active block parser for the node or null if not found or the block is already closed.
    • getInlineParser

      InlineParser getInlineParser()
      Returns:
      inline parser instance for the parser state
    • getLineNumber

      int getLineNumber()
      Returns:
      The 0 based current line number within the input
    • getLineStart

      int getLineStart()
      Returns:
      the start of line offset into the input stream corresponding to current index into the line
    • getLineEolLength

      int getLineEolLength()
      Returns:
      the EOL offset into the input stream corresponding to current index into the line
    • getLineEndIndex

      int getLineEndIndex()
      Returns:
      the end of line offset into the input stream corresponding to current index into the line, including the EOL
    • endsWithBlankLine

      boolean endsWithBlankLine(Node block)
      Test the block to see if it ends in a blank line. The blank line can be in the block or its last child.
      Parameters:
      block - block to be tested
      Returns:
      true if the block ends in a blank line
    • isLastLineBlank

      boolean isLastLineBlank(Node node)
      Test a block to see if the last line of the block is blank. Children not tested.
      Parameters:
      node - block instance to test
      Returns:
      true if the block's last line is blank
    • getProperties

      MutableDataHolder getProperties()
      Returns:
      document properties of the document being parsed
    • getParserPhase

      ParserPhase getParserPhase()
      Get the current parser phase
      Returns:
      the current parser phase ParserPhase
    • getParsing

      Parsing getParsing()
      Returns:
      strings and patterns class adjusted for options Parsing
    • getLineSegments

      List<BasedSequence> getLineSegments()
      Returns a list of document lines encountered this far in the parsing process
      Returns:
      list of line sequences (including EOLs)