Package nl.rrd.wool.parser
Class WoolCommandParser
- java.lang.Object
-
- nl.rrd.wool.parser.WoolCommandParser
-
public class WoolCommandParser extends Object
-
-
Constructor Summary
Constructors Constructor Description WoolCommandParser(List<String> validCommands, WoolNodeState nodeState)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WoolCommandparseFromName(WoolBodyToken startToken, CurrentIterator<WoolBodyToken> tokens)Parses a command from the command name.WoolCommandparseFromStart(CurrentIterator<WoolBodyToken> tokens)Parses a command from the start token.StringreadCommandName(CurrentIterator<WoolBodyToken> tokens)Reads the command name from the start of a command.
-
-
-
Constructor Detail
-
WoolCommandParser
public WoolCommandParser(List<String> validCommands, WoolNodeState nodeState)
-
-
Method Detail
-
readCommandName
public String readCommandName(CurrentIterator<WoolBodyToken> tokens) throws LineNumberParseException
Reads the command name from the start of a command. The specified iterator should be positioned at the command start token. When this method returns, it will be positioned at the token with the command name. This method does not validate the command name.- Parameters:
tokens- the tokens- Returns:
- the command name
- Throws:
LineNumberParseException- if a parsing error occurs
-
parseFromName
public WoolCommand parseFromName(WoolBodyToken startToken, CurrentIterator<WoolBodyToken> tokens) throws LineNumberParseException
Parses a command from the command name. The specified iterator should be positioned at the command name token. When this method returns it will be positioned after the command end token. This method can be called afterreadCommandName(). This method validates the command name.- Parameters:
startToken- the command start tokentokens- the tokens- Returns:
- the command
- Throws:
LineNumberParseException- if a parsing error occurs
-
parseFromStart
public WoolCommand parseFromStart(CurrentIterator<WoolBodyToken> tokens) throws LineNumberParseException
Parses a command from the start token. The specified iterator should be positioned at the command start token. When this method returns it will be positioned after the command end token. This method cannot be called afterreadCommandName(). This method validates the command name.- Parameters:
tokens- the tokens- Returns:
- the command
- Throws:
LineNumberParseException- if a parsing error occurs
-
-