Package org.jparsec
Class ScannerState
- java.lang.Object
-
- org.jparsec.ParseContext
-
- org.jparsec.ScannerState
-
final class ScannerState extends ParseContext
Parser state for scanner.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.jparsec.ParseContext
ParseContext.ErrorType, ParseContext.ParserTrace
-
-
Constructor Summary
Constructors Constructor Description ScannerState(java.lang.CharSequence source)
ScannerState(java.lang.String module, java.lang.CharSequence source, int from, int end, SourceLocator locator, java.lang.Object originalResult)
ScannerState(java.lang.String module, java.lang.CharSequence source, int from, SourceLocator locator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
applyWithExceptionWrapped(Parser<?> parser)
(package private) java.lang.CharSequence
characters()
Reads the characters as input.(package private) java.lang.String
getInputName(int pos)
Returns the string representation of the current input (character or token).(package private) Token
getToken()
Returns the current token.(package private) boolean
isEof()
(package private) char
peekChar()
Peeks the current character.(package private) <T> T
run(Parser<T> parser)
(package private) int
toIndex(int pos)
Translates the logical position to physical index in the original source.-
Methods inherited from class org.jparsec.ParseContext
applyAsDelimiter, applyNested, applyNewNode, buildErrorParseTree, buildParseTree, enableTrace, errorIndex, expected, fail, getIndex, getTrace, missing, next, next, raise, renderError, repeat, repeat, set, setAt, stillThere, toString, unexpected, withErrorSuppressed
-
-
-
-
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 reportingsource
- the source stringfrom
- 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 numberoriginalResult
- 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 classParseContext
-
isEof
boolean isEof()
- Specified by:
isEof
in classParseContext
-
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 classParseContext
-
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 classParseContext
-
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 classParseContext
-
getToken
Token getToken()
Description copied from class:ParseContext
Returns the current token. Only applicable to token level parser.- Specified by:
getToken
in classParseContext
-
run
final <T> T run(Parser<T> parser)
-
applyWithExceptionWrapped
private boolean applyWithExceptionWrapped(Parser<?> parser)
-
-