]> git.lyx.org Git - features.git/blob - src/3rdparty/hunspell/1.3.3/src/parsers/testparser.cxx
add stripped down hunspell 1.3.3
[features.git] / src / 3rdparty / hunspell / 1.3.3 / src / parsers / testparser.cxx
1 #include <cstring>
2 #include <cstdlib>
3 #include <cstdio>
4
5 #include "textparser.hxx"
6 #include "htmlparser.hxx"
7 #include "latexparser.hxx"
8 #include "xmlparser.hxx"
9
10 #ifndef W32
11 using namespace std;
12 #endif
13
14 int 
15 main(int argc, char** argv)
16 {
17     FILE * f;
18   /* first parse the command line options */
19
20   if (argc < 2) {
21     fprintf(stderr,"correct syntax is:\n"); 
22     fprintf(stderr,"testparser file\n");
23     fprintf(stderr,"example: testparser /dev/stdin\n");
24     exit(1);
25   }
26
27   /* open the words to check list */
28   f = fopen(argv[1],"r");
29   if (!f) {
30     fprintf(stderr,"Error - could not open file of words to check\n");
31     exit(1);
32   }
33
34     TextParser * p = new TextParser("qwertzuiopasdfghjklyxcvbnméáúõûóüöíQWERTZUIOPASDFGHJKLYXCVBNMÍÉÁÕÚÖÜÓÛ");
35     
36     char buf[MAXLNLEN];
37     char * next;
38
39     while(fgets(buf,MAXLNLEN,f)) {
40       p->put_line(buf);
41       p->set_url_checking(1);
42       while ((next=p->next_token())) {
43           fprintf(stdout,"token: %s\n",next);
44           free(next);
45       }
46     }
47
48     delete p;
49     fclose(f);
50     return 0;
51 }
52