Package blue.endless.jankson.impl
Interface ParserContext<T>
- All Known Implementing Classes:
ArrayParserContext,CommentParserContext,ElementParserContext,NumberParserContext,ObjectParserContext,StringParserContext,TokenParserContext
public interface ParserContext<T>
-
Method Summary
Modifier and TypeMethodDescriptionbooleanConsume 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.voideof()Notifies this context that the file ended abruptly while in this context and before isComplete returned true.Gets the result of parsing.booleanReturns true if the parser has assembled a complete result.
-
Method Details
-
consume
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
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
Gets the result of parsing. Will be called only after isComplete reports true and processing of input has ceased.- Throws:
SyntaxError
-