Package org.jparsec

Class ScannerState

java.lang.Object
org.jparsec.ParseContext
org.jparsec.ScannerState

final class ScannerState extends ParseContext
Parser state for scanner.
  • Field Details

    • end

      private final int end
  • Constructor Details

    • ScannerState

      ScannerState(CharSequence source)
    • ScannerState

      ScannerState(String module, CharSequence source, int from, SourceLocator locator)
    • ScannerState

      ScannerState(String module, CharSequence source, int from, int end, SourceLocator locator, Object originalResult)
      Parameters:
      module - the current module name for error reporting
      source - the source string
      from - from where do we start to scan?
      end - till where do we stop scanning? (exclusive)
      locator - the locator for mapping index to line and column number
      originalResult - the original result value
  • Method Details

    • peekChar

      char peekChar()
      Description copied from class: ParseContext
      Peeks the current character. Only applicable to character level parser.
      Specified by:
      peekChar in class ParseContext
    • isEof

      boolean isEof()
      Specified by:
      isEof in class ParseContext
    • toIndex

      int toIndex(int pos)
      Description copied from class: ParseContext
      Translates the logical position to physical index in the original source.
      Specified by:
      toIndex in class ParseContext
    • getInputName

      String getInputName(int pos)
      Description copied from class: ParseContext
      Returns the string representation of the current input (character or token).
      Specified by:
      getInputName in class ParseContext
    • characters

      CharSequence characters()
      Description copied from class: ParseContext
      Reads the characters as input. Only applicable to character level parsers.
      Specified by:
      characters in class ParseContext
    • getToken

      Token getToken()
      Description copied from class: ParseContext
      Returns the current token. Only applicable to token level parser.
      Specified by:
      getToken in class ParseContext
    • run

      final <T> T run(Parser<T> parser)
    • applyWithExceptionWrapped

      private boolean applyWithExceptionWrapped(Parser<?> parser)