Interface TokenControl


public interface TokenControl
Offers methods to control the parsing process by the handler.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Disable the handling of all types of comments.
    void
    disableComments(int type)
    Disable the handling of comments of the given type.
    void
    Enable the handling of all types of comments.
    void
    enableComments(int type)
    Enable the handling of comments of the given type.
    Get the current TokenHandler.
    void
    setAcceptEofEndingQuoted(boolean accept)
    If set, quoted strings ending with an EOF (End Of File). are processed through the relevant quoted method, albeit an error is reported in any case.
    void
    If set, quoted strings ending with an unescaped newline (instead of the closing quote) are processed through the relevant quoted method, albeit an error is reported in any case.
    void
    Enable/disable the external handling of locations.
    void
    Set the current parsing location to the given locator.
    void
    setLocationTo(LocatorAccess locator, int index)
    Set the parsing location given by index to the given locator.
    void
    Set a new TokenHandler.
    int
    Gives the next code point in the stream, bypassing the general processing for that one.
  • Method Details

    • enableAllComments

      void enableAllComments()
      Enable the handling of all types of comments.
    • setAcceptNewlineEndingQuote

      void setAcceptNewlineEndingQuote(boolean accept)
      If set, quoted strings ending with an unescaped newline (instead of the closing quote) are processed through the relevant quoted method, albeit an error is reported in any case. Otherwise, only the error is reported.

      It is set to false by default.

      Parameters:
      accept - true to process quoted strings that ends with an unescaped newline, false otherwise.
    • setAcceptEofEndingQuoted

      void setAcceptEofEndingQuoted(boolean accept)
      If set, quoted strings ending with an EOF (End Of File). are processed through the relevant quoted method, albeit an error is reported in any case. Otherwise, only the error is reported.

      It is set to false by default.

      Parameters:
      accept - true to process quoted strings that ends with an EOF, false otherwise.
    • skipNextCodepoint

      int skipNextCodepoint() throws IOException
      Gives the next code point in the stream, bypassing the general processing for that one.
      Returns:
      the next code point, or -1 if the end of the stream was reached.
      Throws:
      IOException - if an I/O problem occurs.
    • getTokenHandler

      TokenHandler3<?> getTokenHandler()
      Get the current TokenHandler.
      Returns:
      the TokenHandler.
    • setTokenHandler

      void setTokenHandler(TokenHandler3<?> handler)
      Set a new TokenHandler.
      Parameters:
      handler - the new TokenHandler.
    • disableAllComments

      void disableAllComments()
      Disable the handling of all types of comments.
    • enableComments

      void enableComments(int type)
      Enable the handling of comments of the given type.
      Parameters:
      type - the type of comment to enable. If the type does not exist, implementations may or may not throw an exception, depending on the intended coupling with the TokenHandler.
    • disableComments

      void disableComments(int type)
      Disable the handling of comments of the given type.
      Parameters:
      type - the type of comment to disable. If the type does not exist, implementations may or may not throw an exception, depending on the intended coupling with the TokenHandler.
    • setExternalLocationHandling

      void setExternalLocationHandling(boolean enable)
      Enable/disable the external handling of locations.

      If a binary stream is being processed, it should be enabled. It is enabled by default.

      Parameters:
      enable - if false, this parser will take care of handling CR/LF/FF control characters and location housekeeping. Otherwise, all control characters are sent to the handler without further processing.
    • setLocationTo

      void setLocationTo(LocatorAccess locator)
      Set the current parsing location to the given locator.

      Will only work correctly if externalLocationHandling is disabled.

      Parameters:
      locator - the locator.
      See Also:
    • setLocationTo

      void setLocationTo(LocatorAccess locator, int index)
      Set the parsing location given by index to the given locator.

      Will only work correctly if externalLocationHandling is disabled and the index points at the same line that the current parsing location.

      Parameters:
      locator - the locator.
      index - the index at which the location is to be set.
      See Also: