java.lang.Object
io.github.darvil.lanat.utils.errors.ErrorContainerImpl<T>
io.github.darvil.lanat.parsing.ParsingStateBase<Error.ParseError>
io.github.darvil.lanat.parsing.Parser
- All Implemented Interfaces:
ErrorContainer<Error.ParseError>,Resettable
Parses the tokens that have been tokenized from the CLI input.
This class is responsible for parsing the tokens and delegating the parsing of the values to the ArgumentTypes
of the arguments that are being parsed.
getParsedArgsMap().-
Field Summary
Fields inherited from class io.github.darvil.lanat.parsing.ParsingStateBase
command, hasFinished, nestingOffset -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns the index of the current token that is being parsed.@Nullable StringReturns the forward value if one was found.Returns a hashmap of Arguments and their corresponding parsed values.voidparseTokens(@Nullable Parser previousParser) Parses the tokens that have been set.voidSets the tokens that this parser will parse.Methods inherited from class io.github.darvil.lanat.parsing.ParsingStateBase
getMatchingArgument, getMatchingArgument, getNestingOffset, hasFinished, resetState, runForMatchingArgument, runForMatchingArgumentMethods inherited from class io.github.darvil.lanat.utils.errors.ErrorContainerImpl
addError, getErrorDisplayThreshold, getErrorExitThreshold, getErrorsUnderDisplayThreshold, getErrorsUnderExitThreshold, getErrorsUnderThreshold, hasDisplayErrors, hasExitErrors, setErrorDisplayThreshold, setErrorExitThreshold
-
Constructor Details
-
Parser
-
-
Method Details
-
getCurrentTokenIndex
public int getCurrentTokenIndex()Returns the index of the current token that is being parsed. -
getForwardValue
Returns the forward value if one was found.- Returns:
- The forward value, or
nullif there is no forward value.
-
setTokens
Sets the tokens that this parser will parse. -
parseTokens
Parses the tokens that have been set. Delegates parsing of argument values to theArgumentTypeof the argument that is being parsed. -
getParsedArgsMap
Returns a hashmap of Arguments and their corresponding parsed values. This function invokes theArgument.finishParsing()method on each argument the first time it is called. After that, it will return the same hashmap.
-