Interface ParserContext<T>

All Known Implementing Classes:
ArrayParserContext, CommentParserContext, ElementParserContext, NumberParserContext, ObjectParserContext, StringParserContext, TokenParserContext

public interface ParserContext<T>
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    consume(int codePoint, Jankson loader)
    Consume one codepoint from the stream, and either use it to continue composing the result or to discover that the result is complete and processing should stop.
    void
    eof()
    Notifies this context that the file ended abruptly while in this context and before isComplete returned true.
    Gets the result of parsing.
    boolean
    Returns true if the parser has assembled a complete result.
  • Method Details

    • consume

      boolean consume(int codePoint, Jankson loader) throws SyntaxError
      Consume one codepoint from the stream, and either use it to continue composing the result or to discover that the result is complete and processing should stop. Throws a SyntaxError if unexpected or nonsense characters are encountered.
      Throws:
      SyntaxError
    • eof

      void eof() throws SyntaxError
      Notifies this context that the file ended abruptly while in this context and before isComplete returned true. In some contexts, like a single-line comment, this is fine. In most contexts, this should throw a descriptive error.
      Throws:
      SyntaxError
    • isComplete

      boolean isComplete()
      Returns true if the parser has assembled a complete result. After true is returned, no more code points will be offered to consume, and getResult will soon be called to retrieve the result.
    • getResult

      T getResult() throws SyntaxError
      Gets the result of parsing. Will be called only after isComplete reports true and processing of input has ceased.
      Throws:
      SyntaxError