Nokogiri_precompiled_aarch64_dedshit 1.14.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +44 -0
- data/LICENSE-DEPENDENCIES.md +2224 -0
- data/LICENSE.md +9 -0
- data/README.md +287 -0
- data/bin/nokogiri +131 -0
- data/dependencies.yml +41 -0
- data/ext/java/nokogiri/Html4Document.java +157 -0
- data/ext/java/nokogiri/Html4ElementDescription.java +133 -0
- data/ext/java/nokogiri/Html4EntityLookup.java +63 -0
- data/ext/java/nokogiri/Html4SaxParserContext.java +289 -0
- data/ext/java/nokogiri/Html4SaxPushParser.java +213 -0
- data/ext/java/nokogiri/NokogiriService.java +613 -0
- data/ext/java/nokogiri/XmlAttr.java +154 -0
- data/ext/java/nokogiri/XmlAttributeDecl.java +119 -0
- data/ext/java/nokogiri/XmlCdata.java +60 -0
- data/ext/java/nokogiri/XmlComment.java +77 -0
- data/ext/java/nokogiri/XmlDocument.java +705 -0
- data/ext/java/nokogiri/XmlDocumentFragment.java +163 -0
- data/ext/java/nokogiri/XmlDtd.java +516 -0
- data/ext/java/nokogiri/XmlElement.java +44 -0
- data/ext/java/nokogiri/XmlElementContent.java +412 -0
- data/ext/java/nokogiri/XmlElementDecl.java +148 -0
- data/ext/java/nokogiri/XmlEntityDecl.java +151 -0
- data/ext/java/nokogiri/XmlEntityReference.java +79 -0
- data/ext/java/nokogiri/XmlNamespace.java +193 -0
- data/ext/java/nokogiri/XmlNode.java +1938 -0
- data/ext/java/nokogiri/XmlNodeSet.java +463 -0
- data/ext/java/nokogiri/XmlProcessingInstruction.java +79 -0
- data/ext/java/nokogiri/XmlReader.java +615 -0
- data/ext/java/nokogiri/XmlRelaxng.java +133 -0
- data/ext/java/nokogiri/XmlSaxParserContext.java +329 -0
- data/ext/java/nokogiri/XmlSaxPushParser.java +288 -0
- data/ext/java/nokogiri/XmlSchema.java +423 -0
- data/ext/java/nokogiri/XmlSyntaxError.java +137 -0
- data/ext/java/nokogiri/XmlText.java +90 -0
- data/ext/java/nokogiri/XmlXpathContext.java +305 -0
- data/ext/java/nokogiri/XsltStylesheet.java +368 -0
- data/ext/java/nokogiri/internals/ClosedStreamException.java +13 -0
- data/ext/java/nokogiri/internals/HtmlDomParserContext.java +252 -0
- data/ext/java/nokogiri/internals/IgnoreSchemaErrorsErrorHandler.java +27 -0
- data/ext/java/nokogiri/internals/NokogiriBlockingQueueInputStream.java +178 -0
- data/ext/java/nokogiri/internals/NokogiriDomParser.java +99 -0
- data/ext/java/nokogiri/internals/NokogiriEntityResolver.java +140 -0
- data/ext/java/nokogiri/internals/NokogiriErrorHandler.java +65 -0
- data/ext/java/nokogiri/internals/NokogiriHandler.java +339 -0
- data/ext/java/nokogiri/internals/NokogiriHelpers.java +817 -0
- data/ext/java/nokogiri/internals/NokogiriNamespaceCache.java +228 -0
- data/ext/java/nokogiri/internals/NokogiriNamespaceContext.java +110 -0
- data/ext/java/nokogiri/internals/NokogiriNonStrictErrorHandler.java +86 -0
- data/ext/java/nokogiri/internals/NokogiriNonStrictErrorHandler4NekoHtml.java +107 -0
- data/ext/java/nokogiri/internals/NokogiriStrictErrorHandler.java +62 -0
- data/ext/java/nokogiri/internals/NokogiriXPathFunction.java +165 -0
- data/ext/java/nokogiri/internals/NokogiriXPathFunctionResolver.java +50 -0
- data/ext/java/nokogiri/internals/NokogiriXPathVariableResolver.java +37 -0
- data/ext/java/nokogiri/internals/NokogiriXsltErrorListener.java +70 -0
- data/ext/java/nokogiri/internals/ParserContext.java +262 -0
- data/ext/java/nokogiri/internals/ReaderNode.java +564 -0
- data/ext/java/nokogiri/internals/SaveContextVisitor.java +865 -0
- data/ext/java/nokogiri/internals/SchemaErrorHandler.java +50 -0
- data/ext/java/nokogiri/internals/XalanDTMManagerPatch.java +174 -0
- data/ext/java/nokogiri/internals/XmlDeclHandler.java +11 -0
- data/ext/java/nokogiri/internals/XmlDomParserContext.java +265 -0
- data/ext/java/nokogiri/internals/XmlSaxParser.java +40 -0
- data/ext/java/nokogiri/internals/c14n/AttrCompare.java +122 -0
- data/ext/java/nokogiri/internals/c14n/C14nHelper.java +178 -0
- data/ext/java/nokogiri/internals/c14n/CanonicalFilter.java +43 -0
- data/ext/java/nokogiri/internals/c14n/CanonicalizationException.java +106 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer.java +278 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer11.java +664 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer11_OmitComments.java +45 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer11_WithComments.java +45 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315.java +388 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315Excl.java +308 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315ExclOmitComments.java +47 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315ExclWithComments.java +51 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315OmitComments.java +51 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315WithComments.java +50 -0
- data/ext/java/nokogiri/internals/c14n/CanonicalizerBase.java +660 -0
- data/ext/java/nokogiri/internals/c14n/CanonicalizerPhysical.java +194 -0
- data/ext/java/nokogiri/internals/c14n/CanonicalizerSpi.java +77 -0
- data/ext/java/nokogiri/internals/c14n/Constants.java +45 -0
- data/ext/java/nokogiri/internals/c14n/ElementProxy.java +325 -0
- data/ext/java/nokogiri/internals/c14n/HelperNodeList.java +106 -0
- data/ext/java/nokogiri/internals/c14n/IgnoreAllErrorHandler.java +86 -0
- data/ext/java/nokogiri/internals/c14n/InclusiveNamespaces.java +181 -0
- data/ext/java/nokogiri/internals/c14n/InvalidCanonicalizerException.java +87 -0
- data/ext/java/nokogiri/internals/c14n/NameSpaceSymbTable.java +452 -0
- data/ext/java/nokogiri/internals/c14n/NodeFilter.java +52 -0
- data/ext/java/nokogiri/internals/c14n/UtfHelpper.java +190 -0
- data/ext/java/nokogiri/internals/c14n/XMLUtils.java +540 -0
- data/ext/java/nokogiri/internals/dom2dtm/DOM2DTM.java +1712 -0
- data/ext/java/nokogiri/internals/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java +737 -0
- data/ext/nokogiri/depend +38 -0
- data/ext/nokogiri/extconf.rb +1086 -0
- data/ext/nokogiri/gumbo.c +594 -0
- data/ext/nokogiri/html4_document.c +167 -0
- data/ext/nokogiri/html4_element_description.c +294 -0
- data/ext/nokogiri/html4_entity_lookup.c +37 -0
- data/ext/nokogiri/html4_sax_parser_context.c +116 -0
- data/ext/nokogiri/html4_sax_push_parser.c +95 -0
- data/ext/nokogiri/libxml2_backwards_compat.c +121 -0
- data/ext/nokogiri/nokogiri.c +265 -0
- data/ext/nokogiri/nokogiri.h +235 -0
- data/ext/nokogiri/test_global_handlers.c +42 -0
- data/ext/nokogiri/xml_attr.c +103 -0
- data/ext/nokogiri/xml_attribute_decl.c +70 -0
- data/ext/nokogiri/xml_cdata.c +57 -0
- data/ext/nokogiri/xml_comment.c +62 -0
- data/ext/nokogiri/xml_document.c +689 -0
- data/ext/nokogiri/xml_document_fragment.c +44 -0
- data/ext/nokogiri/xml_dtd.c +210 -0
- data/ext/nokogiri/xml_element_content.c +128 -0
- data/ext/nokogiri/xml_element_decl.c +69 -0
- data/ext/nokogiri/xml_encoding_handler.c +104 -0
- data/ext/nokogiri/xml_entity_decl.c +112 -0
- data/ext/nokogiri/xml_entity_reference.c +50 -0
- data/ext/nokogiri/xml_namespace.c +186 -0
- data/ext/nokogiri/xml_node.c +2426 -0
- data/ext/nokogiri/xml_node_set.c +496 -0
- data/ext/nokogiri/xml_processing_instruction.c +54 -0
- data/ext/nokogiri/xml_reader.c +794 -0
- data/ext/nokogiri/xml_relax_ng.c +164 -0
- data/ext/nokogiri/xml_sax_parser.c +316 -0
- data/ext/nokogiri/xml_sax_parser_context.c +283 -0
- data/ext/nokogiri/xml_sax_push_parser.c +166 -0
- data/ext/nokogiri/xml_schema.c +260 -0
- data/ext/nokogiri/xml_syntax_error.c +85 -0
- data/ext/nokogiri/xml_text.c +48 -0
- data/ext/nokogiri/xml_xpath_context.c +415 -0
- data/ext/nokogiri/xslt_stylesheet.c +363 -0
- data/gumbo-parser/CHANGES.md +63 -0
- data/gumbo-parser/Makefile +111 -0
- data/gumbo-parser/THANKS +27 -0
- data/gumbo-parser/src/Makefile +34 -0
- data/gumbo-parser/src/README.md +41 -0
- data/gumbo-parser/src/ascii.c +75 -0
- data/gumbo-parser/src/ascii.h +115 -0
- data/gumbo-parser/src/attribute.c +42 -0
- data/gumbo-parser/src/attribute.h +17 -0
- data/gumbo-parser/src/char_ref.c +22225 -0
- data/gumbo-parser/src/char_ref.h +29 -0
- data/gumbo-parser/src/char_ref.rl +2154 -0
- data/gumbo-parser/src/error.c +626 -0
- data/gumbo-parser/src/error.h +148 -0
- data/gumbo-parser/src/foreign_attrs.c +104 -0
- data/gumbo-parser/src/foreign_attrs.gperf +27 -0
- data/gumbo-parser/src/insertion_mode.h +33 -0
- data/gumbo-parser/src/macros.h +91 -0
- data/gumbo-parser/src/nokogiri_gumbo.h +944 -0
- data/gumbo-parser/src/parser.c +4878 -0
- data/gumbo-parser/src/parser.h +41 -0
- data/gumbo-parser/src/replacement.h +33 -0
- data/gumbo-parser/src/string_buffer.c +103 -0
- data/gumbo-parser/src/string_buffer.h +68 -0
- data/gumbo-parser/src/string_piece.c +48 -0
- data/gumbo-parser/src/svg_attrs.c +174 -0
- data/gumbo-parser/src/svg_attrs.gperf +77 -0
- data/gumbo-parser/src/svg_tags.c +137 -0
- data/gumbo-parser/src/svg_tags.gperf +55 -0
- data/gumbo-parser/src/tag.c +223 -0
- data/gumbo-parser/src/tag_lookup.c +382 -0
- data/gumbo-parser/src/tag_lookup.gperf +170 -0
- data/gumbo-parser/src/tag_lookup.h +13 -0
- data/gumbo-parser/src/token_buffer.c +79 -0
- data/gumbo-parser/src/token_buffer.h +71 -0
- data/gumbo-parser/src/token_type.h +17 -0
- data/gumbo-parser/src/tokenizer.c +3463 -0
- data/gumbo-parser/src/tokenizer.h +112 -0
- data/gumbo-parser/src/tokenizer_states.h +339 -0
- data/gumbo-parser/src/utf8.c +245 -0
- data/gumbo-parser/src/utf8.h +164 -0
- data/gumbo-parser/src/util.c +66 -0
- data/gumbo-parser/src/util.h +34 -0
- data/gumbo-parser/src/vector.c +111 -0
- data/gumbo-parser/src/vector.h +45 -0
- data/lib/nokogiri/class_resolver.rb +67 -0
- data/lib/nokogiri/css/node.rb +54 -0
- data/lib/nokogiri/css/parser.rb +770 -0
- data/lib/nokogiri/css/parser.y +277 -0
- data/lib/nokogiri/css/parser_extras.rb +96 -0
- data/lib/nokogiri/css/syntax_error.rb +9 -0
- data/lib/nokogiri/css/tokenizer.rb +155 -0
- data/lib/nokogiri/css/tokenizer.rex +56 -0
- data/lib/nokogiri/css/xpath_visitor.rb +359 -0
- data/lib/nokogiri/css.rb +66 -0
- data/lib/nokogiri/decorators/slop.rb +44 -0
- data/lib/nokogiri/encoding_handler.rb +57 -0
- data/lib/nokogiri/extension.rb +32 -0
- data/lib/nokogiri/gumbo.rb +15 -0
- data/lib/nokogiri/html.rb +48 -0
- data/lib/nokogiri/html4/builder.rb +37 -0
- data/lib/nokogiri/html4/document.rb +214 -0
- data/lib/nokogiri/html4/document_fragment.rb +54 -0
- data/lib/nokogiri/html4/element_description.rb +25 -0
- data/lib/nokogiri/html4/element_description_defaults.rb +572 -0
- data/lib/nokogiri/html4/encoding_reader.rb +121 -0
- data/lib/nokogiri/html4/entity_lookup.rb +15 -0
- data/lib/nokogiri/html4/sax/parser.rb +63 -0
- data/lib/nokogiri/html4/sax/parser_context.rb +20 -0
- data/lib/nokogiri/html4/sax/push_parser.rb +37 -0
- data/lib/nokogiri/html4.rb +47 -0
- data/lib/nokogiri/html5/document.rb +168 -0
- data/lib/nokogiri/html5/document_fragment.rb +90 -0
- data/lib/nokogiri/html5/node.rb +98 -0
- data/lib/nokogiri/html5.rb +389 -0
- data/lib/nokogiri/jruby/dependencies.rb +3 -0
- data/lib/nokogiri/jruby/isorelax/isorelax/20030108/isorelax-20030108.jar +0 -0
- data/lib/nokogiri/jruby/net/sf/saxon/Saxon-HE/9.6.0-4/Saxon-HE-9.6.0-4.jar +0 -0
- data/lib/nokogiri/jruby/net/sourceforge/htmlunit/neko-htmlunit/2.63.0/neko-htmlunit-2.63.0.jar +0 -0
- data/lib/nokogiri/jruby/nokogiri_jars.rb +43 -0
- data/lib/nokogiri/jruby/nu/validator/jing/20200702VNU/jing-20200702VNU.jar +0 -0
- data/lib/nokogiri/jruby/org/nokogiri/nekodtd/0.1.11.noko2/nekodtd-0.1.11.noko2.jar +0 -0
- data/lib/nokogiri/jruby/xalan/serializer/2.7.3/serializer-2.7.3.jar +0 -0
- data/lib/nokogiri/jruby/xalan/xalan/2.7.3/xalan-2.7.3.jar +0 -0
- data/lib/nokogiri/jruby/xerces/xercesImpl/2.12.2/xercesImpl-2.12.2.jar +0 -0
- data/lib/nokogiri/jruby/xml-apis/xml-apis/1.4.01/xml-apis-1.4.01.jar +0 -0
- data/lib/nokogiri/syntax_error.rb +6 -0
- data/lib/nokogiri/version/constant.rb +6 -0
- data/lib/nokogiri/version/info.rb +223 -0
- data/lib/nokogiri/version.rb +4 -0
- data/lib/nokogiri/xml/attr.rb +66 -0
- data/lib/nokogiri/xml/attribute_decl.rb +20 -0
- data/lib/nokogiri/xml/builder.rb +487 -0
- data/lib/nokogiri/xml/cdata.rb +13 -0
- data/lib/nokogiri/xml/character_data.rb +9 -0
- data/lib/nokogiri/xml/document.rb +471 -0
- data/lib/nokogiri/xml/document_fragment.rb +205 -0
- data/lib/nokogiri/xml/dtd.rb +34 -0
- data/lib/nokogiri/xml/element_content.rb +38 -0
- data/lib/nokogiri/xml/element_decl.rb +15 -0
- data/lib/nokogiri/xml/entity_decl.rb +21 -0
- data/lib/nokogiri/xml/entity_reference.rb +20 -0
- data/lib/nokogiri/xml/namespace.rb +58 -0
- data/lib/nokogiri/xml/node/save_options.rb +68 -0
- data/lib/nokogiri/xml/node.rb +1563 -0
- data/lib/nokogiri/xml/node_set.rb +447 -0
- data/lib/nokogiri/xml/notation.rb +19 -0
- data/lib/nokogiri/xml/parse_options.rb +213 -0
- data/lib/nokogiri/xml/pp/character_data.rb +21 -0
- data/lib/nokogiri/xml/pp/node.rb +57 -0
- data/lib/nokogiri/xml/pp.rb +4 -0
- data/lib/nokogiri/xml/processing_instruction.rb +11 -0
- data/lib/nokogiri/xml/reader.rb +105 -0
- data/lib/nokogiri/xml/relax_ng.rb +38 -0
- data/lib/nokogiri/xml/sax/document.rb +167 -0
- data/lib/nokogiri/xml/sax/parser.rb +125 -0
- data/lib/nokogiri/xml/sax/parser_context.rb +21 -0
- data/lib/nokogiri/xml/sax/push_parser.rb +61 -0
- data/lib/nokogiri/xml/sax.rb +6 -0
- data/lib/nokogiri/xml/schema.rb +73 -0
- data/lib/nokogiri/xml/searchable.rb +270 -0
- data/lib/nokogiri/xml/syntax_error.rb +72 -0
- data/lib/nokogiri/xml/text.rb +11 -0
- data/lib/nokogiri/xml/xpath/syntax_error.rb +13 -0
- data/lib/nokogiri/xml/xpath.rb +21 -0
- data/lib/nokogiri/xml/xpath_context.rb +16 -0
- data/lib/nokogiri/xml.rb +76 -0
- data/lib/nokogiri/xslt/stylesheet.rb +27 -0
- data/lib/nokogiri/xslt.rb +65 -0
- data/lib/nokogiri.rb +120 -0
- data/lib/xsd/xmlparser/nokogiri.rb +106 -0
- metadata +391 -0
@@ -0,0 +1,41 @@
|
|
1
|
+
#ifndef GUMBO_PARSER_H_
|
2
|
+
#define GUMBO_PARSER_H_
|
3
|
+
|
4
|
+
#ifdef __cplusplus
|
5
|
+
extern "C" {
|
6
|
+
#endif
|
7
|
+
|
8
|
+
// Contains the definition of the top-level GumboParser structure that's
|
9
|
+
// threaded through basically every internal function in the library.
|
10
|
+
|
11
|
+
struct GumboInternalParserState;
|
12
|
+
struct GumboInternalOutput;
|
13
|
+
struct GumboInternalOptions;
|
14
|
+
struct GumboInternalTokenizerState;
|
15
|
+
|
16
|
+
// An overarching struct that's threaded through (nearly) all functions in the
|
17
|
+
// library, OOP-style. This gives each function access to the options and
|
18
|
+
// output, along with any internal state needed for the parse.
|
19
|
+
typedef struct GumboInternalParser {
|
20
|
+
// Settings for this parse run.
|
21
|
+
const struct GumboInternalOptions* _options;
|
22
|
+
|
23
|
+
// Output for the parse.
|
24
|
+
struct GumboInternalOutput* _output;
|
25
|
+
|
26
|
+
// The internal tokenizer state, defined as a pointer to avoid a cyclic
|
27
|
+
// dependency on html5tokenizer.h. The main parse routine is responsible for
|
28
|
+
// initializing this on parse start, and destroying it on parse end.
|
29
|
+
// End-users will never see a non-garbage value in this pointer.
|
30
|
+
struct GumboInternalTokenizerState* _tokenizer_state;
|
31
|
+
|
32
|
+
// The internal parser state. Initialized on parse start and destroyed on
|
33
|
+
// parse end; end-users will never see a non-garbage value in this pointer.
|
34
|
+
struct GumboInternalParserState* _parser_state;
|
35
|
+
} GumboParser;
|
36
|
+
|
37
|
+
#ifdef __cplusplus
|
38
|
+
}
|
39
|
+
#endif
|
40
|
+
|
41
|
+
#endif // GUMBO_PARSER_H_
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#ifndef GUMBO_REPLACEMENT_H_
|
2
|
+
#define GUMBO_REPLACEMENT_H_
|
3
|
+
|
4
|
+
#include <stddef.h>
|
5
|
+
#include "nokogiri_gumbo.h"
|
6
|
+
|
7
|
+
typedef struct {
|
8
|
+
const char *const from;
|
9
|
+
const char *const to;
|
10
|
+
} StringReplacement;
|
11
|
+
|
12
|
+
const StringReplacement *gumbo_get_svg_tag_replacement (
|
13
|
+
const char* str,
|
14
|
+
size_t len
|
15
|
+
);
|
16
|
+
|
17
|
+
const StringReplacement *gumbo_get_svg_attr_replacement (
|
18
|
+
const char* str,
|
19
|
+
size_t len
|
20
|
+
);
|
21
|
+
|
22
|
+
typedef struct {
|
23
|
+
const char *const from;
|
24
|
+
const char *const local_name;
|
25
|
+
const GumboAttributeNamespaceEnum attr_namespace;
|
26
|
+
} ForeignAttrReplacement;
|
27
|
+
|
28
|
+
const ForeignAttrReplacement *gumbo_get_foreign_attr_replacement (
|
29
|
+
const char* str,
|
30
|
+
size_t len
|
31
|
+
);
|
32
|
+
|
33
|
+
#endif // GUMBO_REPLACEMENT_H_
|
@@ -0,0 +1,103 @@
|
|
1
|
+
/*
|
2
|
+
Copyright 2010 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 <string.h>
|
18
|
+
#include "string_buffer.h"
|
19
|
+
#include "util.h"
|
20
|
+
|
21
|
+
// Size chosen via statistical analysis of ~60K websites.
|
22
|
+
// 99% of text nodes and 98% of attribute names/values fit in this initial size.
|
23
|
+
static const size_t kDefaultStringBufferSize = 5;
|
24
|
+
|
25
|
+
static void maybe_resize_string_buffer (
|
26
|
+
size_t additional_chars,
|
27
|
+
GumboStringBuffer* buffer
|
28
|
+
) {
|
29
|
+
size_t new_length = buffer->length + additional_chars;
|
30
|
+
size_t new_capacity = buffer->capacity;
|
31
|
+
while (new_capacity < new_length) {
|
32
|
+
new_capacity *= 2;
|
33
|
+
}
|
34
|
+
if (new_capacity != buffer->capacity) {
|
35
|
+
buffer->data = gumbo_realloc(buffer->data, new_capacity);
|
36
|
+
buffer->capacity = new_capacity;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
void gumbo_string_buffer_init(GumboStringBuffer* output) {
|
41
|
+
output->data = gumbo_alloc(kDefaultStringBufferSize);
|
42
|
+
output->length = 0;
|
43
|
+
output->capacity = kDefaultStringBufferSize;
|
44
|
+
}
|
45
|
+
|
46
|
+
void gumbo_string_buffer_reserve (
|
47
|
+
size_t min_capacity,
|
48
|
+
GumboStringBuffer* output
|
49
|
+
) {
|
50
|
+
maybe_resize_string_buffer(min_capacity - output->length, output);
|
51
|
+
}
|
52
|
+
|
53
|
+
void gumbo_string_buffer_append_codepoint (
|
54
|
+
int c,
|
55
|
+
GumboStringBuffer* output
|
56
|
+
) {
|
57
|
+
// num_bytes is actually the number of continuation bytes, 1 less than the
|
58
|
+
// total number of bytes. This is done to keep the loop below simple and
|
59
|
+
// should probably change if we unroll it.
|
60
|
+
int num_bytes, prefix;
|
61
|
+
if (c <= 0x7f) {
|
62
|
+
num_bytes = 0;
|
63
|
+
prefix = 0;
|
64
|
+
} else if (c <= 0x7ff) {
|
65
|
+
num_bytes = 1;
|
66
|
+
prefix = 0xc0;
|
67
|
+
} else if (c <= 0xffff) {
|
68
|
+
num_bytes = 2;
|
69
|
+
prefix = 0xe0;
|
70
|
+
} else {
|
71
|
+
num_bytes = 3;
|
72
|
+
prefix = 0xf0;
|
73
|
+
}
|
74
|
+
maybe_resize_string_buffer(num_bytes + 1, output);
|
75
|
+
output->data[output->length++] = prefix | (c >> (num_bytes * 6));
|
76
|
+
for (int i = num_bytes - 1; i >= 0; --i) {
|
77
|
+
output->data[output->length++] = 0x80 | (0x3f & (c >> (i * 6)));
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
void gumbo_string_buffer_append_string (
|
82
|
+
const GumboStringPiece* str,
|
83
|
+
GumboStringBuffer* output
|
84
|
+
) {
|
85
|
+
maybe_resize_string_buffer(str->length, output);
|
86
|
+
memcpy(output->data + output->length, str->data, str->length);
|
87
|
+
output->length += str->length;
|
88
|
+
}
|
89
|
+
|
90
|
+
char* gumbo_string_buffer_to_string(const GumboStringBuffer* input) {
|
91
|
+
char* buffer = gumbo_alloc(input->length + 1);
|
92
|
+
memcpy(buffer, input->data, input->length);
|
93
|
+
buffer[input->length] = '\0';
|
94
|
+
return buffer;
|
95
|
+
}
|
96
|
+
|
97
|
+
void gumbo_string_buffer_clear(GumboStringBuffer* input) {
|
98
|
+
input->length = 0;
|
99
|
+
}
|
100
|
+
|
101
|
+
void gumbo_string_buffer_destroy(GumboStringBuffer* buffer) {
|
102
|
+
gumbo_free(buffer->data);
|
103
|
+
}
|
@@ -0,0 +1,68 @@
|
|
1
|
+
#ifndef GUMBO_STRING_BUFFER_H_
|
2
|
+
#define GUMBO_STRING_BUFFER_H_
|
3
|
+
|
4
|
+
#include <stdbool.h>
|
5
|
+
#include <stddef.h>
|
6
|
+
|
7
|
+
#include "nokogiri_gumbo.h"
|
8
|
+
|
9
|
+
#ifdef __cplusplus
|
10
|
+
extern "C" {
|
11
|
+
#endif
|
12
|
+
|
13
|
+
// A struct representing a mutable, growable string. This consists of a
|
14
|
+
// heap-allocated buffer that may grow (by doubling) as necessary. When
|
15
|
+
// converting to a string, this allocates a new buffer that is only as long as
|
16
|
+
// it needs to be. Note that the internal buffer here is *not* nul-terminated,
|
17
|
+
// so be sure not to use ordinary string manipulation functions on it.
|
18
|
+
typedef struct {
|
19
|
+
// A pointer to the beginning of the string. NULL if length == 0.
|
20
|
+
char* data;
|
21
|
+
|
22
|
+
// The length of the string fragment, in bytes. May be zero.
|
23
|
+
size_t length;
|
24
|
+
|
25
|
+
// The capacity of the buffer, in bytes.
|
26
|
+
size_t capacity;
|
27
|
+
} GumboStringBuffer;
|
28
|
+
|
29
|
+
// Initializes a new GumboStringBuffer.
|
30
|
+
void gumbo_string_buffer_init(GumboStringBuffer* output);
|
31
|
+
|
32
|
+
// Ensures that the buffer contains at least a certain amount of space. Most
|
33
|
+
// useful with snprintf and the other length-delimited string functions, which
|
34
|
+
// may want to write directly into the buffer.
|
35
|
+
void gumbo_string_buffer_reserve (
|
36
|
+
size_t min_capacity,
|
37
|
+
GumboStringBuffer* output
|
38
|
+
);
|
39
|
+
|
40
|
+
// Appends a single Unicode codepoint onto the end of the GumboStringBuffer.
|
41
|
+
// This is essentially a UTF-8 encoder, and may add 1-4 bytes depending on the
|
42
|
+
// value of the codepoint.
|
43
|
+
void gumbo_string_buffer_append_codepoint (
|
44
|
+
int c,
|
45
|
+
GumboStringBuffer* output
|
46
|
+
);
|
47
|
+
|
48
|
+
// Appends a string onto the end of the GumboStringBuffer.
|
49
|
+
void gumbo_string_buffer_append_string (
|
50
|
+
const GumboStringPiece* str,
|
51
|
+
GumboStringBuffer* output
|
52
|
+
);
|
53
|
+
|
54
|
+
// Converts this string buffer to const char*, alloctaing a new buffer for it.
|
55
|
+
char* gumbo_string_buffer_to_string(const GumboStringBuffer* input);
|
56
|
+
|
57
|
+
// Reinitialize this string buffer. This clears it by setting length=0. It
|
58
|
+
// does not zero out the buffer itself.
|
59
|
+
void gumbo_string_buffer_clear(GumboStringBuffer* input);
|
60
|
+
|
61
|
+
// Deallocates this GumboStringBuffer.
|
62
|
+
void gumbo_string_buffer_destroy(GumboStringBuffer* buffer);
|
63
|
+
|
64
|
+
#ifdef __cplusplus
|
65
|
+
}
|
66
|
+
#endif
|
67
|
+
|
68
|
+
#endif // GUMBO_STRING_BUFFER_H_
|
@@ -0,0 +1,48 @@
|
|
1
|
+
/*
|
2
|
+
Copyright 2018 Craig Barnes.
|
3
|
+
Copyright 2010 Google Inc.
|
4
|
+
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
you may not use this file except in compliance with the License.
|
7
|
+
You may obtain a copy of the License at
|
8
|
+
|
9
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
See the License for the specific language governing permissions and
|
15
|
+
limitations under the License.
|
16
|
+
*/
|
17
|
+
|
18
|
+
#include <stddef.h>
|
19
|
+
#include <string.h>
|
20
|
+
#include "nokogiri_gumbo.h"
|
21
|
+
#include "ascii.h"
|
22
|
+
|
23
|
+
bool gumbo_string_equals (
|
24
|
+
const GumboStringPiece* str1,
|
25
|
+
const GumboStringPiece* str2
|
26
|
+
) {
|
27
|
+
return
|
28
|
+
str1->length == str2->length
|
29
|
+
&& !memcmp(str1->data, str2->data, str1->length);
|
30
|
+
}
|
31
|
+
|
32
|
+
bool gumbo_string_equals_ignore_case (
|
33
|
+
const GumboStringPiece* str1,
|
34
|
+
const GumboStringPiece* str2
|
35
|
+
) {
|
36
|
+
return
|
37
|
+
str1->length == str2->length
|
38
|
+
&& !gumbo_ascii_strncasecmp(str1->data, str2->data, str1->length);
|
39
|
+
}
|
40
|
+
|
41
|
+
bool gumbo_string_prefix_ignore_case (
|
42
|
+
const GumboStringPiece* prefix,
|
43
|
+
const GumboStringPiece* str
|
44
|
+
) {
|
45
|
+
return
|
46
|
+
prefix->length <= str->length
|
47
|
+
&& !gumbo_ascii_strncasecmp(prefix->data, str->data, prefix->length);
|
48
|
+
}
|
@@ -0,0 +1,174 @@
|
|
1
|
+
/* ANSI-C code produced by gperf version 3.1 */
|
2
|
+
/* Command-line: gperf -m100 src/svg_attrs.gperf */
|
3
|
+
/* Computed positions: -k'1,10,$' */
|
4
|
+
/* Filtered by: gperf-filter.sed */
|
5
|
+
|
6
|
+
#include "replacement.h"
|
7
|
+
#include "macros.h"
|
8
|
+
#include "ascii.h"
|
9
|
+
#include <string.h>
|
10
|
+
|
11
|
+
#define TOTAL_KEYWORDS 58
|
12
|
+
#define MIN_WORD_LENGTH 4
|
13
|
+
#define MAX_WORD_LENGTH 19
|
14
|
+
#define MIN_HASH_VALUE 5
|
15
|
+
#define MAX_HASH_VALUE 77
|
16
|
+
/* maximum key range = 73, 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 char asso_values[] =
|
24
|
+
{
|
25
|
+
78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
|
26
|
+
78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
|
27
|
+
78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
|
28
|
+
78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
|
29
|
+
78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
|
30
|
+
78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
|
31
|
+
78, 78, 78, 78, 78, 5, 78, 39, 14, 1,
|
32
|
+
31, 31, 13, 13, 78, 78, 22, 25, 10, 2,
|
33
|
+
7, 78, 22, 0, 1, 3, 1, 78, 0, 36,
|
34
|
+
14, 17, 20, 78, 78, 78, 78, 5, 78, 39,
|
35
|
+
14, 1, 31, 31, 13, 13, 78, 78, 22, 25,
|
36
|
+
10, 2, 7, 78, 22, 0, 1, 3, 1, 78,
|
37
|
+
0, 36, 14, 17, 20, 78, 78, 78, 78, 78,
|
38
|
+
78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
|
39
|
+
78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
|
40
|
+
78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
|
41
|
+
78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
|
42
|
+
78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
|
43
|
+
78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
|
44
|
+
78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
|
45
|
+
78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
|
46
|
+
78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
|
47
|
+
78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
|
48
|
+
78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
|
49
|
+
78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
|
50
|
+
78, 78, 78, 78, 78, 78, 78, 78
|
51
|
+
};
|
52
|
+
register unsigned int hval = len;
|
53
|
+
|
54
|
+
switch (hval)
|
55
|
+
{
|
56
|
+
default:
|
57
|
+
hval += asso_values[(unsigned char)str[9]];
|
58
|
+
/*FALLTHROUGH*/
|
59
|
+
case 9:
|
60
|
+
case 8:
|
61
|
+
case 7:
|
62
|
+
case 6:
|
63
|
+
case 5:
|
64
|
+
case 4:
|
65
|
+
case 3:
|
66
|
+
case 2:
|
67
|
+
case 1:
|
68
|
+
hval += asso_values[(unsigned char)str[0]+2];
|
69
|
+
break;
|
70
|
+
}
|
71
|
+
return hval + asso_values[(unsigned char)str[len - 1]];
|
72
|
+
}
|
73
|
+
|
74
|
+
const StringReplacement *
|
75
|
+
gumbo_get_svg_attr_replacement (register const char *str, register size_t len)
|
76
|
+
{
|
77
|
+
static const unsigned char lengthtable[] =
|
78
|
+
{
|
79
|
+
0, 0, 0, 0, 0, 4, 0, 7, 7, 0, 8, 9, 10, 11,
|
80
|
+
11, 11, 11, 10, 16, 18, 16, 12, 16, 11, 13, 11, 12, 11,
|
81
|
+
16, 0, 17, 9, 9, 8, 9, 10, 13, 10, 12, 14, 8, 4,
|
82
|
+
12, 19, 7, 9, 12, 12, 11, 14, 10, 19, 8, 16, 13, 16,
|
83
|
+
16, 15, 10, 12, 0, 0, 13, 13, 13, 0, 0, 9, 16, 0,
|
84
|
+
0, 0, 0, 0, 0, 0, 0, 17
|
85
|
+
};
|
86
|
+
static const StringReplacement wordlist[] =
|
87
|
+
{
|
88
|
+
{(char*)0,(char*)0}, {(char*)0,(char*)0},
|
89
|
+
{(char*)0,(char*)0}, {(char*)0,(char*)0},
|
90
|
+
{(char*)0,(char*)0},
|
91
|
+
{"refx", "refX"},
|
92
|
+
{(char*)0,(char*)0},
|
93
|
+
{"viewbox", "viewBox"},
|
94
|
+
{"targetx", "targetX"},
|
95
|
+
{(char*)0,(char*)0},
|
96
|
+
{"calcmode", "calcMode"},
|
97
|
+
{"maskunits", "maskUnits"},
|
98
|
+
{"viewtarget", "viewTarget"},
|
99
|
+
{"tablevalues", "tableValues"},
|
100
|
+
{"markerunits", "markerUnits"},
|
101
|
+
{"stitchtiles", "stitchTiles"},
|
102
|
+
{"startoffset", "startOffset"},
|
103
|
+
{"numoctaves", "numOctaves"},
|
104
|
+
{"requiredfeatures", "requiredFeatures"},
|
105
|
+
{"requiredextensions", "requiredExtensions"},
|
106
|
+
{"specularexponent", "specularExponent"},
|
107
|
+
{"surfacescale", "surfaceScale"},
|
108
|
+
{"specularconstant", "specularConstant"},
|
109
|
+
{"repeatcount", "repeatCount"},
|
110
|
+
{"clippathunits", "clipPathUnits"},
|
111
|
+
{"filterunits", "filterUnits"},
|
112
|
+
{"lengthadjust", "lengthAdjust"},
|
113
|
+
{"markerwidth", "markerWidth"},
|
114
|
+
{"maskcontentunits", "maskContentUnits"},
|
115
|
+
{(char*)0,(char*)0},
|
116
|
+
{"limitingconeangle", "limitingConeAngle"},
|
117
|
+
{"pointsatx", "pointsAtX"},
|
118
|
+
{"repeatdur", "repeatDur"},
|
119
|
+
{"keytimes", "keyTimes"},
|
120
|
+
{"keypoints", "keyPoints"},
|
121
|
+
{"keysplines", "keySplines"},
|
122
|
+
{"gradientunits", "gradientUnits"},
|
123
|
+
{"textlength", "textLength"},
|
124
|
+
{"stddeviation", "stdDeviation"},
|
125
|
+
{"primitiveunits", "primitiveUnits"},
|
126
|
+
{"edgemode", "edgeMode"},
|
127
|
+
{"refy", "refY"},
|
128
|
+
{"spreadmethod", "spreadMethod"},
|
129
|
+
{"preserveaspectratio", "preserveAspectRatio"},
|
130
|
+
{"targety", "targetY"},
|
131
|
+
{"pointsatz", "pointsAtZ"},
|
132
|
+
{"markerheight", "markerHeight"},
|
133
|
+
{"patternunits", "patternUnits"},
|
134
|
+
{"baseprofile", "baseProfile"},
|
135
|
+
{"systemlanguage", "systemLanguage"},
|
136
|
+
{"zoomandpan", "zoomAndPan"},
|
137
|
+
{"patterncontentunits", "patternContentUnits"},
|
138
|
+
{"glyphref", "glyphRef"},
|
139
|
+
{"xchannelselector", "xChannelSelector"},
|
140
|
+
{"attributetype", "attributeType"},
|
141
|
+
{"kernelunitlength", "kernelUnitLength"},
|
142
|
+
{"ychannelselector", "yChannelSelector"},
|
143
|
+
{"diffuseconstant", "diffuseConstant"},
|
144
|
+
{"pathlength", "pathLength"},
|
145
|
+
{"kernelmatrix", "kernelMatrix"},
|
146
|
+
{(char*)0,(char*)0}, {(char*)0,(char*)0},
|
147
|
+
{"preservealpha", "preserveAlpha"},
|
148
|
+
{"attributename", "attributeName"},
|
149
|
+
{"basefrequency", "baseFrequency"},
|
150
|
+
{(char*)0,(char*)0}, {(char*)0,(char*)0},
|
151
|
+
{"pointsaty", "pointsAtY"},
|
152
|
+
{"patterntransform", "patternTransform"},
|
153
|
+
{(char*)0,(char*)0}, {(char*)0,(char*)0},
|
154
|
+
{(char*)0,(char*)0}, {(char*)0,(char*)0},
|
155
|
+
{(char*)0,(char*)0}, {(char*)0,(char*)0},
|
156
|
+
{(char*)0,(char*)0}, {(char*)0,(char*)0},
|
157
|
+
{"gradienttransform", "gradientTransform"}
|
158
|
+
};
|
159
|
+
|
160
|
+
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
161
|
+
{
|
162
|
+
register unsigned int key = hash (str, len);
|
163
|
+
|
164
|
+
if (key <= MAX_HASH_VALUE)
|
165
|
+
if (len == lengthtable[key])
|
166
|
+
{
|
167
|
+
register const char *s = wordlist[key].from;
|
168
|
+
|
169
|
+
if (s && (((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gumbo_ascii_strncasecmp(str, s, len))
|
170
|
+
return &wordlist[key];
|
171
|
+
}
|
172
|
+
}
|
173
|
+
return 0;
|
174
|
+
}
|
@@ -0,0 +1,77 @@
|
|
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_attr_replacement
|
15
|
+
%define slot-name from
|
16
|
+
%define initializer-suffix ,(char*)0
|
17
|
+
StringReplacement;
|
18
|
+
|
19
|
+
%%
|
20
|
+
"attributename", "attributeName"
|
21
|
+
"attributetype", "attributeType"
|
22
|
+
"basefrequency", "baseFrequency"
|
23
|
+
"baseprofile", "baseProfile"
|
24
|
+
"calcmode", "calcMode"
|
25
|
+
"clippathunits", "clipPathUnits"
|
26
|
+
"diffuseconstant", "diffuseConstant"
|
27
|
+
"edgemode", "edgeMode"
|
28
|
+
"filterunits", "filterUnits"
|
29
|
+
"glyphref", "glyphRef"
|
30
|
+
"gradienttransform", "gradientTransform"
|
31
|
+
"gradientunits", "gradientUnits"
|
32
|
+
"kernelmatrix", "kernelMatrix"
|
33
|
+
"kernelunitlength", "kernelUnitLength"
|
34
|
+
"keypoints", "keyPoints"
|
35
|
+
"keysplines", "keySplines"
|
36
|
+
"keytimes", "keyTimes"
|
37
|
+
"lengthadjust", "lengthAdjust"
|
38
|
+
"limitingconeangle", "limitingConeAngle"
|
39
|
+
"markerheight", "markerHeight"
|
40
|
+
"markerunits", "markerUnits"
|
41
|
+
"markerwidth", "markerWidth"
|
42
|
+
"maskcontentunits", "maskContentUnits"
|
43
|
+
"maskunits", "maskUnits"
|
44
|
+
"numoctaves", "numOctaves"
|
45
|
+
"pathlength", "pathLength"
|
46
|
+
"patterncontentunits", "patternContentUnits"
|
47
|
+
"patterntransform", "patternTransform"
|
48
|
+
"patternunits", "patternUnits"
|
49
|
+
"pointsatx", "pointsAtX"
|
50
|
+
"pointsaty", "pointsAtY"
|
51
|
+
"pointsatz", "pointsAtZ"
|
52
|
+
"preservealpha", "preserveAlpha"
|
53
|
+
"preserveaspectratio", "preserveAspectRatio"
|
54
|
+
"primitiveunits", "primitiveUnits"
|
55
|
+
"refx", "refX"
|
56
|
+
"refy", "refY"
|
57
|
+
"repeatcount", "repeatCount"
|
58
|
+
"repeatdur", "repeatDur"
|
59
|
+
"requiredextensions", "requiredExtensions"
|
60
|
+
"requiredfeatures", "requiredFeatures"
|
61
|
+
"specularconstant", "specularConstant"
|
62
|
+
"specularexponent", "specularExponent"
|
63
|
+
"spreadmethod", "spreadMethod"
|
64
|
+
"startoffset", "startOffset"
|
65
|
+
"stddeviation", "stdDeviation"
|
66
|
+
"stitchtiles", "stitchTiles"
|
67
|
+
"surfacescale", "surfaceScale"
|
68
|
+
"systemlanguage", "systemLanguage"
|
69
|
+
"tablevalues", "tableValues"
|
70
|
+
"targetx", "targetX"
|
71
|
+
"targety", "targetY"
|
72
|
+
"textlength", "textLength"
|
73
|
+
"viewbox", "viewBox"
|
74
|
+
"viewtarget", "viewTarget"
|
75
|
+
"xchannelselector", "xChannelSelector"
|
76
|
+
"ychannelselector", "yChannelSelector"
|
77
|
+
"zoomandpan", "zoomAndPan"
|
@@ -0,0 +1,137 @@
|
|
1
|
+
/* ANSI-C code produced by gperf version 3.1 */
|
2
|
+
/* Command-line: gperf -m100 src/svg_tags.gperf */
|
3
|
+
/* Computed positions: -k'3,7' */
|
4
|
+
/* Filtered by: gperf-filter.sed */
|
5
|
+
|
6
|
+
#include "replacement.h"
|
7
|
+
#include "macros.h"
|
8
|
+
#include "ascii.h"
|
9
|
+
#include <string.h>
|
10
|
+
|
11
|
+
#define TOTAL_KEYWORDS 36
|
12
|
+
#define MIN_WORD_LENGTH 6
|
13
|
+
#define MAX_WORD_LENGTH 19
|
14
|
+
#define MIN_HASH_VALUE 6
|
15
|
+
#define MAX_HASH_VALUE 42
|
16
|
+
/* maximum key range = 37, 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 char asso_values[] =
|
24
|
+
{
|
25
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
26
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
27
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
28
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
29
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
30
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
31
|
+
43, 43, 43, 43, 43, 43, 12, 2, 10, 22,
|
32
|
+
1, 28, 15, 1, 43, 43, 43, 0, 9, 26,
|
33
|
+
3, 17, 1, 11, 0, 22, 5, 43, 3, 2,
|
34
|
+
43, 43, 43, 43, 43, 43, 43, 43, 12, 2,
|
35
|
+
10, 22, 1, 28, 15, 1, 43, 43, 43, 0,
|
36
|
+
9, 26, 3, 17, 1, 11, 0, 22, 5, 43,
|
37
|
+
3, 2, 43, 43, 43, 43, 43, 43, 43, 43,
|
38
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
39
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
40
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
41
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
42
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
43
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
44
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
45
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
46
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
47
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
48
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
49
|
+
43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
50
|
+
43, 43, 43, 43, 43, 43, 43
|
51
|
+
};
|
52
|
+
register unsigned int hval = len;
|
53
|
+
|
54
|
+
switch (hval)
|
55
|
+
{
|
56
|
+
default:
|
57
|
+
hval += asso_values[(unsigned char)str[6]+1];
|
58
|
+
/*FALLTHROUGH*/
|
59
|
+
case 6:
|
60
|
+
case 5:
|
61
|
+
case 4:
|
62
|
+
case 3:
|
63
|
+
hval += asso_values[(unsigned char)str[2]];
|
64
|
+
break;
|
65
|
+
}
|
66
|
+
return hval;
|
67
|
+
}
|
68
|
+
|
69
|
+
const StringReplacement *
|
70
|
+
gumbo_get_svg_tag_replacement (register const char *str, register size_t len)
|
71
|
+
{
|
72
|
+
static const unsigned char lengthtable[] =
|
73
|
+
{
|
74
|
+
0, 0, 0, 0, 0, 0, 6, 0, 7, 7, 7, 8, 11, 12,
|
75
|
+
12, 13, 11, 12, 16, 7, 7, 16, 11, 7, 19, 8, 13, 17,
|
76
|
+
11, 12, 7, 8, 17, 8, 18, 8, 14, 12, 14, 14, 13, 7,
|
77
|
+
14
|
78
|
+
};
|
79
|
+
static const StringReplacement wordlist[] =
|
80
|
+
{
|
81
|
+
{(char*)0,(char*)0}, {(char*)0,(char*)0},
|
82
|
+
{(char*)0,(char*)0}, {(char*)0,(char*)0},
|
83
|
+
{(char*)0,(char*)0}, {(char*)0,(char*)0},
|
84
|
+
{"fetile", "feTile"},
|
85
|
+
{(char*)0,(char*)0},
|
86
|
+
{"femerge", "feMerge"},
|
87
|
+
{"feimage", "feImage"},
|
88
|
+
{"fefuncb", "feFuncB"},
|
89
|
+
{"glyphref", "glyphRef"},
|
90
|
+
{"femergenode", "feMergeNode"},
|
91
|
+
{"femorphology", "feMorphology"},
|
92
|
+
{"animatecolor", "animateColor"},
|
93
|
+
{"animatemotion", "animateMotion"},
|
94
|
+
{"fecomposite", "feComposite"},
|
95
|
+
{"feturbulence", "feTurbulence"},
|
96
|
+
{"animatetransform", "animateTransform"},
|
97
|
+
{"fefuncr", "feFuncR"},
|
98
|
+
{"fefunca", "feFuncA"},
|
99
|
+
{"feconvolvematrix", "feConvolveMatrix"},
|
100
|
+
{"fespotlight", "feSpotLight"},
|
101
|
+
{"fefuncg", "feFuncG"},
|
102
|
+
{"fecomponenttransfer", "feComponentTransfer"},
|
103
|
+
{"altglyph", "altGlyph"},
|
104
|
+
{"fecolormatrix", "feColorMatrix"},
|
105
|
+
{"fedisplacementmap", "feDisplacementMap"},
|
106
|
+
{"altglyphdef", "altGlyphDef"},
|
107
|
+
{"altglyphitem", "altGlyphItem"},
|
108
|
+
{"feflood", "feFlood"},
|
109
|
+
{"clippath", "clipPath"},
|
110
|
+
{"fediffuselighting", "feDiffuseLighting"},
|
111
|
+
{"textpath", "textPath"},
|
112
|
+
{"fespecularlighting", "feSpecularLighting"},
|
113
|
+
{"feoffset", "feOffset"},
|
114
|
+
{"fedistantlight", "feDistantLight"},
|
115
|
+
{"fepointlight", "fePointLight"},
|
116
|
+
{"lineargradient", "linearGradient"},
|
117
|
+
{"radialgradient", "radialGradient"},
|
118
|
+
{"foreignobject", "foreignObject"},
|
119
|
+
{"feblend", "feBlend"},
|
120
|
+
{"fegaussianblur", "feGaussianBlur"}
|
121
|
+
};
|
122
|
+
|
123
|
+
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
124
|
+
{
|
125
|
+
register unsigned int key = hash (str, len);
|
126
|
+
|
127
|
+
if (key <= MAX_HASH_VALUE)
|
128
|
+
if (len == lengthtable[key])
|
129
|
+
{
|
130
|
+
register const char *s = wordlist[key].from;
|
131
|
+
|
132
|
+
if (s && (((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gumbo_ascii_strncasecmp(str, s, len))
|
133
|
+
return &wordlist[key];
|
134
|
+
}
|
135
|
+
}
|
136
|
+
return 0;
|
137
|
+
}
|