nokolexbor 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ext/nokolexbor/config.h +186 -0
- data/ext/nokolexbor/extconf.rb +131 -0
- data/ext/nokolexbor/libxml/HTMLparser.h +320 -0
- data/ext/nokolexbor/libxml/SAX2.h +173 -0
- data/ext/nokolexbor/libxml/chvalid.h +230 -0
- data/ext/nokolexbor/libxml/debugXML.h +217 -0
- data/ext/nokolexbor/libxml/dict.h +81 -0
- data/ext/nokolexbor/libxml/encoding.h +232 -0
- data/ext/nokolexbor/libxml/entities.h +153 -0
- data/ext/nokolexbor/libxml/globals.h +529 -0
- data/ext/nokolexbor/libxml/hash.h +236 -0
- data/ext/nokolexbor/libxml/list.h +137 -0
- data/ext/nokolexbor/libxml/parser.h +1264 -0
- data/ext/nokolexbor/libxml/parserInternals.h +641 -0
- data/ext/nokolexbor/libxml/pattern.h +100 -0
- data/ext/nokolexbor/libxml/threads.h +94 -0
- data/ext/nokolexbor/libxml/tree.h +1315 -0
- data/ext/nokolexbor/libxml/uri.h +94 -0
- data/ext/nokolexbor/libxml/valid.h +448 -0
- data/ext/nokolexbor/libxml/xmlIO.h +369 -0
- data/ext/nokolexbor/libxml/xmlautomata.h +146 -0
- data/ext/nokolexbor/libxml/xmlerror.h +919 -0
- data/ext/nokolexbor/libxml/xmlexports.h +79 -0
- data/ext/nokolexbor/libxml/xmlmemory.h +226 -0
- data/ext/nokolexbor/libxml/xmlregexp.h +222 -0
- data/ext/nokolexbor/libxml/xmlstring.h +140 -0
- data/ext/nokolexbor/libxml/xmlversion.h +526 -0
- data/ext/nokolexbor/libxml/xpath.h +575 -0
- data/ext/nokolexbor/libxml/xpathInternals.h +632 -0
- data/ext/nokolexbor/libxml/xpointer.h +137 -0
- data/ext/nokolexbor/libxml.h +76 -0
- data/ext/nokolexbor/memory.c +39 -0
- data/ext/nokolexbor/nl_document.c +51 -0
- data/ext/nokolexbor/nl_node.c +790 -0
- data/ext/nokolexbor/nl_node_set.c +368 -0
- data/ext/nokolexbor/nl_xpath_context.c +200 -0
- data/ext/nokolexbor/nokolexbor.c +63 -0
- data/ext/nokolexbor/nokolexbor.h +37 -0
- data/ext/nokolexbor/private/buf.h +70 -0
- data/ext/nokolexbor/private/dict.h +11 -0
- data/ext/nokolexbor/private/enc.h +17 -0
- data/ext/nokolexbor/private/error.h +21 -0
- data/ext/nokolexbor/private/globals.h +9 -0
- data/ext/nokolexbor/private/memory.h +9 -0
- data/ext/nokolexbor/private/parser.h +27 -0
- data/ext/nokolexbor/private/string.h +9 -0
- data/ext/nokolexbor/private/threads.h +50 -0
- data/ext/nokolexbor/private/tree.h +18 -0
- data/ext/nokolexbor/private/xpath.h +7 -0
- data/ext/nokolexbor/timsort.h +601 -0
- data/ext/nokolexbor/xml_SAX2.c +80 -0
- data/ext/nokolexbor/xml_buf.c +363 -0
- data/ext/nokolexbor/xml_chvalid.c +334 -0
- data/ext/nokolexbor/xml_dict.c +1264 -0
- data/ext/nokolexbor/xml_encoding.c +124 -0
- data/ext/nokolexbor/xml_error.c +134 -0
- data/ext/nokolexbor/xml_globals.c +1085 -0
- data/ext/nokolexbor/xml_hash.c +1141 -0
- data/ext/nokolexbor/xml_memory.c +203 -0
- data/ext/nokolexbor/xml_parser.c +127 -0
- data/ext/nokolexbor/xml_parserInternals.c +338 -0
- data/ext/nokolexbor/xml_pattern.c +2375 -0
- data/ext/nokolexbor/xml_string.c +1051 -0
- data/ext/nokolexbor/xml_threads.c +881 -0
- data/ext/nokolexbor/xml_tree.c +148 -0
- data/ext/nokolexbor/xml_xpath.c +14743 -0
- data/lib/nokolexbor/attribute.rb +18 -0
- data/lib/nokolexbor/document.rb +6 -0
- data/lib/nokolexbor/node.rb +264 -0
- data/lib/nokolexbor/node_set.rb +124 -0
- data/lib/nokolexbor/version.rb +5 -0
- data/lib/nokolexbor/xpath_context.rb +14 -0
- data/lib/nokolexbor.rb +17 -0
- data/patches/0001-lexbor-support-text-pseudo-element.patch +137 -0
- data/patches/0002-lexbor-match-id-class-case-sensitive.patch +22 -0
- data/patches/0003-lexbor-attach-template-content-to-self.patch +13 -0
- data/vendor/lexbor/CMakeLists.txt +331 -0
- data/vendor/lexbor/config.cmake +890 -0
- data/vendor/lexbor/feature.cmake +134 -0
- data/vendor/lexbor/source/lexbor/core/array.c +208 -0
- data/vendor/lexbor/source/lexbor/core/array.h +100 -0
- data/vendor/lexbor/source/lexbor/core/array_obj.c +216 -0
- data/vendor/lexbor/source/lexbor/core/array_obj.h +134 -0
- data/vendor/lexbor/source/lexbor/core/avl.c +442 -0
- data/vendor/lexbor/source/lexbor/core/avl.h +82 -0
- data/vendor/lexbor/source/lexbor/core/base.h +86 -0
- data/vendor/lexbor/source/lexbor/core/bst.c +468 -0
- data/vendor/lexbor/source/lexbor/core/bst.h +108 -0
- data/vendor/lexbor/source/lexbor/core/bst_map.c +238 -0
- data/vendor/lexbor/source/lexbor/core/bst_map.h +87 -0
- data/vendor/lexbor/source/lexbor/core/config.cmake +12 -0
- data/vendor/lexbor/source/lexbor/core/conv.c +203 -0
- data/vendor/lexbor/source/lexbor/core/conv.h +53 -0
- data/vendor/lexbor/source/lexbor/core/core.h +35 -0
- data/vendor/lexbor/source/lexbor/core/def.h +57 -0
- data/vendor/lexbor/source/lexbor/core/diyfp.c +153 -0
- data/vendor/lexbor/source/lexbor/core/diyfp.h +258 -0
- data/vendor/lexbor/source/lexbor/core/dobject.c +187 -0
- data/vendor/lexbor/source/lexbor/core/dobject.h +92 -0
- data/vendor/lexbor/source/lexbor/core/dtoa.c +404 -0
- data/vendor/lexbor/source/lexbor/core/dtoa.h +28 -0
- data/vendor/lexbor/source/lexbor/core/fs.h +60 -0
- data/vendor/lexbor/source/lexbor/core/hash.c +476 -0
- data/vendor/lexbor/source/lexbor/core/hash.h +218 -0
- data/vendor/lexbor/source/lexbor/core/in.c +267 -0
- data/vendor/lexbor/source/lexbor/core/in.h +172 -0
- data/vendor/lexbor/source/lexbor/core/lexbor.h +35 -0
- data/vendor/lexbor/source/lexbor/core/mem.c +228 -0
- data/vendor/lexbor/source/lexbor/core/mem.h +141 -0
- data/vendor/lexbor/source/lexbor/core/mraw.c +428 -0
- data/vendor/lexbor/source/lexbor/core/mraw.h +114 -0
- data/vendor/lexbor/source/lexbor/core/perf.h +45 -0
- data/vendor/lexbor/source/lexbor/core/plog.c +73 -0
- data/vendor/lexbor/source/lexbor/core/plog.h +102 -0
- data/vendor/lexbor/source/lexbor/core/print.c +168 -0
- data/vendor/lexbor/source/lexbor/core/print.h +39 -0
- data/vendor/lexbor/source/lexbor/core/sbst.h +59 -0
- data/vendor/lexbor/source/lexbor/core/serialize.c +27 -0
- data/vendor/lexbor/source/lexbor/core/serialize.h +32 -0
- data/vendor/lexbor/source/lexbor/core/shs.c +118 -0
- data/vendor/lexbor/source/lexbor/core/shs.h +82 -0
- data/vendor/lexbor/source/lexbor/core/str.c +617 -0
- data/vendor/lexbor/source/lexbor/core/str.h +247 -0
- data/vendor/lexbor/source/lexbor/core/str_res.h +369 -0
- data/vendor/lexbor/source/lexbor/core/strtod.c +326 -0
- data/vendor/lexbor/source/lexbor/core/strtod.h +28 -0
- data/vendor/lexbor/source/lexbor/core/types.h +39 -0
- data/vendor/lexbor/source/lexbor/core/utils.c +43 -0
- data/vendor/lexbor/source/lexbor/core/utils.h +36 -0
- data/vendor/lexbor/source/lexbor/css/base.h +44 -0
- data/vendor/lexbor/source/lexbor/css/config.cmake +2 -0
- data/vendor/lexbor/source/lexbor/css/css.h +25 -0
- data/vendor/lexbor/source/lexbor/css/log.c +336 -0
- data/vendor/lexbor/source/lexbor/css/log.h +103 -0
- data/vendor/lexbor/source/lexbor/css/node.h +29 -0
- data/vendor/lexbor/source/lexbor/css/parser.c +473 -0
- data/vendor/lexbor/source/lexbor/css/parser.h +368 -0
- data/vendor/lexbor/source/lexbor/css/selectors/base.h +48 -0
- data/vendor/lexbor/source/lexbor/css/selectors/pseudo.c +91 -0
- data/vendor/lexbor/source/lexbor/css/selectors/pseudo.h +66 -0
- data/vendor/lexbor/source/lexbor/css/selectors/pseudo_const.h +109 -0
- data/vendor/lexbor/source/lexbor/css/selectors/pseudo_res.h +302 -0
- data/vendor/lexbor/source/lexbor/css/selectors/pseudo_state.c +279 -0
- data/vendor/lexbor/source/lexbor/css/selectors/pseudo_state.h +85 -0
- data/vendor/lexbor/source/lexbor/css/selectors/selector.c +927 -0
- data/vendor/lexbor/source/lexbor/css/selectors/selector.h +200 -0
- data/vendor/lexbor/source/lexbor/css/selectors/selectors.c +340 -0
- data/vendor/lexbor/source/lexbor/css/selectors/selectors.h +137 -0
- data/vendor/lexbor/source/lexbor/css/selectors/state.c +1718 -0
- data/vendor/lexbor/source/lexbor/css/selectors/state.h +79 -0
- data/vendor/lexbor/source/lexbor/css/stylesheet.h +37 -0
- data/vendor/lexbor/source/lexbor/css/syntax/anb.c +443 -0
- data/vendor/lexbor/source/lexbor/css/syntax/anb.h +45 -0
- data/vendor/lexbor/source/lexbor/css/syntax/base.h +33 -0
- data/vendor/lexbor/source/lexbor/css/syntax/parser.c +9 -0
- data/vendor/lexbor/source/lexbor/css/syntax/parser.h +25 -0
- data/vendor/lexbor/source/lexbor/css/syntax/res.h +48 -0
- data/vendor/lexbor/source/lexbor/css/syntax/state.c +2603 -0
- data/vendor/lexbor/source/lexbor/css/syntax/state.h +140 -0
- data/vendor/lexbor/source/lexbor/css/syntax/state_res.h +273 -0
- data/vendor/lexbor/source/lexbor/css/syntax/syntax.c +67 -0
- data/vendor/lexbor/source/lexbor/css/syntax/token.c +618 -0
- data/vendor/lexbor/source/lexbor/css/syntax/token.h +298 -0
- data/vendor/lexbor/source/lexbor/css/syntax/token_res.h +68 -0
- data/vendor/lexbor/source/lexbor/css/syntax/tokenizer/error.c +30 -0
- data/vendor/lexbor/source/lexbor/css/syntax/tokenizer/error.h +58 -0
- data/vendor/lexbor/source/lexbor/css/syntax/tokenizer.c +278 -0
- data/vendor/lexbor/source/lexbor/css/syntax/tokenizer.h +121 -0
- data/vendor/lexbor/source/lexbor/dom/base.h +32 -0
- data/vendor/lexbor/source/lexbor/dom/collection.c +97 -0
- data/vendor/lexbor/source/lexbor/dom/collection.h +112 -0
- data/vendor/lexbor/source/lexbor/dom/config.cmake +3 -0
- data/vendor/lexbor/source/lexbor/dom/dom.h +29 -0
- data/vendor/lexbor/source/lexbor/dom/exception.c +18 -0
- data/vendor/lexbor/source/lexbor/dom/exception.h +73 -0
- data/vendor/lexbor/source/lexbor/dom/interface.c +110 -0
- data/vendor/lexbor/source/lexbor/dom/interface.h +88 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/attr.c +445 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/attr.h +152 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/attr_const.h +62 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/attr_res.h +143 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/cdata_section.c +55 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/cdata_section.h +38 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/character_data.c +110 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/character_data.h +51 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/comment.c +64 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/comment.h +42 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/document.c +536 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/document.h +243 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/document_fragment.c +36 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/document_fragment.h +36 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/document_type.c +125 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/document_type.h +108 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/element.c +1411 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/element.h +319 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/event_target.c +32 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/event_target.h +34 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/node.c +661 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/node.h +192 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/processing_instruction.c +87 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/processing_instruction.h +66 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/shadow_root.c +36 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/shadow_root.h +44 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/text.c +63 -0
- data/vendor/lexbor/source/lexbor/dom/interfaces/text.h +42 -0
- data/vendor/lexbor/source/lexbor/encoding/base.h +218 -0
- data/vendor/lexbor/source/lexbor/encoding/big5.c +42839 -0
- data/vendor/lexbor/source/lexbor/encoding/config.cmake +12 -0
- data/vendor/lexbor/source/lexbor/encoding/const.h +65 -0
- data/vendor/lexbor/source/lexbor/encoding/decode.c +3193 -0
- data/vendor/lexbor/source/lexbor/encoding/decode.h +370 -0
- data/vendor/lexbor/source/lexbor/encoding/encode.c +1931 -0
- data/vendor/lexbor/source/lexbor/encoding/encode.h +377 -0
- data/vendor/lexbor/source/lexbor/encoding/encoding.c +252 -0
- data/vendor/lexbor/source/lexbor/encoding/encoding.h +475 -0
- data/vendor/lexbor/source/lexbor/encoding/euc_kr.c +53883 -0
- data/vendor/lexbor/source/lexbor/encoding/gb18030.c +47905 -0
- data/vendor/lexbor/source/lexbor/encoding/iso_2022_jp_katakana.c +159 -0
- data/vendor/lexbor/source/lexbor/encoding/jis0208.c +22477 -0
- data/vendor/lexbor/source/lexbor/encoding/jis0212.c +15787 -0
- data/vendor/lexbor/source/lexbor/encoding/multi.h +53 -0
- data/vendor/lexbor/source/lexbor/encoding/range.c +71 -0
- data/vendor/lexbor/source/lexbor/encoding/range.h +34 -0
- data/vendor/lexbor/source/lexbor/encoding/res.c +222 -0
- data/vendor/lexbor/source/lexbor/encoding/res.h +34 -0
- data/vendor/lexbor/source/lexbor/encoding/single.c +13748 -0
- data/vendor/lexbor/source/lexbor/encoding/single.h +116 -0
- data/vendor/lexbor/source/lexbor/html/base.h +44 -0
- data/vendor/lexbor/source/lexbor/html/config.cmake +3 -0
- data/vendor/lexbor/source/lexbor/html/encoding.c +574 -0
- data/vendor/lexbor/source/lexbor/html/encoding.h +106 -0
- data/vendor/lexbor/source/lexbor/html/html.h +107 -0
- data/vendor/lexbor/source/lexbor/html/interface.c +165 -0
- data/vendor/lexbor/source/lexbor/html/interface.h +186 -0
- data/vendor/lexbor/source/lexbor/html/interface_res.h +4449 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/anchor_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/anchor_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/area_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/area_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/audio_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/audio_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/base_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/base_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/body_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/body_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/br_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/br_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/button_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/button_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/canvas_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/canvas_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/d_list_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/d_list_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/data_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/data_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/data_list_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/data_list_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/details_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/details_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/dialog_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/dialog_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/directory_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/directory_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/div_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/div_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/document.c +444 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/document.h +256 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/element.c +64 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/element.h +54 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/embed_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/embed_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/field_set_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/field_set_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/font_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/font_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/form_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/form_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/frame_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/frame_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/frame_set_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/frame_set_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/head_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/head_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/heading_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/heading_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/hr_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/hr_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/html_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/html_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/iframe_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/iframe_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/image_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/image_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/input_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/input_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/label_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/label_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/legend_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/legend_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/li_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/li_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/link_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/link_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/map_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/map_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/marquee_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/marquee_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/media_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/media_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/menu_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/menu_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/meta_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/meta_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/meter_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/meter_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/mod_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/mod_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/o_list_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/o_list_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/object_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/object_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/opt_group_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/opt_group_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/option_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/option_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/output_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/output_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/paragraph_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/paragraph_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/param_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/param_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/picture_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/picture_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/pre_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/pre_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/progress_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/progress_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/quote_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/quote_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/script_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/script_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/select_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/select_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/slot_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/slot_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/source_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/source_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/span_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/span_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/style_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/style_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/table_caption_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/table_caption_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/table_cell_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/table_cell_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/table_col_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/table_col_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/table_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/table_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/table_row_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/table_row_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/table_section_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/table_section_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/template_element.c +46 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/template_element.h +38 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/text_area_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/text_area_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/time_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/time_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/title_element.c +133 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/title_element.h +42 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/track_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/track_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/u_list_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/u_list_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/unknown_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/unknown_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/video_element.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/video_element.h +34 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/window.c +36 -0
- data/vendor/lexbor/source/lexbor/html/interfaces/window.h +34 -0
- data/vendor/lexbor/source/lexbor/html/node.c +14 -0
- data/vendor/lexbor/source/lexbor/html/node.h +67 -0
- data/vendor/lexbor/source/lexbor/html/parser.c +469 -0
- data/vendor/lexbor/source/lexbor/html/parser.h +170 -0
- data/vendor/lexbor/source/lexbor/html/serialize.c +1510 -0
- data/vendor/lexbor/source/lexbor/html/serialize.h +93 -0
- data/vendor/lexbor/source/lexbor/html/tag.h +103 -0
- data/vendor/lexbor/source/lexbor/html/tag_res.h +2262 -0
- data/vendor/lexbor/source/lexbor/html/token.c +386 -0
- data/vendor/lexbor/source/lexbor/html/token.h +130 -0
- data/vendor/lexbor/source/lexbor/html/token_attr.c +44 -0
- data/vendor/lexbor/source/lexbor/html/token_attr.h +67 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/error.c +28 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/error.h +141 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/res.h +4956 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/state.c +2171 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/state.h +225 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/state_comment.c +489 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/state_comment.h +27 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/state_doctype.c +1654 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/state_doctype.h +27 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/state_rawtext.c +303 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/state_rawtext.h +32 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/state_rcdata.c +311 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/state_rcdata.h +32 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/state_script.c +1209 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer/state_script.h +32 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer.c +499 -0
- data/vendor/lexbor/source/lexbor/html/tokenizer.h +343 -0
- data/vendor/lexbor/source/lexbor/html/tree/active_formatting.c +241 -0
- data/vendor/lexbor/source/lexbor/html/tree/active_formatting.h +117 -0
- data/vendor/lexbor/source/lexbor/html/tree/error.c +26 -0
- data/vendor/lexbor/source/lexbor/html/tree/error.h +114 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/after_after_body.c +62 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/after_after_frameset.c +63 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/after_body.c +82 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/after_frameset.c +88 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/after_head.c +222 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/before_head.c +144 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/before_html.c +166 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/foreign_content.c +358 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_body.c +1974 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_caption.c +158 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_cell.c +187 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_column_group.c +194 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_frameset.c +149 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_head.c +374 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_head_noscript.c +121 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_row.c +211 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_select.c +341 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_select_in_table.c +115 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_table.c +451 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_table_body.c +208 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_table_text.c +127 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_template.c +189 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/initial.c +411 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/text.c +61 -0
- data/vendor/lexbor/source/lexbor/html/tree/insertion_mode.h +135 -0
- data/vendor/lexbor/source/lexbor/html/tree/open_elements.c +251 -0
- data/vendor/lexbor/source/lexbor/html/tree/open_elements.h +105 -0
- data/vendor/lexbor/source/lexbor/html/tree/template_insertion.c +10 -0
- data/vendor/lexbor/source/lexbor/html/tree/template_insertion.h +100 -0
- data/vendor/lexbor/source/lexbor/html/tree.c +1726 -0
- data/vendor/lexbor/source/lexbor/html/tree.h +431 -0
- data/vendor/lexbor/source/lexbor/html/tree_res.h +111 -0
- data/vendor/lexbor/source/lexbor/ns/base.h +32 -0
- data/vendor/lexbor/source/lexbor/ns/config.cmake +2 -0
- data/vendor/lexbor/source/lexbor/ns/const.h +37 -0
- data/vendor/lexbor/source/lexbor/ns/ns.c +154 -0
- data/vendor/lexbor/source/lexbor/ns/ns.h +66 -0
- data/vendor/lexbor/source/lexbor/ns/res.h +97 -0
- data/vendor/lexbor/source/lexbor/ports/posix/config.cmake +11 -0
- data/vendor/lexbor/source/lexbor/ports/posix/lexbor/core/fs.c +236 -0
- data/vendor/lexbor/source/lexbor/ports/posix/lexbor/core/memory.c +33 -0
- data/vendor/lexbor/source/lexbor/ports/posix/lexbor/core/perf.c +158 -0
- data/vendor/lexbor/source/lexbor/ports/windows_nt/config.cmake +18 -0
- data/vendor/lexbor/source/lexbor/ports/windows_nt/lexbor/core/fs.c +239 -0
- data/vendor/lexbor/source/lexbor/ports/windows_nt/lexbor/core/memory.c +33 -0
- data/vendor/lexbor/source/lexbor/ports/windows_nt/lexbor/core/perf.c +81 -0
- data/vendor/lexbor/source/lexbor/selectors/base.h +30 -0
- data/vendor/lexbor/source/lexbor/selectors/config.cmake +2 -0
- data/vendor/lexbor/source/lexbor/selectors/selectors.c +1591 -0
- data/vendor/lexbor/source/lexbor/selectors/selectors.h +71 -0
- data/vendor/lexbor/source/lexbor/tag/base.h +32 -0
- data/vendor/lexbor/source/lexbor/tag/config.cmake +2 -0
- data/vendor/lexbor/source/lexbor/tag/const.h +225 -0
- data/vendor/lexbor/source/lexbor/tag/res.h +562 -0
- data/vendor/lexbor/source/lexbor/tag/tag.c +144 -0
- data/vendor/lexbor/source/lexbor/tag/tag.h +123 -0
- data/vendor/lexbor/source/lexbor/utils/base.h +32 -0
- data/vendor/lexbor/source/lexbor/utils/config.cmake +2 -0
- data/vendor/lexbor/source/lexbor/utils/http.c +534 -0
- data/vendor/lexbor/source/lexbor/utils/http.h +90 -0
- data/vendor/lexbor/source/lexbor/utils/utils.h +15 -0
- data/vendor/lexbor/source/lexbor/utils/warc.c +817 -0
- data/vendor/lexbor/source/lexbor/utils/warc.h +126 -0
- data/vendor/lexbor/utils/lexbor/css/selectors/pseudo.py +231 -0
- data/vendor/lexbor/utils/lexbor/css/selectors/tmp/const.h +21 -0
- data/vendor/lexbor/utils/lexbor/css/selectors/tmp/res.h +26 -0
- data/vendor/lexbor/utils/lexbor/css/syntax/definitions.py +49 -0
- data/vendor/lexbor/utils/lexbor/css/syntax/token_res.py +54 -0
- data/vendor/lexbor/utils/lexbor/css/syntax/tokenizer_code_map.py +36 -0
- data/vendor/lexbor/version +1 -0
- metadata +542 -0
@@ -0,0 +1,1209 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) 2018-2020 Alexander Borisov
|
3
|
+
*
|
4
|
+
* Author: Alexander Borisov <borisov@lexbor.com>
|
5
|
+
*/
|
6
|
+
|
7
|
+
#include "lexbor/html/tokenizer/state_script.h"
|
8
|
+
#include "lexbor/html/tokenizer/state.h"
|
9
|
+
|
10
|
+
#define LEXBOR_STR_RES_ALPHA_CHARACTER
|
11
|
+
#define LEXBOR_STR_RES_ANSI_REPLACEMENT_CHARACTER
|
12
|
+
#include "lexbor/core/str_res.h"
|
13
|
+
|
14
|
+
#include "lexbor/core/str_res.h"
|
15
|
+
|
16
|
+
|
17
|
+
const lxb_tag_data_t *
|
18
|
+
lxb_tag_append_lower(lexbor_hash_t *hash,
|
19
|
+
const lxb_char_t *name, size_t length);
|
20
|
+
|
21
|
+
|
22
|
+
static const lxb_char_t *
|
23
|
+
lxb_html_tokenizer_state_script_data(lxb_html_tokenizer_t *tkz,
|
24
|
+
const lxb_char_t *data,
|
25
|
+
const lxb_char_t *end);
|
26
|
+
|
27
|
+
static const lxb_char_t *
|
28
|
+
lxb_html_tokenizer_state_script_data_less_than_sign(lxb_html_tokenizer_t *tkz,
|
29
|
+
const lxb_char_t *data,
|
30
|
+
const lxb_char_t *end);
|
31
|
+
|
32
|
+
static const lxb_char_t *
|
33
|
+
lxb_html_tokenizer_state_script_data_end_tag_open(lxb_html_tokenizer_t *tkz,
|
34
|
+
const lxb_char_t *data,
|
35
|
+
const lxb_char_t *end);
|
36
|
+
|
37
|
+
static const lxb_char_t *
|
38
|
+
lxb_html_tokenizer_state_script_data_end_tag_name(lxb_html_tokenizer_t *tkz,
|
39
|
+
const lxb_char_t *data,
|
40
|
+
const lxb_char_t *end);
|
41
|
+
|
42
|
+
static const lxb_char_t *
|
43
|
+
lxb_html_tokenizer_state_script_data_escape_start(lxb_html_tokenizer_t *tkz,
|
44
|
+
const lxb_char_t *data,
|
45
|
+
const lxb_char_t *end);
|
46
|
+
|
47
|
+
static const lxb_char_t *
|
48
|
+
lxb_html_tokenizer_state_script_data_escape_start_dash(
|
49
|
+
lxb_html_tokenizer_t *tkz,
|
50
|
+
const lxb_char_t *data,
|
51
|
+
const lxb_char_t *end);
|
52
|
+
|
53
|
+
static const lxb_char_t *
|
54
|
+
lxb_html_tokenizer_state_script_data_escaped(lxb_html_tokenizer_t *tkz,
|
55
|
+
const lxb_char_t *data,
|
56
|
+
const lxb_char_t *end);
|
57
|
+
|
58
|
+
static const lxb_char_t *
|
59
|
+
lxb_html_tokenizer_state_script_data_escaped_dash(lxb_html_tokenizer_t *tkz,
|
60
|
+
const lxb_char_t *data,
|
61
|
+
const lxb_char_t *end);
|
62
|
+
|
63
|
+
static const lxb_char_t *
|
64
|
+
lxb_html_tokenizer_state_script_data_escaped_dash_dash(
|
65
|
+
lxb_html_tokenizer_t *tkz,
|
66
|
+
const lxb_char_t *data,
|
67
|
+
const lxb_char_t *end);
|
68
|
+
|
69
|
+
static const lxb_char_t *
|
70
|
+
lxb_html_tokenizer_state_script_data_escaped_less_than_sign(
|
71
|
+
lxb_html_tokenizer_t *tkz,
|
72
|
+
const lxb_char_t *data,
|
73
|
+
const lxb_char_t *end);
|
74
|
+
|
75
|
+
static const lxb_char_t *
|
76
|
+
lxb_html_tokenizer_state_script_data_escaped_end_tag_open(
|
77
|
+
lxb_html_tokenizer_t *tkz,
|
78
|
+
const lxb_char_t *data,
|
79
|
+
const lxb_char_t *end);
|
80
|
+
|
81
|
+
static const lxb_char_t *
|
82
|
+
lxb_html_tokenizer_state_script_data_escaped_end_tag_name(
|
83
|
+
lxb_html_tokenizer_t *tkz,
|
84
|
+
const lxb_char_t *data,
|
85
|
+
const lxb_char_t *end);
|
86
|
+
|
87
|
+
static const lxb_char_t *
|
88
|
+
lxb_html_tokenizer_state_script_data_double_escape_start(
|
89
|
+
lxb_html_tokenizer_t *tkz,
|
90
|
+
const lxb_char_t *data,
|
91
|
+
const lxb_char_t *end);
|
92
|
+
|
93
|
+
static const lxb_char_t *
|
94
|
+
lxb_html_tokenizer_state_script_data_double_escaped(lxb_html_tokenizer_t *tkz,
|
95
|
+
const lxb_char_t *data,
|
96
|
+
const lxb_char_t *end);
|
97
|
+
|
98
|
+
static const lxb_char_t *
|
99
|
+
lxb_html_tokenizer_state_script_data_double_escaped_dash(
|
100
|
+
lxb_html_tokenizer_t *tkz,
|
101
|
+
const lxb_char_t *data,
|
102
|
+
const lxb_char_t *end);
|
103
|
+
|
104
|
+
static const lxb_char_t *
|
105
|
+
lxb_html_tokenizer_state_script_data_double_escaped_dash_dash(
|
106
|
+
lxb_html_tokenizer_t *tkz,
|
107
|
+
const lxb_char_t *data,
|
108
|
+
const lxb_char_t *end);
|
109
|
+
|
110
|
+
static const lxb_char_t *
|
111
|
+
lxb_html_tokenizer_state_script_data_double_escaped_less_than_sign(
|
112
|
+
lxb_html_tokenizer_t *tkz,
|
113
|
+
const lxb_char_t *data,
|
114
|
+
const lxb_char_t *end);
|
115
|
+
|
116
|
+
static const lxb_char_t *
|
117
|
+
lxb_html_tokenizer_state_script_data_double_escaped_end_tag_open(
|
118
|
+
lxb_html_tokenizer_t *tkz,
|
119
|
+
const lxb_char_t *data,
|
120
|
+
const lxb_char_t *end);
|
121
|
+
|
122
|
+
static const lxb_char_t *
|
123
|
+
lxb_html_tokenizer_state_script_data_double_escape_end(
|
124
|
+
lxb_html_tokenizer_t *tkz,
|
125
|
+
const lxb_char_t *data,
|
126
|
+
const lxb_char_t *end);
|
127
|
+
|
128
|
+
|
129
|
+
/*
|
130
|
+
* Helper function. No in the specification. For 12.2.5.4 Script data state
|
131
|
+
*/
|
132
|
+
const lxb_char_t *
|
133
|
+
lxb_html_tokenizer_state_script_data_before(lxb_html_tokenizer_t *tkz,
|
134
|
+
const lxb_char_t *data,
|
135
|
+
const lxb_char_t *end)
|
136
|
+
{
|
137
|
+
if (tkz->is_eof == false) {
|
138
|
+
lxb_html_tokenizer_state_token_set_begin(tkz, data);
|
139
|
+
}
|
140
|
+
|
141
|
+
tkz->state = lxb_html_tokenizer_state_script_data;
|
142
|
+
|
143
|
+
return data;
|
144
|
+
}
|
145
|
+
|
146
|
+
/*
|
147
|
+
* 12.2.5.4 Script data state
|
148
|
+
*/
|
149
|
+
static const lxb_char_t *
|
150
|
+
lxb_html_tokenizer_state_script_data(lxb_html_tokenizer_t *tkz,
|
151
|
+
const lxb_char_t *data,
|
152
|
+
const lxb_char_t *end)
|
153
|
+
{
|
154
|
+
lxb_html_tokenizer_state_begin_set(tkz, data);
|
155
|
+
|
156
|
+
while (data != end) {
|
157
|
+
switch (*data) {
|
158
|
+
/* U+003C LESS-THAN SIGN (<) */
|
159
|
+
case 0x3C:
|
160
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data + 1);
|
161
|
+
lxb_html_tokenizer_state_token_set_end(tkz, data);
|
162
|
+
|
163
|
+
tkz->state =
|
164
|
+
lxb_html_tokenizer_state_script_data_less_than_sign;
|
165
|
+
|
166
|
+
return (data + 1);
|
167
|
+
|
168
|
+
/* U+000D CARRIAGE RETURN (CR) */
|
169
|
+
case 0x0D:
|
170
|
+
if (++data >= end) {
|
171
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data - 1);
|
172
|
+
|
173
|
+
tkz->state = lxb_html_tokenizer_state_cr;
|
174
|
+
tkz->state_return = lxb_html_tokenizer_state_script_data;
|
175
|
+
|
176
|
+
return data;
|
177
|
+
}
|
178
|
+
|
179
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data);
|
180
|
+
tkz->pos[-1] = 0x0A;
|
181
|
+
|
182
|
+
lxb_html_tokenizer_state_begin_set(tkz, data + 1);
|
183
|
+
|
184
|
+
if (*data != 0x0A) {
|
185
|
+
lxb_html_tokenizer_state_begin_set(tkz, data);
|
186
|
+
data--;
|
187
|
+
}
|
188
|
+
|
189
|
+
break;
|
190
|
+
|
191
|
+
/*
|
192
|
+
* U+0000 NULL
|
193
|
+
* EOF
|
194
|
+
*/
|
195
|
+
case 0x00:
|
196
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data);
|
197
|
+
|
198
|
+
if (tkz->is_eof) {
|
199
|
+
if (tkz->token->begin != NULL) {
|
200
|
+
lxb_html_tokenizer_state_token_set_end_oef(tkz);
|
201
|
+
}
|
202
|
+
|
203
|
+
tkz->token->tag_id = LXB_TAG__TEXT;
|
204
|
+
|
205
|
+
lxb_html_tokenizer_state_set_text(tkz);
|
206
|
+
lxb_html_tokenizer_state_token_done_m(tkz, end);
|
207
|
+
|
208
|
+
return end;
|
209
|
+
}
|
210
|
+
|
211
|
+
lxb_html_tokenizer_state_begin_set(tkz, data + 1);
|
212
|
+
lxb_html_tokenizer_state_append_replace_m(tkz);
|
213
|
+
|
214
|
+
lxb_html_tokenizer_error_add(tkz->parse_errors, data,
|
215
|
+
LXB_HTML_TOKENIZER_ERROR_UNNUCH);
|
216
|
+
break;
|
217
|
+
|
218
|
+
default:
|
219
|
+
break;
|
220
|
+
}
|
221
|
+
|
222
|
+
data++;
|
223
|
+
}
|
224
|
+
|
225
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data);
|
226
|
+
|
227
|
+
return data;
|
228
|
+
}
|
229
|
+
|
230
|
+
/*
|
231
|
+
* 12.2.5.15 Script data less-than sign state
|
232
|
+
*/
|
233
|
+
static const lxb_char_t *
|
234
|
+
lxb_html_tokenizer_state_script_data_less_than_sign(lxb_html_tokenizer_t *tkz,
|
235
|
+
const lxb_char_t *data,
|
236
|
+
const lxb_char_t *end)
|
237
|
+
{
|
238
|
+
switch (*data) {
|
239
|
+
/* U+002F SOLIDUS (/) */
|
240
|
+
case 0x2F:
|
241
|
+
tkz->state = lxb_html_tokenizer_state_script_data_end_tag_open;
|
242
|
+
|
243
|
+
return (data + 1);
|
244
|
+
|
245
|
+
/* U+0021 EXCLAMATION MARK (!) */
|
246
|
+
case 0x21:
|
247
|
+
tkz->state = lxb_html_tokenizer_state_script_data_escape_start;
|
248
|
+
|
249
|
+
return (data + 1);
|
250
|
+
|
251
|
+
default:
|
252
|
+
tkz->state = lxb_html_tokenizer_state_script_data;
|
253
|
+
|
254
|
+
break;
|
255
|
+
}
|
256
|
+
|
257
|
+
return data;
|
258
|
+
}
|
259
|
+
|
260
|
+
/*
|
261
|
+
* 12.2.5.16 Script data end tag open state
|
262
|
+
*/
|
263
|
+
static const lxb_char_t *
|
264
|
+
lxb_html_tokenizer_state_script_data_end_tag_open(lxb_html_tokenizer_t *tkz,
|
265
|
+
const lxb_char_t *data,
|
266
|
+
const lxb_char_t *end)
|
267
|
+
{
|
268
|
+
if (lexbor_str_res_alpha_character[*data] != LEXBOR_STR_RES_SLIP) {
|
269
|
+
tkz->entity_start = (tkz->pos - 1) - tkz->start;
|
270
|
+
tkz->temp = data;
|
271
|
+
|
272
|
+
tkz->state = lxb_html_tokenizer_state_script_data_end_tag_name;
|
273
|
+
}
|
274
|
+
else {
|
275
|
+
tkz->state = lxb_html_tokenizer_state_script_data;
|
276
|
+
}
|
277
|
+
|
278
|
+
lxb_html_tokenizer_state_append_m(tkz, "/", 1);
|
279
|
+
|
280
|
+
return data;
|
281
|
+
}
|
282
|
+
|
283
|
+
/*
|
284
|
+
* 12.2.5.17 Script data end tag name state
|
285
|
+
*/
|
286
|
+
static const lxb_char_t *
|
287
|
+
lxb_html_tokenizer_state_script_data_end_tag_name(lxb_html_tokenizer_t *tkz,
|
288
|
+
const lxb_char_t *data,
|
289
|
+
const lxb_char_t *end)
|
290
|
+
{
|
291
|
+
lxb_html_tokenizer_state_begin_set(tkz, data);
|
292
|
+
|
293
|
+
while (data != end) {
|
294
|
+
switch (*data) {
|
295
|
+
/*
|
296
|
+
* U+0009 CHARACTER TABULATION (tab)
|
297
|
+
* U+000A LINE FEED (LF)
|
298
|
+
* U+000C FORM FEED (FF)
|
299
|
+
* U+000D CARRIAGE RETURN (CR)
|
300
|
+
* U+0020 SPACE
|
301
|
+
*/
|
302
|
+
case 0x09:
|
303
|
+
case 0x0A:
|
304
|
+
case 0x0C:
|
305
|
+
case 0x0D:
|
306
|
+
case 0x20:
|
307
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data);
|
308
|
+
lxb_html_tokenizer_state_set_tag_m(tkz, &tkz->start[tkz->entity_start] + 2,
|
309
|
+
tkz->pos);
|
310
|
+
|
311
|
+
if (tkz->tmp_tag_id != tkz->token->tag_id) {
|
312
|
+
goto anything_else;
|
313
|
+
}
|
314
|
+
|
315
|
+
tkz->state = lxb_html_tokenizer_state_before_attribute_name;
|
316
|
+
|
317
|
+
goto done;
|
318
|
+
|
319
|
+
/* U+002F SOLIDUS (/) */
|
320
|
+
case 0x2F:
|
321
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data);
|
322
|
+
lxb_html_tokenizer_state_set_tag_m(tkz, &tkz->start[tkz->entity_start] + 2,
|
323
|
+
tkz->pos);
|
324
|
+
|
325
|
+
if (tkz->tmp_tag_id != tkz->token->tag_id) {
|
326
|
+
goto anything_else;
|
327
|
+
}
|
328
|
+
|
329
|
+
tkz->state = lxb_html_tokenizer_state_self_closing_start_tag;
|
330
|
+
|
331
|
+
goto done;
|
332
|
+
|
333
|
+
/* U+003E GREATER-THAN SIGN (>) */
|
334
|
+
case 0x3E:
|
335
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data);
|
336
|
+
lxb_html_tokenizer_state_set_tag_m(tkz, &tkz->start[tkz->entity_start] + 2,
|
337
|
+
tkz->pos);
|
338
|
+
|
339
|
+
if (tkz->tmp_tag_id != tkz->token->tag_id) {
|
340
|
+
goto anything_else;
|
341
|
+
}
|
342
|
+
|
343
|
+
tkz->state = lxb_html_tokenizer_state_data_before;
|
344
|
+
|
345
|
+
/* Emit text token */
|
346
|
+
tkz->token->tag_id = LXB_TAG__TEXT;
|
347
|
+
tkz->pos = &tkz->start[tkz->entity_start];
|
348
|
+
|
349
|
+
lxb_html_tokenizer_state_set_text(tkz);
|
350
|
+
lxb_html_tokenizer_state_token_done_m(tkz, end);
|
351
|
+
|
352
|
+
/* Init close token */
|
353
|
+
tkz->token->tag_id = tkz->tmp_tag_id;
|
354
|
+
tkz->token->begin = tkz->temp;
|
355
|
+
tkz->token->end = data;
|
356
|
+
tkz->token->type |= LXB_HTML_TOKEN_TYPE_CLOSE;
|
357
|
+
|
358
|
+
/* Emit close token */
|
359
|
+
lxb_html_tokenizer_state_token_done_m(tkz, end);
|
360
|
+
|
361
|
+
return (data + 1);
|
362
|
+
|
363
|
+
default:
|
364
|
+
if (lexbor_str_res_alpha_character[*data]
|
365
|
+
== LEXBOR_STR_RES_SLIP)
|
366
|
+
{
|
367
|
+
goto anything_else;
|
368
|
+
}
|
369
|
+
|
370
|
+
break;
|
371
|
+
}
|
372
|
+
|
373
|
+
data++;
|
374
|
+
}
|
375
|
+
|
376
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data);
|
377
|
+
|
378
|
+
return data;
|
379
|
+
|
380
|
+
anything_else:
|
381
|
+
|
382
|
+
tkz->state = lxb_html_tokenizer_state_script_data;
|
383
|
+
|
384
|
+
return data;
|
385
|
+
|
386
|
+
done:
|
387
|
+
|
388
|
+
/* Emit text token */
|
389
|
+
tkz->token->tag_id = LXB_TAG__TEXT;
|
390
|
+
tkz->pos = &tkz->start[tkz->entity_start];
|
391
|
+
|
392
|
+
lxb_html_tokenizer_state_set_text(tkz);
|
393
|
+
lxb_html_tokenizer_state_token_done_m(tkz, end);
|
394
|
+
|
395
|
+
/* Init close token */
|
396
|
+
tkz->token->tag_id = tkz->tmp_tag_id;
|
397
|
+
tkz->token->begin = tkz->temp;
|
398
|
+
tkz->token->end = data;
|
399
|
+
tkz->token->type |= LXB_HTML_TOKEN_TYPE_CLOSE;
|
400
|
+
|
401
|
+
return (data + 1);
|
402
|
+
}
|
403
|
+
|
404
|
+
/*
|
405
|
+
* 12.2.5.18 Script data escape start state
|
406
|
+
*/
|
407
|
+
static const lxb_char_t *
|
408
|
+
lxb_html_tokenizer_state_script_data_escape_start(lxb_html_tokenizer_t *tkz,
|
409
|
+
const lxb_char_t *data,
|
410
|
+
const lxb_char_t *end)
|
411
|
+
{
|
412
|
+
/* U+002D HYPHEN-MINUS (-) */
|
413
|
+
if (*data == 0x2D) {
|
414
|
+
tkz->state = lxb_html_tokenizer_state_script_data_escape_start_dash;
|
415
|
+
|
416
|
+
return (data + 1);
|
417
|
+
}
|
418
|
+
|
419
|
+
lxb_html_tokenizer_state_append_m(tkz, "!", 1);
|
420
|
+
|
421
|
+
tkz->state = lxb_html_tokenizer_state_script_data;
|
422
|
+
|
423
|
+
return data;
|
424
|
+
}
|
425
|
+
|
426
|
+
/*
|
427
|
+
* 12.2.5.19 Script data escape start dash state
|
428
|
+
*/
|
429
|
+
static const lxb_char_t *
|
430
|
+
lxb_html_tokenizer_state_script_data_escape_start_dash(
|
431
|
+
lxb_html_tokenizer_t *tkz,
|
432
|
+
const lxb_char_t *data,
|
433
|
+
const lxb_char_t *end)
|
434
|
+
{
|
435
|
+
/* U+002D HYPHEN-MINUS (-) */
|
436
|
+
if (*data == 0x2D) {
|
437
|
+
lxb_html_tokenizer_state_append_m(tkz, "!--", 3);
|
438
|
+
|
439
|
+
tkz->state = lxb_html_tokenizer_state_script_data_escaped_dash_dash;
|
440
|
+
|
441
|
+
return (data + 1);
|
442
|
+
}
|
443
|
+
|
444
|
+
lxb_html_tokenizer_state_append_m(tkz, "!-", 2);
|
445
|
+
|
446
|
+
tkz->state = lxb_html_tokenizer_state_script_data;
|
447
|
+
|
448
|
+
return data;
|
449
|
+
}
|
450
|
+
|
451
|
+
/*
|
452
|
+
* 12.2.5.20 Script data escaped state
|
453
|
+
*/
|
454
|
+
static const lxb_char_t *
|
455
|
+
lxb_html_tokenizer_state_script_data_escaped(lxb_html_tokenizer_t *tkz,
|
456
|
+
const lxb_char_t *data,
|
457
|
+
const lxb_char_t *end)
|
458
|
+
{
|
459
|
+
lxb_html_tokenizer_state_begin_set(tkz, data);
|
460
|
+
|
461
|
+
while (data != end) {
|
462
|
+
switch (*data) {
|
463
|
+
/* U+002D HYPHEN-MINUS (-) */
|
464
|
+
case 0x2D:
|
465
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data + 1);
|
466
|
+
|
467
|
+
tkz->state = lxb_html_tokenizer_state_script_data_escaped_dash;
|
468
|
+
|
469
|
+
return (data + 1);
|
470
|
+
|
471
|
+
/* U+003C LESS-THAN SIGN (<) */
|
472
|
+
case 0x3C:
|
473
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data + 1);
|
474
|
+
lxb_html_tokenizer_state_token_set_end(tkz, data);
|
475
|
+
|
476
|
+
tkz->state =
|
477
|
+
lxb_html_tokenizer_state_script_data_escaped_less_than_sign;
|
478
|
+
|
479
|
+
return (data + 1);
|
480
|
+
|
481
|
+
/* U+000D CARRIAGE RETURN (CR) */
|
482
|
+
case 0x0D:
|
483
|
+
if (++data >= end) {
|
484
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data - 1);
|
485
|
+
|
486
|
+
tkz->state = lxb_html_tokenizer_state_cr;
|
487
|
+
tkz->state_return = lxb_html_tokenizer_state_script_data_escaped;
|
488
|
+
|
489
|
+
return data;
|
490
|
+
}
|
491
|
+
|
492
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data);
|
493
|
+
tkz->pos[-1] = 0x0A;
|
494
|
+
|
495
|
+
lxb_html_tokenizer_state_begin_set(tkz, data + 1);
|
496
|
+
|
497
|
+
if (*data != 0x0A) {
|
498
|
+
lxb_html_tokenizer_state_begin_set(tkz, data);
|
499
|
+
data--;
|
500
|
+
}
|
501
|
+
|
502
|
+
break;
|
503
|
+
|
504
|
+
/*
|
505
|
+
* U+0000 NULL
|
506
|
+
* EOF
|
507
|
+
*/
|
508
|
+
case 0x00:
|
509
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data);
|
510
|
+
|
511
|
+
if (tkz->is_eof) {
|
512
|
+
lxb_html_tokenizer_error_add(tkz->parse_errors, tkz->last,
|
513
|
+
LXB_HTML_TOKENIZER_ERROR_EOINSCHTCOLITE);
|
514
|
+
|
515
|
+
tkz->token->tag_id = LXB_TAG__TEXT;
|
516
|
+
|
517
|
+
lxb_html_tokenizer_state_set_text(tkz);
|
518
|
+
lxb_html_tokenizer_state_token_set_end_oef(tkz);
|
519
|
+
lxb_html_tokenizer_state_token_done_m(tkz, end);
|
520
|
+
|
521
|
+
return end;
|
522
|
+
}
|
523
|
+
|
524
|
+
lxb_html_tokenizer_state_begin_set(tkz, data + 1);
|
525
|
+
lxb_html_tokenizer_state_append_replace_m(tkz);
|
526
|
+
|
527
|
+
lxb_html_tokenizer_error_add(tkz->parse_errors, data,
|
528
|
+
LXB_HTML_TOKENIZER_ERROR_UNNUCH);
|
529
|
+
break;
|
530
|
+
|
531
|
+
default:
|
532
|
+
break;
|
533
|
+
}
|
534
|
+
|
535
|
+
data++;
|
536
|
+
}
|
537
|
+
|
538
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data);
|
539
|
+
|
540
|
+
return data;
|
541
|
+
}
|
542
|
+
|
543
|
+
/*
|
544
|
+
* 12.2.5.21 Script data escaped dash state
|
545
|
+
*/
|
546
|
+
static const lxb_char_t *
|
547
|
+
lxb_html_tokenizer_state_script_data_escaped_dash(lxb_html_tokenizer_t *tkz,
|
548
|
+
const lxb_char_t *data,
|
549
|
+
const lxb_char_t *end)
|
550
|
+
{
|
551
|
+
switch (*data) {
|
552
|
+
/* U+002D HYPHEN-MINUS (-) */
|
553
|
+
case 0x2D:
|
554
|
+
lxb_html_tokenizer_state_append_m(tkz, data, 1);
|
555
|
+
|
556
|
+
tkz->state = lxb_html_tokenizer_state_script_data_escaped_dash_dash;
|
557
|
+
|
558
|
+
return (data + 1);
|
559
|
+
|
560
|
+
/* U+003C LESS-THAN SIGN (<) */
|
561
|
+
case 0x3C:
|
562
|
+
lxb_html_tokenizer_state_append_m(tkz, data, 1);
|
563
|
+
lxb_html_tokenizer_state_token_set_end(tkz, data);
|
564
|
+
|
565
|
+
tkz->state =
|
566
|
+
lxb_html_tokenizer_state_script_data_escaped_less_than_sign;
|
567
|
+
|
568
|
+
return (data + 1);
|
569
|
+
|
570
|
+
/*
|
571
|
+
* U+0000 NULL
|
572
|
+
* EOF
|
573
|
+
*/
|
574
|
+
case 0x00:
|
575
|
+
if (tkz->is_eof) {
|
576
|
+
lxb_html_tokenizer_error_add(tkz->parse_errors, tkz->last,
|
577
|
+
LXB_HTML_TOKENIZER_ERROR_EOINSCHTCOLITE);
|
578
|
+
|
579
|
+
tkz->token->tag_id = LXB_TAG__TEXT;
|
580
|
+
|
581
|
+
lxb_html_tokenizer_state_set_text(tkz);
|
582
|
+
lxb_html_tokenizer_state_token_set_end_oef(tkz);
|
583
|
+
lxb_html_tokenizer_state_token_done_m(tkz, end);
|
584
|
+
|
585
|
+
return end;
|
586
|
+
}
|
587
|
+
|
588
|
+
lxb_html_tokenizer_state_append_replace_m(tkz);
|
589
|
+
|
590
|
+
lxb_html_tokenizer_error_add(tkz->parse_errors, data,
|
591
|
+
LXB_HTML_TOKENIZER_ERROR_UNNUCH);
|
592
|
+
|
593
|
+
tkz->state = lxb_html_tokenizer_state_script_data_escaped;
|
594
|
+
|
595
|
+
return (data + 1);
|
596
|
+
|
597
|
+
default:
|
598
|
+
tkz->state = lxb_html_tokenizer_state_script_data_escaped;
|
599
|
+
|
600
|
+
return data;
|
601
|
+
}
|
602
|
+
}
|
603
|
+
|
604
|
+
/*
|
605
|
+
* 12.2.5.22 Script data escaped dash dash state
|
606
|
+
*/
|
607
|
+
static const lxb_char_t *
|
608
|
+
lxb_html_tokenizer_state_script_data_escaped_dash_dash(lxb_html_tokenizer_t *tkz,
|
609
|
+
const lxb_char_t *data,
|
610
|
+
const lxb_char_t *end)
|
611
|
+
{
|
612
|
+
switch (*data) {
|
613
|
+
/* U+002D HYPHEN-MINUS (-) */
|
614
|
+
case 0x2D:
|
615
|
+
lxb_html_tokenizer_state_append_m(tkz, "-", 1);
|
616
|
+
return (data + 1);
|
617
|
+
|
618
|
+
/* U+003C LESS-THAN SIGN (<) */
|
619
|
+
case 0x3C:
|
620
|
+
lxb_html_tokenizer_state_append_m(tkz, "<", 1);
|
621
|
+
lxb_html_tokenizer_state_token_set_end(tkz, data);
|
622
|
+
|
623
|
+
tkz->state =
|
624
|
+
lxb_html_tokenizer_state_script_data_escaped_less_than_sign;
|
625
|
+
|
626
|
+
return (data + 1);
|
627
|
+
|
628
|
+
/* U+003E GREATER-THAN SIGN (>) */
|
629
|
+
case 0x3E:
|
630
|
+
tkz->state = lxb_html_tokenizer_state_script_data;
|
631
|
+
return data;
|
632
|
+
|
633
|
+
default:
|
634
|
+
tkz->state = lxb_html_tokenizer_state_script_data_escaped;
|
635
|
+
return data;
|
636
|
+
}
|
637
|
+
}
|
638
|
+
|
639
|
+
/*
|
640
|
+
* 12.2.5.23 Script data escaped less-than sign state
|
641
|
+
*/
|
642
|
+
static const lxb_char_t *
|
643
|
+
lxb_html_tokenizer_state_script_data_escaped_less_than_sign(
|
644
|
+
lxb_html_tokenizer_t *tkz,
|
645
|
+
const lxb_char_t *data,
|
646
|
+
const lxb_char_t *end)
|
647
|
+
{
|
648
|
+
/* U+002F SOLIDUS (/) */
|
649
|
+
if (*data == 0x2F) {
|
650
|
+
tkz->state = lxb_html_tokenizer_state_script_data_escaped_end_tag_open;
|
651
|
+
|
652
|
+
return (data + 1);
|
653
|
+
}
|
654
|
+
|
655
|
+
/* ASCII alpha */
|
656
|
+
if (lexbor_str_res_alpha_character[*data] != LEXBOR_STR_RES_SLIP) {
|
657
|
+
tkz->entity_start = tkz->pos - tkz->start;
|
658
|
+
|
659
|
+
tkz->state = lxb_html_tokenizer_state_script_data_double_escape_start;
|
660
|
+
|
661
|
+
return data;
|
662
|
+
}
|
663
|
+
|
664
|
+
tkz->state = lxb_html_tokenizer_state_script_data_escaped;
|
665
|
+
|
666
|
+
return data;
|
667
|
+
}
|
668
|
+
|
669
|
+
/*
|
670
|
+
* 12.2.5.24 Script data escaped end tag open state
|
671
|
+
*/
|
672
|
+
static const lxb_char_t *
|
673
|
+
lxb_html_tokenizer_state_script_data_escaped_end_tag_open(lxb_html_tokenizer_t *tkz,
|
674
|
+
const lxb_char_t *data,
|
675
|
+
const lxb_char_t *end)
|
676
|
+
{
|
677
|
+
if (lexbor_str_res_alpha_character[*data] != LEXBOR_STR_RES_SLIP) {
|
678
|
+
tkz->temp = data;
|
679
|
+
tkz->entity_start = (tkz->pos - 1) - tkz->start;
|
680
|
+
|
681
|
+
tkz->state = lxb_html_tokenizer_state_script_data_escaped_end_tag_name;
|
682
|
+
}
|
683
|
+
else {
|
684
|
+
tkz->state = lxb_html_tokenizer_state_script_data_escaped;
|
685
|
+
}
|
686
|
+
|
687
|
+
lxb_html_tokenizer_state_append_m(tkz, "/", 1);
|
688
|
+
|
689
|
+
return data;
|
690
|
+
}
|
691
|
+
|
692
|
+
/*
|
693
|
+
* 12.2.5.25 Script data escaped end tag name state
|
694
|
+
*/
|
695
|
+
static const lxb_char_t *
|
696
|
+
lxb_html_tokenizer_state_script_data_escaped_end_tag_name(
|
697
|
+
lxb_html_tokenizer_t *tkz,
|
698
|
+
const lxb_char_t *data,
|
699
|
+
const lxb_char_t *end)
|
700
|
+
{
|
701
|
+
lxb_html_tokenizer_state_begin_set(tkz, data);
|
702
|
+
|
703
|
+
while (data != end) {
|
704
|
+
switch (*data) {
|
705
|
+
/*
|
706
|
+
* U+0009 CHARACTER TABULATION (tab)
|
707
|
+
* U+000A LINE FEED (LF)
|
708
|
+
* U+000C FORM FEED (FF)
|
709
|
+
* U+000D CARRIAGE RETURN (CR)
|
710
|
+
* U+0020 SPACE
|
711
|
+
*/
|
712
|
+
case 0x09:
|
713
|
+
case 0x0A:
|
714
|
+
case 0x0C:
|
715
|
+
case 0x0D:
|
716
|
+
case 0x20:
|
717
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data);
|
718
|
+
lxb_html_tokenizer_state_set_tag_m(tkz, &tkz->start[tkz->entity_start] + 2,
|
719
|
+
tkz->pos);
|
720
|
+
|
721
|
+
if (tkz->tmp_tag_id != tkz->token->tag_id) {
|
722
|
+
goto anything_else;
|
723
|
+
}
|
724
|
+
|
725
|
+
tkz->state = lxb_html_tokenizer_state_before_attribute_name;
|
726
|
+
|
727
|
+
goto done;
|
728
|
+
|
729
|
+
/* U+002F SOLIDUS (/) */
|
730
|
+
case 0x2F:
|
731
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data);
|
732
|
+
lxb_html_tokenizer_state_set_tag_m(tkz, &tkz->start[tkz->entity_start] + 2,
|
733
|
+
tkz->pos);
|
734
|
+
|
735
|
+
if (tkz->tmp_tag_id != tkz->token->tag_id) {
|
736
|
+
goto anything_else;
|
737
|
+
}
|
738
|
+
|
739
|
+
tkz->state = lxb_html_tokenizer_state_self_closing_start_tag;
|
740
|
+
|
741
|
+
goto done;
|
742
|
+
|
743
|
+
/* U+003E GREATER-THAN SIGN (>) */
|
744
|
+
case 0x3E:
|
745
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data);
|
746
|
+
lxb_html_tokenizer_state_set_tag_m(tkz, &tkz->start[tkz->entity_start] + 2,
|
747
|
+
tkz->pos);
|
748
|
+
|
749
|
+
if (tkz->tmp_tag_id != tkz->token->tag_id) {
|
750
|
+
goto anything_else;
|
751
|
+
}
|
752
|
+
|
753
|
+
tkz->state = lxb_html_tokenizer_state_data_before;
|
754
|
+
|
755
|
+
/* Emit text token */
|
756
|
+
tkz->token->tag_id = LXB_TAG__TEXT;
|
757
|
+
tkz->pos = &tkz->start[tkz->entity_start];
|
758
|
+
|
759
|
+
lxb_html_tokenizer_state_set_text(tkz);
|
760
|
+
lxb_html_tokenizer_state_token_done_m(tkz, end);
|
761
|
+
|
762
|
+
/* Init close token */
|
763
|
+
tkz->token->tag_id = tkz->tmp_tag_id;
|
764
|
+
tkz->token->begin = tkz->temp;
|
765
|
+
tkz->token->end = data;
|
766
|
+
tkz->token->type |= LXB_HTML_TOKEN_TYPE_CLOSE;
|
767
|
+
|
768
|
+
/* Emit close token */
|
769
|
+
lxb_html_tokenizer_state_token_done_m(tkz, end);
|
770
|
+
|
771
|
+
return (data + 1);
|
772
|
+
|
773
|
+
default:
|
774
|
+
if (lexbor_str_res_alpha_character[*data]
|
775
|
+
== LEXBOR_STR_RES_SLIP)
|
776
|
+
{
|
777
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data);
|
778
|
+
goto anything_else;
|
779
|
+
}
|
780
|
+
|
781
|
+
break;
|
782
|
+
}
|
783
|
+
|
784
|
+
data++;
|
785
|
+
}
|
786
|
+
|
787
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data);
|
788
|
+
|
789
|
+
return data;
|
790
|
+
|
791
|
+
anything_else:
|
792
|
+
|
793
|
+
tkz->state = lxb_html_tokenizer_state_script_data_escaped;
|
794
|
+
|
795
|
+
return data;
|
796
|
+
|
797
|
+
done:
|
798
|
+
|
799
|
+
/* Emit text token */
|
800
|
+
tkz->token->tag_id = LXB_TAG__TEXT;
|
801
|
+
tkz->pos = &tkz->start[tkz->entity_start];
|
802
|
+
|
803
|
+
lxb_html_tokenizer_state_set_text(tkz);
|
804
|
+
lxb_html_tokenizer_state_token_done_m(tkz, end);
|
805
|
+
|
806
|
+
/* Init close token */
|
807
|
+
tkz->token->tag_id = tkz->tmp_tag_id;
|
808
|
+
tkz->token->begin = tkz->temp;
|
809
|
+
tkz->token->end = data;
|
810
|
+
tkz->token->type |= LXB_HTML_TOKEN_TYPE_CLOSE;
|
811
|
+
|
812
|
+
return (data + 1);
|
813
|
+
}
|
814
|
+
|
815
|
+
/*
|
816
|
+
* 12.2.5.26 Script data double escape start state
|
817
|
+
*/
|
818
|
+
static const lxb_char_t *
|
819
|
+
lxb_html_tokenizer_state_script_data_double_escape_start(lxb_html_tokenizer_t *tkz,
|
820
|
+
const lxb_char_t *data,
|
821
|
+
const lxb_char_t *end)
|
822
|
+
{
|
823
|
+
lxb_html_tokenizer_state_begin_set(tkz, data);
|
824
|
+
|
825
|
+
while (data != end) {
|
826
|
+
switch (*data) {
|
827
|
+
/*
|
828
|
+
* U+0009 CHARACTER TABULATION (tab)
|
829
|
+
* U+000A LINE FEED (LF)
|
830
|
+
* U+000C FORM FEED (FF)
|
831
|
+
* U+000D CARRIAGE RETURN (CR)
|
832
|
+
* U+0020 SPACE
|
833
|
+
* U+002F SOLIDUS (/)
|
834
|
+
* U+003E GREATER-THAN SIGN (>)
|
835
|
+
*/
|
836
|
+
case 0x09:
|
837
|
+
case 0x0A:
|
838
|
+
case 0x0C:
|
839
|
+
case 0x0D:
|
840
|
+
case 0x20:
|
841
|
+
case 0x2F:
|
842
|
+
case 0x3E:
|
843
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data);
|
844
|
+
|
845
|
+
if ((tkz->pos - &tkz->start[tkz->entity_start]) == 6
|
846
|
+
&& lexbor_str_data_ncasecmp(&tkz->start[tkz->entity_start],
|
847
|
+
(const lxb_char_t *) "script", 6))
|
848
|
+
{
|
849
|
+
tkz->state =
|
850
|
+
lxb_html_tokenizer_state_script_data_double_escaped;
|
851
|
+
|
852
|
+
return data;
|
853
|
+
}
|
854
|
+
|
855
|
+
tkz->state = lxb_html_tokenizer_state_script_data_escaped;
|
856
|
+
|
857
|
+
return data;
|
858
|
+
|
859
|
+
default:
|
860
|
+
if (lexbor_str_res_alpha_character[*data]
|
861
|
+
== LEXBOR_STR_RES_SLIP)
|
862
|
+
{
|
863
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data);
|
864
|
+
|
865
|
+
tkz->state = lxb_html_tokenizer_state_script_data_escaped;
|
866
|
+
|
867
|
+
return data;
|
868
|
+
}
|
869
|
+
|
870
|
+
break;
|
871
|
+
}
|
872
|
+
|
873
|
+
data++;
|
874
|
+
}
|
875
|
+
|
876
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data);
|
877
|
+
|
878
|
+
return data;
|
879
|
+
}
|
880
|
+
|
881
|
+
/*
|
882
|
+
* 12.2.5.27 Script data double escaped state
|
883
|
+
*/
|
884
|
+
static const lxb_char_t *
|
885
|
+
lxb_html_tokenizer_state_script_data_double_escaped(lxb_html_tokenizer_t *tkz,
|
886
|
+
const lxb_char_t *data,
|
887
|
+
const lxb_char_t *end)
|
888
|
+
{
|
889
|
+
lxb_html_tokenizer_state_begin_set(tkz, data);
|
890
|
+
|
891
|
+
while (data != end) {
|
892
|
+
switch (*data) {
|
893
|
+
/* U+002D HYPHEN-MINUS (-) */
|
894
|
+
case 0x2D:
|
895
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data + 1);
|
896
|
+
|
897
|
+
tkz->state =
|
898
|
+
lxb_html_tokenizer_state_script_data_double_escaped_dash;
|
899
|
+
|
900
|
+
return (data + 1);
|
901
|
+
|
902
|
+
/* U+003C LESS-THAN SIGN (<) */
|
903
|
+
case 0x3C:
|
904
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data + 1);
|
905
|
+
|
906
|
+
tkz->state =
|
907
|
+
lxb_html_tokenizer_state_script_data_double_escaped_less_than_sign;
|
908
|
+
|
909
|
+
return (data + 1);
|
910
|
+
|
911
|
+
/* U+000D CARRIAGE RETURN (CR) */
|
912
|
+
case 0x0D:
|
913
|
+
if (++data >= end) {
|
914
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data - 1);
|
915
|
+
|
916
|
+
tkz->state = lxb_html_tokenizer_state_cr;
|
917
|
+
tkz->state_return = lxb_html_tokenizer_state_script_data_double_escaped;
|
918
|
+
|
919
|
+
return data;
|
920
|
+
}
|
921
|
+
|
922
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data);
|
923
|
+
tkz->pos[-1] = 0x0A;
|
924
|
+
|
925
|
+
lxb_html_tokenizer_state_begin_set(tkz, data + 1);
|
926
|
+
|
927
|
+
if (*data != 0x0A) {
|
928
|
+
lxb_html_tokenizer_state_begin_set(tkz, data);
|
929
|
+
data--;
|
930
|
+
}
|
931
|
+
|
932
|
+
break;
|
933
|
+
|
934
|
+
/*
|
935
|
+
* U+0000 NULL
|
936
|
+
* EOF
|
937
|
+
*/
|
938
|
+
case 0x00:
|
939
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data);
|
940
|
+
|
941
|
+
if (tkz->is_eof) {
|
942
|
+
lxb_html_tokenizer_error_add(tkz->parse_errors, tkz->last,
|
943
|
+
LXB_HTML_TOKENIZER_ERROR_EOINSCHTCOLITE);
|
944
|
+
|
945
|
+
tkz->token->tag_id = LXB_TAG__TEXT;
|
946
|
+
|
947
|
+
lxb_html_tokenizer_state_set_text(tkz);
|
948
|
+
lxb_html_tokenizer_state_token_set_end_oef(tkz);
|
949
|
+
lxb_html_tokenizer_state_token_done_m(tkz, end);
|
950
|
+
|
951
|
+
return end;
|
952
|
+
}
|
953
|
+
|
954
|
+
lxb_html_tokenizer_state_begin_set(tkz, data + 1);
|
955
|
+
lxb_html_tokenizer_state_append_replace_m(tkz);
|
956
|
+
|
957
|
+
lxb_html_tokenizer_error_add(tkz->parse_errors, data,
|
958
|
+
LXB_HTML_TOKENIZER_ERROR_UNNUCH);
|
959
|
+
break;
|
960
|
+
|
961
|
+
default:
|
962
|
+
break;
|
963
|
+
}
|
964
|
+
|
965
|
+
data++;
|
966
|
+
}
|
967
|
+
|
968
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data);
|
969
|
+
|
970
|
+
return data;
|
971
|
+
}
|
972
|
+
|
973
|
+
/*
|
974
|
+
* 12.2.5.28 Script data double escaped dash state
|
975
|
+
*/
|
976
|
+
static const lxb_char_t *
|
977
|
+
lxb_html_tokenizer_state_script_data_double_escaped_dash(lxb_html_tokenizer_t *tkz,
|
978
|
+
const lxb_char_t *data,
|
979
|
+
const lxb_char_t *end)
|
980
|
+
{
|
981
|
+
switch (*data) {
|
982
|
+
/* U+002D HYPHEN-MINUS (-) */
|
983
|
+
case 0x2D:
|
984
|
+
lxb_html_tokenizer_state_append_m(tkz, data, 1);
|
985
|
+
|
986
|
+
tkz->state =
|
987
|
+
lxb_html_tokenizer_state_script_data_double_escaped_dash_dash;
|
988
|
+
|
989
|
+
return (data + 1);
|
990
|
+
|
991
|
+
/* U+003C LESS-THAN SIGN (<) */
|
992
|
+
case 0x3C:
|
993
|
+
lxb_html_tokenizer_state_append_m(tkz, data, 1);
|
994
|
+
|
995
|
+
tkz->state =
|
996
|
+
lxb_html_tokenizer_state_script_data_double_escaped_less_than_sign;
|
997
|
+
|
998
|
+
return (data + 1);
|
999
|
+
|
1000
|
+
/*
|
1001
|
+
* U+0000 NULL
|
1002
|
+
* EOF
|
1003
|
+
*/
|
1004
|
+
case 0x00:
|
1005
|
+
if (tkz->is_eof) {
|
1006
|
+
lxb_html_tokenizer_error_add(tkz->parse_errors, tkz->last,
|
1007
|
+
LXB_HTML_TOKENIZER_ERROR_EOINSCHTCOLITE);
|
1008
|
+
|
1009
|
+
tkz->token->tag_id = LXB_TAG__TEXT;
|
1010
|
+
|
1011
|
+
lxb_html_tokenizer_state_set_text(tkz);
|
1012
|
+
lxb_html_tokenizer_state_token_set_end_oef(tkz);
|
1013
|
+
lxb_html_tokenizer_state_token_done_m(tkz, end);
|
1014
|
+
|
1015
|
+
return end;
|
1016
|
+
}
|
1017
|
+
|
1018
|
+
lxb_html_tokenizer_state_append_replace_m(tkz);
|
1019
|
+
|
1020
|
+
lxb_html_tokenizer_error_add(tkz->parse_errors, data,
|
1021
|
+
LXB_HTML_TOKENIZER_ERROR_UNNUCH);
|
1022
|
+
|
1023
|
+
tkz->state = lxb_html_tokenizer_state_script_data_double_escaped;
|
1024
|
+
|
1025
|
+
return (data + 1);
|
1026
|
+
|
1027
|
+
default:
|
1028
|
+
tkz->state = lxb_html_tokenizer_state_script_data_double_escaped;
|
1029
|
+
|
1030
|
+
return data;
|
1031
|
+
}
|
1032
|
+
}
|
1033
|
+
|
1034
|
+
/*
|
1035
|
+
* 12.2.5.29 Script data double escaped dash dash state
|
1036
|
+
*/
|
1037
|
+
static const lxb_char_t *
|
1038
|
+
lxb_html_tokenizer_state_script_data_double_escaped_dash_dash(
|
1039
|
+
lxb_html_tokenizer_t *tkz,
|
1040
|
+
const lxb_char_t *data,
|
1041
|
+
const lxb_char_t *end)
|
1042
|
+
{
|
1043
|
+
switch (*data) {
|
1044
|
+
/* U+002D HYPHEN-MINUS (-) */
|
1045
|
+
case 0x2D:
|
1046
|
+
lxb_html_tokenizer_state_append_m(tkz, data, 1);
|
1047
|
+
return (data + 1);
|
1048
|
+
|
1049
|
+
/* U+003C LESS-THAN SIGN (<) */
|
1050
|
+
case 0x3C:
|
1051
|
+
lxb_html_tokenizer_state_append_m(tkz, data, 1);
|
1052
|
+
|
1053
|
+
tkz->state =
|
1054
|
+
lxb_html_tokenizer_state_script_data_double_escaped_less_than_sign;
|
1055
|
+
|
1056
|
+
return (data + 1);
|
1057
|
+
|
1058
|
+
/* U+003E GREATER-THAN SIGN (>) */
|
1059
|
+
case 0x3E:
|
1060
|
+
lxb_html_tokenizer_state_append_m(tkz, data, 1);
|
1061
|
+
|
1062
|
+
tkz->state = lxb_html_tokenizer_state_script_data;
|
1063
|
+
|
1064
|
+
return (data + 1);
|
1065
|
+
|
1066
|
+
/*
|
1067
|
+
* U+0000 NULL
|
1068
|
+
* EOF
|
1069
|
+
*/
|
1070
|
+
case 0x00:
|
1071
|
+
if (tkz->is_eof) {
|
1072
|
+
lxb_html_tokenizer_error_add(tkz->parse_errors, tkz->last,
|
1073
|
+
LXB_HTML_TOKENIZER_ERROR_EOINSCHTCOLITE);
|
1074
|
+
|
1075
|
+
tkz->token->tag_id = LXB_TAG__TEXT;
|
1076
|
+
|
1077
|
+
lxb_html_tokenizer_state_set_text(tkz);
|
1078
|
+
lxb_html_tokenizer_state_token_set_end_oef(tkz);
|
1079
|
+
lxb_html_tokenizer_state_token_done_m(tkz, end);
|
1080
|
+
|
1081
|
+
return end;
|
1082
|
+
}
|
1083
|
+
|
1084
|
+
lxb_html_tokenizer_state_append_replace_m(tkz);
|
1085
|
+
|
1086
|
+
lxb_html_tokenizer_error_add(tkz->parse_errors, data,
|
1087
|
+
LXB_HTML_TOKENIZER_ERROR_UNNUCH);
|
1088
|
+
|
1089
|
+
tkz->state = lxb_html_tokenizer_state_script_data_double_escaped;
|
1090
|
+
|
1091
|
+
return (data + 1);
|
1092
|
+
|
1093
|
+
default:
|
1094
|
+
tkz->state = lxb_html_tokenizer_state_script_data_double_escaped;
|
1095
|
+
|
1096
|
+
return data;
|
1097
|
+
}
|
1098
|
+
|
1099
|
+
return data;
|
1100
|
+
}
|
1101
|
+
|
1102
|
+
/*
|
1103
|
+
* 12.2.5.30 Script data double escaped less-than sign state
|
1104
|
+
*/
|
1105
|
+
static const lxb_char_t *
|
1106
|
+
lxb_html_tokenizer_state_script_data_double_escaped_less_than_sign(
|
1107
|
+
lxb_html_tokenizer_t *tkz,
|
1108
|
+
const lxb_char_t *data,
|
1109
|
+
const lxb_char_t *end)
|
1110
|
+
{
|
1111
|
+
/* U+002F SOLIDUS (/) */
|
1112
|
+
if (*data == 0x2F) {
|
1113
|
+
tkz->state =
|
1114
|
+
lxb_html_tokenizer_state_script_data_double_escaped_end_tag_open;
|
1115
|
+
|
1116
|
+
return (data + 1);
|
1117
|
+
}
|
1118
|
+
|
1119
|
+
tkz->state = lxb_html_tokenizer_state_script_data_double_escaped;
|
1120
|
+
|
1121
|
+
return data;
|
1122
|
+
}
|
1123
|
+
|
1124
|
+
/*
|
1125
|
+
* 12.2.5.30.5 Helper function. No in the specification.
|
1126
|
+
*/
|
1127
|
+
static const lxb_char_t *
|
1128
|
+
lxb_html_tokenizer_state_script_data_double_escaped_end_tag_open(
|
1129
|
+
lxb_html_tokenizer_t *tkz,
|
1130
|
+
const lxb_char_t *data,
|
1131
|
+
const lxb_char_t *end)
|
1132
|
+
{
|
1133
|
+
if (lexbor_str_res_alpha_character[*data] != LEXBOR_STR_RES_SLIP) {
|
1134
|
+
tkz->entity_start = (tkz->pos + 1) - tkz->start;
|
1135
|
+
|
1136
|
+
tkz->state = lxb_html_tokenizer_state_script_data_double_escape_end;
|
1137
|
+
}
|
1138
|
+
else {
|
1139
|
+
tkz->state = lxb_html_tokenizer_state_script_data_double_escaped;
|
1140
|
+
}
|
1141
|
+
|
1142
|
+
lxb_html_tokenizer_state_append_m(tkz, "/", 1);
|
1143
|
+
|
1144
|
+
return data;
|
1145
|
+
}
|
1146
|
+
|
1147
|
+
/*
|
1148
|
+
* 12.2.5.31 Script data double escape end state
|
1149
|
+
*/
|
1150
|
+
static const lxb_char_t *
|
1151
|
+
lxb_html_tokenizer_state_script_data_double_escape_end(
|
1152
|
+
lxb_html_tokenizer_t *tkz,
|
1153
|
+
const lxb_char_t *data,
|
1154
|
+
const lxb_char_t *end)
|
1155
|
+
{
|
1156
|
+
lxb_html_tokenizer_state_begin_set(tkz, data);
|
1157
|
+
|
1158
|
+
while (data != end) {
|
1159
|
+
switch (*data) {
|
1160
|
+
/*
|
1161
|
+
* U+0009 CHARACTER TABULATION (tab)
|
1162
|
+
* U+000A LINE FEED (LF)
|
1163
|
+
* U+000C FORM FEED (FF)
|
1164
|
+
* U+000D CARRIAGE RETURN (CR)
|
1165
|
+
* U+0020 SPACE
|
1166
|
+
* U+002F SOLIDUS (/)
|
1167
|
+
* U+003E GREATER-THAN SIGN (>)
|
1168
|
+
*/
|
1169
|
+
case 0x09:
|
1170
|
+
case 0x0A:
|
1171
|
+
case 0x0C:
|
1172
|
+
case 0x0D:
|
1173
|
+
case 0x20:
|
1174
|
+
case 0x2F:
|
1175
|
+
case 0x3E:
|
1176
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data);
|
1177
|
+
|
1178
|
+
if ((tkz->pos - &tkz->start[tkz->entity_start]) == 6
|
1179
|
+
&& lexbor_str_data_ncasecmp(&tkz->start[tkz->entity_start],
|
1180
|
+
(const lxb_char_t *) "script", 6))
|
1181
|
+
{
|
1182
|
+
tkz->state = lxb_html_tokenizer_state_script_data_escaped;
|
1183
|
+
return data;
|
1184
|
+
}
|
1185
|
+
|
1186
|
+
tkz->state = lxb_html_tokenizer_state_script_data_double_escaped;
|
1187
|
+
|
1188
|
+
return data;
|
1189
|
+
|
1190
|
+
default:
|
1191
|
+
if (lexbor_str_res_alpha_character[*data]
|
1192
|
+
== LEXBOR_STR_RES_SLIP)
|
1193
|
+
{
|
1194
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data);
|
1195
|
+
|
1196
|
+
tkz->state = lxb_html_tokenizer_state_script_data_double_escaped;
|
1197
|
+
return data;
|
1198
|
+
}
|
1199
|
+
|
1200
|
+
break;
|
1201
|
+
}
|
1202
|
+
|
1203
|
+
data++;
|
1204
|
+
}
|
1205
|
+
|
1206
|
+
lxb_html_tokenizer_state_append_data_m(tkz, data);
|
1207
|
+
|
1208
|
+
return data;
|
1209
|
+
}
|