Class SimpleCommandLexer

java.lang.Object
net.apartium.cocoabeans.commands.lexer.SimpleCommandLexer
All Implemented Interfaces:
CommandLexer

@AvailableSince("0.0.37") public class SimpleCommandLexer extends Object implements CommandLexer
A simple command lexer tokenize commands, and then we could use it to parse the command
See Also:
  • Constructor Details

    • SimpleCommandLexer

      public SimpleCommandLexer()
      Create a new simple command lexer with SimpleArgumentParserToken and SimpleKeywordToken
    • SimpleCommandLexer

      public SimpleCommandLexer(CommandTokenSupplier<ArgumentParserToken> argumentSupplier, CommandTokenSupplier<KeywordToken> keywordSupplier)
      Create a new simple command lexer
      Parameters:
      argumentSupplier - the argument supplier to create argument parser tokens
      keywordSupplier - the keyword supplier to create keyword tokens
  • Method Details

    • tokenize

      public List<CommandToken> tokenize(String command)
      Tokenize the command into tokens
      Specified by:
      tokenize in interface CommandLexer
      Parameters:
      command - the command to tokenize
      Returns:
      the tokens after tokenization