Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / hunspell / src / parsers / firstparser.cxx
blob786ecea2eeb5da6f619a55d3b55671cecbfb929b
1 #include <cstdlib>
2 #include <cstring>
3 #include <cstdio>
4 #include <ctype.h>
6 #include "../hunspell/csutil.hxx"
7 #include "firstparser.hxx"
9 #ifndef W32
10 using namespace std;
11 #endif
13 FirstParser::FirstParser(const char * wordchars)
15 init(wordchars);
18 FirstParser::~FirstParser()
22 char * FirstParser::next_token()
24 char * tabpos = strchr(line[actual],'\t');
25 if ((tabpos) && (tabpos - line[actual]>token)) {
26 char * t = (char *) malloc(tabpos - line[actual] + 1);
27 t[tabpos - line[actual]] = '\0';
28 token = tabpos - line[actual] +1;
29 if (t) return strncpy(t, line[actual], tabpos - line[actual]);
30 fprintf(stderr,"Error - Insufficient Memory\n");
32 return NULL;