Class ArgumentParserToken
java.lang.Object
net.apartium.cocoabeans.commands.lexer.CommandToken
net.apartium.cocoabeans.commands.lexer.ArgumentParserToken
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
SimpleArgumentParserToken
A token that represents an argument parser.
- See Also:
-
Field Summary
Fields inherited from class net.apartium.cocoabeans.commands.lexer.CommandToken
from, text, to -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedArgumentParserToken(int from, int to, String text) Create a new argument parser token -
Method Summary
Modifier and TypeMethodDescriptionGets the parameter name of the argument parser if it has oneabstract RegisterArgumentParser<?> getParser(Map<String, ArgumentParser<?>> parsers) Gets the argument parser from the given parsers mapabstract StringGets the argument parser namegetType()Get the type of the tokenabstract booleanGets if the argument parser is optionalabstract booleanGets if the argument parser is optional but does not matchMethods inherited from class net.apartium.cocoabeans.commands.lexer.CommandToken
from, to
-
Constructor Details
-
ArgumentParserToken
Create a new argument parser token- Parameters:
from- starting indexto- ending indextext- the entire text of command
-
-
Method Details
-
getType
Get the type of the token- Specified by:
getTypein classCommandToken- Returns:
- CommandTokenType.ARGUMENT_PARSER
-
getParser
Gets the argument parser from the given parsers map- Parameters:
parsers- parser map that represents all argument parsers we have- Returns:
- the argument parser
-
getParserName
Gets the argument parser name- Returns:
- the argument parser name
-
getParameterName
Gets the parameter name of the argument parser if it has one- Returns:
- the parameter name
-
isOptional
public abstract boolean isOptional()Gets if the argument parser is optional- Returns:
- true if the argument parser is optional
-
optionalNotMatch
public abstract boolean optionalNotMatch()Gets if the argument parser is optional but does not match- Returns:
- true if the argument parser is optional but does not match
-