Module md.grammar

Class DocumentParser


  • public final class DocumentParser
    extends Object
    • Constructor Detail

      • DocumentParser

        public DocumentParser()
    • Method Detail

      • parse

        public boolean parse​(InputStream inputStream,
                             Consumer<? super GraphContext> contextConsumer)
                      throws IOException
        Parse a markdown document
        Parameters:
        inputStream - input as markdown
        contextConsumer - consumer of document events
        Returns:
        true if the document is fully parsed without errors
        Throws:
        IOException - if the document cannot be read
      • parse

        public boolean parse​(InputStream inputStream,
                             Consumer<? super GraphContext> contextConsumer,
                             DocumentParser.ParserErrorListener parserListener)
                      throws IOException
        Parse a markdown document
        Parameters:
        inputStream - input as markdown
        contextConsumer - consumer of document events
        parserListener - listens for parser errors. May be null.
        Returns:
        true if the document is fully parsed without errors
        Throws:
        IOException - if the document cannot be read
      • validate

        public boolean validate​(InputStream inputStream,
                                DocumentParser.ParserErrorListener parserListener)
                         throws IOException
        Validate a markdown document
        Parameters:
        inputStream - input as markdown
        parserListener - listens for parser errors.
        Returns:
        true if the document is fully parsed without errors
        Throws:
        IOException - if the document cannot be read