35 #ifndef RERANKER_TOKENIZER_H_ 
   36 #define RERANKER_TOKENIZER_H_ 
   43 #define SPACE_CHARS " \t" 
   62   void Tokenize(
const string &s, vector<string> &toks,
 
   63                 const char *delimiters = 
" \t")
 const {
 
   66     while (begin_pos != string::npos) {
 
   67       begin_pos = s.find_first_not_of(delimiters, end_pos);
 
   68       end_pos = s.find_first_of(delimiters, begin_pos);
 
   69       if (end_pos == string::npos) {
 
   72       if (begin_pos != string::npos) {
 
   73         toks.push_back(s.substr(begin_pos, end_pos - begin_pos));
 
  102     size_t first_non_ws_idx = spec.find_first_not_of(
SPACE_CHARS);
 
  103     if (first_non_ws_idx == string::npos) {
 
  108     size_t first_paren_idx = spec.find_first_of(
"(", first_non_ws_idx + 1);
 
  109     size_t last_paren_idx = spec.find_last_of(
")");
 
  111     if (first_paren_idx == string::npos ||
 
  112         last_paren_idx == string::npos ||
 
  113         last_paren_idx < first_paren_idx) {
 
  117     class_name = spec.substr(first_non_ws_idx,
 
  118                                     first_paren_idx - first_non_ws_idx);
 
  119     size_t init_string_start_idx = first_paren_idx + 1;
 
  120     size_t init_string_len = last_paren_idx - init_string_start_idx;
 
  121     init_string = spec.substr(init_string_start_idx, init_string_len);
 
void Tokenize(const string &s, vector< string > &toks, const char *delimiters=" \t") const 
Tokenizes the specified string, depositing the results into the specified vector. ...
 
A very simple tokenizer class. 
 
bool ParseSpecString(const string &spec, string &class_name, string &init_string, bool &error)
Parses a specification string of the form "ClassName(init_string)", depositing the results into the s...