Package org.jparsec

Class ScannerState


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

      • end

        private final int end
    • Constructor Detail

      • ScannerState

        ScannerState​(java.lang.CharSequence source)
      • ScannerState

        ScannerState​(java.lang.String module,
                     java.lang.CharSequence source,
                     int from,
                     SourceLocator locator)
      • ScannerState

        ScannerState​(java.lang.String module,
                     java.lang.CharSequence source,
                     int from,
                     int end,
                     SourceLocator locator,
                     java.lang.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 Detail

      • peekChar

        char peekChar()
        Description copied from class: ParseContext
        Peeks the current character. Only applicable to character level parser.
        Specified by:
        peekChar 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

        java.lang.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

        java.lang.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)