nokogiri 1.5.10 → 1.13.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of nokogiri might be problematic. Click here for more details.

Files changed (334) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +5 -0
  3. data/LICENSE-DEPENDENCIES.md +1903 -0
  4. data/LICENSE.md +9 -0
  5. data/README.md +280 -0
  6. data/bin/nokogiri +84 -31
  7. data/dependencies.yml +73 -0
  8. data/ext/nokogiri/depend +38 -358
  9. data/ext/nokogiri/extconf.rb +956 -100
  10. data/ext/nokogiri/gumbo.c +584 -0
  11. data/ext/nokogiri/html4_document.c +166 -0
  12. data/ext/nokogiri/html4_element_description.c +294 -0
  13. data/ext/nokogiri/html4_entity_lookup.c +37 -0
  14. data/ext/nokogiri/html4_sax_parser_context.c +120 -0
  15. data/ext/nokogiri/html4_sax_push_parser.c +95 -0
  16. data/ext/nokogiri/libxml2_backwards_compat.c +121 -0
  17. data/ext/nokogiri/nokogiri.c +232 -87
  18. data/ext/nokogiri/nokogiri.h +188 -129
  19. data/ext/nokogiri/test_global_handlers.c +40 -0
  20. data/ext/nokogiri/xml_attr.c +49 -40
  21. data/ext/nokogiri/xml_attribute_decl.c +18 -18
  22. data/ext/nokogiri/xml_cdata.c +24 -23
  23. data/ext/nokogiri/xml_comment.c +29 -21
  24. data/ext/nokogiri/xml_document.c +327 -223
  25. data/ext/nokogiri/xml_document_fragment.c +12 -16
  26. data/ext/nokogiri/xml_dtd.c +56 -50
  27. data/ext/nokogiri/xml_element_content.c +31 -26
  28. data/ext/nokogiri/xml_element_decl.c +22 -22
  29. data/ext/nokogiri/xml_encoding_handler.c +45 -20
  30. data/ext/nokogiri/xml_entity_decl.c +32 -30
  31. data/ext/nokogiri/xml_entity_reference.c +16 -18
  32. data/ext/nokogiri/xml_namespace.c +74 -32
  33. data/ext/nokogiri/xml_node.c +1290 -680
  34. data/ext/nokogiri/xml_node_set.c +239 -208
  35. data/ext/nokogiri/xml_processing_instruction.c +17 -19
  36. data/ext/nokogiri/xml_reader.c +227 -189
  37. data/ext/nokogiri/xml_relax_ng.c +52 -28
  38. data/ext/nokogiri/xml_sax_parser.c +123 -125
  39. data/ext/nokogiri/xml_sax_parser_context.c +138 -79
  40. data/ext/nokogiri/xml_sax_push_parser.c +88 -35
  41. data/ext/nokogiri/xml_schema.c +112 -33
  42. data/ext/nokogiri/xml_syntax_error.c +50 -23
  43. data/ext/nokogiri/xml_text.c +14 -18
  44. data/ext/nokogiri/xml_xpath_context.c +227 -140
  45. data/ext/nokogiri/xslt_stylesheet.c +162 -168
  46. data/gumbo-parser/CHANGES.md +63 -0
  47. data/gumbo-parser/Makefile +101 -0
  48. data/gumbo-parser/THANKS +27 -0
  49. data/gumbo-parser/src/Makefile +34 -0
  50. data/gumbo-parser/src/README.md +41 -0
  51. data/gumbo-parser/src/ascii.c +75 -0
  52. data/gumbo-parser/src/ascii.h +115 -0
  53. data/gumbo-parser/src/attribute.c +42 -0
  54. data/gumbo-parser/src/attribute.h +17 -0
  55. data/gumbo-parser/src/char_ref.c +22225 -0
  56. data/gumbo-parser/src/char_ref.h +29 -0
  57. data/gumbo-parser/src/char_ref.rl +2154 -0
  58. data/gumbo-parser/src/error.c +626 -0
  59. data/gumbo-parser/src/error.h +148 -0
  60. data/gumbo-parser/src/foreign_attrs.c +104 -0
  61. data/gumbo-parser/src/foreign_attrs.gperf +27 -0
  62. data/gumbo-parser/src/gumbo.h +943 -0
  63. data/gumbo-parser/src/insertion_mode.h +33 -0
  64. data/gumbo-parser/src/macros.h +91 -0
  65. data/gumbo-parser/src/parser.c +4875 -0
  66. data/gumbo-parser/src/parser.h +41 -0
  67. data/gumbo-parser/src/replacement.h +33 -0
  68. data/gumbo-parser/src/string_buffer.c +103 -0
  69. data/gumbo-parser/src/string_buffer.h +68 -0
  70. data/gumbo-parser/src/string_piece.c +48 -0
  71. data/gumbo-parser/src/svg_attrs.c +174 -0
  72. data/gumbo-parser/src/svg_attrs.gperf +77 -0
  73. data/gumbo-parser/src/svg_tags.c +137 -0
  74. data/gumbo-parser/src/svg_tags.gperf +55 -0
  75. data/gumbo-parser/src/tag.c +222 -0
  76. data/gumbo-parser/src/tag_lookup.c +382 -0
  77. data/gumbo-parser/src/tag_lookup.gperf +169 -0
  78. data/gumbo-parser/src/tag_lookup.h +13 -0
  79. data/gumbo-parser/src/token_buffer.c +79 -0
  80. data/gumbo-parser/src/token_buffer.h +71 -0
  81. data/gumbo-parser/src/token_type.h +17 -0
  82. data/gumbo-parser/src/tokenizer.c +3463 -0
  83. data/gumbo-parser/src/tokenizer.h +112 -0
  84. data/gumbo-parser/src/tokenizer_states.h +339 -0
  85. data/gumbo-parser/src/utf8.c +245 -0
  86. data/gumbo-parser/src/utf8.h +164 -0
  87. data/gumbo-parser/src/util.c +68 -0
  88. data/gumbo-parser/src/util.h +30 -0
  89. data/gumbo-parser/src/vector.c +111 -0
  90. data/gumbo-parser/src/vector.h +45 -0
  91. data/lib/nokogiri/class_resolver.rb +67 -0
  92. data/lib/nokogiri/css/node.rb +10 -58
  93. data/lib/nokogiri/css/parser.rb +327 -288
  94. data/lib/nokogiri/css/parser.y +67 -45
  95. data/lib/nokogiri/css/parser_extras.rb +52 -49
  96. data/lib/nokogiri/css/syntax_error.rb +3 -1
  97. data/lib/nokogiri/css/tokenizer.rb +107 -104
  98. data/lib/nokogiri/css/tokenizer.rex +7 -6
  99. data/lib/nokogiri/css/xpath_visitor.rb +263 -75
  100. data/lib/nokogiri/css.rb +50 -17
  101. data/lib/nokogiri/decorators/slop.rb +17 -8
  102. data/lib/nokogiri/extension.rb +31 -0
  103. data/lib/nokogiri/gumbo.rb +15 -0
  104. data/lib/nokogiri/html.rb +38 -27
  105. data/lib/nokogiri/{html → html4}/builder.rb +4 -2
  106. data/lib/nokogiri/html4/document.rb +331 -0
  107. data/lib/nokogiri/html4/document_fragment.rb +54 -0
  108. data/lib/nokogiri/{html → html4}/element_description.rb +3 -1
  109. data/lib/nokogiri/html4/element_description_defaults.rb +578 -0
  110. data/lib/nokogiri/{html → html4}/entity_lookup.rb +4 -2
  111. data/lib/nokogiri/{html → html4}/sax/parser.rb +24 -15
  112. data/lib/nokogiri/html4/sax/parser_context.rb +20 -0
  113. data/lib/nokogiri/html4/sax/push_parser.rb +37 -0
  114. data/lib/nokogiri/html4.rb +46 -0
  115. data/lib/nokogiri/html5/document.rb +88 -0
  116. data/lib/nokogiri/html5/document_fragment.rb +83 -0
  117. data/lib/nokogiri/html5/node.rb +96 -0
  118. data/lib/nokogiri/html5.rb +477 -0
  119. data/lib/nokogiri/jruby/dependencies.rb +21 -0
  120. data/lib/nokogiri/syntax_error.rb +2 -0
  121. data/lib/nokogiri/version/constant.rb +6 -0
  122. data/lib/nokogiri/version/info.rb +221 -0
  123. data/lib/nokogiri/version.rb +3 -90
  124. data/lib/nokogiri/xml/attr.rb +6 -3
  125. data/lib/nokogiri/xml/attribute_decl.rb +3 -1
  126. data/lib/nokogiri/xml/builder.rb +96 -54
  127. data/lib/nokogiri/xml/cdata.rb +3 -1
  128. data/lib/nokogiri/xml/character_data.rb +2 -0
  129. data/lib/nokogiri/xml/document.rb +234 -95
  130. data/lib/nokogiri/xml/document_fragment.rb +86 -36
  131. data/lib/nokogiri/xml/dtd.rb +16 -4
  132. data/lib/nokogiri/xml/element_content.rb +2 -0
  133. data/lib/nokogiri/xml/element_decl.rb +3 -1
  134. data/lib/nokogiri/xml/entity_decl.rb +4 -2
  135. data/lib/nokogiri/xml/entity_reference.rb +20 -0
  136. data/lib/nokogiri/xml/namespace.rb +3 -0
  137. data/lib/nokogiri/xml/node/save_options.rb +8 -4
  138. data/lib/nokogiri/xml/node.rb +947 -502
  139. data/lib/nokogiri/xml/node_set.rb +168 -159
  140. data/lib/nokogiri/xml/notation.rb +13 -0
  141. data/lib/nokogiri/xml/parse_options.rb +40 -5
  142. data/lib/nokogiri/xml/pp/character_data.rb +9 -6
  143. data/lib/nokogiri/xml/pp/node.rb +25 -26
  144. data/lib/nokogiri/xml/pp.rb +4 -2
  145. data/lib/nokogiri/xml/processing_instruction.rb +3 -1
  146. data/lib/nokogiri/xml/reader.rb +23 -28
  147. data/lib/nokogiri/xml/relax_ng.rb +8 -2
  148. data/lib/nokogiri/xml/sax/document.rb +45 -49
  149. data/lib/nokogiri/xml/sax/parser.rb +43 -41
  150. data/lib/nokogiri/xml/sax/parser_context.rb +8 -3
  151. data/lib/nokogiri/xml/sax/push_parser.rb +6 -5
  152. data/lib/nokogiri/xml/sax.rb +6 -4
  153. data/lib/nokogiri/xml/schema.rb +19 -9
  154. data/lib/nokogiri/xml/searchable.rb +259 -0
  155. data/lib/nokogiri/xml/syntax_error.rb +25 -1
  156. data/lib/nokogiri/xml/text.rb +2 -0
  157. data/lib/nokogiri/xml/xpath/syntax_error.rb +4 -2
  158. data/lib/nokogiri/xml/xpath.rb +15 -4
  159. data/lib/nokogiri/xml/xpath_context.rb +3 -3
  160. data/lib/nokogiri/xml.rb +38 -36
  161. data/lib/nokogiri/xslt/stylesheet.rb +3 -1
  162. data/lib/nokogiri/xslt.rb +18 -16
  163. data/lib/nokogiri.rb +69 -69
  164. data/lib/xsd/xmlparser/nokogiri.rb +26 -24
  165. data/patches/libxml2/0001-Remove-script-macro-support.patch +40 -0
  166. data/patches/libxml2/0002-Update-entities-to-remove-handling-of-ssi.patch +44 -0
  167. data/patches/libxml2/0003-libxml2.la-is-in-top_builddir.patch +25 -0
  168. data/patches/libxml2/0004-use-glibc-strlen.patch +53 -0
  169. data/patches/libxml2/0005-avoid-isnan-isinf.patch +81 -0
  170. data/patches/libxml2/0006-update-automake-files-for-arm64.patch +2511 -0
  171. data/patches/libxml2/0007-Fix-XPath-recursion-limit.patch +31 -0
  172. data/patches/libxml2/0008-htmlParseComment-handle-abruptly-closed-comments.patch +61 -0
  173. data/patches/libxml2/0009-allow-wildcard-namespaces.patch +77 -0
  174. data/patches/libxslt/0001-update-automake-files-for-arm64.patch +2511 -0
  175. data/patches/libxslt/0002-Fix-xml2-config-check-in-configure-script.patch +19 -0
  176. data/ports/archives/libxml2-2.9.12.tar.gz +0 -0
  177. data/ports/archives/libxslt-1.1.34.tar.gz +0 -0
  178. metadata +382 -460
  179. data/.autotest +0 -26
  180. data/.gemtest +0 -0
  181. data/CHANGELOG.ja.rdoc +0 -785
  182. data/CHANGELOG.rdoc +0 -783
  183. data/C_CODING_STYLE.rdoc +0 -33
  184. data/Manifest.txt +0 -303
  185. data/README.ja.rdoc +0 -106
  186. data/README.rdoc +0 -175
  187. data/ROADMAP.md +0 -90
  188. data/Rakefile +0 -228
  189. data/STANDARD_RESPONSES.md +0 -47
  190. data/Y_U_NO_GEMSPEC.md +0 -155
  191. data/build_all +0 -105
  192. data/ext/nokogiri/html_document.c +0 -170
  193. data/ext/nokogiri/html_document.h +0 -10
  194. data/ext/nokogiri/html_element_description.c +0 -279
  195. data/ext/nokogiri/html_element_description.h +0 -10
  196. data/ext/nokogiri/html_entity_lookup.c +0 -32
  197. data/ext/nokogiri/html_entity_lookup.h +0 -8
  198. data/ext/nokogiri/html_sax_parser_context.c +0 -116
  199. data/ext/nokogiri/html_sax_parser_context.h +0 -11
  200. data/ext/nokogiri/html_sax_push_parser.c +0 -87
  201. data/ext/nokogiri/html_sax_push_parser.h +0 -9
  202. data/ext/nokogiri/xml_attr.h +0 -9
  203. data/ext/nokogiri/xml_attribute_decl.h +0 -9
  204. data/ext/nokogiri/xml_cdata.h +0 -9
  205. data/ext/nokogiri/xml_comment.h +0 -9
  206. data/ext/nokogiri/xml_document.h +0 -23
  207. data/ext/nokogiri/xml_document_fragment.h +0 -10
  208. data/ext/nokogiri/xml_dtd.h +0 -10
  209. data/ext/nokogiri/xml_element_content.h +0 -10
  210. data/ext/nokogiri/xml_element_decl.h +0 -9
  211. data/ext/nokogiri/xml_encoding_handler.h +0 -8
  212. data/ext/nokogiri/xml_entity_decl.h +0 -10
  213. data/ext/nokogiri/xml_entity_reference.h +0 -9
  214. data/ext/nokogiri/xml_io.c +0 -56
  215. data/ext/nokogiri/xml_io.h +0 -11
  216. data/ext/nokogiri/xml_libxml2_hacks.c +0 -112
  217. data/ext/nokogiri/xml_libxml2_hacks.h +0 -12
  218. data/ext/nokogiri/xml_namespace.h +0 -13
  219. data/ext/nokogiri/xml_node.h +0 -13
  220. data/ext/nokogiri/xml_node_set.h +0 -14
  221. data/ext/nokogiri/xml_processing_instruction.h +0 -9
  222. data/ext/nokogiri/xml_reader.h +0 -10
  223. data/ext/nokogiri/xml_relax_ng.h +0 -9
  224. data/ext/nokogiri/xml_sax_parser.h +0 -39
  225. data/ext/nokogiri/xml_sax_parser_context.h +0 -10
  226. data/ext/nokogiri/xml_sax_push_parser.h +0 -9
  227. data/ext/nokogiri/xml_schema.h +0 -9
  228. data/ext/nokogiri/xml_syntax_error.h +0 -13
  229. data/ext/nokogiri/xml_text.h +0 -9
  230. data/ext/nokogiri/xml_xpath_context.h +0 -10
  231. data/ext/nokogiri/xslt_stylesheet.h +0 -14
  232. data/lib/nokogiri/html/document.rb +0 -254
  233. data/lib/nokogiri/html/document_fragment.rb +0 -41
  234. data/lib/nokogiri/html/element_description_defaults.rb +0 -671
  235. data/lib/nokogiri/html/sax/parser_context.rb +0 -16
  236. data/lib/nokogiri/html/sax/push_parser.rb +0 -16
  237. data/tasks/cross_compile.rb +0 -150
  238. data/tasks/nokogiri.org.rb +0 -24
  239. data/tasks/test.rb +0 -95
  240. data/test/css/test_nthiness.rb +0 -159
  241. data/test/css/test_parser.rb +0 -341
  242. data/test/css/test_tokenizer.rb +0 -198
  243. data/test/css/test_xpath_visitor.rb +0 -91
  244. data/test/decorators/test_slop.rb +0 -16
  245. data/test/files/2ch.html +0 -108
  246. data/test/files/address_book.rlx +0 -12
  247. data/test/files/address_book.xml +0 -10
  248. data/test/files/bar/bar.xsd +0 -4
  249. data/test/files/dont_hurt_em_why.xml +0 -422
  250. data/test/files/encoding.html +0 -82
  251. data/test/files/encoding.xhtml +0 -84
  252. data/test/files/exslt.xml +0 -8
  253. data/test/files/exslt.xslt +0 -35
  254. data/test/files/foo/foo.xsd +0 -4
  255. data/test/files/metacharset.html +0 -10
  256. data/test/files/noencoding.html +0 -47
  257. data/test/files/po.xml +0 -32
  258. data/test/files/po.xsd +0 -66
  259. data/test/files/shift_jis.html +0 -10
  260. data/test/files/shift_jis.xml +0 -5
  261. data/test/files/snuggles.xml +0 -3
  262. data/test/files/staff.dtd +0 -10
  263. data/test/files/staff.xml +0 -59
  264. data/test/files/staff.xslt +0 -32
  265. data/test/files/test_document_url/bar.xml +0 -2
  266. data/test/files/test_document_url/document.dtd +0 -4
  267. data/test/files/test_document_url/document.xml +0 -6
  268. data/test/files/tlm.html +0 -850
  269. data/test/files/to_be_xincluded.xml +0 -2
  270. data/test/files/valid_bar.xml +0 -2
  271. data/test/files/xinclude.xml +0 -4
  272. data/test/helper.rb +0 -154
  273. data/test/html/sax/test_parser.rb +0 -141
  274. data/test/html/sax/test_parser_context.rb +0 -46
  275. data/test/html/test_builder.rb +0 -164
  276. data/test/html/test_document.rb +0 -552
  277. data/test/html/test_document_encoding.rb +0 -138
  278. data/test/html/test_document_fragment.rb +0 -261
  279. data/test/html/test_element_description.rb +0 -105
  280. data/test/html/test_named_characters.rb +0 -14
  281. data/test/html/test_node.rb +0 -196
  282. data/test/html/test_node_encoding.rb +0 -27
  283. data/test/namespaces/test_additional_namespaces_in_builder_doc.rb +0 -14
  284. data/test/namespaces/test_namespaces_in_builder_doc.rb +0 -75
  285. data/test/namespaces/test_namespaces_in_created_doc.rb +0 -75
  286. data/test/namespaces/test_namespaces_in_parsed_doc.rb +0 -66
  287. data/test/test_convert_xpath.rb +0 -135
  288. data/test/test_css_cache.rb +0 -45
  289. data/test/test_encoding_handler.rb +0 -46
  290. data/test/test_memory_leak.rb +0 -156
  291. data/test/test_nokogiri.rb +0 -132
  292. data/test/test_reader.rb +0 -555
  293. data/test/test_soap4r_sax.rb +0 -52
  294. data/test/test_xslt_transforms.rb +0 -254
  295. data/test/xml/node/test_save_options.rb +0 -28
  296. data/test/xml/node/test_subclass.rb +0 -44
  297. data/test/xml/sax/test_parser.rb +0 -366
  298. data/test/xml/sax/test_parser_context.rb +0 -106
  299. data/test/xml/sax/test_push_parser.rb +0 -157
  300. data/test/xml/test_attr.rb +0 -64
  301. data/test/xml/test_attribute_decl.rb +0 -86
  302. data/test/xml/test_builder.rb +0 -306
  303. data/test/xml/test_c14n.rb +0 -151
  304. data/test/xml/test_cdata.rb +0 -48
  305. data/test/xml/test_comment.rb +0 -29
  306. data/test/xml/test_document.rb +0 -828
  307. data/test/xml/test_document_encoding.rb +0 -28
  308. data/test/xml/test_document_fragment.rb +0 -223
  309. data/test/xml/test_dtd.rb +0 -103
  310. data/test/xml/test_dtd_encoding.rb +0 -33
  311. data/test/xml/test_element_content.rb +0 -56
  312. data/test/xml/test_element_decl.rb +0 -73
  313. data/test/xml/test_entity_decl.rb +0 -122
  314. data/test/xml/test_entity_reference.rb +0 -245
  315. data/test/xml/test_namespace.rb +0 -95
  316. data/test/xml/test_node.rb +0 -1137
  317. data/test/xml/test_node_attributes.rb +0 -96
  318. data/test/xml/test_node_encoding.rb +0 -107
  319. data/test/xml/test_node_inheritance.rb +0 -32
  320. data/test/xml/test_node_reparenting.rb +0 -374
  321. data/test/xml/test_node_set.rb +0 -755
  322. data/test/xml/test_parse_options.rb +0 -64
  323. data/test/xml/test_processing_instruction.rb +0 -30
  324. data/test/xml/test_reader_encoding.rb +0 -142
  325. data/test/xml/test_relax_ng.rb +0 -60
  326. data/test/xml/test_schema.rb +0 -103
  327. data/test/xml/test_syntax_error.rb +0 -12
  328. data/test/xml/test_text.rb +0 -45
  329. data/test/xml/test_unparented_node.rb +0 -422
  330. data/test/xml/test_xinclude.rb +0 -83
  331. data/test/xml/test_xpath.rb +0 -295
  332. data/test/xslt/test_custom_functions.rb +0 -133
  333. data/test/xslt/test_exception_handling.rb +0 -37
  334. data/test_all +0 -81
