8 #ifndef SRC_TOOLS_TOKENIZER_H_ 9 #define SRC_TOOLS_TOKENIZER_H_ 48 Tokenizer(
const std::string &raw,
const char delim);
58 Tokenizer(
const std::string &raw,
const std::string &delims);
98 void setDelims (
const std::string &delims);
106 const std::vector<Token>&
getTokens ()
const;
122 size_t indexOf (
const Token &token,
const size_t start = 0)
const;
130 void limitDelims (
const std::string &raw);
137 void tokenize (std::string raw);
139 std::vector<Token> m_tokens;
140 std::string m_delims;
Splits up a source string into Tokens based on the given delimiter(s).
Definition: Tokenizer.h:25
const std::vector< Token > & getTokens() const
Gets a reference to a vector of all of the tokens that were found in the source string.
Definition: Tokenizer.cpp:57
void setSource(const std::string &raw)
Sets the source string to tokenize and tokenizes it.
Definition: Tokenizer.cpp:47
size_t indexOf(const Token &token, const size_t start=0) const
Finds the index of the given Token in the token vector.
Definition: Tokenizer.cpp:67
Thrown when the tokenizer encounters trouble tokenizing a string.
Definition: Tokenizer.h:148
const Token & getToken(const size_t pos) const
Gets the Token at the given position in the token vector.
Definition: Tokenizer.cpp:62
Represents a single unit of a command language.
Definition: Token.h:23
Tokenizer()
Creates a Tokenizer with no initial settings.
Definition: Tokenizer.cpp:13
void setDelims(const std::string &delims)
Sets the delimiters to tokenize over.
Definition: Tokenizer.cpp:52