]> git.lyx.org Git - features.git/blob - src/3rdparty/hunspell/1.3.3/src/parsers/htmlparser.cxx
add stripped down hunspell 1.3.3
[features.git] / src / 3rdparty / hunspell / 1.3.3 / src / parsers / htmlparser.cxx
1 #include <cstdlib>
2 #include <cstring>
3 #include <cstdio>
4 #include <ctype.h>
5
6 #include "../hunspell/csutil.hxx"
7 #include "htmlparser.hxx"
8
9
10 #ifndef W32
11 using namespace std;
12 #endif
13
14 static const char * PATTERN[][2] = {
15         { "<script", "</script>" },
16         { "<style", "</style>" },
17         { "<code", "</code>" },
18         { "<samp", "</samp>" },
19         { "<kbd", "</kbd>" },
20         { "<var", "</var>" },
21         { "<listing", "</listing>" },
22         { "<address", "</address>" },
23         { "<pre", "</pre>" },
24         { "<!--", "-->" },
25         { "<[cdata[", "]]>" }, // XML comment
26         { "<", ">" }
27 };
28
29 #define PATTERN_LEN (sizeof(PATTERN) / (sizeof(char *) * 2))
30
31 static const char * PATTERN2[][2] = {
32         { "<img", "alt=" }, // ALT and TITLE attrib handled spec.
33         { "<img", "title=" },
34         { "<a ", "title=" }
35 };
36
37 #define PATTERN_LEN2 (sizeof(PATTERN2) / (sizeof(char *) * 2))
38
39 HTMLParser::HTMLParser(const char * wordchars)
40 {
41         init(wordchars);
42 }
43
44 HTMLParser::HTMLParser(unsigned short * wordchars, int len)
45 {
46         init(wordchars, len);
47 }
48
49 char * HTMLParser::next_token()
50 {
51         return XMLParser::next_token(PATTERN, PATTERN_LEN, PATTERN2, PATTERN_LEN2);
52 }
53
54 HTMLParser::~HTMLParser() 
55 {
56 }