Update mojo sdk to rev 1dc8a9a5db73d3718d99917fadf31f5fb2ebad4f
[chromium-blink-merge.git] / third_party / hunspell / src / parsers / testparser.cxx
blob0774ee9f592b922bc712c712f53c3976b5b4ad72
1 #include <cstring>
2 #include <cstdlib>
3 #include <cstdio>
5 #include "textparser.hxx"
6 #include "htmlparser.hxx"
7 #include "latexparser.hxx"
9 #ifndef W32
10 using namespace std;
11 #endif
13 int
14 main(int argc, char** argv)
16 FILE * f;
17 /* first parse the command line options */
19 if (argc < 2) {
20 fprintf(stderr,"correct syntax is:\n");
21 fprintf(stderr,"testparser file\n");
22 fprintf(stderr,"example: testparser /dev/stdin\n");
23 exit(1);
26 /* open the words to check list */
27 f = fopen(argv[1],"r");
28 if (!f) {
29 fprintf(stderr,"Error - could not open file of words to check\n");
30 exit(1);
33 TextParser * p = new LaTeXParser("qwertzuiopasdfghjklyxcvbnméáúõûóüöíQWERTZUIOPASDFGHJKLYXCVBNMÍÉÁÕÚÖÜÓÛ");
35 char buf[MAXLNLEN];
36 char * next;
38 while(fgets(buf,MAXLNLEN,f)) {
39 fprintf(stdout,"---------------------------------------\n");
40 p->put_line(buf);
41 fprintf(stderr, "x:%s\n", buf);
42 p->set_url_checking(1);
43 while ((next=p->next_token())) {
44 fprintf(stdout,"token: %s\n",next);
45 free(next);
49 delete p;
50 fclose(f);
51 return 0;