Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: third_party/hunspell/src/parsers/firstparser.cxx

Issue 2544793003: [spellcheck] Updated Hunspell to 1.5.4 (Closed)
Patch Set: Test Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 *
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
8 *
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
13 *
14 * The Original Code is Hunspell, based on MySpell.
15 *
16 * The Initial Developers of the Original Code are
17 * Kevin Hendricks (MySpell) and Németh László (Hunspell).
18 * Portions created by the Initial Developers are Copyright (C) 2002-2005
19 * the Initial Developers. All Rights Reserved.
20 *
21 * Contributor(s): David Einstein, Davide Prina, Giuseppe Modugno,
22 * Gianluca Turconi, Simon Brouwer, Noll János, Bíró Árpád,
23 * Goldman Eleonóra, Sarlós Tamás, Bencsáth Boldizsár, Halácsy Péter,
24 * Dvornik László, Gefferth András, Nagy Viktor, Varga Dániel, Chris Halls,
25 * Rene Engelhard, Bram Moolenaar, Dafydd Jones, Harri Pitkänen
26 *
27 * Alternatively, the contents of this file may be used under the terms of
28 * either the GNU General Public License Version 2 or later (the "GPL"), or
29 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 * in which case the provisions of the GPL or the LGPL are applicable instead
31 * of those above. If you wish to allow use of your version of this file only
32 * under the terms of either the GPL or the LGPL, and not to allow others to
33 * use your version of this file under the terms of the MPL, indicate your
34 * decision by deleting the provisions above and replace them with the notice
35 * and other provisions required by the GPL or the LGPL. If you do not delete
36 * the provisions above, a recipient may use your version of this file under
37 * the terms of any one of the MPL, the GPL or the LGPL.
38 *
39 * ***** END LICENSE BLOCK ***** */
40
1 #include <cstdlib> 41 #include <cstdlib>
2 #include <cstring> 42 #include <cstring>
3 #include <cstdio> 43 #include <cstdio>
4 #include <ctype.h> 44 #include <ctype.h>
5 45
6 #include "../hunspell/csutil.hxx" 46 #include "../hunspell/csutil.hxx"
7 #include "firstparser.hxx" 47 #include "firstparser.hxx"
8 48
9 #ifndef W32 49 #ifndef W32
10 using namespace std; 50 using namespace std;
11 #endif 51 #endif
12 52
13 FirstParser::FirstParser(const char * wordchars) 53 FirstParser::FirstParser(const char* wordchars)
14 { 54 : TextParser(wordchars) {
15 » init(wordchars);
16 } 55 }
17 56
18 FirstParser::~FirstParser() 57 FirstParser::~FirstParser() {}
19 { 58
59 bool FirstParser::next_token(std::string& t) {
60 t.clear();
61 const size_t tabpos = line[actual].find('\t');
62 if (tabpos != std::string::npos && tabpos > token) {
63 token = tabpos;
64 t = line[actual].substr(0, tabpos);
65 return true;
66 }
67 return false;
20 } 68 }
21
22 char * FirstParser::next_token()
23 {
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");
31 }
32 return NULL;
33 }
OLDNEW
« no previous file with comments | « third_party/hunspell/src/parsers/firstparser.hxx ('k') | third_party/hunspell/src/parsers/htmlparser.hxx » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698