Class BlockStart

  • Direct Known Subclasses:
    BlockStartImpl

    public abstract class BlockStart
    extends java.lang.Object
    Result object for starting parsing of a block, see static methods for constructors.
    • Constructor Detail

      • BlockStart

        protected BlockStart()
    • Method Detail

      • none

        public static BlockStart none()
        Result for when there is no block start.
      • of

        public static BlockStart of​(BlockParser... blockParsers)
        Start block(s) with the specified parser(s).
      • atIndex

        public abstract BlockStart atIndex​(int newIndex)
        Continue parsing at the specified index.
        Parameters:
        newIndex - the new index, see ParserState.getIndex()
      • atColumn

        public abstract BlockStart atColumn​(int newColumn)
        Continue parsing at the specified column (for tab handling).
        Parameters:
        newColumn - the new column, see ParserState.getColumn()
      • replaceActiveBlockParser

        @Deprecated
        public abstract BlockStart replaceActiveBlockParser()
        Deprecated.
        use replaceParagraphLines(int) instead; please raise an issue if that doesn't work for you for some reason.
      • replaceParagraphLines

        public abstract BlockStart replaceParagraphLines​(int lines)
        Replace a number of lines from the current paragraph (as returned by MatchedBlockParser.getParagraphLines()) with the new block.

        This is useful for parsing blocks that start with normal paragraphs and only have special marker syntax in later lines, e.g. in this:

         Foo
         ===
         
        The Foo line is initially parsed as a normal paragraph, then === is parsed as a heading marker, replacing the 1 paragraph line before. The end result is a single Heading block.

        Note that source spans from the replaced lines are automatically added to the new block.

        Parameters:
        lines - the number of lines to replace (at least 1); use Integer.MAX_VALUE to replace the whole paragraph