@@ -0,0 +1,55 @@
1
+ %{
2
+ #include "replacement.h"
3
+ #include "macros.h"
4
+ #include "ascii.h"
5
+ %}
6
+
7
+ %ignore-case
8
+ %struct-type
9
+ %omit-struct-type
10
+ %compare-lengths
11
+ %readonly-tables
12
+ %null-strings
13
+ %includes
14
+ %define lookup-function-name gumbo_get_svg_tag_replacement
15
+ %define slot-name from
16
+ %define initializer-suffix ,(char*)0
17
+ StringReplacement;
18
+
19
+ %%
20
+ "altglyph", "altGlyph"
21
+ "altglyphdef", "altGlyphDef"
22
+ "altglyphitem", "altGlyphItem"
23
+ "animatecolor", "animateColor"
24
+ "animatemotion", "animateMotion"
25
+ "animatetransform", "animateTransform"
26
+ "clippath", "clipPath"
27
+ "feblend", "feBlend"
28
+ "fecolormatrix", "feColorMatrix"
29
+ "fecomponenttransfer", "feComponentTransfer"
30
+ "fecomposite", "feComposite"
31
+ "feconvolvematrix", "feConvolveMatrix"
32
+ "fediffuselighting", "feDiffuseLighting"
33
+ "fedisplacementmap", "feDisplacementMap"
34
+ "fedistantlight", "feDistantLight"
35
+ "feflood", "feFlood"
36
+ "fefunca", "feFuncA"
37
+ "fefuncb", "feFuncB"
38
+ "fefuncg", "feFuncG"
39
+ "fefuncr", "feFuncR"
40
+ "fegaussianblur", "feGaussianBlur"
41
+ "feimage", "feImage"
42
+ "femerge", "feMerge"
43
+ "femergenode", "feMergeNode"
44
+ "femorphology", "feMorphology"
45
+ "feoffset", "feOffset"
46
+ "fepointlight", "fePointLight"
47
+ "fespecularlighting", "feSpecularLighting"
48
+ "fespotlight", "feSpotLight"
49
+ "fetile", "feTile"
50
+ "feturbulence", "feTurbulence"
51
+ "foreignobject", "foreignObject"
52
+ "glyphref", "glyphRef"
53
+ "lineargradient", "linearGradient"
54
+ "radialgradient", "radialGradient"
55
+ "textpath", "textPath"
@@ -0,0 +1,222 @@
1
+ /*
2
+ Copyright 2011 Google Inc.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ https://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
17
+ #include "gumbo.h"
18
+ #include "util.h"
19
+ #include "tag_lookup.h"
20
+
21
+ #include <assert.h>
22
+ #include <string.h>
23
+
24
+ static const char kGumboTagNames[GUMBO_TAG_LAST+1][15] = {
25
+ [GUMBO_TAG_HTML] = "html",
26
+ [GUMBO_TAG_HEAD] = "head",
27
+ [GUMBO_TAG_TITLE] = "title",
28
+ [GUMBO_TAG_BASE] = "base",
29
+ [GUMBO_TAG_LINK] = "link",
30
+ [GUMBO_TAG_META] = "meta",
31
+ [GUMBO_TAG_STYLE] = "style",
32
+ [GUMBO_TAG_SCRIPT] = "script",
33
+ [GUMBO_TAG_NOSCRIPT] = "noscript",
34
+ [GUMBO_TAG_TEMPLATE] = "template",
35
+ [GUMBO_TAG_BODY] = "body",
36
+ [GUMBO_TAG_ARTICLE] = "article",
37
+ [GUMBO_TAG_SECTION] = "section",
38
+ [GUMBO_TAG_NAV] = "nav",
39
+ [GUMBO_TAG_ASIDE] = "aside",
40
+ [GUMBO_TAG_H1] = "h1",
41
+ [GUMBO_TAG_H2] = "h2",
42
+ [GUMBO_TAG_H3] = "h3",
43
+ [GUMBO_TAG_H4] = "h4",
44
+ [GUMBO_TAG_H5] = "h5",
45
+ [GUMBO_TAG_H6] = "h6",
46
+ [GUMBO_TAG_HGROUP] = "hgroup",
47
+ [GUMBO_TAG_HEADER] = "header",
48
+ [GUMBO_TAG_FOOTER] = "footer",
49
+ [GUMBO_TAG_ADDRESS] = "address",
50
+ [GUMBO_TAG_P] = "p",
51
+ [GUMBO_TAG_HR] = "hr",
52
+ [GUMBO_TAG_PRE] = "pre",
53
+ [GUMBO_TAG_BLOCKQUOTE] = "blockquote",
54
+ [GUMBO_TAG_OL] = "ol",
55
+ [GUMBO_TAG_UL] = "ul",
56
+ [GUMBO_TAG_LI] = "li",
57
+ [GUMBO_TAG_DL] = "dl",
58
+ [GUMBO_TAG_DT] = "dt",
59
+ [GUMBO_TAG_DD] = "dd",
60
+ [GUMBO_TAG_FIGURE] = "figure",
61
+ [GUMBO_TAG_FIGCAPTION] = "figcaption",
62
+ [GUMBO_TAG_MAIN] = "main",
63
+ [GUMBO_TAG_DIV] = "div",
64
+ [GUMBO_TAG_A] = "a",
65
+ [GUMBO_TAG_EM] = "em",
66
+ [GUMBO_TAG_STRONG] = "strong",
67
+ [GUMBO_TAG_SMALL] = "small",
68
+ [GUMBO_TAG_S] = "s",
69
+ [GUMBO_TAG_CITE] = "cite",
70
+ [GUMBO_TAG_Q] = "q",
71
+ [GUMBO_TAG_DFN] = "dfn",
72
+ [GUMBO_TAG_ABBR] = "abbr",
73
+ [GUMBO_TAG_DATA] = "data",
74
+ [GUMBO_TAG_TIME] = "time",
75
+ [GUMBO_TAG_CODE] = "code",
76
+ [GUMBO_TAG_VAR] = "var",
77
+ [GUMBO_TAG_SAMP] = "samp",
78
+ [GUMBO_TAG_KBD] = "kbd",
79
+ [GUMBO_TAG_SUB] = "sub",
80
+ [GUMBO_TAG_SUP] = "sup",
81
+ [GUMBO_TAG_I] = "i",
82
+ [GUMBO_TAG_B] = "b",
83
+ [GUMBO_TAG_U] = "u",
84
+ [GUMBO_TAG_MARK] = "mark",
85
+ [GUMBO_TAG_RUBY] = "ruby",
86
+ [GUMBO_TAG_RT] = "rt",
87
+ [GUMBO_TAG_RP] = "rp",
88
+ [GUMBO_TAG_BDI] = "bdi",
89
+ [GUMBO_TAG_BDO] = "bdo",
90
+ [GUMBO_TAG_SPAN] = "span",
91
+ [GUMBO_TAG_BR] = "br",
92
+ [GUMBO_TAG_WBR] = "wbr",
93
+ [GUMBO_TAG_INS] = "ins",
94
+ [GUMBO_TAG_DEL] = "del",
95
+ [GUMBO_TAG_IMAGE] = "image",
96
+ [GUMBO_TAG_IMG] = "img",
97
+ [GUMBO_TAG_IFRAME] = "iframe",
98
+ [GUMBO_TAG_EMBED] = "embed",
99
+ [GUMBO_TAG_OBJECT] = "object",
100
+ [GUMBO_TAG_PARAM] = "param",
101
+ [GUMBO_TAG_VIDEO] = "video",
102
+ [GUMBO_TAG_AUDIO] = "audio",
103
+ [GUMBO_TAG_SOURCE] = "source",
104
+ [GUMBO_TAG_TRACK] = "track",
105
+ [GUMBO_TAG_CANVAS] = "canvas",
106
+ [GUMBO_TAG_MAP] = "map",
107
+ [GUMBO_TAG_AREA] = "area",
108
+ [GUMBO_TAG_MATH] = "math",
109
+ [GUMBO_TAG_MI] = "mi",
110
+ [GUMBO_TAG_MO] = "mo",
111
+ [GUMBO_TAG_MN] = "mn",
112
+ [GUMBO_TAG_MS] = "ms",
113
+ [GUMBO_TAG_MTEXT] = "mtext",
114
+ [GUMBO_TAG_MGLYPH] = "mglyph",
115
+ [GUMBO_TAG_MALIGNMARK] = "malignmark",
116
+ [GUMBO_TAG_ANNOTATION_XML] = "annotation-xml",
117
+ [GUMBO_TAG_SVG] = "svg",
118
+ [GUMBO_TAG_FOREIGNOBJECT] = "foreignobject",
119
+ [GUMBO_TAG_DESC] = "desc",
120
+ [GUMBO_TAG_TABLE] = "table",
121
+ [GUMBO_TAG_CAPTION] = "caption",
122
+ [GUMBO_TAG_COLGROUP] = "colgroup",
123
+ [GUMBO_TAG_COL] = "col",
124
+ [GUMBO_TAG_TBODY] = "tbody",
125
+ [GUMBO_TAG_THEAD] = "thead",
126
+ [GUMBO_TAG_TFOOT] = "tfoot",
127
+ [GUMBO_TAG_TR] = "tr",
128
+ [GUMBO_TAG_TD] = "td",
129
+ [GUMBO_TAG_TH] = "th",
130
+ [GUMBO_TAG_FORM] = "form",
131
+ [GUMBO_TAG_FIELDSET] = "fieldset",
132
+ [GUMBO_TAG_LEGEND] = "legend",
133
+ [GUMBO_TAG_LABEL] = "label",
134
+ [GUMBO_TAG_INPUT] = "input",
135
+ [GUMBO_TAG_BUTTON] = "button",
136
+ [GUMBO_TAG_SELECT] = "select",
137
+ [GUMBO_TAG_DATALIST] = "datalist",
138
+ [GUMBO_TAG_OPTGROUP] = "optgroup",
139
+ [GUMBO_TAG_OPTION] = "option",
140
+ [GUMBO_TAG_TEXTAREA] = "textarea",
141
+ [GUMBO_TAG_KEYGEN] = "keygen",
142
+ [GUMBO_TAG_OUTPUT] = "output",
143
+ [GUMBO_TAG_PROGRESS] = "progress",
144
+ [GUMBO_TAG_METER] = "meter",
145
+ [GUMBO_TAG_DETAILS] = "details",
146
+ [GUMBO_TAG_SUMMARY] = "summary",
147
+ [GUMBO_TAG_MENU] = "menu",
148
+ [GUMBO_TAG_MENUITEM] = "menuitem",
149
+ [GUMBO_TAG_APPLET] = "applet",
150
+ [GUMBO_TAG_ACRONYM] = "acronym",
151
+ [GUMBO_TAG_BGSOUND] = "bgsound",
152
+ [GUMBO_TAG_DIR] = "dir",
153
+ [GUMBO_TAG_FRAME] = "frame",
154
+ [GUMBO_TAG_FRAMESET] = "frameset",
155
+ [GUMBO_TAG_NOFRAMES] = "noframes",
156
+ [GUMBO_TAG_LISTING] = "listing",
157
+ [GUMBO_TAG_XMP] = "xmp",
158
+ [GUMBO_TAG_NEXTID] = "nextid",
159
+ [GUMBO_TAG_NOEMBED] = "noembed",
160
+ [GUMBO_TAG_PLAINTEXT] = "plaintext",
161
+ [GUMBO_TAG_RB] = "rb",
162
+ [GUMBO_TAG_STRIKE] = "strike",
163
+ [GUMBO_TAG_BASEFONT] = "basefont",
164
+ [GUMBO_TAG_BIG] = "big",
165
+ [GUMBO_TAG_BLINK] = "blink",
166
+ [GUMBO_TAG_CENTER] = "center",
167
+ [GUMBO_TAG_FONT] = "font",
168
+ [GUMBO_TAG_MARQUEE] = "marquee",
169
+ [GUMBO_TAG_MULTICOL] = "multicol",
170
+ [GUMBO_TAG_NOBR] = "nobr",
171
+ [GUMBO_TAG_SPACER] = "spacer",
172
+ [GUMBO_TAG_TT] = "tt",
173
+ [GUMBO_TAG_RTC] = "rtc",
174
+ [GUMBO_TAG_DIALOG] = "dialog",
175
+
176
+ [GUMBO_TAG_UNKNOWN] = "",
177
+ [GUMBO_TAG_LAST] = "",
178
+ };
179
+
180
+ const char* gumbo_normalized_tagname(GumboTag tag) {
181
+ assert(tag <= GUMBO_TAG_LAST);
182
+ const char *tagname = kGumboTagNames[tag];
183
+ assert(tagname);
184
+ return tagname;
185
+ }
186
+
187
+ void gumbo_tag_from_original_text(GumboStringPiece* text) {
188
+ if (text->data == NULL) {
189
+ return;
190
+ }
191
+
192
+ assert(text->length >= 2);
193
+ assert(text->data[0] == '<');
194
+ assert(text->data[text->length - 1] == '>');
195
+
196
+ if (text->data[1] == '/') {
197
+ // End tag
198
+ assert(text->length >= 3);
199
+ text->data += 2; // Move past </
200
+ text->length -= 3;
201
+ } else {
202
+ // Start tag
203
+ text->data += 1; // Move past <
204
+ text->length -= 2;
205
+ for (const char* c = text->data; c != text->data + text->length; ++c) {
206
+ switch (*c) {
207
+ case '\t':
208
+ case '\n':
209
+ case '\f':
210
+ case ' ':
211
+ case '/':
212
+ text->length = c - text->data;
213
+ return;
214
+ }
215
+ }
216
+ }
217
+ }
218
+
219
+ GumboTag gumbo_tagn_enum(const char *tagname, size_t tagname_length) {
220
+ const TagHashSlot *slot = gumbo_tag_lookup(tagname, tagname_length);
221
+ return slot ? slot->tag : GUMBO_TAG_UNKNOWN;
222
+ }
@@ -0,0 +1,382 @@
1
+ /* ANSI-C code produced by gperf version 3.1 */
2
+ /* Command-line: gperf -m100 lib/tag_lookup.gperf */
3
+ /* Computed positions: -k'1-2,$' */
4
+ /* Filtered by: mk/gperf-filter.sed */
5
+
6
+ #include "tag_lookup.h"
7
+ #include "macros.h"
8
+ #include "ascii.h"
9
+ #include <string.h>
10
+
11
+ #define TOTAL_KEYWORDS 150
12
+ #define MIN_WORD_LENGTH 1
13
+ #define MAX_WORD_LENGTH 14
14
+ #define MIN_HASH_VALUE 9
15
+ #define MAX_HASH_VALUE 271
16
+ /* maximum key range = 263, duplicates = 0 */
17
+
18
+
19
+
20
+ static inline unsigned int
21
+ hash (register const char *str, register size_t len)
22
+ {
23
+ static const unsigned short asso_values[] =
24
+ {
25
+ 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
26
+ 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
27
+ 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
28
+ 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
29
+ 272, 272, 272, 272, 272, 272, 272, 272, 272, 9,
30
+ 7, 6, 4, 4, 3, 4, 3, 3, 272, 272,
31
+ 272, 272, 272, 272, 272, 70, 83, 152, 7, 16,
32
+ 61, 98, 5, 76, 102, 126, 12, 19, 54, 54,
33
+ 31, 97, 3, 4, 9, 33, 136, 113, 86, 15,
34
+ 272, 272, 272, 272, 272, 272, 272, 70, 83, 152,
35
+ 7, 16, 61, 98, 5, 76, 102, 126, 12, 19,
36
+ 54, 54, 31, 97, 3, 4, 9, 33, 136, 113,
37
+ 86, 15, 272, 272, 272, 272, 272, 272, 272, 272,
38
+ 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
39
+ 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
40
+ 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
41
+ 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
42
+ 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
43
+ 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
44
+ 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
45
+ 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
46
+ 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
47
+ 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
48
+ 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
49
+ 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
50
+ 272, 272, 272, 272, 272, 272, 272, 272, 272
51
+ };
52
+ register unsigned int hval = len;
53
+
54
+ switch (hval)
55
+ {
56
+ default:
57
+ hval += asso_values[(unsigned char)str[1]+3];
58
+ /*FALLTHROUGH*/
59
+ case 1:
60
+ hval += asso_values[(unsigned char)str[0]];
61
+ break;
62
+ }
63
+ return hval + asso_values[(unsigned char)str[len - 1]];
64
+ }
65
+
66
+ const TagHashSlot *
67
+ gumbo_tag_lookup (register const char *str, register size_t len)
68
+ {
69
+ static const unsigned char lengthtable[] =
70
+ {
71
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2,
72
+ 2, 2, 2, 6, 2, 6, 2, 4, 0, 7, 6, 3, 0, 3,
73
+ 0, 6, 6, 8, 5, 0, 0, 4, 5, 5, 8, 0, 2, 4,
74
+ 5, 2, 0, 5, 4, 2, 0, 7, 0, 8, 5, 0, 0, 0,
75
+ 0, 0, 0, 5, 3, 4, 5, 1, 4, 0, 4, 1, 2, 8,
76
+ 7, 7, 6, 6, 8, 2, 8, 4, 2, 0, 6, 0, 0, 3,
77
+ 4, 6, 13, 4, 4, 6, 8, 0, 8, 4, 0, 6, 0, 8,
78
+ 4, 5, 0, 2, 2, 9, 2, 4, 0, 8, 4, 2, 4, 8,
79
+ 7, 0, 2, 5, 2, 0, 6, 0, 3, 2, 2, 6, 3, 8,
80
+ 7, 2, 5, 7, 0, 2, 6, 2, 4, 3, 0, 10, 5, 6,
81
+ 3, 1, 2, 0, 6, 0, 5, 5, 0, 3, 0, 3, 3, 1,
82
+ 4, 6, 4, 7, 3, 0, 0, 2, 10, 10, 0, 0, 6, 1,
83
+ 4, 6, 3, 0, 2, 5, 6, 4, 3, 4, 0, 7, 3, 0,
84
+ 0, 0, 4, 0, 0, 5, 0, 0, 0, 6, 0, 14, 8, 1,
85
+ 3, 0, 0, 7, 3, 0, 0, 0, 0, 0, 0, 5, 3, 0,
86
+ 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 7, 6, 0, 0,
87
+ 0, 0, 0, 5, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0,
88
+ 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
89
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
90
+ 0, 0, 5, 0, 0, 3
91
+ };
92
+ static const TagHashSlot wordlist[] =
93
+ {
94
+ {(char*)0,GUMBO_TAG_UNKNOWN},
95
+ {(char*)0,GUMBO_TAG_UNKNOWN},
96
+ {(char*)0,GUMBO_TAG_UNKNOWN},
97
+ {(char*)0,GUMBO_TAG_UNKNOWN},
98
+ {(char*)0,GUMBO_TAG_UNKNOWN},
99
+ {(char*)0,GUMBO_TAG_UNKNOWN},
100
+ {(char*)0,GUMBO_TAG_UNKNOWN},
101
+ {(char*)0,GUMBO_TAG_UNKNOWN},
102
+ {(char*)0,GUMBO_TAG_UNKNOWN},
103
+ {"s", GUMBO_TAG_S},
104
+ {(char*)0,GUMBO_TAG_UNKNOWN},
105
+ {(char*)0,GUMBO_TAG_UNKNOWN},
106
+ {(char*)0,GUMBO_TAG_UNKNOWN},
107
+ {"h6", GUMBO_TAG_H6},
108
+ {"h5", GUMBO_TAG_H5},
109
+ {"h4", GUMBO_TAG_H4},
110
+ {"h3", GUMBO_TAG_H3},
111
+ {"spacer", GUMBO_TAG_SPACER},
112
+ {"h2", GUMBO_TAG_H2},
113
+ {"header", GUMBO_TAG_HEADER},
114
+ {"h1", GUMBO_TAG_H1},
115
+ {"head", GUMBO_TAG_HEAD},
116
+ {(char*)0,GUMBO_TAG_UNKNOWN},
117
+ {"details", GUMBO_TAG_DETAILS},
118
+ {"select", GUMBO_TAG_SELECT},
119
+ {"dir", GUMBO_TAG_DIR},
120
+ {(char*)0,GUMBO_TAG_UNKNOWN},
121
+ {"del", GUMBO_TAG_DEL},
122
+ {(char*)0,GUMBO_TAG_UNKNOWN},
123
+ {"source", GUMBO_TAG_SOURCE},
124
+ {"legend", GUMBO_TAG_LEGEND},
125
+ {"datalist", GUMBO_TAG_DATALIST},
126
+ {"meter", GUMBO_TAG_METER},
127
+ {(char*)0,GUMBO_TAG_UNKNOWN},
128
+ {(char*)0,GUMBO_TAG_UNKNOWN},
129
+ {"math", GUMBO_TAG_MATH},
130
+ {"label", GUMBO_TAG_LABEL},
131
+ {"table", GUMBO_TAG_TABLE},
132
+ {"template", GUMBO_TAG_TEMPLATE},
133
+ {(char*)0,GUMBO_TAG_UNKNOWN},
134
+ {"rp", GUMBO_TAG_RP},
135
+ {"time", GUMBO_TAG_TIME},
136
+ {"title", GUMBO_TAG_TITLE},
137
+ {"hr", GUMBO_TAG_HR},
138
+ {(char*)0,GUMBO_TAG_UNKNOWN},
139
+ {"tbody", GUMBO_TAG_TBODY},
140
+ {"samp", GUMBO_TAG_SAMP},
141
+ {"tr", GUMBO_TAG_TR},
142
+ {(char*)0,GUMBO_TAG_UNKNOWN},
143
+ {"marquee", GUMBO_TAG_MARQUEE},
144
+ {(char*)0,GUMBO_TAG_UNKNOWN},
145
+ {"menuitem", GUMBO_TAG_MENUITEM},
146
+ {"small", GUMBO_TAG_SMALL},
147
+ {(char*)0,GUMBO_TAG_UNKNOWN},
148
+ {(char*)0,GUMBO_TAG_UNKNOWN},
149
+ {(char*)0,GUMBO_TAG_UNKNOWN},
150
+ {(char*)0,GUMBO_TAG_UNKNOWN},
151
+ {(char*)0,GUMBO_TAG_UNKNOWN},
152
+ {(char*)0,GUMBO_TAG_UNKNOWN},
153
+ {"embed", GUMBO_TAG_EMBED},
154
+ {"map", GUMBO_TAG_MAP},
155
+ {"menu", GUMBO_TAG_MENU},
156
+ {"param", GUMBO_TAG_PARAM},
157
+ {"p", GUMBO_TAG_P},
158
+ {"nobr", GUMBO_TAG_NOBR},
159
+ {(char*)0,GUMBO_TAG_UNKNOWN},
160
+ {"span", GUMBO_TAG_SPAN},
161
+ {"u", GUMBO_TAG_U},
162
+ {"em", GUMBO_TAG_EM},
163
+ {"noframes", GUMBO_TAG_NOFRAMES},
164
+ {"section", GUMBO_TAG_SECTION},
165
+ {"noembed", GUMBO_TAG_NOEMBED},
166
+ {"nextid", GUMBO_TAG_NEXTID},
167
+ {"footer", GUMBO_TAG_FOOTER},
168
+ {"noscript", GUMBO_TAG_NOSCRIPT},
169
+ {"dl", GUMBO_TAG_DL},
170
+ {"progress", GUMBO_TAG_PROGRESS},
171
+ {"font", GUMBO_TAG_FONT},
172
+ {"mo", GUMBO_TAG_MO},
173
+ {(char*)0,GUMBO_TAG_UNKNOWN},
174
+ {"script", GUMBO_TAG_SCRIPT},
175
+ {(char*)0,GUMBO_TAG_UNKNOWN},
176
+ {(char*)0,GUMBO_TAG_UNKNOWN},
177
+ {"pre", GUMBO_TAG_PRE},
178
+ {"main", GUMBO_TAG_MAIN},
179
+ {"object", GUMBO_TAG_OBJECT},
180
+ {"foreignobject", GUMBO_TAG_FOREIGNOBJECT},
181
+ {"form", GUMBO_TAG_FORM},
182
+ {"data", GUMBO_TAG_DATA},
183
+ {"applet", GUMBO_TAG_APPLET},
184
+ {"fieldset", GUMBO_TAG_FIELDSET},
185
+ {(char*)0,GUMBO_TAG_UNKNOWN},
186
+ {"textarea", GUMBO_TAG_TEXTAREA},
187
+ {"abbr", GUMBO_TAG_ABBR},
188
+ {(char*)0,GUMBO_TAG_UNKNOWN},
189
+ {"figure", GUMBO_TAG_FIGURE},
190
+ {(char*)0,GUMBO_TAG_UNKNOWN},
191
+ {"optgroup", GUMBO_TAG_OPTGROUP},
192
+ {"meta", GUMBO_TAG_META},
193
+ {"tfoot", GUMBO_TAG_TFOOT},
194
+ {(char*)0,GUMBO_TAG_UNKNOWN},
195
+ {"ul", GUMBO_TAG_UL},
196
+ {"li", GUMBO_TAG_LI},
197
+ {"plaintext", GUMBO_TAG_PLAINTEXT},
198
+ {"rb", GUMBO_TAG_RB},
199
+ {"body", GUMBO_TAG_BODY},
200
+ {(char*)0,GUMBO_TAG_UNKNOWN},
201
+ {"basefont", GUMBO_TAG_BASEFONT},
202
+ {"ruby", GUMBO_TAG_RUBY},
203
+ {"mi", GUMBO_TAG_MI},
204
+ {"base", GUMBO_TAG_BASE},
205
+ {"frameset", GUMBO_TAG_FRAMESET},
206
+ {"summary", GUMBO_TAG_SUMMARY},
207
+ {(char*)0,GUMBO_TAG_UNKNOWN},
208
+ {"dd", GUMBO_TAG_DD},
209
+ {"frame", GUMBO_TAG_FRAME},
210
+ {"td", GUMBO_TAG_TD},
211
+ {(char*)0,GUMBO_TAG_UNKNOWN},
212
+ {"option", GUMBO_TAG_OPTION},
213
+ {(char*)0,GUMBO_TAG_UNKNOWN},
214
+ {"svg", GUMBO_TAG_SVG},
215
+ {"br", GUMBO_TAG_BR},
216
+ {"ol", GUMBO_TAG_OL},
217
+ {"dialog", GUMBO_TAG_DIALOG},
218
+ {"sup", GUMBO_TAG_SUP},
219
+ {"multicol", GUMBO_TAG_MULTICOL},
220
+ {"article", GUMBO_TAG_ARTICLE},
221
+ {"rt", GUMBO_TAG_RT},
222
+ {"image", GUMBO_TAG_IMAGE},
223
+ {"listing", GUMBO_TAG_LISTING},
224
+ {(char*)0,GUMBO_TAG_UNKNOWN},
225
+ {"dt", GUMBO_TAG_DT},
226
+ {"mglyph", GUMBO_TAG_MGLYPH},
227
+ {"tt", GUMBO_TAG_TT},
228
+ {"html", GUMBO_TAG_HTML},
229
+ {"wbr", GUMBO_TAG_WBR},
230
+ {(char*)0,GUMBO_TAG_UNKNOWN},
231
+ {"figcaption", GUMBO_TAG_FIGCAPTION},
232
+ {"style", GUMBO_TAG_STYLE},
233
+ {"strike", GUMBO_TAG_STRIKE},
234
+ {"dfn", GUMBO_TAG_DFN},
235
+ {"a", GUMBO_TAG_A},
236
+ {"th", GUMBO_TAG_TH},
237
+ {(char*)0,GUMBO_TAG_UNKNOWN},
238
+ {"hgroup", GUMBO_TAG_HGROUP},
239
+ {(char*)0,GUMBO_TAG_UNKNOWN},
240
+ {"mtext", GUMBO_TAG_MTEXT},
241
+ {"thead", GUMBO_TAG_THEAD},
242
+ {(char*)0,GUMBO_TAG_UNKNOWN},
243
+ {"var", GUMBO_TAG_VAR},
244
+ {(char*)0,GUMBO_TAG_UNKNOWN},
245
+ {"xmp", GUMBO_TAG_XMP},
246
+ {"kbd", GUMBO_TAG_KBD},
247
+ {"i", GUMBO_TAG_I},
248
+ {"link", GUMBO_TAG_LINK},
249
+ {"output", GUMBO_TAG_OUTPUT},
250
+ {"mark", GUMBO_TAG_MARK},
251
+ {"acronym", GUMBO_TAG_ACRONYM},
252
+ {"div", GUMBO_TAG_DIV},
253
+ {(char*)0,GUMBO_TAG_UNKNOWN},
254
+ {(char*)0,GUMBO_TAG_UNKNOWN},
255
+ {"ms", GUMBO_TAG_MS},
256
+ {"malignmark", GUMBO_TAG_MALIGNMARK},
257
+ {"blockquote", GUMBO_TAG_BLOCKQUOTE},
258
+ {(char*)0,GUMBO_TAG_UNKNOWN},
259
+ {(char*)0,GUMBO_TAG_UNKNOWN},
260
+ {"center", GUMBO_TAG_CENTER},
261
+ {"b", GUMBO_TAG_B},
262
+ {"desc", GUMBO_TAG_DESC},
263
+ {"canvas", GUMBO_TAG_CANVAS},
264
+ {"col", GUMBO_TAG_COL},
265
+ {(char*)0,GUMBO_TAG_UNKNOWN},
266
+ {"mn", GUMBO_TAG_MN},
267
+ {"track", GUMBO_TAG_TRACK},
268
+ {"iframe", GUMBO_TAG_IFRAME},
269
+ {"code", GUMBO_TAG_CODE},
270
+ {"sub", GUMBO_TAG_SUB},
271
+ {"area", GUMBO_TAG_AREA},
272
+ {(char*)0,GUMBO_TAG_UNKNOWN},
273
+ {"address", GUMBO_TAG_ADDRESS},
274
+ {"ins", GUMBO_TAG_INS},
275
+ {(char*)0,GUMBO_TAG_UNKNOWN},
276
+ {(char*)0,GUMBO_TAG_UNKNOWN},
277
+ {(char*)0,GUMBO_TAG_UNKNOWN},
278
+ {"cite", GUMBO_TAG_CITE},
279
+ {(char*)0,GUMBO_TAG_UNKNOWN},
280
+ {(char*)0,GUMBO_TAG_UNKNOWN},
281
+ {"input", GUMBO_TAG_INPUT},
282
+ {(char*)0,GUMBO_TAG_UNKNOWN},
283
+ {(char*)0,GUMBO_TAG_UNKNOWN},
284
+ {(char*)0,GUMBO_TAG_UNKNOWN},
285
+ {"keygen", GUMBO_TAG_KEYGEN},
286
+ {(char*)0,GUMBO_TAG_UNKNOWN},
287
+ {"annotation-xml", GUMBO_TAG_ANNOTATION_XML},
288
+ {"colgroup", GUMBO_TAG_COLGROUP},
289
+ {"q", GUMBO_TAG_Q},
290
+ {"big", GUMBO_TAG_BIG},
291
+ {(char*)0,GUMBO_TAG_UNKNOWN},
292
+ {(char*)0,GUMBO_TAG_UNKNOWN},
293
+ {"bgsound", GUMBO_TAG_BGSOUND},
294
+ {"nav", GUMBO_TAG_NAV},
295
+ {(char*)0,GUMBO_TAG_UNKNOWN},
296
+ {(char*)0,GUMBO_TAG_UNKNOWN},
297
+ {(char*)0,GUMBO_TAG_UNKNOWN},
298
+ {(char*)0,GUMBO_TAG_UNKNOWN},
299
+ {(char*)0,GUMBO_TAG_UNKNOWN},
300
+ {(char*)0,GUMBO_TAG_UNKNOWN},
301
+ {"video", GUMBO_TAG_VIDEO},
302
+ {"img", GUMBO_TAG_IMG},
303
+ {(char*)0,GUMBO_TAG_UNKNOWN},
304
+ {(char*)0,GUMBO_TAG_UNKNOWN},
305
+ {(char*)0,GUMBO_TAG_UNKNOWN},
306
+ {(char*)0,GUMBO_TAG_UNKNOWN},
307
+ {(char*)0,GUMBO_TAG_UNKNOWN},
308
+ {(char*)0,GUMBO_TAG_UNKNOWN},
309
+ {"audio", GUMBO_TAG_AUDIO},
310
+ {(char*)0,GUMBO_TAG_UNKNOWN},
311
+ {(char*)0,GUMBO_TAG_UNKNOWN},
312
+ {(char*)0,GUMBO_TAG_UNKNOWN},
313
+ {(char*)0,GUMBO_TAG_UNKNOWN},
314
+ {"caption", GUMBO_TAG_CAPTION},
315
+ {"strong", GUMBO_TAG_STRONG},
316
+ {(char*)0,GUMBO_TAG_UNKNOWN},
317
+ {(char*)0,GUMBO_TAG_UNKNOWN},
318
+ {(char*)0,GUMBO_TAG_UNKNOWN},
319
+ {(char*)0,GUMBO_TAG_UNKNOWN},
320
+ {(char*)0,GUMBO_TAG_UNKNOWN},
321
+ {"aside", GUMBO_TAG_ASIDE},
322
+ {(char*)0,GUMBO_TAG_UNKNOWN},
323
+ {"button", GUMBO_TAG_BUTTON},
324
+ {(char*)0,GUMBO_TAG_UNKNOWN},
325
+ {(char*)0,GUMBO_TAG_UNKNOWN},
326
+ {(char*)0,GUMBO_TAG_UNKNOWN},
327
+ {(char*)0,GUMBO_TAG_UNKNOWN},
328
+ {(char*)0,GUMBO_TAG_UNKNOWN},
329
+ {(char*)0,GUMBO_TAG_UNKNOWN},
330
+ {(char*)0,GUMBO_TAG_UNKNOWN},
331
+ {(char*)0,GUMBO_TAG_UNKNOWN},
332
+ {"bdo", GUMBO_TAG_BDO},
333
+ {(char*)0,GUMBO_TAG_UNKNOWN},
334
+ {(char*)0,GUMBO_TAG_UNKNOWN},
335
+ {(char*)0,GUMBO_TAG_UNKNOWN},
336
+ {(char*)0,GUMBO_TAG_UNKNOWN},
337
+ {(char*)0,GUMBO_TAG_UNKNOWN},
338
+ {(char*)0,GUMBO_TAG_UNKNOWN},
339
+ {(char*)0,GUMBO_TAG_UNKNOWN},
340
+ {(char*)0,GUMBO_TAG_UNKNOWN},
341
+ {(char*)0,GUMBO_TAG_UNKNOWN},
342
+ {(char*)0,GUMBO_TAG_UNKNOWN},
343
+ {(char*)0,GUMBO_TAG_UNKNOWN},
344
+ {(char*)0,GUMBO_TAG_UNKNOWN},
345
+ {(char*)0,GUMBO_TAG_UNKNOWN},
346
+ {(char*)0,GUMBO_TAG_UNKNOWN},
347
+ {(char*)0,GUMBO_TAG_UNKNOWN},
348
+ {(char*)0,GUMBO_TAG_UNKNOWN},
349
+ {(char*)0,GUMBO_TAG_UNKNOWN},
350
+ {(char*)0,GUMBO_TAG_UNKNOWN},
351
+ {(char*)0,GUMBO_TAG_UNKNOWN},
352
+ {(char*)0,GUMBO_TAG_UNKNOWN},
353
+ {(char*)0,GUMBO_TAG_UNKNOWN},
354
+ {"bdi", GUMBO_TAG_BDI},
355
+ {(char*)0,GUMBO_TAG_UNKNOWN},
356
+ {(char*)0,GUMBO_TAG_UNKNOWN},
357
+ {(char*)0,GUMBO_TAG_UNKNOWN},
358
+ {(char*)0,GUMBO_TAG_UNKNOWN},
359
+ {(char*)0,GUMBO_TAG_UNKNOWN},
360
+ {(char*)0,GUMBO_TAG_UNKNOWN},
361
+ {(char*)0,GUMBO_TAG_UNKNOWN},
362
+ {"blink", GUMBO_TAG_BLINK},
363
+ {(char*)0,GUMBO_TAG_UNKNOWN},
364
+ {(char*)0,GUMBO_TAG_UNKNOWN},
365
+ {"rtc", GUMBO_TAG_RTC}
366
+ };
367
+
368
+ if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
369
+ {
370
+ register unsigned int key = hash (str, len);
371
+
372
+ if (key <= MAX_HASH_VALUE)
373
+ if (len == lengthtable[key])
374
+ {
375
+ register const char *s = wordlist[key].key;
376
+
377
+ if (s && (((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gumbo_ascii_strncasecmp(str, s, len))
378
+ return &wordlist[key];
379
+ }
380
+ }
381
+ return 0;
382
+ }