Welcome to mirror list, hosted at ThFree Co, Russian Federation.

parse_primitives.cc - github.com/moses-smt/vowpal_wabbit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 323e25d37994d2284b3ad23d62a1810a33ba8c6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
Copyright (c) 2009 Yahoo! Inc.  All rights reserved.  The copyrights
embodied in the content of this file are licensed under the BSD
(revised) open source license
 */

#include "parse_primitives.h"

void tokenize(char delim, substring s, v_array<substring>& ret)
{
  ret.erase();
  char *last = s.start;
  for (; s.start != s.end; s.start++) {
    if (*s.start == delim) {
      if (s.start != last)
	{
	  substring temp = {last,s.start};
	  push(ret, temp);
	}
      last = s.start+1;
    }
  }
  if (s.start != last)
    {
      substring final = {last, s.start};
      push(ret, final);
    }
}