diff --git a/liteidex/deploy/welcome/en/changes.md b/liteidex/deploy/welcome/en/changes.md index fd0073acf..1d27dd56f 100644 --- a/liteidex/deploy/welcome/en/changes.md +++ b/liteidex/deploy/welcome/en/changes.md @@ -3,6 +3,10 @@ ## LiteIDE X Version LiteIDE is a simple, open source, cross-platform Go IDE. +### Unreleased +* Markdown + * replace CommonMark/cmark with cmark-gfm 0.29.0.gfm.13 (tables, strikethrough, task lists, autolinks, footnotes) + ### 2025.5.20 Ver X38.4 * LiteIDE * support Go1.24 diff --git a/liteidex/deploy/welcome/en/website.md b/liteidex/deploy/welcome/en/website.md index 7318883ca..d8d969a73 100644 --- a/liteidex/deploy/welcome/en/website.md +++ b/liteidex/deploy/welcome/en/website.md @@ -7,7 +7,7 @@ * [Support LiteIDE](https://visualfc.github.io/support/) ### LiteIDE Markdown -* Markdown parser from [sundown](https://github.com/vmg/sundown) +* Markdown parser from [cmark-gfm](https://github.com/github/cmark-gfm) * Markdown CSS files from [Mou](http://mouapp.com) ### Golang diff --git a/liteidex/deploy/welcome/zh_CN/changes.md b/liteidex/deploy/welcome/zh_CN/changes.md index 11b1acc78..5ebe3c12d 100644 --- a/liteidex/deploy/welcome/zh_CN/changes.md +++ b/liteidex/deploy/welcome/zh_CN/changes.md @@ -3,6 +3,10 @@ ## LiteIDE X Version LiteIDE is a simple, open source, cross-platform Go IDE. +### Unreleased +* Markdown + * 用 cmark-gfm 0.29.0.gfm.13 替换 CommonMark/cmark(表格、删除线、任务列表、自动链接、脚注) + ### 2025.5.20 Ver X38.4 * LiteIDE * support Go1.24 diff --git a/liteidex/deploy/welcome/zh_CN/website.md b/liteidex/deploy/welcome/zh_CN/website.md index 2b6b8f9e2..1efc25ffc 100644 --- a/liteidex/deploy/welcome/zh_CN/website.md +++ b/liteidex/deploy/welcome/zh_CN/website.md @@ -7,7 +7,7 @@ * [Support LiteIDE](http://visualfc.github.com/support) ### LiteIDE Markdown -* Markdown parser from [sundown](https://github.com/vmg/sundown) +* Markdown parser from [cmark-gfm](https://github.com/github/cmark-gfm) * Markdown CSS files from [Mou](http://mouapp.com) ### Golang diff --git a/liteidex/src/3rdparty/cmark/COPYING b/liteidex/src/3rdparty/cmark/COPYING old mode 100755 new mode 100644 diff --git a/liteidex/src/3rdparty/cmark/README.md b/liteidex/src/3rdparty/cmark/README.md old mode 100755 new mode 100644 index 5f31cccc1..0b9f719f6 --- a/liteidex/src/3rdparty/cmark/README.md +++ b/liteidex/src/3rdparty/cmark/README.md @@ -1,13 +1,18 @@ -cmark -===== +cmark-gfm +========= -[![Build Status]](https://travis-ci.org/commonmark/cmark) -[![Windows Build Status]](https://ci.appveyor.com/project/jgm/cmark-0ub06) +![Actions CI](https://github.com/github/cmark-gfm/actions/workflows/ci.yml/badge.svg) -`cmark` is the C reference implementation of [CommonMark], a -rationalized version of Markdown syntax with a [spec][the spec]. -(For the JavaScript reference implementation, see -[commonmark.js].) +`cmark-gfm` is an extended version of the C reference implementation of +[CommonMark], a rationalized version of Markdown syntax with a spec. This +repository adds GitHub Flavored Markdown extensions to +[the upstream implementation], as defined in [the spec]. + +The rest of the README is preserved as-is from the upstream source. Note that +the library and binaries produced by this fork are suffixed with `-gfm` in +order to distinguish them from the upstream. + +--- It provides a shared library (`libcmark`) with functions for parsing CommonMark documents to an abstract syntax tree (AST), manipulating @@ -59,8 +64,10 @@ There are also libraries that wrap `libcmark` for [Lua](https://github.com/jgm/cmark-lua), [Perl](https://metacpan.org/release/CommonMark), [Python](https://pypi.python.org/pypi/paka.cmark), -[R](https://cran.r-project.org/package=commonmark) and -[Scala](https://github.com/sparsetech/cmark-scala). +[R](https://cran.r-project.org/package=commonmark), +[Tcl](https://github.com/apnadkarni/tcl-cmark), +[Scala](https://github.com/sparsetech/cmark-scala) and +[Node.js](https://github.com/killa123/node-cmark). Installing ---------- @@ -187,12 +194,13 @@ Nick Wellnhofer contributed many improvements, including most of the C library's API and its test harness. [benchmarks]: benchmarks.md -[the spec]: http://spec.commonmark.org +[the spec]: https://github.github.com/gfm/ +[the upstream implementation]: https://github.com/jgm/cmark [CommonMark]: http://commonmark.org [cmake]: http://www.cmake.org/download/ [re2c]: http://re2c.org [commonmark.js]: https://github.com/commonmark/commonmark.js -[Build Status]: https://img.shields.io/travis/commonmark/cmark/master.svg?style=flat -[Windows Build Status]: https://ci.appveyor.com/api/projects/status/h3fd91vtd1xfmp69?svg=true +[Build Status]: https://img.shields.io/travis/github/cmark-gfm/master.svg?style=flat +[Windows Build Status]: https://ci.appveyor.com/api/projects/status/wv7ifhqhv5itm3d5?svg=true [american fuzzy lop]: http://lcamtuf.coredump.cx/afl/ [libFuzzer]: http://llvm.org/docs/LibFuzzer.html diff --git a/liteidex/src/3rdparty/cmark/changelog.txt b/liteidex/src/3rdparty/cmark/changelog.txt old mode 100755 new mode 100644 index be961a750..94e8a19fd --- a/liteidex/src/3rdparty/cmark/changelog.txt +++ b/liteidex/src/3rdparty/cmark/changelog.txt @@ -1,3 +1,105 @@ +[0.29.0.gfm.13] + * Normalized marker row vs. delimiter row nomenclature (#273) + * Exposed CMARK_NODE_FOOTNOTE_DEFINITION literal value (#336) + * Fix format specifier for printing a size_t (#340) + +[0.29.0.gfm.12] + + * Fixed polynomial time complexity issues per + https://github.com/github/cmark-gfm/security/advisories/GHSA-w4qg-3vf7-m9x5 + * Added CodeQL project integration (#337) + * Addressed const qualifier discard compiler warnings (#330, #331) + +[0.29.0.gfm.11] + + * Improved fixes for polynomial time complexity issues per + https://github.com/github/cmark-gfm/security/advisories/GHSA-66g8-4hjf-77xh + (#323, #324) + * Added fuzzing target for bracketed patterns (#318) + * Fixed bug in list numbering introduced in + 763587e8775350b8cb4a2aa0f4cec3685aa96e8b (#322) which caused list numbers + to increment by 2 + * Fixed strict prototype clang warning (#310) + * Fixed regression test (#312) + * Added additional output formats to quadratic fuzzer (#327) + * Fixed buffer overflow in fuzzing harness (#326) + + Note: these changes may lead to minor changes in expected output on plaintext + rendering of list items. Notably, blank lines may no longer delineate the start + of a list when rendering to plaintext due to changes in how the tight list status + is calculated. + +[0.29.0.gfm.10] + + * Fixed polynomial time complexity issue per + https://github.com/github/cmark-gfm/security/advisories/GHSA-r8vr-c48j-fcc5 + * Fixed polynomial time complexity issues per + https://github.com/github/cmark-gfm/security/advisories/GHSA-66g8-4hjf-77xh + + Note: these changes remove redundant bold tag nesting which may result + in existing rendering tests failing, e.g. rendering "____bold____" to html + will no longer yield "

bold

". + +[0.29.0.gfm.9] + + * Cleanup: Use of a private header was cleaned up (#248) + * Cleanup: Man page was updated (#255) + * Cleanup: Warnings for -Wstrict-prototypes were cleaned up (#285) + * Cleanup: We avoid header duplication (#289) + + * We now store positioning info for url_match (#201) + * We now expose cmark_parent_footnote_def for non-C renderers (#254) + * Footnote aria-label text now reference the specific footnote backref, and we include a data-footnote-backref-idx attribute so the label can be internationalized in a downstream filter (#307) + +[0.29.0.gfm.8] + + * We restored backwards compatibility by deprecating the `cmark_init_standard_node_flags()` requirement, which is now a noop (#305) + * We added a quadratic complexity fuzzing target (#304) + +[0.29.0.gfm.7] + + * Fixed a polynomial time complexity issue per + https://github.com/github/cmark-gfm/security/advisories/GHSA-r572-jvj2-3m8p + * Fixed an issue in which crafted markdown document could trigger an + out-of-bounds read in the validate_protocol function per + https://github.com/github/cmark-gfm/security/advisories/GHSA-c944-cv5f-hpvr + * Fixed a polynomial time complexity issue + https://github.com/github/cmark-gfm/security/advisories/GHSA-24f7-9frr-5h2r + * Fixed several polynomial time complexity issues per + https://github.com/github/cmark-gfm/security/advisories/GHSA-29g3-96g3-jg6c + * We removed an unneeded .DS_Store file (#291) + * We added a test for domains with underscores and fix roundtrip behavior (#292) + * We now use an up-to-date clang-format (#294) + * We made a variety of implicit integer trunctions explicit by moving to + size_t as our standard size integer type (#302) + +[0.29.0.gfm.6] + * Fixed polynomial time complexity DoS vulnerability in autolink extension + +[0.29.0.gfm.5] + * Added xmpp: and mailto: support to the autolink extension + +[0.29.0.gfm.4] + * Remove `source` from list of HTML blocks + +[0.29.0.gfm.3] + * Fixed heap memory corruption vulnerabiliy via integer overflow per https://github.com/github/cmark-gfm/security/advisories/GHSA-mc3g-88wq-6f4x + +[0.29.0.gfm.2] + * Fixed issues with footnote rendering when used with the autolinker (#121), + and when footnotes are adjacent (#139). + * We now allow footnotes to be referenced from inside a footnote definition, + we use the footnote label for the fnref href text when rendering html, and + we insert multiple backrefs when a footnote has been referenced multiple + times (#229, #230) + * We added new data- attributes to footnote html rendering to make them + easier to style (#234) + +[0.29.0.gfm.1] + + * Fixed denial of service bug in GFM's table extension + per https://github.com/github/cmark-gfm/security/advisories/GHSA-7gc6-9qr5-hc85 + [0.29.0] * Update spec to 0.29. @@ -122,6 +224,61 @@ * Update the Racket wrapper (Eli Barzilay). * Makefile: For afl target, don't build tests. +[0.28.3.gfm.20] + + * Add tasklist extension implementation (Watson1978, #94). + +[0.28.3.gfm.19] + + * Prevent out-of-bound memory access in strikethrough matcher (Xavier Décoret, #124). + * Limit recursion in autolink extension (Xavier Décoret, #125). + * Add plaintext rendering for footnotes (Xavier Décoret, #126). + +[0.28.3.gfm.18] + + * Match strikethrough more strictly (#120). + * Default to safe operation (#123). + +[0.28.3.gfm.17] + + * Allow extension to provide opaque allocation function (Nicolás Ojeda + Bär, #89). + * Upstream optimisations and fixes. + * Extensions can add custom XML attributes (#116). + * Support for GFM extensions in cmark XML to CommonMark XSLT converter + (Maëlle Salmon, #117). + +[0.28.3.gfm.16] + + * Do not percent-encode tildes (~) in HTML attribute values (#110). + * Fix footnote references in tables (#112). + +[0.28.3.gfm.15] + + * Escape non-strikethrough tildes (~) in commonmark output (John MacFarlane, #106). + * Cosmetic fix to table HTML output (John MacFarlane, #105). + * Use two tildes for strikethrough CommonMark output (John MacFarlane, #104). + * Normalised header and define names (#109). + +[0.28.3.gfm.14] + + * Added a plaintext renderer for strikethrough nodes. + +[0.28.3.gfm.13] + + * Footnote rendering bugfix (Michael Camilleri, #90). + * Debian packaging (Joachim Nilsson, #97). + * Add CMARK_OPT_STRIKETHROUGH_DOUBLE_TILDE for redcarpet compatibility. + * Add CMARK_OPT_TABLE_PREFER_STYLE_ATTRIBUTES (FUJI Goro, #86, #87). + * Fix pathological nested list parsing (Phil Turnbull, #95). + * Expose more of the extension APIs (Minghao Liu, #96). + * Add python example which uses extensions (Greg Stein, #102). + * Add CMARK_OPT_FULL_INFO_STRING (Mike Kavouras, #103). + +[0.28.3.gfm.12] + + * Various security and bug fixes. + [0.28.3] * Include GNUInstallDirs in src/CMakeLists.txt (Nick Wellnhofer, #240). @@ -145,6 +302,40 @@ * Update README.md, replace `make astyle` with `make format` (Nguyễn Thái Ngọc Duy). +[0.28.0.gfm.11] + + * Do not output empty `` in table extension. + +[0.28.0.gfm.10] + + * Fix denial of service parsing references. + +[0.28.0.gfm.9] + + * Fix denial of service parsing nested links (#49). + +[0.28.0.gfm.8] + + * Fix bug where autolink would cause `:` to be skipped in emphasis + processing. + +[0.28.0.gfm.7] + + * Strikethrough characters do not disturb regular emphasis processing. + +[0.28.0.gfm.6] + + * Fix inline sourcepos info when inlines span multiple lines, and in + ATX headings. + +[0.28.0.gfm.5] + + * Latest spec. + * Fix a typo in the spec (John Gardner). + * Fix quadratic behavior in reference lookups. + * Add `core_extensions_ensure_registered`. + * Add sourcepos information for inlines. + [0.28.0] * Update spec. @@ -271,6 +462,34 @@ (Pavlo Kapyshin). * README: Add link to cmark-scala (Tim Nieradzik, #196) +[0.27.1.gfm.4] + + * Fix regression with nested parentheses in link targets (#48). + +[0.27.1.gfm.3] + + * Various undefined behavior issues fixed (#38, #39, #40). + * Tag filter is case-insensitive (#43). + +[0.27.1.gfm.2] + + * Fix a number of bugs (reading past end of buffer, undefined behavior. + * Add `cmark_syntax_extension_get_private()`. (Jonathan Müller) + +[0.27.1.gfm.1] + + * Add plaintext renderer. + * Remove normalize option; we now always normalize the AST. + * Add getters for table alignment. + * `make install` also installs the extensions static/shared library. + +[0.27.1.gfm.0] + + * Add extensions: tagfilter, strikethrough, table, autolink. + * Add arena memory implementation. + * Add CMARK_OPT_GITHUB_PRE_LANG for fenced code blocks. + * Skip UTF-8 BOM on input. + [0.27.1] * Set policy for CMP0063 to avoid a warning (#162). diff --git a/liteidex/src/3rdparty/cmark/cmark-gfm_export.h b/liteidex/src/3rdparty/cmark/cmark-gfm_export.h new file mode 100644 index 000000000..2732c2f60 --- /dev/null +++ b/liteidex/src/3rdparty/cmark/cmark-gfm_export.h @@ -0,0 +1,28 @@ +#ifndef CMARK_GFM_EXPORT_H +#define CMARK_GFM_EXPORT_H + +#ifdef CMARK_GFM_STATIC_DEFINE +# define CMARK_GFM_EXPORT +# define CMARK_GFM_NO_EXPORT +#else +# ifndef CMARK_GFM_EXPORT +# define CMARK_GFM_EXPORT +# endif +# ifndef CMARK_GFM_NO_EXPORT +# define CMARK_GFM_NO_EXPORT +# endif +#endif + +#ifndef CMARK_GFM_DEPRECATED +# define CMARK_GFM_DEPRECATED +#endif + +#ifndef CMARK_GFM_DEPRECATED_EXPORT +# define CMARK_GFM_DEPRECATED_EXPORT CMARK_GFM_EXPORT CMARK_GFM_DEPRECATED +#endif + +#ifndef CMARK_GFM_DEPRECATED_NO_EXPORT +# define CMARK_GFM_DEPRECATED_NO_EXPORT CMARK_GFM_NO_EXPORT CMARK_GFM_DEPRECATED +#endif + +#endif /* CMARK_GFM_EXPORT_H */ diff --git a/liteidex/src/3rdparty/cmark/cmark-gfm_version.h b/liteidex/src/3rdparty/cmark/cmark-gfm_version.h new file mode 100644 index 000000000..cf4dfee03 --- /dev/null +++ b/liteidex/src/3rdparty/cmark/cmark-gfm_version.h @@ -0,0 +1,7 @@ +#ifndef CMARK_GFM_VERSION_H +#define CMARK_GFM_VERSION_H + +#define CMARK_GFM_VERSION ((0 << 24) | (29 << 16) | (0 << 8) | 13) +#define CMARK_GFM_VERSION_STRING "0.29.0.gfm.13" + +#endif diff --git a/liteidex/src/3rdparty/cmark/cmark.pro b/liteidex/src/3rdparty/cmark/cmark.pro index cbee52a4b..476efc497 100644 --- a/liteidex/src/3rdparty/cmark/cmark.pro +++ b/liteidex/src/3rdparty/cmark/cmark.pro @@ -1,3 +1,4 @@ +# Vendored github/cmark-gfm 0.29.0.gfm.13 as a qmake static library. TEMPLATE = lib CONFIG += staticlib @@ -6,17 +7,20 @@ TARGET = cmark include(../../liteideutils.pri) - DEFINES += QT_DEPRECATED_WARNINGS -INCLUDEPATH += . +DEFINES += CMARK_GFM_STATIC_DEFINE CMARK_GFM_EXTENSIONS_STATIC_DEFINE +INCLUDEPATH += . src extensions +!win32-msvc*: QMAKE_CFLAGS += -Wno-unused-parameter SOURCES += \ libcmark.cpp \ + src/arena.c \ src/blocks.c \ src/buffer.c \ src/cmark.c \ src/cmark_ctype.c \ src/commonmark.c \ + src/footnotes.c \ src/houdini_href_e.c \ src/houdini_html_e.c \ src/houdini_html_u.c \ @@ -24,13 +28,26 @@ SOURCES += \ src/inlines.c \ src/iterator.c \ src/latex.c \ + src/linked_list.c \ src/man.c \ + src/map.c \ src/node.c \ + src/plaintext.c \ + src/plugin.c \ src/references.c \ + src/registry.c \ src/render.c \ src/scanners.c \ + src/syntax_extension.c \ src/utf8.c \ - src/xml.c + src/xml.c \ + extensions/autolink.c \ + extensions/core-extensions.c \ + extensions/ext_scanners.c \ + extensions/strikethrough.c \ + extensions/table.c \ + extensions/tagfilter.c \ + extensions/tasklist.c DISTFILES += \ src/case_fold_switch.inc \ @@ -38,16 +55,32 @@ DISTFILES += \ HEADERS += \ libcmark.h \ + cmark-gfm_export.h \ + cmark-gfm_version.h \ src/buffer.h \ src/chunk.h \ - src/cmark.h \ + src/cmark-gfm.h \ + src/cmark-gfm-extension_api.h \ src/cmark_ctype.h \ + src/footnotes.h \ src/houdini.h \ + src/html.h \ src/inlines.h \ src/iterator.h \ + src/map.h \ src/node.h \ src/parser.h \ + src/plugin.h \ src/references.h \ + src/registry.h \ src/render.h \ src/scanners.h \ - src/utf8.h + src/syntax_extension.h \ + src/utf8.h \ + extensions/autolink.h \ + extensions/cmark-gfm-core-extensions.h \ + extensions/ext_scanners.h \ + extensions/strikethrough.h \ + extensions/table.h \ + extensions/tagfilter.h \ + extensions/tasklist.h diff --git a/liteidex/src/3rdparty/cmark/cmark_export.h b/liteidex/src/3rdparty/cmark/cmark_export.h deleted file mode 100644 index 91f0b70c9..000000000 --- a/liteidex/src/3rdparty/cmark/cmark_export.h +++ /dev/null @@ -1,44 +0,0 @@ - -#ifndef CMARK_EXPORT_H -#define CMARK_EXPORT_H - -#define CMARK_EXPORT - -#ifdef CMARK_STATIC_DEFINE -# define CMARK_EXPORT -# define CMARK_NO_EXPORT -#else -# ifndef CMARK_EXPORT -# ifdef libcmark_EXPORTS - /* We are building this library */ -# define CMARK_EXPORT __attribute__((visibility("default"))) -# else - /* We are using this library */ -# define CMARK_EXPORT __attribute__((visibility("default"))) -# endif -# endif - -# ifndef CMARK_NO_EXPORT -# define CMARK_NO_EXPORT __attribute__((visibility("hidden"))) -# endif -#endif - -#ifndef CMARK_DEPRECATED -# define CMARK_DEPRECATED __attribute__ ((__deprecated__)) -#endif - -#ifndef CMARK_DEPRECATED_EXPORT -# define CMARK_DEPRECATED_EXPORT CMARK_EXPORT CMARK_DEPRECATED -#endif - -#ifndef CMARK_DEPRECATED_NO_EXPORT -# define CMARK_DEPRECATED_NO_EXPORT CMARK_NO_EXPORT CMARK_DEPRECATED -#endif - -#if 0 /* DEFINE_NO_DEPRECATED */ -# ifndef CMARK_NO_DEPRECATED -# define CMARK_NO_DEPRECATED -# endif -#endif - -#endif /* CMARK_EXPORT_H */ diff --git a/liteidex/src/3rdparty/cmark/cmark_version.h b/liteidex/src/3rdparty/cmark/cmark_version.h deleted file mode 100755 index dcacd378b..000000000 --- a/liteidex/src/3rdparty/cmark/cmark_version.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef CMARK_VERSION_H -#define CMARK_VERSION_H - -#define CMARK_VERSION ((0 << 16) | (29 << 8) | 0) -#define CMARK_VERSION_STRING "0.29.0" - -#endif diff --git a/liteidex/src/3rdparty/cmark/extensions/autolink.c b/liteidex/src/3rdparty/cmark/extensions/autolink.c new file mode 100644 index 000000000..d898cd2d4 --- /dev/null +++ b/liteidex/src/3rdparty/cmark/extensions/autolink.c @@ -0,0 +1,508 @@ +#include "autolink.h" +#include +#include +#include +#include + +#if defined(_WIN32) +#define strncasecmp _strnicmp +#else +#include +#endif + +static int is_valid_hostchar(const uint8_t *link, size_t link_len) { + int32_t ch; + int r = cmark_utf8proc_iterate(link, (bufsize_t)link_len, &ch); + if (r < 0) + return 0; + return !cmark_utf8proc_is_space(ch) && !cmark_utf8proc_is_punctuation(ch); +} + +static int sd_autolink_issafe(const uint8_t *link, size_t link_len) { + static const size_t valid_uris_count = 3; + static const char *valid_uris[] = {"http://", "https://", "ftp://"}; + + size_t i; + + for (i = 0; i < valid_uris_count; ++i) { + size_t len = strlen(valid_uris[i]); + + if (link_len > len && strncasecmp((char *)link, valid_uris[i], len) == 0 && + is_valid_hostchar(link + len, link_len - len)) + return 1; + } + + return 0; +} + +static size_t autolink_delim(uint8_t *data, size_t link_end) { + size_t i; + size_t closing = 0; + size_t opening = 0; + + for (i = 0; i < link_end; ++i) { + const uint8_t c = data[i]; + if (c == '<') { + link_end = i; + break; + } else if (c == '(') { + opening++; + } else if (c == ')') { + closing++; + } + } + + while (link_end > 0) { + switch (data[link_end - 1]) { + case ')': + /* Allow any number of matching brackets (as recognised in copen/cclose) + * at the end of the URL. If there is a greater number of closing + * brackets than opening ones, we remove one character from the end of + * the link. + * + * Examples (input text => output linked portion): + * + * http://www.pokemon.com/Pikachu_(Electric) + * => http://www.pokemon.com/Pikachu_(Electric) + * + * http://www.pokemon.com/Pikachu_((Electric) + * => http://www.pokemon.com/Pikachu_((Electric) + * + * http://www.pokemon.com/Pikachu_(Electric)) + * => http://www.pokemon.com/Pikachu_(Electric) + * + * http://www.pokemon.com/Pikachu_((Electric)) + * => http://www.pokemon.com/Pikachu_((Electric)) + */ + if (closing <= opening) { + return link_end; + } + closing--; + link_end--; + break; + case '?': + case '!': + case '.': + case ',': + case ':': + case '*': + case '_': + case '~': + case '\'': + case '"': + link_end--; + break; + case ';': { + size_t new_end = link_end - 2; + + while (new_end > 0 && cmark_isalpha(data[new_end])) + new_end--; + + if (new_end < link_end - 2 && data[new_end] == '&') + link_end = new_end; + else + link_end--; + break; + } + + default: + return link_end; + } + } + + return link_end; +} + +static size_t check_domain(uint8_t *data, size_t size, int allow_short) { + size_t i, np = 0, uscore1 = 0, uscore2 = 0; + + /* The purpose of this code is to reject urls that contain an underscore + * in one of the last two segments. Examples: + * + * www.xxx.yyy.zzz autolinked + * www.xxx.yyy._zzz not autolinked + * www.xxx._yyy.zzz not autolinked + * www._xxx.yyy.zzz autolinked + * + * The reason is that domain names are allowed to include underscores, + * but host names are not. See: https://stackoverflow.com/a/2183140 + */ + for (i = 1; i < size - 1; i++) { + if (data[i] == '\\' && i < size - 2) + i++; + if (data[i] == '_') + uscore2++; + else if (data[i] == '.') { + uscore1 = uscore2; + uscore2 = 0; + np++; + } else if (!is_valid_hostchar(data + i, size - i) && data[i] != '-') + break; + } + + if (uscore1 > 0 || uscore2 > 0) { + /* If the url is very long then accept it despite the underscores, + * to avoid quadratic behavior causing a denial of service. See: + * https://github.com/github/cmark-gfm/security/advisories/GHSA-29g3-96g3-jg6c + * Reasonable urls are unlikely to have more than 10 segments, so + * this extra condition shouldn't have any impact on normal usage. + */ + if (np <= 10) { + return 0; + } + } + + if (allow_short) { + /* We don't need a valid domain in the strict sense (with + * least one dot; so just make sure it's composed of valid + * domain characters and return the length of the the valid + * sequence. */ + return i; + } else { + /* a valid domain needs to have at least a dot. + * that's as far as we get */ + return np ? i : 0; + } +} + +static cmark_node *www_match(cmark_parser *parser, cmark_node *parent, + cmark_inline_parser *inline_parser) { + cmark_chunk *chunk = cmark_inline_parser_get_chunk(inline_parser); + size_t max_rewind = cmark_inline_parser_get_offset(inline_parser); + uint8_t *data = chunk->data + max_rewind; + size_t size = chunk->len - max_rewind; + int start = cmark_inline_parser_get_column(inline_parser); + + size_t link_end; + + if (max_rewind > 0 && strchr("*_~(", data[-1]) == NULL && + !cmark_isspace(data[-1])) + return 0; + + if (size < 4 || memcmp(data, "www.", strlen("www.")) != 0) + return 0; + + link_end = check_domain(data, size, 0); + + if (link_end == 0) + return NULL; + + while (link_end < size && !cmark_isspace(data[link_end]) && data[link_end] != '<') + link_end++; + + link_end = autolink_delim(data, link_end); + + if (link_end == 0) + return NULL; + + cmark_inline_parser_set_offset(inline_parser, (int)(max_rewind + link_end)); + + cmark_node *node = cmark_node_new_with_mem(CMARK_NODE_LINK, parser->mem); + + cmark_strbuf buf; + cmark_strbuf_init(parser->mem, &buf, 10); + cmark_strbuf_puts(&buf, "http://"); + cmark_strbuf_put(&buf, data, (bufsize_t)link_end); + node->as.link.url = cmark_chunk_buf_detach(&buf); + + cmark_node *text = cmark_node_new_with_mem(CMARK_NODE_TEXT, parser->mem); + text->as.literal = + cmark_chunk_dup(chunk, (bufsize_t)max_rewind, (bufsize_t)link_end); + cmark_node_append_child(node, text); + + node->start_line = text->start_line = + node->end_line = text->end_line = + cmark_inline_parser_get_line(inline_parser); + + node->start_column = text->start_column = start - 1; + node->end_column = text->end_column = cmark_inline_parser_get_column(inline_parser) - 1; + + return node; +} + +static cmark_node *url_match(cmark_parser *parser, cmark_node *parent, + cmark_inline_parser *inline_parser) { + size_t link_end, domain_len; + int rewind = 0; + + cmark_chunk *chunk = cmark_inline_parser_get_chunk(inline_parser); + int max_rewind = cmark_inline_parser_get_offset(inline_parser); + uint8_t *data = chunk->data + max_rewind; + size_t size = chunk->len - max_rewind; + + if (size < 4 || data[1] != '/' || data[2] != '/') + return 0; + + while (rewind < max_rewind && cmark_isalpha(data[-rewind - 1])) + rewind++; + + if (!sd_autolink_issafe(data - rewind, size + rewind)) + return 0; + + link_end = strlen("://"); + + domain_len = check_domain(data + link_end, size - link_end, 1); + + if (domain_len == 0) + return 0; + + link_end += domain_len; + while (link_end < size && !cmark_isspace(data[link_end]) && data[link_end] != '<') + link_end++; + + link_end = autolink_delim(data, link_end); + + if (link_end == 0) + return NULL; + + cmark_inline_parser_set_offset(inline_parser, (int)(max_rewind + link_end)); + cmark_node_unput(parent, rewind); + + cmark_node *node = cmark_node_new_with_mem(CMARK_NODE_LINK, parser->mem); + + cmark_chunk url = cmark_chunk_dup(chunk, max_rewind - rewind, + (bufsize_t)(link_end + rewind)); + node->as.link.url = url; + + cmark_node *text = cmark_node_new_with_mem(CMARK_NODE_TEXT, parser->mem); + text->as.literal = url; + cmark_node_append_child(node, text); + + node->start_line = text->start_line = node->end_line = text->end_line = cmark_inline_parser_get_line(inline_parser); + + node->start_column = text->start_column = max_rewind - rewind; + node->end_column = text->end_column = cmark_inline_parser_get_column(inline_parser) - 1; + + return node; +} + +static cmark_node *match(cmark_syntax_extension *ext, cmark_parser *parser, + cmark_node *parent, unsigned char c, + cmark_inline_parser *inline_parser) { + if (cmark_inline_parser_in_bracket(inline_parser, false) || + cmark_inline_parser_in_bracket(inline_parser, true)) + return NULL; + + if (c == ':') + return url_match(parser, parent, inline_parser); + + if (c == 'w') + return www_match(parser, parent, inline_parser); + + return NULL; + + // note that we could end up re-consuming something already a + // part of an inline, because we don't track when the last + // inline was finished in inlines.c. +} + +static bool validate_protocol(const char protocol[], uint8_t *data, size_t rewind, size_t max_rewind) { + size_t len = strlen(protocol); + + if (len > (max_rewind - rewind)) { + return false; + } + + // Check that the protocol matches + if (memcmp(data - rewind - len, protocol, len) != 0) { + return false; + } + + if (len == (max_rewind - rewind)) { + return true; + } + + char prev_char = data[-((ptrdiff_t)rewind) - len - 1]; + + // Make sure the character before the protocol is non-alphanumeric + return !cmark_isalnum(prev_char); +} + +static void postprocess_text(cmark_parser *parser, cmark_node *text) { + size_t start = 0; + size_t offset = 0; + // `text` is going to be split into a list of nodes containing shorter segments + // of text, so we detach the memory buffer from text and use `cmark_chunk_dup` to + // create references to it. Later, `cmark_chunk_to_cstr` is used to convert + // the references into allocated buffers. The detached buffer is freed before we + // return. + cmark_chunk detached_chunk = text->as.literal; + text->as.literal = cmark_chunk_dup(&detached_chunk, 0, detached_chunk.len); + + uint8_t *data = text->as.literal.data; + size_t remaining = text->as.literal.len; + + while (true) { + size_t link_end; + uint8_t *at; + bool auto_mailto = true; + bool is_xmpp = false; + size_t rewind; + size_t max_rewind; + size_t np = 0; + + if (offset >= remaining) + break; + + at = (uint8_t *)memchr(data + start + offset, '@', remaining - offset); + if (!at) + break; + + max_rewind = at - (data + start + offset); + +found_at: + for (rewind = 0; rewind < max_rewind; ++rewind) { + uint8_t c = data[start + offset + max_rewind - rewind - 1]; + + if (cmark_isalnum(c)) + continue; + + if (strchr(".+-_", c) != NULL) + continue; + + if (strchr(":", c) != NULL) { + if (validate_protocol("mailto:", data + start + offset + max_rewind, rewind, max_rewind)) { + auto_mailto = false; + continue; + } + + if (validate_protocol("xmpp:", data + start + offset + max_rewind, rewind, max_rewind)) { + auto_mailto = false; + is_xmpp = true; + continue; + } + } + + break; + } + + if (rewind == 0) { + offset += max_rewind + 1; + continue; + } + + assert(data[start + offset + max_rewind] == '@'); + for (link_end = 1; link_end < remaining - offset - max_rewind; ++link_end) { + uint8_t c = data[start + offset + max_rewind + link_end]; + + if (cmark_isalnum(c)) + continue; + + if (c == '@') { + // Found another '@', so go back and try again with an updated offset and max_rewind. + offset += max_rewind + 1; + max_rewind = link_end - 1; + goto found_at; + } else if (c == '.' && link_end < remaining - offset - max_rewind - 1 && + cmark_isalnum(data[start + offset + max_rewind + link_end + 1])) + np++; + else if (c == '/' && is_xmpp) + continue; + else if (c != '-' && c != '_') + break; + } + + if (link_end < 2 || np == 0 || + (!cmark_isalpha(data[start + offset + max_rewind + link_end - 1]) && + data[start + offset + max_rewind + link_end - 1] != '.')) { + offset += max_rewind + link_end; + continue; + } + + link_end = autolink_delim(data + start + offset + max_rewind, link_end); + + if (link_end == 0) { + offset += max_rewind + 1; + continue; + } + + cmark_node *link_node = cmark_node_new_with_mem(CMARK_NODE_LINK, parser->mem); + cmark_strbuf buf; + cmark_strbuf_init(parser->mem, &buf, 10); + if (auto_mailto) + cmark_strbuf_puts(&buf, "mailto:"); + cmark_strbuf_put(&buf, data + start + offset + max_rewind - rewind, (bufsize_t)(link_end + rewind)); + link_node->as.link.url = cmark_chunk_buf_detach(&buf); + + cmark_node *link_text = cmark_node_new_with_mem(CMARK_NODE_TEXT, parser->mem); + cmark_chunk email = cmark_chunk_dup( + &detached_chunk, + (bufsize_t)(start + offset + max_rewind - rewind), + (bufsize_t)(link_end + rewind)); + cmark_chunk_to_cstr(parser->mem, &email); + link_text->as.literal = email; + cmark_node_append_child(link_node, link_text); + + cmark_node_insert_after(text, link_node); + + cmark_node *post = cmark_node_new_with_mem(CMARK_NODE_TEXT, parser->mem); + post->as.literal = cmark_chunk_dup(&detached_chunk, + (bufsize_t)(start + offset + max_rewind + link_end), + (bufsize_t)(remaining - offset - max_rewind - link_end)); + + cmark_node_insert_after(link_node, post); + + text->as.literal = cmark_chunk_dup(&detached_chunk, (bufsize_t)start, (bufsize_t)(offset + max_rewind - rewind)); + cmark_chunk_to_cstr(parser->mem, &text->as.literal); + + text = post; + start += offset + max_rewind + link_end; + remaining -= offset + max_rewind + link_end; + offset = 0; + } + + // Convert the reference to allocated memory. + assert(!text->as.literal.alloc); + cmark_chunk_to_cstr(parser->mem, &text->as.literal); + + // Free the detached buffer. + cmark_chunk_free(parser->mem, &detached_chunk); +} + +static cmark_node *postprocess(cmark_syntax_extension *ext, cmark_parser *parser, cmark_node *root) { + cmark_iter *iter; + cmark_event_type ev; + cmark_node *node; + bool in_link = false; + + cmark_consolidate_text_nodes(root); + iter = cmark_iter_new(root); + + while ((ev = cmark_iter_next(iter)) != CMARK_EVENT_DONE) { + node = cmark_iter_get_node(iter); + if (in_link) { + if (ev == CMARK_EVENT_EXIT && node->type == CMARK_NODE_LINK) { + in_link = false; + } + continue; + } + + if (ev == CMARK_EVENT_ENTER && node->type == CMARK_NODE_LINK) { + in_link = true; + continue; + } + + if (ev == CMARK_EVENT_ENTER && node->type == CMARK_NODE_TEXT) { + postprocess_text(parser, node); + } + } + + cmark_iter_free(iter); + + return root; +} + +cmark_syntax_extension *create_autolink_extension(void) { + cmark_syntax_extension *ext = cmark_syntax_extension_new("autolink"); + cmark_llist *special_chars = NULL; + + cmark_syntax_extension_set_match_inline_func(ext, match); + cmark_syntax_extension_set_postprocess_func(ext, postprocess); + + cmark_mem *mem = cmark_get_default_mem_allocator(); + special_chars = cmark_llist_append(mem, special_chars, (void *)':'); + special_chars = cmark_llist_append(mem, special_chars, (void *)'w'); + cmark_syntax_extension_set_special_inline_chars(ext, special_chars); + + return ext; +} diff --git a/liteidex/src/3rdparty/cmark/extensions/autolink.h b/liteidex/src/3rdparty/cmark/extensions/autolink.h new file mode 100644 index 000000000..4e179379d --- /dev/null +++ b/liteidex/src/3rdparty/cmark/extensions/autolink.h @@ -0,0 +1,8 @@ +#ifndef CMARK_GFM_AUTOLINK_H +#define CMARK_GFM_AUTOLINK_H + +#include "cmark-gfm-core-extensions.h" + +cmark_syntax_extension *create_autolink_extension(void); + +#endif diff --git a/liteidex/src/3rdparty/cmark/extensions/cmark-gfm-core-extensions.h b/liteidex/src/3rdparty/cmark/extensions/cmark-gfm-core-extensions.h new file mode 100644 index 000000000..bc29ffd41 --- /dev/null +++ b/liteidex/src/3rdparty/cmark/extensions/cmark-gfm-core-extensions.h @@ -0,0 +1,54 @@ +#ifndef CMARK_GFM_CORE_EXTENSIONS_H +#define CMARK_GFM_CORE_EXTENSIONS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "cmark-gfm-extension_api.h" +#include "cmark-gfm_export.h" +#include +#include + +CMARK_GFM_EXPORT +void cmark_gfm_core_extensions_ensure_registered(void); + +CMARK_GFM_EXPORT +uint16_t cmark_gfm_extensions_get_table_columns(cmark_node *node); + +/** Sets the number of columns for the table, returning 1 on success and 0 on error. + */ +CMARK_GFM_EXPORT +int cmark_gfm_extensions_set_table_columns(cmark_node *node, uint16_t n_columns); + +CMARK_GFM_EXPORT +uint8_t *cmark_gfm_extensions_get_table_alignments(cmark_node *node); + +/** Sets the alignments for the table, returning 1 on success and 0 on error. + */ +CMARK_GFM_EXPORT +int cmark_gfm_extensions_set_table_alignments(cmark_node *node, uint16_t ncols, uint8_t *alignments); + +CMARK_GFM_EXPORT +int cmark_gfm_extensions_get_table_row_is_header(cmark_node *node); + +/** Sets whether the node is a table header row, returning 1 on success and 0 on error. + */ +CMARK_GFM_EXPORT +int cmark_gfm_extensions_set_table_row_is_header(cmark_node *node, int is_header); + +CMARK_GFM_EXPORT +bool cmark_gfm_extensions_get_tasklist_item_checked(cmark_node *node); +/* For backwards compatibility */ +#define cmark_gfm_extensions_tasklist_is_checked cmark_gfm_extensions_get_tasklist_item_checked + +/** Sets whether a tasklist item is "checked" (completed), returning 1 on success and 0 on error. + */ +CMARK_GFM_EXPORT +int cmark_gfm_extensions_set_tasklist_item_checked(cmark_node *node, bool is_checked); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/liteidex/src/3rdparty/cmark/extensions/core-extensions.c b/liteidex/src/3rdparty/cmark/extensions/core-extensions.c new file mode 100644 index 000000000..846e2bc2b --- /dev/null +++ b/liteidex/src/3rdparty/cmark/extensions/core-extensions.c @@ -0,0 +1,27 @@ +#include "cmark-gfm-core-extensions.h" +#include "autolink.h" +#include "strikethrough.h" +#include "table.h" +#include "tagfilter.h" +#include "tasklist.h" +#include "registry.h" +#include "plugin.h" + +static int core_extensions_registration(cmark_plugin *plugin) { + cmark_plugin_register_syntax_extension(plugin, create_table_extension()); + cmark_plugin_register_syntax_extension(plugin, + create_strikethrough_extension()); + cmark_plugin_register_syntax_extension(plugin, create_autolink_extension()); + cmark_plugin_register_syntax_extension(plugin, create_tagfilter_extension()); + cmark_plugin_register_syntax_extension(plugin, create_tasklist_extension()); + return 1; +} + +void cmark_gfm_core_extensions_ensure_registered(void) { + static int registered = 0; + + if (!registered) { + cmark_register_plugin(core_extensions_registration); + registered = 1; + } +} diff --git a/liteidex/src/3rdparty/cmark/extensions/ext_scanners.c b/liteidex/src/3rdparty/cmark/extensions/ext_scanners.c new file mode 100644 index 000000000..0d3ba2881 --- /dev/null +++ b/liteidex/src/3rdparty/cmark/extensions/ext_scanners.c @@ -0,0 +1,879 @@ +/* Generated by re2c 1.3 */ + +#include "ext_scanners.h" +#include + +bufsize_t _ext_scan_at(bufsize_t (*scanner)(const unsigned char *), + unsigned char *ptr, int len, bufsize_t offset) { + bufsize_t res; + + if (ptr == NULL || offset >= len) { + return 0; + } else { + unsigned char lim = ptr[len]; + + ptr[len] = '\0'; + res = scanner(ptr + offset); + ptr[len] = lim; + } + + return res; +} + +bufsize_t _scan_table_start(const unsigned char *p) { + const unsigned char *marker = NULL; + const unsigned char *start = p; + + { + unsigned char yych; + static const unsigned char yybm[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 64, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }; + yych = *p; + if (yych <= ' ') { + if (yych <= '\n') { + if (yych == '\t') + goto yy4; + } else { + if (yych <= '\f') + goto yy4; + if (yych >= ' ') + goto yy4; + } + } else { + if (yych <= '9') { + if (yych == '-') + goto yy5; + } else { + if (yych <= ':') + goto yy6; + if (yych == '|') + goto yy4; + } + } + ++p; + yy3 : { return 0; } + yy4: + yych = *(marker = ++p); + if (yybm[0 + yych] & 64) { + goto yy7; + } + if (yych == '-') + goto yy10; + if (yych == ':') + goto yy12; + goto yy3; + yy5: + yych = *(marker = ++p); + if (yybm[0 + yych] & 128) { + goto yy10; + } + if (yych <= ' ') { + if (yych <= 0x08) + goto yy3; + if (yych <= '\r') + goto yy14; + if (yych <= 0x1F) + goto yy3; + goto yy14; + } else { + if (yych <= ':') { + if (yych <= '9') + goto yy3; + goto yy13; + } else { + if (yych == '|') + goto yy14; + goto yy3; + } + } + yy6: + yych = *(marker = ++p); + if (yybm[0 + yych] & 128) { + goto yy10; + } + goto yy3; + yy7: + yych = *++p; + if (yybm[0 + yych] & 64) { + goto yy7; + } + if (yych == '-') + goto yy10; + if (yych == ':') + goto yy12; + yy9: + p = marker; + goto yy3; + yy10: + yych = *++p; + if (yybm[0 + yych] & 128) { + goto yy10; + } + if (yych <= 0x1F) { + if (yych <= '\n') { + if (yych <= 0x08) + goto yy9; + if (yych <= '\t') + goto yy13; + goto yy15; + } else { + if (yych <= '\f') + goto yy13; + if (yych <= '\r') + goto yy17; + goto yy9; + } + } else { + if (yych <= ':') { + if (yych <= ' ') + goto yy13; + if (yych <= '9') + goto yy9; + goto yy13; + } else { + if (yych == '|') + goto yy18; + goto yy9; + } + } + yy12: + yych = *++p; + if (yybm[0 + yych] & 128) { + goto yy10; + } + goto yy9; + yy13: + yych = *++p; + yy14: + if (yych <= '\r') { + if (yych <= '\t') { + if (yych <= 0x08) + goto yy9; + goto yy13; + } else { + if (yych <= '\n') + goto yy15; + if (yych <= '\f') + goto yy13; + goto yy17; + } + } else { + if (yych <= ' ') { + if (yych <= 0x1F) + goto yy9; + goto yy13; + } else { + if (yych == '|') + goto yy18; + goto yy9; + } + } + yy15: + ++p; + { return (bufsize_t)(p - start); } + yy17: + yych = *++p; + if (yych == '\n') + goto yy15; + goto yy9; + yy18: + yych = *++p; + if (yybm[0 + yych] & 128) { + goto yy10; + } + if (yych <= '\r') { + if (yych <= '\t') { + if (yych <= 0x08) + goto yy9; + goto yy18; + } else { + if (yych <= '\n') + goto yy15; + if (yych <= '\f') + goto yy18; + goto yy17; + } + } else { + if (yych <= ' ') { + if (yych <= 0x1F) + goto yy9; + goto yy18; + } else { + if (yych == ':') + goto yy12; + goto yy9; + } + } + } +} + +bufsize_t _scan_table_cell(const unsigned char *p) { + const unsigned char *marker = NULL; + const unsigned char *start = p; + + { + unsigned char yych; + unsigned int yyaccept = 0; + static const unsigned char yybm[] = { + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 0, 64, 64, 0, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 128, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 0, 64, + 64, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, + }; + yych = *p; + if (yybm[0 + yych] & 64) { + goto yy22; + } + if (yych <= 0xEC) { + if (yych <= 0xC1) { + if (yych <= '\r') + goto yy25; + if (yych <= '\\') + goto yy27; + goto yy25; + } else { + if (yych <= 0xDF) + goto yy29; + if (yych <= 0xE0) + goto yy30; + goto yy31; + } + } else { + if (yych <= 0xF0) { + if (yych <= 0xED) + goto yy32; + if (yych <= 0xEF) + goto yy31; + goto yy33; + } else { + if (yych <= 0xF3) + goto yy34; + if (yych <= 0xF4) + goto yy35; + goto yy25; + } + } + yy22: + yyaccept = 0; + yych = *(marker = ++p); + if (yybm[0 + yych] & 64) { + goto yy22; + } + if (yych <= 0xEC) { + if (yych <= 0xC1) { + if (yych <= '\r') + goto yy24; + if (yych <= '\\') + goto yy27; + } else { + if (yych <= 0xDF) + goto yy36; + if (yych <= 0xE0) + goto yy38; + goto yy39; + } + } else { + if (yych <= 0xF0) { + if (yych <= 0xED) + goto yy40; + if (yych <= 0xEF) + goto yy39; + goto yy41; + } else { + if (yych <= 0xF3) + goto yy42; + if (yych <= 0xF4) + goto yy43; + } + } + yy24 : { return (bufsize_t)(p - start); } + yy25: + ++p; + yy26 : { return 0; } + yy27: + yyaccept = 0; + yych = *(marker = ++p); + if (yybm[0 + yych] & 128) { + goto yy27; + } + if (yych <= 0xDF) { + if (yych <= '\f') { + if (yych == '\n') + goto yy24; + goto yy22; + } else { + if (yych <= '\r') + goto yy24; + if (yych <= 0x7F) + goto yy22; + if (yych <= 0xC1) + goto yy24; + goto yy36; + } + } else { + if (yych <= 0xEF) { + if (yych <= 0xE0) + goto yy38; + if (yych == 0xED) + goto yy40; + goto yy39; + } else { + if (yych <= 0xF0) + goto yy41; + if (yych <= 0xF3) + goto yy42; + if (yych <= 0xF4) + goto yy43; + goto yy24; + } + } + yy29: + yych = *++p; + if (yych <= 0x7F) + goto yy26; + if (yych <= 0xBF) + goto yy22; + goto yy26; + yy30: + yyaccept = 1; + yych = *(marker = ++p); + if (yych <= 0x9F) + goto yy26; + if (yych <= 0xBF) + goto yy36; + goto yy26; + yy31: + yyaccept = 1; + yych = *(marker = ++p); + if (yych <= 0x7F) + goto yy26; + if (yych <= 0xBF) + goto yy36; + goto yy26; + yy32: + yyaccept = 1; + yych = *(marker = ++p); + if (yych <= 0x7F) + goto yy26; + if (yych <= 0x9F) + goto yy36; + goto yy26; + yy33: + yyaccept = 1; + yych = *(marker = ++p); + if (yych <= 0x8F) + goto yy26; + if (yych <= 0xBF) + goto yy39; + goto yy26; + yy34: + yyaccept = 1; + yych = *(marker = ++p); + if (yych <= 0x7F) + goto yy26; + if (yych <= 0xBF) + goto yy39; + goto yy26; + yy35: + yyaccept = 1; + yych = *(marker = ++p); + if (yych <= 0x7F) + goto yy26; + if (yych <= 0x8F) + goto yy39; + goto yy26; + yy36: + yych = *++p; + if (yych <= 0x7F) + goto yy37; + if (yych <= 0xBF) + goto yy22; + yy37: + p = marker; + if (yyaccept == 0) { + goto yy24; + } else { + goto yy26; + } + yy38: + yych = *++p; + if (yych <= 0x9F) + goto yy37; + if (yych <= 0xBF) + goto yy36; + goto yy37; + yy39: + yych = *++p; + if (yych <= 0x7F) + goto yy37; + if (yych <= 0xBF) + goto yy36; + goto yy37; + yy40: + yych = *++p; + if (yych <= 0x7F) + goto yy37; + if (yych <= 0x9F) + goto yy36; + goto yy37; + yy41: + yych = *++p; + if (yych <= 0x8F) + goto yy37; + if (yych <= 0xBF) + goto yy39; + goto yy37; + yy42: + yych = *++p; + if (yych <= 0x7F) + goto yy37; + if (yych <= 0xBF) + goto yy39; + goto yy37; + yy43: + yych = *++p; + if (yych <= 0x7F) + goto yy37; + if (yych <= 0x8F) + goto yy39; + goto yy37; + } +} + +bufsize_t _scan_table_cell_end(const unsigned char *p) { + const unsigned char *start = p; + + { + unsigned char yych; + static const unsigned char yybm[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 128, 128, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }; + yych = *p; + if (yych == '|') + goto yy48; + ++p; + { return 0; } + yy48: + yych = *++p; + if (yybm[0 + yych] & 128) { + goto yy48; + } + { return (bufsize_t)(p - start); } + } +} + +bufsize_t _scan_table_row_end(const unsigned char *p) { + const unsigned char *marker = NULL; + const unsigned char *start = p; + + { + unsigned char yych; + static const unsigned char yybm[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 128, 128, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }; + yych = *p; + if (yych <= '\f') { + if (yych <= 0x08) + goto yy53; + if (yych == '\n') + goto yy56; + goto yy55; + } else { + if (yych <= '\r') + goto yy58; + if (yych == ' ') + goto yy55; + } + yy53: + ++p; + yy54 : { return 0; } + yy55: + yych = *(marker = ++p); + if (yych <= 0x08) + goto yy54; + if (yych <= '\r') + goto yy60; + if (yych == ' ') + goto yy60; + goto yy54; + yy56: + ++p; + { return (bufsize_t)(p - start); } + yy58: + yych = *++p; + if (yych == '\n') + goto yy56; + goto yy54; + yy59: + yych = *++p; + yy60: + if (yybm[0 + yych] & 128) { + goto yy59; + } + if (yych <= 0x08) + goto yy61; + if (yych <= '\n') + goto yy56; + if (yych <= '\r') + goto yy62; + yy61: + p = marker; + goto yy54; + yy62: + yych = *++p; + if (yych == '\n') + goto yy56; + goto yy61; + } +} + +bufsize_t _scan_tasklist(const unsigned char *p) { + const unsigned char *marker = NULL; + const unsigned char *start = p; + + { + unsigned char yych; + static const unsigned char yybm[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 64, 64, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }; + yych = *p; + if (yych <= ' ') { + if (yych <= '\n') { + if (yych == '\t') + goto yy67; + } else { + if (yych <= '\f') + goto yy67; + if (yych >= ' ') + goto yy67; + } + } else { + if (yych <= ',') { + if (yych <= ')') + goto yy65; + if (yych <= '+') + goto yy68; + } else { + if (yych <= '-') + goto yy68; + if (yych <= '/') + goto yy65; + if (yych <= '9') + goto yy69; + } + } + yy65: + ++p; + yy66 : { return 0; } + yy67: + yych = *(marker = ++p); + if (yybm[0 + yych] & 64) { + goto yy70; + } + if (yych <= ',') { + if (yych <= ')') + goto yy66; + if (yych <= '+') + goto yy73; + goto yy66; + } else { + if (yych <= '-') + goto yy73; + if (yych <= '/') + goto yy66; + if (yych <= '9') + goto yy74; + goto yy66; + } + yy68: + yych = *(marker = ++p); + if (yych <= '\n') { + if (yych == '\t') + goto yy75; + goto yy66; + } else { + if (yych <= '\f') + goto yy75; + if (yych == ' ') + goto yy75; + goto yy66; + } + yy69: + yych = *(marker = ++p); + if (yych <= 0x1F) { + if (yych <= '\t') { + if (yych <= 0x08) + goto yy78; + goto yy73; + } else { + if (yych <= '\n') + goto yy66; + if (yych <= '\f') + goto yy73; + goto yy78; + } + } else { + if (yych <= 0x7F) { + if (yych <= ' ') + goto yy73; + goto yy78; + } else { + if (yych <= 0xC1) + goto yy66; + if (yych <= 0xF4) + goto yy78; + goto yy66; + } + } + yy70: + yych = *++p; + if (yybm[0 + yych] & 64) { + goto yy70; + } + if (yych <= ',') { + if (yych <= ')') + goto yy72; + if (yych <= '+') + goto yy73; + } else { + if (yych <= '-') + goto yy73; + if (yych <= '/') + goto yy72; + if (yych <= '9') + goto yy74; + } + yy72: + p = marker; + goto yy66; + yy73: + yych = *++p; + if (yych == '[') + goto yy72; + goto yy76; + yy74: + yych = *++p; + if (yych <= '\n') { + if (yych == '\t') + goto yy73; + goto yy78; + } else { + if (yych <= '\f') + goto yy73; + if (yych == ' ') + goto yy73; + goto yy78; + } + yy75: + yych = *++p; + yy76: + if (yych <= '\f') { + if (yych == '\t') + goto yy75; + if (yych <= '\n') + goto yy72; + goto yy75; + } else { + if (yych <= ' ') { + if (yych <= 0x1F) + goto yy72; + goto yy75; + } else { + if (yych == '[') + goto yy86; + goto yy72; + } + } + yy77: + yych = *++p; + yy78: + if (yybm[0 + yych] & 128) { + goto yy77; + } + if (yych <= 0xC1) { + if (yych <= '\f') { + if (yych <= 0x08) + goto yy73; + if (yych == '\n') + goto yy72; + goto yy75; + } else { + if (yych == ' ') + goto yy75; + if (yych <= 0x7F) + goto yy73; + goto yy72; + } + } else { + if (yych <= 0xED) { + if (yych <= 0xDF) + goto yy79; + if (yych <= 0xE0) + goto yy80; + if (yych <= 0xEC) + goto yy81; + goto yy82; + } else { + if (yych <= 0xF0) { + if (yych <= 0xEF) + goto yy81; + goto yy83; + } else { + if (yych <= 0xF3) + goto yy84; + if (yych <= 0xF4) + goto yy85; + goto yy72; + } + } + } + yy79: + yych = *++p; + if (yych <= 0x7F) + goto yy72; + if (yych <= 0xBF) + goto yy73; + goto yy72; + yy80: + yych = *++p; + if (yych <= 0x9F) + goto yy72; + if (yych <= 0xBF) + goto yy79; + goto yy72; + yy81: + yych = *++p; + if (yych <= 0x7F) + goto yy72; + if (yych <= 0xBF) + goto yy79; + goto yy72; + yy82: + yych = *++p; + if (yych <= 0x7F) + goto yy72; + if (yych <= 0x9F) + goto yy79; + goto yy72; + yy83: + yych = *++p; + if (yych <= 0x8F) + goto yy72; + if (yych <= 0xBF) + goto yy81; + goto yy72; + yy84: + yych = *++p; + if (yych <= 0x7F) + goto yy72; + if (yych <= 0xBF) + goto yy81; + goto yy72; + yy85: + yych = *++p; + if (yych <= 0x7F) + goto yy72; + if (yych <= 0x8F) + goto yy81; + goto yy72; + yy86: + yych = *++p; + if (yych <= 'W') { + if (yych != ' ') + goto yy72; + } else { + if (yych <= 'X') + goto yy87; + if (yych != 'x') + goto yy72; + } + yy87: + yych = *++p; + if (yych != ']') + goto yy72; + yych = *++p; + if (yych <= '\n') { + if (yych != '\t') + goto yy72; + } else { + if (yych <= '\f') + goto yy89; + if (yych != ' ') + goto yy72; + } + yy89: + yych = *++p; + if (yych <= '\n') { + if (yych == '\t') + goto yy89; + } else { + if (yych <= '\f') + goto yy89; + if (yych == ' ') + goto yy89; + } + { return (bufsize_t)(p - start); } + } +} diff --git a/liteidex/src/3rdparty/cmark/extensions/ext_scanners.h b/liteidex/src/3rdparty/cmark/extensions/ext_scanners.h new file mode 100644 index 000000000..6dd4a725d --- /dev/null +++ b/liteidex/src/3rdparty/cmark/extensions/ext_scanners.h @@ -0,0 +1,24 @@ +#include "chunk.h" +#include "cmark-gfm.h" + +#ifdef __cplusplus +extern "C" { +#endif + +bufsize_t _ext_scan_at(bufsize_t (*scanner)(const unsigned char *), + unsigned char *ptr, int len, bufsize_t offset); +bufsize_t _scan_table_start(const unsigned char *p); +bufsize_t _scan_table_cell(const unsigned char *p); +bufsize_t _scan_table_cell_end(const unsigned char *p); +bufsize_t _scan_table_row_end(const unsigned char *p); +bufsize_t _scan_tasklist(const unsigned char *p); + +#define scan_table_start(c, l, n) _ext_scan_at(&_scan_table_start, c, l, n) +#define scan_table_cell(c, l, n) _ext_scan_at(&_scan_table_cell, c, l, n) +#define scan_table_cell_end(c, l, n) _ext_scan_at(&_scan_table_cell_end, c, l, n) +#define scan_table_row_end(c, l, n) _ext_scan_at(&_scan_table_row_end, c, l, n) +#define scan_tasklist(c, l, n) _ext_scan_at(&_scan_tasklist, c, l, n) + +#ifdef __cplusplus +} +#endif diff --git a/liteidex/src/3rdparty/cmark/extensions/strikethrough.c b/liteidex/src/3rdparty/cmark/extensions/strikethrough.c new file mode 100644 index 000000000..e08842242 --- /dev/null +++ b/liteidex/src/3rdparty/cmark/extensions/strikethrough.c @@ -0,0 +1,167 @@ +#include "strikethrough.h" +#include +#include + +cmark_node_type CMARK_NODE_STRIKETHROUGH; + +static cmark_node *match(cmark_syntax_extension *self, cmark_parser *parser, + cmark_node *parent, unsigned char character, + cmark_inline_parser *inline_parser) { + cmark_node *res = NULL; + int left_flanking, right_flanking, punct_before, punct_after, delims; + char buffer[101]; + + if (character != '~') + return NULL; + + delims = cmark_inline_parser_scan_delimiters( + inline_parser, sizeof(buffer) - 1, '~', + &left_flanking, + &right_flanking, &punct_before, &punct_after); + + memset(buffer, '~', delims); + buffer[delims] = 0; + + res = cmark_node_new_with_mem(CMARK_NODE_TEXT, parser->mem); + cmark_node_set_literal(res, buffer); + res->start_line = res->end_line = cmark_inline_parser_get_line(inline_parser); + res->start_column = cmark_inline_parser_get_column(inline_parser) - delims; + + if ((left_flanking || right_flanking) && + (delims == 2 || (!(parser->options & CMARK_OPT_STRIKETHROUGH_DOUBLE_TILDE) && delims == 1))) { + cmark_inline_parser_push_delimiter(inline_parser, character, left_flanking, + right_flanking, res); + } + + return res; +} + +static delimiter *insert(cmark_syntax_extension *self, cmark_parser *parser, + cmark_inline_parser *inline_parser, delimiter *opener, + delimiter *closer) { + cmark_node *strikethrough; + cmark_node *tmp, *next; + delimiter *delim, *tmp_delim; + delimiter *res = closer->next; + + strikethrough = opener->inl_text; + + if (opener->inl_text->as.literal.len != closer->inl_text->as.literal.len) + goto done; + + if (!cmark_node_set_type(strikethrough, CMARK_NODE_STRIKETHROUGH)) + goto done; + + cmark_node_set_syntax_extension(strikethrough, self); + + tmp = cmark_node_next(opener->inl_text); + + while (tmp) { + if (tmp == closer->inl_text) + break; + next = cmark_node_next(tmp); + cmark_node_append_child(strikethrough, tmp); + tmp = next; + } + + strikethrough->end_column = closer->inl_text->start_column + closer->inl_text->as.literal.len - 1; + cmark_node_free(closer->inl_text); + +done: + delim = closer; + while (delim != NULL && delim != opener) { + tmp_delim = delim->previous; + cmark_inline_parser_remove_delimiter(inline_parser, delim); + delim = tmp_delim; + } + + cmark_inline_parser_remove_delimiter(inline_parser, opener); + + return res; +} + +static const char *get_type_string(cmark_syntax_extension *extension, + cmark_node *node) { + return node->type == CMARK_NODE_STRIKETHROUGH ? "strikethrough" : ""; +} + +static int can_contain(cmark_syntax_extension *extension, cmark_node *node, + cmark_node_type child_type) { + if (node->type != CMARK_NODE_STRIKETHROUGH) + return false; + + return CMARK_NODE_TYPE_INLINE_P(child_type); +} + +static void commonmark_render(cmark_syntax_extension *extension, + cmark_renderer *renderer, cmark_node *node, + cmark_event_type ev_type, int options) { + renderer->out(renderer, node, "~~", false, LITERAL); +} + +static void latex_render(cmark_syntax_extension *extension, + cmark_renderer *renderer, cmark_node *node, + cmark_event_type ev_type, int options) { + // requires \usepackage{ulem} + bool entering = (ev_type == CMARK_EVENT_ENTER); + if (entering) { + renderer->out(renderer, node, "\\sout{", false, LITERAL); + } else { + renderer->out(renderer, node, "}", false, LITERAL); + } +} + +static void man_render(cmark_syntax_extension *extension, + cmark_renderer *renderer, cmark_node *node, + cmark_event_type ev_type, int options) { + bool entering = (ev_type == CMARK_EVENT_ENTER); + if (entering) { + renderer->cr(renderer); + renderer->out(renderer, node, ".ST \"", false, LITERAL); + } else { + renderer->out(renderer, node, "\"", false, LITERAL); + renderer->cr(renderer); + } +} + +static void html_render(cmark_syntax_extension *extension, + cmark_html_renderer *renderer, cmark_node *node, + cmark_event_type ev_type, int options) { + bool entering = (ev_type == CMARK_EVENT_ENTER); + if (entering) { + cmark_strbuf_puts(renderer->html, ""); + } else { + cmark_strbuf_puts(renderer->html, ""); + } +} + +static void plaintext_render(cmark_syntax_extension *extension, + cmark_renderer *renderer, cmark_node *node, + cmark_event_type ev_type, int options) { + renderer->out(renderer, node, "~", false, LITERAL); +} + +cmark_syntax_extension *create_strikethrough_extension(void) { + cmark_syntax_extension *ext = cmark_syntax_extension_new("strikethrough"); + cmark_llist *special_chars = NULL; + + cmark_syntax_extension_set_get_type_string_func(ext, get_type_string); + cmark_syntax_extension_set_can_contain_func(ext, can_contain); + cmark_syntax_extension_set_commonmark_render_func(ext, commonmark_render); + cmark_syntax_extension_set_latex_render_func(ext, latex_render); + cmark_syntax_extension_set_man_render_func(ext, man_render); + cmark_syntax_extension_set_html_render_func(ext, html_render); + cmark_syntax_extension_set_plaintext_render_func(ext, plaintext_render); + CMARK_NODE_STRIKETHROUGH = cmark_syntax_extension_add_node(1); + + cmark_syntax_extension_set_match_inline_func(ext, match); + cmark_syntax_extension_set_inline_from_delim_func(ext, insert); + + cmark_mem *mem = cmark_get_default_mem_allocator(); + special_chars = cmark_llist_append(mem, special_chars, (void *)'~'); + cmark_syntax_extension_set_special_inline_chars(ext, special_chars); + + cmark_syntax_extension_set_emphasis(ext, 1); + + return ext; +} diff --git a/liteidex/src/3rdparty/cmark/extensions/strikethrough.h b/liteidex/src/3rdparty/cmark/extensions/strikethrough.h new file mode 100644 index 000000000..a52a2b4ac --- /dev/null +++ b/liteidex/src/3rdparty/cmark/extensions/strikethrough.h @@ -0,0 +1,9 @@ +#ifndef CMARK_GFM_STRIKETHROUGH_H +#define CMARK_GFM_STRIKETHROUGH_H + +#include "cmark-gfm-core-extensions.h" + +extern cmark_node_type CMARK_NODE_STRIKETHROUGH; +cmark_syntax_extension *create_strikethrough_extension(void); + +#endif diff --git a/liteidex/src/3rdparty/cmark/extensions/table.c b/liteidex/src/3rdparty/cmark/extensions/table.c new file mode 100644 index 000000000..e8359f259 --- /dev/null +++ b/liteidex/src/3rdparty/cmark/extensions/table.c @@ -0,0 +1,917 @@ +#include +#include +#include +#include +#include +#include +#include + +#include "ext_scanners.h" +#include "strikethrough.h" +#include "table.h" +#include "cmark-gfm-core-extensions.h" + +// Limit to prevent a malicious input from causing a denial of service. +#define MAX_AUTOCOMPLETED_CELLS 0x80000 + +// Custom node flag, initialized in `create_table_extension`. +static cmark_node_internal_flags CMARK_NODE__TABLE_VISITED; + +cmark_node_type CMARK_NODE_TABLE, CMARK_NODE_TABLE_ROW, + CMARK_NODE_TABLE_CELL; + +typedef struct { + cmark_strbuf *buf; + int start_offset, end_offset, internal_offset; +} node_cell; + +typedef struct { + uint16_t n_columns; + int paragraph_offset; + node_cell *cells; +} table_row; + +typedef struct { + uint16_t n_columns; + uint8_t *alignments; + int n_rows; + int n_nonempty_cells; +} node_table; + +typedef struct { + bool is_header; +} node_table_row; + +static void free_table_cell(cmark_mem *mem, node_cell *cell) { + cmark_strbuf_free((cmark_strbuf *)cell->buf); + mem->free(cell->buf); +} + +static void free_row_cells(cmark_mem *mem, table_row *row) { + while (row->n_columns > 0) { + free_table_cell(mem, &row->cells[--row->n_columns]); + } + mem->free(row->cells); + row->cells = NULL; +} + +static void free_table_row(cmark_mem *mem, table_row *row) { + if (!row) + return; + + free_row_cells(mem, row); + mem->free(row); +} + +static void free_node_table(cmark_mem *mem, void *ptr) { + node_table *t = (node_table *)ptr; + mem->free(t->alignments); + mem->free(t); +} + +static void free_node_table_row(cmark_mem *mem, void *ptr) { + mem->free(ptr); +} + +static int get_n_table_columns(cmark_node *node) { + if (!node || node->type != CMARK_NODE_TABLE) + return -1; + + return (int)((node_table *)node->as.opaque)->n_columns; +} + +static int set_n_table_columns(cmark_node *node, uint16_t n_columns) { + if (!node || node->type != CMARK_NODE_TABLE) + return 0; + + ((node_table *)node->as.opaque)->n_columns = n_columns; + return 1; +} + +// Increment the number of rows in the table. Also update n_nonempty_cells, +// which keeps track of the number of cells which were parsed from the +// input file. (If one of the rows is too short, then the trailing cells +// are autocompleted. Autocompleted cells are not counted in n_nonempty_cells.) +// The purpose of this is to prevent a malicious input from generating a very +// large number of autocompleted cells, which could cause a denial of service +// vulnerability. +static int incr_table_row_count(cmark_node *node, int i) { + if (!node || node->type != CMARK_NODE_TABLE) { + return 0; + } + + ((node_table *)node->as.opaque)->n_rows++; + ((node_table *)node->as.opaque)->n_nonempty_cells += i; + return 1; +} + +// Calculate the number of autocompleted cells. +static int get_n_autocompleted_cells(cmark_node *node) { + if (!node || node->type != CMARK_NODE_TABLE) { + return 0; + } + + const node_table *nt = (node_table *)node->as.opaque; + return (nt->n_columns * nt->n_rows) - nt->n_nonempty_cells; +} + +static uint8_t *get_table_alignments(cmark_node *node) { + if (!node || node->type != CMARK_NODE_TABLE) + return 0; + + return ((node_table *)node->as.opaque)->alignments; +} + +static int set_table_alignments(cmark_node *node, uint8_t *alignments) { + if (!node || node->type != CMARK_NODE_TABLE) + return 0; + + ((node_table *)node->as.opaque)->alignments = alignments; + return 1; +} + +static uint8_t get_cell_alignment(cmark_node *node) { + if (!node || node->type != CMARK_NODE_TABLE_CELL) + return 0; + + const uint8_t *alignments = get_table_alignments(node->parent->parent); + int i = node->as.cell_index; + return alignments[i]; +} + +static int set_cell_index(cmark_node *node, int i) { + if (!node || node->type != CMARK_NODE_TABLE_CELL) + return 0; + + node->as.cell_index = i; + return 1; +} + +static cmark_strbuf *unescape_pipes(cmark_mem *mem, unsigned char *string, bufsize_t len) +{ + cmark_strbuf *res = (cmark_strbuf *)mem->calloc(1, sizeof(cmark_strbuf)); + bufsize_t r, w; + + cmark_strbuf_init(mem, res, len + 1); + cmark_strbuf_put(res, string, len); + cmark_strbuf_putc(res, '\0'); + + for (r = 0, w = 0; r < len; ++r) { + if (res->ptr[r] == '\\' && res->ptr[r + 1] == '|') + r++; + + res->ptr[w++] = res->ptr[r]; + } + + cmark_strbuf_truncate(res, w); + + return res; +} + +// Adds a new cell to the end of the row. A pointer to the new cell is returned +// for the caller to initialize. +static node_cell* append_row_cell(cmark_mem *mem, table_row *row) { + const uint32_t n_columns = row->n_columns + 1; + // realloc when n_columns is a power of 2 + if ((n_columns & (n_columns-1)) == 0) { + // make sure we never wrap row->n_columns + // offset will != len and our exit will clean up as intended + if (n_columns > UINT16_MAX) { + return NULL; + } + // Use realloc to double the size of the buffer. + row->cells = (node_cell *)mem->realloc(row->cells, (2 * n_columns - 1) * sizeof(node_cell)); + } + row->n_columns = (uint16_t)n_columns; + return &row->cells[n_columns-1]; +} + +static table_row *row_from_string(cmark_syntax_extension *self, + cmark_parser *parser, unsigned char *string, + int len) { + // Parses a single table row. It has the following form: + // `delim? table_cell (delim table_cell)* delim? newline` + // Note that cells are allowed to be empty. + // + // From the GitHub-flavored Markdown specification: + // + // > Each row consists of cells containing arbitrary text, in which inlines + // > are parsed, separated by pipes (|). A leading and trailing pipe is also + // > recommended for clarity of reading, and if there’s otherwise parsing + // > ambiguity. + + table_row *row = NULL; + bufsize_t cell_matched = 1, pipe_matched = 1, offset; + int expect_more_cells = 1; + int row_end_offset = 0; + int int_overflow_abort = 0; + + row = (table_row *)parser->mem->calloc(1, sizeof(table_row)); + row->n_columns = 0; + row->cells = NULL; + + // Scan past the (optional) leading pipe. + offset = scan_table_cell_end(string, len, 0); + + // Parse the cells of the row. Stop if we reach the end of the input, or if we + // cannot detect any more cells. + while (offset < len && expect_more_cells) { + cell_matched = scan_table_cell(string, len, offset); + pipe_matched = scan_table_cell_end(string, len, offset + cell_matched); + + if (cell_matched || pipe_matched) { + // We are guaranteed to have a cell, since (1) either we found some + // content and cell_matched, or (2) we found an empty cell followed by a + // pipe. + cmark_strbuf *cell_buf = unescape_pipes(parser->mem, string + offset, + cell_matched); + cmark_strbuf_trim(cell_buf); + + node_cell *cell = append_row_cell(parser->mem, row); + if (!cell) { + int_overflow_abort = 1; + cmark_strbuf_free(cell_buf); + parser->mem->free(cell_buf); + break; + } + cell->buf = cell_buf; + cell->start_offset = offset; + cell->end_offset = offset + cell_matched - 1; + cell->internal_offset = 0; + + while (cell->start_offset > row->paragraph_offset && string[cell->start_offset - 1] != '|') { + --cell->start_offset; + ++cell->internal_offset; + } + } + + offset += cell_matched + pipe_matched; + + if (pipe_matched) { + expect_more_cells = 1; + } else { + // We've scanned the last cell. Check if we have reached the end of the row + row_end_offset = scan_table_row_end(string, len, offset); + offset += row_end_offset; + + // If the end of the row is not the end of the input, + // the row is not a real row but potentially part of the paragraph + // preceding the table. + if (row_end_offset && offset != len) { + row->paragraph_offset = offset; + + free_row_cells(parser->mem, row); + + // Scan past the (optional) leading pipe. + offset += scan_table_cell_end(string, len, offset); + + expect_more_cells = 1; + } else { + expect_more_cells = 0; + } + } + } + + if (offset != len || row->n_columns == 0 || int_overflow_abort) { + free_table_row(parser->mem, row); + row = NULL; + } + + return row; +} + +static void try_inserting_table_header_paragraph(cmark_parser *parser, + cmark_node *parent_container, + unsigned char *parent_string, + int paragraph_offset) { + cmark_node *paragraph; + cmark_strbuf *paragraph_content; + + paragraph = cmark_node_new_with_mem(CMARK_NODE_PARAGRAPH, parser->mem); + + paragraph_content = unescape_pipes(parser->mem, parent_string, paragraph_offset); + cmark_strbuf_trim(paragraph_content); + cmark_node_set_string_content(paragraph, (char *) paragraph_content->ptr); + cmark_strbuf_free(paragraph_content); + parser->mem->free(paragraph_content); + + if (!cmark_node_insert_before(parent_container, paragraph)) { + parser->mem->free(paragraph); + } +} + +static cmark_node *try_opening_table_header(cmark_syntax_extension *self, + cmark_parser *parser, + cmark_node *parent_container, + unsigned char *input, int len) { + cmark_node *table_header; + table_row *header_row = NULL; + table_row *delimiter_row = NULL; + node_table_row *ntr; + const char *parent_string; + uint16_t i; + + if (parent_container->flags & CMARK_NODE__TABLE_VISITED) { + return parent_container; + } + + if (!scan_table_start(input, len, cmark_parser_get_first_nonspace(parser))) { + return parent_container; + } + + // Since scan_table_start was successful, we must have a delimiter row. + delimiter_row = row_from_string( + self, parser, input + cmark_parser_get_first_nonspace(parser), + len - cmark_parser_get_first_nonspace(parser)); + // assert may be optimized out, don't rely on it for security boundaries + if (!delimiter_row) { + return parent_container; + } + + assert(delimiter_row); + + cmark_arena_push(); + + // Check for a matching header row. We call `row_from_string` with the entire + // (potentially long) parent container as input, but this should be safe since + // `row_from_string` bails out early if it does not find a row. + parent_string = cmark_node_get_string_content(parent_container); + header_row = row_from_string(self, parser, (unsigned char *)parent_string, + (int)strlen(parent_string)); + if (!header_row || header_row->n_columns != delimiter_row->n_columns) { + free_table_row(parser->mem, delimiter_row); + free_table_row(parser->mem, header_row); + cmark_arena_pop(); + parent_container->flags |= CMARK_NODE__TABLE_VISITED; + return parent_container; + } + + if (cmark_arena_pop()) { + delimiter_row = row_from_string( + self, parser, input + cmark_parser_get_first_nonspace(parser), + len - cmark_parser_get_first_nonspace(parser)); + header_row = row_from_string(self, parser, (unsigned char *)parent_string, + (int)strlen(parent_string)); + // row_from_string can return NULL, add additional check to ensure n_columns match + if (!delimiter_row || !header_row || header_row->n_columns != delimiter_row->n_columns) { + free_table_row(parser->mem, delimiter_row); + free_table_row(parser->mem, header_row); + return parent_container; + } + } + + if (!cmark_node_set_type(parent_container, CMARK_NODE_TABLE)) { + free_table_row(parser->mem, header_row); + free_table_row(parser->mem, delimiter_row); + return parent_container; + } + + if (header_row->paragraph_offset) { + try_inserting_table_header_paragraph(parser, parent_container, (unsigned char *)parent_string, + header_row->paragraph_offset); + } + + cmark_node_set_syntax_extension(parent_container, self); + parent_container->as.opaque = parser->mem->calloc(1, sizeof(node_table)); + set_n_table_columns(parent_container, header_row->n_columns); + + // allocate alignments based on delimiter_row->n_columns + // since we populate the alignments array based on delimiter_row->cells + uint8_t *alignments = + (uint8_t *)parser->mem->calloc(delimiter_row->n_columns, sizeof(uint8_t)); + for (i = 0; i < delimiter_row->n_columns; ++i) { + node_cell *node = &delimiter_row->cells[i]; + bool left = node->buf->ptr[0] == ':', right = node->buf->ptr[node->buf->size - 1] == ':'; + + if (left && right) + alignments[i] = 'c'; + else if (left) + alignments[i] = 'l'; + else if (right) + alignments[i] = 'r'; + } + set_table_alignments(parent_container, alignments); + + table_header = + cmark_parser_add_child(parser, parent_container, CMARK_NODE_TABLE_ROW, + parent_container->start_column); + cmark_node_set_syntax_extension(table_header, self); + table_header->end_column = parent_container->start_column + (int)strlen(parent_string) - 2; + table_header->start_line = table_header->end_line = parent_container->start_line; + + table_header->as.opaque = ntr = (node_table_row *)parser->mem->calloc(1, sizeof(node_table_row)); + ntr->is_header = true; + + for (i = 0; i < header_row->n_columns; ++i) { + node_cell *cell = &header_row->cells[i]; + cmark_node *header_cell = cmark_parser_add_child(parser, table_header, + CMARK_NODE_TABLE_CELL, parent_container->start_column + cell->start_offset); + header_cell->start_line = header_cell->end_line = parent_container->start_line; + header_cell->internal_offset = cell->internal_offset; + header_cell->end_column = parent_container->start_column + cell->end_offset; + cmark_node_set_string_content(header_cell, (char *) cell->buf->ptr); + cmark_node_set_syntax_extension(header_cell, self); + set_cell_index(header_cell, i); + } + + incr_table_row_count(parent_container, i); + + cmark_parser_advance_offset( + parser, (char *)input, + (int)strlen((char *)input) - 1 - cmark_parser_get_offset(parser), false); + + free_table_row(parser->mem, header_row); + free_table_row(parser->mem, delimiter_row); + return parent_container; +} + +static cmark_node *try_opening_table_row(cmark_syntax_extension *self, + cmark_parser *parser, + cmark_node *parent_container, + unsigned char *input, int len) { + cmark_node *table_row_block; + table_row *row; + + if (cmark_parser_is_blank(parser)) + return NULL; + + if (get_n_autocompleted_cells(parent_container) > MAX_AUTOCOMPLETED_CELLS) { + return NULL; + } + + table_row_block = + cmark_parser_add_child(parser, parent_container, CMARK_NODE_TABLE_ROW, + parent_container->start_column); + cmark_node_set_syntax_extension(table_row_block, self); + table_row_block->end_column = parent_container->end_column; + table_row_block->as.opaque = parser->mem->calloc(1, sizeof(node_table_row)); + + row = row_from_string(self, parser, input + cmark_parser_get_first_nonspace(parser), + len - cmark_parser_get_first_nonspace(parser)); + + if (!row) { + // clean up the dangling node + cmark_node_free(table_row_block); + return NULL; + } + + { + int i, table_columns = get_n_table_columns(parent_container); + + for (i = 0; i < row->n_columns && i < table_columns; ++i) { + node_cell *cell = &row->cells[i]; + cmark_node *node = cmark_parser_add_child(parser, table_row_block, + CMARK_NODE_TABLE_CELL, parent_container->start_column + cell->start_offset); + node->internal_offset = cell->internal_offset; + node->end_column = parent_container->start_column + cell->end_offset; + cmark_node_set_string_content(node, (char *) cell->buf->ptr); + cmark_node_set_syntax_extension(node, self); + set_cell_index(node, i); + } + + incr_table_row_count(parent_container, i); + + for (; i < table_columns; ++i) { + cmark_node *node = cmark_parser_add_child( + parser, table_row_block, CMARK_NODE_TABLE_CELL, 0); + cmark_node_set_syntax_extension(node, self); + set_cell_index(node, i); + } + } + + free_table_row(parser->mem, row); + + cmark_parser_advance_offset(parser, (char *)input, + len - 1 - cmark_parser_get_offset(parser), false); + + return table_row_block; +} + +static cmark_node *try_opening_table_block(cmark_syntax_extension *self, + int indented, cmark_parser *parser, + cmark_node *parent_container, + unsigned char *input, int len) { + cmark_node_type parent_type = cmark_node_get_type(parent_container); + + if (!indented && parent_type == CMARK_NODE_PARAGRAPH) { + return try_opening_table_header(self, parser, parent_container, input, len); + } else if (!indented && parent_type == CMARK_NODE_TABLE) { + return try_opening_table_row(self, parser, parent_container, input, len); + } + + return NULL; +} + +static int matches(cmark_syntax_extension *self, cmark_parser *parser, + unsigned char *input, int len, + cmark_node *parent_container) { + int res = 0; + + if (cmark_node_get_type(parent_container) == CMARK_NODE_TABLE) { + cmark_arena_push(); + table_row *new_row = row_from_string( + self, parser, input + cmark_parser_get_first_nonspace(parser), + len - cmark_parser_get_first_nonspace(parser)); + if (new_row && new_row->n_columns) + res = 1; + free_table_row(parser->mem, new_row); + cmark_arena_pop(); + } + + return res; +} + +static const char *get_type_string(cmark_syntax_extension *self, + cmark_node *node) { + if (node->type == CMARK_NODE_TABLE) { + return "table"; + } else if (node->type == CMARK_NODE_TABLE_ROW) { + if (((node_table_row *)node->as.opaque)->is_header) + return "table_header"; + else + return "table_row"; + } else if (node->type == CMARK_NODE_TABLE_CELL) { + return "table_cell"; + } + + return ""; +} + +static int can_contain(cmark_syntax_extension *extension, cmark_node *node, + cmark_node_type child_type) { + if (node->type == CMARK_NODE_TABLE) { + return child_type == CMARK_NODE_TABLE_ROW; + } else if (node->type == CMARK_NODE_TABLE_ROW) { + return child_type == CMARK_NODE_TABLE_CELL; + } else if (node->type == CMARK_NODE_TABLE_CELL) { + return child_type == CMARK_NODE_TEXT || child_type == CMARK_NODE_CODE || + child_type == CMARK_NODE_EMPH || child_type == CMARK_NODE_STRONG || + child_type == CMARK_NODE_LINK || child_type == CMARK_NODE_IMAGE || + child_type == CMARK_NODE_STRIKETHROUGH || + child_type == CMARK_NODE_HTML_INLINE || + child_type == CMARK_NODE_FOOTNOTE_REFERENCE; + } + return false; +} + +static int contains_inlines(cmark_syntax_extension *extension, + cmark_node *node) { + return node->type == CMARK_NODE_TABLE_CELL; +} + +static void commonmark_render(cmark_syntax_extension *extension, + cmark_renderer *renderer, cmark_node *node, + cmark_event_type ev_type, int options) { + bool entering = (ev_type == CMARK_EVENT_ENTER); + + if (node->type == CMARK_NODE_TABLE) { + renderer->blankline(renderer); + } else if (node->type == CMARK_NODE_TABLE_ROW) { + if (entering) { + renderer->cr(renderer); + renderer->out(renderer, node, "|", false, LITERAL); + } + } else if (node->type == CMARK_NODE_TABLE_CELL) { + if (entering) { + renderer->out(renderer, node, " ", false, LITERAL); + } else { + renderer->out(renderer, node, " |", false, LITERAL); + if (((node_table_row *)node->parent->as.opaque)->is_header && + !node->next) { + int i; + uint8_t *alignments = get_table_alignments(node->parent->parent); + uint16_t n_cols = + ((node_table *)node->parent->parent->as.opaque)->n_columns; + renderer->cr(renderer); + renderer->out(renderer, node, "|", false, LITERAL); + for (i = 0; i < n_cols; i++) { + switch (alignments[i]) { + case 0: renderer->out(renderer, node, " --- |", false, LITERAL); break; + case 'l': renderer->out(renderer, node, " :-- |", false, LITERAL); break; + case 'c': renderer->out(renderer, node, " :-: |", false, LITERAL); break; + case 'r': renderer->out(renderer, node, " --: |", false, LITERAL); break; + } + } + renderer->cr(renderer); + } + } + } else { + assert(false); + } +} + +static void latex_render(cmark_syntax_extension *extension, + cmark_renderer *renderer, cmark_node *node, + cmark_event_type ev_type, int options) { + bool entering = (ev_type == CMARK_EVENT_ENTER); + + if (node->type == CMARK_NODE_TABLE) { + if (entering) { + int i; + uint16_t n_cols; + uint8_t *alignments = get_table_alignments(node); + + renderer->cr(renderer); + renderer->out(renderer, node, "\\begin{table}", false, LITERAL); + renderer->cr(renderer); + renderer->out(renderer, node, "\\begin{tabular}{", false, LITERAL); + + n_cols = ((node_table *)node->as.opaque)->n_columns; + for (i = 0; i < n_cols; i++) { + switch(alignments[i]) { + case 0: + case 'l': + renderer->out(renderer, node, "l", false, LITERAL); + break; + case 'c': + renderer->out(renderer, node, "c", false, LITERAL); + break; + case 'r': + renderer->out(renderer, node, "r", false, LITERAL); + break; + } + } + renderer->out(renderer, node, "}", false, LITERAL); + renderer->cr(renderer); + } else { + renderer->out(renderer, node, "\\end{tabular}", false, LITERAL); + renderer->cr(renderer); + renderer->out(renderer, node, "\\end{table}", false, LITERAL); + renderer->cr(renderer); + } + } else if (node->type == CMARK_NODE_TABLE_ROW) { + if (!entering) { + renderer->cr(renderer); + } + } else if (node->type == CMARK_NODE_TABLE_CELL) { + if (!entering) { + if (node->next) { + renderer->out(renderer, node, " & ", false, LITERAL); + } else { + renderer->out(renderer, node, " \\\\", false, LITERAL); + } + } + } else { + assert(false); + } +} + +static const char *xml_attr(cmark_syntax_extension *extension, + cmark_node *node) { + if (node->type == CMARK_NODE_TABLE_CELL) { + if (cmark_gfm_extensions_get_table_row_is_header(node->parent)) { + switch (get_cell_alignment(node)) { + case 'l': return " align=\"left\""; + case 'c': return " align=\"center\""; + case 'r': return " align=\"right\""; + } + } + } + + return NULL; +} + +static void man_render(cmark_syntax_extension *extension, + cmark_renderer *renderer, cmark_node *node, + cmark_event_type ev_type, int options) { + bool entering = (ev_type == CMARK_EVENT_ENTER); + + if (node->type == CMARK_NODE_TABLE) { + if (entering) { + int i; + uint16_t n_cols; + uint8_t *alignments = get_table_alignments(node); + + renderer->cr(renderer); + renderer->out(renderer, node, ".TS", false, LITERAL); + renderer->cr(renderer); + renderer->out(renderer, node, "tab(@);", false, LITERAL); + renderer->cr(renderer); + + n_cols = ((node_table *)node->as.opaque)->n_columns; + + for (i = 0; i < n_cols; i++) { + switch (alignments[i]) { + case 'l': + renderer->out(renderer, node, "l", false, LITERAL); + break; + case 0: + case 'c': + renderer->out(renderer, node, "c", false, LITERAL); + break; + case 'r': + renderer->out(renderer, node, "r", false, LITERAL); + break; + } + } + + if (n_cols) { + renderer->out(renderer, node, ".", false, LITERAL); + renderer->cr(renderer); + } + } else { + renderer->out(renderer, node, ".TE", false, LITERAL); + renderer->cr(renderer); + } + } else if (node->type == CMARK_NODE_TABLE_ROW) { + if (!entering) { + renderer->cr(renderer); + } + } else if (node->type == CMARK_NODE_TABLE_CELL) { + if (!entering && node->next) { + renderer->out(renderer, node, "@", false, LITERAL); + } + } else { + assert(false); + } +} + +static void html_table_add_align(cmark_strbuf* html, const char* align, int options) { + if (options & CMARK_OPT_TABLE_PREFER_STYLE_ATTRIBUTES) { + cmark_strbuf_puts(html, " style=\"text-align: "); + cmark_strbuf_puts(html, align); + cmark_strbuf_puts(html, "\""); + } else { + cmark_strbuf_puts(html, " align=\""); + cmark_strbuf_puts(html, align); + cmark_strbuf_puts(html, "\""); + } +} + +struct html_table_state { + unsigned need_closing_table_body : 1; + unsigned in_table_header : 1; +}; + +static void html_render(cmark_syntax_extension *extension, + cmark_html_renderer *renderer, cmark_node *node, + cmark_event_type ev_type, int options) { + bool entering = (ev_type == CMARK_EVENT_ENTER); + cmark_strbuf *html = renderer->html; + + // XXX: we just monopolise renderer->opaque. + struct html_table_state *table_state = + (struct html_table_state *)&renderer->opaque; + + if (node->type == CMARK_NODE_TABLE) { + if (entering) { + cmark_html_render_cr(html); + cmark_strbuf_puts(html, "'); + table_state->need_closing_table_body = false; + } else { + if (table_state->need_closing_table_body) { + cmark_html_render_cr(html); + cmark_strbuf_puts(html, ""); + cmark_html_render_cr(html); + } + table_state->need_closing_table_body = false; + cmark_html_render_cr(html); + cmark_strbuf_puts(html, ""); + cmark_html_render_cr(html); + } + } else if (node->type == CMARK_NODE_TABLE_ROW) { + if (entering) { + cmark_html_render_cr(html); + if (((node_table_row *)node->as.opaque)->is_header) { + table_state->in_table_header = 1; + cmark_strbuf_puts(html, ""); + cmark_html_render_cr(html); + } else if (!table_state->need_closing_table_body) { + cmark_strbuf_puts(html, ""); + cmark_html_render_cr(html); + table_state->need_closing_table_body = 1; + } + cmark_strbuf_puts(html, "'); + } else { + cmark_html_render_cr(html); + cmark_strbuf_puts(html, ""); + if (((node_table_row *)node->as.opaque)->is_header) { + cmark_html_render_cr(html); + cmark_strbuf_puts(html, ""); + table_state->in_table_header = false; + } + } + } else if (node->type == CMARK_NODE_TABLE_CELL) { + if (entering) { + cmark_html_render_cr(html); + if (table_state->in_table_header) { + cmark_strbuf_puts(html, "'); + } else { + if (table_state->in_table_header) { + cmark_strbuf_puts(html, ""); + } else { + cmark_strbuf_puts(html, ""); + } + } + } else { + assert(false); + } +} + +static void opaque_alloc(cmark_syntax_extension *self, cmark_mem *mem, cmark_node *node) { + if (node->type == CMARK_NODE_TABLE) { + node->as.opaque = mem->calloc(1, sizeof(node_table)); + } else if (node->type == CMARK_NODE_TABLE_ROW) { + node->as.opaque = mem->calloc(1, sizeof(node_table_row)); + } else if (node->type == CMARK_NODE_TABLE_CELL) { + node->as.opaque = mem->calloc(1, sizeof(node_cell)); + } +} + +static void opaque_free(cmark_syntax_extension *self, cmark_mem *mem, cmark_node *node) { + if (node->type == CMARK_NODE_TABLE) { + free_node_table(mem, node->as.opaque); + } else if (node->type == CMARK_NODE_TABLE_ROW) { + free_node_table_row(mem, node->as.opaque); + } +} + +static int escape(cmark_syntax_extension *self, cmark_node *node, int c) { + return + node->type != CMARK_NODE_TABLE && + node->type != CMARK_NODE_TABLE_ROW && + node->type != CMARK_NODE_TABLE_CELL && + c == '|'; +} + +cmark_syntax_extension *create_table_extension(void) { + cmark_syntax_extension *self = cmark_syntax_extension_new("table"); + + cmark_register_node_flag(&CMARK_NODE__TABLE_VISITED); + cmark_syntax_extension_set_match_block_func(self, matches); + cmark_syntax_extension_set_open_block_func(self, try_opening_table_block); + cmark_syntax_extension_set_get_type_string_func(self, get_type_string); + cmark_syntax_extension_set_can_contain_func(self, can_contain); + cmark_syntax_extension_set_contains_inlines_func(self, contains_inlines); + cmark_syntax_extension_set_commonmark_render_func(self, commonmark_render); + cmark_syntax_extension_set_plaintext_render_func(self, commonmark_render); + cmark_syntax_extension_set_latex_render_func(self, latex_render); + cmark_syntax_extension_set_xml_attr_func(self, xml_attr); + cmark_syntax_extension_set_man_render_func(self, man_render); + cmark_syntax_extension_set_html_render_func(self, html_render); + cmark_syntax_extension_set_opaque_alloc_func(self, opaque_alloc); + cmark_syntax_extension_set_opaque_free_func(self, opaque_free); + cmark_syntax_extension_set_commonmark_escape_func(self, escape); + CMARK_NODE_TABLE = cmark_syntax_extension_add_node(0); + CMARK_NODE_TABLE_ROW = cmark_syntax_extension_add_node(0); + CMARK_NODE_TABLE_CELL = cmark_syntax_extension_add_node(0); + + return self; +} + +uint16_t cmark_gfm_extensions_get_table_columns(cmark_node *node) { + if (node->type != CMARK_NODE_TABLE) + return 0; + + return ((node_table *)node->as.opaque)->n_columns; +} + +uint8_t *cmark_gfm_extensions_get_table_alignments(cmark_node *node) { + if (node->type != CMARK_NODE_TABLE) + return 0; + + return ((node_table *)node->as.opaque)->alignments; +} + +int cmark_gfm_extensions_set_table_columns(cmark_node *node, uint16_t n_columns) { + return set_n_table_columns(node, n_columns); +} + +int cmark_gfm_extensions_set_table_alignments(cmark_node *node, uint16_t ncols, uint8_t *alignments) { + uint8_t *a = (uint8_t *)cmark_node_mem(node)->calloc(1, ncols); + memcpy(a, alignments, ncols); + return set_table_alignments(node, a); +} + +int cmark_gfm_extensions_get_table_row_is_header(cmark_node *node) +{ + if (!node || node->type != CMARK_NODE_TABLE_ROW) + return 0; + + return ((node_table_row *)node->as.opaque)->is_header; +} + +int cmark_gfm_extensions_set_table_row_is_header(cmark_node *node, int is_header) +{ + if (!node || node->type != CMARK_NODE_TABLE_ROW) + return 0; + + ((node_table_row *)node->as.opaque)->is_header = (is_header != 0); + return 1; +} diff --git a/liteidex/src/3rdparty/cmark/extensions/table.h b/liteidex/src/3rdparty/cmark/extensions/table.h new file mode 100644 index 000000000..f6a0634f0 --- /dev/null +++ b/liteidex/src/3rdparty/cmark/extensions/table.h @@ -0,0 +1,12 @@ +#ifndef CMARK_GFM_TABLE_H +#define CMARK_GFM_TABLE_H + +#include "cmark-gfm-core-extensions.h" + + +extern cmark_node_type CMARK_NODE_TABLE, CMARK_NODE_TABLE_ROW, + CMARK_NODE_TABLE_CELL; + +cmark_syntax_extension *create_table_extension(void); + +#endif diff --git a/liteidex/src/3rdparty/cmark/extensions/tagfilter.c b/liteidex/src/3rdparty/cmark/extensions/tagfilter.c new file mode 100644 index 000000000..262352e0c --- /dev/null +++ b/liteidex/src/3rdparty/cmark/extensions/tagfilter.c @@ -0,0 +1,60 @@ +#include "tagfilter.h" +#include +#include + +static const char *blacklist[] = { + "title", "textarea", "style", "xmp", "iframe", + "noembed", "noframes", "script", "plaintext", NULL, +}; + +static int is_tag(const unsigned char *tag_data, size_t tag_size, + const char *tagname) { + size_t i; + + if (tag_size < 3 || tag_data[0] != '<') + return 0; + + i = 1; + + if (tag_data[i] == '/') { + i++; + } + + for (; i < tag_size; ++i, ++tagname) { + if (*tagname == 0) + break; + + if (tolower(tag_data[i]) != *tagname) + return 0; + } + + if (i == tag_size) + return 0; + + if (cmark_isspace(tag_data[i]) || tag_data[i] == '>') + return 1; + + if (tag_data[i] == '/' && tag_size >= i + 2 && tag_data[i + 1] == '>') + return 1; + + return 0; +} + +static int filter(cmark_syntax_extension *ext, const unsigned char *tag, + size_t tag_len) { + const char **it; + + for (it = blacklist; *it; ++it) { + if (is_tag(tag, tag_len, *it)) { + return 0; + } + } + + return 1; +} + +cmark_syntax_extension *create_tagfilter_extension(void) { + cmark_syntax_extension *ext = cmark_syntax_extension_new("tagfilter"); + cmark_syntax_extension_set_html_filter_func(ext, filter); + return ext; +} diff --git a/liteidex/src/3rdparty/cmark/extensions/tagfilter.h b/liteidex/src/3rdparty/cmark/extensions/tagfilter.h new file mode 100644 index 000000000..9a5f388d4 --- /dev/null +++ b/liteidex/src/3rdparty/cmark/extensions/tagfilter.h @@ -0,0 +1,8 @@ +#ifndef CMARK_GFM_TAGFILTER_H +#define CMARK_GFM_TAGFILTER_H + +#include "cmark-gfm-core-extensions.h" + +cmark_syntax_extension *create_tagfilter_extension(void); + +#endif diff --git a/liteidex/src/3rdparty/cmark/extensions/tasklist.c b/liteidex/src/3rdparty/cmark/extensions/tasklist.c new file mode 100644 index 000000000..7bef45499 --- /dev/null +++ b/liteidex/src/3rdparty/cmark/extensions/tasklist.c @@ -0,0 +1,156 @@ +#include "tasklist.h" +#include +#include +#include +#include "ext_scanners.h" + +typedef enum { + CMARK_TASKLIST_NOCHECKED, + CMARK_TASKLIST_CHECKED, +} cmark_tasklist_type; + +// Local constants +static const char *TYPE_STRING = "tasklist"; + +static const char *get_type_string(cmark_syntax_extension *extension, cmark_node *node) { + return TYPE_STRING; +} + + +// Return 1 if state was set, 0 otherwise +int cmark_gfm_extensions_set_tasklist_item_checked(cmark_node *node, bool is_checked) { + // The node has to exist, and be an extension, and actually be the right type in order to get the value. + if (!node || !node->extension || strcmp(cmark_node_get_type_string(node), TYPE_STRING)) + return 0; + + node->as.list.checked = is_checked; + return 1; +} + +bool cmark_gfm_extensions_get_tasklist_item_checked(cmark_node *node) { + if (!node || !node->extension || strcmp(cmark_node_get_type_string(node), TYPE_STRING)) + return false; + + if (node->as.list.checked) { + return true; + } + else { + return false; + } +} + +static bool parse_node_item_prefix(cmark_parser *parser, const char *input, + cmark_node *container) { + bool res = false; + + if (parser->indent >= + container->as.list.marker_offset + container->as.list.padding) { + cmark_parser_advance_offset(parser, input, container->as.list.marker_offset + + container->as.list.padding, + true); + res = true; + } else if (parser->blank && container->first_child != NULL) { + // if container->first_child is NULL, then the opening line + // of the list item was blank after the list marker; in this + // case, we are done with the list item. + cmark_parser_advance_offset(parser, input, parser->first_nonspace - parser->offset, + false); + res = true; + } + return res; +} + +static int matches(cmark_syntax_extension *self, cmark_parser *parser, + unsigned char *input, int len, + cmark_node *parent_container) { + return parse_node_item_prefix(parser, (const char*)input, parent_container); +} + +static int can_contain(cmark_syntax_extension *extension, cmark_node *node, + cmark_node_type child_type) { + return (node->type == CMARK_NODE_ITEM) ? 1 : 0; +} + +static cmark_node *open_tasklist_item(cmark_syntax_extension *self, + int indented, cmark_parser *parser, + cmark_node *parent_container, + unsigned char *input, int len) { + cmark_node_type node_type = cmark_node_get_type(parent_container); + if (node_type != CMARK_NODE_ITEM) { + return NULL; + } + + bufsize_t matched = scan_tasklist(input, len, 0); + if (!matched) { + return NULL; + } + + cmark_node_set_syntax_extension(parent_container, self); + cmark_parser_advance_offset(parser, (char *)input, 3, false); + + // Either an upper or lower case X means the task is completed. + parent_container->as.list.checked = (strstr((char*)input, "[x]") || strstr((char*)input, "[X]")); + + return NULL; +} + +static void commonmark_render(cmark_syntax_extension *extension, + cmark_renderer *renderer, cmark_node *node, + cmark_event_type ev_type, int options) { + bool entering = (ev_type == CMARK_EVENT_ENTER); + if (entering) { + renderer->cr(renderer); + if (node->as.list.checked) { + renderer->out(renderer, node, "- [x] ", false, LITERAL); + } else { + renderer->out(renderer, node, "- [ ] ", false, LITERAL); + } + cmark_strbuf_puts(renderer->prefix, " "); + } else { + cmark_strbuf_truncate(renderer->prefix, renderer->prefix->size - 2); + renderer->cr(renderer); + } +} + +static void html_render(cmark_syntax_extension *extension, + cmark_html_renderer *renderer, cmark_node *node, + cmark_event_type ev_type, int options) { + bool entering = (ev_type == CMARK_EVENT_ENTER); + if (entering) { + cmark_html_render_cr(renderer->html); + cmark_strbuf_puts(renderer->html, "html, options); + cmark_strbuf_putc(renderer->html, '>'); + if (node->as.list.checked) { + cmark_strbuf_puts(renderer->html, " "); + } else { + cmark_strbuf_puts(renderer->html, " "); + } + } else { + cmark_strbuf_puts(renderer->html, "\n"); + } +} + +static const char *xml_attr(cmark_syntax_extension *extension, + cmark_node *node) { + if (node->as.list.checked) { + return " completed=\"true\""; + } else { + return " completed=\"false\""; + } +} + +cmark_syntax_extension *create_tasklist_extension(void) { + cmark_syntax_extension *ext = cmark_syntax_extension_new("tasklist"); + + cmark_syntax_extension_set_match_block_func(ext, matches); + cmark_syntax_extension_set_get_type_string_func(ext, get_type_string); + cmark_syntax_extension_set_open_block_func(ext, open_tasklist_item); + cmark_syntax_extension_set_can_contain_func(ext, can_contain); + cmark_syntax_extension_set_commonmark_render_func(ext, commonmark_render); + cmark_syntax_extension_set_plaintext_render_func(ext, commonmark_render); + cmark_syntax_extension_set_html_render_func(ext, html_render); + cmark_syntax_extension_set_xml_attr_func(ext, xml_attr); + + return ext; +} diff --git a/liteidex/src/3rdparty/cmark/extensions/tasklist.h b/liteidex/src/3rdparty/cmark/extensions/tasklist.h new file mode 100644 index 000000000..26e9d96d2 --- /dev/null +++ b/liteidex/src/3rdparty/cmark/extensions/tasklist.h @@ -0,0 +1,8 @@ +#ifndef TASKLIST_H +#define TASKLIST_H + +#include "cmark-gfm-core-extensions.h" + +cmark_syntax_extension *create_tasklist_extension(void); + +#endif diff --git a/liteidex/src/3rdparty/cmark/libcmark.cpp b/liteidex/src/3rdparty/cmark/libcmark.cpp index a5047d582..761bb10c8 100644 --- a/liteidex/src/3rdparty/cmark/libcmark.cpp +++ b/liteidex/src/3rdparty/cmark/libcmark.cpp @@ -1,14 +1,39 @@ #include "libcmark.h" -#include "src/cmark.h" +#include "cmark-gfm.h" +#include "cmark-gfm-core-extensions.h" +#include namespace cmark { +static const char *gfmExtensions[] = { + "table", + "strikethrough", + "autolink", + "tagfilter", + "tasklist" +}; + QByteArray markdown_to_html(const QByteArray &data) { - char *buf = cmark_markdown_to_html(data.data(),size_t(data.size()),CMARK_OPT_UNSAFE); + cmark_gfm_core_extensions_ensure_registered(); + + const int options = CMARK_OPT_UNSAFE | CMARK_OPT_FOOTNOTES | CMARK_OPT_GITHUB_PRE_LANG; + cmark_parser *parser = cmark_parser_new(options); + for (const char *name : gfmExtensions) { + cmark_syntax_extension *ext = cmark_find_syntax_extension(name); + if (ext) { + cmark_parser_attach_syntax_extension(parser, ext); + } + } + + cmark_parser_feed(parser, data.constData(), size_t(data.size())); + cmark_node *doc = cmark_parser_finish(parser); + char *buf = cmark_render_html(doc, options, cmark_parser_get_syntax_extensions(parser)); QByteArray out(buf); free(buf); - return out; + cmark_parser_free(parser); + cmark_node_free(doc); + return out; } } //cmark diff --git a/liteidex/src/3rdparty/cmark/src/CMakeLists.txt b/liteidex/src/3rdparty/cmark/src/CMakeLists.txt deleted file mode 100755 index 10fcb1d8a..000000000 --- a/liteidex/src/3rdparty/cmark/src/CMakeLists.txt +++ /dev/null @@ -1,206 +0,0 @@ -if(${CMAKE_VERSION} VERSION_GREATER "3.3") - cmake_policy(SET CMP0063 NEW) -endif() - -include(GNUInstallDirs) - -set(LIBRARY "libcmark") -set(STATICLIBRARY "libcmark_static") -set(HEADERS - cmark.h - parser.h - buffer.h - node.h - iterator.h - chunk.h - references.h - utf8.h - scanners.h - inlines.h - houdini.h - cmark_ctype.h - render.h - ) -set(LIBRARY_SOURCES - cmark.c - node.c - iterator.c - blocks.c - inlines.c - scanners.c - scanners.re - utf8.c - buffer.c - references.c - render.c - man.c - xml.c - html.c - commonmark.c - latex.c - houdini_href_e.c - houdini_html_e.c - houdini_html_u.c - cmark_ctype.c - ${HEADERS} - ) - -set(PROGRAM "cmark") -set(PROGRAM_SOURCES - ${LIBRARY_SOURCES} - main.c - ) - -include_directories(. ${CMAKE_CURRENT_BINARY_DIR}) - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmark_version.h.in - ${CMAKE_CURRENT_BINARY_DIR}/cmark_version.h) - -include (GenerateExportHeader) - -add_executable(${PROGRAM} ${PROGRAM_SOURCES}) - -# Disable the PUBLIC declarations when compiling the executable: -set_target_properties(${PROGRAM} PROPERTIES - COMPILE_FLAGS -DCMARK_STATIC_DEFINE) - -# Check integrity of node structure when compiled as debug: -set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DCMARK_DEBUG_NODES") -set(CMAKE_LINKER_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG}") - -set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE} -pg") -set(CMAKE_LINKER_PROFILE "${CMAKE_LINKER_FLAGS_RELEASE} -pg") - -# -fvisibility=hidden -set(CMAKE_C_VISIBILITY_PRESET hidden) -set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) - -if (CMARK_SHARED) - add_library(${LIBRARY} SHARED ${LIBRARY_SOURCES}) - # Include minor version and patch level in soname for now. - set_target_properties(${LIBRARY} PROPERTIES - OUTPUT_NAME "cmark" - SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} - VERSION ${PROJECT_VERSION}) - - set_property(TARGET ${LIBRARY} - APPEND PROPERTY MACOSX_RPATH true) - - # Avoid name clash between PROGRAM and LIBRARY pdb files. - set_target_properties(${LIBRARY} PROPERTIES PDB_NAME cmark_dll) - - generate_export_header(${LIBRARY} - BASE_NAME ${PROJECT_NAME}) - - list(APPEND CMARK_INSTALL ${LIBRARY}) -endif() - -if (CMARK_STATIC) - add_library(${STATICLIBRARY} STATIC ${LIBRARY_SOURCES}) - set_target_properties(${STATICLIBRARY} PROPERTIES - COMPILE_FLAGS -DCMARK_STATIC_DEFINE - POSITION_INDEPENDENT_CODE ON) - - if (MSVC) - set_target_properties(${STATICLIBRARY} PROPERTIES - OUTPUT_NAME "cmark_static" - VERSION ${PROJECT_VERSION}) - else() - set_target_properties(${STATICLIBRARY} PROPERTIES - OUTPUT_NAME "cmark" - VERSION ${PROJECT_VERSION}) - endif(MSVC) - - if (NOT CMARK_SHARED) - generate_export_header(${STATICLIBRARY} - BASE_NAME ${PROJECT_NAME}) - endif() - - list(APPEND CMARK_INSTALL ${STATICLIBRARY}) -endif() - -if (MSVC) - set_property(TARGET ${PROGRAM} - APPEND PROPERTY LINK_FLAGS /INCREMENTAL:NO) -endif(MSVC) - -if(NOT MSVC OR CMAKE_HOST_SYSTEM_NAME STREQUAL Windows) - set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON) - include(InstallRequiredSystemLibraries) -endif() - -set(libdir lib${LIB_SUFFIX}) - -install(TARGETS ${PROGRAM} ${CMARK_INSTALL} - EXPORT cmark - RUNTIME DESTINATION bin - LIBRARY DESTINATION ${libdir} - ARCHIVE DESTINATION ${libdir} - ) - -if(CMARK_SHARED OR CMARK_STATIC) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libcmark.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/libcmark.pc @ONLY) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libcmark.pc - DESTINATION ${libdir}/pkgconfig) - - install(FILES - cmark.h - ${CMAKE_CURRENT_BINARY_DIR}/cmark_export.h - ${CMAKE_CURRENT_BINARY_DIR}/cmark_version.h - DESTINATION include - ) - - install(EXPORT cmark DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake) -endif() - -# Feature tests -include(CheckIncludeFile) -include(CheckCSourceCompiles) -include(CheckCSourceRuns) -include(CheckSymbolExists) -CHECK_INCLUDE_FILE(stdbool.h HAVE_STDBOOL_H) -CHECK_C_SOURCE_COMPILES( - "int main() { __builtin_expect(0,0); return 0; }" - HAVE___BUILTIN_EXPECT) -CHECK_C_SOURCE_COMPILES(" - int f(void) __attribute__ (()); - int main() { return 0; } -" HAVE___ATTRIBUTE__) - -CONFIGURE_FILE( - ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in - ${CMAKE_CURRENT_BINARY_DIR}/config.h) - -# Always compile with warnings -if(MSVC) - # Force to always compile with W4 - if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]") - string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - else() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") - endif() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4706 /D_CRT_SECURE_NO_WARNINGS") -elseif(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -std=c99 -pedantic") -endif() - -# Compile as C++ under MSVC older than 12.0 -if(MSVC AND MSVC_VERSION LESS 1800) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /TP") -endif() - -if(CMAKE_BUILD_TYPE STREQUAL "Ubsan") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined") -endif() - -if(CMARK_LIB_FUZZER) - set(FUZZ_HARNESS "cmark-fuzz") - add_executable(${FUZZ_HARNESS} ../test/cmark-fuzz.c ${LIBRARY_SOURCES}) - target_link_libraries(${FUZZ_HARNESS} "${CMAKE_LIB_FUZZER_PATH}") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize-coverage=trace-pc-guard") - - # cmark is written in C but the libFuzzer runtime is written in C++ which - # needs to link against the C++ runtime. Explicitly link it into cmark-fuzz - set_target_properties(${FUZZ_HARNESS} PROPERTIES LINK_FLAGS "-lstdc++") -endif() diff --git a/liteidex/src/3rdparty/cmark/src/arena.c b/liteidex/src/3rdparty/cmark/src/arena.c new file mode 100644 index 000000000..da1a70e92 --- /dev/null +++ b/liteidex/src/3rdparty/cmark/src/arena.c @@ -0,0 +1,104 @@ +#include +#include +#include +#include "cmark-gfm.h" +#include "cmark-gfm-extension_api.h" + +static struct arena_chunk { + size_t sz, used; + uint8_t push_point; + void *ptr; + struct arena_chunk *prev; +} *A = NULL; + +static struct arena_chunk *alloc_arena_chunk(size_t sz, struct arena_chunk *prev) { + struct arena_chunk *c = (struct arena_chunk *)calloc(1, sizeof(*c)); + if (!c) + abort(); + c->sz = sz; + c->ptr = calloc(1, sz); + if (!c->ptr) + abort(); + c->prev = prev; + return c; +} + +void cmark_arena_push(void) { + if (!A) + return; + A->push_point = 1; + A = alloc_arena_chunk(10240, A); +} + +int cmark_arena_pop(void) { + if (!A) + return 0; + while (A && !A->push_point) { + free(A->ptr); + struct arena_chunk *n = A->prev; + free(A); + A = n; + } + if (A) + A->push_point = 0; + return 1; +} + +static void init_arena(void) { + A = alloc_arena_chunk(4 * 1048576, NULL); +} + +void cmark_arena_reset(void) { + while (A) { + free(A->ptr); + struct arena_chunk *n = A->prev; + free(A); + A = n; + } +} + +static void *arena_calloc(size_t nmem, size_t size) { + if (!A) + init_arena(); + + size_t sz = nmem * size + sizeof(size_t); + + // Round allocation sizes to largest integer size to + // ensure returned memory is correctly aligned + const size_t align = sizeof(size_t) - 1; + sz = (sz + align) & ~align; + + struct arena_chunk *chunk; + if (sz > A->sz) { + A->prev = chunk = alloc_arena_chunk(sz, A->prev); + } else if (sz > A->sz - A->used) { + A = chunk = alloc_arena_chunk(A->sz + A->sz / 2, A); + } else { + chunk = A; + } + void *ptr = (uint8_t *) chunk->ptr + chunk->used; + chunk->used += sz; + *((size_t *) ptr) = sz - sizeof(size_t); + return (uint8_t *) ptr + sizeof(size_t); +} + +static void *arena_realloc(void *ptr, size_t size) { + if (!A) + init_arena(); + + void *new_ptr = arena_calloc(1, size); + if (ptr) + memcpy(new_ptr, ptr, ((size_t *) ptr)[-1]); + return new_ptr; +} + +static void arena_free(void *ptr) { + (void) ptr; + /* no-op */ +} + +cmark_mem CMARK_ARENA_MEM_ALLOCATOR = {arena_calloc, arena_realloc, arena_free}; + +cmark_mem *cmark_get_arena_mem_allocator(void) { + return &CMARK_ARENA_MEM_ALLOCATOR; +} diff --git a/liteidex/src/3rdparty/cmark/src/blocks.c b/liteidex/src/3rdparty/cmark/src/blocks.c old mode 100755 new mode 100644 index b6077eb96..3b5da56bf --- a/liteidex/src/3rdparty/cmark/src/blocks.c +++ b/liteidex/src/3rdparty/cmark/src/blocks.c @@ -8,11 +8,13 @@ #include #include #include +#include #include "cmark_ctype.h" +#include "syntax_extension.h" #include "config.h" #include "parser.h" -#include "cmark.h" +#include "cmark-gfm.h" #include "node.h" #include "references.h" #include "utf8.h" @@ -20,10 +22,19 @@ #include "inlines.h" #include "houdini.h" #include "buffer.h" +#include "footnotes.h" #define CODE_INDENT 4 #define TAB_STOP 4 +/** + * Very deeply nested lists can cause quadratic performance issues. + * This constant is used in open_new_blocks() to limit the nesting + * depth. It is unlikely that a non-contrived markdown document will + * be nested this deeply. + */ +#define MAX_LIST_DEPTH 100 + #ifndef MIN #define MIN(x, y) ((x < y) ? x : y) #endif @@ -88,44 +99,70 @@ static cmark_node *make_document(cmark_mem *mem) { return e; } -cmark_parser *cmark_parser_new_with_mem(int options, cmark_mem *mem) { - cmark_parser *parser = (cmark_parser *)mem->calloc(1, sizeof(cmark_parser)); - parser->mem = mem; +int cmark_parser_attach_syntax_extension(cmark_parser *parser, + cmark_syntax_extension *extension) { + parser->syntax_extensions = cmark_llist_append(parser->mem, parser->syntax_extensions, extension); + if (extension->match_inline || extension->insert_inline_from_delim) { + parser->inline_syntax_extensions = cmark_llist_append( + parser->mem, parser->inline_syntax_extensions, extension); + } + + return 1; +} + +static void cmark_parser_dispose(cmark_parser *parser) { + if (parser->root) + cmark_node_free(parser->root); - cmark_node *document = make_document(mem); + if (parser->refmap) + cmark_map_free(parser->refmap); +} + +static void cmark_parser_reset(cmark_parser *parser) { + cmark_llist *saved_exts = parser->syntax_extensions; + cmark_llist *saved_inline_exts = parser->inline_syntax_extensions; + int saved_options = parser->options; + cmark_mem *saved_mem = parser->mem; + + cmark_parser_dispose(parser); + + memset(parser, 0, sizeof(cmark_parser)); + parser->mem = saved_mem; + + cmark_strbuf_init(parser->mem, &parser->curline, 256); + cmark_strbuf_init(parser->mem, &parser->linebuf, 0); - cmark_strbuf_init(mem, &parser->curline, 256); - cmark_strbuf_init(mem, &parser->linebuf, 0); + cmark_node *document = make_document(parser->mem); - parser->refmap = cmark_reference_map_new(mem); + parser->refmap = cmark_reference_map_new(parser->mem); parser->root = document; parser->current = document; - parser->line_number = 0; - parser->offset = 0; - parser->column = 0; - parser->first_nonspace = 0; - parser->first_nonspace_column = 0; - parser->thematic_break_kill_pos = 0; - parser->indent = 0; - parser->blank = false; - parser->partially_consumed_tab = false; - parser->last_line_length = 0; - parser->options = options; - parser->last_buffer_ended_with_cr = false; + parser->syntax_extensions = saved_exts; + parser->inline_syntax_extensions = saved_inline_exts; + parser->options = saved_options; +} + +cmark_parser *cmark_parser_new_with_mem(int options, cmark_mem *mem) { + cmark_parser *parser = (cmark_parser *)mem->calloc(1, sizeof(cmark_parser)); + parser->mem = mem; + parser->options = options; + cmark_parser_reset(parser); return parser; } cmark_parser *cmark_parser_new(int options) { - extern cmark_mem DEFAULT_MEM_ALLOCATOR; - return cmark_parser_new_with_mem(options, &DEFAULT_MEM_ALLOCATOR); + extern cmark_mem CMARK_DEFAULT_MEM_ALLOCATOR; + return cmark_parser_new_with_mem(options, &CMARK_DEFAULT_MEM_ALLOCATOR); } void cmark_parser_free(cmark_parser *parser) { cmark_mem *mem = parser->mem; + cmark_parser_dispose(parser); cmark_strbuf_free(&parser->curline); cmark_strbuf_free(&parser->linebuf); - cmark_reference_map_free(parser->refmap); + cmark_llist_free(parser->mem, parser->syntax_extensions); + cmark_llist_free(parser->mem, parser->inline_syntax_extensions); mem->free(parser); } @@ -152,23 +189,19 @@ static bool is_blank(cmark_strbuf *s, bufsize_t offset) { return true; } -static CMARK_INLINE bool can_contain(cmark_node_type parent_type, - cmark_node_type child_type) { - return (parent_type == CMARK_NODE_DOCUMENT || - parent_type == CMARK_NODE_BLOCK_QUOTE || - parent_type == CMARK_NODE_ITEM || - (parent_type == CMARK_NODE_LIST && child_type == CMARK_NODE_ITEM)); -} - static CMARK_INLINE bool accepts_lines(cmark_node_type block_type) { return (block_type == CMARK_NODE_PARAGRAPH || block_type == CMARK_NODE_HEADING || block_type == CMARK_NODE_CODE_BLOCK); } -static CMARK_INLINE bool contains_inlines(cmark_node_type block_type) { - return (block_type == CMARK_NODE_PARAGRAPH || - block_type == CMARK_NODE_HEADING); +static CMARK_INLINE bool contains_inlines(cmark_node *node) { + if (node->extension && node->extension->contains_inlines_func) { + return node->extension->contains_inlines_func(node->extension, node) != 0; + } + + return (node->type == CMARK_NODE_PARAGRAPH || + node->type == CMARK_NODE_HEADING); } static void add_line(cmark_node *node, cmark_chunk *ch, cmark_parser *parser) { @@ -364,7 +397,7 @@ static cmark_node *add_child(cmark_parser *parser, cmark_node *parent, // if 'parent' isn't the kind of node that can accept this child, // then back up til we hit a node that can. - while (!can_contain(S_type(parent), block_type)) { + while (!cmark_node_can_contain_type(parent, block_type)) { parent = finalize(parser, parent); } @@ -383,26 +416,135 @@ static cmark_node *add_child(cmark_parser *parser, cmark_node *parent, return child; } +void cmark_manage_extensions_special_characters(cmark_parser *parser, int add) { + cmark_llist *tmp_ext; + + for (tmp_ext = parser->inline_syntax_extensions; tmp_ext; tmp_ext=tmp_ext->next) { + cmark_syntax_extension *ext = (cmark_syntax_extension *) tmp_ext->data; + cmark_llist *tmp_char; + for (tmp_char = ext->special_inline_chars; tmp_char; tmp_char=tmp_char->next) { + unsigned char c = (unsigned char)(size_t)tmp_char->data; + if (add) + cmark_inlines_add_special_character(c, ext->emphasis); + else + cmark_inlines_remove_special_character(c, ext->emphasis); + } + } +} + // Walk through node and all children, recursively, parsing // string content into inline content where appropriate. -static void process_inlines(cmark_mem *mem, cmark_node *root, - cmark_reference_map *refmap, int options) { - cmark_iter *iter = cmark_iter_new(root); +static void process_inlines(cmark_parser *parser, + cmark_map *refmap, int options) { + cmark_iter *iter = cmark_iter_new(parser->root); cmark_node *cur; cmark_event_type ev_type; + cmark_manage_extensions_special_characters(parser, true); + while ((ev_type = cmark_iter_next(iter)) != CMARK_EVENT_DONE) { cur = cmark_iter_get_node(iter); if (ev_type == CMARK_EVENT_ENTER) { - if (contains_inlines(S_type(cur))) { - cmark_parse_inlines(mem, cur, refmap, options); + if (contains_inlines(cur)) { + cmark_parse_inlines(parser, cur, refmap, options); } } } + cmark_manage_extensions_special_characters(parser, false); + cmark_iter_free(iter); } +static int sort_footnote_by_ix(const void *_a, const void *_b) { + cmark_footnote *a = *(cmark_footnote **)_a; + cmark_footnote *b = *(cmark_footnote **)_b; + return (int)a->ix - (int)b->ix; +} + +static void process_footnotes(cmark_parser *parser) { + // * Collect definitions in a map. + // * Iterate the references in the document in order, assigning indices to + // definitions in the order they're seen. + // * Write out the footnotes at the bottom of the document in index order. + + cmark_map *map = cmark_footnote_map_new(parser->mem); + + cmark_iter *iter = cmark_iter_new(parser->root); + cmark_node *cur; + cmark_event_type ev_type; + + while ((ev_type = cmark_iter_next(iter)) != CMARK_EVENT_DONE) { + cur = cmark_iter_get_node(iter); + if (ev_type == CMARK_EVENT_EXIT && cur->type == CMARK_NODE_FOOTNOTE_DEFINITION) { + cmark_footnote_create(map, cur); + } + } + + cmark_iter_free(iter); + iter = cmark_iter_new(parser->root); + unsigned int ix = 0; + + while ((ev_type = cmark_iter_next(iter)) != CMARK_EVENT_DONE) { + cur = cmark_iter_get_node(iter); + if (ev_type == CMARK_EVENT_EXIT && cur->type == CMARK_NODE_FOOTNOTE_REFERENCE) { + cmark_footnote *footnote = (cmark_footnote *)cmark_map_lookup(map, &cur->as.literal); + if (footnote) { + if (!footnote->ix) + footnote->ix = ++ix; + + // store a reference to this footnote reference's footnote definition + // this is used by renderers when generating label ids + cur->parent_footnote_def = footnote->node; + + // keep track of a) count of how many times this footnote def has been + // referenced, and b) which reference index this footnote ref is at. + // this is used by renderers when generating links and backreferences. + cur->footnote.ref_ix = ++footnote->node->footnote.def_count; + + char n[32]; + snprintf(n, sizeof(n), "%d", footnote->ix); + cmark_chunk_free(parser->mem, &cur->as.literal); + cmark_strbuf buf = CMARK_BUF_INIT(parser->mem); + cmark_strbuf_puts(&buf, n); + + cur->as.literal = cmark_chunk_buf_detach(&buf); + } else { + cmark_node *text = (cmark_node *)parser->mem->calloc(1, sizeof(*text)); + cmark_strbuf_init(parser->mem, &text->content, 0); + text->type = (uint16_t) CMARK_NODE_TEXT; + + cmark_strbuf buf = CMARK_BUF_INIT(parser->mem); + cmark_strbuf_puts(&buf, "[^"); + cmark_strbuf_put(&buf, cur->as.literal.data, cur->as.literal.len); + cmark_strbuf_putc(&buf, ']'); + + text->as.literal = cmark_chunk_buf_detach(&buf); + cmark_node_insert_after(cur, text); + cmark_node_free(cur); + } + } + } + + cmark_iter_free(iter); + + if (map->sorted) { + qsort(map->sorted, map->size, sizeof(cmark_map_entry *), sort_footnote_by_ix); + for (unsigned int i = 0; i < map->size; ++i) { + cmark_footnote *footnote = (cmark_footnote *)map->sorted[i]; + if (!footnote->ix) { + cmark_node_unlink(footnote->node); + continue; + } + cmark_node_append_child(parser->root, footnote->node); + footnote->node = NULL; + } + } + + cmark_unlink_footnotes_map(map); + cmark_map_free(map); +} + // Attempts to parse a list item marker (bullet or enumerated). // On success, returns length of the marker, and populates // data with the details. On failure, returns 0. @@ -506,7 +648,17 @@ static cmark_node *finalize_document(cmark_parser *parser) { } finalize(parser, parser->root); - process_inlines(parser->mem, parser->root, parser->refmap, parser->options); + + // Limit total size of extra content created from reference links to + // document size to avoid superlinear growth. Always allow 100KB. + if (parser->total_size > 100000) + parser->refmap->max_ref_size = parser->total_size; + else + parser->refmap->max_ref_size = 100000; + + process_inlines(parser, parser->refmap, parser->options); + if (parser->options & CMARK_OPT_FOOTNOTES) + process_footnotes(parser); return parser->root; } @@ -545,11 +697,29 @@ void cmark_parser_feed(cmark_parser *parser, const char *buffer, size_t len) { S_parser_feed(parser, (const unsigned char *)buffer, len, false); } +void cmark_parser_feed_reentrant(cmark_parser *parser, const char *buffer, size_t len) { + cmark_strbuf saved_linebuf; + + cmark_strbuf_init(parser->mem, &saved_linebuf, 0); + cmark_strbuf_puts(&saved_linebuf, cmark_strbuf_cstr(&parser->linebuf)); + cmark_strbuf_clear(&parser->linebuf); + + S_parser_feed(parser, (const unsigned char *)buffer, len, true); + + cmark_strbuf_sets(&parser->linebuf, cmark_strbuf_cstr(&saved_linebuf)); + cmark_strbuf_free(&saved_linebuf); +} + static void S_parser_feed(cmark_parser *parser, const unsigned char *buffer, size_t len, bool eof) { const unsigned char *end = buffer + len; static const uint8_t repl[] = {239, 191, 189}; + if (len > UINT_MAX - parser->total_size) + parser->total_size = UINT_MAX; + else + parser->total_size += len; + if (parser->last_buffer_ended_with_cr && *buffer == '\n') { // skip NL if last buffer ended with CR ; see #117 buffer++; @@ -572,7 +742,7 @@ static void S_parser_feed(cmark_parser *parser, const unsigned char *buffer, process = true; } - chunk_len = (eol - buffer); + chunk_len = (bufsize_t)(eol - buffer); if (process) { if (parser->linebuf.size > 0) { cmark_strbuf_put(&parser->linebuf, buffer, chunk_len); @@ -756,6 +926,18 @@ static bool parse_block_quote_prefix(cmark_parser *parser, cmark_chunk *input) { return res; } +static bool parse_footnote_definition_block_prefix(cmark_parser *parser, cmark_chunk *input, + cmark_node *container) { + if (parser->indent >= 4) { + S_advance_offset(parser, input, 4, true); + return true; + } else if (input->len > 0 && (input->data[0] == '\n' || (input->data[0] == '\r' && input->data[1] == '\n'))) { + return true; + } + + return false; +} + static bool parse_node_item_prefix(cmark_parser *parser, cmark_chunk *input, cmark_node *container) { bool res = false; @@ -844,6 +1026,21 @@ static bool parse_html_block_prefix(cmark_parser *parser, return res; } +static bool parse_extension_block(cmark_parser *parser, + cmark_node *container, + cmark_chunk *input) +{ + bool res = false; + + if (container->extension->last_block_matches) { + if (container->extension->last_block_matches( + container->extension, parser, input->data, input->len, container)) + res = true; + } + + return res; +} + /** * For each containing node, try to parse the associated line start. * @@ -865,6 +1062,12 @@ static cmark_node *check_open_blocks(cmark_parser *parser, cmark_chunk *input, S_find_first_nonspace(parser, input); + if (container->extension) { + if (!parse_extension_block(parser, container, input)) + goto done; + continue; + } + switch (cont_type) { case CMARK_NODE_BLOCK_QUOTE: if (!parse_block_quote_prefix(parser, input)) @@ -889,6 +1092,10 @@ static cmark_node *check_open_blocks(cmark_parser *parser, cmark_chunk *input, if (parser->blank) goto done; break; + case CMARK_NODE_FOOTNOTE_DEFINITION: + if (!parse_footnote_definition_block_prefix(parser, input, container)) + goto done; + break; default: break; } @@ -920,10 +1127,11 @@ static void open_new_blocks(cmark_parser *parser, cmark_node **container, bool has_content; int save_offset; int save_column; + size_t depth = 0; while (cont_type != CMARK_NODE_CODE_BLOCK && cont_type != CMARK_NODE_HTML_BLOCK) { - + depth++; S_find_first_nonspace(parser, input); indented = parser->indent >= CODE_INDENT; @@ -969,7 +1177,7 @@ static void open_new_blocks(cmark_parser *parser, cmark_node **container, parser->first_nonspace + 1); (*container)->as.code.fenced = true; (*container)->as.code.fence_char = peek_at(input, parser->first_nonspace); - (*container)->as.code.fence_length = (matched > 255) ? 255 : matched; + (*container)->as.code.fence_length = (matched > 255) ? 255 : (uint8_t)matched; (*container)->as.code.fence_offset = (int8_t)(parser->first_nonspace - parser->offset); (*container)->as.code.info = cmark_chunk_literal(""); @@ -1008,8 +1216,26 @@ static void open_new_blocks(cmark_parser *parser, cmark_node **container, *container = add_child(parser, *container, CMARK_NODE_THEMATIC_BREAK, parser->first_nonspace + 1); S_advance_offset(parser, input, input->len - 1 - parser->offset, false); + } else if (!indented && + (parser->options & CMARK_OPT_FOOTNOTES) && + depth < MAX_LIST_DEPTH && + (matched = scan_footnote_definition(input, parser->first_nonspace))) { + cmark_chunk c = cmark_chunk_dup(input, parser->first_nonspace + 2, matched - 2); + + while (c.data[c.len - 1] != ']') + --c.len; + --c.len; + + cmark_chunk_to_cstr(parser->mem, &c); + + S_advance_offset(parser, input, parser->first_nonspace + matched - parser->offset, false); + *container = add_child(parser, *container, CMARK_NODE_FOOTNOTE_DEFINITION, parser->first_nonspace + matched + 1); + (*container)->as.literal = c; + + (*container)->internal_offset = matched; } else if ((!indented || cont_type == CMARK_NODE_LIST) && parser->indent < 4 && + depth < MAX_LIST_DEPTH && (matched = parse_list_marker( parser->mem, input, parser->first_nonspace, (*container)->type == CMARK_NODE_PARAGRAPH, &data))) { @@ -1075,9 +1301,27 @@ static void open_new_blocks(cmark_parser *parser, cmark_node **container, (*container)->as.code.fence_length = 0; (*container)->as.code.fence_offset = 0; (*container)->as.code.info = cmark_chunk_literal(""); - } else { - break; + cmark_llist *tmp; + cmark_node *new_container = NULL; + + for (tmp = parser->syntax_extensions; tmp; tmp=tmp->next) { + cmark_syntax_extension *ext = (cmark_syntax_extension *) tmp->data; + + if (ext->try_opening_block) { + new_container = ext->try_opening_block( + ext, indented, parser, *container, input->data, input->len); + + if (new_container) { + *container = new_container; + break; + } + } + } + + if (!new_container) { + break; + } } if (accepts_lines(S_type(*container))) { @@ -1210,6 +1454,9 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer, bool all_matched = true; cmark_node *container; cmark_chunk input; + cmark_node *current; + + cmark_strbuf_clear(&parser->curline); if (parser->options & CMARK_OPT_VALIDATE_UTF8) cmark_utf8proc_check(&parser->curline, buffer, bytes); @@ -1235,6 +1482,12 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer, input.len = parser->curline.size; input.alloc = 0; + // Skip UTF-8 BOM. + if (parser->line_number == 0 && + input.len >= 3 && + memcmp(input.data, "\xef\xbb\xbf", 3) == 0) + parser->offset += 3; + parser->line_number++; last_matched_container = check_open_blocks(parser, &input, &all_matched); @@ -1244,8 +1497,12 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer, container = last_matched_container; + current = parser->current; + open_new_blocks(parser, &container, &input, all_matched); + /* parser->current might have changed if feed_reentrant was called */ + if (current == parser->current) add_text_to_container(parser, container, last_matched_container, &input); finished: @@ -1261,6 +1518,13 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer, } cmark_node *cmark_parser_finish(cmark_parser *parser) { + cmark_node *res; + cmark_llist *extensions; + + /* Parser was already finished once */ + if (parser->root == NULL) + return NULL; + if (parser->linebuf.size) { S_process_line(parser, parser->linebuf.ptr, parser->linebuf.size); cmark_strbuf_clear(&parser->linebuf); @@ -1271,11 +1535,88 @@ cmark_node *cmark_parser_finish(cmark_parser *parser) { cmark_consolidate_text_nodes(parser->root); cmark_strbuf_free(&parser->curline); + cmark_strbuf_free(&parser->linebuf); #if CMARK_DEBUG_NODES if (cmark_node_check(parser->root, stderr)) { abort(); } #endif - return parser->root; + + for (extensions = parser->syntax_extensions; extensions; extensions = extensions->next) { + cmark_syntax_extension *ext = (cmark_syntax_extension *) extensions->data; + if (ext->postprocess_func) { + cmark_node *processed = ext->postprocess_func(ext, parser, parser->root); + if (processed) + parser->root = processed; + } + } + + res = parser->root; + parser->root = NULL; + + cmark_parser_reset(parser); + + return res; +} + +int cmark_parser_get_line_number(cmark_parser *parser) { + return parser->line_number; +} + +bufsize_t cmark_parser_get_offset(cmark_parser *parser) { + return parser->offset; +} + +bufsize_t cmark_parser_get_column(cmark_parser *parser) { + return parser->column; +} + +int cmark_parser_get_first_nonspace(cmark_parser *parser) { + return parser->first_nonspace; +} + +int cmark_parser_get_first_nonspace_column(cmark_parser *parser) { + return parser->first_nonspace_column; +} + +int cmark_parser_get_indent(cmark_parser *parser) { + return parser->indent; +} + +int cmark_parser_is_blank(cmark_parser *parser) { + return parser->blank; +} + +int cmark_parser_has_partially_consumed_tab(cmark_parser *parser) { + return parser->partially_consumed_tab; +} + +int cmark_parser_get_last_line_length(cmark_parser *parser) { + return parser->last_line_length; +} + +cmark_node *cmark_parser_add_child(cmark_parser *parser, + cmark_node *parent, + cmark_node_type block_type, + int start_column) { + return add_child(parser, parent, block_type, start_column); +} + +void cmark_parser_advance_offset(cmark_parser *parser, + const char *input, + int count, + int columns) { + cmark_chunk input_chunk = cmark_chunk_literal(input); + + S_advance_offset(parser, &input_chunk, count, columns != 0); +} + +void cmark_parser_set_backslash_ispunct_func(cmark_parser *parser, + cmark_ispunct_func func) { + parser->backslash_ispunct = func; +} + +cmark_llist *cmark_parser_get_syntax_extensions(cmark_parser *parser) { + return parser->syntax_extensions; } diff --git a/liteidex/src/3rdparty/cmark/src/buffer.c b/liteidex/src/3rdparty/cmark/src/buffer.c old mode 100755 new mode 100644 index d94649310..c7934e57d --- a/liteidex/src/3rdparty/cmark/src/buffer.c +++ b/liteidex/src/3rdparty/cmark/src/buffer.c @@ -95,7 +95,7 @@ void cmark_strbuf_set(cmark_strbuf *buf, const unsigned char *data, void cmark_strbuf_sets(cmark_strbuf *buf, const char *string) { cmark_strbuf_set(buf, (const unsigned char *)string, - string ? strlen(string) : 0); + string ? (bufsize_t)strlen(string) : 0); } void cmark_strbuf_putc(cmark_strbuf *buf, int c) { @@ -116,7 +116,7 @@ void cmark_strbuf_put(cmark_strbuf *buf, const unsigned char *data, } void cmark_strbuf_puts(cmark_strbuf *buf, const char *string) { - cmark_strbuf_put(buf, (const unsigned char *)string, strlen(string)); + cmark_strbuf_put(buf, (const unsigned char *)string, (bufsize_t)strlen(string)); } void cmark_strbuf_copy_cstr(char *data, bufsize_t datasize, diff --git a/liteidex/src/3rdparty/cmark/src/buffer.h b/liteidex/src/3rdparty/cmark/src/buffer.h old mode 100755 new mode 100644 index e8780753f..b85bb4406 --- a/liteidex/src/3rdparty/cmark/src/buffer.h +++ b/liteidex/src/3rdparty/cmark/src/buffer.h @@ -7,14 +7,12 @@ #include #include #include "config.h" -#include "cmark.h" +#include "cmark-gfm.h" #ifdef __cplusplus extern "C" { #endif -typedef int32_t bufsize_t; - typedef struct { cmark_mem *mem; unsigned char *ptr; @@ -32,22 +30,32 @@ extern unsigned char cmark_strbuf__initbuf[]; * For the cases where CMARK_BUF_INIT cannot be used to do static * initialization. */ +CMARK_GFM_EXPORT void cmark_strbuf_init(cmark_mem *mem, cmark_strbuf *buf, bufsize_t initial_size); /** * Grow the buffer to hold at least `target_size` bytes. */ +CMARK_GFM_EXPORT void cmark_strbuf_grow(cmark_strbuf *buf, bufsize_t target_size); +CMARK_GFM_EXPORT void cmark_strbuf_free(cmark_strbuf *buf); + +CMARK_GFM_EXPORT void cmark_strbuf_swap(cmark_strbuf *buf_a, cmark_strbuf *buf_b); +CMARK_GFM_EXPORT bufsize_t cmark_strbuf_len(const cmark_strbuf *buf); +CMARK_GFM_EXPORT int cmark_strbuf_cmp(const cmark_strbuf *a, const cmark_strbuf *b); +CMARK_GFM_EXPORT unsigned char *cmark_strbuf_detach(cmark_strbuf *buf); + +CMARK_GFM_EXPORT void cmark_strbuf_copy_cstr(char *data, bufsize_t datasize, const cmark_strbuf *buf); @@ -57,22 +65,48 @@ static CMARK_INLINE const char *cmark_strbuf_cstr(const cmark_strbuf *buf) { #define cmark_strbuf_at(buf, n) ((buf)->ptr[n]) +CMARK_GFM_EXPORT void cmark_strbuf_set(cmark_strbuf *buf, const unsigned char *data, bufsize_t len); + +CMARK_GFM_EXPORT void cmark_strbuf_sets(cmark_strbuf *buf, const char *string); + +CMARK_GFM_EXPORT void cmark_strbuf_putc(cmark_strbuf *buf, int c); + +CMARK_GFM_EXPORT void cmark_strbuf_put(cmark_strbuf *buf, const unsigned char *data, bufsize_t len); + +CMARK_GFM_EXPORT void cmark_strbuf_puts(cmark_strbuf *buf, const char *string); + +CMARK_GFM_EXPORT void cmark_strbuf_clear(cmark_strbuf *buf); +CMARK_GFM_EXPORT bufsize_t cmark_strbuf_strchr(const cmark_strbuf *buf, int c, bufsize_t pos); + +CMARK_GFM_EXPORT bufsize_t cmark_strbuf_strrchr(const cmark_strbuf *buf, int c, bufsize_t pos); + +CMARK_GFM_EXPORT void cmark_strbuf_drop(cmark_strbuf *buf, bufsize_t n); + +CMARK_GFM_EXPORT void cmark_strbuf_truncate(cmark_strbuf *buf, bufsize_t len); + +CMARK_GFM_EXPORT void cmark_strbuf_rtrim(cmark_strbuf *buf); + +CMARK_GFM_EXPORT void cmark_strbuf_trim(cmark_strbuf *buf); + +CMARK_GFM_EXPORT void cmark_strbuf_normalize_whitespace(cmark_strbuf *s); + +CMARK_GFM_EXPORT void cmark_strbuf_unescape(cmark_strbuf *s); #ifdef __cplusplus diff --git a/liteidex/src/3rdparty/cmark/src/case_fold_switch.inc b/liteidex/src/3rdparty/cmark/src/case_fold_switch.inc old mode 100755 new mode 100644 diff --git a/liteidex/src/3rdparty/cmark/src/chunk.h b/liteidex/src/3rdparty/cmark/src/chunk.h old mode 100755 new mode 100644 index 6d1601d24..c411c04a4 --- a/liteidex/src/3rdparty/cmark/src/chunk.h +++ b/liteidex/src/3rdparty/cmark/src/chunk.h @@ -4,14 +4,14 @@ #include #include #include -#include "cmark.h" +#include "cmark-gfm.h" #include "buffer.h" #include "cmark_ctype.h" #define CMARK_CHUNK_EMPTY \ { NULL, 0, 0 } -typedef struct { +typedef struct cmark_chunk { unsigned char *data; bufsize_t len; bufsize_t alloc; // also implies a NULL-terminated string @@ -116,4 +116,20 @@ static CMARK_INLINE cmark_chunk cmark_chunk_buf_detach(cmark_strbuf *buf) { return c; } +/* trim_new variants are to be used when the source chunk may or may not be + * allocated; forces a newly allocated chunk. */ +static CMARK_INLINE cmark_chunk cmark_chunk_ltrim_new(cmark_mem *mem, cmark_chunk *c) { + cmark_chunk r = cmark_chunk_dup(c, 0, c->len); + cmark_chunk_ltrim(&r); + cmark_chunk_to_cstr(mem, &r); + return r; +} + +static CMARK_INLINE cmark_chunk cmark_chunk_rtrim_new(cmark_mem *mem, cmark_chunk *c) { + cmark_chunk r = cmark_chunk_dup(c, 0, c->len); + cmark_chunk_rtrim(&r); + cmark_chunk_to_cstr(mem, &r); + return r; +} + #endif diff --git a/liteidex/src/3rdparty/cmark/src/cmark-gfm-extension_api.h b/liteidex/src/3rdparty/cmark/src/cmark-gfm-extension_api.h new file mode 100644 index 000000000..bb92a59bf --- /dev/null +++ b/liteidex/src/3rdparty/cmark/src/cmark-gfm-extension_api.h @@ -0,0 +1,737 @@ +#ifndef CMARK_GFM_EXTENSION_API_H +#define CMARK_GFM_EXTENSION_API_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "cmark-gfm.h" + +struct cmark_renderer; +struct cmark_html_renderer; +struct cmark_chunk; + +/** + * ## Extension Support + * + * While the "core" of libcmark is strictly compliant with the + * specification, an API is provided for extension writers to + * hook into the parsing process. + * + * It should be noted that the cmark_node API already offers + * room for customization, with methods offered to traverse and + * modify the AST, and even define custom blocks. + * When the desired customization is achievable in an error-proof + * way using that API, it should be the preferred method. + * + * The following API requires a more in-depth understanding + * of libcmark's parsing strategy, which is exposed + * [here](http://spec.commonmark.org/0.24/#appendix-a-parsing-strategy). + * + * It should be used when "a posteriori" modification of the AST + * proves to be too difficult / impossible to implement correctly. + * + * It can also serve as an intermediary step before extending + * the specification, as an extension implemented using this API + * will be trivially integrated in the core if it proves to be + * desirable. + */ + +typedef struct cmark_plugin cmark_plugin; + +/** A syntax extension that can be attached to a cmark_parser + * with cmark_parser_attach_syntax_extension(). + * + * Extension writers should assign functions matching + * the signature of the following 'virtual methods' to + * implement new functionality. + * + * Their calling order and expected behaviour match the procedure outlined + * at : + * + * During step 1, cmark will call the function provided through + * 'cmark_syntax_extension_set_match_block_func' when it + * iterates over an open block created by this extension, + * to determine whether it could contain the new line. + * If no function was provided, cmark will close the block. + * + * During step 2, if and only if the new line doesn't match any + * of the standard syntax rules, cmark will call the function + * provided through 'cmark_syntax_extension_set_open_block_func' + * to let the extension determine whether that new line matches + * one of its syntax rules. + * It is the responsibility of the parser to create and add the + * new block with cmark_parser_make_block and cmark_parser_add_child. + * If no function was provided is NULL, the extension will have + * no effect at all on the final block structure of the AST. + * + * #### Inline parsing phase hooks + * + * For each character provided by the extension through + * 'cmark_syntax_extension_set_special_inline_chars', + * the function provided by the extension through + * 'cmark_syntax_extension_set_match_inline_func' + * will get called, it is the responsibility of the extension + * to scan the characters located at the current inline parsing offset + * with the cmark_inline_parser API. + * + * Depending on the type of the extension, it can either: + * + * * Scan forward, determine that the syntax matches and return + * a newly-created inline node with the appropriate type. + * This is the technique that would be used if inline code + * (with backticks) was implemented as an extension. + * * Scan only the character(s) that its syntax rules require + * for opening and closing nodes, push a delimiter on the + * delimiter stack, and return a simple text node with its + * contents set to the character(s) consumed. + * This is the technique that would be used if emphasis + * inlines were implemented as an extension. + * + * When an extension has pushed delimiters on the stack, + * the function provided through + * 'cmark_syntax_extension_set_inline_from_delim_func' + * will get called in a latter phase, + * when the inline parser has matched opener and closer delimiters + * created by the extension together. + * + * It is then the responsibility of the extension to modify + * and populate the opener inline text node, and to remove + * the necessary delimiters from the delimiter stack. + * + * Finally, the extension should return NULL if its scan didn't + * match its syntax rules. + * + * The extension can store whatever private data it might need + * with 'cmark_syntax_extension_set_private', + * and optionally define a free function for this data. + */ +typedef struct subject cmark_inline_parser; + +/** Exposed raw for now */ + +typedef struct delimiter { + struct delimiter *previous; + struct delimiter *next; + cmark_node *inl_text; + bufsize_t position; + bufsize_t length; + unsigned char delim_char; + int can_open; + int can_close; +} delimiter; + +/** + * ### Plugin API. + * + * Extensions should be distributed as dynamic libraries, + * with a single exported function named after the distributed + * filename. + * + * When discovering extensions (see cmark_init), cmark will + * try to load a symbol named "init_{{filename}}" in all the + * dynamic libraries it encounters. + * + * For example, given a dynamic library named myextension.so + * (or myextension.dll), cmark will try to load the symbol + * named "init_myextension". This means that the filename + * must lend itself to forming a valid C identifier, with + * the notable exception of dashes, which will be translated + * to underscores, which means cmark will look for a function + * named "init_my_extension" if it encounters a dynamic library + * named "my-extension.so". + * + * See the 'cmark_plugin_init_func' typedef for the exact prototype + * this function should follow. + * + * For now the extensibility of cmark is not complete, as + * it only offers API to hook into the block parsing phase + * (). + * + * See 'cmark_plugin_register_syntax_extension' for more information. + */ + +/** The prototype plugins' init function should follow. + */ +typedef int (*cmark_plugin_init_func)(cmark_plugin *plugin); + +/** Register a syntax 'extension' with the 'plugin', it will be made + * available as an extension and, if attached to a cmark_parser + * with 'cmark_parser_attach_syntax_extension', it will contribute + * to the block parsing process. + * + * See the documentation for 'cmark_syntax_extension' for information + * on how to implement one. + * + * This function will typically be called from the init function + * of external modules. + * + * This takes ownership of 'extension', one should not call + * 'cmark_syntax_extension_free' on a registered extension. + */ +CMARK_GFM_EXPORT +int cmark_plugin_register_syntax_extension(cmark_plugin *plugin, + cmark_syntax_extension *extension); + +/** This will search for the syntax extension named 'name' among the + * registered syntax extensions. + * + * It can then be attached to a cmark_parser + * with the cmark_parser_attach_syntax_extension method. + */ +CMARK_GFM_EXPORT +cmark_syntax_extension *cmark_find_syntax_extension(const char *name); + +/** Should create and add a new open block to 'parent_container' if + * 'input' matches a syntax rule for that block type. It is allowed + * to modify the type of 'parent_container'. + * + * Should return the newly created block if there is one, or + * 'parent_container' if its type was modified, or NULL. + */ +typedef cmark_node * (*cmark_open_block_func) (cmark_syntax_extension *extension, + int indented, + cmark_parser *parser, + cmark_node *parent_container, + unsigned char *input, + int len); + +typedef cmark_node *(*cmark_match_inline_func)(cmark_syntax_extension *extension, + cmark_parser *parser, + cmark_node *parent, + unsigned char character, + cmark_inline_parser *inline_parser); + +typedef delimiter *(*cmark_inline_from_delim_func)(cmark_syntax_extension *extension, + cmark_parser *parser, + cmark_inline_parser *inline_parser, + delimiter *opener, + delimiter *closer); + +/** Should return 'true' if 'input' can be contained in 'container', + * 'false' otherwise. + */ +typedef int (*cmark_match_block_func) (cmark_syntax_extension *extension, + cmark_parser *parser, + unsigned char *input, + int len, + cmark_node *container); + +typedef const char *(*cmark_get_type_string_func) (cmark_syntax_extension *extension, + cmark_node *node); + +typedef int (*cmark_can_contain_func) (cmark_syntax_extension *extension, + cmark_node *node, + cmark_node_type child); + +typedef int (*cmark_contains_inlines_func) (cmark_syntax_extension *extension, + cmark_node *node); + +typedef void (*cmark_common_render_func) (cmark_syntax_extension *extension, + struct cmark_renderer *renderer, + cmark_node *node, + cmark_event_type ev_type, + int options); + +typedef int (*cmark_commonmark_escape_func) (cmark_syntax_extension *extension, + cmark_node *node, + int c); + +typedef const char* (*cmark_xml_attr_func) (cmark_syntax_extension *extension, + cmark_node *node); + +typedef void (*cmark_html_render_func) (cmark_syntax_extension *extension, + struct cmark_html_renderer *renderer, + cmark_node *node, + cmark_event_type ev_type, + int options); + +typedef int (*cmark_html_filter_func) (cmark_syntax_extension *extension, + const unsigned char *tag, + size_t tag_len); + +typedef cmark_node *(*cmark_postprocess_func) (cmark_syntax_extension *extension, + cmark_parser *parser, + cmark_node *root); + +typedef int (*cmark_ispunct_func) (char c); + +typedef void (*cmark_opaque_alloc_func) (cmark_syntax_extension *extension, + cmark_mem *mem, + cmark_node *node); + +typedef void (*cmark_opaque_free_func) (cmark_syntax_extension *extension, + cmark_mem *mem, + cmark_node *node); + +/** Free a cmark_syntax_extension. + */ +CMARK_GFM_EXPORT +void cmark_syntax_extension_free (cmark_mem *mem, cmark_syntax_extension *extension); + +/** Return a newly-constructed cmark_syntax_extension, named 'name'. + */ +CMARK_GFM_EXPORT +cmark_syntax_extension *cmark_syntax_extension_new (const char *name); + +CMARK_GFM_EXPORT +cmark_node_type cmark_syntax_extension_add_node(int is_inline); + +CMARK_GFM_EXPORT +void cmark_syntax_extension_set_emphasis(cmark_syntax_extension *extension, int emphasis); + +/** See the documentation for 'cmark_syntax_extension' + */ +CMARK_GFM_EXPORT +void cmark_syntax_extension_set_open_block_func(cmark_syntax_extension *extension, + cmark_open_block_func func); + +/** See the documentation for 'cmark_syntax_extension' + */ +CMARK_GFM_EXPORT +void cmark_syntax_extension_set_match_block_func(cmark_syntax_extension *extension, + cmark_match_block_func func); + +/** See the documentation for 'cmark_syntax_extension' + */ +CMARK_GFM_EXPORT +void cmark_syntax_extension_set_match_inline_func(cmark_syntax_extension *extension, + cmark_match_inline_func func); + +/** See the documentation for 'cmark_syntax_extension' + */ +CMARK_GFM_EXPORT +void cmark_syntax_extension_set_inline_from_delim_func(cmark_syntax_extension *extension, + cmark_inline_from_delim_func func); + +/** See the documentation for 'cmark_syntax_extension' + */ +CMARK_GFM_EXPORT +void cmark_syntax_extension_set_special_inline_chars(cmark_syntax_extension *extension, + cmark_llist *special_chars); + +/** See the documentation for 'cmark_syntax_extension' + */ +CMARK_GFM_EXPORT +void cmark_syntax_extension_set_get_type_string_func(cmark_syntax_extension *extension, + cmark_get_type_string_func func); + +/** See the documentation for 'cmark_syntax_extension' + */ +CMARK_GFM_EXPORT +void cmark_syntax_extension_set_can_contain_func(cmark_syntax_extension *extension, + cmark_can_contain_func func); + +/** See the documentation for 'cmark_syntax_extension' + */ +CMARK_GFM_EXPORT +void cmark_syntax_extension_set_contains_inlines_func(cmark_syntax_extension *extension, + cmark_contains_inlines_func func); + +/** See the documentation for 'cmark_syntax_extension' + */ +CMARK_GFM_EXPORT +void cmark_syntax_extension_set_commonmark_render_func(cmark_syntax_extension *extension, + cmark_common_render_func func); + +/** See the documentation for 'cmark_syntax_extension' + */ +CMARK_GFM_EXPORT +void cmark_syntax_extension_set_plaintext_render_func(cmark_syntax_extension *extension, + cmark_common_render_func func); + +/** See the documentation for 'cmark_syntax_extension' + */ +CMARK_GFM_EXPORT +void cmark_syntax_extension_set_latex_render_func(cmark_syntax_extension *extension, + cmark_common_render_func func); + +/** See the documentation for 'cmark_syntax_extension' + */ +CMARK_GFM_EXPORT +void cmark_syntax_extension_set_xml_attr_func(cmark_syntax_extension *extension, + cmark_xml_attr_func func); + + /** See the documentation for 'cmark_syntax_extension' + */ +CMARK_GFM_EXPORT +void cmark_syntax_extension_set_man_render_func(cmark_syntax_extension *extension, + cmark_common_render_func func); + +/** See the documentation for 'cmark_syntax_extension' + */ +CMARK_GFM_EXPORT +void cmark_syntax_extension_set_html_render_func(cmark_syntax_extension *extension, + cmark_html_render_func func); + +/** See the documentation for 'cmark_syntax_extension' + */ +CMARK_GFM_EXPORT +void cmark_syntax_extension_set_html_filter_func(cmark_syntax_extension *extension, + cmark_html_filter_func func); + +/** See the documentation for 'cmark_syntax_extension' + */ +CMARK_GFM_EXPORT +void cmark_syntax_extension_set_commonmark_escape_func(cmark_syntax_extension *extension, + cmark_commonmark_escape_func func); + +/** See the documentation for 'cmark_syntax_extension' + */ +CMARK_GFM_EXPORT +void cmark_syntax_extension_set_private(cmark_syntax_extension *extension, + void *priv, + cmark_free_func free_func); + +/** See the documentation for 'cmark_syntax_extension' + */ +CMARK_GFM_EXPORT +void *cmark_syntax_extension_get_private(cmark_syntax_extension *extension); + +/** See the documentation for 'cmark_syntax_extension' + */ +CMARK_GFM_EXPORT +void cmark_syntax_extension_set_postprocess_func(cmark_syntax_extension *extension, + cmark_postprocess_func func); + +/** See the documentation for 'cmark_syntax_extension' + */ +CMARK_GFM_EXPORT +void cmark_syntax_extension_set_opaque_alloc_func(cmark_syntax_extension *extension, + cmark_opaque_alloc_func func); + +/** See the documentation for 'cmark_syntax_extension' + */ +CMARK_GFM_EXPORT +void cmark_syntax_extension_set_opaque_free_func(cmark_syntax_extension *extension, + cmark_opaque_free_func func); + +/** See the documentation for 'cmark_syntax_extension' + */ +CMARK_GFM_EXPORT +void cmark_parser_set_backslash_ispunct_func(cmark_parser *parser, + cmark_ispunct_func func); + +/** Return the index of the line currently being parsed, starting with 1. + */ +CMARK_GFM_EXPORT +int cmark_parser_get_line_number(cmark_parser *parser); + +/** Return the offset in bytes in the line being processed. + * + * Example: + * + * ### foo + * + * Here, offset will first be 0, then 5 (the index of the 'f' character). + */ +CMARK_GFM_EXPORT +int cmark_parser_get_offset(cmark_parser *parser); + +/** + * Return the offset in 'columns' in the line being processed. + * + * This value may differ from the value returned by + * cmark_parser_get_offset() in that it accounts for tabs, + * and as such should not be used as an index in the current line's + * buffer. + * + * Example: + * + * cmark_parser_advance_offset() can be called to advance the + * offset by a number of columns, instead of a number of bytes. + * + * In that case, if offset falls "in the middle" of a tab + * character, 'column' and offset will differ. + * + * ``` + * foo \t bar + * ^ ^^ + * offset (0) 20 + * ``` + * + * If cmark_parser_advance_offset is called here with 'columns' + * set to 'true' and 'offset' set to 22, cmark_parser_get_offset() + * will return 20, whereas cmark_parser_get_column() will return + * 22. + * + * Additionally, as tabs expand to the next multiple of 4 column, + * cmark_parser_has_partially_consumed_tab() will now return + * 'true'. + */ +CMARK_GFM_EXPORT +int cmark_parser_get_column(cmark_parser *parser); + +/** Return the absolute index in bytes of the first nonspace + * character coming after the offset as returned by + * cmark_parser_get_offset() in the line currently being processed. + * + * Example: + * + * ``` + * foo bar baz \n + * ^ ^ ^ + * 0 offset (16) first_nonspace (28) + * ``` + */ +CMARK_GFM_EXPORT +int cmark_parser_get_first_nonspace(cmark_parser *parser); + +/** Return the absolute index of the first nonspace column coming after 'offset' + * in the line currently being processed, counting tabs as multiple + * columns as appropriate. + * + * See the documentation for cmark_parser_get_first_nonspace() and + * cmark_parser_get_column() for more information. + */ +CMARK_GFM_EXPORT +int cmark_parser_get_first_nonspace_column(cmark_parser *parser); + +/** Return the difference between the values returned by + * cmark_parser_get_first_nonspace_column() and + * cmark_parser_get_column(). + * + * This is not a byte offset, as it can count one tab as multiple + * characters. + */ +CMARK_GFM_EXPORT +int cmark_parser_get_indent(cmark_parser *parser); + +/** Return 'true' if the line currently being processed has been entirely + * consumed, 'false' otherwise. + * + * Example: + * + * ``` + * foo bar baz \n + * ^ + * offset + * ``` + * + * This function will return 'false' here. + * + * ``` + * foo bar baz \n + * ^ + * offset + * ``` + * This function will still return 'false'. + * + * ``` + * foo bar baz \n + * ^ + * offset + * ``` + * + * At this point, this function will now return 'true'. + */ +CMARK_GFM_EXPORT +int cmark_parser_is_blank(cmark_parser *parser); + +/** Return 'true' if the value returned by cmark_parser_get_offset() + * is 'inside' an expanded tab. + * + * See the documentation for cmark_parser_get_column() for more + * information. + */ +CMARK_GFM_EXPORT +int cmark_parser_has_partially_consumed_tab(cmark_parser *parser); + +/** Return the length in bytes of the previously processed line, excluding potential + * newline (\n) and carriage return (\r) trailing characters. + */ +CMARK_GFM_EXPORT +int cmark_parser_get_last_line_length(cmark_parser *parser); + +/** Add a child to 'parent' during the parsing process. + * + * If 'parent' isn't the kind of node that can accept this child, + * this function will back up till it hits a node that can, closing + * blocks as appropriate. + */ +CMARK_GFM_EXPORT +cmark_node*cmark_parser_add_child(cmark_parser *parser, + cmark_node *parent, + cmark_node_type block_type, + int start_column); + +/** Advance the 'offset' of the parser in the current line. + * + * See the documentation of cmark_parser_get_offset() and + * cmark_parser_get_column() for more information. + */ +CMARK_GFM_EXPORT +void cmark_parser_advance_offset(cmark_parser *parser, + const char *input, + int count, + int columns); + + +CMARK_GFM_EXPORT +void cmark_parser_feed_reentrant(cmark_parser *parser, const char *buffer, size_t len); + +/** Attach the syntax 'extension' to the 'parser', to provide extra syntax + * rules. + * See the documentation for cmark_syntax_extension for more information. + * + * Returns 'true' if the 'extension' was successfully attached, + * 'false' otherwise. + */ +CMARK_GFM_EXPORT +int cmark_parser_attach_syntax_extension(cmark_parser *parser, cmark_syntax_extension *extension); + +/** Change the type of 'node'. + * + * Return 0 if the type could be changed, 1 otherwise. + */ +CMARK_GFM_EXPORT int cmark_node_set_type(cmark_node *node, cmark_node_type type); + +/** Return the string content for all types of 'node'. + * The pointer stays valid as long as 'node' isn't freed. + */ +CMARK_GFM_EXPORT const char *cmark_node_get_string_content(cmark_node *node); + +/** Set the string 'content' for all types of 'node'. + * Copies 'content'. + */ +CMARK_GFM_EXPORT int cmark_node_set_string_content(cmark_node *node, const char *content); + +/** Get the syntax extension responsible for the creation of 'node'. + * Return NULL if 'node' was created because it matched standard syntax rules. + */ +CMARK_GFM_EXPORT cmark_syntax_extension *cmark_node_get_syntax_extension(cmark_node *node); + +/** Set the syntax extension responsible for creating 'node'. + */ +CMARK_GFM_EXPORT int cmark_node_set_syntax_extension(cmark_node *node, + cmark_syntax_extension *extension); + +/** + * ## Inline syntax extension helpers + * + * The inline parsing process is described in detail at + * + */ + +/** Should return 'true' if the predicate matches 'c', 'false' otherwise + */ +typedef int (*cmark_inline_predicate)(int c); + +/** Advance the current inline parsing offset */ +CMARK_GFM_EXPORT +void cmark_inline_parser_advance_offset(cmark_inline_parser *parser); + +/** Get the current inline parsing offset */ +CMARK_GFM_EXPORT +int cmark_inline_parser_get_offset(cmark_inline_parser *parser); + +/** Set the offset in bytes in the chunk being processed by the given inline parser. + */ +CMARK_GFM_EXPORT +void cmark_inline_parser_set_offset(cmark_inline_parser *parser, int offset); + +/** Gets the cmark_chunk being operated on by the given inline parser. + * Use cmark_inline_parser_get_offset to get our current position in the chunk. + */ +CMARK_GFM_EXPORT +struct cmark_chunk *cmark_inline_parser_get_chunk(cmark_inline_parser *parser); + +/** Returns 1 if the inline parser is currently in a bracket; pass 1 for 'image' + * if you want to know about an image-type bracket, 0 for link-type. */ +CMARK_GFM_EXPORT +int cmark_inline_parser_in_bracket(cmark_inline_parser *parser, int image); + +/** Remove the last n characters from the last child of the given node. + * This only works where all n characters are in the single last child, and the last + * child is CMARK_NODE_TEXT. + */ +CMARK_GFM_EXPORT +void cmark_node_unput(cmark_node *node, int n); + + +/** Get the character located at the current inline parsing offset + */ +CMARK_GFM_EXPORT +unsigned char cmark_inline_parser_peek_char(cmark_inline_parser *parser); + +/** Get the character located 'pos' bytes in the current line. + */ +CMARK_GFM_EXPORT +unsigned char cmark_inline_parser_peek_at(cmark_inline_parser *parser, int pos); + +/** Whether the inline parser has reached the end of the current line + */ +CMARK_GFM_EXPORT +int cmark_inline_parser_is_eof(cmark_inline_parser *parser); + +/** Get the characters located after the current inline parsing offset + * while 'pred' matches. Free after usage. + */ +CMARK_GFM_EXPORT +char *cmark_inline_parser_take_while(cmark_inline_parser *parser, cmark_inline_predicate pred); + +/** Push a delimiter on the delimiter stack. + * See < for + * more information on the parameters + */ +CMARK_GFM_EXPORT +void cmark_inline_parser_push_delimiter(cmark_inline_parser *parser, + unsigned char c, + int can_open, + int can_close, + cmark_node *inl_text); + +/** Remove 'delim' from the delimiter stack + */ +CMARK_GFM_EXPORT +void cmark_inline_parser_remove_delimiter(cmark_inline_parser *parser, delimiter *delim); + +CMARK_GFM_EXPORT +delimiter *cmark_inline_parser_get_last_delimiter(cmark_inline_parser *parser); + +CMARK_GFM_EXPORT +int cmark_inline_parser_get_line(cmark_inline_parser *parser); + +CMARK_GFM_EXPORT +int cmark_inline_parser_get_column(cmark_inline_parser *parser); + +/** Convenience function to scan a given delimiter. + * + * 'left_flanking' and 'right_flanking' will be set to true if they + * respectively precede and follow a non-space, non-punctuation + * character. + * + * Additionally, 'punct_before' and 'punct_after' will respectively be set + * if the preceding or following character is a punctuation character. + * + * Note that 'left_flanking' and 'right_flanking' can both be 'true'. + * + * Returns the number of delimiters encountered, in the limit + * of 'max_delims', and advances the inline parsing offset. + */ +CMARK_GFM_EXPORT +int cmark_inline_parser_scan_delimiters(cmark_inline_parser *parser, + int max_delims, + unsigned char c, + int *left_flanking, + int *right_flanking, + int *punct_before, + int *punct_after); + +CMARK_GFM_EXPORT +void cmark_manage_extensions_special_characters(cmark_parser *parser, int add); + +CMARK_GFM_EXPORT +cmark_llist *cmark_parser_get_syntax_extensions(cmark_parser *parser); + +CMARK_GFM_EXPORT +void cmark_arena_push(void); + +CMARK_GFM_EXPORT +int cmark_arena_pop(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/liteidex/src/3rdparty/cmark/src/cmark.h b/liteidex/src/3rdparty/cmark/src/cmark-gfm.h old mode 100755 new mode 100644 similarity index 57% rename from liteidex/src/3rdparty/cmark/src/cmark.h rename to liteidex/src/3rdparty/cmark/src/cmark-gfm.h index 102aa6f8f..0544057a5 --- a/liteidex/src/3rdparty/cmark/src/cmark.h +++ b/liteidex/src/3rdparty/cmark/src/cmark-gfm.h @@ -1,9 +1,10 @@ -#ifndef CMARK_H -#define CMARK_H +#ifndef CMARK_GFM_H +#define CMARK_GFM_H #include -#include -#include +#include +#include "cmark-gfm_export.h" +#include "cmark-gfm_version.h" #ifdef __cplusplus extern "C" { @@ -11,7 +12,7 @@ extern "C" { /** # NAME * - * **cmark** - CommonMark parsing, manipulating, and rendering + * **cmark-gfm** - CommonMark parsing, manipulating, and rendering */ /** # DESCRIPTION @@ -24,47 +25,52 @@ extern "C" { * UTF-8-encoded string. It is the caller's responsibility * to free the returned buffer. */ -CMARK_EXPORT +CMARK_GFM_EXPORT char *cmark_markdown_to_html(const char *text, size_t len, int options); /** ## Node Structure */ +#define CMARK_NODE_TYPE_PRESENT (0x8000) +#define CMARK_NODE_TYPE_BLOCK (CMARK_NODE_TYPE_PRESENT | 0x0000) +#define CMARK_NODE_TYPE_INLINE (CMARK_NODE_TYPE_PRESENT | 0x4000) +#define CMARK_NODE_TYPE_MASK (0xc000) +#define CMARK_NODE_VALUE_MASK (0x3fff) + typedef enum { /* Error status */ - CMARK_NODE_NONE, + CMARK_NODE_NONE = 0x0000, /* Block */ - CMARK_NODE_DOCUMENT, - CMARK_NODE_BLOCK_QUOTE, - CMARK_NODE_LIST, - CMARK_NODE_ITEM, - CMARK_NODE_CODE_BLOCK, - CMARK_NODE_HTML_BLOCK, - CMARK_NODE_CUSTOM_BLOCK, - CMARK_NODE_PARAGRAPH, - CMARK_NODE_HEADING, - CMARK_NODE_THEMATIC_BREAK, - - CMARK_NODE_FIRST_BLOCK = CMARK_NODE_DOCUMENT, - CMARK_NODE_LAST_BLOCK = CMARK_NODE_THEMATIC_BREAK, + CMARK_NODE_DOCUMENT = CMARK_NODE_TYPE_BLOCK | 0x0001, + CMARK_NODE_BLOCK_QUOTE = CMARK_NODE_TYPE_BLOCK | 0x0002, + CMARK_NODE_LIST = CMARK_NODE_TYPE_BLOCK | 0x0003, + CMARK_NODE_ITEM = CMARK_NODE_TYPE_BLOCK | 0x0004, + CMARK_NODE_CODE_BLOCK = CMARK_NODE_TYPE_BLOCK | 0x0005, + CMARK_NODE_HTML_BLOCK = CMARK_NODE_TYPE_BLOCK | 0x0006, + CMARK_NODE_CUSTOM_BLOCK = CMARK_NODE_TYPE_BLOCK | 0x0007, + CMARK_NODE_PARAGRAPH = CMARK_NODE_TYPE_BLOCK | 0x0008, + CMARK_NODE_HEADING = CMARK_NODE_TYPE_BLOCK | 0x0009, + CMARK_NODE_THEMATIC_BREAK = CMARK_NODE_TYPE_BLOCK | 0x000a, + CMARK_NODE_FOOTNOTE_DEFINITION = CMARK_NODE_TYPE_BLOCK | 0x000b, /* Inline */ - CMARK_NODE_TEXT, - CMARK_NODE_SOFTBREAK, - CMARK_NODE_LINEBREAK, - CMARK_NODE_CODE, - CMARK_NODE_HTML_INLINE, - CMARK_NODE_CUSTOM_INLINE, - CMARK_NODE_EMPH, - CMARK_NODE_STRONG, - CMARK_NODE_LINK, - CMARK_NODE_IMAGE, - - CMARK_NODE_FIRST_INLINE = CMARK_NODE_TEXT, - CMARK_NODE_LAST_INLINE = CMARK_NODE_IMAGE, + CMARK_NODE_TEXT = CMARK_NODE_TYPE_INLINE | 0x0001, + CMARK_NODE_SOFTBREAK = CMARK_NODE_TYPE_INLINE | 0x0002, + CMARK_NODE_LINEBREAK = CMARK_NODE_TYPE_INLINE | 0x0003, + CMARK_NODE_CODE = CMARK_NODE_TYPE_INLINE | 0x0004, + CMARK_NODE_HTML_INLINE = CMARK_NODE_TYPE_INLINE | 0x0005, + CMARK_NODE_CUSTOM_INLINE = CMARK_NODE_TYPE_INLINE | 0x0006, + CMARK_NODE_EMPH = CMARK_NODE_TYPE_INLINE | 0x0007, + CMARK_NODE_STRONG = CMARK_NODE_TYPE_INLINE | 0x0008, + CMARK_NODE_LINK = CMARK_NODE_TYPE_INLINE | 0x0009, + CMARK_NODE_IMAGE = CMARK_NODE_TYPE_INLINE | 0x000a, + CMARK_NODE_FOOTNOTE_REFERENCE = CMARK_NODE_TYPE_INLINE | 0x000b, } cmark_node_type; +extern cmark_node_type CMARK_NODE_LAST_BLOCK; +extern cmark_node_type CMARK_NODE_LAST_INLINE; + /* For backwards compatibility: */ #define CMARK_NODE_HEADER CMARK_NODE_HEADING #define CMARK_NODE_HRULE CMARK_NODE_THEMATIC_BREAK @@ -86,6 +92,7 @@ typedef enum { typedef struct cmark_node cmark_node; typedef struct cmark_parser cmark_parser; typedef struct cmark_iter cmark_iter; +typedef struct cmark_syntax_extension cmark_syntax_extension; /** * ## Custom memory allocator support @@ -100,6 +107,70 @@ typedef struct cmark_mem { void (*free)(void *); } cmark_mem; +/** The default memory allocator; uses the system's calloc, + * realloc and free. + */ +CMARK_GFM_EXPORT +cmark_mem *cmark_get_default_mem_allocator(void); + +/** An arena allocator; uses system calloc to allocate large + * slabs of memory. Memory in these slabs is not reused at all. + */ +CMARK_GFM_EXPORT +cmark_mem *cmark_get_arena_mem_allocator(void); + +/** Resets the arena allocator, quickly returning all used memory + * to the operating system. + */ +CMARK_GFM_EXPORT +void cmark_arena_reset(void); + +/** Callback for freeing user data with a 'cmark_mem' context. + */ +typedef void (*cmark_free_func) (cmark_mem *mem, void *user_data); + + +/* + * ## Basic data structures + * + * To keep dependencies to the strict minimum, libcmark implements + * its own versions of "classic" data structures. + */ + +/** + * ### Linked list + */ + +/** A generic singly linked list. + */ +typedef struct _cmark_llist +{ + struct _cmark_llist *next; + void *data; +} cmark_llist; + +/** Append an element to the linked list, return the possibly modified + * head of the list. + */ +CMARK_GFM_EXPORT +cmark_llist * cmark_llist_append (cmark_mem * mem, + cmark_llist * head, + void * data); + +/** Free the list starting with 'head', calling 'free_func' with the + * data pointer of each of its elements + */ +CMARK_GFM_EXPORT +void cmark_llist_free_full (cmark_mem * mem, + cmark_llist * head, + cmark_free_func free_func); + +/** Free the list starting with 'head' + */ +CMARK_GFM_EXPORT +void cmark_llist_free (cmark_mem * mem, + cmark_llist * head); + /** * ## Creating and Destroying Nodes */ @@ -108,18 +179,25 @@ typedef struct cmark_mem { * other required properties, which it is the caller's responsibility * to assign. */ -CMARK_EXPORT cmark_node *cmark_node_new(cmark_node_type type); +CMARK_GFM_EXPORT cmark_node *cmark_node_new(cmark_node_type type); /** Same as `cmark_node_new`, but explicitly listing the memory * allocator used to allocate the node. Note: be sure to use the same * allocator for every node in a tree, or bad things can happen. */ -CMARK_EXPORT cmark_node *cmark_node_new_with_mem(cmark_node_type type, +CMARK_GFM_EXPORT cmark_node *cmark_node_new_with_mem(cmark_node_type type, cmark_mem *mem); +CMARK_GFM_EXPORT cmark_node *cmark_node_new_with_ext(cmark_node_type type, + cmark_syntax_extension *extension); + +CMARK_GFM_EXPORT cmark_node *cmark_node_new_with_mem_and_ext(cmark_node_type type, + cmark_mem *mem, + cmark_syntax_extension *extension); + /** Frees the memory allocated for a node and any children. */ -CMARK_EXPORT void cmark_node_free(cmark_node *node); +CMARK_GFM_EXPORT void cmark_node_free(cmark_node *node); /** * ## Tree Traversal @@ -128,24 +206,29 @@ CMARK_EXPORT void cmark_node_free(cmark_node *node); /** Returns the next node in the sequence after 'node', or NULL if * there is none. */ -CMARK_EXPORT cmark_node *cmark_node_next(cmark_node *node); +CMARK_GFM_EXPORT cmark_node *cmark_node_next(cmark_node *node); /** Returns the previous node in the sequence after 'node', or NULL if * there is none. */ -CMARK_EXPORT cmark_node *cmark_node_previous(cmark_node *node); +CMARK_GFM_EXPORT cmark_node *cmark_node_previous(cmark_node *node); /** Returns the parent of 'node', or NULL if there is none. */ -CMARK_EXPORT cmark_node *cmark_node_parent(cmark_node *node); +CMARK_GFM_EXPORT cmark_node *cmark_node_parent(cmark_node *node); /** Returns the first child of 'node', or NULL if 'node' has no children. */ -CMARK_EXPORT cmark_node *cmark_node_first_child(cmark_node *node); +CMARK_GFM_EXPORT cmark_node *cmark_node_first_child(cmark_node *node); /** Returns the last child of 'node', or NULL if 'node' has no children. */ -CMARK_EXPORT cmark_node *cmark_node_last_child(cmark_node *node); +CMARK_GFM_EXPORT cmark_node *cmark_node_last_child(cmark_node *node); + +/** Returns the footnote reference of 'node', or NULL if 'node' doesn't have a + * footnote reference. + */ +CMARK_GFM_EXPORT cmark_node *cmark_node_parent_footnote_def(cmark_node *node); /** * ## Iterator @@ -204,40 +287,40 @@ typedef enum { * The memory allocated for the iterator should be released using * 'cmark_iter_free' when it is no longer needed. */ -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_iter *cmark_iter_new(cmark_node *root); /** Frees the memory allocated for an iterator. */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_iter_free(cmark_iter *iter); /** Advances to the next node and returns the event type (`CMARK_EVENT_ENTER`, * `CMARK_EVENT_EXIT` or `CMARK_EVENT_DONE`). */ -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_event_type cmark_iter_next(cmark_iter *iter); /** Returns the current node. */ -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_node *cmark_iter_get_node(cmark_iter *iter); /** Returns the current event type. */ -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_event_type cmark_iter_get_event_type(cmark_iter *iter); /** Returns the root node. */ -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_node *cmark_iter_get_root(cmark_iter *iter); /** Resets the iterator so that the current node is 'current' and * the event type is 'event_type'. The new current node must be a * descendant of the root node or the root node itself. */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_iter_reset(cmark_iter *iter, cmark_node *current, cmark_event_type event_type); @@ -247,37 +330,42 @@ void cmark_iter_reset(cmark_iter *iter, cmark_node *current, /** Returns the user data of 'node'. */ -CMARK_EXPORT void *cmark_node_get_user_data(cmark_node *node); +CMARK_GFM_EXPORT void *cmark_node_get_user_data(cmark_node *node); /** Sets arbitrary user data for 'node'. Returns 1 on success, * 0 on failure. */ -CMARK_EXPORT int cmark_node_set_user_data(cmark_node *node, void *user_data); +CMARK_GFM_EXPORT int cmark_node_set_user_data(cmark_node *node, void *user_data); + +/** Set free function for user data */ +CMARK_GFM_EXPORT +int cmark_node_set_user_data_free_func(cmark_node *node, + cmark_free_func free_func); /** Returns the type of 'node', or `CMARK_NODE_NONE` on error. */ -CMARK_EXPORT cmark_node_type cmark_node_get_type(cmark_node *node); +CMARK_GFM_EXPORT cmark_node_type cmark_node_get_type(cmark_node *node); /** Like 'cmark_node_get_type', but returns a string representation of the type, or `""`. */ -CMARK_EXPORT +CMARK_GFM_EXPORT const char *cmark_node_get_type_string(cmark_node *node); /** Returns the string contents of 'node', or an empty string if none is set. Returns NULL if called on a node that does not have string content. */ -CMARK_EXPORT const char *cmark_node_get_literal(cmark_node *node); +CMARK_GFM_EXPORT const char *cmark_node_get_literal(cmark_node *node); /** Sets the string contents of 'node'. Returns 1 on success, * 0 on failure. */ -CMARK_EXPORT int cmark_node_set_literal(cmark_node *node, const char *content); +CMARK_GFM_EXPORT int cmark_node_set_literal(cmark_node *node, const char *content); /** Returns the heading level of 'node', or 0 if 'node' is not a heading. */ -CMARK_EXPORT int cmark_node_get_heading_level(cmark_node *node); +CMARK_GFM_EXPORT int cmark_node_get_heading_level(cmark_node *node); /* For backwards compatibility */ #define cmark_node_get_header_level cmark_node_get_heading_level @@ -285,117 +373,137 @@ CMARK_EXPORT int cmark_node_get_heading_level(cmark_node *node); /** Sets the heading level of 'node', returning 1 on success and 0 on error. */ -CMARK_EXPORT int cmark_node_set_heading_level(cmark_node *node, int level); +CMARK_GFM_EXPORT int cmark_node_set_heading_level(cmark_node *node, int level); /** Returns the list type of 'node', or `CMARK_NO_LIST` if 'node' * is not a list. */ -CMARK_EXPORT cmark_list_type cmark_node_get_list_type(cmark_node *node); +CMARK_GFM_EXPORT cmark_list_type cmark_node_get_list_type(cmark_node *node); /** Sets the list type of 'node', returning 1 on success and 0 on error. */ -CMARK_EXPORT int cmark_node_set_list_type(cmark_node *node, +CMARK_GFM_EXPORT int cmark_node_set_list_type(cmark_node *node, cmark_list_type type); /** Returns the list delimiter type of 'node', or `CMARK_NO_DELIM` if 'node' * is not a list. */ -CMARK_EXPORT cmark_delim_type cmark_node_get_list_delim(cmark_node *node); +CMARK_GFM_EXPORT cmark_delim_type cmark_node_get_list_delim(cmark_node *node); /** Sets the list delimiter type of 'node', returning 1 on success and 0 * on error. */ -CMARK_EXPORT int cmark_node_set_list_delim(cmark_node *node, +CMARK_GFM_EXPORT int cmark_node_set_list_delim(cmark_node *node, cmark_delim_type delim); /** Returns starting number of 'node', if it is an ordered list, otherwise 0. */ -CMARK_EXPORT int cmark_node_get_list_start(cmark_node *node); +CMARK_GFM_EXPORT int cmark_node_get_list_start(cmark_node *node); /** Sets starting number of 'node', if it is an ordered list. Returns 1 * on success, 0 on failure. */ -CMARK_EXPORT int cmark_node_set_list_start(cmark_node *node, int start); +CMARK_GFM_EXPORT int cmark_node_set_list_start(cmark_node *node, int start); /** Returns 1 if 'node' is a tight list, 0 otherwise. */ -CMARK_EXPORT int cmark_node_get_list_tight(cmark_node *node); +CMARK_GFM_EXPORT int cmark_node_get_list_tight(cmark_node *node); /** Sets the "tightness" of a list. Returns 1 on success, 0 on failure. */ -CMARK_EXPORT int cmark_node_set_list_tight(cmark_node *node, int tight); +CMARK_GFM_EXPORT int cmark_node_set_list_tight(cmark_node *node, int tight); + +/** + * Returns item index of 'node'. This is only used when rendering output + * formats such as commonmark, which need to output the index. It is not + * required for formats such as html or latex. + */ +CMARK_GFM_EXPORT int cmark_node_get_item_index(cmark_node *node); + +/** Sets item index of 'node'. Returns 1 on success, 0 on failure. + */ +CMARK_GFM_EXPORT int cmark_node_set_item_index(cmark_node *node, int idx); /** Returns the info string from a fenced code block. */ -CMARK_EXPORT const char *cmark_node_get_fence_info(cmark_node *node); +CMARK_GFM_EXPORT const char *cmark_node_get_fence_info(cmark_node *node); /** Sets the info string in a fenced code block, returning 1 on * success and 0 on failure. */ -CMARK_EXPORT int cmark_node_set_fence_info(cmark_node *node, const char *info); +CMARK_GFM_EXPORT int cmark_node_set_fence_info(cmark_node *node, const char *info); + +/** Sets code blocks fencing details + */ +CMARK_GFM_EXPORT int cmark_node_set_fenced(cmark_node * node, int fenced, + int length, int offset, char character); + +/** Returns code blocks fencing details + */ +CMARK_GFM_EXPORT int cmark_node_get_fenced(cmark_node *node, int *length, int *offset, char *character); /** Returns the URL of a link or image 'node', or an empty string if no URL is set. Returns NULL if called on a node that is not a link or image. */ -CMARK_EXPORT const char *cmark_node_get_url(cmark_node *node); +CMARK_GFM_EXPORT const char *cmark_node_get_url(cmark_node *node); /** Sets the URL of a link or image 'node'. Returns 1 on success, * 0 on failure. */ -CMARK_EXPORT int cmark_node_set_url(cmark_node *node, const char *url); +CMARK_GFM_EXPORT int cmark_node_set_url(cmark_node *node, const char *url); /** Returns the title of a link or image 'node', or an empty string if no title is set. Returns NULL if called on a node that is not a link or image. */ -CMARK_EXPORT const char *cmark_node_get_title(cmark_node *node); +CMARK_GFM_EXPORT const char *cmark_node_get_title(cmark_node *node); /** Sets the title of a link or image 'node'. Returns 1 on success, * 0 on failure. */ -CMARK_EXPORT int cmark_node_set_title(cmark_node *node, const char *title); +CMARK_GFM_EXPORT int cmark_node_set_title(cmark_node *node, const char *title); /** Returns the literal "on enter" text for a custom 'node', or an empty string if no on_enter is set. Returns NULL if called on a non-custom node. */ -CMARK_EXPORT const char *cmark_node_get_on_enter(cmark_node *node); +CMARK_GFM_EXPORT const char *cmark_node_get_on_enter(cmark_node *node); /** Sets the literal text to render "on enter" for a custom 'node'. Any children of the node will be rendered after this text. Returns 1 on success 0 on failure. */ -CMARK_EXPORT int cmark_node_set_on_enter(cmark_node *node, +CMARK_GFM_EXPORT int cmark_node_set_on_enter(cmark_node *node, const char *on_enter); /** Returns the literal "on exit" text for a custom 'node', or an empty string if no on_exit is set. Returns NULL if called on a non-custom node. */ -CMARK_EXPORT const char *cmark_node_get_on_exit(cmark_node *node); +CMARK_GFM_EXPORT const char *cmark_node_get_on_exit(cmark_node *node); /** Sets the literal text to render "on exit" for a custom 'node'. Any children of the node will be rendered before this text. Returns 1 on success 0 on failure. */ -CMARK_EXPORT int cmark_node_set_on_exit(cmark_node *node, const char *on_exit); +CMARK_GFM_EXPORT int cmark_node_set_on_exit(cmark_node *node, const char *on_exit); /** Returns the line on which 'node' begins. */ -CMARK_EXPORT int cmark_node_get_start_line(cmark_node *node); +CMARK_GFM_EXPORT int cmark_node_get_start_line(cmark_node *node); /** Returns the column at which 'node' begins. */ -CMARK_EXPORT int cmark_node_get_start_column(cmark_node *node); +CMARK_GFM_EXPORT int cmark_node_get_start_column(cmark_node *node); /** Returns the line on which 'node' ends. */ -CMARK_EXPORT int cmark_node_get_end_line(cmark_node *node); +CMARK_GFM_EXPORT int cmark_node_get_end_line(cmark_node *node); /** Returns the column at which 'node' ends. */ -CMARK_EXPORT int cmark_node_get_end_column(cmark_node *node); +CMARK_GFM_EXPORT int cmark_node_get_end_column(cmark_node *node); /** * ## Tree Manipulation @@ -404,36 +512,40 @@ CMARK_EXPORT int cmark_node_get_end_column(cmark_node *node); /** Unlinks a 'node', removing it from the tree, but not freeing its * memory. (Use 'cmark_node_free' for that.) */ -CMARK_EXPORT void cmark_node_unlink(cmark_node *node); +CMARK_GFM_EXPORT void cmark_node_unlink(cmark_node *node); /** Inserts 'sibling' before 'node'. Returns 1 on success, 0 on failure. */ -CMARK_EXPORT int cmark_node_insert_before(cmark_node *node, +CMARK_GFM_EXPORT int cmark_node_insert_before(cmark_node *node, cmark_node *sibling); /** Inserts 'sibling' after 'node'. Returns 1 on success, 0 on failure. */ -CMARK_EXPORT int cmark_node_insert_after(cmark_node *node, cmark_node *sibling); +CMARK_GFM_EXPORT int cmark_node_insert_after(cmark_node *node, cmark_node *sibling); /** Replaces 'oldnode' with 'newnode' and unlinks 'oldnode' (but does * not free its memory). * Returns 1 on success, 0 on failure. */ -CMARK_EXPORT int cmark_node_replace(cmark_node *oldnode, cmark_node *newnode); +CMARK_GFM_EXPORT int cmark_node_replace(cmark_node *oldnode, cmark_node *newnode); /** Adds 'child' to the beginning of the children of 'node'. * Returns 1 on success, 0 on failure. */ -CMARK_EXPORT int cmark_node_prepend_child(cmark_node *node, cmark_node *child); +CMARK_GFM_EXPORT int cmark_node_prepend_child(cmark_node *node, cmark_node *child); /** Adds 'child' to the end of the children of 'node'. * Returns 1 on success, 0 on failure. */ -CMARK_EXPORT int cmark_node_append_child(cmark_node *node, cmark_node *child); +CMARK_GFM_EXPORT int cmark_node_append_child(cmark_node *node, cmark_node *child); /** Consolidates adjacent text nodes. */ -CMARK_EXPORT void cmark_consolidate_text_nodes(cmark_node *root); +CMARK_GFM_EXPORT void cmark_consolidate_text_nodes(cmark_node *root); + +/** Ensures a node and all its children own their own chunk memory. + */ +CMARK_GFM_EXPORT void cmark_node_own(cmark_node *root); /** * ## Parsing @@ -459,27 +571,27 @@ CMARK_EXPORT void cmark_consolidate_text_nodes(cmark_node *root); /** Creates a new parser object. */ -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_parser *cmark_parser_new(int options); /** Creates a new parser object with the given memory allocator */ -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_parser *cmark_parser_new_with_mem(int options, cmark_mem *mem); /** Frees memory allocated for a parser object. */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_parser_free(cmark_parser *parser); /** Feeds a string of length 'len' to 'parser'. */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_parser_feed(cmark_parser *parser, const char *buffer, size_t len); /** Finish parsing and return a pointer to a tree of nodes. */ -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_node *cmark_parser_finish(cmark_parser *parser); /** Parse a CommonMark document in 'buffer' of length 'len'. @@ -487,14 +599,14 @@ cmark_node *cmark_parser_finish(cmark_parser *parser); * the node tree should be released using 'cmark_node_free' * when it is no longer needed. */ -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_node *cmark_parse_document(const char *buffer, size_t len, int options); /** Parse a CommonMark document in file 'f', returning a pointer to * a tree of nodes. The memory allocated for the node tree should be * released using 'cmark_node_free' when it is no longer needed. */ -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_node *cmark_parse_file(FILE *f, int options); /** @@ -504,34 +616,76 @@ cmark_node *cmark_parse_file(FILE *f, int options); /** Render a 'node' tree as XML. It is the caller's responsibility * to free the returned buffer. */ -CMARK_EXPORT +CMARK_GFM_EXPORT char *cmark_render_xml(cmark_node *root, int options); +/** As for 'cmark_render_xml', but specifying the allocator to use for + * the resulting string. + */ +CMARK_GFM_EXPORT +char *cmark_render_xml_with_mem(cmark_node *root, int options, cmark_mem *mem); + /** Render a 'node' tree as an HTML fragment. It is up to the user * to add an appropriate header and footer. It is the caller's * responsibility to free the returned buffer. */ -CMARK_EXPORT -char *cmark_render_html(cmark_node *root, int options); +CMARK_GFM_EXPORT +char *cmark_render_html(cmark_node *root, int options, cmark_llist *extensions); + +/** As for 'cmark_render_html', but specifying the allocator to use for + * the resulting string. + */ +CMARK_GFM_EXPORT +char *cmark_render_html_with_mem(cmark_node *root, int options, cmark_llist *extensions, cmark_mem *mem); /** Render a 'node' tree as a groff man page, without the header. * It is the caller's responsibility to free the returned buffer. */ -CMARK_EXPORT +CMARK_GFM_EXPORT char *cmark_render_man(cmark_node *root, int options, int width); +/** As for 'cmark_render_man', but specifying the allocator to use for + * the resulting string. + */ +CMARK_GFM_EXPORT +char *cmark_render_man_with_mem(cmark_node *root, int options, int width, cmark_mem *mem); + /** Render a 'node' tree as a commonmark document. * It is the caller's responsibility to free the returned buffer. */ -CMARK_EXPORT +CMARK_GFM_EXPORT char *cmark_render_commonmark(cmark_node *root, int options, int width); +/** As for 'cmark_render_commonmark', but specifying the allocator to use for + * the resulting string. + */ +CMARK_GFM_EXPORT +char *cmark_render_commonmark_with_mem(cmark_node *root, int options, int width, cmark_mem *mem); + +/** Render a 'node' tree as a plain text document. + * It is the caller's responsibility to free the returned buffer. + */ +CMARK_GFM_EXPORT +char *cmark_render_plaintext(cmark_node *root, int options, int width); + +/** As for 'cmark_render_plaintext', but specifying the allocator to use for + * the resulting string. + */ +CMARK_GFM_EXPORT +char *cmark_render_plaintext_with_mem(cmark_node *root, int options, int width, cmark_mem *mem); + /** Render a 'node' tree as a LaTeX document. * It is the caller's responsibility to free the returned buffer. */ -CMARK_EXPORT +CMARK_GFM_EXPORT char *cmark_render_latex(cmark_node *root, int options, int width); +/** As for 'cmark_render_latex', but specifying the allocator to use for + * the resulting string. + */ +CMARK_GFM_EXPORT +char *cmark_render_latex_with_mem(cmark_node *root, int options, int width, cmark_mem *mem); + /** * ## Options */ @@ -587,6 +741,33 @@ char *cmark_render_latex(cmark_node *root, int options, int width); */ #define CMARK_OPT_SMART (1 << 10) +/** Use GitHub-style
 tags for code blocks instead of 
.
+ */
+#define CMARK_OPT_GITHUB_PRE_LANG (1 << 11)
+
+/** Be liberal in interpreting inline HTML tags.
+ */
+#define CMARK_OPT_LIBERAL_HTML_TAG (1 << 12)
+
+/** Parse footnotes.
+ */
+#define CMARK_OPT_FOOTNOTES (1 << 13)
+
+/** Only parse strikethroughs if surrounded by exactly 2 tildes.
+ * Gives some compatibility with redcarpet.
+ */
+#define CMARK_OPT_STRIKETHROUGH_DOUBLE_TILDE (1 << 14)
+
+/** Use style attributes to align table cells instead of align attributes.
+ */
+#define CMARK_OPT_TABLE_PREFER_STYLE_ATTRIBUTES (1 << 15)
+
+/** Include the remainder of the info string in code blocks in
+ * a separate attribute.
+ */
+#define CMARK_OPT_FULL_INFO_STRING (1 << 16)
+
 /**
  * ## Version information
  */
@@ -600,13 +781,13 @@ char *cmark_render_latex(cmark_node *root, int options, int width);
  *
  * In hexadecimal format, the number 0x010203 represents version 1.2.3.
  */
-CMARK_EXPORT
+CMARK_GFM_EXPORT
 int cmark_version(void);
 
 /** The library version string for runtime checks. Also available as
  * macro CMARK_VERSION_STRING for compile time checks.
  */
-CMARK_EXPORT
+CMARK_GFM_EXPORT
 const char *cmark_version_string(void);
 
 /** # AUTHORS
@@ -643,6 +824,8 @@ const char *cmark_version_string(void);
 #define PAREN_DELIM CMARK_PAREN_DELIM
 #endif
 
+typedef int32_t bufsize_t;
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/liteidex/src/3rdparty/cmark/src/cmark.c b/liteidex/src/3rdparty/cmark/src/cmark.c
old mode 100755
new mode 100644
index d64237f24..68c40c477
--- a/liteidex/src/3rdparty/cmark/src/cmark.c
+++ b/liteidex/src/3rdparty/cmark/src/cmark.c
@@ -1,14 +1,18 @@
 #include 
 #include 
 #include 
+#include "registry.h"
 #include "node.h"
 #include "houdini.h"
-#include "cmark.h"
+#include "cmark-gfm.h"
 #include "buffer.h"
 
-int cmark_version() { return CMARK_VERSION; }
+cmark_node_type CMARK_NODE_LAST_BLOCK = CMARK_NODE_FOOTNOTE_DEFINITION;
+cmark_node_type CMARK_NODE_LAST_INLINE = CMARK_NODE_FOOTNOTE_REFERENCE;
 
-const char *cmark_version_string() { return CMARK_VERSION_STRING; }
+int cmark_version(void) { return CMARK_GFM_VERSION; }
+
+const char *cmark_version_string(void) { return CMARK_GFM_VERSION_STRING; }
 
 static void *xcalloc(size_t nmem, size_t size) {
   void *ptr = calloc(nmem, size);
@@ -28,7 +32,15 @@ static void *xrealloc(void *ptr, size_t size) {
   return new_ptr;
 }
 
-cmark_mem DEFAULT_MEM_ALLOCATOR = {xcalloc, xrealloc, free};
+static void xfree(void *ptr) {
+  free(ptr);
+}
+
+cmark_mem CMARK_DEFAULT_MEM_ALLOCATOR = {xcalloc, xrealloc, xfree};
+
+cmark_mem *cmark_get_default_mem_allocator(void) {
+  return &CMARK_DEFAULT_MEM_ALLOCATOR;
+}
 
 char *cmark_markdown_to_html(const char *text, size_t len, int options) {
   cmark_node *doc;
@@ -36,7 +48,7 @@ char *cmark_markdown_to_html(const char *text, size_t len, int options) {
 
   doc = cmark_parse_document(text, len, options);
 
-  result = cmark_render_html(doc, options);
+  result = cmark_render_html(doc, options, NULL);
   cmark_node_free(doc);
 
   return result;
diff --git a/liteidex/src/3rdparty/cmark/src/cmark_ctype.c b/liteidex/src/3rdparty/cmark/src/cmark_ctype.c
old mode 100755
new mode 100644
diff --git a/liteidex/src/3rdparty/cmark/src/cmark_ctype.h b/liteidex/src/3rdparty/cmark/src/cmark_ctype.h
old mode 100755
new mode 100644
index 9a0761851..67c1cb037
--- a/liteidex/src/3rdparty/cmark/src/cmark_ctype.h
+++ b/liteidex/src/3rdparty/cmark/src/cmark_ctype.h
@@ -5,18 +5,25 @@
 extern "C" {
 #endif
 
+#include "cmark-gfm_export.h"
+
 /** Locale-independent versions of functions from ctype.h.
  * We want cmark to behave the same no matter what the system locale.
  */
 
+CMARK_GFM_EXPORT
 int cmark_isspace(char c);
 
+CMARK_GFM_EXPORT
 int cmark_ispunct(char c);
 
+CMARK_GFM_EXPORT
 int cmark_isalnum(char c);
 
+CMARK_GFM_EXPORT
 int cmark_isdigit(char c);
 
+CMARK_GFM_EXPORT
 int cmark_isalpha(char c);
 
 #ifdef __cplusplus
diff --git a/liteidex/src/3rdparty/cmark/src/cmark_version.h.in b/liteidex/src/3rdparty/cmark/src/cmark_version.h.in
deleted file mode 100755
index 41de3ac67..000000000
--- a/liteidex/src/3rdparty/cmark/src/cmark_version.h.in
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef CMARK_VERSION_H
-#define CMARK_VERSION_H
-
-#define CMARK_VERSION ((@PROJECT_VERSION_MAJOR@ << 16) | (@PROJECT_VERSION_MINOR@ << 8)  | @PROJECT_VERSION_PATCH@)
-#define CMARK_VERSION_STRING "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@"
-
-#endif
diff --git a/liteidex/src/3rdparty/cmark/src/commonmark.c b/liteidex/src/3rdparty/cmark/src/commonmark.c
old mode 100755
new mode 100644
index 404c2903c..987b47318
--- a/liteidex/src/3rdparty/cmark/src/commonmark.c
+++ b/liteidex/src/3rdparty/cmark/src/commonmark.c
@@ -5,15 +5,16 @@
 #include 
 
 #include "config.h"
-#include "cmark.h"
+#include "cmark-gfm.h"
 #include "node.h"
 #include "buffer.h"
 #include "utf8.h"
 #include "scanners.h"
 #include "render.h"
+#include "syntax_extension.h"
 
-#define OUT(s, wrap, escaping) renderer->out(renderer, s, wrap, escaping)
-#define LIT(s) renderer->out(renderer, s, false, LITERAL)
+#define OUT(s, wrap, escaping) renderer->out(renderer, node, s, wrap, escaping)
+#define LIT(s) renderer->out(renderer, node, s, false, LITERAL)
 #define CR() renderer->cr(renderer)
 #define BLANKLINE() renderer->blankline(renderer)
 #define ENCODED_SIZE 20
@@ -21,7 +22,8 @@
 
 // Functions to convert cmark_nodes to commonmark strings.
 
-static CMARK_INLINE void outc(cmark_renderer *renderer, cmark_escaping escape,
+static CMARK_INLINE void outc(cmark_renderer *renderer, cmark_node *node, 
+                              cmark_escaping escape,
                               int32_t c, unsigned char nextc) {
   bool needs_escaping = false;
   bool follows_digit =
@@ -34,7 +36,7 @@ static CMARK_INLINE void outc(cmark_renderer *renderer, cmark_escaping escape,
       ((escape == NORMAL &&
         (c < 0x20 ||
 	 c == '*' || c == '_' || c == '[' || c == ']' || c == '#' || c == '<' ||
-         c == '>' || c == '\\' || c == '`' || c == '!' ||
+         c == '>' || c == '\\' || c == '`' || c == '~' || c == '!' ||
          (c == '&' && cmark_isalpha(nextc)) || (c == '!' && nextc == '[') ||
          (renderer->begin_content && (c == '-' || c == '+' || c == '=') &&
           // begin_content doesn't get set to false til we've passed digits
@@ -43,24 +45,24 @@ static CMARK_INLINE void outc(cmark_renderer *renderer, cmark_escaping escape,
          (renderer->begin_content && (c == '.' || c == ')') && follows_digit &&
           (nextc == 0 || cmark_isspace(nextc))))) ||
        (escape == URL &&
-        (c == '`' || c == '<' || c == '>' || cmark_isspace(c) || c == '\\' ||
+        (c == '`' || c == '<' || c == '>' || cmark_isspace((char)c) || c == '\\' ||
          c == ')' || c == '(')) ||
        (escape == TITLE &&
         (c == '`' || c == '<' || c == '>' || c == '"' || c == '\\')));
 
   if (needs_escaping) {
-    if (escape == URL && cmark_isspace(c)) {
+    if (escape == URL && cmark_isspace((char)c)) {
       // use percent encoding for spaces
       snprintf(encoded, ENCODED_SIZE, "%%%2X", c);
       cmark_strbuf_puts(renderer->buffer, encoded);
       renderer->column += 3;
-    } else if (cmark_ispunct(c)) {
+    } else if (cmark_ispunct((char)c)) {
       cmark_render_ascii(renderer, "\\");
       cmark_render_code_point(renderer, c);
     } else { // render as entity
       snprintf(encoded, ENCODED_SIZE, "&#%d;", c);
       cmark_strbuf_puts(renderer->buffer, encoded);
-      renderer->column += strlen(encoded);
+      renderer->column += (int)strlen(encoded);
     }
   } else {
     cmark_render_code_point(renderer, c);
@@ -151,24 +153,8 @@ static bool is_autolink(cmark_node *node) {
                   link_text->as.literal.len) == 0);
 }
 
-// if node is a block node, returns node.
-// otherwise returns first block-level node that is an ancestor of node.
-// if there is no block-level ancestor, returns NULL.
-static cmark_node *get_containing_block(cmark_node *node) {
-  while (node) {
-    if (node->type >= CMARK_NODE_FIRST_BLOCK &&
-        node->type <= CMARK_NODE_LAST_BLOCK) {
-      return node;
-    } else {
-      node = node->parent;
-    }
-  }
-  return NULL;
-}
-
 static int S_render_node(cmark_renderer *renderer, cmark_node *node,
                          cmark_event_type ev_type, int options) {
-  cmark_node *tmp;
   int list_number;
   cmark_delim_type list_delim;
   int numticks;
@@ -179,7 +165,7 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
   char fencechar[2] = {'\0', '\0'};
   size_t info_len, code_len;
   char listmarker[LISTMARKER_SIZE];
-  char *emph_delim;
+  const char *emph_delim;
   bool first_in_list_item;
   bufsize_t marker_width;
   bool allow_wrap = renderer->width > 0 && !(CMARK_OPT_NOBREAKS & options) &&
@@ -188,14 +174,22 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
   // Don't adjust tight list status til we've started the list.
   // Otherwise we loose the blank line between a paragraph and
   // a following list.
-  if (!(node->type == CMARK_NODE_ITEM && node->prev == NULL && entering)) {
-    tmp = get_containing_block(node);
-    renderer->in_tight_list_item =
-        tmp && // tmp might be NULL if there is no containing block
-        ((tmp->type == CMARK_NODE_ITEM &&
-          cmark_node_get_list_tight(tmp->parent)) ||
-         (tmp && tmp->parent && tmp->parent->type == CMARK_NODE_ITEM &&
-          cmark_node_get_list_tight(tmp->parent->parent)));
+  if (entering) {
+    if (node->parent && node->parent->type == CMARK_NODE_ITEM) {
+      renderer->in_tight_list_item = node->parent->parent->as.list.tight;
+    }
+  } else {
+    if (node->type == CMARK_NODE_LIST) {
+      renderer->in_tight_list_item =
+        node->parent &&
+        node->parent->type == CMARK_NODE_ITEM &&
+        node->parent->parent->as.list.tight;
+    }
+  }
+
+  if (node->extension && node->extension->commonmark_render_func) {
+    node->extension->commonmark_render_func(node->extension, renderer, node, ev_type, options);
+    return 1;
   }
 
   switch (node->type) {
@@ -228,20 +222,15 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
     if (cmark_node_get_list_type(node->parent) == CMARK_BULLET_LIST) {
       marker_width = 4;
     } else {
-      list_number = cmark_node_get_list_start(node->parent);
+      list_number = cmark_node_get_item_index(node);
       list_delim = cmark_node_get_list_delim(node->parent);
-      tmp = node;
-      while (tmp->prev) {
-        tmp = tmp->prev;
-        list_number += 1;
-      }
       // we ensure a width of at least 4 so
       // we get nice transition from single digits
       // to double
       snprintf(listmarker, LISTMARKER_SIZE, "%d%s%s", list_number,
                list_delim == CMARK_PAREN_DELIM ? ")" : ".",
                list_number < 10 ? "  " : " ");
-      marker_width = strlen(listmarker);
+      marker_width = (bufsize_t)strlen(listmarker);
     }
     if (entering) {
       if (cmark_node_get_list_type(node->parent) == CMARK_BULLET_LIST) {
@@ -399,10 +388,12 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
     break;
 
   case CMARK_NODE_STRONG:
-    if (entering) {
-      LIT("**");
-    } else {
-      LIT("**");
+    if (node->parent == NULL || node->parent->type != CMARK_NODE_STRONG) {
+      if (entering) {
+        LIT("**");
+      } else {
+        LIT("**");
+      }
     }
     break;
 
@@ -468,6 +459,39 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
     }
     break;
 
+  case CMARK_NODE_FOOTNOTE_REFERENCE:
+    if (entering) {
+      LIT("[^");
+
+      char *footnote_label = renderer->mem->calloc(node->parent_footnote_def->as.literal.len + 1, sizeof(char));
+      memmove(footnote_label, node->parent_footnote_def->as.literal.data, node->parent_footnote_def->as.literal.len);
+
+      OUT(footnote_label, false, LITERAL);
+      renderer->mem->free(footnote_label);
+
+      LIT("]");
+    }
+    break;
+
+  case CMARK_NODE_FOOTNOTE_DEFINITION:
+    if (entering) {
+      renderer->footnote_ix += 1;
+      LIT("[^");
+
+      char *footnote_label = renderer->mem->calloc(node->as.literal.len + 1, sizeof(char));
+      memmove(footnote_label, node->as.literal.data, node->as.literal.len);
+
+      OUT(footnote_label, false, LITERAL);
+      renderer->mem->free(footnote_label);
+
+      LIT("]:\n");
+
+      cmark_strbuf_puts(renderer->prefix, "    ");
+    } else {
+      cmark_strbuf_truncate(renderer->prefix, renderer->prefix->size - 4);
+    }
+    break;
+
   default:
     assert(false);
     break;
@@ -477,10 +501,14 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
 }
 
 char *cmark_render_commonmark(cmark_node *root, int options, int width) {
+  return cmark_render_commonmark_with_mem(root, options, width, cmark_node_mem(root));
+}
+
+char *cmark_render_commonmark_with_mem(cmark_node *root, int options, int width, cmark_mem *mem) {
   if (options & CMARK_OPT_HARDBREAKS) {
     // disable breaking on width, since it has
     // a different meaning with OPT_HARDBREAKS
     width = 0;
   }
-  return cmark_render(root, options, width, outc, S_render_node);
+  return cmark_render(mem, root, options, width, outc, S_render_node);
 }
diff --git a/liteidex/src/3rdparty/cmark/src/config.h.in b/liteidex/src/3rdparty/cmark/src/config.h.in
deleted file mode 100755
index de1a4dd49..000000000
--- a/liteidex/src/3rdparty/cmark/src/config.h.in
+++ /dev/null
@@ -1,76 +0,0 @@
-#ifndef CMARK_CONFIG_H
-#define CMARK_CONFIG_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#cmakedefine HAVE_STDBOOL_H
-
-#ifdef HAVE_STDBOOL_H
-  #include 
-#elif !defined(__cplusplus)
-  typedef char bool;
-#endif
-
-#cmakedefine HAVE___BUILTIN_EXPECT
-
-#cmakedefine HAVE___ATTRIBUTE__
-
-#ifdef HAVE___ATTRIBUTE__
-  #define CMARK_ATTRIBUTE(list) __attribute__ (list)
-#else
-  #define CMARK_ATTRIBUTE(list)
-#endif
-
-#ifndef CMARK_INLINE
-  #if defined(_MSC_VER) && !defined(__cplusplus)
-    #define CMARK_INLINE __inline
-  #else
-    #define CMARK_INLINE inline
-  #endif
-#endif
-
-/* snprintf and vsnprintf fallbacks for MSVC before 2015,
-   due to Valentin Milea http://stackoverflow.com/questions/2915672/
-*/
-
-#if defined(_MSC_VER) && _MSC_VER < 1900
-
-#include 
-#include 
-
-#define snprintf c99_snprintf
-#define vsnprintf c99_vsnprintf
-
-CMARK_INLINE int c99_vsnprintf(char *outBuf, size_t size, const char *format, va_list ap)
-{
-    int count = -1;
-
-    if (size != 0)
-        count = _vsnprintf_s(outBuf, size, _TRUNCATE, format, ap);
-    if (count == -1)
-        count = _vscprintf(format, ap);
-
-    return count;
-}
-
-CMARK_INLINE int c99_snprintf(char *outBuf, size_t size, const char *format, ...)
-{
-    int count;
-    va_list ap;
-
-    va_start(ap, format);
-    count = c99_vsnprintf(outBuf, size, format, ap);
-    va_end(ap);
-
-    return count;
-}
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/liteidex/src/3rdparty/cmark/src/entities.inc b/liteidex/src/3rdparty/cmark/src/entities.inc
old mode 100755
new mode 100644
diff --git a/liteidex/src/3rdparty/cmark/src/footnotes.c b/liteidex/src/3rdparty/cmark/src/footnotes.c
new file mode 100644
index 000000000..c2b745f79
--- /dev/null
+++ b/liteidex/src/3rdparty/cmark/src/footnotes.c
@@ -0,0 +1,63 @@
+#include "cmark-gfm.h"
+#include "parser.h"
+#include "footnotes.h"
+#include "inlines.h"
+#include "chunk.h"
+
+static void footnote_free(cmark_map *map, cmark_map_entry *_ref) {
+  cmark_footnote *ref = (cmark_footnote *)_ref;
+  cmark_mem *mem = map->mem;
+  if (ref != NULL) {
+    mem->free(ref->entry.label);
+    if (ref->node)
+      cmark_node_free(ref->node);
+    mem->free(ref);
+  }
+}
+
+void cmark_footnote_create(cmark_map *map, cmark_node *node) {
+  cmark_footnote *ref;
+  unsigned char *reflabel = normalize_map_label(map->mem, &node->as.literal);
+
+  /* empty footnote name, or composed from only whitespace */
+  if (reflabel == NULL)
+    return;
+
+  assert(map->sorted == NULL);
+
+  ref = (cmark_footnote *)map->mem->calloc(1, sizeof(*ref));
+  ref->entry.label = reflabel;
+  ref->node = node;
+  ref->entry.age = map->size;
+  ref->entry.next = map->refs;
+
+  map->refs = (cmark_map_entry *)ref;
+  map->size++;
+}
+
+cmark_map *cmark_footnote_map_new(cmark_mem *mem) {
+  return cmark_map_new(mem, footnote_free);
+}
+
+// Before calling `cmark_map_free` on a map with `cmark_footnotes`, first
+// unlink all of the footnote nodes before freeing their memory.
+//
+// Sometimes, two (unused) footnote nodes can end up referencing each other,
+// which as they get freed up by calling `cmark_map_free` -> `footnote_free` ->
+// etc, can lead to a use-after-free error.
+//
+// Better to `unlink` every footnote node first, setting their next, prev, and
+// parent pointers to NULL, and only then walk thru & free them up.
+void cmark_unlink_footnotes_map(cmark_map *map) {
+  cmark_map_entry *ref;
+  cmark_map_entry *next;
+
+  ref = map->refs;
+  while(ref) {
+    next = ref->next;
+    if (((cmark_footnote *)ref)->node) {
+      cmark_node_unlink(((cmark_footnote *)ref)->node);
+    }
+    ref = next;
+  }
+}
diff --git a/liteidex/src/3rdparty/cmark/src/footnotes.h b/liteidex/src/3rdparty/cmark/src/footnotes.h
new file mode 100644
index 000000000..64e2901e3
--- /dev/null
+++ b/liteidex/src/3rdparty/cmark/src/footnotes.h
@@ -0,0 +1,27 @@
+#ifndef CMARK_FOOTNOTES_H
+#define CMARK_FOOTNOTES_H
+
+#include "map.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct cmark_footnote {
+  cmark_map_entry entry;
+  cmark_node *node;
+  unsigned int ix;
+};
+
+typedef struct cmark_footnote cmark_footnote;
+
+void cmark_footnote_create(cmark_map *map, cmark_node *node);
+cmark_map *cmark_footnote_map_new(cmark_mem *mem);
+
+void cmark_unlink_footnotes_map(cmark_map *map);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/liteidex/src/3rdparty/cmark/src/houdini.h b/liteidex/src/3rdparty/cmark/src/houdini.h
old mode 100755
new mode 100644
index f738e8243..7625b045b
--- a/liteidex/src/3rdparty/cmark/src/houdini.h
+++ b/liteidex/src/3rdparty/cmark/src/houdini.h
@@ -31,17 +31,23 @@ extern "C" {
 #define HOUDINI_ESCAPED_SIZE(x) (((x)*12) / 10)
 #define HOUDINI_UNESCAPED_SIZE(x) (x)
 
-extern bufsize_t houdini_unescape_ent(cmark_strbuf *ob, const uint8_t *src,
+CMARK_GFM_EXPORT
+bufsize_t houdini_unescape_ent(cmark_strbuf *ob, const uint8_t *src,
                                       bufsize_t size);
-extern int houdini_escape_html(cmark_strbuf *ob, const uint8_t *src,
+CMARK_GFM_EXPORT
+int houdini_escape_html(cmark_strbuf *ob, const uint8_t *src,
                                bufsize_t size);
-extern int houdini_escape_html0(cmark_strbuf *ob, const uint8_t *src,
+CMARK_GFM_EXPORT
+int houdini_escape_html0(cmark_strbuf *ob, const uint8_t *src,
                                 bufsize_t size, int secure);
-extern int houdini_unescape_html(cmark_strbuf *ob, const uint8_t *src,
+CMARK_GFM_EXPORT
+int houdini_unescape_html(cmark_strbuf *ob, const uint8_t *src,
                                  bufsize_t size);
-extern void houdini_unescape_html_f(cmark_strbuf *ob, const uint8_t *src,
+CMARK_GFM_EXPORT
+void houdini_unescape_html_f(cmark_strbuf *ob, const uint8_t *src,
                                     bufsize_t size);
-extern int houdini_escape_href(cmark_strbuf *ob, const uint8_t *src,
+CMARK_GFM_EXPORT
+int houdini_escape_href(cmark_strbuf *ob, const uint8_t *src,
                                bufsize_t size);
 
 #ifdef __cplusplus
diff --git a/liteidex/src/3rdparty/cmark/src/houdini_href_e.c b/liteidex/src/3rdparty/cmark/src/houdini_href_e.c
old mode 100755
new mode 100644
index bfa970485..169389197
--- a/liteidex/src/3rdparty/cmark/src/houdini_href_e.c
+++ b/liteidex/src/3rdparty/cmark/src/houdini_href_e.c
@@ -7,7 +7,7 @@
 /*
  * The following characters will not be escaped:
  *
- *		-_.+!*'(),%#@?=;:/,+&$ alphanum
+ *		-_.+!*'(),%#@?=;:/,+&$~ alphanum
  *
  * Note that this character set is the addition of:
  *
@@ -35,7 +35,7 @@ static const char HREF_SAFE[] = {
     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,
     0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-    1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
diff --git a/liteidex/src/3rdparty/cmark/src/houdini_html_e.c b/liteidex/src/3rdparty/cmark/src/houdini_html_e.c
old mode 100755
new mode 100644
index 0e539f037..da0b15c53
--- a/liteidex/src/3rdparty/cmark/src/houdini_html_e.c
+++ b/liteidex/src/3rdparty/cmark/src/houdini_html_e.c
@@ -48,7 +48,7 @@ int houdini_escape_html0(cmark_strbuf *ob, const uint8_t *src, bufsize_t size,
     if (unlikely(i >= size))
       break;
 
-    /* The forward slash is only escaped in secure mode */
+    /* The forward slash and single quote are only escaped in secure mode */
     if ((src[i] == '/' || src[i] == '\'') && !secure) {
       cmark_strbuf_putc(ob, src[i]);
     } else {
diff --git a/liteidex/src/3rdparty/cmark/src/houdini_html_u.c b/liteidex/src/3rdparty/cmark/src/houdini_html_u.c
old mode 100755
new mode 100644
diff --git a/liteidex/src/3rdparty/cmark/src/html.c b/liteidex/src/3rdparty/cmark/src/html.c
old mode 100755
new mode 100644
index a13d016dc..22513c939
--- a/liteidex/src/3rdparty/cmark/src/html.c
+++ b/liteidex/src/3rdparty/cmark/src/html.c
@@ -4,13 +4,12 @@
 #include 
 #include "cmark_ctype.h"
 #include "config.h"
-#include "cmark.h"
-#include "node.h"
-#include "buffer.h"
+#include "cmark-gfm.h"
 #include "houdini.h"
 #include "scanners.h"
-
-#define BUFFER_SIZE 100
+#include "syntax_extension.h"
+#include "html.h"
+#include "render.h"
 
 // Functions to convert cmark_nodes to HTML strings.
 
@@ -19,44 +18,109 @@ static void escape_html(cmark_strbuf *dest, const unsigned char *source,
   houdini_escape_html0(dest, source, length, 0);
 }
 
-static CMARK_INLINE void cr(cmark_strbuf *html) {
-  if (html->size && html->ptr[html->size - 1] != '\n')
-    cmark_strbuf_putc(html, '\n');
-}
+static void filter_html_block(cmark_html_renderer *renderer, uint8_t *data, size_t len) {
+  cmark_strbuf *html = renderer->html;
+  cmark_llist *it;
+  cmark_syntax_extension *ext;
+  bool filtered;
+  uint8_t *match;
 
-struct render_state {
-  cmark_strbuf *html;
-  cmark_node *plain;
-};
+  while (len) {
+    match = (uint8_t *) memchr(data, '<', len);
+    if (!match)
+      break;
 
-static void S_render_sourcepos(cmark_node *node, cmark_strbuf *html,
-                               int options) {
-  char buffer[BUFFER_SIZE];
-  if (CMARK_OPT_SOURCEPOS & options) {
-    snprintf(buffer, BUFFER_SIZE, " data-sourcepos=\"%d:%d-%d:%d\"",
-             cmark_node_get_start_line(node), cmark_node_get_start_column(node),
-             cmark_node_get_end_line(node), cmark_node_get_end_column(node));
-    cmark_strbuf_puts(html, buffer);
+    if (match != data) {
+      cmark_strbuf_put(html, data, (bufsize_t)(match - data));
+      len -= (match - data);
+      data = match;
+    }
+
+    filtered = false;
+    for (it = renderer->filter_extensions; it; it = it->next) {
+      ext = ((cmark_syntax_extension *) it->data);
+      if (!ext->html_filter_func(ext, data, len)) {
+        filtered = true;
+        break;
+      }
+    }
+
+    if (!filtered) {
+      cmark_strbuf_putc(html, '<');
+    } else {
+      cmark_strbuf_puts(html, "<");
+    }
+
+    ++data;
+    --len;
+  }
+
+  if (len)
+    cmark_strbuf_put(html, data, (bufsize_t)len);
+}
+
+static bool S_put_footnote_backref(cmark_html_renderer *renderer, cmark_strbuf *html, cmark_node *node) {
+  if (renderer->written_footnote_ix >= renderer->footnote_ix)
+    return false;
+  renderer->written_footnote_ix = renderer->footnote_ix;
+  char m[32];
+  snprintf(m, sizeof(m), "%d", renderer->written_footnote_ix);
+
+  cmark_strbuf_puts(html, "as.literal.data, node->as.literal.len);
+  cmark_strbuf_puts(html, "\" class=\"footnote-backref\" data-footnote-backref data-footnote-backref-idx=\"");
+  cmark_strbuf_puts(html, m);
+  cmark_strbuf_puts(html, "\" aria-label=\"Back to reference ");
+  cmark_strbuf_puts(html, m);
+  cmark_strbuf_puts(html, "\">↩");
+
+  if (node->footnote.def_count > 1)
+  {
+    for(int i = 2; i <= node->footnote.def_count; i++) {
+      char n[32];
+      snprintf(n, sizeof(n), "%d", i);
+
+      cmark_strbuf_puts(html, " as.literal.data, node->as.literal.len);
+      cmark_strbuf_puts(html, "-");
+      cmark_strbuf_puts(html, n);
+      cmark_strbuf_puts(html, "\" class=\"footnote-backref\" data-footnote-backref data-footnote-backref-idx=\"");
+      cmark_strbuf_puts(html, m);
+      cmark_strbuf_puts(html, "-");
+      cmark_strbuf_puts(html, n);
+      cmark_strbuf_puts(html, "\" aria-label=\"Back to reference ");
+      cmark_strbuf_puts(html, m);
+      cmark_strbuf_puts(html, "-");
+      cmark_strbuf_puts(html, n);
+      cmark_strbuf_puts(html, "\">↩");
+      cmark_strbuf_puts(html, n);
+      cmark_strbuf_puts(html, "");
+    }
   }
+
+  return true;
 }
 
-static int S_render_node(cmark_node *node, cmark_event_type ev_type,
-                         struct render_state *state, int options) {
+static int S_render_node(cmark_html_renderer *renderer, cmark_node *node,
+                         cmark_event_type ev_type, int options) {
   cmark_node *parent;
   cmark_node *grandparent;
-  cmark_strbuf *html = state->html;
+  cmark_strbuf *html = renderer->html;
+  cmark_llist *it;
+  cmark_syntax_extension *ext;
   char start_heading[] = "plain == node) { // back at original node
-    state->plain = NULL;
+  if (renderer->plain == node) { // back at original node
+    renderer->plain = NULL;
   }
 
-  if (state->plain != NULL) {
+  if (renderer->plain != NULL) {
     switch (node->type) {
     case CMARK_NODE_TEXT:
     case CMARK_NODE_CODE:
@@ -75,18 +139,23 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type,
     return 1;
   }
 
+  if (node->extension && node->extension->html_render_func) {
+    node->extension->html_render_func(node->extension, renderer, node, ev_type, options);
+    return 1;
+  }
+
   switch (node->type) {
   case CMARK_NODE_DOCUMENT:
     break;
 
   case CMARK_NODE_BLOCK_QUOTE:
     if (entering) {
-      cr(html);
+      cmark_html_render_cr(html);
       cmark_strbuf_puts(html, "\n");
     } else {
-      cr(html);
+      cmark_html_render_cr(html);
       cmark_strbuf_puts(html, "\n");
     }
     break;
@@ -96,19 +165,19 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type,
     int start = node->as.list.start;
 
     if (entering) {
-      cr(html);
+      cmark_html_render_cr(html);
       if (list_type == CMARK_BULLET_LIST) {
         cmark_strbuf_puts(html, "\n");
       } else if (start == 1) {
         cmark_strbuf_puts(html, "\n");
       } else {
         snprintf(buffer, BUFFER_SIZE, "
    \n"); } } else { @@ -120,9 +189,9 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type, case CMARK_NODE_ITEM: if (entering) { - cr(html); + cmark_html_render_cr(html); cmark_strbuf_puts(html, "'); } else { cmark_strbuf_puts(html, "\n"); @@ -131,10 +200,10 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type, case CMARK_NODE_HEADING: if (entering) { - cr(html); + cmark_html_render_cr(html); start_heading[2] = (char)('0' + node->as.heading.level); cmark_strbuf_puts(html, start_heading); - S_render_sourcepos(node, html, options); + cmark_html_render_sourcepos(node, html, options); cmark_strbuf_putc(html, '>'); } else { end_heading[3] = (char)('0' + node->as.heading.level); @@ -144,11 +213,11 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type, break; case CMARK_NODE_CODE_BLOCK: - cr(html); + cmark_html_render_cr(html); if (node->as.code.info.len == 0) { cmark_strbuf_puts(html, ""); } else { bufsize_t first_tag = 0; @@ -157,11 +226,27 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type, first_tag += 1; } - cmark_strbuf_puts(html, "as.code.info.data, first_tag); - cmark_strbuf_puts(html, "\">"); + if (options & CMARK_OPT_GITHUB_PRE_LANG) { + cmark_strbuf_puts(html, "as.code.info.data, first_tag); + if (first_tag < node->as.code.info.len && (options & CMARK_OPT_FULL_INFO_STRING)) { + cmark_strbuf_puts(html, "\" data-meta=\""); + escape_html(html, node->as.code.info.data + first_tag + 1, node->as.code.info.len - first_tag - 1); + } + cmark_strbuf_puts(html, "\">"); + } else { + cmark_strbuf_puts(html, "as.code.info.data, first_tag); + if (first_tag < node->as.code.info.len && (options & CMARK_OPT_FULL_INFO_STRING)) { + cmark_strbuf_puts(html, "\" data-meta=\""); + escape_html(html, node->as.code.info.data + first_tag + 1, node->as.code.info.len - first_tag - 1); + } + cmark_strbuf_puts(html, "\">"); + } } escape_html(html, node->as.code.literal.data, node->as.code.literal.len); @@ -169,17 +254,19 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type, break; case CMARK_NODE_HTML_BLOCK: - cr(html); + cmark_html_render_cr(html); if (!(options & CMARK_OPT_UNSAFE)) { cmark_strbuf_puts(html, ""); + } else if (renderer->filter_extensions) { + filter_html_block(renderer, node->as.literal.data, node->as.literal.len); } else { cmark_strbuf_put(html, node->as.literal.data, node->as.literal.len); } - cr(html); + cmark_html_render_cr(html); break; case CMARK_NODE_CUSTOM_BLOCK: - cr(html); + cmark_html_render_cr(html); if (entering) { cmark_strbuf_put(html, node->as.custom.on_enter.data, node->as.custom.on_enter.len); @@ -187,13 +274,13 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type, cmark_strbuf_put(html, node->as.custom.on_exit.data, node->as.custom.on_exit.len); } - cr(html); + cmark_html_render_cr(html); break; case CMARK_NODE_THEMATIC_BREAK: - cr(html); + cmark_html_render_cr(html); cmark_strbuf_puts(html, "\n"); break; @@ -207,11 +294,15 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type, } if (!tight) { if (entering) { - cr(html); + cmark_html_render_cr(html); cmark_strbuf_puts(html, "'); } else { + if (parent->type == CMARK_NODE_FOOTNOTE_DEFINITION && node->next == NULL) { + cmark_strbuf_putc(html, ' '); + S_put_footnote_backref(renderer, html, parent); + } cmark_strbuf_puts(html, "

    \n"); } } @@ -245,7 +336,20 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type, if (!(options & CMARK_OPT_UNSAFE)) { cmark_strbuf_puts(html, ""); } else { - cmark_strbuf_put(html, node->as.literal.data, node->as.literal.len); + filtered = false; + for (it = renderer->filter_extensions; it; it = it->next) { + ext = (cmark_syntax_extension *) it->data; + if (!ext->html_filter_func(ext, node->as.literal.data, node->as.literal.len)) { + filtered = true; + break; + } + } + if (!filtered) { + cmark_strbuf_put(html, node->as.literal.data, node->as.literal.len); + } else { + cmark_strbuf_puts(html, "<"); + cmark_strbuf_put(html, node->as.literal.data + 1, node->as.literal.len - 1); + } } break; @@ -260,10 +364,12 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type, break; case CMARK_NODE_STRONG: - if (entering) { - cmark_strbuf_puts(html, ""); - } else { - cmark_strbuf_puts(html, ""); + if (node->parent == NULL || node->parent->type != CMARK_NODE_STRONG) { + if (entering) { + cmark_strbuf_puts(html, ""); + } else { + cmark_strbuf_puts(html, ""); + } } break; @@ -302,7 +408,7 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type, node->as.link.url.len); } cmark_strbuf_puts(html, "\" alt=\""); - state->plain = node; + renderer->plain = node; } else { if (node->as.link.title.len) { cmark_strbuf_puts(html, "\" title=\""); @@ -313,29 +419,84 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type, } break; + case CMARK_NODE_FOOTNOTE_DEFINITION: + if (entering) { + if (renderer->footnote_ix == 0) { + cmark_strbuf_puts(html, "
    \n
      \n"); + } + ++renderer->footnote_ix; + + cmark_strbuf_puts(html, "
    1. as.literal.data, node->as.literal.len); + cmark_strbuf_puts(html, "\">\n"); + } else { + if (S_put_footnote_backref(renderer, html, node)) { + cmark_strbuf_putc(html, '\n'); + } + cmark_strbuf_puts(html, "
    2. \n"); + } + break; + + case CMARK_NODE_FOOTNOTE_REFERENCE: + if (entering) { + cmark_strbuf_puts(html, "parent_footnote_def->as.literal.data, node->parent_footnote_def->as.literal.len); + cmark_strbuf_puts(html, "\" id=\"fnref-"); + houdini_escape_href(html, node->parent_footnote_def->as.literal.data, node->parent_footnote_def->as.literal.len); + + if (node->footnote.ref_ix > 1) { + char n[32]; + snprintf(n, sizeof(n), "%d", node->footnote.ref_ix); + cmark_strbuf_puts(html, "-"); + cmark_strbuf_puts(html, n); + } + + cmark_strbuf_puts(html, "\" data-footnote-ref>"); + houdini_escape_href(html, node->as.literal.data, node->as.literal.len); + cmark_strbuf_puts(html, ""); + } + break; + default: assert(false); break; } - // cmark_strbuf_putc(html, 'x'); return 1; } -char *cmark_render_html(cmark_node *root, int options) { +char *cmark_render_html(cmark_node *root, int options, cmark_llist *extensions) { + return cmark_render_html_with_mem(root, options, extensions, cmark_node_mem(root)); +} + +char *cmark_render_html_with_mem(cmark_node *root, int options, cmark_llist *extensions, cmark_mem *mem) { char *result; - cmark_strbuf html = CMARK_BUF_INIT(cmark_node_mem(root)); + cmark_strbuf html = CMARK_BUF_INIT(mem); cmark_event_type ev_type; cmark_node *cur; - struct render_state state = {&html, NULL}; + cmark_html_renderer renderer = {&html, NULL, NULL, 0, 0, NULL}; cmark_iter *iter = cmark_iter_new(root); + for (; extensions; extensions = extensions->next) + if (((cmark_syntax_extension *) extensions->data)->html_filter_func) + renderer.filter_extensions = cmark_llist_append( + mem, + renderer.filter_extensions, + (cmark_syntax_extension *) extensions->data); + while ((ev_type = cmark_iter_next(iter)) != CMARK_EVENT_DONE) { cur = cmark_iter_get_node(iter); - S_render_node(cur, ev_type, &state, options); + S_render_node(&renderer, cur, ev_type, options); } + + if (renderer.footnote_ix) { + cmark_strbuf_puts(&html, "
    \n
    \n"); + } + result = (char *)cmark_strbuf_detach(&html); + cmark_llist_free(mem, renderer.filter_extensions); + cmark_iter_free(iter); return result; } diff --git a/liteidex/src/3rdparty/cmark/src/html.h b/liteidex/src/3rdparty/cmark/src/html.h new file mode 100644 index 000000000..aeba7bcda --- /dev/null +++ b/liteidex/src/3rdparty/cmark/src/html.h @@ -0,0 +1,27 @@ +#ifndef CMARK_HTML_H +#define CMARK_HTML_H + +#include "buffer.h" +#include "node.h" + +CMARK_INLINE +static void cmark_html_render_cr(cmark_strbuf *html) { + if (html->size && html->ptr[html->size - 1] != '\n') + cmark_strbuf_putc(html, '\n'); +} + +#define BUFFER_SIZE 100 + +CMARK_INLINE +static void cmark_html_render_sourcepos(cmark_node *node, cmark_strbuf *html, int options) { + char buffer[BUFFER_SIZE]; + if (CMARK_OPT_SOURCEPOS & options) { + snprintf(buffer, BUFFER_SIZE, " data-sourcepos=\"%d:%d-%d:%d\"", + cmark_node_get_start_line(node), cmark_node_get_start_column(node), + cmark_node_get_end_line(node), cmark_node_get_end_column(node)); + cmark_strbuf_puts(html, buffer); + } +} + + +#endif diff --git a/liteidex/src/3rdparty/cmark/src/inlines.c b/liteidex/src/3rdparty/cmark/src/inlines.c old mode 100755 new mode 100644 index e6b491ffa..30f2c1700 --- a/liteidex/src/3rdparty/cmark/src/inlines.c +++ b/liteidex/src/3rdparty/cmark/src/inlines.c @@ -7,11 +7,12 @@ #include "node.h" #include "parser.h" #include "references.h" -#include "cmark.h" +#include "cmark-gfm.h" #include "houdini.h" #include "utf8.h" #include "scanners.h" #include "inlines.h" +#include "syntax_extension.h" static const char *EMDASH = "\xE2\x80\x94"; static const char *ENDASH = "\xE2\x80\x93"; @@ -30,42 +31,43 @@ static const char *RIGHTSINGLEQUOTE = "\xE2\x80\x99"; #define make_emph(mem) make_simple(mem, CMARK_NODE_EMPH) #define make_strong(mem) make_simple(mem, CMARK_NODE_STRONG) -#define MAXBACKTICKS 1000 - -typedef struct delimiter { - struct delimiter *previous; - struct delimiter *next; - cmark_node *inl_text; - bufsize_t length; - unsigned char delim_char; - bool can_open; - bool can_close; -} delimiter; +#define MAXBACKTICKS 80 typedef struct bracket { struct bracket *previous; - struct delimiter *previous_delimiter; cmark_node *inl_text; bufsize_t position; bool image; bool active; bool bracket_after; + bool in_bracket_image0; + bool in_bracket_image1; } bracket; -typedef struct { +#define FLAG_SKIP_HTML_CDATA (1u << 0) +#define FLAG_SKIP_HTML_DECLARATION (1u << 1) +#define FLAG_SKIP_HTML_PI (1u << 2) +#define FLAG_SKIP_HTML_COMMENT (1u << 3) + +typedef struct subject{ cmark_mem *mem; cmark_chunk input; + unsigned flags; int line; bufsize_t pos; int block_offset; int column_offset; - cmark_reference_map *refmap; + cmark_map *refmap; delimiter *last_delim; bracket *last_bracket; bufsize_t backticks[MAXBACKTICKS + 1]; bool scanned_for_backticks; + bool no_link_openers; } subject; +// Extensions may populate this. +static int8_t SKIP_CHARS[256]; + static CMARK_INLINE bool S_is_line_end_char(char c) { return (c == '\n' || c == '\r'); } @@ -73,10 +75,10 @@ static CMARK_INLINE bool S_is_line_end_char(char c) { static delimiter *S_insert_emph(subject *subj, delimiter *opener, delimiter *closer); -static int parse_inline(subject *subj, cmark_node *parent, int options); +static int parse_inline(cmark_parser *parser, subject *subj, cmark_node *parent, int options); static void subject_from_buf(cmark_mem *mem, int line_number, int block_offset, subject *e, - cmark_chunk *chunk, cmark_reference_map *refmap); + cmark_chunk *buffer, cmark_map *refmap); static bufsize_t subject_find_special_char(subject *subj, int options); // Create an inline with a literal string value. @@ -98,7 +100,7 @@ static CMARK_INLINE cmark_node *make_literal(subject *subj, cmark_node_type t, static CMARK_INLINE cmark_node *make_simple(cmark_mem *mem, cmark_node_type t) { cmark_node *e = (cmark_node *)mem->calloc(1, sizeof(*e)); cmark_strbuf_init(mem, &e->content, 0); - e->type = t; + e->type = (uint16_t)t; return e; } @@ -115,6 +117,24 @@ static cmark_node *make_str_with_entities(subject *subj, } } +// Like cmark_node_append_child but without costly sanity checks. +// Assumes that child was newly created. +static void append_child(cmark_node *node, cmark_node *child) { + cmark_node *old_last_child = node->last_child; + + child->next = NULL; + child->prev = old_last_child; + child->parent = node; + node->last_child = child; + + if (old_last_child) { + old_last_child->next = child; + } else { + // Also set first_child if node previously had no children. + node->first_child = child; + } +} + // Duplicate a chunk by creating a copy of the buffer not by reusing the // buffer like cmark_chunk_dup does. static cmark_chunk chunk_clone(cmark_mem *mem, cmark_chunk *src) { @@ -158,15 +178,16 @@ static CMARK_INLINE cmark_node *make_autolink(subject *subj, link->start_line = link->end_line = subj->line; link->start_column = start_column + 1; link->end_column = end_column + 1; - cmark_node_append_child(link, make_str_with_entities(subj, start_column + 1, end_column - 1, &url)); + append_child(link, make_str_with_entities(subj, start_column + 1, end_column - 1, &url)); return link; } static void subject_from_buf(cmark_mem *mem, int line_number, int block_offset, subject *e, - cmark_chunk *chunk, cmark_reference_map *refmap) { + cmark_chunk *chunk, cmark_map *refmap) { int i; e->mem = mem; e->input = *chunk; + e->flags = 0; e->line = line_number; e->pos = 0; e->block_offset = block_offset; @@ -178,15 +199,20 @@ static void subject_from_buf(cmark_mem *mem, int line_number, int block_offset, e->backticks[i] = 0; } e->scanned_for_backticks = false; + e->no_link_openers = true; } static CMARK_INLINE int isbacktick(int c) { return (c == '`'); } -static CMARK_INLINE unsigned char peek_char(subject *subj) { +static CMARK_INLINE unsigned char peek_char_n(subject *subj, bufsize_t n) { // NULL bytes should have been stripped out by now. If they're // present, it's a programming error: - assert(!(subj->pos < subj->input.len && subj->input.data[subj->pos] == 0)); - return (subj->pos < subj->input.len) ? subj->input.data[subj->pos] : 0; + assert(!(subj->pos + n < subj->input.len && subj->input.data[subj->pos + n] == 0)); + return (subj->pos + n < subj->input.len) ? subj->input.data[subj->pos + n] : 0; +} + +static CMARK_INLINE unsigned char peek_char(subject *subj) { + return peek_char_n(subj, 0); } static CMARK_INLINE unsigned char peek_at(subject *subj, bufsize_t pos) { @@ -389,7 +415,7 @@ static cmark_node *handle_backticks(subject *subj, int options) { static int scan_delims(subject *subj, unsigned char c, bool *can_open, bool *can_close) { int numdelims = 0; - bufsize_t before_char_pos; + bufsize_t before_char_pos, after_char_pos; int32_t after_char = 0; int32_t before_char = 0; int len; @@ -400,12 +426,12 @@ static int scan_delims(subject *subj, unsigned char c, bool *can_open, } else { before_char_pos = subj->pos - 1; // walk back to the beginning of the UTF_8 sequence: - while (peek_at(subj, before_char_pos) >> 6 == 2 && before_char_pos > 0) { + while ((peek_at(subj, before_char_pos) >> 6 == 2 || SKIP_CHARS[peek_at(subj, before_char_pos)]) && before_char_pos > 0) { before_char_pos -= 1; } len = cmark_utf8proc_iterate(subj->input.data + before_char_pos, subj->pos - before_char_pos, &before_char); - if (len == -1) { + if (len == -1 || (before_char < 256 && SKIP_CHARS[(unsigned char) before_char])) { before_char = 10; } } @@ -420,11 +446,20 @@ static int scan_delims(subject *subj, unsigned char c, bool *can_open, } } - len = cmark_utf8proc_iterate(subj->input.data + subj->pos, - subj->input.len - subj->pos, &after_char); - if (len == -1) { + if (subj->pos == subj->input.len) { + after_char = 10; + } else { + after_char_pos = subj->pos; + while (SKIP_CHARS[peek_at(subj, after_char_pos)] && after_char_pos < subj->input.len) { + after_char_pos += 1; + } + len = cmark_utf8proc_iterate(subj->input.data + after_char_pos, + subj->input.len - after_char_pos, &after_char); + if (len == -1 || (after_char < 256 && SKIP_CHARS[(unsigned char) after_char])) { after_char = 10; } + } + left_flanking = numdelims > 0 && !cmark_utf8proc_is_space(after_char) && (!cmark_utf8proc_is_punctuation(after_char) || cmark_utf8proc_is_space(before_char) || @@ -496,6 +531,7 @@ static void push_delimiter(subject *subj, unsigned char c, bool can_open, delim->can_open = can_open; delim->can_close = can_close; delim->inl_text = inl_text; + delim->position = subj->pos; delim->length = inl_text->as.literal.len; delim->previous = subj->last_delim; delim->next = NULL; @@ -509,15 +545,24 @@ static void push_bracket(subject *subj, bool image, cmark_node *inl_text) { bracket *b = (bracket *)subj->mem->calloc(1, sizeof(bracket)); if (subj->last_bracket != NULL) { subj->last_bracket->bracket_after = true; + b->in_bracket_image0 = subj->last_bracket->in_bracket_image0; + b->in_bracket_image1 = subj->last_bracket->in_bracket_image1; } b->image = image; b->active = true; b->inl_text = inl_text; b->previous = subj->last_bracket; - b->previous_delimiter = subj->last_delim; b->position = subj->pos; b->bracket_after = false; + if (image) { + b->in_bracket_image1 = true; + } else { + b->in_bracket_image0 = true; + } subj->last_bracket = b; + if (!image) { + subj->no_link_openers = false; + } } // Assumes the subject has a c at the current position. @@ -606,44 +651,58 @@ static cmark_node *handle_period(subject *subj, bool smart) { } } -static void process_emphasis(subject *subj, delimiter *stack_bottom) { - delimiter *closer = subj->last_delim; +static cmark_syntax_extension *get_extension_for_special_char(cmark_parser *parser, unsigned char c) { + cmark_llist *tmp_ext; + + for (tmp_ext = parser->inline_syntax_extensions; tmp_ext; tmp_ext=tmp_ext->next) { + cmark_syntax_extension *ext = (cmark_syntax_extension *) tmp_ext->data; + cmark_llist *tmp_char; + for (tmp_char = ext->special_inline_chars; tmp_char; tmp_char=tmp_char->next) { + unsigned char tmp_c = (unsigned char)(size_t)tmp_char->data; + + if (tmp_c == c) { + return ext; + } + } + } + + return NULL; +} + +static void process_emphasis(cmark_parser *parser, subject *subj, bufsize_t stack_bottom) { + delimiter *candidate; + delimiter *closer = NULL; delimiter *opener; delimiter *old_closer; bool opener_found; - int openers_bottom_index = 0; - delimiter *openers_bottom[6] = {stack_bottom, stack_bottom, stack_bottom, - stack_bottom, stack_bottom, stack_bottom}; + bufsize_t openers_bottom[3][128]; + int i; + + // initialize openers_bottom: + memset(&openers_bottom, 0, sizeof(openers_bottom)); + for (i=0; i < 3; i++) { + openers_bottom[i]['*'] = stack_bottom; + openers_bottom[i]['_'] = stack_bottom; + openers_bottom[i]['\''] = stack_bottom; + openers_bottom[i]['"'] = stack_bottom; + } // move back to first relevant delim. - while (closer != NULL && closer->previous != stack_bottom) { - closer = closer->previous; + candidate = subj->last_delim; + while (candidate != NULL && candidate->position >= stack_bottom) { + closer = candidate; + candidate = candidate->previous; } // now move forward, looking for closers, and handling each while (closer != NULL) { + cmark_syntax_extension *extension = get_extension_for_special_char(parser, closer->delim_char); if (closer->can_close) { - switch (closer->delim_char) { - case '"': - openers_bottom_index = 0; - break; - case '\'': - openers_bottom_index = 1; - break; - case '_': - openers_bottom_index = 2; - break; - case '*': - openers_bottom_index = 3 + (closer->length % 3); - break; - default: - assert(false); - } - // Now look backwards for first matching opener: opener = closer->previous; opener_found = false; - while (opener != NULL && opener != openers_bottom[openers_bottom_index]) { + while (opener != NULL && opener->position >= stack_bottom && + opener->position >= openers_bottom[closer->length % 3][closer->delim_char]) { if (opener->can_open && opener->delim_char == closer->delim_char) { // interior closer of size 2 can't match opener of size 1 // or of size 1 can't match 2 @@ -657,32 +716,41 @@ static void process_emphasis(subject *subj, delimiter *stack_bottom) { opener = opener->previous; } old_closer = closer; - if (closer->delim_char == '*' || closer->delim_char == '_') { + + if (extension) { + if (opener_found) + closer = extension->insert_inline_from_delim(extension, parser, subj, opener, closer); + else + closer = closer->next; + } else if (closer->delim_char == '*' || closer->delim_char == '_') { if (opener_found) { closer = S_insert_emph(subj, opener, closer); } else { closer = closer->next; } - } else if (closer->delim_char == '\'') { + } else if (closer->delim_char == '\'' || closer->delim_char == '"') { cmark_chunk_free(subj->mem, &closer->inl_text->as.literal); - closer->inl_text->as.literal = cmark_chunk_literal(RIGHTSINGLEQUOTE); - if (opener_found) { - cmark_chunk_free(subj->mem, &opener->inl_text->as.literal); - opener->inl_text->as.literal = cmark_chunk_literal(LEFTSINGLEQUOTE); + if (closer->delim_char == '\'') { + closer->inl_text->as.literal = cmark_chunk_literal(RIGHTSINGLEQUOTE); + } else { + closer->inl_text->as.literal = cmark_chunk_literal(RIGHTDOUBLEQUOTE); } closer = closer->next; - } else if (closer->delim_char == '"') { - cmark_chunk_free(subj->mem, &closer->inl_text->as.literal); - closer->inl_text->as.literal = cmark_chunk_literal(RIGHTDOUBLEQUOTE); if (opener_found) { cmark_chunk_free(subj->mem, &opener->inl_text->as.literal); - opener->inl_text->as.literal = cmark_chunk_literal(LEFTDOUBLEQUOTE); + if (old_closer->delim_char == '\'') { + opener->inl_text->as.literal = cmark_chunk_literal(LEFTSINGLEQUOTE); + } else { + opener->inl_text->as.literal = cmark_chunk_literal(LEFTDOUBLEQUOTE); + } + remove_delimiter(subj, opener); + remove_delimiter(subj, old_closer); } - closer = closer->next; } if (!opener_found) { // set lower bound for future searches for openers - openers_bottom[openers_bottom_index] = old_closer->previous; + openers_bottom[old_closer->length % 3][old_closer->delim_char] = + old_closer->position; if (!old_closer->can_open) { // we can remove a closer that can't be an // opener, once we've seen there's no @@ -695,7 +763,8 @@ static void process_emphasis(subject *subj, delimiter *stack_bottom) { } } // free all delimiters in list until stack_bottom: - while (subj->last_delim != NULL && subj->last_delim != stack_bottom) { + while (subj->last_delim != NULL && + subj->last_delim->position >= stack_bottom) { remove_delimiter(subj, subj->last_delim); } } @@ -734,7 +803,8 @@ static delimiter *S_insert_emph(subject *subj, delimiter *opener, tmp = opener_inl->next; while (tmp && tmp != closer_inl) { tmpnext = tmp->next; - cmark_node_append_child(emph, tmp); + cmark_node_unlink(tmp); + append_child(emph, tmp); tmp = tmpnext; } cmark_node_insert_after(opener_inl, emph); @@ -764,11 +834,11 @@ static delimiter *S_insert_emph(subject *subj, delimiter *opener, } // Parse backslash-escape or just a backslash, returning an inline. -static cmark_node *handle_backslash(subject *subj) { +static cmark_node *handle_backslash(cmark_parser *parser, subject *subj) { advance(subj); unsigned char nextchar = peek_char(subj); - if (cmark_ispunct( - nextchar)) { // only ascii symbols and newline can be escaped + if ((parser->backslash_ispunct ? parser->backslash_ispunct : cmark_ispunct)(nextchar)) { + // only ascii symbols and newline can be escaped advance(subj); return make_str(subj, subj->pos - 2, subj->pos - 1, cmark_chunk_dup(&subj->input, subj->pos - 1, 1)); } else if (!is_eof(subj) && skip_line_end(subj)) { @@ -808,7 +878,7 @@ cmark_chunk cmark_clean_url(cmark_mem *mem, cmark_chunk *url) { return result; } - houdini_unescape_html_f(&buf, url->data, url->len); + houdini_unescape_html_f(&buf, url->data, url->len); cmark_strbuf_unescape(&buf); return cmark_chunk_buf_detach(&buf); @@ -865,7 +935,63 @@ static cmark_node *handle_pointy_brace(subject *subj, int options) { } // finally, try to match an html tag - matchlen = scan_html_tag(&subj->input, subj->pos); + if (subj->pos + 2 <= subj->input.len) { + int c = subj->input.data[subj->pos]; + if (c == '!' && (subj->flags & FLAG_SKIP_HTML_COMMENT) == 0) { + c = subj->input.data[subj->pos+1]; + if (c == '-' && subj->input.data[subj->pos+2] == '-') { + if (subj->input.data[subj->pos+3] == '>') { + matchlen = 4; + } else if (subj->input.data[subj->pos+3] == '-' && + subj->input.data[subj->pos+4] == '>') { + matchlen = 5; + } else { + matchlen = scan_html_comment(&subj->input, subj->pos + 1); + if (matchlen > 0) { + matchlen += 1; // prefix "<" + } else { // no match through end of input: set a flag so + // we don't reparse looking for -->: + subj->flags |= FLAG_SKIP_HTML_COMMENT; + } + } + } else if (c == '[') { + if ((subj->flags & FLAG_SKIP_HTML_CDATA) == 0) { + matchlen = scan_html_cdata(&subj->input, subj->pos + 2); + if (matchlen > 0) { + // The regex doesn't require the final "]]>". But if we're not at + // the end of input, it must come after the match. Otherwise, + // disable subsequent scans to avoid quadratic behavior. + matchlen += 5; // prefix "![", suffix "]]>" + if (subj->pos + matchlen > subj->input.len) { + subj->flags |= FLAG_SKIP_HTML_CDATA; + matchlen = 0; + } + } + } + } else if ((subj->flags & FLAG_SKIP_HTML_DECLARATION) == 0) { + matchlen = scan_html_declaration(&subj->input, subj->pos + 1); + if (matchlen > 0) { + matchlen += 2; // prefix "!", suffix ">" + if (subj->pos + matchlen > subj->input.len) { + subj->flags |= FLAG_SKIP_HTML_DECLARATION; + matchlen = 0; + } + } + } + } else if (c == '?') { + if ((subj->flags & FLAG_SKIP_HTML_PI) == 0) { + // Note that we allow an empty match. + matchlen = scan_html_pi(&subj->input, subj->pos + 1); + matchlen += 3; // prefix "?", suffix "?>" + if (subj->pos + matchlen > subj->input.len) { + subj->flags |= FLAG_SKIP_HTML_PI; + matchlen = 0; + } + } + } else { + matchlen = scan_html_tag(&subj->input, subj->pos); + } + } if (matchlen > 0) { contents = cmark_chunk_dup(&subj->input, subj->pos - 1, matchlen + 1); subj->pos += matchlen; @@ -874,6 +1000,17 @@ static cmark_node *handle_pointy_brace(subject *subj, int options) { return node; } + if (options & CMARK_OPT_LIBERAL_HTML_TAG) { + matchlen = scan_liberal_html_tag(&subj->input, subj->pos); + if (matchlen > 0) { + contents = cmark_chunk_dup(&subj->input, subj->pos - 1, matchlen + 1); + subj->pos += matchlen; + cmark_node *node = make_raw_html(subj, subj->pos - matchlen - 1, subj->pos - 1, contents); + adjust_subj_node_newlines(subj, node, matchlen, 1, options); + return node; + } + } + // if nothing matches, just return the opening <: return make_str(subj, subj->pos - 1, subj->pos - 1, cmark_chunk_literal("<")); } @@ -929,30 +1066,30 @@ static bufsize_t manual_scan_link_url_2(cmark_chunk *input, bufsize_t offset, bufsize_t i = offset; size_t nb_p = 0; - while (i < input->len) { - if (input->data[i] == '\\' && - i + 1 < input-> len && - cmark_ispunct(input->data[i+1])) - i += 2; - else if (input->data[i] == '(') { - ++nb_p; - ++i; - if (nb_p > 32) - return -1; - } else if (input->data[i] == ')') { - if (nb_p == 0) - break; - --nb_p; - ++i; - } else if (cmark_isspace(input->data[i])) { - if (i == offset) { - return -1; - } + while (i < input->len) { + if (input->data[i] == '\\' && + i + 1 < input-> len && + cmark_ispunct(input->data[i+1])) + i += 2; + else if (input->data[i] == '(') { + ++nb_p; + ++i; + if (nb_p > 32) + return -1; + } else if (input->data[i] == ')') { + if (nb_p == 0) break; - } else { - ++i; + --nb_p; + ++i; + } else if (cmark_isspace(input->data[i])) { + if (i == offset) { + return -1; } + break; + } else { + ++i; } + } if (i >= input->len) return -1; @@ -996,7 +1133,7 @@ static bufsize_t manual_scan_link_url(cmark_chunk *input, bufsize_t offset, } // Return a link, an image, or a literal close bracket. -static cmark_node *handle_close_bracket(subject *subj) { +static cmark_node *handle_close_bracket(cmark_parser *parser, subject *subj) { bufsize_t initial_pos, after_link_text_pos; bufsize_t endurl, starttitle, endtitle, endall; bufsize_t sps, n; @@ -1020,16 +1157,16 @@ static cmark_node *handle_close_bracket(subject *subj) { return make_str(subj, subj->pos - 1, subj->pos - 1, cmark_chunk_literal("]")); } - if (!opener->active) { + // If we got here, we matched a potential link/image text. + // Now we check to see if it's a link/image. + is_image = opener->image; + + if (!is_image && subj->no_link_openers) { // take delimiter off stack pop_bracket(subj); return make_str(subj, subj->pos - 1, subj->pos - 1, cmark_chunk_literal("]")); } - // If we got here, we matched a potential link/image text. - // Now we check to see if it's a link/image. - is_image = opener->image; - after_link_text_pos = subj->pos; // First, look for an inline link. @@ -1084,7 +1221,7 @@ static cmark_node *handle_close_bracket(subject *subj) { } if (found_label) { - ref = cmark_reference_lookup(subj->refmap, &raw_label); + ref = (cmark_reference *)cmark_map_lookup(subj->refmap, &raw_label); cmark_chunk_free(subj->mem, &raw_label); } @@ -1097,7 +1234,86 @@ static cmark_node *handle_close_bracket(subject *subj) { } noMatch: - // If we fall through to here, it means we didn't match a link: + // If we fall through to here, it means we didn't match a link. + // What if we're a footnote link? + if (parser->options & CMARK_OPT_FOOTNOTES && + opener->inl_text->next && + opener->inl_text->next->type == CMARK_NODE_TEXT) { + + cmark_chunk *literal = &opener->inl_text->next->as.literal; + + // look back to the opening '[', and skip ahead to the next character + // if we're looking at a '[^' sequence, and there is other text or nodes + // after the ^, let's call it a footnote reference. + if ((literal->len > 0 && literal->data[0] == '^') && (literal->len > 1 || opener->inl_text->next->next)) { + + // Before we got this far, the `handle_close_bracket` function may have + // advanced the current state beyond our footnote's actual closing + // bracket, ie if it went looking for a `link_label`. + // Let's just rewind the subject's position: + subj->pos = initial_pos; + + cmark_node *fnref = make_simple(subj->mem, CMARK_NODE_FOOTNOTE_REFERENCE); + + // the start and end of the footnote ref is the opening and closing brace + // i.e. the subject's current position, and the opener's start_column + int fnref_end_column = subj->pos + subj->column_offset + subj->block_offset; + int fnref_start_column = opener->inl_text->start_column; + + // any given node delineates a substring of the line being processed, + // with the remainder of the line being pointed to thru its 'literal' + // struct member. + // here, we copy the literal's pointer, moving it past the '^' character + // for a length equal to the size of footnote reference text. + // i.e. end_col minus start_col, minus the [ and the ^ characters + // + // this copies the footnote reference string, even if between the + // `opener` and the subject's current position there are other nodes + // + // (first, check for underflows) + if ((fnref_start_column + 2) <= fnref_end_column) { + fnref->as.literal = cmark_chunk_dup(literal, 1, (fnref_end_column - fnref_start_column) - 2); + } else { + fnref->as.literal = cmark_chunk_dup(literal, 1, 0); + } + + fnref->start_line = fnref->end_line = subj->line; + fnref->start_column = fnref_start_column; + fnref->end_column = fnref_end_column; + + // we then replace the opener with this new fnref node, the net effect + // being replacing the opening '[' text node with a `^footnote-ref]` node. + cmark_node_insert_before(opener->inl_text, fnref); + + process_emphasis(parser, subj, opener->position); + // sometimes, the footnote reference text gets parsed into multiple nodes + // i.e. '[^example]' parsed into '[', '^exam', 'ple]'. + // this happens for ex with the autolink extension. when the autolinker + // finds the 'w' character, it will split the text into multiple nodes + // in hopes of being able to match a 'www.' substring. + // + // because this function is called one character at a time via the + // `parse_inlines` function, and the current subj->pos is pointing at the + // closing ] brace, and because we copy all the text between the [ ] + // braces, we should be able to safely ignore and delete any nodes after + // the opener->inl_text->next. + // + // therefore, here we walk thru the list and free them all up + cmark_node *next_node; + cmark_node *current_node = opener->inl_text->next; + while(current_node) { + next_node = current_node->next; + cmark_node_free(current_node); + current_node = next_node; + } + + cmark_node_free(opener->inl_text); + + pop_bracket(subj); + return NULL; + } + } + pop_bracket(subj); // remove this opener from delimiter list subj->pos = initial_pos; return make_str(subj, subj->pos - 1, subj->pos - 1, cmark_chunk_literal("]")); @@ -1114,31 +1330,22 @@ static cmark_node *handle_close_bracket(subject *subj) { tmp = opener->inl_text->next; while (tmp) { tmpnext = tmp->next; - cmark_node_append_child(inl, tmp); + cmark_node_unlink(tmp); + append_child(inl, tmp); tmp = tmpnext; } // Free the bracket [: cmark_node_free(opener->inl_text); - process_emphasis(subj, opener->previous_delimiter); + process_emphasis(parser, subj, opener->position); pop_bracket(subj); - // Now, if we have a link, we also want to deactivate earlier link - // delimiters. (This code can be removed if we decide to allow links + // Now, if we have a link, we also want to deactivate links until + // we get a new opener. (This code can be removed if we decide to allow links // inside links.) if (!is_image) { - opener = subj->last_bracket; - while (opener != NULL) { - if (!opener->image) { - if (!opener->active) { - break; - } else { - opener->active = false; - } - } - opener = opener->previous; - } + subj->no_link_openers = true; } return NULL; @@ -1167,9 +1374,8 @@ static cmark_node *handle_newline(subject *subj) { } } -static bufsize_t subject_find_special_char(subject *subj, int options) { - // "\r\n\\`&_*[]pos + 1; while (n < subj->input.len) { @@ -1210,9 +1417,39 @@ static bufsize_t subject_find_special_char(subject *subj, int options) { return subj->input.len; } +void cmark_inlines_add_special_character(unsigned char c, bool emphasis) { + SPECIAL_CHARS[c] = 1; + if (emphasis) + SKIP_CHARS[c] = 1; +} + +void cmark_inlines_remove_special_character(unsigned char c, bool emphasis) { + SPECIAL_CHARS[c] = 0; + if (emphasis) + SKIP_CHARS[c] = 0; +} + +static cmark_node *try_extensions(cmark_parser *parser, + cmark_node *parent, + unsigned char c, + subject *subj) { + cmark_node *res = NULL; + cmark_llist *tmp; + + for (tmp = parser->inline_syntax_extensions; tmp; tmp = tmp->next) { + cmark_syntax_extension *ext = (cmark_syntax_extension *) tmp->data; + res = ext->match_inline(ext, parser, parent, c, subj); + + if (res) + break; + } + + return res; +} + // Parse an inline, advancing subject, and add it as a child of parent. // Return 0 if no inline can be parsed, 1 otherwise. -static int parse_inline(subject *subj, cmark_node *parent, int options) { +static int parse_inline(cmark_parser *parser, subject *subj, cmark_node *parent, int options) { cmark_node *new_inl = NULL; cmark_chunk contents; unsigned char c; @@ -1230,7 +1467,7 @@ static int parse_inline(subject *subj, cmark_node *parent, int options) { new_inl = handle_backticks(subj, options); break; case '\\': - new_inl = handle_backslash(subj); + new_inl = handle_backslash(parser, subj); break; case '&': new_inl = handle_entity(subj); @@ -1256,11 +1493,11 @@ static int parse_inline(subject *subj, cmark_node *parent, int options) { push_bracket(subj, false, new_inl); break; case ']': - new_inl = handle_close_bracket(subj); + new_inl = handle_close_bracket(parser, subj); break; case '!': advance(subj); - if (peek_char(subj) == '[') { + if (peek_char(subj) == '[' && peek_char_n(subj, 1) != '^') { advance(subj); new_inl = make_str(subj, subj->pos - 2, subj->pos - 1, cmark_chunk_literal("![")); push_bracket(subj, true, new_inl); @@ -1269,6 +1506,10 @@ static int parse_inline(subject *subj, cmark_node *parent, int options) { } break; default: + new_inl = try_extensions(parser, parent, c, subj); + if (new_inl != NULL) + break; + endpos = subject_find_special_char(subj, options); contents = cmark_chunk_dup(&subj->input, subj->pos, endpos - subj->pos); startpos = subj->pos; @@ -1282,24 +1523,26 @@ static int parse_inline(subject *subj, cmark_node *parent, int options) { new_inl = make_str(subj, startpos, endpos - 1, contents); } if (new_inl != NULL) { - cmark_node_append_child(parent, new_inl); + append_child(parent, new_inl); } return 1; } // Parse inlines from parent's string_content, adding as children of parent. -extern void cmark_parse_inlines(cmark_mem *mem, cmark_node *parent, - cmark_reference_map *refmap, int options) { +void cmark_parse_inlines(cmark_parser *parser, + cmark_node *parent, + cmark_map *refmap, + int options) { subject subj; cmark_chunk content = {parent->content.ptr, parent->content.size, 0}; - subject_from_buf(mem, parent->start_line, parent->start_column - 1 + parent->internal_offset, &subj, &content, refmap); + subject_from_buf(parser->mem, parent->start_line, parent->start_column - 1 + parent->internal_offset, &subj, &content, refmap); cmark_chunk_rtrim(&subj.input); - while (!is_eof(&subj) && parse_inline(&subj, parent, options)) + while (!is_eof(&subj) && parse_inline(parser, &subj, parent, options)) ; - process_emphasis(&subj, NULL); + process_emphasis(parser, &subj, 0); // free bracket and delim stack while (subj.last_delim) { remove_delimiter(&subj, subj.last_delim); @@ -1322,7 +1565,7 @@ static void spnl(subject *subj) { // Return 0 if no reference found, otherwise position of subject // after reference is parsed. bufsize_t cmark_parse_reference_inline(cmark_mem *mem, cmark_chunk *input, - cmark_reference_map *refmap) { + cmark_map *refmap) { subject subj; cmark_chunk lab; @@ -1382,3 +1625,164 @@ bufsize_t cmark_parse_reference_inline(cmark_mem *mem, cmark_chunk *input, cmark_reference_create(refmap, &lab, &url, &title); return subj.pos; } + +unsigned char cmark_inline_parser_peek_char(cmark_inline_parser *parser) { + return peek_char(parser); +} + +unsigned char cmark_inline_parser_peek_at(cmark_inline_parser *parser, bufsize_t pos) { + return peek_at(parser, pos); +} + +int cmark_inline_parser_is_eof(cmark_inline_parser *parser) { + return is_eof(parser); +} + +static char * +my_strndup (const char *s, size_t n) +{ + char *result; + size_t len = strlen (s); + + if (n < len) + len = n; + + result = (char *) malloc (len + 1); + if (!result) + return 0; + + result[len] = '\0'; + return (char *) memcpy (result, s, len); +} + +char *cmark_inline_parser_take_while(cmark_inline_parser *parser, cmark_inline_predicate pred) { + unsigned char c; + bufsize_t startpos = parser->pos; + bufsize_t len = 0; + + while ((c = peek_char(parser)) && (*pred)(c)) { + advance(parser); + len++; + } + + return my_strndup((const char *) parser->input.data + startpos, len); +} + +void cmark_inline_parser_push_delimiter(cmark_inline_parser *parser, + unsigned char c, + int can_open, + int can_close, + cmark_node *inl_text) { + push_delimiter(parser, c, can_open != 0, can_close != 0, inl_text); +} + +void cmark_inline_parser_remove_delimiter(cmark_inline_parser *parser, delimiter *delim) { + remove_delimiter(parser, delim); +} + +int cmark_inline_parser_scan_delimiters(cmark_inline_parser *parser, + int max_delims, + unsigned char c, + int *left_flanking, + int *right_flanking, + int *punct_before, + int *punct_after) { + int numdelims = 0; + bufsize_t before_char_pos; + int32_t after_char = 0; + int32_t before_char = 0; + int len; + bool space_before, space_after; + + if (parser->pos == 0) { + before_char = 10; + } else { + before_char_pos = parser->pos - 1; + // walk back to the beginning of the UTF_8 sequence: + while (peek_at(parser, before_char_pos) >> 6 == 2 && before_char_pos > 0) { + before_char_pos -= 1; + } + len = cmark_utf8proc_iterate(parser->input.data + before_char_pos, + parser->pos - before_char_pos, &before_char); + if (len == -1) { + before_char = 10; + } + } + + while (peek_char(parser) == c && numdelims < max_delims) { + numdelims++; + advance(parser); + } + + len = cmark_utf8proc_iterate(parser->input.data + parser->pos, + parser->input.len - parser->pos, &after_char); + if (len == -1) { + after_char = 10; + } + + *punct_before = cmark_utf8proc_is_punctuation(before_char); + *punct_after = cmark_utf8proc_is_punctuation(after_char); + space_before = cmark_utf8proc_is_space(before_char) != 0; + space_after = cmark_utf8proc_is_space(after_char) != 0; + + *left_flanking = numdelims > 0 && !cmark_utf8proc_is_space(after_char) && + !(*punct_after && !space_before && !*punct_before); + *right_flanking = numdelims > 0 && !cmark_utf8proc_is_space(before_char) && + !(*punct_before && !space_after && !*punct_after); + + return numdelims; +} + +void cmark_inline_parser_advance_offset(cmark_inline_parser *parser) { + advance(parser); +} + +int cmark_inline_parser_get_offset(cmark_inline_parser *parser) { + return parser->pos; +} + +void cmark_inline_parser_set_offset(cmark_inline_parser *parser, int offset) { + parser->pos = offset; +} + +int cmark_inline_parser_get_column(cmark_inline_parser *parser) { + return parser->pos + 1 + parser->column_offset + parser->block_offset; +} + +cmark_chunk *cmark_inline_parser_get_chunk(cmark_inline_parser *parser) { + return &parser->input; +} + +int cmark_inline_parser_in_bracket(cmark_inline_parser *parser, int image) { + bracket *b = parser->last_bracket; + if (!b) { + return 0; + } + if (image != 0) { + return b->in_bracket_image1; + } else { + return b->in_bracket_image0; + } +} + +void cmark_node_unput(cmark_node *node, int n) { + node = node->last_child; + while (n > 0 && node && node->type == CMARK_NODE_TEXT) { + if (node->as.literal.len < n) { + n -= node->as.literal.len; + node->as.literal.len = 0; + } else { + node->as.literal.len -= n; + n = 0; + } + node = node->prev; + } +} + +delimiter *cmark_inline_parser_get_last_delimiter(cmark_inline_parser *parser) { + return parser->last_delim; +} + +int cmark_inline_parser_get_line(cmark_inline_parser *parser) { + return parser->line; +} diff --git a/liteidex/src/3rdparty/cmark/src/inlines.h b/liteidex/src/3rdparty/cmark/src/inlines.h old mode 100755 new mode 100644 index 39d3363ac..7dd91bf52 --- a/liteidex/src/3rdparty/cmark/src/inlines.h +++ b/liteidex/src/3rdparty/cmark/src/inlines.h @@ -5,14 +5,22 @@ extern "C" { #endif +#include "references.h" + cmark_chunk cmark_clean_url(cmark_mem *mem, cmark_chunk *url); cmark_chunk cmark_clean_title(cmark_mem *mem, cmark_chunk *title); -void cmark_parse_inlines(cmark_mem *mem, cmark_node *parent, - cmark_reference_map *refmap, int options); +CMARK_GFM_EXPORT +void cmark_parse_inlines(cmark_parser *parser, + cmark_node *parent, + cmark_map *refmap, + int options); bufsize_t cmark_parse_reference_inline(cmark_mem *mem, cmark_chunk *input, - cmark_reference_map *refmap); + cmark_map *refmap); + +void cmark_inlines_add_special_character(unsigned char c, bool emphasis); +void cmark_inlines_remove_special_character(unsigned char c, bool emphasis); #ifdef __cplusplus } diff --git a/liteidex/src/3rdparty/cmark/src/iterator.c b/liteidex/src/3rdparty/cmark/src/iterator.c old mode 100755 new mode 100644 index f5cd80205..13fdb7616 --- a/liteidex/src/3rdparty/cmark/src/iterator.c +++ b/liteidex/src/3rdparty/cmark/src/iterator.c @@ -3,15 +3,9 @@ #include "config.h" #include "node.h" -#include "cmark.h" +#include "cmark-gfm.h" #include "iterator.h" -static const int S_leaf_mask = - (1 << CMARK_NODE_HTML_BLOCK) | (1 << CMARK_NODE_THEMATIC_BREAK) | - (1 << CMARK_NODE_CODE_BLOCK) | (1 << CMARK_NODE_TEXT) | - (1 << CMARK_NODE_SOFTBREAK) | (1 << CMARK_NODE_LINEBREAK) | - (1 << CMARK_NODE_CODE) | (1 << CMARK_NODE_HTML_INLINE); - cmark_iter *cmark_iter_new(cmark_node *root) { if (root == NULL) { return NULL; @@ -30,7 +24,18 @@ cmark_iter *cmark_iter_new(cmark_node *root) { void cmark_iter_free(cmark_iter *iter) { iter->mem->free(iter); } static bool S_is_leaf(cmark_node *node) { - return ((1 << node->type) & S_leaf_mask) != 0; + switch (node->type) { + case CMARK_NODE_HTML_BLOCK: + case CMARK_NODE_THEMATIC_BREAK: + case CMARK_NODE_CODE_BLOCK: + case CMARK_NODE_TEXT: + case CMARK_NODE_SOFTBREAK: + case CMARK_NODE_LINEBREAK: + case CMARK_NODE_CODE: + case CMARK_NODE_HTML_INLINE: + return 1; + } + return 0; } cmark_event_type cmark_iter_next(cmark_iter *iter) { @@ -119,3 +124,36 @@ void cmark_consolidate_text_nodes(cmark_node *root) { cmark_strbuf_free(&buf); cmark_iter_free(iter); } + +void cmark_node_own(cmark_node *root) { + if (root == NULL) { + return; + } + cmark_iter *iter = cmark_iter_new(root); + cmark_event_type ev_type; + cmark_node *cur; + + while ((ev_type = cmark_iter_next(iter)) != CMARK_EVENT_DONE) { + cur = cmark_iter_get_node(iter); + if (ev_type == CMARK_EVENT_ENTER) { + switch (cur->type) { + case CMARK_NODE_TEXT: + case CMARK_NODE_HTML_INLINE: + case CMARK_NODE_CODE: + case CMARK_NODE_HTML_BLOCK: + cmark_chunk_to_cstr(iter->mem, &cur->as.literal); + break; + case CMARK_NODE_LINK: + cmark_chunk_to_cstr(iter->mem, &cur->as.link.url); + cmark_chunk_to_cstr(iter->mem, &cur->as.link.title); + break; + case CMARK_NODE_CUSTOM_INLINE: + cmark_chunk_to_cstr(iter->mem, &cur->as.custom.on_enter); + cmark_chunk_to_cstr(iter->mem, &cur->as.custom.on_exit); + break; + } + } + } + + cmark_iter_free(iter); +} diff --git a/liteidex/src/3rdparty/cmark/src/iterator.h b/liteidex/src/3rdparty/cmark/src/iterator.h old mode 100755 new mode 100644 index 30ce76f51..47e10e57b --- a/liteidex/src/3rdparty/cmark/src/iterator.h +++ b/liteidex/src/3rdparty/cmark/src/iterator.h @@ -5,7 +5,7 @@ extern "C" { #endif -#include "cmark.h" +#include "cmark-gfm.h" typedef struct { cmark_event_type ev_type; diff --git a/liteidex/src/3rdparty/cmark/src/latex.c b/liteidex/src/3rdparty/cmark/src/latex.c old mode 100755 new mode 100644 index 0d9517d19..1a6367a4e --- a/liteidex/src/3rdparty/cmark/src/latex.c +++ b/liteidex/src/3rdparty/cmark/src/latex.c @@ -4,20 +4,22 @@ #include #include "config.h" -#include "cmark.h" +#include "cmark-gfm.h" #include "node.h" #include "buffer.h" #include "utf8.h" #include "scanners.h" #include "render.h" +#include "syntax_extension.h" -#define OUT(s, wrap, escaping) renderer->out(renderer, s, wrap, escaping) -#define LIT(s) renderer->out(renderer, s, false, LITERAL) +#define OUT(s, wrap, escaping) renderer->out(renderer, node, s, wrap, escaping) +#define LIT(s) renderer->out(renderer, node, s, false, LITERAL) #define CR() renderer->cr(renderer) #define BLANKLINE() renderer->blankline(renderer) #define LIST_NUMBER_STRING_SIZE 20 -static CMARK_INLINE void outc(cmark_renderer *renderer, cmark_escaping escape, +static CMARK_INLINE void outc(cmark_renderer *renderer, cmark_node *node, + cmark_escaping escape, int32_t c, unsigned char nextc) { if (escape == LITERAL) { cmark_render_code_point(renderer, c); @@ -226,8 +228,10 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, cmark_list_type list_type; bool allow_wrap = renderer->width > 0 && !(CMARK_OPT_NOBREAKS & options); - // avoid warning about unused parameter: - (void)(options); + if (node->extension && node->extension->latex_render_func) { + node->extension->latex_render_func(node->extension, renderer, node, ev_type, options); + return 1; + } switch (node->type) { case CMARK_NODE_DOCUMENT: @@ -381,10 +385,12 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, break; case CMARK_NODE_STRONG: - if (entering) { - LIT("\\textbf{"); - } else { - LIT("}"); + if (node->parent == NULL || node->parent->type != CMARK_NODE_STRONG) { + if (entering) { + LIT("\\textbf{"); + } else { + LIT("}"); + } } break; @@ -440,6 +446,11 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, } break; + case CMARK_NODE_FOOTNOTE_DEFINITION: + case CMARK_NODE_FOOTNOTE_REFERENCE: + // TODO + break; + default: assert(false); break; @@ -449,5 +460,9 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, } char *cmark_render_latex(cmark_node *root, int options, int width) { - return cmark_render(root, options, width, outc, S_render_node); + return cmark_render_latex_with_mem(root, options, width, cmark_node_mem(root)); +} + +char *cmark_render_latex_with_mem(cmark_node *root, int options, int width, cmark_mem *mem) { + return cmark_render(mem, root, options, width, outc, S_render_node); } diff --git a/liteidex/src/3rdparty/cmark/src/libcmark.pc.in b/liteidex/src/3rdparty/cmark/src/libcmark.pc.in deleted file mode 100755 index 0f87c309b..000000000 --- a/liteidex/src/3rdparty/cmark/src/libcmark.pc.in +++ /dev/null @@ -1,10 +0,0 @@ -prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=@CMAKE_INSTALL_PREFIX@ -libdir=@CMAKE_INSTALL_PREFIX@/@libdir@ -includedir=@CMAKE_INSTALL_PREFIX@/include - -Name: libcmark -Description: CommonMark parsing, rendering, and manipulation -Version: @PROJECT_VERSION@ -Libs: -L${libdir} -lcmark -Cflags: -I${includedir} diff --git a/liteidex/src/3rdparty/cmark/src/linked_list.c b/liteidex/src/3rdparty/cmark/src/linked_list.c new file mode 100644 index 000000000..8c26dc557 --- /dev/null +++ b/liteidex/src/3rdparty/cmark/src/linked_list.c @@ -0,0 +1,37 @@ +#include + +#include "cmark-gfm.h" + +cmark_llist *cmark_llist_append(cmark_mem *mem, cmark_llist *head, void *data) { + cmark_llist *tmp; + cmark_llist *new_node = (cmark_llist *) mem->calloc(1, sizeof(cmark_llist)); + + new_node->data = data; + new_node->next = NULL; + + if (!head) + return new_node; + + for (tmp = head; tmp->next; tmp=tmp->next); + + tmp->next = new_node; + + return head; +} + +void cmark_llist_free_full(cmark_mem *mem, cmark_llist *head, cmark_free_func free_func) { + cmark_llist *tmp, *prev; + + for (tmp = head; tmp;) { + if (free_func) + free_func(mem, tmp->data); + + prev = tmp; + tmp = tmp->next; + mem->free(prev); + } +} + +void cmark_llist_free(cmark_mem *mem, cmark_llist *head) { + cmark_llist_free_full(mem, head, NULL); +} diff --git a/liteidex/src/3rdparty/cmark/src/main.c b/liteidex/src/3rdparty/cmark/src/main.c deleted file mode 100755 index ab0d93c3d..000000000 --- a/liteidex/src/3rdparty/cmark/src/main.c +++ /dev/null @@ -1,210 +0,0 @@ -#include -#include -#include -#include -#include "config.h" -#include "cmark.h" -#include "node.h" - -#if defined(__OpenBSD__) -# include -# if OpenBSD >= 201605 -# define USE_PLEDGE -# include -# endif -#endif - -#if defined(_WIN32) && !defined(__CYGWIN__) -#include -#include -#endif - -typedef enum { - FORMAT_NONE, - FORMAT_HTML, - FORMAT_XML, - FORMAT_MAN, - FORMAT_COMMONMARK, - FORMAT_LATEX -} writer_format; - -void print_usage() { - printf("Usage: cmark [FILE*]\n"); - printf("Options:\n"); - printf(" --to, -t FORMAT Specify output format (html, xml, man, " - "commonmark, latex)\n"); - printf(" --width WIDTH Specify wrap width (default 0 = nowrap)\n"); - printf(" --sourcepos Include source position attribute\n"); - printf(" --hardbreaks Treat newlines as hard line breaks\n"); - printf(" --nobreaks Render soft line breaks as spaces\n"); - printf(" --unsafe Render raw HTML and dangerous URLs\n"); - printf(" --smart Use smart punctuation\n"); - printf(" --validate-utf8 Replace UTF-8 invalid sequences with U+FFFD\n"); - printf(" --help, -h Print usage information\n"); - printf(" --version Print version\n"); -} - -static void print_document(cmark_node *document, writer_format writer, - int options, int width) { - char *result; - - switch (writer) { - case FORMAT_HTML: - result = cmark_render_html(document, options); - break; - case FORMAT_XML: - result = cmark_render_xml(document, options); - break; - case FORMAT_MAN: - result = cmark_render_man(document, options, width); - break; - case FORMAT_COMMONMARK: - result = cmark_render_commonmark(document, options, width); - break; - case FORMAT_LATEX: - result = cmark_render_latex(document, options, width); - break; - default: - fprintf(stderr, "Unknown format %d\n", writer); - exit(1); - } - printf("%s", result); - cmark_node_mem(document)->free(result); -} - -int main(int argc, char *argv[]) { - int i, numfps = 0; - int *files; - char buffer[4096]; - cmark_parser *parser; - size_t bytes; - cmark_node *document; - int width = 0; - char *unparsed; - writer_format writer = FORMAT_HTML; - int options = CMARK_OPT_DEFAULT; - -#ifdef USE_PLEDGE - if (pledge("stdio rpath", NULL) != 0) { - perror("pledge"); - return 1; - } -#endif - -#if defined(_WIN32) && !defined(__CYGWIN__) - _setmode(_fileno(stdin), _O_BINARY); - _setmode(_fileno(stdout), _O_BINARY); -#endif - - files = (int *)calloc(argc, sizeof(*files)); - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "--version") == 0) { - printf("cmark %s", CMARK_VERSION_STRING); - printf(" - CommonMark converter\n(C) 2014-2016 John MacFarlane\n"); - exit(0); - } else if (strcmp(argv[i], "--sourcepos") == 0) { - options |= CMARK_OPT_SOURCEPOS; - } else if (strcmp(argv[i], "--hardbreaks") == 0) { - options |= CMARK_OPT_HARDBREAKS; - } else if (strcmp(argv[i], "--nobreaks") == 0) { - options |= CMARK_OPT_NOBREAKS; - } else if (strcmp(argv[i], "--smart") == 0) { - options |= CMARK_OPT_SMART; - } else if (strcmp(argv[i], "--unsafe") == 0) { - options |= CMARK_OPT_UNSAFE; - } else if (strcmp(argv[i], "--validate-utf8") == 0) { - options |= CMARK_OPT_VALIDATE_UTF8; - } else if ((strcmp(argv[i], "--help") == 0) || - (strcmp(argv[i], "-h") == 0)) { - print_usage(); - exit(0); - } else if (strcmp(argv[i], "--width") == 0) { - i += 1; - if (i < argc) { - width = (int)strtol(argv[i], &unparsed, 10); - if (unparsed && strlen(unparsed) > 0) { - fprintf(stderr, "failed parsing width '%s' at '%s'\n", argv[i], - unparsed); - exit(1); - } - } else { - fprintf(stderr, "--width requires an argument\n"); - exit(1); - } - } else if ((strcmp(argv[i], "-t") == 0) || (strcmp(argv[i], "--to") == 0)) { - i += 1; - if (i < argc) { - if (strcmp(argv[i], "man") == 0) { - writer = FORMAT_MAN; - } else if (strcmp(argv[i], "html") == 0) { - writer = FORMAT_HTML; - } else if (strcmp(argv[i], "xml") == 0) { - writer = FORMAT_XML; - } else if (strcmp(argv[i], "commonmark") == 0) { - writer = FORMAT_COMMONMARK; - } else if (strcmp(argv[i], "latex") == 0) { - writer = FORMAT_LATEX; - } else { - fprintf(stderr, "Unknown format %s\n", argv[i]); - exit(1); - } - } else { - fprintf(stderr, "No argument provided for %s\n", argv[i - 1]); - exit(1); - } - } else if (*argv[i] == '-') { - print_usage(); - exit(1); - } else { // treat as file argument - files[numfps++] = i; - } - } - - parser = cmark_parser_new(options); - for (i = 0; i < numfps; i++) { - FILE *fp = fopen(argv[files[i]], "rb"); - if (fp == NULL) { - fprintf(stderr, "Error opening file %s: %s\n", argv[files[i]], - strerror(errno)); - exit(1); - } - - while ((bytes = fread(buffer, 1, sizeof(buffer), fp)) > 0) { - cmark_parser_feed(parser, buffer, bytes); - if (bytes < sizeof(buffer)) { - break; - } - } - - fclose(fp); - } - - if (numfps == 0) { - - while ((bytes = fread(buffer, 1, sizeof(buffer), stdin)) > 0) { - cmark_parser_feed(parser, buffer, bytes); - if (bytes < sizeof(buffer)) { - break; - } - } - } - -#ifdef USE_PLEDGE - if (pledge("stdio", NULL) != 0) { - perror("pledge"); - return 1; - } -#endif - - document = cmark_parser_finish(parser); - cmark_parser_free(parser); - - print_document(document, writer, options, width); - - cmark_node_free(document); - - free(files); - - return 0; -} diff --git a/liteidex/src/3rdparty/cmark/src/man.c b/liteidex/src/3rdparty/cmark/src/man.c old mode 100755 new mode 100644 index 1c76f68bb..634fd9d0f --- a/liteidex/src/3rdparty/cmark/src/man.c +++ b/liteidex/src/3rdparty/cmark/src/man.c @@ -4,20 +4,22 @@ #include #include "config.h" -#include "cmark.h" +#include "cmark-gfm.h" #include "node.h" #include "buffer.h" #include "utf8.h" #include "render.h" +#include "syntax_extension.h" -#define OUT(s, wrap, escaping) renderer->out(renderer, s, wrap, escaping) -#define LIT(s) renderer->out(renderer, s, false, LITERAL) +#define OUT(s, wrap, escaping) renderer->out(renderer, node, s, wrap, escaping) +#define LIT(s) renderer->out(renderer, node, s, false, LITERAL) #define CR() renderer->cr(renderer) #define BLANKLINE() renderer->blankline(renderer) #define LIST_NUMBER_SIZE 20 // Functions to convert cmark_nodes to groff man strings. -static void S_outc(cmark_renderer *renderer, cmark_escaping escape, int32_t c, +static void S_outc(cmark_renderer *renderer, cmark_node *node, + cmark_escaping escape, int32_t c, unsigned char nextc) { (void)(nextc); @@ -72,16 +74,30 @@ static void S_outc(cmark_renderer *renderer, cmark_escaping escape, int32_t c, static int S_render_node(cmark_renderer *renderer, cmark_node *node, cmark_event_type ev_type, int options) { - cmark_node *tmp; int list_number; bool entering = (ev_type == CMARK_EVENT_ENTER); bool allow_wrap = renderer->width > 0 && !(CMARK_OPT_NOBREAKS & options); - // avoid unused parameter error: - (void)(options); + if (node->extension && node->extension->man_render_func) { + node->extension->man_render_func(node->extension, renderer, node, ev_type, options); + return 1; + } switch (node->type) { case CMARK_NODE_DOCUMENT: + if (entering) { + /* Define a strikethrough macro */ + /* Commenting out because this makes tests fail + LIT(".de ST"); + CR(); + LIT(".nr ww \\w'\\\\$1'"); + CR(); + LIT("\\Z@\\v'-.25m'\\l'\\\\n[ww]u'@\\\\$1"); + CR(); + LIT(".."); + CR(); + */ + } break; case CMARK_NODE_BLOCK_QUOTE: @@ -106,12 +122,7 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, if (cmark_node_get_list_type(node->parent) == CMARK_BULLET_LIST) { LIT("\\[bu] 2"); } else { - list_number = cmark_node_get_list_start(node->parent); - tmp = node; - while (tmp->prev) { - tmp = tmp->prev; - list_number += 1; - } + list_number = cmark_node_get_item_index(node); char list_number_s[LIST_NUMBER_SIZE]; snprintf(list_number_s, LIST_NUMBER_SIZE, "\"%d.\" 4", list_number); LIT(list_number_s); @@ -208,10 +219,12 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, break; case CMARK_NODE_STRONG: - if (entering) { - LIT("\\f[B]"); - } else { - LIT("\\f[]"); + if (node->parent == NULL || node->parent->type != CMARK_NODE_STRONG) { + if (entering) { + LIT("\\f[B]"); + } else { + LIT("\\f[]"); + } } break; @@ -239,6 +252,11 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, } break; + case CMARK_NODE_FOOTNOTE_DEFINITION: + case CMARK_NODE_FOOTNOTE_REFERENCE: + // TODO + break; + default: assert(false); break; @@ -248,5 +266,9 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, } char *cmark_render_man(cmark_node *root, int options, int width) { - return cmark_render(root, options, width, S_outc, S_render_node); + return cmark_render_man_with_mem(root, options, width, cmark_node_mem(root)); +} + +char *cmark_render_man_with_mem(cmark_node *root, int options, int width, cmark_mem *mem) { + return cmark_render(mem, root, options, width, S_outc, S_render_node); } diff --git a/liteidex/src/3rdparty/cmark/src/map.c b/liteidex/src/3rdparty/cmark/src/map.c new file mode 100644 index 000000000..f60f8fc60 --- /dev/null +++ b/liteidex/src/3rdparty/cmark/src/map.c @@ -0,0 +1,129 @@ +#include "map.h" +#include "utf8.h" +#include "parser.h" + +// normalize map label: collapse internal whitespace to single space, +// remove leading/trailing whitespace, case fold +// Return NULL if the label is actually empty (i.e. composed solely from +// whitespace) +unsigned char *normalize_map_label(cmark_mem *mem, cmark_chunk *ref) { + cmark_strbuf normalized = CMARK_BUF_INIT(mem); + unsigned char *result; + + if (ref == NULL) + return NULL; + + if (ref->len == 0) + return NULL; + + cmark_utf8proc_case_fold(&normalized, ref->data, ref->len); + cmark_strbuf_trim(&normalized); + cmark_strbuf_normalize_whitespace(&normalized); + + result = cmark_strbuf_detach(&normalized); + assert(result); + + if (result[0] == '\0') { + mem->free(result); + return NULL; + } + + return result; +} + +static int +labelcmp(const unsigned char *a, const unsigned char *b) { + return strcmp((const char *)a, (const char *)b); +} + +static int +refcmp(const void *p1, const void *p2) { + cmark_map_entry *r1 = *(cmark_map_entry **)p1; + cmark_map_entry *r2 = *(cmark_map_entry **)p2; + int res = labelcmp(r1->label, r2->label); + return res ? res : ((int)r1->age - (int)r2->age); +} + +static int +refsearch(const void *label, const void *p2) { + cmark_map_entry *ref = *(cmark_map_entry **)p2; + return labelcmp((const unsigned char *)label, ref->label); +} + +static void sort_map(cmark_map *map) { + size_t i = 0, last = 0, size = map->size; + cmark_map_entry *r = map->refs, **sorted = NULL; + + sorted = (cmark_map_entry **)map->mem->calloc(size, sizeof(cmark_map_entry *)); + while (r) { + sorted[i++] = r; + r = r->next; + } + + qsort(sorted, size, sizeof(cmark_map_entry *), refcmp); + + for (i = 1; i < size; i++) { + if (labelcmp(sorted[i]->label, sorted[last]->label) != 0) + sorted[++last] = sorted[i]; + } + + map->sorted = sorted; + map->size = last + 1; +} + +cmark_map_entry *cmark_map_lookup(cmark_map *map, cmark_chunk *label) { + cmark_map_entry **ref = NULL; + cmark_map_entry *r = NULL; + unsigned char *norm; + + if (label->len < 1 || label->len > MAX_LINK_LABEL_LENGTH) + return NULL; + + if (map == NULL || !map->size) + return NULL; + + norm = normalize_map_label(map->mem, label); + if (norm == NULL) + return NULL; + + if (!map->sorted) + sort_map(map); + + ref = (cmark_map_entry **)bsearch(norm, map->sorted, map->size, sizeof(cmark_map_entry *), refsearch); + map->mem->free(norm); + + if (ref != NULL) { + r = ref[0]; + /* Check for expansion limit */ + if (r->size > map->max_ref_size - map->ref_size) + return NULL; + map->ref_size += r->size; + } + + return r; +} + +void cmark_map_free(cmark_map *map) { + cmark_map_entry *ref; + + if (map == NULL) + return; + + ref = map->refs; + while (ref) { + cmark_map_entry *next = ref->next; + map->free(map, ref); + ref = next; + } + + map->mem->free(map->sorted); + map->mem->free(map); +} + +cmark_map *cmark_map_new(cmark_mem *mem, cmark_map_free_f free) { + cmark_map *map = (cmark_map *)mem->calloc(1, sizeof(cmark_map)); + map->mem = mem; + map->free = free; + map->max_ref_size = UINT_MAX; + return map; +} diff --git a/liteidex/src/3rdparty/cmark/src/map.h b/liteidex/src/3rdparty/cmark/src/map.h new file mode 100644 index 000000000..cc9b1f30c --- /dev/null +++ b/liteidex/src/3rdparty/cmark/src/map.h @@ -0,0 +1,44 @@ +#ifndef CMARK_MAP_H +#define CMARK_MAP_H + +#include "chunk.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct cmark_map_entry { + struct cmark_map_entry *next; + unsigned char *label; + size_t age; + size_t size; +}; + +typedef struct cmark_map_entry cmark_map_entry; + +struct cmark_map; + +typedef void (*cmark_map_free_f)(struct cmark_map *, cmark_map_entry *); + +struct cmark_map { + cmark_mem *mem; + cmark_map_entry *refs; + cmark_map_entry **sorted; + size_t size; + size_t ref_size; + size_t max_ref_size; + cmark_map_free_f free; +}; + +typedef struct cmark_map cmark_map; + +unsigned char *normalize_map_label(cmark_mem *mem, cmark_chunk *ref); +cmark_map *cmark_map_new(cmark_mem *mem, cmark_map_free_f free); +void cmark_map_free(cmark_map *map); +cmark_map_entry *cmark_map_lookup(cmark_map *map, cmark_chunk *label); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/liteidex/src/3rdparty/cmark/src/node.c b/liteidex/src/3rdparty/cmark/src/node.c old mode 100755 new mode 100644 index c6c29028e..e7a9606d5 --- a/liteidex/src/3rdparty/cmark/src/node.c +++ b/liteidex/src/3rdparty/cmark/src/node.c @@ -3,55 +3,62 @@ #include "config.h" #include "node.h" +#include "syntax_extension.h" + +/** + * Expensive safety checks are off by default, but can be enabled + * by calling cmark_enable_safety_checks(). + */ +static bool enable_safety_checks = false; + +void cmark_enable_safety_checks(bool enable) { + enable_safety_checks = enable; +} static void S_node_unlink(cmark_node *node); #define NODE_MEM(node) cmark_node_mem(node) -static CMARK_INLINE bool S_is_block(cmark_node *node) { - if (node == NULL) { - return false; +void cmark_register_node_flag(cmark_node_internal_flags *flags) { + static cmark_node_internal_flags nextflag = CMARK_NODE__REGISTER_FIRST; + + // flags should be a pointer to a global variable and this function + // should only be called once to initialize its value. + if (*flags) { + fprintf(stderr, "flag initialization error in cmark_register_node_flag\n"); + abort(); } - return node->type >= CMARK_NODE_FIRST_BLOCK && - node->type <= CMARK_NODE_LAST_BLOCK; -} -static CMARK_INLINE bool S_is_inline(cmark_node *node) { - if (node == NULL) { - return false; + // Check that we haven't run out of bits. + if (nextflag == 0) { + fprintf(stderr, "too many flags in cmark_register_node_flag\n"); + abort(); } - return node->type >= CMARK_NODE_FIRST_INLINE && - node->type <= CMARK_NODE_LAST_INLINE; + + *flags = nextflag; + nextflag <<= 1; } -static bool S_can_contain(cmark_node *node, cmark_node *child) { - cmark_node *cur; +void cmark_init_standard_node_flags(void) {} - if (node == NULL || child == NULL) { - return false; - } - - // Verify that child is not an ancestor of node or equal to node. - cur = node; - do { - if (cur == child) { +bool cmark_node_can_contain_type(cmark_node *node, cmark_node_type child_type) { + if (child_type == CMARK_NODE_DOCUMENT) { return false; } - cur = cur->parent; - } while (cur != NULL); - if (child->type == CMARK_NODE_DOCUMENT) { - return false; + if (node->extension && node->extension->can_contain_func) { + return node->extension->can_contain_func(node->extension, node, child_type) != 0; } switch (node->type) { case CMARK_NODE_DOCUMENT: case CMARK_NODE_BLOCK_QUOTE: + case CMARK_NODE_FOOTNOTE_DEFINITION: case CMARK_NODE_ITEM: - return S_is_block(child) && child->type != CMARK_NODE_ITEM; + return CMARK_NODE_TYPE_BLOCK_P(child_type) && child_type != CMARK_NODE_ITEM; case CMARK_NODE_LIST: - return child->type == CMARK_NODE_ITEM; + return child_type == CMARK_NODE_ITEM; case CMARK_NODE_CUSTOM_BLOCK: return true; @@ -63,7 +70,7 @@ static bool S_can_contain(cmark_node *node, cmark_node *child) { case CMARK_NODE_LINK: case CMARK_NODE_IMAGE: case CMARK_NODE_CUSTOM_INLINE: - return S_is_inline(child); + return CMARK_NODE_TYPE_INLINE_P(child_type); default: break; @@ -72,10 +79,33 @@ static bool S_can_contain(cmark_node *node, cmark_node *child) { return false; } -cmark_node *cmark_node_new_with_mem(cmark_node_type type, cmark_mem *mem) { +static bool S_can_contain(cmark_node *node, cmark_node *child) { + if (node == NULL || child == NULL) { + return false; + } + if (NODE_MEM(node) != NODE_MEM(child)) { + return 0; + } + + if (enable_safety_checks) { + // Verify that child is not an ancestor of node or equal to node. + cmark_node *cur = node; + do { + if (cur == child) { + return false; + } + cur = cur->parent; + } while (cur != NULL); + } + + return cmark_node_can_contain_type(node, (cmark_node_type) child->type); +} + +cmark_node *cmark_node_new_with_mem_and_ext(cmark_node_type type, cmark_mem *mem, cmark_syntax_extension *extension) { cmark_node *node = (cmark_node *)mem->calloc(1, sizeof(*node)); cmark_strbuf_init(mem, &node->content, 0); node->type = (uint16_t)type; + node->extension = extension; switch (node->type) { case CMARK_NODE_HEADING: @@ -94,43 +124,70 @@ cmark_node *cmark_node_new_with_mem(cmark_node_type type, cmark_mem *mem) { break; } + if (node->extension && node->extension->opaque_alloc_func) { + node->extension->opaque_alloc_func(node->extension, mem, node); + } + return node; } +cmark_node *cmark_node_new_with_ext(cmark_node_type type, cmark_syntax_extension *extension) { + extern cmark_mem CMARK_DEFAULT_MEM_ALLOCATOR; + return cmark_node_new_with_mem_and_ext(type, &CMARK_DEFAULT_MEM_ALLOCATOR, extension); +} + +cmark_node *cmark_node_new_with_mem(cmark_node_type type, cmark_mem *mem) +{ + return cmark_node_new_with_mem_and_ext(type, mem, NULL); +} + cmark_node *cmark_node_new(cmark_node_type type) { - extern cmark_mem DEFAULT_MEM_ALLOCATOR; - return cmark_node_new_with_mem(type, &DEFAULT_MEM_ALLOCATOR); + return cmark_node_new_with_ext(type, NULL); } -// Free a cmark_node list and any children. -static void S_free_nodes(cmark_node *e) { - cmark_node *next; - while (e != NULL) { - cmark_strbuf_free(&e->content); - switch (e->type) { +static void free_node_as(cmark_node *node) { + switch (node->type) { case CMARK_NODE_CODE_BLOCK: - cmark_chunk_free(NODE_MEM(e), &e->as.code.info); - cmark_chunk_free(NODE_MEM(e), &e->as.code.literal); + cmark_chunk_free(NODE_MEM(node), &node->as.code.info); + cmark_chunk_free(NODE_MEM(node), &node->as.code.literal); break; case CMARK_NODE_TEXT: case CMARK_NODE_HTML_INLINE: case CMARK_NODE_CODE: case CMARK_NODE_HTML_BLOCK: - cmark_chunk_free(NODE_MEM(e), &e->as.literal); + case CMARK_NODE_FOOTNOTE_REFERENCE: + case CMARK_NODE_FOOTNOTE_DEFINITION: + cmark_chunk_free(NODE_MEM(node), &node->as.literal); break; case CMARK_NODE_LINK: case CMARK_NODE_IMAGE: - cmark_chunk_free(NODE_MEM(e), &e->as.link.url); - cmark_chunk_free(NODE_MEM(e), &e->as.link.title); + cmark_chunk_free(NODE_MEM(node), &node->as.link.url); + cmark_chunk_free(NODE_MEM(node), &node->as.link.title); break; case CMARK_NODE_CUSTOM_BLOCK: case CMARK_NODE_CUSTOM_INLINE: - cmark_chunk_free(NODE_MEM(e), &e->as.custom.on_enter); - cmark_chunk_free(NODE_MEM(e), &e->as.custom.on_exit); + cmark_chunk_free(NODE_MEM(node), &node->as.custom.on_enter); + cmark_chunk_free(NODE_MEM(node), &node->as.custom.on_exit); break; default: break; } +} + +// Free a cmark_node list and any children. +static void S_free_nodes(cmark_node *e) { + cmark_node *next; + while (e != NULL) { + cmark_strbuf_free(&e->content); + + if (e->user_data && e->user_data_free_func) + e->user_data_free_func(NODE_MEM(e), e->user_data); + + if (e->as.opaque && e->extension && e->extension->opaque_free_func) + e->extension->opaque_free_func(e->extension, NODE_MEM(e), e); + + free_node_as(e); + if (e->last_child) { // Splice children into list e->last_child->next = e->next; @@ -156,11 +213,38 @@ cmark_node_type cmark_node_get_type(cmark_node *node) { } } +int cmark_node_set_type(cmark_node * node, cmark_node_type type) { + cmark_node_type initial_type; + + if (type == node->type) + return 1; + + initial_type = (cmark_node_type) node->type; + node->type = (uint16_t)type; + + if (!S_can_contain(node->parent, node)) { + node->type = (uint16_t)initial_type; + return 0; + } + + /* We rollback the type to free the union members appropriately */ + node->type = (uint16_t)initial_type; + free_node_as(node); + + node->type = (uint16_t)type; + + return 1; +} + const char *cmark_node_get_type_string(cmark_node *node) { if (node == NULL) { return "NONE"; } + if (node->extension && node->extension->get_type_string_func) { + return node->extension->get_type_string_func(node->extension, node); + } + switch (node->type) { case CMARK_NODE_NONE: return "none"; @@ -249,6 +333,14 @@ cmark_node *cmark_node_last_child(cmark_node *node) { } } +cmark_node *cmark_node_parent_footnote_def(cmark_node *node) { + if (node == NULL) { + return NULL; + } else { + return node->parent_footnote_def; + } +} + void *cmark_node_get_user_data(cmark_node *node) { if (node == NULL) { return NULL; @@ -265,6 +357,15 @@ int cmark_node_set_user_data(cmark_node *node, void *user_data) { return 1; } +int cmark_node_set_user_data_free_func(cmark_node *node, + cmark_free_func free_func) { + if (node == NULL) { + return 0; + } + node->user_data_free_func = free_func; + return 1; +} + const char *cmark_node_get_literal(cmark_node *node) { if (node == NULL) { return NULL; @@ -275,6 +376,8 @@ const char *cmark_node_get_literal(cmark_node *node) { case CMARK_NODE_TEXT: case CMARK_NODE_HTML_INLINE: case CMARK_NODE_CODE: + case CMARK_NODE_FOOTNOTE_REFERENCE: + case CMARK_NODE_FOOTNOTE_DEFINITION: return cmark_chunk_to_cstr(NODE_MEM(node), &node->as.literal); case CMARK_NODE_CODE_BLOCK: @@ -297,6 +400,7 @@ int cmark_node_set_literal(cmark_node *node, const char *content) { case CMARK_NODE_TEXT: case CMARK_NODE_HTML_INLINE: case CMARK_NODE_CODE: + case CMARK_NODE_FOOTNOTE_REFERENCE: cmark_chunk_set_cstr(NODE_MEM(node), &node->as.literal, content); return 1; @@ -311,6 +415,15 @@ int cmark_node_set_literal(cmark_node *node, const char *content) { return 0; } +const char *cmark_node_get_string_content(cmark_node *node) { + return (char *) node->content.ptr; +} + +int cmark_node_set_string_content(cmark_node *node, const char *content) { + cmark_strbuf_sets(&node->content, content); + return true; +} + int cmark_node_get_heading_level(cmark_node *node) { if (node == NULL) { return 0; @@ -452,6 +565,31 @@ int cmark_node_set_list_tight(cmark_node *node, int tight) { } } +int cmark_node_get_item_index(cmark_node *node) { + if (node == NULL) { + return 0; + } + + if (node->type == CMARK_NODE_ITEM) { + return node->as.list.start; + } else { + return 0; + } +} + +int cmark_node_set_item_index(cmark_node *node, int idx) { + if (node == NULL || idx < 0) { + return 0; + } + + if (node->type == CMARK_NODE_ITEM) { + node->as.list.start = idx; + return 1; + } else { + return 0; + } +} + const char *cmark_node_get_fence_info(cmark_node *node) { if (node == NULL) { return NULL; @@ -477,6 +615,38 @@ int cmark_node_set_fence_info(cmark_node *node, const char *info) { } } +int cmark_node_get_fenced(cmark_node *node, int *length, int *offset, char *character) { + if (node == NULL) { + return 0; + } + + if (node->type == CMARK_NODE_CODE_BLOCK) { + *length = node->as.code.fence_length; + *offset = node->as.code.fence_offset; + *character = node->as.code.fence_char; + return node->as.code.fenced; + } else { + return 0; + } +} + +int cmark_node_set_fenced(cmark_node * node, int fenced, + int length, int offset, char character) { + if (node == NULL) { + return 0; + } + + if (node->type == CMARK_NODE_CODE_BLOCK) { + node->as.code.fenced = (int8_t)fenced; + node->as.code.fence_length = (uint8_t)length; + node->as.code.fence_offset = (uint8_t)offset; + node->as.code.fence_char = character; + return 1; + } else { + return 0; + } +} + const char *cmark_node_get_url(cmark_node *node) { if (node == NULL) { return NULL; @@ -609,6 +779,23 @@ int cmark_node_set_on_exit(cmark_node *node, const char *on_exit) { return 0; } +cmark_syntax_extension *cmark_node_get_syntax_extension(cmark_node *node) { + if (node == NULL) { + return NULL; + } + + return node->extension; +} + +int cmark_node_set_syntax_extension(cmark_node *node, cmark_syntax_extension *extension) { + if (node == NULL) { + return 0; + } + + node->extension = extension; + return 1; +} + int cmark_node_get_start_line(cmark_node *node) { if (node == NULL) { return 0; diff --git a/liteidex/src/3rdparty/cmark/src/node.h b/liteidex/src/3rdparty/cmark/src/node.h old mode 100755 new mode 100644 index 216323060..73ca76053 --- a/liteidex/src/3rdparty/cmark/src/node.h +++ b/liteidex/src/3rdparty/cmark/src/node.h @@ -8,7 +8,8 @@ extern "C" { #include #include -#include "cmark.h" +#include "cmark-gfm.h" +#include "cmark-gfm-extension_api.h" #include "buffer.h" #include "chunk.h" @@ -20,6 +21,7 @@ typedef struct { cmark_delim_type delimiter; unsigned char bullet_char; bool tight; + bool checked; // For task list extension } cmark_list; typedef struct { @@ -50,8 +52,14 @@ enum cmark_node__internal_flags { CMARK_NODE__OPEN = (1 << 0), CMARK_NODE__LAST_LINE_BLANK = (1 << 1), CMARK_NODE__LAST_LINE_CHECKED = (1 << 2), + + // Extensions can register custom flags by calling `cmark_register_node_flag`. + // This is the starting value for the custom flags. + CMARK_NODE__REGISTER_FIRST = (1 << 3), }; +typedef uint16_t cmark_node_internal_flags; + struct cmark_node { cmark_strbuf content; @@ -62,6 +70,7 @@ struct cmark_node { struct cmark_node *last_child; void *user_data; + cmark_free_func user_data_free_func; int start_line; int start_column; @@ -69,7 +78,24 @@ struct cmark_node { int end_column; int internal_offset; uint16_t type; - uint16_t flags; + cmark_node_internal_flags flags; + + cmark_syntax_extension *extension; + + /** + * Used during cmark_render() to cache the most recent non-NULL + * extension, if you go up the parent chain like this: + * + * node->parent->...parent->extension + */ + cmark_syntax_extension *ancestor_extension; + + union { + int ref_ix; + int def_count; + } footnote; + + cmark_node *parent_footnote_def; union { cmark_chunk literal; @@ -79,13 +105,60 @@ struct cmark_node { cmark_link link; cmark_custom custom; int html_block_type; + int cell_index; // For keeping track of TABLE_CELL table alignments + void *opaque; } as; }; +/** + * Syntax extensions can use this function to register a custom node + * flag. The flags are stored in the `flags` field of the `cmark_node` + * struct. The `flags` parameter should be the address of a global variable + * which will store the flag value. + */ +CMARK_GFM_EXPORT +void cmark_register_node_flag(cmark_node_internal_flags *flags); + +/** + * DEPRECATED. + * + * This function was added in cmark-gfm version 0.29.0.gfm.7, and was + * required to be called at program start time, which caused + * backwards-compatibility issues in applications that use cmark-gfm as a + * library. It is now a no-op. + */ +CMARK_GFM_EXPORT +void cmark_init_standard_node_flags(void); + static CMARK_INLINE cmark_mem *cmark_node_mem(cmark_node *node) { return node->content.mem; } -CMARK_EXPORT int cmark_node_check(cmark_node *node, FILE *out); +CMARK_GFM_EXPORT int cmark_node_check(cmark_node *node, FILE *out); + +static CMARK_INLINE bool CMARK_NODE_TYPE_BLOCK_P(cmark_node_type node_type) { + return (node_type & CMARK_NODE_TYPE_MASK) == CMARK_NODE_TYPE_BLOCK; +} + +static CMARK_INLINE bool CMARK_NODE_BLOCK_P(cmark_node *node) { + return node != NULL && CMARK_NODE_TYPE_BLOCK_P((cmark_node_type) node->type); +} + +static CMARK_INLINE bool CMARK_NODE_TYPE_INLINE_P(cmark_node_type node_type) { + return (node_type & CMARK_NODE_TYPE_MASK) == CMARK_NODE_TYPE_INLINE; +} + +static CMARK_INLINE bool CMARK_NODE_INLINE_P(cmark_node *node) { + return node != NULL && CMARK_NODE_TYPE_INLINE_P((cmark_node_type) node->type); +} + +CMARK_GFM_EXPORT bool cmark_node_can_contain_type(cmark_node *node, cmark_node_type child_type); + +/** + * Enable (or disable) extra safety checks. These extra checks cause + * extra performance overhead (in some cases quadratic), so they are only + * intended to be used during testing. + */ +CMARK_GFM_EXPORT void cmark_enable_safety_checks(bool enable); #ifdef __cplusplus } diff --git a/liteidex/src/3rdparty/cmark/src/parser.h b/liteidex/src/3rdparty/cmark/src/parser.h old mode 100755 new mode 100644 index f41f09960..436c53f5b --- a/liteidex/src/3rdparty/cmark/src/parser.h +++ b/liteidex/src/3rdparty/cmark/src/parser.h @@ -1,5 +1,5 @@ -#ifndef CMARK_AST_H -#define CMARK_AST_H +#ifndef CMARK_PARSER_H +#define CMARK_PARSER_H #include #include "references.h" @@ -14,23 +14,42 @@ extern "C" { struct cmark_parser { struct cmark_mem *mem; - struct cmark_reference_map *refmap; + /* A hashtable of urls in the current document for cross-references */ + struct cmark_map *refmap; + /* The root node of the parser, always a CMARK_NODE_DOCUMENT */ struct cmark_node *root; + /* The last open block after a line is fully processed */ struct cmark_node *current; + /* See the documentation for cmark_parser_get_line_number() in cmark.h */ int line_number; + /* See the documentation for cmark_parser_get_offset() in cmark.h */ bufsize_t offset; + /* See the documentation for cmark_parser_get_column() in cmark.h */ bufsize_t column; + /* See the documentation for cmark_parser_get_first_nonspace() in cmark.h */ bufsize_t first_nonspace; + /* See the documentation for cmark_parser_get_first_nonspace_column() in cmark.h */ bufsize_t first_nonspace_column; bufsize_t thematic_break_kill_pos; + /* See the documentation for cmark_parser_get_indent() in cmark.h */ int indent; + /* See the documentation for cmark_parser_is_blank() in cmark.h */ bool blank; + /* See the documentation for cmark_parser_has_partially_consumed_tab() in cmark.h */ bool partially_consumed_tab; + /* Contains the currently processed line */ cmark_strbuf curline; + /* See the documentation for cmark_parser_get_last_line_length() in cmark.h */ bufsize_t last_line_length; + /* FIXME: not sure about the difference with curline */ cmark_strbuf linebuf; + /* Options set by the user, see the Options section in cmark.h */ int options; bool last_buffer_ended_with_cr; + size_t total_size; + cmark_llist *syntax_extensions; + cmark_llist *inline_syntax_extensions; + cmark_ispunct_func backslash_ispunct; }; #ifdef __cplusplus diff --git a/liteidex/src/3rdparty/cmark/src/plaintext.c b/liteidex/src/3rdparty/cmark/src/plaintext.c new file mode 100644 index 000000000..0c7d257b3 --- /dev/null +++ b/liteidex/src/3rdparty/cmark/src/plaintext.c @@ -0,0 +1,218 @@ +#include "node.h" +#include "syntax_extension.h" +#include "render.h" + +#define OUT(s, wrap, escaping) renderer->out(renderer, node, s, wrap, escaping) +#define LIT(s) renderer->out(renderer, node, s, false, LITERAL) +#define CR() renderer->cr(renderer) +#define BLANKLINE() renderer->blankline(renderer) +#define LISTMARKER_SIZE 20 + +// Functions to convert cmark_nodes to plain text strings. + +static CMARK_INLINE void outc(cmark_renderer *renderer, cmark_node *node, + cmark_escaping escape, + int32_t c, unsigned char nextc) { + cmark_render_code_point(renderer, c); +} + +static int S_render_node(cmark_renderer *renderer, cmark_node *node, + cmark_event_type ev_type, int options) { + int list_number; + cmark_delim_type list_delim; + int i; + bool entering = (ev_type == CMARK_EVENT_ENTER); + char listmarker[LISTMARKER_SIZE]; + bool first_in_list_item; + bufsize_t marker_width; + bool allow_wrap = renderer->width > 0 && !(CMARK_OPT_NOBREAKS & options) && + !(CMARK_OPT_HARDBREAKS & options); + + // Don't adjust tight list status til we've started the list. + // Otherwise we loose the blank line between a paragraph and + // a following list. + if (entering) { + if (node->parent && node->parent->type == CMARK_NODE_ITEM) { + renderer->in_tight_list_item = node->parent->parent->as.list.tight; + } + } else { + if (node->type == CMARK_NODE_LIST) { + renderer->in_tight_list_item = + node->parent && + node->parent->type == CMARK_NODE_ITEM && + node->parent->parent->as.list.tight; + } + } + + if (node->extension && node->extension->plaintext_render_func) { + node->extension->plaintext_render_func(node->extension, renderer, node, ev_type, options); + return 1; + } + + switch (node->type) { + case CMARK_NODE_DOCUMENT: + break; + + case CMARK_NODE_BLOCK_QUOTE: + break; + + case CMARK_NODE_LIST: + if (!entering && node->next && (node->next->type == CMARK_NODE_CODE_BLOCK || + node->next->type == CMARK_NODE_LIST)) { + CR(); + } + break; + + case CMARK_NODE_ITEM: + if (cmark_node_get_list_type(node->parent) == CMARK_BULLET_LIST) { + marker_width = 4; + } else { + list_number = cmark_node_get_item_index(node); + list_delim = cmark_node_get_list_delim(node->parent); + // we ensure a width of at least 4 so + // we get nice transition from single digits + // to double + snprintf(listmarker, LISTMARKER_SIZE, "%d%s%s", list_number, + list_delim == CMARK_PAREN_DELIM ? ")" : ".", + list_number < 10 ? " " : " "); + marker_width = (bufsize_t)strlen(listmarker); + } + if (entering) { + if (cmark_node_get_list_type(node->parent) == CMARK_BULLET_LIST) { + LIT(" - "); + renderer->begin_content = true; + } else { + LIT(listmarker); + renderer->begin_content = true; + } + for (i = marker_width; i--;) { + cmark_strbuf_putc(renderer->prefix, ' '); + } + } else { + cmark_strbuf_truncate(renderer->prefix, + renderer->prefix->size - marker_width); + CR(); + } + break; + + case CMARK_NODE_HEADING: + if (entering) { + renderer->begin_content = true; + renderer->no_linebreaks = true; + } else { + renderer->no_linebreaks = false; + BLANKLINE(); + } + break; + + case CMARK_NODE_CODE_BLOCK: + first_in_list_item = node->prev == NULL && node->parent && + node->parent->type == CMARK_NODE_ITEM; + + if (!first_in_list_item) { + BLANKLINE(); + } + OUT(cmark_node_get_literal(node), false, LITERAL); + BLANKLINE(); + break; + + case CMARK_NODE_HTML_BLOCK: + break; + + case CMARK_NODE_CUSTOM_BLOCK: + break; + + case CMARK_NODE_THEMATIC_BREAK: + BLANKLINE(); + break; + + case CMARK_NODE_PARAGRAPH: + if (!entering) { + BLANKLINE(); + } + break; + + case CMARK_NODE_TEXT: + OUT(cmark_node_get_literal(node), allow_wrap, NORMAL); + break; + + case CMARK_NODE_LINEBREAK: + CR(); + break; + + case CMARK_NODE_SOFTBREAK: + if (CMARK_OPT_HARDBREAKS & options) { + CR(); + } else if (!renderer->no_linebreaks && renderer->width == 0 && + !(CMARK_OPT_HARDBREAKS & options) && + !(CMARK_OPT_NOBREAKS & options)) { + CR(); + } else { + OUT(" ", allow_wrap, LITERAL); + } + break; + + case CMARK_NODE_CODE: + OUT(cmark_node_get_literal(node), allow_wrap, LITERAL); + break; + + case CMARK_NODE_HTML_INLINE: + break; + + case CMARK_NODE_CUSTOM_INLINE: + break; + + case CMARK_NODE_STRONG: + break; + + case CMARK_NODE_EMPH: + break; + + case CMARK_NODE_LINK: + break; + + case CMARK_NODE_IMAGE: + break; + + case CMARK_NODE_FOOTNOTE_REFERENCE: + if (entering) { + LIT("[^"); + OUT(cmark_chunk_to_cstr(renderer->mem, &node->as.literal), false, LITERAL); + LIT("]"); + } + break; + + case CMARK_NODE_FOOTNOTE_DEFINITION: + if (entering) { + renderer->footnote_ix += 1; + LIT("[^"); + char n[32]; + snprintf(n, sizeof(n), "%d", renderer->footnote_ix); + OUT(n, false, LITERAL); + LIT("]: "); + + cmark_strbuf_puts(renderer->prefix, " "); + } else { + cmark_strbuf_truncate(renderer->prefix, renderer->prefix->size - 4); + } + break; + default: + assert(false); + break; + } + + return 1; +} + +char *cmark_render_plaintext(cmark_node *root, int options, int width) { + return cmark_render_plaintext_with_mem(root, options, width, cmark_node_mem(root)); +} + +char *cmark_render_plaintext_with_mem(cmark_node *root, int options, int width, cmark_mem *mem) { + if (options & CMARK_OPT_HARDBREAKS) { + // disable breaking on width, since it has + // a different meaning with OPT_HARDBREAKS + width = 0; + } + return cmark_render(mem, root, options, width, outc, S_render_node); +} diff --git a/liteidex/src/3rdparty/cmark/src/plugin.c b/liteidex/src/3rdparty/cmark/src/plugin.c new file mode 100644 index 000000000..3992fe197 --- /dev/null +++ b/liteidex/src/3rdparty/cmark/src/plugin.c @@ -0,0 +1,36 @@ +#include + +#include "plugin.h" + +extern cmark_mem CMARK_DEFAULT_MEM_ALLOCATOR; + +int cmark_plugin_register_syntax_extension(cmark_plugin * plugin, + cmark_syntax_extension * extension) { + plugin->syntax_extensions = cmark_llist_append(&CMARK_DEFAULT_MEM_ALLOCATOR, plugin->syntax_extensions, extension); + return 1; +} + +cmark_plugin * +cmark_plugin_new(void) { + cmark_plugin *res = (cmark_plugin *) CMARK_DEFAULT_MEM_ALLOCATOR.calloc(1, sizeof(cmark_plugin)); + + res->syntax_extensions = NULL; + + return res; +} + +void +cmark_plugin_free(cmark_plugin *plugin) { + cmark_llist_free_full(&CMARK_DEFAULT_MEM_ALLOCATOR, + plugin->syntax_extensions, + (cmark_free_func) cmark_syntax_extension_free); + CMARK_DEFAULT_MEM_ALLOCATOR.free(plugin); +} + +cmark_llist * +cmark_plugin_steal_syntax_extensions(cmark_plugin *plugin) { + cmark_llist *res = plugin->syntax_extensions; + + plugin->syntax_extensions = NULL; + return res; +} diff --git a/liteidex/src/3rdparty/cmark/src/plugin.h b/liteidex/src/3rdparty/cmark/src/plugin.h new file mode 100644 index 000000000..7bcbd19a2 --- /dev/null +++ b/liteidex/src/3rdparty/cmark/src/plugin.h @@ -0,0 +1,34 @@ +#ifndef CMARK_PLUGIN_H +#define CMARK_PLUGIN_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "cmark-gfm.h" +#include "cmark-gfm-extension_api.h" + +/** + * cmark_plugin: + * + * A plugin structure, which should be filled by plugin's + * init functions. + */ +struct cmark_plugin { + cmark_llist *syntax_extensions; +}; + +cmark_llist * +cmark_plugin_steal_syntax_extensions(cmark_plugin *plugin); + +cmark_plugin * +cmark_plugin_new(void); + +void +cmark_plugin_free(cmark_plugin *plugin); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/liteidex/src/3rdparty/cmark/src/references.c b/liteidex/src/3rdparty/cmark/src/references.c old mode 100755 new mode 100644 index 89f2dc8cb..0c9d3995c --- a/liteidex/src/3rdparty/cmark/src/references.c +++ b/liteidex/src/3rdparty/cmark/src/references.c @@ -1,146 +1,43 @@ -#include "cmark.h" -#include "utf8.h" +#include "cmark-gfm.h" #include "parser.h" #include "references.h" #include "inlines.h" #include "chunk.h" -static unsigned int refhash(const unsigned char *link_ref) { - unsigned int hash = 0; - - while (*link_ref) - hash = (*link_ref++) + (hash << 6) + (hash << 16) - hash; - - return hash; -} - -static void reference_free(cmark_reference_map *map, cmark_reference *ref) { +static void reference_free(cmark_map *map, cmark_map_entry *_ref) { + cmark_reference *ref = (cmark_reference *)_ref; cmark_mem *mem = map->mem; if (ref != NULL) { - mem->free(ref->label); + mem->free(ref->entry.label); cmark_chunk_free(mem, &ref->url); cmark_chunk_free(mem, &ref->title); mem->free(ref); } } -// normalize reference: collapse internal whitespace to single space, -// remove leading/trailing whitespace, case fold -// Return NULL if the reference name is actually empty (i.e. composed -// solely from whitespace) -static unsigned char *normalize_reference(cmark_mem *mem, cmark_chunk *ref) { - cmark_strbuf normalized = CMARK_BUF_INIT(mem); - unsigned char *result; - - if (ref == NULL) - return NULL; - - if (ref->len == 0) - return NULL; - - cmark_utf8proc_case_fold(&normalized, ref->data, ref->len); - cmark_strbuf_trim(&normalized); - cmark_strbuf_normalize_whitespace(&normalized); - - result = cmark_strbuf_detach(&normalized); - assert(result); - - if (result[0] == '\0') { - mem->free(result); - return NULL; - } - - return result; -} - -static void add_reference(cmark_reference_map *map, cmark_reference *ref) { - cmark_reference *t = ref->next = map->table[ref->hash % REFMAP_SIZE]; - - while (t) { - if (t->hash == ref->hash && !strcmp((char *)t->label, (char *)ref->label)) { - reference_free(map, ref); - return; - } - - t = t->next; - } - - map->table[ref->hash % REFMAP_SIZE] = ref; -} - -void cmark_reference_create(cmark_reference_map *map, cmark_chunk *label, +void cmark_reference_create(cmark_map *map, cmark_chunk *label, cmark_chunk *url, cmark_chunk *title) { cmark_reference *ref; - unsigned char *reflabel = normalize_reference(map->mem, label); + unsigned char *reflabel = normalize_map_label(map->mem, label); /* empty reference name, or composed from only whitespace */ if (reflabel == NULL) return; + assert(map->sorted == NULL); + ref = (cmark_reference *)map->mem->calloc(1, sizeof(*ref)); - ref->label = reflabel; - ref->hash = refhash(ref->label); + ref->entry.label = reflabel; ref->url = cmark_clean_url(map->mem, url); ref->title = cmark_clean_title(map->mem, title); - ref->next = NULL; - - add_reference(map, ref); -} - -// Returns reference if refmap contains a reference with matching -// label, otherwise NULL. -cmark_reference *cmark_reference_lookup(cmark_reference_map *map, - cmark_chunk *label) { - cmark_reference *ref = NULL; - unsigned char *norm; - unsigned int hash; - - if (label->len < 1 || label->len > MAX_LINK_LABEL_LENGTH) - return NULL; - - if (map == NULL) - return NULL; - - norm = normalize_reference(map->mem, label); - if (norm == NULL) - return NULL; - - hash = refhash(norm); - ref = map->table[hash % REFMAP_SIZE]; - - while (ref) { - if (ref->hash == hash && !strcmp((char *)ref->label, (char *)norm)) - break; - ref = ref->next; - } - - map->mem->free(norm); - return ref; -} - -void cmark_reference_map_free(cmark_reference_map *map) { - unsigned int i; - - if (map == NULL) - return; - - for (i = 0; i < REFMAP_SIZE; ++i) { - cmark_reference *ref = map->table[i]; - cmark_reference *next; - - while (ref) { - next = ref->next; - reference_free(map, ref); - ref = next; - } - } + ref->entry.age = map->size; + ref->entry.next = map->refs; + ref->entry.size = ref->url.len + ref->title.len; - map->mem->free(map); + map->refs = (cmark_map_entry *)ref; + map->size++; } -cmark_reference_map *cmark_reference_map_new(cmark_mem *mem) { - cmark_reference_map *map = - (cmark_reference_map *)mem->calloc(1, sizeof(cmark_reference_map)); - map->mem = mem; - return map; +cmark_map *cmark_reference_map_new(cmark_mem *mem) { + return cmark_map_new(mem, reference_free); } diff --git a/liteidex/src/3rdparty/cmark/src/references.h b/liteidex/src/3rdparty/cmark/src/references.h old mode 100755 new mode 100644 index 8d3631f34..def944dc7 --- a/liteidex/src/3rdparty/cmark/src/references.h +++ b/liteidex/src/3rdparty/cmark/src/references.h @@ -1,37 +1,23 @@ #ifndef CMARK_REFERENCES_H #define CMARK_REFERENCES_H -#include "chunk.h" +#include "map.h" #ifdef __cplusplus extern "C" { #endif -#define REFMAP_SIZE 16 - struct cmark_reference { - struct cmark_reference *next; - unsigned char *label; + cmark_map_entry entry; cmark_chunk url; cmark_chunk title; - unsigned int hash; }; typedef struct cmark_reference cmark_reference; -struct cmark_reference_map { - cmark_mem *mem; - cmark_reference *table[REFMAP_SIZE]; -}; - -typedef struct cmark_reference_map cmark_reference_map; - -cmark_reference_map *cmark_reference_map_new(cmark_mem *mem); -void cmark_reference_map_free(cmark_reference_map *map); -cmark_reference *cmark_reference_lookup(cmark_reference_map *map, - cmark_chunk *label); -extern void cmark_reference_create(cmark_reference_map *map, cmark_chunk *label, - cmark_chunk *url, cmark_chunk *title); +void cmark_reference_create(cmark_map *map, cmark_chunk *label, + cmark_chunk *url, cmark_chunk *title); +cmark_map *cmark_reference_map_new(cmark_mem *mem); #ifdef __cplusplus } diff --git a/liteidex/src/3rdparty/cmark/src/registry.c b/liteidex/src/3rdparty/cmark/src/registry.c new file mode 100644 index 000000000..f4f2040d6 --- /dev/null +++ b/liteidex/src/3rdparty/cmark/src/registry.c @@ -0,0 +1,63 @@ +#include +#include +#include + +#include "config.h" +#include "cmark-gfm.h" +#include "syntax_extension.h" +#include "registry.h" +#include "plugin.h" + +extern cmark_mem CMARK_DEFAULT_MEM_ALLOCATOR; + +static cmark_llist *syntax_extensions = NULL; + +void cmark_register_plugin(cmark_plugin_init_func reg_fn) { + cmark_plugin *plugin = cmark_plugin_new(); + + if (!reg_fn(plugin)) { + cmark_plugin_free(plugin); + return; + } + + cmark_llist *syntax_extensions_list = cmark_plugin_steal_syntax_extensions(plugin), + *it; + + for (it = syntax_extensions_list; it; it = it->next) { + syntax_extensions = cmark_llist_append(&CMARK_DEFAULT_MEM_ALLOCATOR, syntax_extensions, it->data); + } + + cmark_llist_free(&CMARK_DEFAULT_MEM_ALLOCATOR, syntax_extensions_list); + cmark_plugin_free(plugin); +} + +void cmark_release_plugins(void) { + if (syntax_extensions) { + cmark_llist_free_full( + &CMARK_DEFAULT_MEM_ALLOCATOR, + syntax_extensions, + (cmark_free_func) cmark_syntax_extension_free); + syntax_extensions = NULL; + } +} + +cmark_llist *cmark_list_syntax_extensions(cmark_mem *mem) { + cmark_llist *it; + cmark_llist *res = NULL; + + for (it = syntax_extensions; it; it = it->next) { + res = cmark_llist_append(mem, res, it->data); + } + return res; +} + +cmark_syntax_extension *cmark_find_syntax_extension(const char *name) { + cmark_llist *tmp; + + for (tmp = syntax_extensions; tmp; tmp = tmp->next) { + cmark_syntax_extension *ext = (cmark_syntax_extension *) tmp->data; + if (!strcmp(ext->name, name)) + return ext; + } + return NULL; +} diff --git a/liteidex/src/3rdparty/cmark/src/registry.h b/liteidex/src/3rdparty/cmark/src/registry.h new file mode 100644 index 000000000..fece2b63f --- /dev/null +++ b/liteidex/src/3rdparty/cmark/src/registry.h @@ -0,0 +1,24 @@ +#ifndef CMARK_REGISTRY_H +#define CMARK_REGISTRY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "cmark-gfm.h" +#include "plugin.h" + +CMARK_GFM_EXPORT +void cmark_register_plugin(cmark_plugin_init_func reg_fn); + +CMARK_GFM_EXPORT +void cmark_release_plugins(void); + +CMARK_GFM_EXPORT +cmark_llist *cmark_list_syntax_extensions(cmark_mem *mem); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/liteidex/src/3rdparty/cmark/src/render.c b/liteidex/src/3rdparty/cmark/src/render.c old mode 100755 new mode 100644 index fdd73df1c..1a0d2ae8d --- a/liteidex/src/3rdparty/cmark/src/render.c +++ b/liteidex/src/3rdparty/cmark/src/render.c @@ -1,10 +1,11 @@ #include #include "buffer.h" #include "chunk.h" -#include "cmark.h" +#include "cmark-gfm.h" #include "utf8.h" #include "render.h" #include "node.h" +#include "syntax_extension.h" static CMARK_INLINE void S_cr(cmark_renderer *renderer) { if (renderer->need_cr < 1) { @@ -18,9 +19,10 @@ static CMARK_INLINE void S_blankline(cmark_renderer *renderer) { } } -static void S_out(cmark_renderer *renderer, const char *source, bool wrap, +static void S_out(cmark_renderer *renderer, cmark_node *node, + const char *source, bool wrap, cmark_escaping escape) { - int length = strlen(source); + int length = (int)strlen(source); unsigned char nextc; int32_t c; int i = 0; @@ -29,6 +31,10 @@ static void S_out(cmark_renderer *renderer, const char *source, bool wrap, cmark_chunk remainder = cmark_chunk_literal(""); int k = renderer->buffer->size - 1; + cmark_syntax_extension *ext = node->ancestor_extension; + if (ext && !ext->commonmark_escape_func) + ext = NULL; + wrap = wrap && !renderer->no_linebreaks; if (renderer->in_tight_list_item && renderer->need_cr > 1) { @@ -63,6 +69,10 @@ static void S_out(cmark_renderer *renderer, const char *source, bool wrap, if (len == -1) { // error condition return; // return without rendering rest of string } + + if (ext && ext->commonmark_escape_func(ext, node, c)) + cmark_strbuf_putc(renderer->buffer, '\\'); + nextc = source[i + len]; if (c == 32 && wrap) { if (!renderer->begin_line) { @@ -97,13 +107,13 @@ static void S_out(cmark_renderer *renderer, const char *source, bool wrap, // we need to escape a potential list marker after // a digit: renderer->begin_content = - renderer->begin_content && cmark_isdigit(c) == 1; + renderer->begin_content && cmark_isdigit((char)c) == 1; } } else { - (renderer->outc)(renderer, escape, c, nextc); + (renderer->outc)(renderer, node, escape, c, nextc); renderer->begin_line = false; renderer->begin_content = - renderer->begin_content && cmark_isdigit(c) == 1; + renderer->begin_content && cmark_isdigit((char)c) == 1; } // If adding the character went beyond width, look for an @@ -145,13 +155,13 @@ void cmark_render_code_point(cmark_renderer *renderer, uint32_t c) { renderer->column += 1; } -char *cmark_render(cmark_node *root, int options, int width, - void (*outc)(cmark_renderer *, cmark_escaping, int32_t, +char *cmark_render(cmark_mem *mem, cmark_node *root, int options, int width, + void (*outc)(cmark_renderer *, cmark_node *, + cmark_escaping, int32_t, unsigned char), int (*render_node)(cmark_renderer *renderer, cmark_node *node, cmark_event_type ev_type, int options)) { - cmark_mem *mem = cmark_node_mem(root); cmark_strbuf pref = CMARK_BUF_INIT(mem); cmark_strbuf buf = CMARK_BUF_INIT(mem); cmark_node *cur; @@ -161,10 +171,25 @@ char *cmark_render(cmark_node *root, int options, int width, cmark_renderer renderer = {mem, &buf, &pref, 0, width, 0, 0, true, true, false, - false, outc, S_cr, S_blankline, S_out}; + false, outc, S_cr, S_blankline, S_out, + 0}; while ((ev_type = cmark_iter_next(iter)) != CMARK_EVENT_DONE) { cur = cmark_iter_get_node(iter); + if (cur->extension) { + cur->ancestor_extension = cur->extension; + } else if (cur->parent) { + cur->ancestor_extension = cur->parent->ancestor_extension; + } + if (cur->type == CMARK_NODE_ITEM) { + // Calculate the list item's index, for the benefit of output formats + // like commonmark and plaintext. + if (cur->prev) { + cmark_node_set_item_index(cur, 1 + cmark_node_get_item_index(cur->prev)); + } else { + cmark_node_set_item_index(cur, cmark_node_get_list_start(cur->parent)); + } + } if (!render_node(&renderer, cur, ev_type, options)) { // a false value causes us to skip processing // the node's contents. this is used for diff --git a/liteidex/src/3rdparty/cmark/src/render.h b/liteidex/src/3rdparty/cmark/src/render.h old mode 100755 new mode 100644 index ab1103982..4a68d1e07 --- a/liteidex/src/3rdparty/cmark/src/render.h +++ b/liteidex/src/3rdparty/cmark/src/render.h @@ -23,20 +23,33 @@ struct cmark_renderer { bool begin_content; bool no_linebreaks; bool in_tight_list_item; - void (*outc)(struct cmark_renderer *, cmark_escaping, int32_t, unsigned char); + void (*outc)(struct cmark_renderer *, cmark_node *, cmark_escaping, int32_t, unsigned char); void (*cr)(struct cmark_renderer *); void (*blankline)(struct cmark_renderer *); - void (*out)(struct cmark_renderer *, const char *, bool, cmark_escaping); + void (*out)(struct cmark_renderer *, cmark_node *, const char *, bool, cmark_escaping); + unsigned int footnote_ix; }; typedef struct cmark_renderer cmark_renderer; +struct cmark_html_renderer { + cmark_strbuf *html; + cmark_node *plain; + cmark_llist *filter_extensions; + unsigned int footnote_ix; + unsigned int written_footnote_ix; + void *opaque; +}; + +typedef struct cmark_html_renderer cmark_html_renderer; + void cmark_render_ascii(cmark_renderer *renderer, const char *s); void cmark_render_code_point(cmark_renderer *renderer, uint32_t c); -char *cmark_render(cmark_node *root, int options, int width, - void (*outc)(cmark_renderer *, cmark_escaping, int32_t, +char *cmark_render(cmark_mem *mem, cmark_node *root, int options, int width, + void (*outc)(cmark_renderer *, cmark_node *, + cmark_escaping, int32_t, unsigned char), int (*render_node)(cmark_renderer *renderer, cmark_node *node, diff --git a/liteidex/src/3rdparty/cmark/src/scanners.c b/liteidex/src/3rdparty/cmark/src/scanners.c old mode 100755 new mode 100644 index f8e6c15f2..19720601d --- a/liteidex/src/3rdparty/cmark/src/scanners.c +++ b/liteidex/src/3rdparty/cmark/src/scanners.c @@ -1,7 +1,7 @@ -/* Generated by re2c 0.16 */ -#include -#include "chunk.h" +/* Generated by re2c 3.0 */ #include "scanners.h" +#include "chunk.h" +#include bufsize_t _scan_at(bufsize_t (*scanner)(const unsigned char *), cmark_chunk *c, bufsize_t offset) { @@ -30,718 +30,718 @@ bufsize_t _scan_scheme(const unsigned char *p) { unsigned char yych; yych = *p; if (yych <= '@') - goto yy2; + goto yy1; if (yych <= 'Z') - goto yy4; + goto yy3; if (yych <= '`') - goto yy2; + goto yy1; if (yych <= 'z') - goto yy4; - yy2: + goto yy3; + yy1: ++p; - yy3 : { return 0; } - yy4: + yy2 : { return 0; } + yy3: yych = *(marker = ++p); if (yych <= '/') { if (yych <= '+') { if (yych <= '*') - goto yy3; + goto yy2; } else { if (yych <= ',') - goto yy3; + goto yy2; if (yych >= '/') - goto yy3; + goto yy2; } } else { if (yych <= 'Z') { if (yych <= '9') - goto yy5; + goto yy4; if (yych <= '@') - goto yy3; + goto yy2; } else { if (yych <= '`') - goto yy3; + goto yy2; if (yych >= '{') - goto yy3; + goto yy2; } } - yy5: + yy4: yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych == '+') - goto yy7; + goto yy6; } else { if (yych != '/') - goto yy7; + goto yy6; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; - if (yych >= 'A') goto yy7; + if (yych >= 'A') + goto yy6; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych <= 'z') - goto yy7; + goto yy6; } } - yy6: + yy5: p = marker; - goto yy3; - yy7: + goto yy2; + yy6: yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych == '+') - goto yy10; - goto yy6; + goto yy8; + goto yy5; } else { if (yych == '/') - goto yy6; - goto yy10; + goto yy5; + goto yy8; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; - goto yy10; + goto yy5; + goto yy8; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych <= 'z') - goto yy10; - goto yy6; + goto yy8; + goto yy5; } } - yy8: + yy7: ++p; { return (bufsize_t)(p - start); } - yy10: + yy8: yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy6; + goto yy5; } else { if (yych == '/') - goto yy6; + goto yy5; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy8; + goto yy7; if (yych <= '@') - goto yy6; + goto yy5; } else { if (yych <= '`') - goto yy6; + goto yy5; if (yych >= '{') - goto yy6; + goto yy5; } } - ++p; - if ((yych = *p) == ':') - goto yy8; - goto yy6; + yych = *++p; + if (yych == ':') + goto yy7; + goto yy5; } } @@ -775,814 +775,806 @@ bufsize_t _scan_autolink_uri(const unsigned char *p) { }; yych = *p; if (yych <= '@') - goto yy41; + goto yy10; if (yych <= 'Z') - goto yy43; + goto yy12; if (yych <= '`') - goto yy41; + goto yy10; if (yych <= 'z') - goto yy43; - yy41: + goto yy12; + yy10: ++p; - yy42 : { return 0; } - yy43: + yy11 : { return 0; } + yy12: yych = *(marker = ++p); if (yych <= '/') { if (yych <= '+') { if (yych <= '*') - goto yy42; + goto yy11; } else { if (yych <= ',') - goto yy42; + goto yy11; if (yych >= '/') - goto yy42; + goto yy11; } } else { if (yych <= 'Z') { if (yych <= '9') - goto yy44; + goto yy13; if (yych <= '@') - goto yy42; + goto yy11; } else { if (yych <= '`') - goto yy42; + goto yy11; if (yych >= '{') - goto yy42; + goto yy11; } } - yy44: + yy13: yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych == '+') - goto yy46; + goto yy15; } else { if (yych != '/') - goto yy46; + goto yy15; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych >= 'A') - goto yy46; + goto yy15; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych <= 'z') - goto yy46; + goto yy15; } } - yy45: + yy14: p = marker; - goto yy42; - yy46: + goto yy11; + yy15: yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych == '+') - goto yy49; - goto yy45; + goto yy17; + goto yy14; } else { if (yych == '/') - goto yy45; - goto yy49; + goto yy14; + goto yy17; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; - goto yy49; + goto yy14; + goto yy17; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych <= 'z') - goto yy49; - goto yy45; + goto yy17; + goto yy14; } } - yy47: - ++p; - yych = *p; + yy16: + yych = *++p; if (yybm[0 + yych] & 128) { - goto yy47; + goto yy16; } if (yych <= 0xEC) { if (yych <= 0xC1) { if (yych <= '<') - goto yy45; + goto yy14; if (yych <= '>') - goto yy50; - goto yy45; + goto yy18; + goto yy14; } else { if (yych <= 0xDF) - goto yy52; + goto yy19; if (yych <= 0xE0) - goto yy53; - goto yy54; + goto yy20; + goto yy21; } } else { if (yych <= 0xF0) { if (yych <= 0xED) - goto yy55; + goto yy22; if (yych <= 0xEF) - goto yy54; - goto yy56; + goto yy21; + goto yy23; } else { if (yych <= 0xF3) - goto yy57; + goto yy24; if (yych <= 0xF4) - goto yy58; - goto yy45; + goto yy25; + goto yy14; } } - yy49: + yy17: yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych == '+') - goto yy59; - goto yy45; + goto yy26; + goto yy14; } else { if (yych == '/') - goto yy45; - goto yy59; + goto yy14; + goto yy26; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; - goto yy59; + goto yy14; + goto yy26; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych <= 'z') - goto yy59; - goto yy45; + goto yy26; + goto yy14; } } - yy50: + yy18: ++p; { return (bufsize_t)(p - start); } - yy52: - ++p; - yych = *p; + yy19: + yych = *++p; if (yych <= 0x7F) - goto yy45; + goto yy14; if (yych <= 0xBF) - goto yy47; - goto yy45; - yy53: - ++p; - yych = *p; + goto yy16; + goto yy14; + yy20: + yych = *++p; if (yych <= 0x9F) - goto yy45; + goto yy14; if (yych <= 0xBF) - goto yy52; - goto yy45; - yy54: - ++p; - yych = *p; + goto yy19; + goto yy14; + yy21: + yych = *++p; if (yych <= 0x7F) - goto yy45; + goto yy14; if (yych <= 0xBF) - goto yy52; - goto yy45; - yy55: - ++p; - yych = *p; + goto yy19; + goto yy14; + yy22: + yych = *++p; if (yych <= 0x7F) - goto yy45; + goto yy14; if (yych <= 0x9F) - goto yy52; - goto yy45; - yy56: - ++p; - yych = *p; + goto yy19; + goto yy14; + yy23: + yych = *++p; if (yych <= 0x8F) - goto yy45; + goto yy14; if (yych <= 0xBF) - goto yy54; - goto yy45; - yy57: - ++p; - yych = *p; + goto yy21; + goto yy14; + yy24: + yych = *++p; if (yych <= 0x7F) - goto yy45; + goto yy14; if (yych <= 0xBF) - goto yy54; - goto yy45; - yy58: - ++p; - yych = *p; + goto yy21; + goto yy14; + yy25: + yych = *++p; if (yych <= 0x7F) - goto yy45; + goto yy14; if (yych <= 0x8F) - goto yy54; - goto yy45; - yy59: + goto yy21; + goto yy14; + yy26: yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } yych = *++p; if (yych <= '9') { if (yych <= ',') { if (yych != '+') - goto yy45; + goto yy14; } else { if (yych == '/') - goto yy45; + goto yy14; } } else { if (yych <= 'Z') { if (yych <= ':') - goto yy47; + goto yy16; if (yych <= '@') - goto yy45; + goto yy14; } else { if (yych <= '`') - goto yy45; + goto yy14; if (yych >= '{') - goto yy45; + goto yy14; } } - ++p; - if ((yych = *p) == ':') - goto yy47; - goto yy45; + yych = *++p; + if (yych == ':') + goto yy16; + goto yy14; } } @@ -1618,3366 +1610,3240 @@ bufsize_t _scan_autolink_email(const unsigned char *p) { if (yych <= '9') { if (yych <= '\'') { if (yych == '!') - goto yy91; + goto yy30; if (yych >= '#') - goto yy91; + goto yy30; } else { if (yych <= ')') - goto yy89; + goto yy28; if (yych != ',') - goto yy91; + goto yy30; } } else { if (yych <= '?') { if (yych == '=') - goto yy91; + goto yy30; if (yych >= '?') - goto yy91; + goto yy30; } else { if (yych <= 'Z') { if (yych >= 'A') - goto yy91; + goto yy30; } else { if (yych <= ']') - goto yy89; + goto yy28; if (yych <= '~') - goto yy91; + goto yy30; } } } - yy89: + yy28: ++p; - yy90 : { return 0; } - yy91: + yy29 : { return 0; } + yy30: yych = *(marker = ++p); if (yych <= ',') { if (yych <= '"') { if (yych == '!') - goto yy93; - goto yy90; + goto yy32; + goto yy29; } else { if (yych <= '\'') - goto yy93; + goto yy32; if (yych <= ')') - goto yy90; + goto yy29; if (yych <= '+') - goto yy93; - goto yy90; + goto yy32; + goto yy29; } } else { if (yych <= '>') { if (yych <= '9') - goto yy93; + goto yy32; if (yych == '=') - goto yy93; - goto yy90; + goto yy32; + goto yy29; } else { if (yych <= 'Z') - goto yy93; + goto yy32; if (yych <= ']') - goto yy90; + goto yy29; if (yych <= '~') - goto yy93; - goto yy90; + goto yy32; + goto yy29; } } - yy92: - ++p; - yych = *p; - yy93: + yy31: + yych = *++p; + yy32: if (yybm[0 + yych] & 128) { - goto yy92; + goto yy31; } if (yych <= '>') - goto yy94; + goto yy33; if (yych <= '@') - goto yy95; - yy94: + goto yy34; + yy33: p = marker; - goto yy90; - yy95: - ++p; - yych = *p; + goto yy29; + yy34: + yych = *++p; if (yych <= '@') { if (yych <= '/') - goto yy94; + goto yy33; if (yych >= ':') - goto yy94; + goto yy33; } else { if (yych <= 'Z') - goto yy96; + goto yy35; if (yych <= '`') - goto yy94; + goto yy33; if (yych >= '{') - goto yy94; + goto yy33; } - yy96: - ++p; - yych = *p; + yy35: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy98; - goto yy94; + goto yy36; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy98; + goto yy33; + goto yy36; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy98; - goto yy94; + goto yy36; + goto yy33; } } - ++p; - yych = *p; + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy101; + goto yy38; if (yych <= '/') - goto yy94; - goto yy102; + goto yy33; + goto yy39; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy102; + goto yy33; + goto yy39; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy102; - goto yy94; + goto yy39; + goto yy33; } } - yy98: - ++p; - yych = *p; + yy36: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych <= '-') - goto yy101; - goto yy95; + goto yy38; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy102; - goto yy94; + goto yy39; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy102; + goto yy33; + goto yy39; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy102; - goto yy94; + goto yy39; + goto yy33; } } - yy99: + yy37: ++p; { return (bufsize_t)(p - start); } - yy101: - ++p; - yych = *p; + yy38: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy103; + goto yy40; if (yych <= '/') - goto yy94; - goto yy104; + goto yy33; + goto yy41; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy104; + goto yy33; + goto yy41; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy104; - goto yy94; + goto yy41; + goto yy33; } } - yy102: - ++p; - yych = *p; + yy39: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy104; - goto yy94; + goto yy41; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy104; + goto yy33; + goto yy41; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy104; - goto yy94; + goto yy41; + goto yy33; } } - yy103: - ++p; - yych = *p; + yy40: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy105; + goto yy42; if (yych <= '/') - goto yy94; - goto yy106; + goto yy33; + goto yy43; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy106; + goto yy33; + goto yy43; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy106; - goto yy94; + goto yy43; + goto yy33; } } - yy104: - ++p; - yych = *p; + yy41: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy106; - goto yy94; + goto yy43; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy106; + goto yy33; + goto yy43; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy106; - goto yy94; + goto yy43; + goto yy33; } } - yy105: - ++p; - yych = *p; + yy42: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy107; + goto yy44; if (yych <= '/') - goto yy94; - goto yy108; + goto yy33; + goto yy45; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy108; + goto yy33; + goto yy45; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy108; - goto yy94; + goto yy45; + goto yy33; } } - yy106: - ++p; - yych = *p; + yy43: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy108; - goto yy94; + goto yy45; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy108; + goto yy33; + goto yy45; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy108; - goto yy94; + goto yy45; + goto yy33; } } - yy107: - ++p; - yych = *p; + yy44: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy109; + goto yy46; if (yych <= '/') - goto yy94; - goto yy110; + goto yy33; + goto yy47; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy110; + goto yy33; + goto yy47; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy110; - goto yy94; + goto yy47; + goto yy33; } } - yy108: - ++p; - yych = *p; + yy45: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy110; - goto yy94; + goto yy47; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy110; + goto yy33; + goto yy47; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy110; - goto yy94; + goto yy47; + goto yy33; } } - yy109: - ++p; - yych = *p; + yy46: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy111; + goto yy48; if (yych <= '/') - goto yy94; - goto yy112; + goto yy33; + goto yy49; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy112; + goto yy33; + goto yy49; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy112; - goto yy94; + goto yy49; + goto yy33; } } - yy110: - ++p; - yych = *p; + yy47: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy112; - goto yy94; + goto yy49; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy112; + goto yy33; + goto yy49; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy112; - goto yy94; + goto yy49; + goto yy33; } } - yy111: - ++p; - yych = *p; + yy48: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy113; + goto yy50; if (yych <= '/') - goto yy94; - goto yy114; + goto yy33; + goto yy51; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy114; + goto yy33; + goto yy51; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy114; - goto yy94; + goto yy51; + goto yy33; } } - yy112: - ++p; - yych = *p; + yy49: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy114; - goto yy94; + goto yy51; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy114; + goto yy33; + goto yy51; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy114; - goto yy94; + goto yy51; + goto yy33; } } - yy113: - ++p; - yych = *p; + yy50: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy115; + goto yy52; if (yych <= '/') - goto yy94; - goto yy116; + goto yy33; + goto yy53; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy116; + goto yy33; + goto yy53; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy116; - goto yy94; + goto yy53; + goto yy33; } } - yy114: - ++p; - yych = *p; + yy51: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy116; - goto yy94; + goto yy53; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy116; + goto yy33; + goto yy53; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy116; - goto yy94; + goto yy53; + goto yy33; } } - yy115: - ++p; - yych = *p; + yy52: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy117; + goto yy54; if (yych <= '/') - goto yy94; - goto yy118; + goto yy33; + goto yy55; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy118; + goto yy33; + goto yy55; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy118; - goto yy94; + goto yy55; + goto yy33; } } - yy116: - ++p; - yych = *p; + yy53: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy118; - goto yy94; + goto yy55; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy118; + goto yy33; + goto yy55; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy118; - goto yy94; + goto yy55; + goto yy33; } } - yy117: - ++p; - yych = *p; + yy54: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy119; + goto yy56; if (yych <= '/') - goto yy94; - goto yy120; + goto yy33; + goto yy57; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy120; + goto yy33; + goto yy57; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy120; - goto yy94; + goto yy57; + goto yy33; } } - yy118: - ++p; - yych = *p; + yy55: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy120; - goto yy94; + goto yy57; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy120; + goto yy33; + goto yy57; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy120; - goto yy94; + goto yy57; + goto yy33; } } - yy119: - ++p; - yych = *p; + yy56: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy121; + goto yy58; if (yych <= '/') - goto yy94; - goto yy122; + goto yy33; + goto yy59; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy122; + goto yy33; + goto yy59; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy122; - goto yy94; + goto yy59; + goto yy33; } } - yy120: - ++p; - yych = *p; + yy57: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy122; - goto yy94; + goto yy59; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy122; + goto yy33; + goto yy59; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy122; - goto yy94; + goto yy59; + goto yy33; } } - yy121: - ++p; - yych = *p; + yy58: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy123; + goto yy60; if (yych <= '/') - goto yy94; - goto yy124; + goto yy33; + goto yy61; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy124; + goto yy33; + goto yy61; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy124; - goto yy94; + goto yy61; + goto yy33; } } - yy122: - ++p; - yych = *p; + yy59: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy124; - goto yy94; + goto yy61; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy124; + goto yy33; + goto yy61; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy124; - goto yy94; + goto yy61; + goto yy33; } } - yy123: - ++p; - yych = *p; + yy60: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy125; + goto yy62; if (yych <= '/') - goto yy94; - goto yy126; + goto yy33; + goto yy63; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy126; + goto yy33; + goto yy63; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy126; - goto yy94; + goto yy63; + goto yy33; } } - yy124: - ++p; - yych = *p; + yy61: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy126; - goto yy94; + goto yy63; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy126; + goto yy33; + goto yy63; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy126; - goto yy94; + goto yy63; + goto yy33; } } - yy125: - ++p; - yych = *p; + yy62: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy127; + goto yy64; if (yych <= '/') - goto yy94; - goto yy128; + goto yy33; + goto yy65; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy128; + goto yy33; + goto yy65; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy128; - goto yy94; + goto yy65; + goto yy33; } } - yy126: - ++p; - yych = *p; + yy63: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy128; - goto yy94; + goto yy65; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy128; + goto yy33; + goto yy65; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy128; - goto yy94; + goto yy65; + goto yy33; } } - yy127: - ++p; - yych = *p; + yy64: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy129; + goto yy66; if (yych <= '/') - goto yy94; - goto yy130; + goto yy33; + goto yy67; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy130; + goto yy33; + goto yy67; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy130; - goto yy94; + goto yy67; + goto yy33; } } - yy128: - ++p; - yych = *p; + yy65: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy130; - goto yy94; + goto yy67; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy130; + goto yy33; + goto yy67; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy130; - goto yy94; + goto yy67; + goto yy33; } } - yy129: - ++p; - yych = *p; + yy66: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy131; + goto yy68; if (yych <= '/') - goto yy94; - goto yy132; + goto yy33; + goto yy69; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy132; + goto yy33; + goto yy69; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy132; - goto yy94; + goto yy69; + goto yy33; } } - yy130: - ++p; - yych = *p; + yy67: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy132; - goto yy94; + goto yy69; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy132; + goto yy33; + goto yy69; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy132; - goto yy94; + goto yy69; + goto yy33; } } - yy131: - ++p; - yych = *p; + yy68: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy133; + goto yy70; if (yych <= '/') - goto yy94; - goto yy134; + goto yy33; + goto yy71; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy134; + goto yy33; + goto yy71; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy134; - goto yy94; + goto yy71; + goto yy33; } } - yy132: - ++p; - yych = *p; + yy69: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy134; - goto yy94; + goto yy71; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy134; + goto yy33; + goto yy71; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy134; - goto yy94; + goto yy71; + goto yy33; } } - yy133: - ++p; - yych = *p; + yy70: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy135; + goto yy72; if (yych <= '/') - goto yy94; - goto yy136; + goto yy33; + goto yy73; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy136; + goto yy33; + goto yy73; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy136; - goto yy94; + goto yy73; + goto yy33; } } - yy134: - ++p; - yych = *p; + yy71: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy136; - goto yy94; + goto yy73; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy136; + goto yy33; + goto yy73; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy136; - goto yy94; + goto yy73; + goto yy33; } } - yy135: - ++p; - yych = *p; + yy72: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy137; + goto yy74; if (yych <= '/') - goto yy94; - goto yy138; + goto yy33; + goto yy75; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy138; + goto yy33; + goto yy75; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy138; - goto yy94; + goto yy75; + goto yy33; } } - yy136: - ++p; - yych = *p; + yy73: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy138; - goto yy94; + goto yy75; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy138; + goto yy33; + goto yy75; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy138; - goto yy94; + goto yy75; + goto yy33; } } - yy137: - ++p; - yych = *p; + yy74: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy139; + goto yy76; if (yych <= '/') - goto yy94; - goto yy140; + goto yy33; + goto yy77; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy140; + goto yy33; + goto yy77; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy140; - goto yy94; + goto yy77; + goto yy33; } } - yy138: - ++p; - yych = *p; + yy75: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy140; - goto yy94; + goto yy77; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy140; + goto yy33; + goto yy77; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy140; - goto yy94; + goto yy77; + goto yy33; } } - yy139: - ++p; - yych = *p; + yy76: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy141; + goto yy78; if (yych <= '/') - goto yy94; - goto yy142; + goto yy33; + goto yy79; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy142; + goto yy33; + goto yy79; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy142; - goto yy94; + goto yy79; + goto yy33; } } - yy140: - ++p; - yych = *p; + yy77: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy142; - goto yy94; + goto yy79; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy142; + goto yy33; + goto yy79; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy142; - goto yy94; + goto yy79; + goto yy33; } } - yy141: - ++p; - yych = *p; + yy78: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy143; + goto yy80; if (yych <= '/') - goto yy94; - goto yy144; + goto yy33; + goto yy81; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy144; + goto yy33; + goto yy81; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy144; - goto yy94; + goto yy81; + goto yy33; } } - yy142: - ++p; - yych = *p; + yy79: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy144; - goto yy94; + goto yy81; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy144; + goto yy33; + goto yy81; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy144; - goto yy94; + goto yy81; + goto yy33; } } - yy143: - ++p; - yych = *p; + yy80: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy145; + goto yy82; if (yych <= '/') - goto yy94; - goto yy146; + goto yy33; + goto yy83; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy146; + goto yy33; + goto yy83; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy146; - goto yy94; + goto yy83; + goto yy33; } } - yy144: - ++p; - yych = *p; + yy81: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy146; - goto yy94; + goto yy83; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy146; + goto yy33; + goto yy83; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy146; - goto yy94; + goto yy83; + goto yy33; } } - yy145: - ++p; - yych = *p; + yy82: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy147; + goto yy84; if (yych <= '/') - goto yy94; - goto yy148; + goto yy33; + goto yy85; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy148; + goto yy33; + goto yy85; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy148; - goto yy94; + goto yy85; + goto yy33; } } - yy146: - ++p; - yych = *p; + yy83: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy148; - goto yy94; + goto yy85; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy148; + goto yy33; + goto yy85; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy148; - goto yy94; + goto yy85; + goto yy33; } } - yy147: - ++p; - yych = *p; + yy84: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy149; + goto yy86; if (yych <= '/') - goto yy94; - goto yy150; + goto yy33; + goto yy87; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy150; + goto yy33; + goto yy87; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy150; - goto yy94; + goto yy87; + goto yy33; } } - yy148: - ++p; - yych = *p; + yy85: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy150; - goto yy94; + goto yy87; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy150; + goto yy33; + goto yy87; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy150; - goto yy94; + goto yy87; + goto yy33; } } - yy149: - ++p; - yych = *p; + yy86: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy151; + goto yy88; if (yych <= '/') - goto yy94; - goto yy152; + goto yy33; + goto yy89; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy152; + goto yy33; + goto yy89; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy152; - goto yy94; + goto yy89; + goto yy33; } } - yy150: - ++p; - yych = *p; + yy87: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy152; - goto yy94; + goto yy89; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy152; + goto yy33; + goto yy89; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy152; - goto yy94; + goto yy89; + goto yy33; } } - yy151: - ++p; - yych = *p; + yy88: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy153; + goto yy90; if (yych <= '/') - goto yy94; - goto yy154; + goto yy33; + goto yy91; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy154; + goto yy33; + goto yy91; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy154; - goto yy94; + goto yy91; + goto yy33; } } - yy152: - ++p; - yych = *p; + yy89: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy154; - goto yy94; + goto yy91; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy154; + goto yy33; + goto yy91; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy154; - goto yy94; + goto yy91; + goto yy33; } } - yy153: - ++p; - yych = *p; + yy90: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy155; + goto yy92; if (yych <= '/') - goto yy94; - goto yy156; + goto yy33; + goto yy93; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy156; + goto yy33; + goto yy93; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy156; - goto yy94; + goto yy93; + goto yy33; } } - yy154: - ++p; - yych = *p; + yy91: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy156; - goto yy94; + goto yy93; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy156; + goto yy33; + goto yy93; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy156; - goto yy94; + goto yy93; + goto yy33; } } - yy155: - ++p; - yych = *p; + yy92: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy157; - if (yych <= '/') goto yy94; - goto yy158; + if (yych <= '/') + goto yy33; + goto yy95; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy158; + goto yy33; + goto yy95; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy158; - goto yy94; + goto yy95; + goto yy33; } } - yy156: - ++p; - yych = *p; + yy93: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy158; - goto yy94; + goto yy95; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy158; + goto yy33; + goto yy95; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy158; - goto yy94; + goto yy95; + goto yy33; } } - yy157: - ++p; - yych = *p; + yy94: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy159; + goto yy96; if (yych <= '/') - goto yy94; - goto yy160; + goto yy33; + goto yy97; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy160; + goto yy33; + goto yy97; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy160; - goto yy94; + goto yy97; + goto yy33; } } - yy158: - ++p; - yych = *p; + yy95: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy160; - goto yy94; + goto yy97; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy160; + goto yy33; + goto yy97; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy160; - goto yy94; + goto yy97; + goto yy33; } } - yy159: - ++p; - yych = *p; + yy96: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy161; + goto yy98; if (yych <= '/') - goto yy94; - goto yy162; + goto yy33; + goto yy99; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy162; + goto yy33; + goto yy99; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy162; - goto yy94; + goto yy99; + goto yy33; } } - yy160: - ++p; - yych = *p; + yy97: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy162; - goto yy94; + goto yy99; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy162; + goto yy33; + goto yy99; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy162; - goto yy94; + goto yy99; + goto yy33; } } - yy161: - ++p; - yych = *p; + yy98: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy163; + goto yy100; if (yych <= '/') - goto yy94; - goto yy164; + goto yy33; + goto yy101; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy164; + goto yy33; + goto yy101; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy164; - goto yy94; + goto yy101; + goto yy33; } } - yy162: - ++p; - yych = *p; + yy99: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy164; - goto yy94; + goto yy101; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy164; + goto yy33; + goto yy101; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy164; - goto yy94; + goto yy101; + goto yy33; } } - yy163: - ++p; - yych = *p; + yy100: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy165; + goto yy102; if (yych <= '/') - goto yy94; - goto yy166; + goto yy33; + goto yy103; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy166; + goto yy33; + goto yy103; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy166; - goto yy94; + goto yy103; + goto yy33; } } - yy164: - ++p; - yych = *p; + yy101: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy166; - goto yy94; + goto yy103; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy166; + goto yy33; + goto yy103; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy166; - goto yy94; + goto yy103; + goto yy33; } } - yy165: - ++p; - yych = *p; + yy102: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy167; + goto yy104; if (yych <= '/') - goto yy94; - goto yy168; + goto yy33; + goto yy105; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy168; + goto yy33; + goto yy105; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy168; - goto yy94; + goto yy105; + goto yy33; } } - yy166: - ++p; - yych = *p; + yy103: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy168; - goto yy94; + goto yy105; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy168; + goto yy33; + goto yy105; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy168; - goto yy94; + goto yy105; + goto yy33; } } - yy167: - ++p; - yych = *p; + yy104: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy169; + goto yy106; if (yych <= '/') - goto yy94; - goto yy170; + goto yy33; + goto yy107; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy170; + goto yy33; + goto yy107; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy170; - goto yy94; + goto yy107; + goto yy33; } } - yy168: - ++p; - yych = *p; + yy105: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy170; - goto yy94; + goto yy107; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy170; + goto yy33; + goto yy107; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy170; - goto yy94; + goto yy107; + goto yy33; } } - yy169: - ++p; - yych = *p; + yy106: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy171; + goto yy108; if (yych <= '/') - goto yy94; - goto yy172; + goto yy33; + goto yy109; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy172; + goto yy33; + goto yy109; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy172; - goto yy94; + goto yy109; + goto yy33; } } - yy170: - ++p; - yych = *p; + yy107: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy172; - goto yy94; + goto yy109; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy172; + goto yy33; + goto yy109; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy172; - goto yy94; + goto yy109; + goto yy33; } } - yy171: - ++p; - yych = *p; + yy108: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy173; + goto yy110; if (yych <= '/') - goto yy94; - goto yy174; + goto yy33; + goto yy111; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy174; + goto yy33; + goto yy111; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy174; - goto yy94; + goto yy111; + goto yy33; } } - yy172: - ++p; - yych = *p; + yy109: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy174; - goto yy94; + goto yy111; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy174; + goto yy33; + goto yy111; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy174; - goto yy94; + goto yy111; + goto yy33; } } - yy173: - ++p; - yych = *p; + yy110: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy175; + goto yy112; if (yych <= '/') - goto yy94; - goto yy176; + goto yy33; + goto yy113; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy176; + goto yy33; + goto yy113; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy176; - goto yy94; + goto yy113; + goto yy33; } } - yy174: - ++p; - yych = *p; + yy111: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy176; - goto yy94; + goto yy113; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy176; + goto yy33; + goto yy113; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy176; - goto yy94; + goto yy113; + goto yy33; } } - yy175: - ++p; - yych = *p; + yy112: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy177; + goto yy114; if (yych <= '/') - goto yy94; - goto yy178; + goto yy33; + goto yy115; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy178; + goto yy33; + goto yy115; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy178; - goto yy94; + goto yy115; + goto yy33; } } - yy176: - ++p; - yych = *p; + yy113: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy178; - goto yy94; + goto yy115; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy178; + goto yy33; + goto yy115; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy178; - goto yy94; + goto yy115; + goto yy33; } } - yy177: - ++p; - yych = *p; + yy114: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy179; + goto yy116; if (yych <= '/') - goto yy94; - goto yy180; + goto yy33; + goto yy117; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy180; + goto yy33; + goto yy117; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy180; - goto yy94; + goto yy117; + goto yy33; } } - yy178: - ++p; - yych = *p; + yy115: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy180; - goto yy94; + goto yy117; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy180; + goto yy33; + goto yy117; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy180; - goto yy94; + goto yy117; + goto yy33; } } - yy179: - ++p; - yych = *p; + yy116: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy181; + goto yy118; if (yych <= '/') - goto yy94; - goto yy182; + goto yy33; + goto yy119; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy182; + goto yy33; + goto yy119; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy182; - goto yy94; + goto yy119; + goto yy33; } } - yy180: - ++p; - yych = *p; + yy117: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy182; - goto yy94; + goto yy119; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy182; + goto yy33; + goto yy119; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy182; - goto yy94; + goto yy119; + goto yy33; } } - yy181: - ++p; - yych = *p; + yy118: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy183; + goto yy120; if (yych <= '/') - goto yy94; - goto yy184; + goto yy33; + goto yy121; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy184; + goto yy33; + goto yy121; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy184; - goto yy94; + goto yy121; + goto yy33; } } - yy182: - ++p; - yych = *p; + yy119: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy184; - goto yy94; + goto yy121; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy184; + goto yy33; + goto yy121; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy184; - goto yy94; + goto yy121; + goto yy33; } } - yy183: - ++p; - yych = *p; + yy120: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy185; + goto yy122; if (yych <= '/') - goto yy94; - goto yy186; + goto yy33; + goto yy123; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy186; + goto yy33; + goto yy123; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy186; - goto yy94; + goto yy123; + goto yy33; } } - yy184: - ++p; - yych = *p; + yy121: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy186; - goto yy94; + goto yy123; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy186; + goto yy33; + goto yy123; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy186; - goto yy94; + goto yy123; + goto yy33; } } - yy185: - ++p; - yych = *p; + yy122: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy187; + goto yy124; if (yych <= '/') - goto yy94; - goto yy188; + goto yy33; + goto yy125; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy188; + goto yy33; + goto yy125; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy188; - goto yy94; + goto yy125; + goto yy33; } } - yy186: - ++p; - yych = *p; + yy123: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy188; - goto yy94; + goto yy125; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy188; + goto yy33; + goto yy125; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy188; - goto yy94; + goto yy125; + goto yy33; } } - yy187: - ++p; - yych = *p; + yy124: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy189; + goto yy126; if (yych <= '/') - goto yy94; - goto yy190; + goto yy33; + goto yy127; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy190; + goto yy33; + goto yy127; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy190; - goto yy94; + goto yy127; + goto yy33; } } - yy188: - ++p; - yych = *p; + yy125: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy190; - goto yy94; + goto yy127; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy190; + goto yy33; + goto yy127; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy190; - goto yy94; + goto yy127; + goto yy33; } } - yy189: - ++p; - yych = *p; + yy126: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy191; + goto yy128; if (yych <= '/') - goto yy94; - goto yy192; + goto yy33; + goto yy129; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy192; + goto yy33; + goto yy129; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy192; - goto yy94; + goto yy129; + goto yy33; } } - yy190: - ++p; - yych = *p; + yy127: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy192; - goto yy94; + goto yy129; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy192; + goto yy33; + goto yy129; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy192; - goto yy94; + goto yy129; + goto yy33; } } - yy191: - ++p; - yych = *p; + yy128: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy193; + goto yy130; if (yych <= '/') - goto yy94; - goto yy194; + goto yy33; + goto yy131; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy194; + goto yy33; + goto yy131; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy194; - goto yy94; + goto yy131; + goto yy33; } } - yy192: - ++p; - yych = *p; + yy129: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy194; - goto yy94; + goto yy131; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy194; + goto yy33; + goto yy131; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy194; - goto yy94; + goto yy131; + goto yy33; } } - yy193: - ++p; - yych = *p; + yy130: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy195; + goto yy132; if (yych <= '/') - goto yy94; - goto yy196; + goto yy33; + goto yy133; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy196; + goto yy33; + goto yy133; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy196; - goto yy94; + goto yy133; + goto yy33; } } - yy194: - ++p; - yych = *p; + yy131: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy196; - goto yy94; + goto yy133; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy196; + goto yy33; + goto yy133; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy196; - goto yy94; + goto yy133; + goto yy33; } } - yy195: - ++p; - yych = *p; + yy132: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy197; + goto yy134; if (yych <= '/') - goto yy94; - goto yy198; + goto yy33; + goto yy135; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy198; + goto yy33; + goto yy135; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy198; - goto yy94; + goto yy135; + goto yy33; } } - yy196: - ++p; - yych = *p; + yy133: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy198; - goto yy94; + goto yy135; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy198; + goto yy33; + goto yy135; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy198; - goto yy94; + goto yy135; + goto yy33; } } - yy197: - ++p; - yych = *p; + yy134: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy199; + goto yy136; if (yych <= '/') - goto yy94; - goto yy200; + goto yy33; + goto yy137; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy200; + goto yy33; + goto yy137; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy200; - goto yy94; + goto yy137; + goto yy33; } } - yy198: - ++p; - yych = *p; + yy135: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy200; - goto yy94; + goto yy137; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy200; + goto yy33; + goto yy137; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy200; - goto yy94; + goto yy137; + goto yy33; } } - yy199: - ++p; - yych = *p; + yy136: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy201; + goto yy138; if (yych <= '/') - goto yy94; - goto yy202; + goto yy33; + goto yy139; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy202; + goto yy33; + goto yy139; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy202; - goto yy94; + goto yy139; + goto yy33; } } - yy200: - ++p; - yych = *p; + yy137: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy202; - goto yy94; + goto yy139; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy202; + goto yy33; + goto yy139; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy202; - goto yy94; + goto yy139; + goto yy33; } } - yy201: - ++p; - yych = *p; + yy138: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy203; + goto yy140; if (yych <= '/') - goto yy94; - goto yy204; + goto yy33; + goto yy141; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy204; + goto yy33; + goto yy141; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy204; - goto yy94; + goto yy141; + goto yy33; } } - yy202: - ++p; - yych = *p; + yy139: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy204; - goto yy94; + goto yy141; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy204; + goto yy33; + goto yy141; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy204; - goto yy94; + goto yy141; + goto yy33; } } - yy203: - ++p; - yych = *p; + yy140: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy205; + goto yy142; if (yych <= '/') - goto yy94; - goto yy206; + goto yy33; + goto yy143; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy206; + goto yy33; + goto yy143; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy206; - goto yy94; + goto yy143; + goto yy33; } } - yy204: - ++p; - yych = *p; + yy141: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy206; - goto yy94; + goto yy143; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy206; + goto yy33; + goto yy143; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy206; - goto yy94; + goto yy143; + goto yy33; } } - yy205: - ++p; - yych = *p; + yy142: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy207; + goto yy144; if (yych <= '/') - goto yy94; - goto yy208; + goto yy33; + goto yy145; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy208; + goto yy33; + goto yy145; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy208; - goto yy94; + goto yy145; + goto yy33; } } - yy206: - ++p; - yych = *p; + yy143: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy208; - goto yy94; + goto yy145; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy208; + goto yy33; + goto yy145; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy208; - goto yy94; + goto yy145; + goto yy33; } } - yy207: - ++p; - yych = *p; + yy144: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy209; + goto yy146; if (yych <= '/') - goto yy94; - goto yy210; + goto yy33; + goto yy147; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy210; + goto yy33; + goto yy147; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy210; - goto yy94; + goto yy147; + goto yy33; } } - yy208: - ++p; - yych = *p; + yy145: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy210; - goto yy94; + goto yy147; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy210; + goto yy33; + goto yy147; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy210; - goto yy94; + goto yy147; + goto yy33; } } - yy209: - ++p; - yych = *p; + yy146: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy211; + goto yy148; if (yych <= '/') - goto yy94; - goto yy212; + goto yy33; + goto yy149; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy212; + goto yy33; + goto yy149; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy212; - goto yy94; + goto yy149; + goto yy33; } } - yy210: - ++p; - yych = *p; + yy147: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy212; - goto yy94; + goto yy149; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy212; + goto yy33; + goto yy149; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy212; - goto yy94; + goto yy149; + goto yy33; } } - yy211: - ++p; - yych = *p; + yy148: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy213; + goto yy150; if (yych <= '/') - goto yy94; - goto yy214; + goto yy33; + goto yy151; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy214; + goto yy33; + goto yy151; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy214; - goto yy94; + goto yy151; + goto yy33; } } - yy212: - ++p; - yych = *p; + yy149: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy214; - goto yy94; + goto yy151; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy214; + goto yy33; + goto yy151; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy214; - goto yy94; + goto yy151; + goto yy33; } } - yy213: - ++p; - yych = *p; + yy150: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy215; + goto yy152; if (yych <= '/') - goto yy94; - goto yy216; + goto yy33; + goto yy153; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy216; + goto yy33; + goto yy153; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy216; - goto yy94; + goto yy153; + goto yy33; } } - yy214: - ++p; - yych = *p; + yy151: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy216; - goto yy94; + goto yy153; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy216; + goto yy33; + goto yy153; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy216; - goto yy94; + goto yy153; + goto yy33; } } - yy215: - ++p; - yych = *p; + yy152: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy217; + goto yy154; if (yych <= '/') - goto yy94; - goto yy218; + goto yy33; + goto yy155; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy218; + goto yy33; + goto yy155; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy218; - goto yy94; + goto yy155; + goto yy33; } } - yy216: - ++p; - yych = *p; + yy153: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy218; - goto yy94; + goto yy155; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy218; + goto yy33; + goto yy155; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy218; - goto yy94; + goto yy155; + goto yy33; } } - yy217: - ++p; - yych = *p; + yy154: + yych = *++p; if (yych <= '9') { if (yych == '-') - goto yy219; + goto yy156; if (yych <= '/') - goto yy94; - goto yy220; + goto yy33; + goto yy157; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy94; - goto yy220; + goto yy33; + goto yy157; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy220; - goto yy94; + goto yy157; + goto yy33; } } - yy218: - ++p; - yych = *p; + yy155: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= ',') - goto yy94; + goto yy33; if (yych >= '.') - goto yy95; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy220; - goto yy94; + goto yy157; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; - goto yy220; + goto yy33; + goto yy157; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy220; - goto yy94; + goto yy157; + goto yy33; } } - yy219: - ++p; - yych = *p; + yy156: + yych = *++p; if (yych <= '@') { if (yych <= '/') - goto yy94; + goto yy33; if (yych <= '9') - goto yy221; - goto yy94; + goto yy158; + goto yy33; } else { if (yych <= 'Z') - goto yy221; + goto yy158; if (yych <= '`') - goto yy94; + goto yy33; if (yych <= 'z') - goto yy221; - goto yy94; + goto yy158; + goto yy33; } - yy220: - ++p; - yych = *p; + yy157: + yych = *++p; if (yych <= '=') { if (yych <= '.') { if (yych <= '-') - goto yy94; - goto yy95; + goto yy33; + goto yy34; } else { if (yych <= '/') - goto yy94; + goto yy33; if (yych >= ':') - goto yy94; + goto yy33; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy99; + goto yy37; if (yych <= '@') - goto yy94; + goto yy33; } else { if (yych <= '`') - goto yy94; + goto yy33; if (yych >= '{') - goto yy94; + goto yy33; } } - yy221: - ++p; - yych = *p; + yy158: + yych = *++p; if (yych == '.') - goto yy95; + goto yy34; if (yych == '>') - goto yy99; - goto yy94; + goto yy37; + goto yy33; } } @@ -4989,1688 +4855,1641 @@ bufsize_t _scan_html_tag(const unsigned char *p) { { unsigned char yych; static const unsigned char yybm[] = { - /* table 1 .. 8: 0 */ - 0, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 235, - 235, - 235, - 235, - 235, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 235, - 250, - 202, - 250, - 250, - 250, - 250, - 170, - 250, - 250, - 250, - 250, - 250, - 246, - 254, - 250, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 250, - 234, - 234, - 232, - 250, - 250, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 250, - 250, - 122, - 250, - 254, - 234, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 254, - 250, - 250, - 250, - 250, - 250, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - /* table 9 .. 11: 256 */ - 0, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 128, - 192, - 128, - 128, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 128, - 128, - 128, - 128, - 128, - 0, - 128, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 224, - 128, - 128, - 128, - 128, - 128, - 128, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 192, - 128, - 128, - 128, - 128, - 128, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, + 0, 224, 224, 224, 224, 224, 224, 224, 224, 200, 200, 200, 200, 200, + 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 200, 224, 128, 224, 224, 224, 224, 64, 224, 224, + 224, 224, 224, 244, 240, 224, 244, 244, 244, 244, 244, 244, 244, 244, + 244, 244, 240, 224, 192, 192, 192, 224, 224, 244, 244, 244, 244, 244, + 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, + 244, 244, 244, 244, 244, 244, 244, 224, 224, 224, 224, 240, 192, 244, + 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, + 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, 224, 224, 224, + 224, 224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, }; yych = *p; - if (yych <= '>') { - if (yych <= '!') { - if (yych >= '!') - goto yy226; - } else { - if (yych == '/') - goto yy227; - } + if (yych <= '@') { + if (yych == '/') + goto yy162; } else { - if (yych <= 'Z') { - if (yych <= '?') - goto yy228; - if (yych >= 'A') - goto yy229; - } else { - if (yych <= '`') - goto yy224; - if (yych <= 'z') - goto yy229; - } + if (yych <= 'Z') + goto yy163; + if (yych <= '`') + goto yy160; + if (yych <= 'z') + goto yy163; } - yy224: + yy160: ++p; - yy225 : { return 0; } - yy226: - yych = *(marker = ++p); - if (yybm[256 + yych] & 32) { - goto yy232; - } - if (yych == '-') - goto yy230; - if (yych <= '@') - goto yy225; - if (yych <= '[') - goto yy234; - goto yy225; - yy227: + yy161 : { return 0; } + yy162: yych = *(marker = ++p); if (yych <= '@') - goto yy225; + goto yy161; if (yych <= 'Z') - goto yy235; + goto yy164; if (yych <= '`') - goto yy225; + goto yy161; if (yych <= 'z') - goto yy235; - goto yy225; - yy228: - yych = *(marker = ++p); - if (yych <= 0x00) - goto yy225; - if (yych <= 0x7F) - goto yy238; - if (yych <= 0xC1) - goto yy225; - if (yych <= 0xF4) - goto yy238; - goto yy225; - yy229: + goto yy164; + goto yy161; + yy163: yych = *(marker = ++p); - if (yybm[0 + yych] & 1) { - goto yy247; - } - if (yych <= '=') { - if (yych <= '.') { - if (yych == '-') - goto yy249; - goto yy225; + if (yych <= '.') { + if (yych <= 0x1F) { + if (yych <= 0x08) + goto yy161; + if (yych <= '\r') + goto yy168; + goto yy161; } else { - if (yych <= '/') - goto yy251; - if (yych <= '9') - goto yy249; - goto yy225; + if (yych <= ' ') + goto yy168; + if (yych == '-') + goto yy168; + goto yy161; } } else { - if (yych <= 'Z') { - if (yych <= '>') - goto yy252; - if (yych <= '@') - goto yy225; - goto yy249; + if (yych <= '@') { + if (yych <= '9') + goto yy168; + if (yych == '>') + goto yy168; + goto yy161; } else { + if (yych <= 'Z') + goto yy168; if (yych <= '`') - goto yy225; + goto yy161; if (yych <= 'z') - goto yy249; - goto yy225; + goto yy168; + goto yy161; } } - yy230: + yy164: yych = *++p; - if (yych == '-') - goto yy254; - yy231: - p = marker; - goto yy225; - yy232: - ++p; - yych = *p; - if (yybm[256 + yych] & 32) { - goto yy232; - } - if (yych <= 0x08) - goto yy231; - if (yych <= '\r') - goto yy255; - if (yych == ' ') - goto yy255; - goto yy231; - yy234: - yych = *++p; - if (yych == 'C') - goto yy257; - if (yych == 'c') - goto yy257; - goto yy231; - yy235: - ++p; - yych = *p; - if (yybm[256 + yych] & 64) { - goto yy235; + if (yybm[0 + yych] & 4) { + goto yy164; } if (yych <= 0x1F) { if (yych <= 0x08) - goto yy231; + goto yy165; if (yych <= '\r') - goto yy258; - goto yy231; + goto yy171; } else { if (yych <= ' ') - goto yy258; + goto yy171; if (yych == '>') - goto yy252; - goto yy231; - } - yy237: - ++p; - yych = *p; - yy238: - if (yybm[256 + yych] & 128) { - goto yy237; - } - if (yych <= 0xEC) { - if (yych <= 0xC1) { - if (yych <= 0x00) - goto yy231; - if (yych >= '@') - goto yy231; - } else { - if (yych <= 0xDF) - goto yy240; - if (yych <= 0xE0) - goto yy241; - goto yy242; - } - } else { - if (yych <= 0xF0) { - if (yych <= 0xED) - goto yy243; - if (yych <= 0xEF) - goto yy242; - goto yy244; - } else { - if (yych <= 0xF3) - goto yy245; - if (yych <= 0xF4) - goto yy246; - goto yy231; - } - } - ++p; - yych = *p; - if (yych <= 0xE0) { - if (yych <= '>') { - if (yych <= 0x00) - goto yy231; - if (yych <= '=') - goto yy237; - goto yy252; - } else { - if (yych <= 0x7F) - goto yy237; - if (yych <= 0xC1) - goto yy231; - if (yych >= 0xE0) - goto yy241; - } - } else { - if (yych <= 0xEF) { - if (yych == 0xED) - goto yy243; - goto yy242; - } else { - if (yych <= 0xF0) - goto yy244; - if (yych <= 0xF3) - goto yy245; - if (yych <= 0xF4) - goto yy246; - goto yy231; - } + goto yy170; } - yy240: - ++p; - yych = *p; - if (yych <= 0x7F) - goto yy231; - if (yych <= 0xBF) - goto yy237; - goto yy231; - yy241: - ++p; - yych = *p; - if (yych <= 0x9F) - goto yy231; - if (yych <= 0xBF) - goto yy240; - goto yy231; - yy242: - ++p; - yych = *p; - if (yych <= 0x7F) - goto yy231; - if (yych <= 0xBF) - goto yy240; - goto yy231; - yy243: - ++p; - yych = *p; - if (yych <= 0x7F) - goto yy231; - if (yych <= 0x9F) - goto yy240; - goto yy231; - yy244: - ++p; - yych = *p; - if (yych <= 0x8F) - goto yy231; - if (yych <= 0xBF) - goto yy242; - goto yy231; - yy245: - ++p; - yych = *p; - if (yych <= 0x7F) - goto yy231; - if (yych <= 0xBF) - goto yy242; - goto yy231; - yy246: - ++p; - yych = *p; - if (yych <= 0x7F) - goto yy231; - if (yych <= 0x8F) - goto yy242; - goto yy231; - yy247: - ++p; - yych = *p; - if (yybm[0 + yych] & 1) { - goto yy247; + yy165: + p = marker; + goto yy161; + yy166: + yych = *++p; + if (yybm[0 + yych] & 8) { + goto yy166; } if (yych <= '>') { if (yych <= '9') { if (yych == '/') - goto yy251; - goto yy231; + goto yy169; + goto yy165; } else { if (yych <= ':') - goto yy260; + goto yy172; if (yych <= '=') - goto yy231; - goto yy252; + goto yy165; + goto yy170; } } else { if (yych <= '^') { if (yych <= '@') - goto yy231; + goto yy165; if (yych <= 'Z') - goto yy260; - goto yy231; + goto yy172; + goto yy165; } else { if (yych == '`') - goto yy231; + goto yy165; if (yych <= 'z') - goto yy260; - goto yy231; + goto yy172; + goto yy165; } } - yy249: - ++p; - yych = *p; - if (yybm[0 + yych] & 1) { - goto yy247; + yy167: + yych = *++p; + yy168: + if (yybm[0 + yych] & 8) { + goto yy166; } if (yych <= '=') { if (yych <= '.') { if (yych == '-') - goto yy249; - goto yy231; + goto yy167; + goto yy165; } else { if (yych <= '/') - goto yy251; + goto yy169; if (yych <= '9') - goto yy249; - goto yy231; + goto yy167; + goto yy165; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy252; + goto yy170; if (yych <= '@') - goto yy231; - goto yy249; + goto yy165; + goto yy167; } else { if (yych <= '`') - goto yy231; + goto yy165; if (yych <= 'z') - goto yy249; - goto yy231; + goto yy167; + goto yy165; } } - yy251: + yy169: yych = *++p; if (yych != '>') - goto yy231; - yy252: + goto yy165; + yy170: ++p; { return (bufsize_t)(p - start); } - yy254: - yych = *++p; - if (yych == '-') - goto yy264; - if (yych == '>') - goto yy231; - goto yy263; - yy255: - ++p; - yych = *p; - if (yybm[0 + yych] & 2) { - goto yy255; - } - if (yych <= 0xEC) { - if (yych <= 0xC1) { - if (yych <= 0x00) - goto yy231; - if (yych <= '>') - goto yy252; - goto yy231; - } else { - if (yych <= 0xDF) - goto yy272; - if (yych <= 0xE0) - goto yy273; - goto yy274; - } - } else { - if (yych <= 0xF0) { - if (yych <= 0xED) - goto yy275; - if (yych <= 0xEF) - goto yy274; - goto yy276; - } else { - if (yych <= 0xF3) - goto yy277; - if (yych <= 0xF4) - goto yy278; - goto yy231; - } - } - yy257: + yy171: yych = *++p; - if (yych == 'D') - goto yy279; - if (yych == 'd') - goto yy279; - goto yy231; - yy258: - ++p; - yych = *p; if (yych <= 0x1F) { if (yych <= 0x08) - goto yy231; + goto yy165; if (yych <= '\r') - goto yy258; - goto yy231; + goto yy171; + goto yy165; } else { if (yych <= ' ') - goto yy258; + goto yy171; if (yych == '>') - goto yy252; - goto yy231; + goto yy170; + goto yy165; } - yy260: - ++p; - yych = *p; - if (yybm[0 + yych] & 4) { - goto yy260; + yy172: + yych = *++p; + if (yybm[0 + yych] & 16) { + goto yy172; } if (yych <= ',') { if (yych <= '\r') { if (yych <= 0x08) - goto yy231; - goto yy280; + goto yy165; } else { - if (yych == ' ') - goto yy280; - goto yy231; + if (yych != ' ') + goto yy165; } } else { if (yych <= '<') { if (yych <= '/') - goto yy251; - goto yy231; + goto yy169; + goto yy165; } else { if (yych <= '=') - goto yy282; + goto yy174; if (yych <= '>') - goto yy252; - goto yy231; + goto yy170; + goto yy165; } } - yy262: - ++p; - yych = *p; - yy263: - if (yybm[0 + yych] & 8) { - goto yy262; - } - if (yych <= 0xEC) { - if (yych <= 0xC1) { - if (yych <= 0x00) - goto yy231; - if (yych <= '-') - goto yy284; - goto yy231; - } else { - if (yych <= 0xDF) - goto yy265; - if (yych <= 0xE0) - goto yy266; - goto yy267; - } - } else { - if (yych <= 0xF0) { - if (yych <= 0xED) - goto yy268; - if (yych <= 0xEF) - goto yy267; - goto yy269; - } else { - if (yych <= 0xF3) - goto yy270; - if (yych <= 0xF4) - goto yy271; - goto yy231; - } - } - yy264: - yych = *++p; - if (yych == '-') - goto yy251; - if (yych == '>') - goto yy231; - goto yy263; - yy265: - ++p; - yych = *p; - if (yych <= 0x7F) - goto yy231; - if (yych <= 0xBF) - goto yy262; - goto yy231; - yy266: - ++p; - yych = *p; - if (yych <= 0x9F) - goto yy231; - if (yych <= 0xBF) - goto yy265; - goto yy231; - yy267: - ++p; - yych = *p; - if (yych <= 0x7F) - goto yy231; - if (yych <= 0xBF) - goto yy265; - goto yy231; - yy268: - ++p; - yych = *p; - if (yych <= 0x7F) - goto yy231; - if (yych <= 0x9F) - goto yy265; - goto yy231; - yy269: - ++p; - yych = *p; - if (yych <= 0x8F) - goto yy231; - if (yych <= 0xBF) - goto yy267; - goto yy231; - yy270: - ++p; - yych = *p; - if (yych <= 0x7F) - goto yy231; - if (yych <= 0xBF) - goto yy267; - goto yy231; - yy271: - ++p; - yych = *p; - if (yych <= 0x7F) - goto yy231; - if (yych <= 0x8F) - goto yy267; - goto yy231; - yy272: - ++p; - yych = *p; - if (yych <= 0x7F) - goto yy231; - if (yych <= 0xBF) - goto yy255; - goto yy231; - yy273: - ++p; - yych = *p; - if (yych <= 0x9F) - goto yy231; - if (yych <= 0xBF) - goto yy272; - goto yy231; - yy274: - ++p; - yych = *p; - if (yych <= 0x7F) - goto yy231; - if (yych <= 0xBF) - goto yy272; - goto yy231; - yy275: - ++p; - yych = *p; - if (yych <= 0x7F) - goto yy231; - if (yych <= 0x9F) - goto yy272; - goto yy231; - yy276: - ++p; - yych = *p; - if (yych <= 0x8F) - goto yy231; - if (yych <= 0xBF) - goto yy274; - goto yy231; - yy277: - ++p; - yych = *p; - if (yych <= 0x7F) - goto yy231; - if (yych <= 0xBF) - goto yy274; - goto yy231; - yy278: - ++p; - yych = *p; - if (yych <= 0x7F) - goto yy231; - if (yych <= 0x8F) - goto yy274; - goto yy231; - yy279: + yy173: yych = *++p; - if (yych == 'A') - goto yy285; - if (yych == 'a') - goto yy285; - goto yy231; - yy280: - ++p; - yych = *p; if (yych <= '<') { if (yych <= ' ') { if (yych <= 0x08) - goto yy231; + goto yy165; if (yych <= '\r') - goto yy280; + goto yy173; if (yych <= 0x1F) - goto yy231; - goto yy280; + goto yy165; + goto yy173; } else { if (yych <= '/') { if (yych <= '.') - goto yy231; - goto yy251; + goto yy165; + goto yy169; } else { if (yych == ':') - goto yy260; - goto yy231; + goto yy172; + goto yy165; } } } else { if (yych <= 'Z') { if (yych <= '=') - goto yy282; + goto yy174; if (yych <= '>') - goto yy252; + goto yy170; if (yych <= '@') - goto yy231; - goto yy260; + goto yy165; + goto yy172; } else { if (yych <= '_') { if (yych <= '^') - goto yy231; - goto yy260; + goto yy165; + goto yy172; } else { if (yych <= '`') - goto yy231; + goto yy165; if (yych <= 'z') - goto yy260; - goto yy231; + goto yy172; + goto yy165; } } } - yy282: - ++p; - yych = *p; - if (yybm[0 + yych] & 16) { - goto yy286; + yy174: + yych = *++p; + if (yybm[0 + yych] & 32) { + goto yy175; } if (yych <= 0xE0) { if (yych <= '"') { if (yych <= 0x00) - goto yy231; + goto yy165; if (yych <= ' ') - goto yy282; - goto yy288; + goto yy174; + goto yy176; } else { if (yych <= '\'') - goto yy290; + goto yy177; if (yych <= 0xC1) - goto yy231; + goto yy165; if (yych <= 0xDF) - goto yy292; - goto yy293; + goto yy178; + goto yy179; } } else { if (yych <= 0xEF) { if (yych == 0xED) - goto yy295; - goto yy294; + goto yy181; + goto yy180; } else { if (yych <= 0xF0) - goto yy296; - if (yych <= 0xF3) - goto yy297; - if (yych <= 0xF4) - goto yy298; - goto yy231; - } - } - yy284: - ++p; - yych = *p; - if (yybm[0 + yych] & 8) { - goto yy262; - } - if (yych <= 0xEC) { - if (yych <= 0xC1) { - if (yych <= 0x00) - goto yy231; - if (yych <= '-') - goto yy251; - goto yy231; - } else { - if (yych <= 0xDF) - goto yy265; - if (yych <= 0xE0) - goto yy266; - goto yy267; - } - } else { - if (yych <= 0xF0) { - if (yych <= 0xED) - goto yy268; - if (yych <= 0xEF) - goto yy267; - goto yy269; - } else { + goto yy182; if (yych <= 0xF3) - goto yy270; + goto yy183; if (yych <= 0xF4) - goto yy271; - goto yy231; + goto yy184; + goto yy165; } } - yy285: + yy175: yych = *++p; - if (yych == 'T') - goto yy299; - if (yych == 't') - goto yy299; - goto yy231; - yy286: - ++p; - yych = *p; - if (yybm[0 + yych] & 16) { - goto yy286; + if (yybm[0 + yych] & 32) { + goto yy175; } if (yych <= 0xE0) { if (yych <= '=') { if (yych <= 0x00) - goto yy231; + goto yy165; if (yych <= ' ') - goto yy247; - goto yy231; + goto yy166; + goto yy165; } else { if (yych <= '>') - goto yy252; + goto yy170; if (yych <= 0xC1) - goto yy231; + goto yy165; if (yych <= 0xDF) - goto yy292; - goto yy293; + goto yy178; + goto yy179; } } else { if (yych <= 0xEF) { if (yych == 0xED) - goto yy295; - goto yy294; + goto yy181; + goto yy180; } else { if (yych <= 0xF0) - goto yy296; + goto yy182; if (yych <= 0xF3) - goto yy297; + goto yy183; if (yych <= 0xF4) - goto yy298; - goto yy231; + goto yy184; + goto yy165; } } - yy288: - ++p; - yych = *p; - if (yybm[0 + yych] & 32) { - goto yy288; + yy176: + yych = *++p; + if (yybm[0 + yych] & 64) { + goto yy176; } if (yych <= 0xEC) { if (yych <= 0xC1) { if (yych <= 0x00) - goto yy231; + goto yy165; if (yych <= '"') - goto yy300; - goto yy231; + goto yy185; + goto yy165; } else { if (yych <= 0xDF) - goto yy301; + goto yy186; if (yych <= 0xE0) - goto yy302; - goto yy303; + goto yy187; + goto yy188; } } else { if (yych <= 0xF0) { if (yych <= 0xED) - goto yy304; + goto yy189; if (yych <= 0xEF) - goto yy303; - goto yy305; + goto yy188; + goto yy190; } else { if (yych <= 0xF3) - goto yy306; + goto yy191; if (yych <= 0xF4) - goto yy307; - goto yy231; + goto yy192; + goto yy165; } } - yy290: - ++p; - yych = *p; - if (yybm[0 + yych] & 64) { - goto yy290; + yy177: + yych = *++p; + if (yybm[0 + yych] & 128) { + goto yy177; } if (yych <= 0xEC) { if (yych <= 0xC1) { if (yych <= 0x00) - goto yy231; + goto yy165; if (yych <= '\'') - goto yy300; - goto yy231; + goto yy185; + goto yy165; } else { if (yych <= 0xDF) - goto yy308; + goto yy193; if (yych <= 0xE0) - goto yy309; - goto yy310; + goto yy194; + goto yy195; } } else { if (yych <= 0xF0) { if (yych <= 0xED) - goto yy311; + goto yy196; if (yych <= 0xEF) - goto yy310; - goto yy312; + goto yy195; + goto yy197; } else { if (yych <= 0xF3) - goto yy313; + goto yy198; if (yych <= 0xF4) - goto yy314; - goto yy231; + goto yy199; + goto yy165; } } - yy292: - ++p; - yych = *p; + yy178: + yych = *++p; if (yych <= 0x7F) - goto yy231; + goto yy165; if (yych <= 0xBF) - goto yy286; - goto yy231; - yy293: - ++p; - yych = *p; + goto yy175; + goto yy165; + yy179: + yych = *++p; if (yych <= 0x9F) - goto yy231; + goto yy165; if (yych <= 0xBF) - goto yy292; - goto yy231; - yy294: - ++p; - yych = *p; + goto yy178; + goto yy165; + yy180: + yych = *++p; if (yych <= 0x7F) - goto yy231; + goto yy165; if (yych <= 0xBF) - goto yy292; - goto yy231; - yy295: - ++p; - yych = *p; + goto yy178; + goto yy165; + yy181: + yych = *++p; if (yych <= 0x7F) - goto yy231; + goto yy165; if (yych <= 0x9F) - goto yy292; - goto yy231; - yy296: - ++p; - yych = *p; + goto yy178; + goto yy165; + yy182: + yych = *++p; if (yych <= 0x8F) - goto yy231; + goto yy165; if (yych <= 0xBF) - goto yy294; - goto yy231; - yy297: - ++p; - yych = *p; + goto yy180; + goto yy165; + yy183: + yych = *++p; if (yych <= 0x7F) - goto yy231; + goto yy165; if (yych <= 0xBF) - goto yy294; - goto yy231; - yy298: - ++p; - yych = *p; + goto yy180; + goto yy165; + yy184: + yych = *++p; if (yych <= 0x7F) - goto yy231; + goto yy165; if (yych <= 0x8F) - goto yy294; - goto yy231; - yy299: + goto yy180; + goto yy165; + yy185: yych = *++p; - if (yych == 'A') - goto yy315; - if (yych == 'a') - goto yy315; - goto yy231; - yy300: - ++p; - yych = *p; - if (yybm[0 + yych] & 1) { - goto yy247; + if (yybm[0 + yych] & 8) { + goto yy166; } if (yych == '/') - goto yy251; + goto yy169; if (yych == '>') - goto yy252; - goto yy231; - yy301: - ++p; - yych = *p; + goto yy170; + goto yy165; + yy186: + yych = *++p; if (yych <= 0x7F) - goto yy231; + goto yy165; if (yych <= 0xBF) - goto yy288; - goto yy231; - yy302: - ++p; - yych = *p; + goto yy176; + goto yy165; + yy187: + yych = *++p; if (yych <= 0x9F) - goto yy231; + goto yy165; if (yych <= 0xBF) - goto yy301; - goto yy231; - yy303: - ++p; - yych = *p; + goto yy186; + goto yy165; + yy188: + yych = *++p; if (yych <= 0x7F) - goto yy231; + goto yy165; if (yych <= 0xBF) - goto yy301; - goto yy231; - yy304: - ++p; - yych = *p; + goto yy186; + goto yy165; + yy189: + yych = *++p; if (yych <= 0x7F) - goto yy231; + goto yy165; if (yych <= 0x9F) - goto yy301; - goto yy231; - yy305: - ++p; - yych = *p; + goto yy186; + goto yy165; + yy190: + yych = *++p; if (yych <= 0x8F) - goto yy231; + goto yy165; if (yych <= 0xBF) - goto yy303; - goto yy231; - yy306: - ++p; - yych = *p; + goto yy188; + goto yy165; + yy191: + yych = *++p; if (yych <= 0x7F) - goto yy231; + goto yy165; if (yych <= 0xBF) - goto yy303; - goto yy231; - yy307: - ++p; - yych = *p; + goto yy188; + goto yy165; + yy192: + yych = *++p; if (yych <= 0x7F) - goto yy231; + goto yy165; if (yych <= 0x8F) - goto yy303; - goto yy231; - yy308: - ++p; + goto yy188; + goto yy165; + yy193: + yych = *++p; + if (yych <= 0x7F) + goto yy165; + if (yych <= 0xBF) + goto yy177; + goto yy165; + yy194: + yych = *++p; + if (yych <= 0x9F) + goto yy165; + if (yych <= 0xBF) + goto yy193; + goto yy165; + yy195: + yych = *++p; + if (yych <= 0x7F) + goto yy165; + if (yych <= 0xBF) + goto yy193; + goto yy165; + yy196: + yych = *++p; + if (yych <= 0x7F) + goto yy165; + if (yych <= 0x9F) + goto yy193; + goto yy165; + yy197: + yych = *++p; + if (yych <= 0x8F) + goto yy165; + if (yych <= 0xBF) + goto yy195; + goto yy165; + yy198: + yych = *++p; + if (yych <= 0x7F) + goto yy165; + if (yych <= 0xBF) + goto yy195; + goto yy165; + yy199: + yych = *++p; + if (yych <= 0x7F) + goto yy165; + if (yych <= 0x8F) + goto yy195; + goto yy165; + } +} + +// Try to (liberally) match an HTML tag after first <, returning num of chars +// matched. +bufsize_t _scan_liberal_html_tag(const unsigned char *p) { + const unsigned char *marker = NULL; + const unsigned char *start = p; + + { + unsigned char yych; + unsigned int yyaccept = 0; + static const unsigned char yybm[] = { + 0, 64, 64, 64, 64, 64, 64, 64, 64, 64, 0, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 128, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, + }; yych = *p; + if (yych <= 0xE0) { + if (yych <= '\n') { + if (yych <= 0x00) + goto yy201; + if (yych <= '\t') + goto yy203; + } else { + if (yych <= 0x7F) + goto yy203; + if (yych <= 0xC1) + goto yy201; + if (yych <= 0xDF) + goto yy204; + goto yy205; + } + } else { + if (yych <= 0xEF) { + if (yych == 0xED) + goto yy207; + goto yy206; + } else { + if (yych <= 0xF0) + goto yy208; + if (yych <= 0xF3) + goto yy209; + if (yych <= 0xF4) + goto yy210; + } + } + yy201: + ++p; + yy202 : { return 0; } + yy203: + yyaccept = 0; + yych = *(marker = ++p); + if (yych <= '\n') { + if (yych <= 0x00) + goto yy202; + if (yych <= '\t') + goto yy212; + goto yy202; + } else { + if (yych <= 0x7F) + goto yy212; + if (yych <= 0xC1) + goto yy202; + if (yych <= 0xF4) + goto yy212; + goto yy202; + } + yy204: + yyaccept = 0; + yych = *(marker = ++p); + if (yych <= 0x7F) + goto yy202; + if (yych <= 0xBF) + goto yy211; + goto yy202; + yy205: + yyaccept = 0; + yych = *(marker = ++p); + if (yych <= 0x9F) + goto yy202; + if (yych <= 0xBF) + goto yy216; + goto yy202; + yy206: + yyaccept = 0; + yych = *(marker = ++p); + if (yych <= 0x7F) + goto yy202; + if (yych <= 0xBF) + goto yy216; + goto yy202; + yy207: + yyaccept = 0; + yych = *(marker = ++p); + if (yych <= 0x7F) + goto yy202; + if (yych <= 0x9F) + goto yy216; + goto yy202; + yy208: + yyaccept = 0; + yych = *(marker = ++p); + if (yych <= 0x8F) + goto yy202; + if (yych <= 0xBF) + goto yy218; + goto yy202; + yy209: + yyaccept = 0; + yych = *(marker = ++p); + if (yych <= 0x7F) + goto yy202; + if (yych <= 0xBF) + goto yy218; + goto yy202; + yy210: + yyaccept = 0; + yych = *(marker = ++p); + if (yych <= 0x7F) + goto yy202; + if (yych <= 0x8F) + goto yy218; + goto yy202; + yy211: + yych = *++p; + yy212: + if (yybm[0 + yych] & 64) { + goto yy211; + } + if (yych <= 0xEC) { + if (yych <= 0xC1) { + if (yych <= '\n') + goto yy213; + if (yych <= '>') + goto yy214; + } else { + if (yych <= 0xDF) + goto yy216; + if (yych <= 0xE0) + goto yy217; + goto yy218; + } + } else { + if (yych <= 0xF0) { + if (yych <= 0xED) + goto yy219; + if (yych <= 0xEF) + goto yy218; + goto yy220; + } else { + if (yych <= 0xF3) + goto yy221; + if (yych <= 0xF4) + goto yy222; + } + } + yy213: + p = marker; + if (yyaccept == 0) { + goto yy202; + } else { + goto yy215; + } + yy214: + yyaccept = 1; + yych = *(marker = ++p); + if (yybm[0 + yych] & 64) { + goto yy211; + } + if (yych <= 0xEC) { + if (yych <= 0xC1) { + if (yych <= '\n') + goto yy215; + if (yych <= '>') + goto yy214; + } else { + if (yych <= 0xDF) + goto yy216; + if (yych <= 0xE0) + goto yy217; + goto yy218; + } + } else { + if (yych <= 0xF0) { + if (yych <= 0xED) + goto yy219; + if (yych <= 0xEF) + goto yy218; + goto yy220; + } else { + if (yych <= 0xF3) + goto yy221; + if (yych <= 0xF4) + goto yy222; + } + } + yy215 : { return (bufsize_t)(p - start); } + yy216: + yych = *++p; + if (yych <= 0x7F) + goto yy213; + if (yych <= 0xBF) + goto yy211; + goto yy213; + yy217: + yych = *++p; + if (yych <= 0x9F) + goto yy213; + if (yych <= 0xBF) + goto yy216; + goto yy213; + yy218: + yych = *++p; + if (yych <= 0x7F) + goto yy213; + if (yych <= 0xBF) + goto yy216; + goto yy213; + yy219: + yych = *++p; + if (yych <= 0x7F) + goto yy213; + if (yych <= 0x9F) + goto yy216; + goto yy213; + yy220: + yych = *++p; + if (yych <= 0x8F) + goto yy213; + if (yych <= 0xBF) + goto yy218; + goto yy213; + yy221: + yych = *++p; + if (yych <= 0x7F) + goto yy213; + if (yych <= 0xBF) + goto yy218; + goto yy213; + yy222: + yych = *++p; + if (yych <= 0x7F) + goto yy213; + if (yych <= 0x8F) + goto yy218; + goto yy213; + } +} + +bufsize_t _scan_html_comment(const unsigned char *p) { + const unsigned char *marker = NULL; + const unsigned char *start = p; + + { + unsigned char yych; + static const unsigned char yybm[] = { + 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, + }; + yych = *p; + if (yych == '-') + goto yy225; + ++p; + yy224 : { return 0; } + yy225: + yych = *(marker = ++p); + if (yych != '-') + goto yy224; + yy226: + yych = *++p; + if (yybm[0 + yych] & 128) { + goto yy226; + } + if (yych <= 0xEC) { + if (yych <= 0xC1) { + if (yych <= 0x00) + goto yy227; + if (yych <= '-') + goto yy228; + } else { + if (yych <= 0xDF) + goto yy229; + if (yych <= 0xE0) + goto yy230; + goto yy231; + } + } else { + if (yych <= 0xF0) { + if (yych <= 0xED) + goto yy232; + if (yych <= 0xEF) + goto yy231; + goto yy233; + } else { + if (yych <= 0xF3) + goto yy234; + if (yych <= 0xF4) + goto yy235; + } + } + yy227: + p = marker; + goto yy224; + yy228: + yych = *++p; + if (yybm[0 + yych] & 128) { + goto yy226; + } + if (yych <= 0xEC) { + if (yych <= 0xC1) { + if (yych <= 0x00) + goto yy227; + if (yych <= '-') + goto yy236; + goto yy227; + } else { + if (yych <= 0xDF) + goto yy229; + if (yych <= 0xE0) + goto yy230; + goto yy231; + } + } else { + if (yych <= 0xF0) { + if (yych <= 0xED) + goto yy232; + if (yych <= 0xEF) + goto yy231; + goto yy233; + } else { + if (yych <= 0xF3) + goto yy234; + if (yych <= 0xF4) + goto yy235; + goto yy227; + } + } + yy229: + yych = *++p; + if (yych <= 0x7F) + goto yy227; + if (yych <= 0xBF) + goto yy226; + goto yy227; + yy230: + yych = *++p; + if (yych <= 0x9F) + goto yy227; + if (yych <= 0xBF) + goto yy229; + goto yy227; + yy231: + yych = *++p; + if (yych <= 0x7F) + goto yy227; + if (yych <= 0xBF) + goto yy229; + goto yy227; + yy232: + yych = *++p; + if (yych <= 0x7F) + goto yy227; + if (yych <= 0x9F) + goto yy229; + goto yy227; + yy233: + yych = *++p; + if (yych <= 0x8F) + goto yy227; + if (yych <= 0xBF) + goto yy231; + goto yy227; + yy234: + yych = *++p; + if (yych <= 0x7F) + goto yy227; + if (yych <= 0xBF) + goto yy231; + goto yy227; + yy235: + yych = *++p; + if (yych <= 0x7F) + goto yy227; + if (yych <= 0x8F) + goto yy231; + goto yy227; + yy236: + yych = *++p; + if (yych <= 0xE0) { + if (yych <= '>') { + if (yych <= 0x00) + goto yy227; + if (yych <= '=') + goto yy226; + } else { + if (yych <= 0x7F) + goto yy226; + if (yych <= 0xC1) + goto yy227; + if (yych <= 0xDF) + goto yy229; + goto yy230; + } + } else { + if (yych <= 0xEF) { + if (yych == 0xED) + goto yy232; + goto yy231; + } else { + if (yych <= 0xF0) + goto yy233; + if (yych <= 0xF3) + goto yy234; + if (yych <= 0xF4) + goto yy235; + goto yy227; + } + } + ++p; + { return (bufsize_t)(p - start); } + } +} + +bufsize_t _scan_html_pi(const unsigned char *p) { + const unsigned char *marker = NULL; + const unsigned char *start = p; + + { + unsigned char yych; + unsigned int yyaccept = 0; + static const unsigned char yybm[] = { + 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 0, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, + }; + yych = *p; + if (yybm[0 + yych] & 128) { + goto yy240; + } + if (yych <= 0xEC) { + if (yych <= 0xC1) { + if (yych <= 0x00) + goto yy238; + if (yych <= '?') + goto yy243; + } else { + if (yych <= 0xDF) + goto yy244; + if (yych <= 0xE0) + goto yy245; + goto yy246; + } + } else { + if (yych <= 0xF0) { + if (yych <= 0xED) + goto yy247; + if (yych <= 0xEF) + goto yy246; + goto yy248; + } else { + if (yych <= 0xF3) + goto yy249; + if (yych <= 0xF4) + goto yy250; + } + } + yy238: + ++p; + yy239 : { return 0; } + yy240: + yyaccept = 0; + yych = *(marker = ++p); + yy241: + if (yybm[0 + yych] & 128) { + goto yy240; + } + if (yych <= 0xEC) { + if (yych <= 0xC1) { + if (yych <= 0x00) + goto yy242; + if (yych <= '?') + goto yy251; + } else { + if (yych <= 0xDF) + goto yy253; + if (yych <= 0xE0) + goto yy254; + goto yy255; + } + } else { + if (yych <= 0xF0) { + if (yych <= 0xED) + goto yy256; + if (yych <= 0xEF) + goto yy255; + goto yy257; + } else { + if (yych <= 0xF3) + goto yy258; + if (yych <= 0xF4) + goto yy259; + } + } + yy242 : { return (bufsize_t)(p - start); } + yy243: + yyaccept = 1; + yych = *(marker = ++p); + if (yych <= '?') { + if (yych <= 0x00) + goto yy239; + if (yych <= '=') + goto yy241; + if (yych <= '>') + goto yy239; + goto yy240; + } else { + if (yych <= 0x7F) + goto yy241; + if (yych <= 0xC1) + goto yy239; + if (yych <= 0xF4) + goto yy241; + goto yy239; + } + yy244: + yych = *++p; + if (yych <= 0x7F) + goto yy239; + if (yych <= 0xBF) + goto yy240; + goto yy239; + yy245: + yyaccept = 1; + yych = *(marker = ++p); + if (yych <= 0x9F) + goto yy239; + if (yych <= 0xBF) + goto yy253; + goto yy239; + yy246: + yyaccept = 1; + yych = *(marker = ++p); + if (yych <= 0x7F) + goto yy239; + if (yych <= 0xBF) + goto yy253; + goto yy239; + yy247: + yyaccept = 1; + yych = *(marker = ++p); + if (yych <= 0x7F) + goto yy239; + if (yych <= 0x9F) + goto yy253; + goto yy239; + yy248: + yyaccept = 1; + yych = *(marker = ++p); + if (yych <= 0x8F) + goto yy239; + if (yych <= 0xBF) + goto yy255; + goto yy239; + yy249: + yyaccept = 1; + yych = *(marker = ++p); + if (yych <= 0x7F) + goto yy239; + if (yych <= 0xBF) + goto yy255; + goto yy239; + yy250: + yyaccept = 1; + yych = *(marker = ++p); + if (yych <= 0x7F) + goto yy239; + if (yych <= 0x8F) + goto yy255; + goto yy239; + yy251: + yych = *++p; + if (yych <= 0xE0) { + if (yych <= '>') { + if (yych <= 0x00) + goto yy252; + if (yych <= '=') + goto yy240; + } else { + if (yych <= 0x7F) + goto yy240; + if (yych <= 0xC1) + goto yy252; + if (yych <= 0xDF) + goto yy253; + goto yy254; + } + } else { + if (yych <= 0xEF) { + if (yych == 0xED) + goto yy256; + goto yy255; + } else { + if (yych <= 0xF0) + goto yy257; + if (yych <= 0xF3) + goto yy258; + if (yych <= 0xF4) + goto yy259; + } + } + yy252: + p = marker; + if (yyaccept == 0) { + goto yy242; + } else { + goto yy239; + } + yy253: + yych = *++p; + if (yych <= 0x7F) + goto yy252; + if (yych <= 0xBF) + goto yy240; + goto yy252; + yy254: + yych = *++p; + if (yych <= 0x9F) + goto yy252; + if (yych <= 0xBF) + goto yy253; + goto yy252; + yy255: + yych = *++p; + if (yych <= 0x7F) + goto yy252; + if (yych <= 0xBF) + goto yy253; + goto yy252; + yy256: + yych = *++p; + if (yych <= 0x7F) + goto yy252; + if (yych <= 0x9F) + goto yy253; + goto yy252; + yy257: + yych = *++p; + if (yych <= 0x8F) + goto yy252; + if (yych <= 0xBF) + goto yy255; + goto yy252; + yy258: + yych = *++p; + if (yych <= 0x7F) + goto yy252; + if (yych <= 0xBF) + goto yy255; + goto yy252; + yy259: + yych = *++p; + if (yych <= 0x7F) + goto yy252; + if (yych <= 0x8F) + goto yy255; + goto yy252; + } +} + +bufsize_t _scan_html_declaration(const unsigned char *p) { + const unsigned char *marker = NULL; + const unsigned char *start = p; + + { + unsigned char yych; + unsigned int yyaccept = 0; + static const unsigned char yybm[] = { + 0, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 0, 64, 64, 192, 192, 192, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, + }; + yych = *p; + if (yych <= '@') + goto yy261; + if (yych <= 'Z') + goto yy263; + yy261: + ++p; + yy262 : { return 0; } + yy263: + yyaccept = 0; + yych = *(marker = ++p); + if (yybm[0 + yych] & 128) { + goto yy266; + } + if (yych <= 0x08) + goto yy262; + if (yych <= '\r') + goto yy264; + if (yych != ' ') + goto yy262; + yy264: + yyaccept = 1; + yych = *(marker = ++p); + if (yybm[0 + yych] & 64) { + goto yy264; + } + if (yych <= 0xED) { + if (yych <= 0xDF) { + if (yych >= 0xC2) + goto yy268; + } else { + if (yych <= 0xE0) + goto yy269; + if (yych <= 0xEC) + goto yy270; + goto yy271; + } + } else { + if (yych <= 0xF0) { + if (yych <= 0xEF) + goto yy270; + goto yy272; + } else { + if (yych <= 0xF3) + goto yy273; + if (yych <= 0xF4) + goto yy274; + } + } + yy265 : { return (bufsize_t)(p - start); } + yy266: + yych = *++p; + if (yybm[0 + yych] & 128) { + goto yy266; + } + if (yych <= 0x08) + goto yy267; + if (yych <= '\r') + goto yy264; + if (yych == ' ') + goto yy264; + yy267: + p = marker; + if (yyaccept == 0) { + goto yy262; + } else { + goto yy265; + } + yy268: + yych = *++p; if (yych <= 0x7F) - goto yy231; + goto yy267; if (yych <= 0xBF) - goto yy290; - goto yy231; - yy309: - ++p; - yych = *p; + goto yy264; + goto yy267; + yy269: + yych = *++p; if (yych <= 0x9F) - goto yy231; + goto yy267; if (yych <= 0xBF) - goto yy308; - goto yy231; - yy310: - ++p; - yych = *p; + goto yy268; + goto yy267; + yy270: + yych = *++p; if (yych <= 0x7F) - goto yy231; + goto yy267; if (yych <= 0xBF) - goto yy308; - goto yy231; - yy311: - ++p; - yych = *p; + goto yy268; + goto yy267; + yy271: + yych = *++p; if (yych <= 0x7F) - goto yy231; + goto yy267; if (yych <= 0x9F) - goto yy308; - goto yy231; - yy312: - ++p; - yych = *p; + goto yy268; + goto yy267; + yy272: + yych = *++p; if (yych <= 0x8F) - goto yy231; + goto yy267; if (yych <= 0xBF) - goto yy310; - goto yy231; - yy313: - ++p; - yych = *p; + goto yy270; + goto yy267; + yy273: + yych = *++p; if (yych <= 0x7F) - goto yy231; + goto yy267; if (yych <= 0xBF) - goto yy310; - goto yy231; - yy314: - ++p; - yych = *p; + goto yy270; + goto yy267; + yy274: + yych = *++p; if (yych <= 0x7F) - goto yy231; + goto yy267; if (yych <= 0x8F) - goto yy310; - goto yy231; - yy315: + goto yy270; + goto yy267; + } +} + +bufsize_t _scan_html_cdata(const unsigned char *p) { + const unsigned char *marker = NULL; + const unsigned char *start = p; + + { + unsigned char yych; + unsigned int yyaccept = 0; + static const unsigned char yybm[] = { + 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, + }; + yych = *p; + if (yych == 'C') + goto yy277; + if (yych == 'c') + goto yy277; + ++p; + yy276 : { return 0; } + yy277: + yyaccept = 0; + yych = *(marker = ++p); + if (yych == 'D') + goto yy278; + if (yych != 'd') + goto yy276; + yy278: + yych = *++p; + if (yych == 'A') + goto yy280; + if (yych == 'a') + goto yy280; + yy279: + p = marker; + if (yyaccept == 0) { + goto yy276; + } else { + goto yy284; + } + yy280: + yych = *++p; + if (yych == 'T') + goto yy281; + if (yych != 't') + goto yy279; + yy281: + yych = *++p; + if (yych == 'A') + goto yy282; + if (yych != 'a') + goto yy279; + yy282: yych = *++p; if (yych != '[') - goto yy231; - yy316: - ++p; - yych = *p; + goto yy279; + yy283: + yyaccept = 1; + yych = *(marker = ++p); if (yybm[0 + yych] & 128) { - goto yy316; + goto yy283; } if (yych <= 0xEC) { if (yych <= 0xC1) { if (yych <= 0x00) - goto yy231; - if (yych >= '^') - goto yy231; + goto yy284; + if (yych <= ']') + goto yy285; } else { if (yych <= 0xDF) - goto yy319; + goto yy286; if (yych <= 0xE0) - goto yy320; - goto yy321; + goto yy287; + goto yy288; } } else { if (yych <= 0xF0) { if (yych <= 0xED) - goto yy322; + goto yy289; if (yych <= 0xEF) - goto yy321; - goto yy323; + goto yy288; + goto yy290; } else { if (yych <= 0xF3) - goto yy324; + goto yy291; if (yych <= 0xF4) - goto yy325; - goto yy231; + goto yy292; } } - ++p; - yych = *p; + yy284 : { return (bufsize_t)(p - start); } + yy285: + yych = *++p; if (yybm[0 + yych] & 128) { - goto yy316; + goto yy283; } if (yych <= 0xEC) { if (yych <= 0xC1) { if (yych <= 0x00) - goto yy231; + goto yy279; if (yych <= ']') - goto yy326; - goto yy231; + goto yy293; + goto yy279; } else { if (yych <= 0xDF) - goto yy319; + goto yy286; if (yych <= 0xE0) - goto yy320; - goto yy321; + goto yy287; + goto yy288; } } else { if (yych <= 0xF0) { if (yych <= 0xED) - goto yy322; + goto yy289; if (yych <= 0xEF) - goto yy321; - goto yy323; + goto yy288; + goto yy290; } else { if (yych <= 0xF3) - goto yy324; + goto yy291; if (yych <= 0xF4) - goto yy325; - goto yy231; + goto yy292; + goto yy279; } } - yy319: - ++p; - yych = *p; + yy286: + yych = *++p; if (yych <= 0x7F) - goto yy231; + goto yy279; if (yych <= 0xBF) - goto yy316; - goto yy231; - yy320: - ++p; - yych = *p; + goto yy283; + goto yy279; + yy287: + yych = *++p; if (yych <= 0x9F) - goto yy231; + goto yy279; if (yych <= 0xBF) - goto yy319; - goto yy231; - yy321: - ++p; - yych = *p; + goto yy286; + goto yy279; + yy288: + yych = *++p; if (yych <= 0x7F) - goto yy231; + goto yy279; if (yych <= 0xBF) - goto yy319; - goto yy231; - yy322: - ++p; - yych = *p; + goto yy286; + goto yy279; + yy289: + yych = *++p; if (yych <= 0x7F) - goto yy231; + goto yy279; if (yych <= 0x9F) - goto yy319; - goto yy231; - yy323: - ++p; - yych = *p; + goto yy286; + goto yy279; + yy290: + yych = *++p; if (yych <= 0x8F) - goto yy231; + goto yy279; if (yych <= 0xBF) - goto yy321; - goto yy231; - yy324: - ++p; - yych = *p; + goto yy288; + goto yy279; + yy291: + yych = *++p; if (yych <= 0x7F) - goto yy231; + goto yy279; if (yych <= 0xBF) - goto yy321; - goto yy231; - yy325: - ++p; - yych = *p; + goto yy288; + goto yy279; + yy292: + yych = *++p; if (yych <= 0x7F) - goto yy231; + goto yy279; if (yych <= 0x8F) - goto yy321; - goto yy231; - yy326: - ++p; - yych = *p; + goto yy288; + goto yy279; + yy293: + yych = *++p; if (yych <= 0xE0) { if (yych <= '>') { if (yych <= 0x00) - goto yy231; + goto yy279; if (yych <= '=') - goto yy316; - goto yy252; + goto yy283; + goto yy279; } else { if (yych <= 0x7F) - goto yy316; + goto yy283; if (yych <= 0xC1) - goto yy231; + goto yy279; if (yych <= 0xDF) - goto yy319; - goto yy320; + goto yy286; + goto yy287; } } else { if (yych <= 0xEF) { if (yych == 0xED) - goto yy322; - goto yy321; + goto yy289; + goto yy288; } else { if (yych <= 0xF0) - goto yy323; + goto yy290; if (yych <= 0xF3) - goto yy324; + goto yy291; if (yych <= 0xF4) - goto yy325; - goto yy231; + goto yy292; + goto yy279; } } } @@ -6686,216 +6505,216 @@ bufsize_t _scan_html_block_start(const unsigned char *p) { unsigned char yych; yych = *p; if (yych == '<') - goto yy331; + goto yy296; ++p; - yy330 : { return 0; } - yy331: + yy295 : { return 0; } + yy296: yych = *(marker = ++p); switch (yych) { case '!': - goto yy332; + goto yy297; case '/': - goto yy334; + goto yy299; case '?': - goto yy335; + goto yy300; case 'A': case 'a': - goto yy337; + goto yy301; case 'B': case 'b': - goto yy338; + goto yy302; case 'C': case 'c': - goto yy339; + goto yy303; case 'D': case 'd': - goto yy340; + goto yy304; case 'F': case 'f': - goto yy341; + goto yy305; case 'H': case 'h': - goto yy342; + goto yy306; case 'I': case 'i': - goto yy343; + goto yy307; case 'L': case 'l': - goto yy344; + goto yy308; case 'M': case 'm': - goto yy345; + goto yy309; case 'N': case 'n': - goto yy346; + goto yy310; case 'O': case 'o': - goto yy347; + goto yy311; case 'P': case 'p': - goto yy348; + goto yy312; case 'S': case 's': - goto yy349; + goto yy313; case 'T': case 't': - goto yy350; + goto yy314; case 'U': case 'u': - goto yy351; + goto yy315; default: - goto yy330; + goto yy295; } - yy332: + yy297: yych = *++p; if (yych <= '@') { if (yych == '-') - goto yy352; + goto yy316; } else { if (yych <= 'Z') - goto yy353; + goto yy317; if (yych <= '[') - goto yy355; + goto yy318; } - yy333: + yy298: p = marker; - goto yy330; - yy334: + goto yy295; + yy299: yych = *++p; switch (yych) { case 'A': case 'a': - goto yy337; + goto yy301; case 'B': case 'b': - goto yy338; + goto yy302; case 'C': case 'c': - goto yy339; + goto yy303; case 'D': case 'd': - goto yy340; + goto yy304; case 'F': case 'f': - goto yy341; + goto yy305; case 'H': case 'h': - goto yy342; + goto yy306; case 'I': case 'i': - goto yy343; + goto yy307; case 'L': case 'l': - goto yy344; + goto yy308; case 'M': case 'm': - goto yy345; + goto yy309; case 'N': case 'n': - goto yy346; + goto yy310; case 'O': case 'o': - goto yy347; + goto yy311; case 'P': case 'p': - goto yy356; + goto yy319; case 'S': case 's': - goto yy357; + goto yy320; case 'T': case 't': - goto yy350; + goto yy321; case 'U': case 'u': - goto yy351; + goto yy315; default: - goto yy333; + goto yy298; } - yy335: + yy300: ++p; { return 3; } - yy337: + yy301: yych = *++p; if (yych <= 'S') { if (yych <= 'D') { if (yych <= 'C') - goto yy333; - goto yy358; + goto yy298; + goto yy322; } else { if (yych <= 'Q') - goto yy333; + goto yy298; if (yych <= 'R') - goto yy359; - goto yy360; + goto yy323; + goto yy324; } } else { if (yych <= 'q') { if (yych == 'd') - goto yy358; - goto yy333; + goto yy322; + goto yy298; } else { if (yych <= 'r') - goto yy359; + goto yy323; if (yych <= 's') - goto yy360; - goto yy333; + goto yy324; + goto yy298; } } - yy338: + yy302: yych = *++p; if (yych <= 'O') { if (yych <= 'K') { if (yych == 'A') - goto yy361; - goto yy333; + goto yy325; + goto yy298; } else { if (yych <= 'L') - goto yy362; + goto yy326; if (yych <= 'N') - goto yy333; - goto yy363; + goto yy298; + goto yy327; } } else { if (yych <= 'k') { if (yych == 'a') - goto yy361; - goto yy333; + goto yy325; + goto yy298; } else { if (yych <= 'l') - goto yy362; + goto yy326; if (yych == 'o') - goto yy363; - goto yy333; + goto yy327; + goto yy298; } } - yy339: + yy303: yych = *++p; if (yych <= 'O') { if (yych <= 'D') { if (yych == 'A') - goto yy364; - goto yy333; + goto yy328; + goto yy298; } else { if (yych <= 'E') - goto yy365; + goto yy329; if (yych <= 'N') - goto yy333; - goto yy366; + goto yy298; + goto yy330; } } else { if (yych <= 'd') { if (yych == 'a') - goto yy364; - goto yy333; + goto yy328; + goto yy298; } else { if (yych <= 'e') - goto yy365; + goto yy329; if (yych == 'o') - goto yy366; - goto yy333; + goto yy330; + goto yy298; } } - yy340: + yy304: yych = *++p; switch (yych) { case 'D': @@ -6904,1469 +6723,1541 @@ bufsize_t _scan_html_block_start(const unsigned char *p) { case 'd': case 'l': case 't': - goto yy367; + goto yy331; case 'E': case 'e': - goto yy368; + goto yy332; case 'I': case 'i': - goto yy369; - default: goto yy333; + default: + goto yy298; } - yy341: + yy305: yych = *++p; if (yych <= 'R') { if (yych <= 'N') { if (yych == 'I') - goto yy370; - goto yy333; + goto yy334; + goto yy298; } else { if (yych <= 'O') - goto yy371; + goto yy335; if (yych <= 'Q') - goto yy333; - goto yy372; + goto yy298; + goto yy336; } } else { if (yych <= 'n') { if (yych == 'i') - goto yy370; - goto yy333; + goto yy334; + goto yy298; } else { if (yych <= 'o') - goto yy371; + goto yy335; if (yych == 'r') - goto yy372; - goto yy333; + goto yy336; + goto yy298; } } - yy342: + yy306: yych = *++p; if (yych <= 'S') { if (yych <= 'D') { if (yych <= '0') - goto yy333; + goto yy298; if (yych <= '6') - goto yy367; - goto yy333; + goto yy331; + goto yy298; } else { if (yych <= 'E') - goto yy373; + goto yy337; if (yych == 'R') - goto yy367; - goto yy333; + goto yy331; + goto yy298; } } else { if (yych <= 'q') { if (yych <= 'T') - goto yy374; + goto yy338; if (yych == 'e') - goto yy373; - goto yy333; + goto yy337; + goto yy298; } else { if (yych <= 'r') - goto yy367; + goto yy331; if (yych == 't') - goto yy374; - goto yy333; + goto yy338; + goto yy298; } } - yy343: + yy307: yych = *++p; if (yych == 'F') - goto yy375; + goto yy339; if (yych == 'f') - goto yy375; - goto yy333; - yy344: + goto yy339; + goto yy298; + yy308: yych = *++p; if (yych <= 'I') { if (yych == 'E') - goto yy376; + goto yy340; if (yych <= 'H') - goto yy333; - goto yy377; + goto yy298; + goto yy341; } else { if (yych <= 'e') { if (yych <= 'd') - goto yy333; - goto yy376; + goto yy298; + goto yy340; } else { if (yych == 'i') - goto yy377; - goto yy333; + goto yy341; + goto yy298; } } - yy345: + yy309: yych = *++p; if (yych <= 'E') { if (yych == 'A') - goto yy378; + goto yy342; if (yych <= 'D') - goto yy333; - goto yy379; + goto yy298; + goto yy343; } else { if (yych <= 'a') { if (yych <= '`') - goto yy333; - goto yy378; + goto yy298; + goto yy342; } else { if (yych == 'e') - goto yy379; - goto yy333; + goto yy343; + goto yy298; } } - yy346: + yy310: yych = *++p; if (yych <= 'O') { if (yych == 'A') - goto yy380; + goto yy344; if (yych <= 'N') - goto yy333; - goto yy381; + goto yy298; + goto yy345; } else { if (yych <= 'a') { if (yych <= '`') - goto yy333; - goto yy380; + goto yy298; + goto yy344; } else { if (yych == 'o') - goto yy381; - goto yy333; + goto yy345; + goto yy298; } } - yy347: + yy311: yych = *++p; if (yych <= 'P') { if (yych == 'L') - goto yy367; + goto yy331; if (yych <= 'O') - goto yy333; - goto yy382; + goto yy298; + goto yy346; } else { if (yych <= 'l') { if (yych <= 'k') - goto yy333; - goto yy367; + goto yy298; + goto yy331; } else { if (yych == 'p') - goto yy382; - goto yy333; + goto yy346; + goto yy298; } } - yy348: + yy312: yych = *++p; if (yych <= '>') { if (yych <= ' ') { if (yych <= 0x08) - goto yy333; + goto yy298; if (yych <= '\r') - goto yy383; + goto yy347; if (yych <= 0x1F) - goto yy333; - goto yy383; + goto yy298; + goto yy347; } else { if (yych == '/') - goto yy385; + goto yy348; if (yych <= '=') - goto yy333; - goto yy383; + goto yy298; + goto yy347; } } else { if (yych <= 'R') { if (yych == 'A') - goto yy386; + goto yy349; if (yych <= 'Q') - goto yy333; - goto yy387; + goto yy298; + goto yy350; } else { if (yych <= 'a') { if (yych <= '`') - goto yy333; - goto yy386; + goto yy298; + goto yy349; } else { if (yych == 'r') - goto yy387; - goto yy333; + goto yy350; + goto yy298; } } } - yy349: + yy313: yych = *++p; switch (yych) { case 'C': case 'c': - goto yy388; + goto yy351; case 'E': case 'e': - goto yy389; + goto yy352; case 'O': case 'o': - goto yy390; + goto yy353; case 'T': case 't': - goto yy391; + goto yy354; case 'U': case 'u': - goto yy392; + goto yy355; default: - goto yy333; + goto yy298; } - yy350: + yy314: yych = *++p; switch (yych) { case 'A': case 'a': - goto yy393; + goto yy356; case 'B': case 'b': - goto yy394; + goto yy357; case 'D': case 'd': - goto yy367; + goto yy331; + case 'E': + case 'e': + goto yy358; case 'F': case 'f': - goto yy395; + goto yy359; case 'H': case 'h': - goto yy396; + goto yy360; case 'I': case 'i': - goto yy397; + goto yy361; case 'R': case 'r': - goto yy398; + goto yy362; default: - goto yy333; + goto yy298; } - yy351: + yy315: yych = *++p; if (yych == 'L') - goto yy367; + goto yy331; if (yych == 'l') - goto yy367; - goto yy333; - yy352: + goto yy331; + goto yy298; + yy316: yych = *++p; if (yych == '-') - goto yy399; - goto yy333; - yy353: + goto yy363; + goto yy298; + yy317: ++p; { return 4; } - yy355: + yy318: yych = *++p; if (yych == 'C') - goto yy401; + goto yy364; if (yych == 'c') - goto yy401; - goto yy333; - yy356: + goto yy364; + goto yy298; + yy319: yych = *++p; if (yych <= '/') { if (yych <= 0x1F) { if (yych <= 0x08) - goto yy333; + goto yy298; if (yych <= '\r') - goto yy383; - goto yy333; + goto yy347; + goto yy298; } else { if (yych <= ' ') - goto yy383; + goto yy347; if (yych <= '.') - goto yy333; - goto yy385; + goto yy298; + goto yy348; } } else { if (yych <= '@') { if (yych == '>') - goto yy383; - goto yy333; + goto yy347; + goto yy298; } else { if (yych <= 'A') - goto yy386; + goto yy349; if (yych == 'a') - goto yy386; - goto yy333; + goto yy349; + goto yy298; } } - yy357: + yy320: yych = *++p; if (yych <= 'U') { if (yych <= 'N') { if (yych == 'E') - goto yy389; - goto yy333; + goto yy352; + goto yy298; } else { if (yych <= 'O') - goto yy390; + goto yy353; if (yych <= 'T') - goto yy333; - goto yy392; + goto yy298; + goto yy355; } } else { if (yych <= 'n') { if (yych == 'e') - goto yy389; - goto yy333; + goto yy352; + goto yy298; } else { if (yych <= 'o') - goto yy390; + goto yy353; if (yych == 'u') - goto yy392; - goto yy333; + goto yy355; + goto yy298; } } - yy358: + yy321: + yych = *++p; + switch (yych) { + case 'A': + case 'a': + goto yy356; + case 'B': + case 'b': + goto yy357; + case 'D': + case 'd': + goto yy331; + case 'F': + case 'f': + goto yy359; + case 'H': + case 'h': + goto yy360; + case 'I': + case 'i': + goto yy361; + case 'R': + case 'r': + goto yy362; + default: + goto yy298; + } + yy322: yych = *++p; if (yych == 'D') - goto yy402; + goto yy365; if (yych == 'd') - goto yy402; - goto yy333; - yy359: + goto yy365; + goto yy298; + yy323: yych = *++p; if (yych == 'T') - goto yy403; + goto yy366; if (yych == 't') - goto yy403; - goto yy333; - yy360: + goto yy366; + goto yy298; + yy324: yych = *++p; if (yych == 'I') - goto yy404; + goto yy367; if (yych == 'i') - goto yy404; - goto yy333; - yy361: + goto yy367; + goto yy298; + yy325: yych = *++p; if (yych == 'S') - goto yy405; + goto yy368; if (yych == 's') - goto yy405; - goto yy333; - yy362: + goto yy368; + goto yy298; + yy326: yych = *++p; if (yych == 'O') - goto yy406; + goto yy369; if (yych == 'o') - goto yy406; - goto yy333; - yy363: + goto yy369; + goto yy298; + yy327: yych = *++p; if (yych == 'D') - goto yy407; + goto yy370; if (yych == 'd') - goto yy407; - goto yy333; - yy364: + goto yy370; + goto yy298; + yy328: yych = *++p; if (yych == 'P') - goto yy408; + goto yy371; if (yych == 'p') - goto yy408; - goto yy333; - yy365: + goto yy371; + goto yy298; + yy329: yych = *++p; if (yych == 'N') - goto yy409; + goto yy372; if (yych == 'n') - goto yy409; - goto yy333; - yy366: + goto yy372; + goto yy298; + yy330: yych = *++p; if (yych == 'L') - goto yy410; + goto yy373; if (yych == 'l') - goto yy410; - goto yy333; - yy367: + goto yy373; + goto yy298; + yy331: yych = *++p; if (yych <= ' ') { if (yych <= 0x08) - goto yy333; + goto yy298; if (yych <= '\r') - goto yy383; + goto yy347; if (yych <= 0x1F) - goto yy333; - goto yy383; + goto yy298; + goto yy347; } else { if (yych <= '/') { if (yych <= '.') - goto yy333; - goto yy385; + goto yy298; + goto yy348; } else { if (yych == '>') - goto yy383; - goto yy333; + goto yy347; + goto yy298; } } - yy368: + yy332: yych = *++p; if (yych == 'T') - goto yy411; + goto yy374; if (yych == 't') - goto yy411; - goto yy333; - yy369: + goto yy374; + goto yy298; + yy333: yych = *++p; if (yych <= 'V') { if (yych <= 'Q') { if (yych == 'A') - goto yy412; - goto yy333; + goto yy375; + goto yy298; } else { if (yych <= 'R') - goto yy367; + goto yy331; if (yych <= 'U') - goto yy333; - goto yy367; + goto yy298; + goto yy331; } } else { if (yych <= 'q') { if (yych == 'a') - goto yy412; - goto yy333; + goto yy375; + goto yy298; } else { if (yych <= 'r') - goto yy367; + goto yy331; if (yych == 'v') - goto yy367; - goto yy333; + goto yy331; + goto yy298; } } - yy370: + yy334: yych = *++p; if (yych <= 'G') { if (yych == 'E') - goto yy413; + goto yy376; if (yych <= 'F') - goto yy333; - goto yy414; + goto yy298; + goto yy377; } else { if (yych <= 'e') { if (yych <= 'd') - goto yy333; - goto yy413; + goto yy298; + goto yy376; } else { if (yych == 'g') - goto yy414; - goto yy333; + goto yy377; + goto yy298; } } - yy371: + yy335: yych = *++p; if (yych <= 'R') { if (yych == 'O') - goto yy409; + goto yy372; if (yych <= 'Q') - goto yy333; - goto yy415; + goto yy298; + goto yy378; } else { if (yych <= 'o') { if (yych <= 'n') - goto yy333; - goto yy409; + goto yy298; + goto yy372; } else { if (yych == 'r') - goto yy415; - goto yy333; + goto yy378; + goto yy298; } } - yy372: + yy336: yych = *++p; if (yych == 'A') - goto yy416; + goto yy379; if (yych == 'a') - goto yy416; - goto yy333; - yy373: + goto yy379; + goto yy298; + yy337: yych = *++p; if (yych == 'A') - goto yy417; + goto yy380; if (yych == 'a') - goto yy417; - goto yy333; - yy374: + goto yy380; + goto yy298; + yy338: yych = *++p; if (yych == 'M') - goto yy351; + goto yy315; if (yych == 'm') - goto yy351; - goto yy333; - yy375: + goto yy315; + goto yy298; + yy339: yych = *++p; if (yych == 'R') - goto yy418; + goto yy381; if (yych == 'r') - goto yy418; - goto yy333; - yy376: + goto yy381; + goto yy298; + yy340: yych = *++p; if (yych == 'G') - goto yy419; + goto yy382; if (yych == 'g') - goto yy419; - goto yy333; - yy377: + goto yy382; + goto yy298; + yy341: yych = *++p; if (yych <= '/') { if (yych <= 0x1F) { if (yych <= 0x08) - goto yy333; + goto yy298; if (yych <= '\r') - goto yy383; - goto yy333; + goto yy347; + goto yy298; } else { if (yych <= ' ') - goto yy383; + goto yy347; if (yych <= '.') - goto yy333; - goto yy385; + goto yy298; + goto yy348; } } else { if (yych <= 'M') { if (yych == '>') - goto yy383; - goto yy333; + goto yy347; + goto yy298; } else { if (yych <= 'N') - goto yy420; + goto yy383; if (yych == 'n') - goto yy420; - goto yy333; + goto yy383; + goto yy298; } } - yy378: + yy342: yych = *++p; if (yych == 'I') - goto yy421; + goto yy384; if (yych == 'i') - goto yy421; - goto yy333; - yy379: + goto yy384; + goto yy298; + yy343: yych = *++p; if (yych == 'N') - goto yy422; + goto yy385; if (yych == 'n') - goto yy422; - goto yy333; - yy380: + goto yy385; + goto yy298; + yy344: yych = *++p; if (yych == 'V') - goto yy367; + goto yy331; if (yych == 'v') - goto yy367; - goto yy333; - yy381: + goto yy331; + goto yy298; + yy345: yych = *++p; if (yych == 'F') - goto yy423; + goto yy386; if (yych == 'f') - goto yy423; - goto yy333; - yy382: + goto yy386; + goto yy298; + yy346: yych = *++p; if (yych == 'T') - goto yy424; + goto yy387; if (yych == 't') - goto yy424; - goto yy333; - yy383: + goto yy387; + goto yy298; + yy347: ++p; { return 6; } - yy385: + yy348: yych = *++p; if (yych == '>') - goto yy383; - goto yy333; - yy386: + goto yy347; + goto yy298; + yy349: yych = *++p; if (yych == 'R') - goto yy425; + goto yy388; if (yych == 'r') - goto yy425; - goto yy333; - yy387: + goto yy388; + goto yy298; + yy350: yych = *++p; if (yych == 'E') - goto yy426; + goto yy389; if (yych == 'e') - goto yy426; - goto yy333; - yy388: + goto yy389; + goto yy298; + yy351: yych = *++p; if (yych == 'R') - goto yy427; + goto yy390; if (yych == 'r') - goto yy427; - goto yy333; - yy389: + goto yy390; + goto yy298; + yy352: yych = *++p; if (yych == 'C') - goto yy408; + goto yy371; if (yych == 'c') - goto yy408; - goto yy333; - yy390: + goto yy371; + goto yy298; + yy353: yych = *++p; if (yych == 'U') - goto yy428; + goto yy391; if (yych == 'u') - goto yy428; - goto yy333; - yy391: + goto yy391; + goto yy298; + yy354: yych = *++p; if (yych == 'Y') - goto yy429; + goto yy392; if (yych == 'y') - goto yy429; - goto yy333; - yy392: + goto yy392; + goto yy298; + yy355: yych = *++p; if (yych == 'M') - goto yy430; + goto yy393; if (yych == 'm') - goto yy430; - goto yy333; - yy393: + goto yy393; + goto yy298; + yy356: yych = *++p; if (yych == 'B') - goto yy431; + goto yy394; if (yych == 'b') - goto yy431; - goto yy333; - yy394: + goto yy394; + goto yy298; + yy357: yych = *++p; if (yych == 'O') - goto yy363; + goto yy327; if (yych == 'o') - goto yy363; - goto yy333; - yy395: + goto yy327; + goto yy298; + yy358: + yych = *++p; + if (yych == 'X') + goto yy395; + if (yych == 'x') + goto yy395; + goto yy298; + yy359: yych = *++p; if (yych == 'O') - goto yy432; + goto yy396; if (yych == 'o') - goto yy432; - goto yy333; - yy396: + goto yy396; + goto yy298; + yy360: yych = *++p; if (yych <= '/') { if (yych <= 0x1F) { if (yych <= 0x08) - goto yy333; + goto yy298; if (yych <= '\r') - goto yy383; - goto yy333; + goto yy347; + goto yy298; } else { if (yych <= ' ') - goto yy383; + goto yy347; if (yych <= '.') - goto yy333; - goto yy385; + goto yy298; + goto yy348; } } else { if (yych <= 'D') { if (yych == '>') - goto yy383; - goto yy333; + goto yy347; + goto yy298; } else { if (yych <= 'E') - goto yy433; + goto yy397; if (yych == 'e') - goto yy433; - goto yy333; + goto yy397; + goto yy298; } } - yy397: + yy361: yych = *++p; if (yych == 'T') - goto yy431; + goto yy394; if (yych == 't') - goto yy431; - goto yy333; - yy398: + goto yy394; + goto yy298; + yy362: yych = *++p; if (yych <= '/') { if (yych <= 0x1F) { if (yych <= 0x08) - goto yy333; + goto yy298; if (yych <= '\r') - goto yy383; - goto yy333; + goto yy347; + goto yy298; } else { if (yych <= ' ') - goto yy383; + goto yy347; if (yych <= '.') - goto yy333; - goto yy385; + goto yy298; + goto yy348; } } else { if (yych <= '@') { if (yych == '>') - goto yy383; - goto yy333; + goto yy347; + goto yy298; } else { if (yych <= 'A') - goto yy434; + goto yy398; if (yych == 'a') - goto yy434; - goto yy333; + goto yy398; + goto yy298; } } - yy399: + yy363: ++p; { return 2; } - yy401: + yy364: yych = *++p; if (yych == 'D') - goto yy435; + goto yy399; if (yych == 'd') - goto yy435; - goto yy333; - yy402: + goto yy399; + goto yy298; + yy365: yych = *++p; if (yych == 'R') - goto yy436; + goto yy400; if (yych == 'r') - goto yy436; - goto yy333; - yy403: + goto yy400; + goto yy298; + yy366: yych = *++p; if (yych == 'I') - goto yy437; + goto yy401; if (yych == 'i') - goto yy437; - goto yy333; - yy404: + goto yy401; + goto yy298; + yy367: yych = *++p; if (yych == 'D') - goto yy438; + goto yy402; if (yych == 'd') - goto yy438; - goto yy333; - yy405: + goto yy402; + goto yy298; + yy368: yych = *++p; if (yych == 'E') - goto yy439; + goto yy403; if (yych == 'e') - goto yy439; - goto yy333; - yy406: + goto yy403; + goto yy298; + yy369: yych = *++p; if (yych == 'C') - goto yy440; + goto yy404; if (yych == 'c') - goto yy440; - goto yy333; - yy407: + goto yy404; + goto yy298; + yy370: yych = *++p; if (yych == 'Y') - goto yy367; + goto yy331; if (yych == 'y') - goto yy367; - goto yy333; - yy408: + goto yy331; + goto yy298; + yy371: yych = *++p; if (yych == 'T') - goto yy441; + goto yy405; if (yych == 't') - goto yy441; - goto yy333; - yy409: + goto yy405; + goto yy298; + yy372: yych = *++p; if (yych == 'T') - goto yy442; + goto yy406; if (yych == 't') - goto yy442; - goto yy333; - yy410: + goto yy406; + goto yy298; + yy373: yych = *++p; if (yych <= '/') { if (yych <= 0x1F) { if (yych <= 0x08) - goto yy333; + goto yy298; if (yych <= '\r') - goto yy383; - goto yy333; + goto yy347; + goto yy298; } else { if (yych <= ' ') - goto yy383; + goto yy347; if (yych <= '.') - goto yy333; - goto yy385; + goto yy298; + goto yy348; } } else { if (yych <= 'F') { if (yych == '>') - goto yy383; - goto yy333; + goto yy347; + goto yy298; } else { if (yych <= 'G') - goto yy443; + goto yy407; if (yych == 'g') - goto yy443; - goto yy333; + goto yy407; + goto yy298; } } - yy411: + yy374: yych = *++p; if (yych == 'A') - goto yy444; + goto yy408; if (yych == 'a') - goto yy444; - goto yy333; - yy412: + goto yy408; + goto yy298; + yy375: yych = *++p; if (yych == 'L') - goto yy445; + goto yy409; if (yych == 'l') - goto yy445; - goto yy333; - yy413: + goto yy409; + goto yy298; + yy376: yych = *++p; if (yych == 'L') - goto yy446; + goto yy410; if (yych == 'l') - goto yy446; - goto yy333; - yy414: + goto yy410; + goto yy298; + yy377: yych = *++p; if (yych <= 'U') { if (yych == 'C') - goto yy447; + goto yy411; if (yych <= 'T') - goto yy333; - goto yy448; + goto yy298; + goto yy412; } else { if (yych <= 'c') { if (yych <= 'b') - goto yy333; - goto yy447; + goto yy298; + goto yy411; } else { if (yych == 'u') - goto yy448; - goto yy333; + goto yy412; + goto yy298; } } - yy415: + yy378: yych = *++p; if (yych == 'M') - goto yy367; + goto yy331; if (yych == 'm') - goto yy367; - goto yy333; - yy416: + goto yy331; + goto yy298; + yy379: yych = *++p; if (yych == 'M') - goto yy449; + goto yy413; if (yych == 'm') - goto yy449; - goto yy333; - yy417: + goto yy413; + goto yy298; + yy380: yych = *++p; if (yych == 'D') - goto yy450; + goto yy414; if (yych == 'd') - goto yy450; - goto yy333; - yy418: + goto yy414; + goto yy298; + yy381: yych = *++p; if (yych == 'A') - goto yy451; + goto yy415; if (yych == 'a') - goto yy451; - goto yy333; - yy419: + goto yy415; + goto yy298; + yy382: yych = *++p; if (yych == 'E') - goto yy452; + goto yy416; if (yych == 'e') - goto yy452; - goto yy333; - yy420: + goto yy416; + goto yy298; + yy383: yych = *++p; if (yych == 'K') - goto yy367; + goto yy331; if (yych == 'k') - goto yy367; - goto yy333; - yy421: + goto yy331; + goto yy298; + yy384: yych = *++p; if (yych == 'N') - goto yy367; + goto yy331; if (yych == 'n') - goto yy367; - goto yy333; - yy422: + goto yy331; + goto yy298; + yy385: yych = *++p; if (yych == 'U') - goto yy453; + goto yy417; if (yych == 'u') - goto yy453; - goto yy333; - yy423: + goto yy417; + goto yy298; + yy386: yych = *++p; if (yych == 'R') - goto yy454; + goto yy418; if (yych == 'r') - goto yy454; - goto yy333; - yy424: + goto yy418; + goto yy298; + yy387: yych = *++p; if (yych <= 'I') { if (yych == 'G') - goto yy443; + goto yy407; if (yych <= 'H') - goto yy333; - goto yy455; + goto yy298; + goto yy419; } else { if (yych <= 'g') { if (yych <= 'f') - goto yy333; - goto yy443; + goto yy298; + goto yy407; } else { if (yych == 'i') - goto yy455; - goto yy333; + goto yy419; + goto yy298; } } - yy425: + yy388: yych = *++p; if (yych == 'A') - goto yy415; + goto yy378; if (yych == 'a') - goto yy415; - goto yy333; - yy426: + goto yy378; + goto yy298; + yy389: yych = *++p; if (yych <= 0x1F) { if (yych <= 0x08) - goto yy333; + goto yy298; if (yych <= '\r') - goto yy456; - goto yy333; + goto yy420; + goto yy298; } else { if (yych <= ' ') - goto yy456; + goto yy420; if (yych == '>') - goto yy456; - goto yy333; + goto yy420; + goto yy298; } - yy427: + yy390: yych = *++p; if (yych == 'I') - goto yy458; + goto yy421; if (yych == 'i') - goto yy458; - goto yy333; - yy428: + goto yy421; + goto yy298; + yy391: yych = *++p; if (yych == 'R') - goto yy459; + goto yy422; if (yych == 'r') - goto yy459; - goto yy333; - yy429: + goto yy422; + goto yy298; + yy392: yych = *++p; if (yych == 'L') - goto yy387; + goto yy350; if (yych == 'l') - goto yy387; - goto yy333; - yy430: + goto yy350; + goto yy298; + yy393: yych = *++p; if (yych == 'M') - goto yy460; + goto yy423; if (yych == 'm') - goto yy460; - goto yy333; - yy431: + goto yy423; + goto yy298; + yy394: yych = *++p; if (yych == 'L') - goto yy438; + goto yy402; if (yych == 'l') - goto yy438; - goto yy333; - yy432: + goto yy402; + goto yy298; + yy395: + yych = *++p; + if (yych == 'T') + goto yy424; + if (yych == 't') + goto yy424; + goto yy298; + yy396: yych = *++p; if (yych == 'O') - goto yy461; + goto yy425; if (yych == 'o') - goto yy461; - goto yy333; - yy433: + goto yy425; + goto yy298; + yy397: yych = *++p; if (yych == 'A') - goto yy462; + goto yy426; if (yych == 'a') - goto yy462; - goto yy333; - yy434: + goto yy426; + goto yy298; + yy398: yych = *++p; if (yych == 'C') - goto yy420; + goto yy383; if (yych == 'c') - goto yy420; - goto yy333; - yy435: + goto yy383; + goto yy298; + yy399: yych = *++p; if (yych == 'A') - goto yy463; + goto yy427; if (yych == 'a') - goto yy463; - goto yy333; - yy436: + goto yy427; + goto yy298; + yy400: yych = *++p; if (yych == 'E') - goto yy464; + goto yy428; if (yych == 'e') - goto yy464; - goto yy333; - yy437: + goto yy428; + goto yy298; + yy401: yych = *++p; if (yych == 'C') - goto yy431; + goto yy394; if (yych == 'c') - goto yy431; - goto yy333; - yy438: + goto yy394; + goto yy298; + yy402: yych = *++p; if (yych == 'E') - goto yy367; + goto yy331; if (yych == 'e') - goto yy367; - goto yy333; - yy439: + goto yy331; + goto yy298; + yy403: yych = *++p; if (yych <= '/') { if (yych <= 0x1F) { if (yych <= 0x08) - goto yy333; + goto yy298; if (yych <= '\r') - goto yy383; - goto yy333; + goto yy347; + goto yy298; } else { if (yych <= ' ') - goto yy383; + goto yy347; if (yych <= '.') - goto yy333; - goto yy385; + goto yy298; + goto yy348; } } else { if (yych <= 'E') { if (yych == '>') - goto yy383; - goto yy333; + goto yy347; + goto yy298; } else { if (yych <= 'F') - goto yy465; + goto yy429; if (yych == 'f') - goto yy465; - goto yy333; + goto yy429; + goto yy298; } } - yy440: + yy404: yych = *++p; if (yych == 'K') - goto yy466; + goto yy430; if (yych == 'k') - goto yy466; - goto yy333; - yy441: + goto yy430; + goto yy298; + yy405: yych = *++p; if (yych == 'I') - goto yy455; + goto yy419; if (yych == 'i') - goto yy455; - goto yy333; - yy442: + goto yy419; + goto yy298; + yy406: yych = *++p; if (yych == 'E') - goto yy467; + goto yy431; if (yych == 'e') - goto yy467; - goto yy333; - yy443: + goto yy431; + goto yy298; + yy407: yych = *++p; if (yych == 'R') - goto yy468; + goto yy432; if (yych == 'r') - goto yy468; - goto yy333; - yy444: + goto yy432; + goto yy298; + yy408: yych = *++p; if (yych == 'I') - goto yy469; + goto yy433; if (yych == 'i') - goto yy469; - goto yy333; - yy445: + goto yy433; + goto yy298; + yy409: yych = *++p; if (yych == 'O') - goto yy470; + goto yy434; if (yych == 'o') - goto yy470; - goto yy333; - yy446: + goto yy434; + goto yy298; + yy410: yych = *++p; if (yych == 'D') - goto yy471; + goto yy435; if (yych == 'd') - goto yy471; - goto yy333; - yy447: + goto yy435; + goto yy298; + yy411: yych = *++p; if (yych == 'A') - goto yy364; + goto yy328; if (yych == 'a') - goto yy364; - goto yy333; - yy448: + goto yy328; + goto yy298; + yy412: yych = *++p; if (yych == 'R') - goto yy438; + goto yy402; if (yych == 'r') - goto yy438; - goto yy333; - yy449: + goto yy402; + goto yy298; + yy413: yych = *++p; if (yych == 'E') - goto yy472; + goto yy436; if (yych == 'e') - goto yy472; - goto yy333; - yy450: + goto yy436; + goto yy298; + yy414: yych = *++p; if (yych <= '/') { if (yych <= 0x1F) { if (yych <= 0x08) - goto yy333; + goto yy298; if (yych <= '\r') - goto yy383; - goto yy333; + goto yy347; + goto yy298; } else { if (yych <= ' ') - goto yy383; + goto yy347; if (yych <= '.') - goto yy333; - goto yy385; + goto yy298; + goto yy348; } } else { if (yych <= 'D') { if (yych == '>') - goto yy383; - goto yy333; + goto yy347; + goto yy298; } else { if (yych <= 'E') - goto yy467; + goto yy431; if (yych == 'e') - goto yy467; - goto yy333; + goto yy431; + goto yy298; } } - yy451: + yy415: yych = *++p; if (yych == 'M') - goto yy438; + goto yy402; if (yych == 'm') - goto yy438; - goto yy333; - yy452: + goto yy402; + goto yy298; + yy416: yych = *++p; if (yych == 'N') - goto yy462; + goto yy426; if (yych == 'n') - goto yy462; - goto yy333; - yy453: + goto yy426; + goto yy298; + yy417: yych = *++p; if (yych <= '/') { if (yych <= 0x1F) { if (yych <= 0x08) - goto yy333; + goto yy298; if (yych <= '\r') - goto yy383; - goto yy333; + goto yy347; + goto yy298; } else { if (yych <= ' ') - goto yy383; + goto yy347; if (yych <= '.') - goto yy333; - goto yy385; + goto yy298; + goto yy348; } } else { if (yych <= 'H') { if (yych == '>') - goto yy383; - goto yy333; + goto yy347; + goto yy298; } else { if (yych <= 'I') - goto yy473; + goto yy437; if (yych == 'i') - goto yy473; - goto yy333; + goto yy437; + goto yy298; } } - yy454: + yy418: yych = *++p; if (yych == 'A') - goto yy474; + goto yy438; if (yych == 'a') - goto yy474; - goto yy333; - yy455: + goto yy438; + goto yy298; + yy419: yych = *++p; if (yych == 'O') - goto yy421; + goto yy384; if (yych == 'o') - goto yy421; - goto yy333; - yy456: + goto yy384; + goto yy298; + yy420: ++p; { return 1; } - yy458: + yy421: yych = *++p; if (yych == 'P') - goto yy475; + goto yy439; if (yych == 'p') - goto yy475; - goto yy333; - yy459: + goto yy439; + goto yy298; + yy422: yych = *++p; if (yych == 'C') - goto yy438; + goto yy402; if (yych == 'c') - goto yy438; - goto yy333; - yy460: + goto yy402; + goto yy298; + yy423: yych = *++p; if (yych == 'A') - goto yy476; + goto yy440; if (yych == 'a') - goto yy476; - goto yy333; - yy461: + goto yy440; + goto yy298; + yy424: + yych = *++p; + if (yych == 'A') + goto yy441; + if (yych == 'a') + goto yy441; + goto yy298; + yy425: yych = *++p; if (yych == 'T') - goto yy367; + goto yy331; if (yych == 't') - goto yy367; - goto yy333; - yy462: + goto yy331; + goto yy298; + yy426: yych = *++p; if (yych == 'D') - goto yy367; + goto yy331; if (yych == 'd') - goto yy367; - goto yy333; - yy463: + goto yy331; + goto yy298; + yy427: yych = *++p; if (yych == 'T') - goto yy477; + goto yy442; if (yych == 't') - goto yy477; - goto yy333; - yy464: + goto yy442; + goto yy298; + yy428: yych = *++p; if (yych == 'S') - goto yy478; + goto yy443; if (yych == 's') - goto yy478; - goto yy333; - yy465: + goto yy443; + goto yy298; + yy429: yych = *++p; if (yych == 'O') - goto yy479; + goto yy444; if (yych == 'o') - goto yy479; - goto yy333; - yy466: + goto yy444; + goto yy298; + yy430: yych = *++p; if (yych == 'Q') - goto yy480; + goto yy445; if (yych == 'q') - goto yy480; - goto yy333; - yy467: + goto yy445; + goto yy298; + yy431: yych = *++p; if (yych == 'R') - goto yy367; + goto yy331; if (yych == 'r') - goto yy367; - goto yy333; - yy468: + goto yy331; + goto yy298; + yy432: yych = *++p; if (yych == 'O') - goto yy481; + goto yy446; if (yych == 'o') - goto yy481; - goto yy333; - yy469: + goto yy446; + goto yy298; + yy433: yych = *++p; if (yych == 'L') - goto yy478; + goto yy443; if (yych == 'l') - goto yy478; - goto yy333; - yy470: + goto yy443; + goto yy298; + yy434: yych = *++p; if (yych == 'G') - goto yy367; + goto yy331; if (yych == 'g') - goto yy367; - goto yy333; - yy471: + goto yy331; + goto yy298; + yy435: yych = *++p; if (yych == 'S') - goto yy482; + goto yy447; if (yych == 's') - goto yy482; - goto yy333; - yy472: + goto yy447; + goto yy298; + yy436: yych = *++p; if (yych <= '/') { if (yych <= 0x1F) { if (yych <= 0x08) - goto yy333; + goto yy298; if (yych <= '\r') - goto yy383; - goto yy333; + goto yy347; + goto yy298; } else { if (yych <= ' ') - goto yy383; + goto yy347; if (yych <= '.') - goto yy333; - goto yy385; + goto yy298; + goto yy348; } } else { if (yych <= 'R') { if (yych == '>') - goto yy383; - goto yy333; + goto yy347; + goto yy298; } else { if (yych <= 'S') - goto yy482; + goto yy447; if (yych == 's') - goto yy482; - goto yy333; + goto yy447; + goto yy298; } } - yy473: + yy437: yych = *++p; if (yych == 'T') - goto yy483; + goto yy448; if (yych == 't') - goto yy483; - goto yy333; - yy474: + goto yy448; + goto yy298; + yy438: yych = *++p; if (yych == 'M') - goto yy484; + goto yy449; if (yych == 'm') - goto yy484; - goto yy333; - yy475: + goto yy449; + goto yy298; + yy439: yych = *++p; if (yych == 'T') - goto yy426; + goto yy389; if (yych == 't') - goto yy426; - goto yy333; - yy476: + goto yy389; + goto yy298; + yy440: yych = *++p; if (yych == 'R') - goto yy407; + goto yy370; if (yych == 'r') - goto yy407; - goto yy333; - yy477: + goto yy370; + goto yy298; + yy441: + yych = *++p; + if (yych == 'R') + goto yy450; + if (yych == 'r') + goto yy450; + goto yy298; + yy442: yych = *++p; if (yych == 'A') - goto yy485; + goto yy451; if (yych == 'a') - goto yy485; - goto yy333; - yy478: + goto yy451; + goto yy298; + yy443: yych = *++p; if (yych == 'S') - goto yy367; + goto yy331; if (yych == 's') - goto yy367; - goto yy333; - yy479: + goto yy331; + goto yy298; + yy444: yych = *++p; if (yych == 'N') - goto yy461; + goto yy425; if (yych == 'n') - goto yy461; - goto yy333; - yy480: + goto yy425; + goto yy298; + yy445: yych = *++p; if (yych == 'U') - goto yy486; + goto yy452; if (yych == 'u') - goto yy486; - goto yy333; - yy481: + goto yy452; + goto yy298; + yy446: yych = *++p; if (yych == 'U') - goto yy487; + goto yy453; if (yych == 'u') - goto yy487; - goto yy333; - yy482: + goto yy453; + goto yy298; + yy447: yych = *++p; if (yych == 'E') - goto yy461; + goto yy425; if (yych == 'e') - goto yy461; - goto yy333; - yy483: + goto yy425; + goto yy298; + yy448: yych = *++p; if (yych == 'E') - goto yy415; + goto yy378; if (yych == 'e') - goto yy415; - goto yy333; - yy484: + goto yy378; + goto yy298; + yy449: yych = *++p; if (yych == 'E') - goto yy478; + goto yy443; if (yych == 'e') - goto yy478; - goto yy333; - yy485: + goto yy443; + goto yy298; + yy450: + yych = *++p; + if (yych == 'E') + goto yy454; + if (yych == 'e') + goto yy454; + goto yy298; + yy451: yych = *++p; if (yych == '[') - goto yy488; - goto yy333; - yy486: + goto yy455; + goto yy298; + yy452: yych = *++p; if (yych == 'O') - goto yy490; + goto yy456; if (yych == 'o') - goto yy490; - goto yy333; - yy487: + goto yy456; + goto yy298; + yy453: yych = *++p; if (yych == 'P') - goto yy367; + goto yy331; if (yych == 'p') - goto yy367; - goto yy333; - yy488: + goto yy331; + goto yy298; + yy454: + yych = *++p; + if (yych == 'A') + goto yy389; + if (yych == 'a') + goto yy389; + goto yy298; + yy455: ++p; { return 5; } - yy490: - ++p; - if ((yych = *p) == 'T') - goto yy438; + yy456: + yych = *++p; + if (yych == 'T') + goto yy402; if (yych == 't') - goto yy438; - goto yy333; + goto yy402; + goto yy298; } } @@ -8401,591 +8292,557 @@ bufsize_t _scan_html_block_start_7(const unsigned char *p) { }; yych = *p; if (yych == '<') - goto yy495; + goto yy459; ++p; - yy494 : { return 0; } - yy495: + yy458 : { return 0; } + yy459: yyaccept = 0; yych = *(marker = ++p); if (yych <= '@') { if (yych != '/') - goto yy494; + goto yy458; } else { if (yych <= 'Z') - goto yy498; + goto yy461; if (yych <= '`') - goto yy494; + goto yy458; if (yych <= 'z') - goto yy498; - goto yy494; + goto yy461; + goto yy458; } yych = *++p; if (yych <= '@') - goto yy497; + goto yy460; if (yych <= 'Z') - goto yy500; + goto yy462; if (yych <= '`') - goto yy497; + goto yy460; if (yych <= 'z') - goto yy500; - yy497: + goto yy462; + yy460: p = marker; if (yyaccept == 0) { - goto yy494; + goto yy458; } else { - goto yy513; + goto yy469; } - yy498: - ++p; - yych = *p; + yy461: + yych = *++p; if (yybm[0 + yych] & 2) { - goto yy502; + goto yy463; } if (yych <= '=') { if (yych <= '.') { if (yych == '-') - goto yy498; - goto yy497; + goto yy461; + goto yy460; } else { if (yych <= '/') - goto yy504; + goto yy464; if (yych <= '9') - goto yy498; - goto yy497; + goto yy461; + goto yy460; } } else { if (yych <= 'Z') { if (yych <= '>') - goto yy505; + goto yy465; if (yych <= '@') - goto yy497; - goto yy498; + goto yy460; + goto yy461; } else { if (yych <= '`') - goto yy497; + goto yy460; if (yych <= 'z') - goto yy498; - goto yy497; + goto yy461; + goto yy460; } } - yy500: - ++p; - yych = *p; + yy462: + yych = *++p; if (yych <= '/') { if (yych <= 0x1F) { if (yych <= 0x08) - goto yy497; + goto yy460; if (yych <= '\r') - goto yy507; - goto yy497; + goto yy466; + goto yy460; } else { if (yych <= ' ') - goto yy507; + goto yy466; if (yych == '-') - goto yy500; - goto yy497; + goto yy462; + goto yy460; } } else { if (yych <= '@') { if (yych <= '9') - goto yy500; + goto yy462; if (yych == '>') - goto yy505; - goto yy497; + goto yy465; + goto yy460; } else { if (yych <= 'Z') - goto yy500; + goto yy462; if (yych <= '`') - goto yy497; + goto yy460; if (yych <= 'z') - goto yy500; - goto yy497; + goto yy462; + goto yy460; } } - yy502: - ++p; - yych = *p; + yy463: + yych = *++p; if (yybm[0 + yych] & 2) { - goto yy502; + goto yy463; } if (yych <= '>') { if (yych <= '9') { if (yych != '/') - goto yy497; + goto yy460; } else { if (yych <= ':') - goto yy509; + goto yy467; if (yych <= '=') - goto yy497; - goto yy505; + goto yy460; + goto yy465; } } else { if (yych <= '^') { if (yych <= '@') - goto yy497; + goto yy460; if (yych <= 'Z') - goto yy509; - goto yy497; + goto yy467; + goto yy460; } else { if (yych == '`') - goto yy497; + goto yy460; if (yych <= 'z') - goto yy509; - goto yy497; + goto yy467; + goto yy460; } } - yy504: + yy464: yych = *++p; if (yych != '>') - goto yy497; - yy505: - ++p; - yych = *p; + goto yy460; + yy465: + yych = *++p; if (yybm[0 + yych] & 4) { - goto yy505; + goto yy465; } if (yych <= 0x08) - goto yy497; + goto yy460; if (yych <= '\n') - goto yy511; + goto yy468; if (yych <= '\v') - goto yy497; + goto yy460; if (yych <= '\r') - goto yy514; - goto yy497; - yy507: - ++p; - yych = *p; + goto yy470; + goto yy460; + yy466: + yych = *++p; if (yych <= 0x1F) { if (yych <= 0x08) - goto yy497; + goto yy460; if (yych <= '\r') - goto yy507; - goto yy497; + goto yy466; + goto yy460; } else { if (yych <= ' ') - goto yy507; + goto yy466; if (yych == '>') - goto yy505; - goto yy497; + goto yy465; + goto yy460; } - yy509: - ++p; - yych = *p; + yy467: + yych = *++p; if (yybm[0 + yych] & 8) { - goto yy509; + goto yy467; } if (yych <= ',') { if (yych <= '\r') { if (yych <= 0x08) - goto yy497; - goto yy515; + goto yy460; + goto yy471; } else { if (yych == ' ') - goto yy515; - goto yy497; + goto yy471; + goto yy460; } } else { if (yych <= '<') { if (yych <= '/') - goto yy504; - goto yy497; + goto yy464; + goto yy460; } else { if (yych <= '=') - goto yy517; + goto yy472; if (yych <= '>') - goto yy505; - goto yy497; + goto yy465; + goto yy460; } } - yy511: + yy468: yyaccept = 1; - marker = ++p; - yych = *p; + yych = *(marker = ++p); if (yybm[0 + yych] & 4) { - goto yy505; + goto yy465; } if (yych <= 0x08) - goto yy513; + goto yy469; if (yych <= '\n') - goto yy511; + goto yy468; if (yych <= '\v') - goto yy513; + goto yy469; if (yych <= '\r') - goto yy514; - yy513 : { return 7; } - yy514: - yych = *++p; - goto yy513; - yy515: + goto yy470; + yy469 : { return 7; } + yy470: ++p; - yych = *p; + goto yy469; + yy471: + yych = *++p; if (yych <= '<') { if (yych <= ' ') { if (yych <= 0x08) - goto yy497; + goto yy460; if (yych <= '\r') - goto yy515; + goto yy471; if (yych <= 0x1F) - goto yy497; - goto yy515; + goto yy460; + goto yy471; } else { if (yych <= '/') { if (yych <= '.') - goto yy497; - goto yy504; + goto yy460; + goto yy464; } else { if (yych == ':') - goto yy509; - goto yy497; + goto yy467; + goto yy460; } } } else { if (yych <= 'Z') { if (yych <= '=') - goto yy517; + goto yy472; if (yych <= '>') - goto yy505; + goto yy465; if (yych <= '@') - goto yy497; - goto yy509; + goto yy460; + goto yy467; } else { if (yych <= '_') { if (yych <= '^') - goto yy497; - goto yy509; + goto yy460; + goto yy467; } else { if (yych <= '`') - goto yy497; + goto yy460; if (yych <= 'z') - goto yy509; - goto yy497; + goto yy467; + goto yy460; } } } - yy517: - ++p; - yych = *p; + yy472: + yych = *++p; if (yybm[0 + yych] & 32) { - goto yy519; + goto yy473; } if (yych <= 0xE0) { if (yych <= '"') { if (yych <= 0x00) - goto yy497; + goto yy460; if (yych <= ' ') - goto yy517; - goto yy521; + goto yy472; + goto yy474; } else { if (yych <= '\'') - goto yy523; + goto yy475; if (yych <= 0xC1) - goto yy497; + goto yy460; if (yych <= 0xDF) - goto yy525; - goto yy526; + goto yy476; + goto yy477; } } else { if (yych <= 0xEF) { if (yych == 0xED) - goto yy528; - goto yy527; + goto yy479; + goto yy478; } else { if (yych <= 0xF0) - goto yy529; + goto yy480; if (yych <= 0xF3) - goto yy530; + goto yy481; if (yych <= 0xF4) - goto yy531; - goto yy497; + goto yy482; + goto yy460; } } - yy519: - ++p; - yych = *p; + yy473: + yych = *++p; if (yybm[0 + yych] & 32) { - goto yy519; + goto yy473; } if (yych <= 0xE0) { if (yych <= '=') { if (yych <= 0x00) - goto yy497; + goto yy460; if (yych <= ' ') - goto yy502; - goto yy497; + goto yy463; + goto yy460; } else { if (yych <= '>') - goto yy505; + goto yy465; if (yych <= 0xC1) - goto yy497; + goto yy460; if (yych <= 0xDF) - goto yy525; - goto yy526; + goto yy476; + goto yy477; } } else { if (yych <= 0xEF) { if (yych == 0xED) - goto yy528; - goto yy527; + goto yy479; + goto yy478; } else { if (yych <= 0xF0) - goto yy529; + goto yy480; if (yych <= 0xF3) - goto yy530; + goto yy481; if (yych <= 0xF4) - goto yy531; - goto yy497; + goto yy482; + goto yy460; } } - yy521: - ++p; - yych = *p; + yy474: + yych = *++p; if (yybm[0 + yych] & 64) { - goto yy521; + goto yy474; } if (yych <= 0xEC) { if (yych <= 0xC1) { if (yych <= 0x00) - goto yy497; + goto yy460; if (yych <= '"') - goto yy532; - goto yy497; + goto yy483; + goto yy460; } else { if (yych <= 0xDF) - goto yy533; + goto yy484; if (yych <= 0xE0) - goto yy534; - goto yy535; + goto yy485; + goto yy486; } } else { if (yych <= 0xF0) { if (yych <= 0xED) - goto yy536; + goto yy487; if (yych <= 0xEF) - goto yy535; - goto yy537; + goto yy486; + goto yy488; } else { if (yych <= 0xF3) - goto yy538; + goto yy489; if (yych <= 0xF4) - goto yy539; - goto yy497; + goto yy490; + goto yy460; } } - yy523: - ++p; - yych = *p; + yy475: + yych = *++p; if (yybm[0 + yych] & 128) { - goto yy523; + goto yy475; } if (yych <= 0xEC) { if (yych <= 0xC1) { if (yych <= 0x00) - goto yy497; + goto yy460; if (yych <= '\'') - goto yy532; - goto yy497; + goto yy483; + goto yy460; } else { if (yych <= 0xDF) - goto yy540; + goto yy491; if (yych <= 0xE0) - goto yy541; - goto yy542; + goto yy492; + goto yy493; } } else { if (yych <= 0xF0) { if (yych <= 0xED) - goto yy543; + goto yy494; if (yych <= 0xEF) - goto yy542; - goto yy544; + goto yy493; + goto yy495; } else { if (yych <= 0xF3) - goto yy545; + goto yy496; if (yych <= 0xF4) - goto yy546; - goto yy497; + goto yy497; + goto yy460; } } - yy525: - ++p; - yych = *p; + yy476: + yych = *++p; if (yych <= 0x7F) - goto yy497; - if (yych <= 0xBF) - goto yy519; - goto yy497; - yy526: - ++p; - yych = *p; + goto yy460; + if (yych <= 0xBF) + goto yy473; + goto yy460; + yy477: + yych = *++p; if (yych <= 0x9F) - goto yy497; + goto yy460; if (yych <= 0xBF) - goto yy525; - goto yy497; - yy527: - ++p; - yych = *p; + goto yy476; + goto yy460; + yy478: + yych = *++p; if (yych <= 0x7F) - goto yy497; + goto yy460; if (yych <= 0xBF) - goto yy525; - goto yy497; - yy528: - ++p; - yych = *p; + goto yy476; + goto yy460; + yy479: + yych = *++p; if (yych <= 0x7F) - goto yy497; + goto yy460; if (yych <= 0x9F) - goto yy525; - goto yy497; - yy529: - ++p; - yych = *p; + goto yy476; + goto yy460; + yy480: + yych = *++p; if (yych <= 0x8F) - goto yy497; + goto yy460; if (yych <= 0xBF) - goto yy527; - goto yy497; - yy530: - ++p; - yych = *p; + goto yy478; + goto yy460; + yy481: + yych = *++p; if (yych <= 0x7F) - goto yy497; + goto yy460; if (yych <= 0xBF) - goto yy527; - goto yy497; - yy531: - ++p; - yych = *p; + goto yy478; + goto yy460; + yy482: + yych = *++p; if (yych <= 0x7F) - goto yy497; + goto yy460; if (yych <= 0x8F) - goto yy527; - goto yy497; - yy532: - ++p; - yych = *p; + goto yy478; + goto yy460; + yy483: + yych = *++p; if (yybm[0 + yych] & 2) { - goto yy502; + goto yy463; } if (yych == '/') - goto yy504; + goto yy464; if (yych == '>') - goto yy505; - goto yy497; - yy533: - ++p; - yych = *p; + goto yy465; + goto yy460; + yy484: + yych = *++p; if (yych <= 0x7F) - goto yy497; + goto yy460; if (yych <= 0xBF) - goto yy521; - goto yy497; - yy534: - ++p; - yych = *p; + goto yy474; + goto yy460; + yy485: + yych = *++p; if (yych <= 0x9F) - goto yy497; + goto yy460; if (yych <= 0xBF) - goto yy533; - goto yy497; - yy535: - ++p; - yych = *p; + goto yy484; + goto yy460; + yy486: + yych = *++p; if (yych <= 0x7F) - goto yy497; + goto yy460; if (yych <= 0xBF) - goto yy533; - goto yy497; - yy536: - ++p; - yych = *p; + goto yy484; + goto yy460; + yy487: + yych = *++p; if (yych <= 0x7F) - goto yy497; + goto yy460; if (yych <= 0x9F) - goto yy533; - goto yy497; - yy537: - ++p; - yych = *p; + goto yy484; + goto yy460; + yy488: + yych = *++p; if (yych <= 0x8F) - goto yy497; + goto yy460; if (yych <= 0xBF) - goto yy535; - goto yy497; - yy538: - ++p; - yych = *p; + goto yy486; + goto yy460; + yy489: + yych = *++p; if (yych <= 0x7F) - goto yy497; + goto yy460; if (yych <= 0xBF) - goto yy535; - goto yy497; - yy539: - ++p; - yych = *p; + goto yy486; + goto yy460; + yy490: + yych = *++p; if (yych <= 0x7F) - goto yy497; + goto yy460; if (yych <= 0x8F) - goto yy535; - goto yy497; - yy540: - ++p; - yych = *p; + goto yy486; + goto yy460; + yy491: + yych = *++p; if (yych <= 0x7F) - goto yy497; + goto yy460; if (yych <= 0xBF) - goto yy523; - goto yy497; - yy541: - ++p; - yych = *p; + goto yy475; + goto yy460; + yy492: + yych = *++p; if (yych <= 0x9F) - goto yy497; + goto yy460; if (yych <= 0xBF) - goto yy540; - goto yy497; - yy542: - ++p; - yych = *p; + goto yy491; + goto yy460; + yy493: + yych = *++p; if (yych <= 0x7F) - goto yy497; + goto yy460; if (yych <= 0xBF) - goto yy540; - goto yy497; - yy543: - ++p; - yych = *p; + goto yy491; + goto yy460; + yy494: + yych = *++p; if (yych <= 0x7F) - goto yy497; + goto yy460; if (yych <= 0x9F) - goto yy540; - goto yy497; - yy544: - ++p; - yych = *p; + goto yy491; + goto yy460; + yy495: + yych = *++p; if (yych <= 0x8F) - goto yy497; + goto yy460; if (yych <= 0xBF) - goto yy542; - goto yy497; - yy545: - ++p; - yych = *p; + goto yy493; + goto yy460; + yy496: + yych = *++p; if (yych <= 0x7F) - goto yy497; + goto yy460; if (yych <= 0xBF) - goto yy542; - goto yy497; - yy546: - ++p; - yych = *p; + goto yy493; + goto yy460; + yy497: + yych = *++p; if (yych <= 0x7F) - goto yy497; + goto yy460; if (yych <= 0x8F) - goto yy542; - goto yy497; + goto yy493; + goto yy460; } } @@ -9018,850 +8875,1168 @@ bufsize_t _scan_html_block_end_1(const unsigned char *p) { if (yych <= 0xDF) { if (yych <= ';') { if (yych <= 0x00) - goto yy549; + goto yy499; if (yych != '\n') - goto yy551; + goto yy501; } else { if (yych <= '<') - goto yy552; + goto yy502; if (yych <= 0x7F) - goto yy551; + goto yy501; if (yych >= 0xC2) - goto yy553; + goto yy503; } } else { if (yych <= 0xEF) { if (yych <= 0xE0) - goto yy554; + goto yy504; if (yych == 0xED) - goto yy556; - goto yy555; + goto yy506; + goto yy505; } else { if (yych <= 0xF0) - goto yy557; + goto yy507; if (yych <= 0xF3) - goto yy558; + goto yy508; if (yych <= 0xF4) - goto yy559; + goto yy509; } } - yy549: + yy499: ++p; - yy550 : { return 0; } - yy551: + yy500 : { return 0; } + yy501: yyaccept = 0; yych = *(marker = ++p); if (yych <= '\n') { if (yych <= 0x00) - goto yy550; + goto yy500; if (yych <= '\t') - goto yy561; - goto yy550; + goto yy511; + goto yy500; } else { if (yych <= 0x7F) - goto yy561; + goto yy511; if (yych <= 0xC1) - goto yy550; + goto yy500; if (yych <= 0xF4) - goto yy561; - goto yy550; + goto yy511; + goto yy500; } - yy552: + yy502: yyaccept = 0; yych = *(marker = ++p); if (yych <= '.') { if (yych <= 0x00) - goto yy550; + goto yy500; if (yych == '\n') - goto yy550; - goto yy561; + goto yy500; + goto yy511; } else { if (yych <= 0x7F) { if (yych <= '/') - goto yy572; - goto yy561; + goto yy521; + goto yy511; } else { if (yych <= 0xC1) - goto yy550; + goto yy500; if (yych <= 0xF4) - goto yy561; - goto yy550; + goto yy511; + goto yy500; } } - yy553: + yy503: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x7F) - goto yy550; + goto yy500; if (yych <= 0xBF) - goto yy560; - goto yy550; - yy554: + goto yy510; + goto yy500; + yy504: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x9F) - goto yy550; + goto yy500; if (yych <= 0xBF) - goto yy565; - goto yy550; - yy555: + goto yy514; + goto yy500; + yy505: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x7F) - goto yy550; + goto yy500; if (yych <= 0xBF) - goto yy565; - goto yy550; - yy556: + goto yy514; + goto yy500; + yy506: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x7F) - goto yy550; + goto yy500; if (yych <= 0x9F) - goto yy565; - goto yy550; - yy557: + goto yy514; + goto yy500; + yy507: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x8F) - goto yy550; + goto yy500; if (yych <= 0xBF) - goto yy567; - goto yy550; - yy558: + goto yy516; + goto yy500; + yy508: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x7F) - goto yy550; + goto yy500; if (yych <= 0xBF) - goto yy567; - goto yy550; - yy559: + goto yy516; + goto yy500; + yy509: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x7F) - goto yy550; + goto yy500; if (yych <= 0x8F) - goto yy567; - goto yy550; - yy560: - ++p; - yych = *p; - yy561: + goto yy516; + goto yy500; + yy510: + yych = *++p; + yy511: if (yybm[0 + yych] & 64) { - goto yy560; + goto yy510; } if (yych <= 0xEC) { if (yych <= 0xC1) { if (yych <= '\n') - goto yy562; + goto yy512; if (yych <= '<') - goto yy563; + goto yy513; } else { if (yych <= 0xDF) - goto yy565; + goto yy514; if (yych <= 0xE0) - goto yy566; - goto yy567; + goto yy515; + goto yy516; } } else { if (yych <= 0xF0) { if (yych <= 0xED) - goto yy568; + goto yy517; if (yych <= 0xEF) - goto yy567; - goto yy569; + goto yy516; + goto yy518; } else { if (yych <= 0xF3) - goto yy570; + goto yy519; if (yych <= 0xF4) - goto yy571; + goto yy520; } } - yy562: + yy512: p = marker; if (yyaccept == 0) { - goto yy550; + goto yy500; } else { - goto yy582; + goto yy534; } - yy563: - ++p; - yych = *p; + yy513: + yych = *++p; if (yybm[0 + yych] & 128) { - goto yy563; + goto yy513; } if (yych <= 0xDF) { if (yych <= '.') { if (yych <= 0x00) - goto yy562; + goto yy512; if (yych == '\n') - goto yy562; - goto yy560; + goto yy512; + goto yy510; } else { if (yych <= '/') - goto yy572; + goto yy521; if (yych <= 0x7F) - goto yy560; + goto yy510; if (yych <= 0xC1) - goto yy562; + goto yy512; } } else { if (yych <= 0xEF) { if (yych <= 0xE0) - goto yy566; + goto yy515; if (yych == 0xED) - goto yy568; - goto yy567; + goto yy517; + goto yy516; } else { if (yych <= 0xF0) - goto yy569; + goto yy518; if (yych <= 0xF3) - goto yy570; + goto yy519; if (yych <= 0xF4) - goto yy571; - goto yy562; + goto yy520; + goto yy512; } } - yy565: - ++p; - yych = *p; + yy514: + yych = *++p; if (yych <= 0x7F) - goto yy562; + goto yy512; if (yych <= 0xBF) - goto yy560; - goto yy562; - yy566: - ++p; - yych = *p; + goto yy510; + goto yy512; + yy515: + yych = *++p; if (yych <= 0x9F) - goto yy562; + goto yy512; if (yych <= 0xBF) - goto yy565; - goto yy562; - yy567: - ++p; - yych = *p; + goto yy514; + goto yy512; + yy516: + yych = *++p; if (yych <= 0x7F) - goto yy562; + goto yy512; if (yych <= 0xBF) - goto yy565; - goto yy562; - yy568: - ++p; - yych = *p; + goto yy514; + goto yy512; + yy517: + yych = *++p; if (yych <= 0x7F) - goto yy562; + goto yy512; if (yych <= 0x9F) - goto yy565; - goto yy562; - yy569: - ++p; - yych = *p; + goto yy514; + goto yy512; + yy518: + yych = *++p; if (yych <= 0x8F) - goto yy562; + goto yy512; if (yych <= 0xBF) - goto yy567; - goto yy562; - yy570: - ++p; - yych = *p; + goto yy516; + goto yy512; + yy519: + yych = *++p; if (yych <= 0x7F) - goto yy562; + goto yy512; if (yych <= 0xBF) - goto yy567; - goto yy562; - yy571: - ++p; - yych = *p; + goto yy516; + goto yy512; + yy520: + yych = *++p; if (yych <= 0x7F) - goto yy562; + goto yy512; if (yych <= 0x8F) - goto yy567; - goto yy562; - yy572: - ++p; - yych = *p; + goto yy516; + goto yy512; + yy521: + yych = *++p; if (yybm[0 + yych] & 128) { - goto yy563; + goto yy513; } if (yych <= 's') { - if (yych <= 'P') { - if (yych <= '\t') { + if (yych <= 'R') { + if (yych <= '\n') { if (yych <= 0x00) - goto yy562; - goto yy560; + goto yy512; + if (yych <= '\t') + goto yy510; + goto yy512; } else { - if (yych <= '\n') - goto yy562; - if (yych <= 'O') - goto yy560; + if (yych != 'P') + goto yy510; } } else { if (yych <= 'o') { - if (yych == 'S') - goto yy574; - goto yy560; + if (yych <= 'S') + goto yy523; + if (yych <= 'T') + goto yy524; + goto yy510; } else { if (yych <= 'p') - goto yy573; + goto yy522; if (yych <= 'r') - goto yy560; - goto yy574; + goto yy510; + goto yy523; } } } else { if (yych <= 0xEC) { if (yych <= 0xC1) { + if (yych <= 't') + goto yy524; if (yych <= 0x7F) - goto yy560; - goto yy562; + goto yy510; + goto yy512; } else { if (yych <= 0xDF) - goto yy565; + goto yy514; if (yych <= 0xE0) - goto yy566; - goto yy567; + goto yy515; + goto yy516; } } else { if (yych <= 0xF0) { if (yych <= 0xED) - goto yy568; + goto yy517; if (yych <= 0xEF) - goto yy567; - goto yy569; + goto yy516; + goto yy518; } else { if (yych <= 0xF3) - goto yy570; + goto yy519; if (yych <= 0xF4) - goto yy571; - goto yy562; + goto yy520; + goto yy512; } } } - yy573: - ++p; - yych = *p; + yy522: + yych = *++p; if (yybm[0 + yych] & 128) { - goto yy563; + goto yy513; } if (yych <= 0xC1) { if (yych <= 'Q') { if (yych <= 0x00) - goto yy562; + goto yy512; if (yych == '\n') - goto yy562; - goto yy560; + goto yy512; + goto yy510; } else { if (yych <= 'q') { if (yych <= 'R') - goto yy575; - goto yy560; + goto yy525; + goto yy510; } else { if (yych <= 'r') - goto yy575; + goto yy525; if (yych <= 0x7F) - goto yy560; - goto yy562; + goto yy510; + goto yy512; } } } else { if (yych <= 0xED) { if (yych <= 0xDF) - goto yy565; + goto yy514; if (yych <= 0xE0) - goto yy566; + goto yy515; if (yych <= 0xEC) - goto yy567; - goto yy568; + goto yy516; + goto yy517; } else { if (yych <= 0xF0) { if (yych <= 0xEF) - goto yy567; - goto yy569; + goto yy516; + goto yy518; } else { if (yych <= 0xF3) - goto yy570; + goto yy519; if (yych <= 0xF4) - goto yy571; - goto yy562; + goto yy520; + goto yy512; } } } - yy574: - ++p; - yych = *p; + yy523: + yych = *++p; if (yybm[0 + yych] & 128) { - goto yy563; + goto yy513; } if (yych <= 't') { if (yych <= 'C') { if (yych <= '\t') { if (yych <= 0x00) - goto yy562; - goto yy560; + goto yy512; + goto yy510; } else { if (yych <= '\n') - goto yy562; + goto yy512; if (yych <= 'B') - goto yy560; - goto yy576; + goto yy510; + goto yy526; } } else { if (yych <= 'b') { if (yych == 'T') - goto yy577; - goto yy560; + goto yy527; + goto yy510; } else { if (yych <= 'c') - goto yy576; + goto yy526; if (yych <= 's') - goto yy560; - goto yy577; + goto yy510; + goto yy527; } } } else { if (yych <= 0xEC) { if (yych <= 0xC1) { if (yych <= 0x7F) - goto yy560; - goto yy562; + goto yy510; + goto yy512; } else { if (yych <= 0xDF) - goto yy565; + goto yy514; if (yych <= 0xE0) - goto yy566; - goto yy567; + goto yy515; + goto yy516; } } else { if (yych <= 0xF0) { if (yych <= 0xED) - goto yy568; + goto yy517; if (yych <= 0xEF) - goto yy567; - goto yy569; + goto yy516; + goto yy518; } else { if (yych <= 0xF3) - goto yy570; + goto yy519; if (yych <= 0xF4) - goto yy571; - goto yy562; + goto yy520; + goto yy512; } } } - yy575: - ++p; - yych = *p; + yy524: + yych = *++p; + if (yybm[0 + yych] & 128) { + goto yy513; + } + if (yych <= 0xC1) { + if (yych <= 'D') { + if (yych <= 0x00) + goto yy512; + if (yych == '\n') + goto yy512; + goto yy510; + } else { + if (yych <= 'd') { + if (yych <= 'E') + goto yy528; + goto yy510; + } else { + if (yych <= 'e') + goto yy528; + if (yych <= 0x7F) + goto yy510; + goto yy512; + } + } + } else { + if (yych <= 0xED) { + if (yych <= 0xDF) + goto yy514; + if (yych <= 0xE0) + goto yy515; + if (yych <= 0xEC) + goto yy516; + goto yy517; + } else { + if (yych <= 0xF0) { + if (yych <= 0xEF) + goto yy516; + goto yy518; + } else { + if (yych <= 0xF3) + goto yy519; + if (yych <= 0xF4) + goto yy520; + goto yy512; + } + } + } + yy525: + yych = *++p; + if (yybm[0 + yych] & 128) { + goto yy513; + } + if (yych <= 0xC1) { + if (yych <= 'D') { + if (yych <= 0x00) + goto yy512; + if (yych == '\n') + goto yy512; + goto yy510; + } else { + if (yych <= 'd') { + if (yych <= 'E') + goto yy529; + goto yy510; + } else { + if (yych <= 'e') + goto yy529; + if (yych <= 0x7F) + goto yy510; + goto yy512; + } + } + } else { + if (yych <= 0xED) { + if (yych <= 0xDF) + goto yy514; + if (yych <= 0xE0) + goto yy515; + if (yych <= 0xEC) + goto yy516; + goto yy517; + } else { + if (yych <= 0xF0) { + if (yych <= 0xEF) + goto yy516; + goto yy518; + } else { + if (yych <= 0xF3) + goto yy519; + if (yych <= 0xF4) + goto yy520; + goto yy512; + } + } + } + yy526: + yych = *++p; + if (yybm[0 + yych] & 128) { + goto yy513; + } + if (yych <= 0xC1) { + if (yych <= 'Q') { + if (yych <= 0x00) + goto yy512; + if (yych == '\n') + goto yy512; + goto yy510; + } else { + if (yych <= 'q') { + if (yych <= 'R') + goto yy530; + goto yy510; + } else { + if (yych <= 'r') + goto yy530; + if (yych <= 0x7F) + goto yy510; + goto yy512; + } + } + } else { + if (yych <= 0xED) { + if (yych <= 0xDF) + goto yy514; + if (yych <= 0xE0) + goto yy515; + if (yych <= 0xEC) + goto yy516; + goto yy517; + } else { + if (yych <= 0xF0) { + if (yych <= 0xEF) + goto yy516; + goto yy518; + } else { + if (yych <= 0xF3) + goto yy519; + if (yych <= 0xF4) + goto yy520; + goto yy512; + } + } + } + yy527: + yych = *++p; + if (yybm[0 + yych] & 128) { + goto yy513; + } + if (yych <= 0xC1) { + if (yych <= 'X') { + if (yych <= 0x00) + goto yy512; + if (yych == '\n') + goto yy512; + goto yy510; + } else { + if (yych <= 'x') { + if (yych <= 'Y') + goto yy531; + goto yy510; + } else { + if (yych <= 'y') + goto yy531; + if (yych <= 0x7F) + goto yy510; + goto yy512; + } + } + } else { + if (yych <= 0xED) { + if (yych <= 0xDF) + goto yy514; + if (yych <= 0xE0) + goto yy515; + if (yych <= 0xEC) + goto yy516; + goto yy517; + } else { + if (yych <= 0xF0) { + if (yych <= 0xEF) + goto yy516; + goto yy518; + } else { + if (yych <= 0xF3) + goto yy519; + if (yych <= 0xF4) + goto yy520; + goto yy512; + } + } + } + yy528: + yych = *++p; + if (yybm[0 + yych] & 128) { + goto yy513; + } + if (yych <= 0xC1) { + if (yych <= 'W') { + if (yych <= 0x00) + goto yy512; + if (yych == '\n') + goto yy512; + goto yy510; + } else { + if (yych <= 'w') { + if (yych <= 'X') + goto yy532; + goto yy510; + } else { + if (yych <= 'x') + goto yy532; + if (yych <= 0x7F) + goto yy510; + goto yy512; + } + } + } else { + if (yych <= 0xED) { + if (yych <= 0xDF) + goto yy514; + if (yych <= 0xE0) + goto yy515; + if (yych <= 0xEC) + goto yy516; + goto yy517; + } else { + if (yych <= 0xF0) { + if (yych <= 0xEF) + goto yy516; + goto yy518; + } else { + if (yych <= 0xF3) + goto yy519; + if (yych <= 0xF4) + goto yy520; + goto yy512; + } + } + } + yy529: + yych = *++p; + if (yybm[0 + yych] & 128) { + goto yy513; + } + if (yych <= 0xDF) { + if (yych <= '=') { + if (yych <= 0x00) + goto yy512; + if (yych == '\n') + goto yy512; + goto yy510; + } else { + if (yych <= '>') + goto yy533; + if (yych <= 0x7F) + goto yy510; + if (yych <= 0xC1) + goto yy512; + goto yy514; + } + } else { + if (yych <= 0xEF) { + if (yych <= 0xE0) + goto yy515; + if (yych == 0xED) + goto yy517; + goto yy516; + } else { + if (yych <= 0xF0) + goto yy518; + if (yych <= 0xF3) + goto yy519; + if (yych <= 0xF4) + goto yy520; + goto yy512; + } + } + yy530: + yych = *++p; + if (yybm[0 + yych] & 128) { + goto yy513; + } + if (yych <= 0xC1) { + if (yych <= 'H') { + if (yych <= 0x00) + goto yy512; + if (yych == '\n') + goto yy512; + goto yy510; + } else { + if (yych <= 'h') { + if (yych <= 'I') + goto yy535; + goto yy510; + } else { + if (yych <= 'i') + goto yy535; + if (yych <= 0x7F) + goto yy510; + goto yy512; + } + } + } else { + if (yych <= 0xED) { + if (yych <= 0xDF) + goto yy514; + if (yych <= 0xE0) + goto yy515; + if (yych <= 0xEC) + goto yy516; + goto yy517; + } else { + if (yych <= 0xF0) { + if (yych <= 0xEF) + goto yy516; + goto yy518; + } else { + if (yych <= 0xF3) + goto yy519; + if (yych <= 0xF4) + goto yy520; + goto yy512; + } + } + } + yy531: + yych = *++p; if (yybm[0 + yych] & 128) { - goto yy563; + goto yy513; } if (yych <= 0xC1) { - if (yych <= 'D') { + if (yych <= 'K') { if (yych <= 0x00) - goto yy562; + goto yy512; if (yych == '\n') - goto yy562; - goto yy560; + goto yy512; + goto yy510; } else { - if (yych <= 'd') { - if (yych <= 'E') - goto yy578; - goto yy560; + if (yych <= 'k') { + if (yych <= 'L') + goto yy525; + goto yy510; } else { - if (yych <= 'e') - goto yy578; + if (yych <= 'l') + goto yy525; if (yych <= 0x7F) - goto yy560; - goto yy562; + goto yy510; + goto yy512; } } } else { if (yych <= 0xED) { if (yych <= 0xDF) - goto yy565; + goto yy514; if (yych <= 0xE0) - goto yy566; + goto yy515; if (yych <= 0xEC) - goto yy567; - goto yy568; + goto yy516; + goto yy517; } else { if (yych <= 0xF0) { if (yych <= 0xEF) - goto yy567; - goto yy569; + goto yy516; + goto yy518; } else { if (yych <= 0xF3) - goto yy570; + goto yy519; if (yych <= 0xF4) - goto yy571; - goto yy562; + goto yy520; + goto yy512; } } } - yy576: - ++p; - yych = *p; + yy532: + yych = *++p; if (yybm[0 + yych] & 128) { - goto yy563; + goto yy513; } if (yych <= 0xC1) { - if (yych <= 'Q') { + if (yych <= 'S') { if (yych <= 0x00) - goto yy562; + goto yy512; if (yych == '\n') - goto yy562; - goto yy560; + goto yy512; + goto yy510; } else { - if (yych <= 'q') { - if (yych <= 'R') - goto yy579; - goto yy560; + if (yych <= 's') { + if (yych <= 'T') + goto yy536; + goto yy510; } else { - if (yych <= 'r') - goto yy579; + if (yych <= 't') + goto yy536; if (yych <= 0x7F) - goto yy560; - goto yy562; + goto yy510; + goto yy512; } } } else { if (yych <= 0xED) { if (yych <= 0xDF) - goto yy565; + goto yy514; if (yych <= 0xE0) - goto yy566; + goto yy515; if (yych <= 0xEC) - goto yy567; - goto yy568; + goto yy516; + goto yy517; } else { if (yych <= 0xF0) { if (yych <= 0xEF) - goto yy567; - goto yy569; + goto yy516; + goto yy518; } else { if (yych <= 0xF3) - goto yy570; + goto yy519; if (yych <= 0xF4) - goto yy571; - goto yy562; + goto yy520; + goto yy512; } } } - yy577: - ++p; - yych = *p; + yy533: + yyaccept = 1; + yych = *(marker = ++p); + if (yybm[0 + yych] & 64) { + goto yy510; + } + if (yych <= 0xEC) { + if (yych <= 0xC1) { + if (yych <= '\n') + goto yy534; + if (yych <= '<') + goto yy513; + } else { + if (yych <= 0xDF) + goto yy514; + if (yych <= 0xE0) + goto yy515; + goto yy516; + } + } else { + if (yych <= 0xF0) { + if (yych <= 0xED) + goto yy517; + if (yych <= 0xEF) + goto yy516; + goto yy518; + } else { + if (yych <= 0xF3) + goto yy519; + if (yych <= 0xF4) + goto yy520; + } + } + yy534 : { return (bufsize_t)(p - start); } + yy535: + yych = *++p; if (yybm[0 + yych] & 128) { - goto yy563; + goto yy513; } if (yych <= 0xC1) { - if (yych <= 'X') { + if (yych <= 'O') { if (yych <= 0x00) - goto yy562; + goto yy512; if (yych == '\n') - goto yy562; - goto yy560; + goto yy512; + goto yy510; } else { - if (yych <= 'x') { - if (yych <= 'Y') - goto yy580; - goto yy560; + if (yych <= 'o') { + if (yych <= 'P') + goto yy537; + goto yy510; } else { - if (yych <= 'y') - goto yy580; + if (yych <= 'p') + goto yy537; if (yych <= 0x7F) - goto yy560; - goto yy562; + goto yy510; + goto yy512; } } } else { if (yych <= 0xED) { if (yych <= 0xDF) - goto yy565; + goto yy514; if (yych <= 0xE0) - goto yy566; + goto yy515; if (yych <= 0xEC) - goto yy567; - goto yy568; + goto yy516; + goto yy517; } else { if (yych <= 0xF0) { if (yych <= 0xEF) - goto yy567; - goto yy569; + goto yy516; + goto yy518; } else { if (yych <= 0xF3) - goto yy570; + goto yy519; if (yych <= 0xF4) - goto yy571; - goto yy562; + goto yy520; + goto yy512; } } } - yy578: - ++p; - yych = *p; + yy536: + yych = *++p; if (yybm[0 + yych] & 128) { - goto yy563; + goto yy513; } - if (yych <= 0xDF) { - if (yych <= '=') { + if (yych <= 0xC1) { + if (yych <= '@') { if (yych <= 0x00) - goto yy562; + goto yy512; if (yych == '\n') - goto yy562; - goto yy560; + goto yy512; + goto yy510; } else { - if (yych <= '>') - goto yy581; - if (yych <= 0x7F) - goto yy560; - if (yych <= 0xC1) - goto yy562; - goto yy565; + if (yych <= '`') { + if (yych <= 'A') + goto yy538; + goto yy510; + } else { + if (yych <= 'a') + goto yy538; + if (yych <= 0x7F) + goto yy510; + goto yy512; + } } } else { - if (yych <= 0xEF) { + if (yych <= 0xED) { + if (yych <= 0xDF) + goto yy514; if (yych <= 0xE0) - goto yy566; - if (yych == 0xED) - goto yy568; - goto yy567; + goto yy515; + if (yych <= 0xEC) + goto yy516; + goto yy517; } else { - if (yych <= 0xF0) - goto yy569; - if (yych <= 0xF3) - goto yy570; - if (yych <= 0xF4) - goto yy571; - goto yy562; + if (yych <= 0xF0) { + if (yych <= 0xEF) + goto yy516; + goto yy518; + } else { + if (yych <= 0xF3) + goto yy519; + if (yych <= 0xF4) + goto yy520; + goto yy512; + } } } - yy579: - ++p; - yych = *p; + yy537: + yych = *++p; if (yybm[0 + yych] & 128) { - goto yy563; + goto yy513; } if (yych <= 0xC1) { - if (yych <= 'H') { + if (yych <= 'S') { if (yych <= 0x00) - goto yy562; + goto yy512; if (yych == '\n') - goto yy562; - goto yy560; + goto yy512; + goto yy510; } else { - if (yych <= 'h') { - if (yych <= 'I') - goto yy583; - goto yy560; + if (yych <= 's') { + if (yych <= 'T') + goto yy529; + goto yy510; } else { - if (yych <= 'i') - goto yy583; + if (yych <= 't') + goto yy529; if (yych <= 0x7F) - goto yy560; - goto yy562; + goto yy510; + goto yy512; } } } else { if (yych <= 0xED) { if (yych <= 0xDF) - goto yy565; + goto yy514; if (yych <= 0xE0) - goto yy566; + goto yy515; if (yych <= 0xEC) - goto yy567; - goto yy568; + goto yy516; + goto yy517; } else { if (yych <= 0xF0) { if (yych <= 0xEF) - goto yy567; - goto yy569; + goto yy516; + goto yy518; } else { if (yych <= 0xF3) - goto yy570; + goto yy519; if (yych <= 0xF4) - goto yy571; - goto yy562; + goto yy520; + goto yy512; } } } - yy580: - ++p; - yych = *p; + yy538: + yych = *++p; if (yybm[0 + yych] & 128) { - goto yy563; + goto yy513; } if (yych <= 0xC1) { - if (yych <= 'K') { + if (yych <= 'Q') { if (yych <= 0x00) - goto yy562; + goto yy512; if (yych == '\n') - goto yy562; - goto yy560; + goto yy512; + goto yy510; } else { - if (yych <= 'k') { - if (yych <= 'L') - goto yy575; - goto yy560; + if (yych <= 'q') { + if (yych >= 'S') + goto yy510; } else { - if (yych <= 'l') - goto yy575; + if (yych <= 'r') + goto yy539; if (yych <= 0x7F) - goto yy560; - goto yy562; + goto yy510; + goto yy512; } } } else { if (yych <= 0xED) { if (yych <= 0xDF) - goto yy565; + goto yy514; if (yych <= 0xE0) - goto yy566; + goto yy515; if (yych <= 0xEC) - goto yy567; - goto yy568; + goto yy516; + goto yy517; } else { if (yych <= 0xF0) { if (yych <= 0xEF) - goto yy567; - goto yy569; + goto yy516; + goto yy518; } else { if (yych <= 0xF3) - goto yy570; + goto yy519; if (yych <= 0xF4) - goto yy571; - goto yy562; + goto yy520; + goto yy512; } } } - yy581: - yyaccept = 1; - marker = ++p; - yych = *p; - if (yybm[0 + yych] & 64) { - goto yy560; - } - if (yych <= 0xEC) { - if (yych <= 0xC1) { - if (yych <= '\n') - goto yy582; - if (yych <= '<') - goto yy563; - } else { - if (yych <= 0xDF) - goto yy565; - if (yych <= 0xE0) - goto yy566; - goto yy567; - } - } else { - if (yych <= 0xF0) { - if (yych <= 0xED) - goto yy568; - if (yych <= 0xEF) - goto yy567; - goto yy569; - } else { - if (yych <= 0xF3) - goto yy570; - if (yych <= 0xF4) - goto yy571; - } - } - yy582 : { return (bufsize_t)(p - start); } - yy583: - ++p; - yych = *p; + yy539: + yych = *++p; if (yybm[0 + yych] & 128) { - goto yy563; + goto yy513; } if (yych <= 0xC1) { - if (yych <= 'O') { + if (yych <= 'D') { if (yych <= 0x00) - goto yy562; + goto yy512; if (yych == '\n') - goto yy562; - goto yy560; + goto yy512; + goto yy510; } else { - if (yych <= 'o') { - if (yych >= 'Q') - goto yy560; + if (yych <= 'd') { + if (yych >= 'F') + goto yy510; } else { - if (yych <= 'p') - goto yy584; + if (yych <= 'e') + goto yy540; if (yych <= 0x7F) - goto yy560; - goto yy562; + goto yy510; + goto yy512; } } } else { if (yych <= 0xED) { if (yych <= 0xDF) - goto yy565; + goto yy514; if (yych <= 0xE0) - goto yy566; + goto yy515; if (yych <= 0xEC) - goto yy567; - goto yy568; + goto yy516; + goto yy517; } else { if (yych <= 0xF0) { if (yych <= 0xEF) - goto yy567; - goto yy569; + goto yy516; + goto yy518; } else { if (yych <= 0xF3) - goto yy570; + goto yy519; if (yych <= 0xF4) - goto yy571; - goto yy562; + goto yy520; + goto yy512; } } } - yy584: - ++p; - yych = *p; + yy540: + yych = *++p; if (yybm[0 + yych] & 128) { - goto yy563; + goto yy513; } if (yych <= 0xC1) { - if (yych <= 'S') { + if (yych <= '@') { if (yych <= 0x00) - goto yy562; + goto yy512; if (yych == '\n') - goto yy562; - goto yy560; + goto yy512; + goto yy510; } else { - if (yych <= 's') { - if (yych <= 'T') - goto yy578; - goto yy560; + if (yych <= '`') { + if (yych <= 'A') + goto yy529; + goto yy510; } else { - if (yych <= 't') - goto yy578; + if (yych <= 'a') + goto yy529; if (yych <= 0x7F) - goto yy560; - goto yy562; + goto yy510; + goto yy512; } } } else { if (yych <= 0xED) { if (yych <= 0xDF) - goto yy565; + goto yy514; if (yych <= 0xE0) - goto yy566; + goto yy515; if (yych <= 0xEC) - goto yy567; - goto yy568; + goto yy516; + goto yy517; } else { if (yych <= 0xF0) { if (yych <= 0xEF) - goto yy567; - goto yy569; + goto yy516; + goto yy518; } else { if (yych <= 0xF3) - goto yy570; + goto yy519; if (yych <= 0xF4) - goto yy571; - goto yy562; + goto yy520; + goto yy512; } } } @@ -9897,337 +10072,326 @@ bufsize_t _scan_html_block_end_2(const unsigned char *p) { if (yych <= 0xDF) { if (yych <= ',') { if (yych <= 0x00) - goto yy587; + goto yy542; if (yych != '\n') - goto yy589; + goto yy544; } else { if (yych <= '-') - goto yy590; + goto yy545; if (yych <= 0x7F) - goto yy589; + goto yy544; if (yych >= 0xC2) - goto yy591; + goto yy546; } } else { if (yych <= 0xEF) { if (yych <= 0xE0) - goto yy592; + goto yy547; if (yych == 0xED) - goto yy594; - goto yy593; + goto yy549; + goto yy548; } else { if (yych <= 0xF0) - goto yy595; + goto yy550; if (yych <= 0xF3) - goto yy596; + goto yy551; if (yych <= 0xF4) - goto yy597; + goto yy552; } } - yy587: + yy542: ++p; - yy588 : { return 0; } - yy589: + yy543 : { return 0; } + yy544: yyaccept = 0; yych = *(marker = ++p); if (yych <= '\n') { if (yych <= 0x00) - goto yy588; + goto yy543; if (yych <= '\t') - goto yy599; - goto yy588; + goto yy554; + goto yy543; } else { if (yych <= 0x7F) - goto yy599; + goto yy554; if (yych <= 0xC1) - goto yy588; + goto yy543; if (yych <= 0xF4) - goto yy599; - goto yy588; + goto yy554; + goto yy543; } - yy590: + yy545: yyaccept = 0; yych = *(marker = ++p); if (yybm[0 + yych] & 128) { - goto yy609; + goto yy564; } if (yych <= '\n') { if (yych <= 0x00) - goto yy588; + goto yy543; if (yych <= '\t') - goto yy599; - goto yy588; + goto yy554; + goto yy543; } else { if (yych <= 0x7F) - goto yy599; + goto yy554; if (yych <= 0xC1) - goto yy588; + goto yy543; if (yych <= 0xF4) - goto yy599; - goto yy588; + goto yy554; + goto yy543; } - yy591: + yy546: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x7F) - goto yy588; + goto yy543; if (yych <= 0xBF) - goto yy598; - goto yy588; - yy592: + goto yy553; + goto yy543; + yy547: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x9F) - goto yy588; + goto yy543; if (yych <= 0xBF) - goto yy602; - goto yy588; - yy593: + goto yy557; + goto yy543; + yy548: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x7F) - goto yy588; + goto yy543; if (yych <= 0xBF) - goto yy602; - goto yy588; - yy594: + goto yy557; + goto yy543; + yy549: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x7F) - goto yy588; + goto yy543; if (yych <= 0x9F) - goto yy602; - goto yy588; - yy595: + goto yy557; + goto yy543; + yy550: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x8F) - goto yy588; + goto yy543; if (yych <= 0xBF) - goto yy604; - goto yy588; - yy596: + goto yy559; + goto yy543; + yy551: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x7F) - goto yy588; + goto yy543; if (yych <= 0xBF) - goto yy604; - goto yy588; - yy597: + goto yy559; + goto yy543; + yy552: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x7F) - goto yy588; + goto yy543; if (yych <= 0x8F) - goto yy604; - goto yy588; - yy598: - ++p; - yych = *p; - yy599: + goto yy559; + goto yy543; + yy553: + yych = *++p; + yy554: if (yybm[0 + yych] & 64) { - goto yy598; + goto yy553; } if (yych <= 0xEC) { if (yych <= 0xC1) { if (yych <= '\n') - goto yy600; + goto yy555; if (yych <= '-') - goto yy601; + goto yy556; } else { if (yych <= 0xDF) - goto yy602; + goto yy557; if (yych <= 0xE0) - goto yy603; - goto yy604; + goto yy558; + goto yy559; } } else { if (yych <= 0xF0) { if (yych <= 0xED) - goto yy605; + goto yy560; if (yych <= 0xEF) - goto yy604; - goto yy606; + goto yy559; + goto yy561; } else { if (yych <= 0xF3) - goto yy607; + goto yy562; if (yych <= 0xF4) - goto yy608; + goto yy563; } } - yy600: + yy555: p = marker; if (yyaccept == 0) { - goto yy588; + goto yy543; } else { - goto yy612; + goto yy566; } - yy601: - ++p; - yych = *p; + yy556: + yych = *++p; if (yybm[0 + yych] & 64) { - goto yy598; + goto yy553; } if (yych <= 0xEC) { if (yych <= 0xC1) { if (yych <= '\n') - goto yy600; + goto yy555; if (yych <= '-') - goto yy609; - goto yy600; + goto yy564; + goto yy555; } else { if (yych <= 0xDF) - goto yy602; + goto yy557; if (yych <= 0xE0) - goto yy603; - goto yy604; + goto yy558; + goto yy559; } } else { if (yych <= 0xF0) { if (yych <= 0xED) - goto yy605; + goto yy560; if (yych <= 0xEF) - goto yy604; - goto yy606; + goto yy559; + goto yy561; } else { if (yych <= 0xF3) - goto yy607; + goto yy562; if (yych <= 0xF4) - goto yy608; - goto yy600; + goto yy563; + goto yy555; } } - yy602: - ++p; - yych = *p; + yy557: + yych = *++p; if (yych <= 0x7F) - goto yy600; + goto yy555; if (yych <= 0xBF) - goto yy598; - goto yy600; - yy603: - ++p; - yych = *p; + goto yy553; + goto yy555; + yy558: + yych = *++p; if (yych <= 0x9F) - goto yy600; + goto yy555; if (yych <= 0xBF) - goto yy602; - goto yy600; - yy604: - ++p; - yych = *p; + goto yy557; + goto yy555; + yy559: + yych = *++p; if (yych <= 0x7F) - goto yy600; + goto yy555; if (yych <= 0xBF) - goto yy602; - goto yy600; - yy605: - ++p; - yych = *p; + goto yy557; + goto yy555; + yy560: + yych = *++p; if (yych <= 0x7F) - goto yy600; + goto yy555; if (yych <= 0x9F) - goto yy602; - goto yy600; - yy606: - ++p; - yych = *p; + goto yy557; + goto yy555; + yy561: + yych = *++p; if (yych <= 0x8F) - goto yy600; + goto yy555; if (yych <= 0xBF) - goto yy604; - goto yy600; - yy607: - ++p; - yych = *p; + goto yy559; + goto yy555; + yy562: + yych = *++p; if (yych <= 0x7F) - goto yy600; + goto yy555; if (yych <= 0xBF) - goto yy604; - goto yy600; - yy608: - ++p; - yych = *p; + goto yy559; + goto yy555; + yy563: + yych = *++p; if (yych <= 0x7F) - goto yy600; + goto yy555; if (yych <= 0x8F) - goto yy604; - goto yy600; - yy609: - ++p; - yych = *p; + goto yy559; + goto yy555; + yy564: + yych = *++p; if (yybm[0 + yych] & 128) { - goto yy609; + goto yy564; } if (yych <= 0xDF) { if (yych <= '=') { if (yych <= 0x00) - goto yy600; + goto yy555; if (yych == '\n') - goto yy600; - goto yy598; + goto yy555; + goto yy553; } else { if (yych <= '>') - goto yy611; + goto yy565; if (yych <= 0x7F) - goto yy598; + goto yy553; if (yych <= 0xC1) - goto yy600; - goto yy602; + goto yy555; + goto yy557; } } else { if (yych <= 0xEF) { if (yych <= 0xE0) - goto yy603; + goto yy558; if (yych == 0xED) - goto yy605; - goto yy604; + goto yy560; + goto yy559; } else { if (yych <= 0xF0) - goto yy606; + goto yy561; if (yych <= 0xF3) - goto yy607; + goto yy562; if (yych <= 0xF4) - goto yy608; - goto yy600; + goto yy563; + goto yy555; } } - yy611: + yy565: yyaccept = 1; - marker = ++p; - yych = *p; + yych = *(marker = ++p); if (yybm[0 + yych] & 64) { - goto yy598; + goto yy553; } if (yych <= 0xEC) { if (yych <= 0xC1) { if (yych <= '\n') - goto yy612; + goto yy566; if (yych <= '-') - goto yy601; + goto yy556; } else { if (yych <= 0xDF) - goto yy602; + goto yy557; if (yych <= 0xE0) - goto yy603; - goto yy604; + goto yy558; + goto yy559; } } else { if (yych <= 0xF0) { if (yych <= 0xED) - goto yy605; + goto yy560; if (yych <= 0xEF) - goto yy604; - goto yy606; + goto yy559; + goto yy561; } else { if (yych <= 0xF3) - goto yy607; + goto yy562; if (yych <= 0xF4) - goto yy608; + goto yy563; } } - yy612 : { return (bufsize_t)(p - start); } + yy566 : { return (bufsize_t)(p - start); } } } @@ -10260,302 +10424,292 @@ bufsize_t _scan_html_block_end_3(const unsigned char *p) { if (yych <= 0xDF) { if (yych <= '>') { if (yych <= 0x00) - goto yy615; + goto yy568; if (yych != '\n') - goto yy617; + goto yy570; } else { if (yych <= '?') - goto yy618; + goto yy571; if (yych <= 0x7F) - goto yy617; + goto yy570; if (yych >= 0xC2) - goto yy619; + goto yy572; } } else { if (yych <= 0xEF) { if (yych <= 0xE0) - goto yy620; + goto yy573; if (yych == 0xED) - goto yy622; - goto yy621; + goto yy575; + goto yy574; } else { if (yych <= 0xF0) - goto yy623; + goto yy576; if (yych <= 0xF3) - goto yy624; + goto yy577; if (yych <= 0xF4) - goto yy625; + goto yy578; } } - yy615: + yy568: ++p; - yy616 : { return 0; } - yy617: + yy569 : { return 0; } + yy570: yyaccept = 0; yych = *(marker = ++p); if (yych <= '\n') { if (yych <= 0x00) - goto yy616; + goto yy569; if (yych <= '\t') - goto yy627; - goto yy616; + goto yy580; + goto yy569; } else { if (yych <= 0x7F) - goto yy627; + goto yy580; if (yych <= 0xC1) - goto yy616; + goto yy569; if (yych <= 0xF4) - goto yy627; - goto yy616; + goto yy580; + goto yy569; } - yy618: + yy571: yyaccept = 0; yych = *(marker = ++p); if (yych <= '=') { if (yych <= 0x00) - goto yy616; + goto yy569; if (yych == '\n') - goto yy616; - goto yy627; + goto yy569; + goto yy580; } else { if (yych <= 0x7F) { if (yych <= '>') - goto yy638; - goto yy627; + goto yy590; + goto yy580; } else { if (yych <= 0xC1) - goto yy616; + goto yy569; if (yych <= 0xF4) - goto yy627; - goto yy616; + goto yy580; + goto yy569; } } - yy619: + yy572: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x7F) - goto yy616; + goto yy569; if (yych <= 0xBF) - goto yy626; - goto yy616; - yy620: + goto yy579; + goto yy569; + yy573: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x9F) - goto yy616; + goto yy569; if (yych <= 0xBF) - goto yy631; - goto yy616; - yy621: + goto yy583; + goto yy569; + yy574: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x7F) - goto yy616; + goto yy569; if (yych <= 0xBF) - goto yy631; - goto yy616; - yy622: + goto yy583; + goto yy569; + yy575: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x7F) - goto yy616; + goto yy569; if (yych <= 0x9F) - goto yy631; - goto yy616; - yy623: + goto yy583; + goto yy569; + yy576: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x8F) - goto yy616; + goto yy569; if (yych <= 0xBF) - goto yy633; - goto yy616; - yy624: + goto yy585; + goto yy569; + yy577: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x7F) - goto yy616; + goto yy569; if (yych <= 0xBF) - goto yy633; - goto yy616; - yy625: + goto yy585; + goto yy569; + yy578: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x7F) - goto yy616; + goto yy569; if (yych <= 0x8F) - goto yy633; - goto yy616; - yy626: - ++p; - yych = *p; - yy627: + goto yy585; + goto yy569; + yy579: + yych = *++p; + yy580: if (yybm[0 + yych] & 64) { - goto yy626; + goto yy579; } if (yych <= 0xEC) { if (yych <= 0xC1) { if (yych <= '\n') - goto yy628; + goto yy581; if (yych <= '?') - goto yy629; + goto yy582; } else { if (yych <= 0xDF) - goto yy631; + goto yy583; if (yych <= 0xE0) - goto yy632; - goto yy633; + goto yy584; + goto yy585; } } else { if (yych <= 0xF0) { if (yych <= 0xED) - goto yy634; + goto yy586; if (yych <= 0xEF) - goto yy633; - goto yy635; + goto yy585; + goto yy587; } else { if (yych <= 0xF3) - goto yy636; + goto yy588; if (yych <= 0xF4) - goto yy637; + goto yy589; } } - yy628: + yy581: p = marker; if (yyaccept == 0) { - goto yy616; + goto yy569; } else { - goto yy639; + goto yy591; } - yy629: - ++p; - yych = *p; + yy582: + yych = *++p; if (yybm[0 + yych] & 128) { - goto yy629; + goto yy582; } if (yych <= 0xDF) { if (yych <= '=') { if (yych <= 0x00) - goto yy628; + goto yy581; if (yych == '\n') - goto yy628; - goto yy626; + goto yy581; + goto yy579; } else { if (yych <= '>') - goto yy638; + goto yy590; if (yych <= 0x7F) - goto yy626; + goto yy579; if (yych <= 0xC1) - goto yy628; + goto yy581; } } else { if (yych <= 0xEF) { if (yych <= 0xE0) - goto yy632; + goto yy584; if (yych == 0xED) - goto yy634; - goto yy633; + goto yy586; + goto yy585; } else { if (yych <= 0xF0) - goto yy635; + goto yy587; if (yych <= 0xF3) - goto yy636; + goto yy588; if (yych <= 0xF4) - goto yy637; - goto yy628; + goto yy589; + goto yy581; } } - yy631: - ++p; - yych = *p; + yy583: + yych = *++p; if (yych <= 0x7F) - goto yy628; + goto yy581; if (yych <= 0xBF) - goto yy626; - goto yy628; - yy632: - ++p; - yych = *p; + goto yy579; + goto yy581; + yy584: + yych = *++p; if (yych <= 0x9F) - goto yy628; + goto yy581; if (yych <= 0xBF) - goto yy631; - goto yy628; - yy633: - ++p; - yych = *p; + goto yy583; + goto yy581; + yy585: + yych = *++p; if (yych <= 0x7F) - goto yy628; + goto yy581; if (yych <= 0xBF) - goto yy631; - goto yy628; - yy634: - ++p; - yych = *p; + goto yy583; + goto yy581; + yy586: + yych = *++p; if (yych <= 0x7F) - goto yy628; + goto yy581; if (yych <= 0x9F) - goto yy631; - goto yy628; - yy635: - ++p; - yych = *p; + goto yy583; + goto yy581; + yy587: + yych = *++p; if (yych <= 0x8F) - goto yy628; + goto yy581; if (yych <= 0xBF) - goto yy633; - goto yy628; - yy636: - ++p; - yych = *p; + goto yy585; + goto yy581; + yy588: + yych = *++p; if (yych <= 0x7F) - goto yy628; + goto yy581; if (yych <= 0xBF) - goto yy633; - goto yy628; - yy637: - ++p; - yych = *p; + goto yy585; + goto yy581; + yy589: + yych = *++p; if (yych <= 0x7F) - goto yy628; + goto yy581; if (yych <= 0x8F) - goto yy633; - goto yy628; - yy638: + goto yy585; + goto yy581; + yy590: yyaccept = 1; - marker = ++p; - yych = *p; + yych = *(marker = ++p); if (yybm[0 + yych] & 64) { - goto yy626; + goto yy579; } if (yych <= 0xEC) { if (yych <= 0xC1) { if (yych <= '\n') - goto yy639; + goto yy591; if (yych <= '?') - goto yy629; + goto yy582; } else { if (yych <= 0xDF) - goto yy631; + goto yy583; if (yych <= 0xE0) - goto yy632; - goto yy633; + goto yy584; + goto yy585; } } else { if (yych <= 0xF0) { if (yych <= 0xED) - goto yy634; + goto yy586; if (yych <= 0xEF) - goto yy633; - goto yy635; + goto yy585; + goto yy587; } else { if (yych <= 0xF3) - goto yy636; + goto yy588; if (yych <= 0xF4) - goto yy637; + goto yy589; } } - yy639 : { return (bufsize_t)(p - start); } + yy591 : { return (bufsize_t)(p - start); } } } @@ -10590,246 +10744,237 @@ bufsize_t _scan_html_block_end_4(const unsigned char *p) { }; yych = *p; if (yybm[0 + yych] & 64) { - goto yy645; + goto yy596; } if (yych <= 0xE0) { if (yych <= '\n') { if (yych <= 0x00) - goto yy642; + goto yy593; if (yych <= '\t') - goto yy644; + goto yy595; } else { if (yych <= 0x7F) - goto yy644; + goto yy595; if (yych <= 0xC1) - goto yy642; + goto yy593; if (yych <= 0xDF) - goto yy648; - goto yy649; + goto yy598; + goto yy599; } } else { if (yych <= 0xEF) { if (yych == 0xED) - goto yy651; - goto yy650; + goto yy601; + goto yy600; } else { if (yych <= 0xF0) - goto yy652; + goto yy602; if (yych <= 0xF3) - goto yy653; + goto yy603; if (yych <= 0xF4) - goto yy654; + goto yy604; } } - yy642: + yy593: ++p; - yy643 : { return 0; } - yy644: + yy594 : { return 0; } + yy595: yyaccept = 0; yych = *(marker = ++p); if (yych <= '\n') { if (yych <= 0x00) - goto yy643; + goto yy594; if (yych <= '\t') - goto yy656; - goto yy643; + goto yy606; + goto yy594; } else { if (yych <= 0x7F) - goto yy656; + goto yy606; if (yych <= 0xC1) - goto yy643; + goto yy594; if (yych <= 0xF4) - goto yy656; - goto yy643; + goto yy606; + goto yy594; } - yy645: + yy596: yyaccept = 1; - marker = ++p; - yych = *p; + yych = *(marker = ++p); if (yybm[0 + yych] & 128) { - goto yy655; + goto yy605; } if (yych <= 0xEC) { if (yych <= 0xC1) { if (yych <= '\n') - goto yy647; + goto yy597; if (yych <= '>') - goto yy645; + goto yy596; } else { if (yych <= 0xDF) - goto yy658; + goto yy608; if (yych <= 0xE0) - goto yy659; - goto yy660; + goto yy609; + goto yy610; } } else { if (yych <= 0xF0) { if (yych <= 0xED) - goto yy661; + goto yy611; if (yych <= 0xEF) - goto yy660; - goto yy662; + goto yy610; + goto yy612; } else { if (yych <= 0xF3) - goto yy663; + goto yy613; if (yych <= 0xF4) - goto yy664; + goto yy614; } } - yy647 : { return (bufsize_t)(p - start); } - yy648: + yy597 : { return (bufsize_t)(p - start); } + yy598: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x7F) - goto yy643; + goto yy594; if (yych <= 0xBF) - goto yy655; - goto yy643; - yy649: + goto yy605; + goto yy594; + yy599: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x9F) - goto yy643; + goto yy594; if (yych <= 0xBF) - goto yy658; - goto yy643; - yy650: + goto yy608; + goto yy594; + yy600: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x7F) - goto yy643; + goto yy594; if (yych <= 0xBF) - goto yy658; - goto yy643; - yy651: + goto yy608; + goto yy594; + yy601: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x7F) - goto yy643; + goto yy594; if (yych <= 0x9F) - goto yy658; - goto yy643; - yy652: + goto yy608; + goto yy594; + yy602: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x8F) - goto yy643; + goto yy594; if (yych <= 0xBF) - goto yy660; - goto yy643; - yy653: + goto yy610; + goto yy594; + yy603: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x7F) - goto yy643; + goto yy594; if (yych <= 0xBF) - goto yy660; - goto yy643; - yy654: + goto yy610; + goto yy594; + yy604: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x7F) - goto yy643; + goto yy594; if (yych <= 0x8F) - goto yy660; - goto yy643; - yy655: - ++p; - yych = *p; - yy656: + goto yy610; + goto yy594; + yy605: + yych = *++p; + yy606: if (yybm[0 + yych] & 128) { - goto yy655; + goto yy605; } if (yych <= 0xEC) { if (yych <= 0xC1) { if (yych <= '\n') - goto yy657; + goto yy607; if (yych <= '>') - goto yy645; + goto yy596; } else { if (yych <= 0xDF) - goto yy658; + goto yy608; if (yych <= 0xE0) - goto yy659; - goto yy660; + goto yy609; + goto yy610; } } else { if (yych <= 0xF0) { if (yych <= 0xED) - goto yy661; + goto yy611; if (yych <= 0xEF) - goto yy660; - goto yy662; + goto yy610; + goto yy612; } else { if (yych <= 0xF3) - goto yy663; + goto yy613; if (yych <= 0xF4) - goto yy664; + goto yy614; } } - yy657: + yy607: p = marker; if (yyaccept == 0) { - goto yy643; + goto yy594; } else { - goto yy647; + goto yy597; } - yy658: - ++p; - yych = *p; + yy608: + yych = *++p; if (yych <= 0x7F) - goto yy657; + goto yy607; if (yych <= 0xBF) - goto yy655; - goto yy657; - yy659: - ++p; - yych = *p; + goto yy605; + goto yy607; + yy609: + yych = *++p; if (yych <= 0x9F) - goto yy657; + goto yy607; if (yych <= 0xBF) - goto yy658; - goto yy657; - yy660: - ++p; - yych = *p; + goto yy608; + goto yy607; + yy610: + yych = *++p; if (yych <= 0x7F) - goto yy657; + goto yy607; if (yych <= 0xBF) - goto yy658; - goto yy657; - yy661: - ++p; - yych = *p; + goto yy608; + goto yy607; + yy611: + yych = *++p; if (yych <= 0x7F) - goto yy657; + goto yy607; if (yych <= 0x9F) - goto yy658; - goto yy657; - yy662: - ++p; - yych = *p; + goto yy608; + goto yy607; + yy612: + yych = *++p; if (yych <= 0x8F) - goto yy657; + goto yy607; if (yych <= 0xBF) - goto yy660; - goto yy657; - yy663: - ++p; - yych = *p; + goto yy610; + goto yy607; + yy613: + yych = *++p; if (yych <= 0x7F) - goto yy657; + goto yy607; if (yych <= 0xBF) - goto yy660; - goto yy657; - yy664: - ++p; - yych = *p; + goto yy610; + goto yy607; + yy614: + yych = *++p; if (yych <= 0x7F) - goto yy657; + goto yy607; if (yych <= 0x8F) - goto yy660; - goto yy657; + goto yy610; + goto yy607; } } @@ -10862,337 +11007,326 @@ bufsize_t _scan_html_block_end_5(const unsigned char *p) { if (yych <= 0xDF) { if (yych <= '\\') { if (yych <= 0x00) - goto yy667; + goto yy616; if (yych != '\n') - goto yy669; + goto yy618; } else { if (yych <= ']') - goto yy670; + goto yy619; if (yych <= 0x7F) - goto yy669; + goto yy618; if (yych >= 0xC2) - goto yy671; + goto yy620; } } else { if (yych <= 0xEF) { if (yych <= 0xE0) - goto yy672; + goto yy621; if (yych == 0xED) - goto yy674; - goto yy673; + goto yy623; + goto yy622; } else { if (yych <= 0xF0) - goto yy675; + goto yy624; if (yych <= 0xF3) - goto yy676; + goto yy625; if (yych <= 0xF4) - goto yy677; + goto yy626; } } - yy667: + yy616: ++p; - yy668 : { return 0; } - yy669: + yy617 : { return 0; } + yy618: yyaccept = 0; yych = *(marker = ++p); if (yych <= '\n') { if (yych <= 0x00) - goto yy668; + goto yy617; if (yych <= '\t') - goto yy679; - goto yy668; + goto yy628; + goto yy617; } else { if (yych <= 0x7F) - goto yy679; + goto yy628; if (yych <= 0xC1) - goto yy668; + goto yy617; if (yych <= 0xF4) - goto yy679; - goto yy668; + goto yy628; + goto yy617; } - yy670: + yy619: yyaccept = 0; yych = *(marker = ++p); if (yybm[0 + yych] & 128) { - goto yy689; + goto yy638; } if (yych <= '\n') { if (yych <= 0x00) - goto yy668; + goto yy617; if (yych <= '\t') - goto yy679; - goto yy668; + goto yy628; + goto yy617; } else { if (yych <= 0x7F) - goto yy679; + goto yy628; if (yych <= 0xC1) - goto yy668; + goto yy617; if (yych <= 0xF4) - goto yy679; - goto yy668; + goto yy628; + goto yy617; } - yy671: + yy620: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x7F) - goto yy668; + goto yy617; if (yych <= 0xBF) - goto yy678; - goto yy668; - yy672: + goto yy627; + goto yy617; + yy621: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x9F) - goto yy668; + goto yy617; if (yych <= 0xBF) - goto yy682; - goto yy668; - yy673: + goto yy631; + goto yy617; + yy622: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x7F) - goto yy668; + goto yy617; if (yych <= 0xBF) - goto yy682; - goto yy668; - yy674: + goto yy631; + goto yy617; + yy623: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x7F) - goto yy668; + goto yy617; if (yych <= 0x9F) - goto yy682; - goto yy668; - yy675: + goto yy631; + goto yy617; + yy624: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x8F) - goto yy668; + goto yy617; if (yych <= 0xBF) - goto yy684; - goto yy668; - yy676: + goto yy633; + goto yy617; + yy625: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x7F) - goto yy668; + goto yy617; if (yych <= 0xBF) - goto yy684; - goto yy668; - yy677: + goto yy633; + goto yy617; + yy626: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x7F) - goto yy668; + goto yy617; if (yych <= 0x8F) - goto yy684; - goto yy668; - yy678: - ++p; - yych = *p; - yy679: + goto yy633; + goto yy617; + yy627: + yych = *++p; + yy628: if (yybm[0 + yych] & 64) { - goto yy678; + goto yy627; } if (yych <= 0xEC) { if (yych <= 0xC1) { if (yych <= '\n') - goto yy680; + goto yy629; if (yych <= ']') - goto yy681; + goto yy630; } else { if (yych <= 0xDF) - goto yy682; + goto yy631; if (yych <= 0xE0) - goto yy683; - goto yy684; + goto yy632; + goto yy633; } } else { if (yych <= 0xF0) { if (yych <= 0xED) - goto yy685; + goto yy634; if (yych <= 0xEF) - goto yy684; - goto yy686; + goto yy633; + goto yy635; } else { if (yych <= 0xF3) - goto yy687; + goto yy636; if (yych <= 0xF4) - goto yy688; + goto yy637; } } - yy680: + yy629: p = marker; if (yyaccept == 0) { - goto yy668; + goto yy617; } else { - goto yy692; + goto yy640; } - yy681: - ++p; - yych = *p; + yy630: + yych = *++p; if (yybm[0 + yych] & 64) { - goto yy678; + goto yy627; } if (yych <= 0xEC) { if (yych <= 0xC1) { if (yych <= '\n') - goto yy680; + goto yy629; if (yych <= ']') - goto yy689; - goto yy680; + goto yy638; + goto yy629; } else { if (yych <= 0xDF) - goto yy682; + goto yy631; if (yych <= 0xE0) - goto yy683; - goto yy684; + goto yy632; + goto yy633; } } else { if (yych <= 0xF0) { if (yych <= 0xED) - goto yy685; + goto yy634; if (yych <= 0xEF) - goto yy684; - goto yy686; + goto yy633; + goto yy635; } else { if (yych <= 0xF3) - goto yy687; + goto yy636; if (yych <= 0xF4) - goto yy688; - goto yy680; + goto yy637; + goto yy629; } } - yy682: - ++p; - yych = *p; + yy631: + yych = *++p; if (yych <= 0x7F) - goto yy680; + goto yy629; if (yych <= 0xBF) - goto yy678; - goto yy680; - yy683: - ++p; - yych = *p; + goto yy627; + goto yy629; + yy632: + yych = *++p; if (yych <= 0x9F) - goto yy680; - if (yych <= 0xBF) - goto yy682; - goto yy680; - yy684: - ++p; - yych = *p; + goto yy629; + if (yych <= 0xBF) + goto yy631; + goto yy629; + yy633: + yych = *++p; if (yych <= 0x7F) - goto yy680; + goto yy629; if (yych <= 0xBF) - goto yy682; - goto yy680; - yy685: - ++p; - yych = *p; + goto yy631; + goto yy629; + yy634: + yych = *++p; if (yych <= 0x7F) - goto yy680; + goto yy629; if (yych <= 0x9F) - goto yy682; - goto yy680; - yy686: - ++p; - yych = *p; + goto yy631; + goto yy629; + yy635: + yych = *++p; if (yych <= 0x8F) - goto yy680; + goto yy629; if (yych <= 0xBF) - goto yy684; - goto yy680; - yy687: - ++p; - yych = *p; + goto yy633; + goto yy629; + yy636: + yych = *++p; if (yych <= 0x7F) - goto yy680; + goto yy629; if (yych <= 0xBF) - goto yy684; - goto yy680; - yy688: - ++p; - yych = *p; + goto yy633; + goto yy629; + yy637: + yych = *++p; if (yych <= 0x7F) - goto yy680; + goto yy629; if (yych <= 0x8F) - goto yy684; - goto yy680; - yy689: - ++p; - yych = *p; + goto yy633; + goto yy629; + yy638: + yych = *++p; if (yybm[0 + yych] & 128) { - goto yy689; + goto yy638; } if (yych <= 0xDF) { if (yych <= '=') { if (yych <= 0x00) - goto yy680; + goto yy629; if (yych == '\n') - goto yy680; - goto yy678; + goto yy629; + goto yy627; } else { if (yych <= '>') - goto yy691; + goto yy639; if (yych <= 0x7F) - goto yy678; + goto yy627; if (yych <= 0xC1) - goto yy680; - goto yy682; + goto yy629; + goto yy631; } } else { if (yych <= 0xEF) { if (yych <= 0xE0) - goto yy683; + goto yy632; if (yych == 0xED) - goto yy685; - goto yy684; + goto yy634; + goto yy633; } else { if (yych <= 0xF0) - goto yy686; + goto yy635; if (yych <= 0xF3) - goto yy687; + goto yy636; if (yych <= 0xF4) - goto yy688; - goto yy680; + goto yy637; + goto yy629; } } - yy691: + yy639: yyaccept = 1; - marker = ++p; - yych = *p; + yych = *(marker = ++p); if (yybm[0 + yych] & 64) { - goto yy678; + goto yy627; } if (yych <= 0xEC) { if (yych <= 0xC1) { if (yych <= '\n') - goto yy692; + goto yy640; if (yych <= ']') - goto yy681; + goto yy630; } else { if (yych <= 0xDF) - goto yy682; + goto yy631; if (yych <= 0xE0) - goto yy683; - goto yy684; + goto yy632; + goto yy633; } } else { if (yych <= 0xF0) { if (yych <= 0xED) - goto yy685; + goto yy634; if (yych <= 0xEF) - goto yy684; - goto yy686; + goto yy633; + goto yy635; } else { if (yych <= 0xF3) - goto yy687; + goto yy636; if (yych <= 0xF4) - goto yy688; + goto yy637; } } - yy692 : { return (bufsize_t)(p - start); } + yy640 : { return (bufsize_t)(p - start); } } } @@ -11230,563 +11364,533 @@ bufsize_t _scan_link_title(const unsigned char *p) { yych = *p; if (yych <= '&') { if (yych == '"') - goto yy697; + goto yy643; } else { if (yych <= '\'') - goto yy698; + goto yy644; if (yych <= '(') - goto yy699; + goto yy645; } ++p; - yy696 : { return 0; } - yy697: + yy642 : { return 0; } + yy643: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x00) - goto yy696; + goto yy642; if (yych <= 0x7F) - goto yy701; + goto yy647; if (yych <= 0xC1) - goto yy696; + goto yy642; if (yych <= 0xF4) - goto yy701; - goto yy696; - yy698: + goto yy647; + goto yy642; + yy644: yyaccept = 0; yych = *(marker = ++p); if (yych <= 0x00) - goto yy696; + goto yy642; if (yych <= 0x7F) - goto yy715; + goto yy660; if (yych <= 0xC1) - goto yy696; + goto yy642; if (yych <= 0xF4) - goto yy715; - goto yy696; - yy699: + goto yy660; + goto yy642; + yy645: yyaccept = 0; yych = *(marker = ++p); if (yych <= '(') { if (yych <= 0x00) - goto yy696; + goto yy642; if (yych <= '\'') - goto yy728; - goto yy696; + goto yy672; + goto yy642; } else { if (yych <= 0x7F) - goto yy728; + goto yy672; if (yych <= 0xC1) - goto yy696; + goto yy642; if (yych <= 0xF4) - goto yy728; - goto yy696; + goto yy672; + goto yy642; } - yy700: - ++p; - yych = *p; - yy701: + yy646: + yych = *++p; + yy647: if (yybm[0 + yych] & 16) { - goto yy700; + goto yy646; } if (yych <= 0xE0) { if (yych <= '\\') { if (yych <= 0x00) - goto yy702; + goto yy648; if (yych <= '"') - goto yy703; - goto yy705; + goto yy649; + goto yy651; } else { if (yych <= 0xC1) - goto yy702; + goto yy648; if (yych <= 0xDF) - goto yy707; - goto yy708; + goto yy652; + goto yy653; } } else { if (yych <= 0xEF) { if (yych == 0xED) - goto yy710; - goto yy709; + goto yy655; + goto yy654; } else { if (yych <= 0xF0) - goto yy711; + goto yy656; if (yych <= 0xF3) - goto yy712; + goto yy657; if (yych <= 0xF4) - goto yy713; + goto yy658; } } - yy702: + yy648: p = marker; if (yyaccept <= 1) { if (yyaccept == 0) { - goto yy696; + goto yy642; } else { - goto yy704; + goto yy650; } } else { if (yyaccept == 2) { - goto yy717; + goto yy662; } else { - goto yy730; + goto yy674; } } - yy703: - ++p; - yy704 : { return (bufsize_t)(p - start); } - yy705: + yy649: ++p; - yych = *p; + yy650 : { return (bufsize_t)(p - start); } + yy651: + yych = *++p; if (yybm[0 + yych] & 16) { - goto yy700; + goto yy646; } if (yych <= 0xE0) { if (yych <= '\\') { if (yych <= 0x00) - goto yy702; + goto yy648; if (yych <= '"') - goto yy740; - goto yy705; + goto yy683; + goto yy651; } else { if (yych <= 0xC1) - goto yy702; + goto yy648; if (yych >= 0xE0) - goto yy708; + goto yy653; } } else { if (yych <= 0xEF) { if (yych == 0xED) - goto yy710; - goto yy709; + goto yy655; + goto yy654; } else { if (yych <= 0xF0) - goto yy711; + goto yy656; if (yych <= 0xF3) - goto yy712; + goto yy657; if (yych <= 0xF4) - goto yy713; - goto yy702; + goto yy658; + goto yy648; } } - yy707: - ++p; - yych = *p; + yy652: + yych = *++p; if (yych <= 0x7F) - goto yy702; + goto yy648; if (yych <= 0xBF) - goto yy700; - goto yy702; - yy708: - ++p; - yych = *p; + goto yy646; + goto yy648; + yy653: + yych = *++p; if (yych <= 0x9F) - goto yy702; + goto yy648; if (yych <= 0xBF) - goto yy707; - goto yy702; - yy709: - ++p; - yych = *p; + goto yy652; + goto yy648; + yy654: + yych = *++p; if (yych <= 0x7F) - goto yy702; + goto yy648; if (yych <= 0xBF) - goto yy707; - goto yy702; - yy710: - ++p; - yych = *p; + goto yy652; + goto yy648; + yy655: + yych = *++p; if (yych <= 0x7F) - goto yy702; + goto yy648; if (yych <= 0x9F) - goto yy707; - goto yy702; - yy711: - ++p; - yych = *p; + goto yy652; + goto yy648; + yy656: + yych = *++p; if (yych <= 0x8F) - goto yy702; + goto yy648; if (yych <= 0xBF) - goto yy709; - goto yy702; - yy712: - ++p; - yych = *p; + goto yy654; + goto yy648; + yy657: + yych = *++p; if (yych <= 0x7F) - goto yy702; + goto yy648; if (yych <= 0xBF) - goto yy709; - goto yy702; - yy713: - ++p; - yych = *p; + goto yy654; + goto yy648; + yy658: + yych = *++p; if (yych <= 0x7F) - goto yy702; + goto yy648; if (yych <= 0x8F) - goto yy709; - goto yy702; - yy714: - ++p; - yych = *p; - yy715: + goto yy654; + goto yy648; + yy659: + yych = *++p; + yy660: if (yybm[0 + yych] & 64) { - goto yy714; + goto yy659; } if (yych <= 0xE0) { if (yych <= '\\') { if (yych <= 0x00) - goto yy702; + goto yy648; if (yych >= '(') - goto yy718; + goto yy663; } else { if (yych <= 0xC1) - goto yy702; + goto yy648; if (yych <= 0xDF) - goto yy720; - goto yy721; + goto yy664; + goto yy665; } } else { if (yych <= 0xEF) { if (yych == 0xED) - goto yy723; - goto yy722; + goto yy667; + goto yy666; } else { if (yych <= 0xF0) - goto yy724; + goto yy668; if (yych <= 0xF3) - goto yy725; + goto yy669; if (yych <= 0xF4) - goto yy726; - goto yy702; + goto yy670; + goto yy648; } } - yy716: - ++p; - yy717 : { return (bufsize_t)(p - start); } - yy718: + yy661: ++p; - yych = *p; + yy662 : { return (bufsize_t)(p - start); } + yy663: + yych = *++p; if (yybm[0 + yych] & 64) { - goto yy714; + goto yy659; } if (yych <= 0xE0) { if (yych <= '\\') { if (yych <= 0x00) - goto yy702; + goto yy648; if (yych <= '\'') - goto yy741; - goto yy718; + goto yy684; + goto yy663; } else { if (yych <= 0xC1) - goto yy702; + goto yy648; if (yych >= 0xE0) - goto yy721; + goto yy665; } } else { if (yych <= 0xEF) { if (yych == 0xED) - goto yy723; - goto yy722; + goto yy667; + goto yy666; } else { if (yych <= 0xF0) - goto yy724; + goto yy668; if (yych <= 0xF3) - goto yy725; + goto yy669; if (yych <= 0xF4) - goto yy726; - goto yy702; + goto yy670; + goto yy648; } } - yy720: - ++p; - yych = *p; + yy664: + yych = *++p; if (yych <= 0x7F) - goto yy702; + goto yy648; if (yych <= 0xBF) - goto yy714; - goto yy702; - yy721: - ++p; - yych = *p; + goto yy659; + goto yy648; + yy665: + yych = *++p; if (yych <= 0x9F) - goto yy702; + goto yy648; if (yych <= 0xBF) - goto yy720; - goto yy702; - yy722: - ++p; - yych = *p; + goto yy664; + goto yy648; + yy666: + yych = *++p; if (yych <= 0x7F) - goto yy702; + goto yy648; if (yych <= 0xBF) - goto yy720; - goto yy702; - yy723: - ++p; - yych = *p; + goto yy664; + goto yy648; + yy667: + yych = *++p; if (yych <= 0x7F) - goto yy702; + goto yy648; if (yych <= 0x9F) - goto yy720; - goto yy702; - yy724: - ++p; - yych = *p; + goto yy664; + goto yy648; + yy668: + yych = *++p; if (yych <= 0x8F) - goto yy702; + goto yy648; if (yych <= 0xBF) - goto yy722; - goto yy702; - yy725: - ++p; - yych = *p; + goto yy666; + goto yy648; + yy669: + yych = *++p; if (yych <= 0x7F) - goto yy702; + goto yy648; if (yych <= 0xBF) - goto yy722; - goto yy702; - yy726: - ++p; - yych = *p; + goto yy666; + goto yy648; + yy670: + yych = *++p; if (yych <= 0x7F) - goto yy702; + goto yy648; if (yych <= 0x8F) - goto yy722; - goto yy702; - yy727: - ++p; - yych = *p; - yy728: + goto yy666; + goto yy648; + yy671: + yych = *++p; + yy672: if (yybm[0 + yych] & 128) { - goto yy727; + goto yy671; } if (yych <= 0xE0) { if (yych <= '\\') { if (yych <= '(') - goto yy702; + goto yy648; if (yych >= '*') - goto yy731; + goto yy675; } else { if (yych <= 0xC1) - goto yy702; + goto yy648; if (yych <= 0xDF) - goto yy733; - goto yy734; + goto yy676; + goto yy677; } } else { if (yych <= 0xEF) { if (yych == 0xED) - goto yy736; - goto yy735; + goto yy679; + goto yy678; } else { if (yych <= 0xF0) - goto yy737; + goto yy680; if (yych <= 0xF3) - goto yy738; + goto yy681; if (yych <= 0xF4) - goto yy739; - goto yy702; + goto yy682; + goto yy648; } } - yy729: - ++p; - yy730 : { return (bufsize_t)(p - start); } - yy731: + yy673: ++p; - yych = *p; + yy674 : { return (bufsize_t)(p - start); } + yy675: + yych = *++p; if (yych <= 0xDF) { if (yych <= '[') { if (yych <= 0x00) - goto yy702; + goto yy648; if (yych == ')') - goto yy742; - goto yy727; + goto yy685; + goto yy671; } else { if (yych <= '\\') - goto yy731; + goto yy675; if (yych <= 0x7F) - goto yy727; + goto yy671; if (yych <= 0xC1) - goto yy702; + goto yy648; } } else { if (yych <= 0xEF) { if (yych <= 0xE0) - goto yy734; + goto yy677; if (yych == 0xED) - goto yy736; - goto yy735; + goto yy679; + goto yy678; } else { if (yych <= 0xF0) - goto yy737; + goto yy680; if (yych <= 0xF3) - goto yy738; + goto yy681; if (yych <= 0xF4) - goto yy739; - goto yy702; + goto yy682; + goto yy648; } } - yy733: - ++p; - yych = *p; + yy676: + yych = *++p; if (yych <= 0x7F) - goto yy702; + goto yy648; if (yych <= 0xBF) - goto yy727; - goto yy702; - yy734: - ++p; - yych = *p; + goto yy671; + goto yy648; + yy677: + yych = *++p; if (yych <= 0x9F) - goto yy702; + goto yy648; if (yych <= 0xBF) - goto yy733; - goto yy702; - yy735: - ++p; - yych = *p; + goto yy676; + goto yy648; + yy678: + yych = *++p; if (yych <= 0x7F) - goto yy702; + goto yy648; if (yych <= 0xBF) - goto yy733; - goto yy702; - yy736: - ++p; - yych = *p; + goto yy676; + goto yy648; + yy679: + yych = *++p; if (yych <= 0x7F) - goto yy702; + goto yy648; if (yych <= 0x9F) - goto yy733; - goto yy702; - yy737: - ++p; - yych = *p; + goto yy676; + goto yy648; + yy680: + yych = *++p; if (yych <= 0x8F) - goto yy702; + goto yy648; if (yych <= 0xBF) - goto yy735; - goto yy702; - yy738: - ++p; - yych = *p; + goto yy678; + goto yy648; + yy681: + yych = *++p; if (yych <= 0x7F) - goto yy702; + goto yy648; if (yych <= 0xBF) - goto yy735; - goto yy702; - yy739: - ++p; - yych = *p; + goto yy678; + goto yy648; + yy682: + yych = *++p; if (yych <= 0x7F) - goto yy702; + goto yy648; if (yych <= 0x8F) - goto yy735; - goto yy702; - yy740: + goto yy678; + goto yy648; + yy683: yyaccept = 1; - marker = ++p; - yych = *p; + yych = *(marker = ++p); if (yybm[0 + yych] & 16) { - goto yy700; + goto yy646; } if (yych <= 0xE0) { if (yych <= '\\') { if (yych <= 0x00) - goto yy704; + goto yy650; if (yych <= '"') - goto yy703; - goto yy705; + goto yy649; + goto yy651; } else { if (yych <= 0xC1) - goto yy704; + goto yy650; if (yych <= 0xDF) - goto yy707; - goto yy708; + goto yy652; + goto yy653; } } else { if (yych <= 0xEF) { if (yych == 0xED) - goto yy710; - goto yy709; + goto yy655; + goto yy654; } else { if (yych <= 0xF0) - goto yy711; + goto yy656; if (yych <= 0xF3) - goto yy712; + goto yy657; if (yych <= 0xF4) - goto yy713; - goto yy704; + goto yy658; + goto yy650; } } - yy741: + yy684: yyaccept = 2; - marker = ++p; - yych = *p; + yych = *(marker = ++p); if (yybm[0 + yych] & 64) { - goto yy714; + goto yy659; } if (yych <= 0xE0) { if (yych <= '\\') { if (yych <= 0x00) - goto yy717; + goto yy662; if (yych <= '\'') - goto yy716; - goto yy718; + goto yy661; + goto yy663; } else { if (yych <= 0xC1) - goto yy717; + goto yy662; if (yych <= 0xDF) - goto yy720; - goto yy721; + goto yy664; + goto yy665; } } else { if (yych <= 0xEF) { if (yych == 0xED) - goto yy723; - goto yy722; + goto yy667; + goto yy666; } else { if (yych <= 0xF0) - goto yy724; + goto yy668; if (yych <= 0xF3) - goto yy725; + goto yy669; if (yych <= 0xF4) - goto yy726; - goto yy717; + goto yy670; + goto yy662; } } - yy742: + yy685: yyaccept = 3; - marker = ++p; - yych = *p; + yych = *(marker = ++p); if (yybm[0 + yych] & 128) { - goto yy727; + goto yy671; } if (yych <= 0xE0) { if (yych <= '\\') { if (yych <= '(') - goto yy730; + goto yy674; if (yych <= ')') - goto yy729; - goto yy731; + goto yy673; + goto yy675; } else { if (yych <= 0xC1) - goto yy730; + goto yy674; if (yych <= 0xDF) - goto yy733; - goto yy734; + goto yy676; + goto yy677; } } else { if (yych <= 0xEF) { if (yych == 0xED) - goto yy736; - goto yy735; + goto yy679; + goto yy678; } else { if (yych <= 0xF0) - goto yy737; + goto yy680; if (yych <= 0xF3) - goto yy738; + goto yy681; if (yych <= 0xF4) - goto yy739; - goto yy730; + goto yy682; + goto yy674; } } } @@ -11815,15 +11919,14 @@ bufsize_t _scan_spacechars(const unsigned char *p) { }; yych = *p; if (yybm[0 + yych] & 128) { - goto yy747; + goto yy687; } ++p; { return 0; } - yy747: - ++p; - yych = *p; + yy687: + yych = *++p; if (yybm[0 + yych] & 128) { - goto yy747; + goto yy687; } { return (bufsize_t)(p - start); } } @@ -11852,116 +11955,115 @@ bufsize_t _scan_atx_heading_start(const unsigned char *p) { }; yych = *p; if (yych == '#') - goto yy754; + goto yy690; ++p; - yy753 : { return 0; } - yy754: + yy689 : { return 0; } + yy690: yych = *(marker = ++p); if (yybm[0 + yych] & 128) { - goto yy755; + goto yy691; } if (yych <= '\f') { if (yych <= 0x08) - goto yy753; + goto yy689; if (yych <= '\n') - goto yy758; - goto yy753; + goto yy693; + goto yy689; } else { if (yych <= '\r') - goto yy758; + goto yy693; if (yych == '#') - goto yy759; - goto yy753; + goto yy694; + goto yy689; } - yy755: - ++p; - yych = *p; + yy691: + yych = *++p; if (yybm[0 + yych] & 128) { - goto yy755; + goto yy691; } - yy757 : { return (bufsize_t)(p - start); } - yy758: - yych = *++p; - goto yy757; - yy759: + yy692 : { return (bufsize_t)(p - start); } + yy693: + ++p; + goto yy692; + yy694: yych = *++p; if (yybm[0 + yych] & 128) { - goto yy755; + goto yy691; } if (yych <= '\f') { if (yych <= 0x08) - goto yy760; + goto yy695; if (yych <= '\n') - goto yy758; + goto yy693; } else { if (yych <= '\r') - goto yy758; + goto yy693; if (yych == '#') - goto yy761; + goto yy696; } - yy760: + yy695: p = marker; - goto yy753; - yy761: + goto yy689; + yy696: yych = *++p; if (yybm[0 + yych] & 128) { - goto yy755; + goto yy691; } if (yych <= '\f') { if (yych <= 0x08) - goto yy760; + goto yy695; if (yych <= '\n') - goto yy758; - goto yy760; + goto yy693; + goto yy695; } else { if (yych <= '\r') - goto yy758; + goto yy693; if (yych != '#') - goto yy760; + goto yy695; } yych = *++p; if (yybm[0 + yych] & 128) { - goto yy755; + goto yy691; } if (yych <= '\f') { if (yych <= 0x08) - goto yy760; + goto yy695; if (yych <= '\n') - goto yy758; - goto yy760; + goto yy693; + goto yy695; } else { if (yych <= '\r') - goto yy758; + goto yy693; if (yych != '#') - goto yy760; + goto yy695; } yych = *++p; if (yybm[0 + yych] & 128) { - goto yy755; + goto yy691; } if (yych <= '\f') { if (yych <= 0x08) - goto yy760; + goto yy695; if (yych <= '\n') - goto yy758; - goto yy760; + goto yy693; + goto yy695; } else { if (yych <= '\r') - goto yy758; + goto yy693; if (yych != '#') - goto yy760; + goto yy695; } - ++p; - if (yybm[0 + (yych = *p)] & 128) { - goto yy755; + yych = *++p; + if (yybm[0 + yych] & 128) { + goto yy691; } if (yych <= 0x08) - goto yy760; + goto yy695; if (yych <= '\n') - goto yy758; + goto yy693; if (yych == '\r') - goto yy758; - goto yy760; + goto yy693; + goto yy695; } } @@ -11988,126 +12090,122 @@ bufsize_t _scan_setext_heading_line(const unsigned char *p) { }; yych = *p; if (yych == '-') - goto yy769; + goto yy699; if (yych == '=') - goto yy770; + goto yy700; ++p; - yy768 : { return 0; } - yy769: + yy698 : { return 0; } + yy699: yych = *(marker = ++p); if (yybm[0 + yych] & 64) { - goto yy776; + goto yy705; } if (yych <= '\f') { if (yych <= 0x08) - goto yy768; + goto yy698; if (yych <= '\n') - goto yy772; - goto yy768; + goto yy702; + goto yy698; } else { if (yych <= '\r') - goto yy772; + goto yy702; if (yych == ' ') - goto yy772; - goto yy768; + goto yy702; + goto yy698; } - yy770: + yy700: yych = *(marker = ++p); if (yybm[0 + yych] & 128) { - goto yy782; + goto yy709; } if (yych <= '\f') { if (yych <= 0x08) - goto yy768; + goto yy698; if (yych <= '\n') - goto yy779; - goto yy768; + goto yy707; + goto yy698; } else { if (yych <= '\r') - goto yy779; + goto yy707; if (yych == ' ') - goto yy779; - goto yy768; + goto yy707; + goto yy698; } - yy771: - ++p; - yych = *p; - yy772: + yy701: + yych = *++p; + yy702: if (yybm[0 + yych] & 32) { - goto yy771; + goto yy701; } if (yych <= 0x08) - goto yy773; + goto yy703; if (yych <= '\n') - goto yy774; + goto yy704; if (yych == '\r') - goto yy774; - yy773: + goto yy704; + yy703: p = marker; - goto yy768; - yy774: + goto yy698; + yy704: ++p; { return 2; } - yy776: - ++p; - yych = *p; + yy705: + yych = *++p; if (yybm[0 + yych] & 32) { - goto yy771; + goto yy701; } if (yych <= '\f') { if (yych <= 0x08) - goto yy773; + goto yy703; if (yych <= '\n') - goto yy774; - goto yy773; + goto yy704; + goto yy703; } else { if (yych <= '\r') - goto yy774; + goto yy704; if (yych == '-') - goto yy776; - goto yy773; + goto yy705; + goto yy703; } - yy778: - ++p; - yych = *p; - yy779: + yy706: + yych = *++p; + yy707: if (yych <= '\f') { if (yych <= 0x08) - goto yy773; + goto yy703; if (yych <= '\t') - goto yy778; + goto yy706; if (yych >= '\v') - goto yy773; + goto yy703; } else { if (yych <= '\r') - goto yy780; + goto yy708; if (yych == ' ') - goto yy778; - goto yy773; + goto yy706; + goto yy703; } - yy780: + yy708: ++p; { return 1; } - yy782: - ++p; - yych = *p; + yy709: + yych = *++p; if (yybm[0 + yych] & 128) { - goto yy782; + goto yy709; } if (yych <= '\f') { if (yych <= 0x08) - goto yy773; + goto yy703; if (yych <= '\t') - goto yy778; + goto yy706; if (yych <= '\n') - goto yy780; - goto yy773; + goto yy708; + goto yy703; } else { if (yych <= '\r') - goto yy780; + goto yy708; if (yych == ' ') - goto yy778; - goto yy773; + goto yy706; + goto yy703; } } } @@ -12142,299 +12240,321 @@ bufsize_t _scan_open_code_fence(const unsigned char *p) { }; yych = *p; if (yych == '`') - goto yy788; + goto yy712; if (yych == '~') - goto yy789; + goto yy713; ++p; - yy787 : { return 0; } - yy788: + yy711 : { return 0; } + yy712: yych = *(marker = ++p); if (yych == '`') - goto yy790; - goto yy787; - yy789: + goto yy714; + goto yy711; + yy713: yych = *(marker = ++p); if (yych == '~') - goto yy792; - goto yy787; - yy790: + goto yy716; + goto yy711; + yy714: yych = *++p; if (yybm[0 + yych] & 16) { - goto yy793; + goto yy717; } - yy791: + yy715: p = marker; - goto yy787; - yy792: + goto yy711; + yy716: yych = *++p; if (yybm[0 + yych] & 32) { - goto yy795; + goto yy718; } - goto yy791; - yy793: - ++p; - yych = *p; - marker = p; - if (yybm[0 + yych] & 64) { - goto yy797; + goto yy715; + yy717: + yych = *++p; + if (yybm[0 + yych] & 16) { + goto yy717; } - if (yych <= 0xE0) { - if (yych <= '`') { + if (yych <= 0xDF) { + if (yych <= '\f') { if (yych <= 0x00) - goto yy791; - if (yych <= '\r') - goto yy799; - goto yy793; + goto yy715; + if (yych == '\n') { + marker = p; + goto yy720; + } + marker = p; + goto yy719; } else { - if (yych <= 0xC1) - goto yy791; - if (yych <= 0xDF) - goto yy801; - goto yy802; + if (yych <= '\r') { + marker = p; + goto yy720; + } + if (yych <= 0x7F) { + marker = p; + goto yy719; + } + if (yych <= 0xC1) + goto yy715; + marker = p; + goto yy721; } } else { if (yych <= 0xEF) { - if (yych == 0xED) - goto yy804; - goto yy803; + if (yych <= 0xE0) { + marker = p; + goto yy722; + } + if (yych == 0xED) { + marker = p; + goto yy724; + } + marker = p; + goto yy723; } else { - if (yych <= 0xF0) - goto yy805; - if (yych <= 0xF3) - goto yy806; - if (yych <= 0xF4) - goto yy807; - goto yy791; + if (yych <= 0xF0) { + marker = p; + goto yy725; + } + if (yych <= 0xF3) { + marker = p; + goto yy726; + } + if (yych <= 0xF4) { + marker = p; + goto yy727; + } + goto yy715; } } - yy795: - ++p; - yych = *p; - marker = p; + yy718: + yych = *++p; if (yybm[0 + yych] & 32) { - goto yy795; + goto yy718; } if (yych <= 0xDF) { if (yych <= '\f') { if (yych <= 0x00) - goto yy791; - if (yych == '\n') - goto yy810; - goto yy808; + goto yy715; + if (yych == '\n') { + marker = p; + goto yy729; + } + marker = p; + goto yy728; } else { - if (yych <= '\r') - goto yy810; - if (yych <= 0x7F) - goto yy808; + if (yych <= '\r') { + marker = p; + goto yy729; + } + if (yych <= 0x7F) { + marker = p; + goto yy728; + } if (yych <= 0xC1) - goto yy791; - goto yy812; + goto yy715; + marker = p; + goto yy730; } } else { if (yych <= 0xEF) { - if (yych <= 0xE0) - goto yy813; - if (yych == 0xED) - goto yy815; - goto yy814; + if (yych <= 0xE0) { + marker = p; + goto yy731; + } + if (yych == 0xED) { + marker = p; + goto yy733; + } + marker = p; + goto yy732; } else { - if (yych <= 0xF0) - goto yy816; - if (yych <= 0xF3) - goto yy817; - if (yych <= 0xF4) - goto yy818; - goto yy791; + if (yych <= 0xF0) { + marker = p; + goto yy734; + } + if (yych <= 0xF3) { + marker = p; + goto yy735; + } + if (yych <= 0xF4) { + marker = p; + goto yy736; + } + goto yy715; } } - yy797: - ++p; - yych = *p; + yy719: + yych = *++p; if (yybm[0 + yych] & 64) { - goto yy797; + goto yy719; } if (yych <= 0xEC) { if (yych <= 0xC1) { if (yych <= 0x00) - goto yy791; + goto yy715; if (yych >= 0x0E) - goto yy791; + goto yy715; } else { if (yych <= 0xDF) - goto yy801; + goto yy721; if (yych <= 0xE0) - goto yy802; - goto yy803; + goto yy722; + goto yy723; } } else { if (yych <= 0xF0) { if (yych <= 0xED) - goto yy804; + goto yy724; if (yych <= 0xEF) - goto yy803; - goto yy805; + goto yy723; + goto yy725; } else { if (yych <= 0xF3) - goto yy806; + goto yy726; if (yych <= 0xF4) - goto yy807; - goto yy791; + goto yy727; + goto yy715; } } - yy799: + yy720: ++p; p = marker; { return (bufsize_t)(p - start); } - yy801: - ++p; - yych = *p; + yy721: + yych = *++p; if (yych <= 0x7F) - goto yy791; + goto yy715; if (yych <= 0xBF) - goto yy797; - goto yy791; - yy802: - ++p; - yych = *p; + goto yy719; + goto yy715; + yy722: + yych = *++p; if (yych <= 0x9F) - goto yy791; + goto yy715; if (yych <= 0xBF) - goto yy801; - goto yy791; - yy803: - ++p; - yych = *p; + goto yy721; + goto yy715; + yy723: + yych = *++p; if (yych <= 0x7F) - goto yy791; + goto yy715; if (yych <= 0xBF) - goto yy801; - goto yy791; - yy804: - ++p; - yych = *p; + goto yy721; + goto yy715; + yy724: + yych = *++p; if (yych <= 0x7F) - goto yy791; + goto yy715; if (yych <= 0x9F) - goto yy801; - goto yy791; - yy805: - ++p; - yych = *p; + goto yy721; + goto yy715; + yy725: + yych = *++p; if (yych <= 0x8F) - goto yy791; + goto yy715; if (yych <= 0xBF) - goto yy803; - goto yy791; - yy806: - ++p; - yych = *p; + goto yy723; + goto yy715; + yy726: + yych = *++p; if (yych <= 0x7F) - goto yy791; + goto yy715; if (yych <= 0xBF) - goto yy803; - goto yy791; - yy807: - ++p; - yych = *p; + goto yy723; + goto yy715; + yy727: + yych = *++p; if (yych <= 0x7F) - goto yy791; + goto yy715; if (yych <= 0x8F) - goto yy803; - goto yy791; - yy808: - ++p; - yych = *p; + goto yy723; + goto yy715; + yy728: + yych = *++p; if (yybm[0 + yych] & 128) { - goto yy808; + goto yy728; } if (yych <= 0xEC) { if (yych <= 0xC1) { if (yych <= 0x00) - goto yy791; + goto yy715; if (yych >= 0x0E) - goto yy791; + goto yy715; } else { if (yych <= 0xDF) - goto yy812; + goto yy730; if (yych <= 0xE0) - goto yy813; - goto yy814; + goto yy731; + goto yy732; } } else { if (yych <= 0xF0) { if (yych <= 0xED) - goto yy815; + goto yy733; if (yych <= 0xEF) - goto yy814; - goto yy816; + goto yy732; + goto yy734; } else { if (yych <= 0xF3) - goto yy817; + goto yy735; if (yych <= 0xF4) - goto yy818; - goto yy791; + goto yy736; + goto yy715; } } - yy810: + yy729: ++p; p = marker; { return (bufsize_t)(p - start); } - yy812: - ++p; - yych = *p; + yy730: + yych = *++p; if (yych <= 0x7F) - goto yy791; + goto yy715; if (yych <= 0xBF) - goto yy808; - goto yy791; - yy813: - ++p; - yych = *p; + goto yy728; + goto yy715; + yy731: + yych = *++p; if (yych <= 0x9F) - goto yy791; + goto yy715; if (yych <= 0xBF) - goto yy812; - goto yy791; - yy814: - ++p; - yych = *p; + goto yy730; + goto yy715; + yy732: + yych = *++p; if (yych <= 0x7F) - goto yy791; + goto yy715; if (yych <= 0xBF) - goto yy812; - goto yy791; - yy815: - ++p; - yych = *p; + goto yy730; + goto yy715; + yy733: + yych = *++p; if (yych <= 0x7F) - goto yy791; + goto yy715; if (yych <= 0x9F) - goto yy812; - goto yy791; - yy816: - ++p; - yych = *p; + goto yy730; + goto yy715; + yy734: + yych = *++p; if (yych <= 0x8F) - goto yy791; + goto yy715; if (yych <= 0xBF) - goto yy814; - goto yy791; - yy817: - ++p; - yych = *p; + goto yy732; + goto yy715; + yy735: + yych = *++p; if (yych <= 0x7F) - goto yy791; + goto yy715; if (yych <= 0xBF) - goto yy814; - goto yy791; - yy818: - ++p; - yych = *p; + goto yy732; + goto yy715; + yy736: + yych = *++p; if (yych <= 0x7F) - goto yy791; + goto yy715; if (yych <= 0x8F) - goto yy814; - goto yy791; + goto yy732; + goto yy715; } } @@ -12461,111 +12581,123 @@ bufsize_t _scan_close_code_fence(const unsigned char *p) { }; yych = *p; if (yych == '`') - goto yy823; + goto yy739; if (yych == '~') - goto yy824; + goto yy740; ++p; - yy822 : { return 0; } - yy823: + yy738 : { return 0; } + yy739: yych = *(marker = ++p); if (yych == '`') - goto yy825; - goto yy822; - yy824: + goto yy741; + goto yy738; + yy740: yych = *(marker = ++p); if (yych == '~') - goto yy827; - goto yy822; - yy825: + goto yy743; + goto yy738; + yy741: yych = *++p; if (yybm[0 + yych] & 32) { - goto yy828; + goto yy744; } - yy826: + yy742: p = marker; - goto yy822; - yy827: + goto yy738; + yy743: yych = *++p; if (yybm[0 + yych] & 64) { - goto yy830; + goto yy745; } - goto yy826; - yy828: - ++p; - yych = *p; - marker = p; - if (yybm[0 + yych] & 128) { - goto yy832; + goto yy742; + yy744: + yych = *++p; + if (yybm[0 + yych] & 32) { + goto yy744; } if (yych <= '\f') { if (yych <= 0x08) - goto yy826; - if (yych <= '\n') - goto yy834; - goto yy826; + goto yy742; + if (yych <= '\t') { + marker = p; + goto yy746; + } + if (yych <= '\n') { + marker = p; + goto yy747; + } + goto yy742; } else { - if (yych <= '\r') - goto yy834; - if (yych == '`') - goto yy828; - goto yy826; + if (yych <= '\r') { + marker = p; + goto yy747; + } + if (yych == ' ') { + marker = p; + goto yy746; + } + goto yy742; } - yy830: - ++p; - yych = *p; - marker = p; + yy745: + yych = *++p; if (yybm[0 + yych] & 64) { - goto yy830; + goto yy745; } if (yych <= '\f') { if (yych <= 0x08) - goto yy826; - if (yych <= '\t') - goto yy836; - if (yych <= '\n') - goto yy838; - goto yy826; + goto yy742; + if (yych <= '\t') { + marker = p; + goto yy748; + } + if (yych <= '\n') { + marker = p; + goto yy749; + } + goto yy742; } else { - if (yych <= '\r') - goto yy838; - if (yych == ' ') - goto yy836; - goto yy826; + if (yych <= '\r') { + marker = p; + goto yy749; + } + if (yych == ' ') { + marker = p; + goto yy748; + } + goto yy742; } - yy832: - ++p; - yych = *p; + yy746: + yych = *++p; if (yybm[0 + yych] & 128) { - goto yy832; + goto yy746; } if (yych <= 0x08) - goto yy826; + goto yy742; if (yych <= '\n') - goto yy834; + goto yy747; if (yych != '\r') - goto yy826; - yy834: + goto yy742; + yy747: ++p; p = marker; { return (bufsize_t)(p - start); } - yy836: - ++p; - yych = *p; + yy748: + yych = *++p; if (yych <= '\f') { if (yych <= 0x08) - goto yy826; + goto yy742; if (yych <= '\t') - goto yy836; + goto yy748; if (yych >= '\v') - goto yy826; + goto yy742; } else { if (yych <= '\r') - goto yy838; + goto yy749; if (yych == ' ') - goto yy836; - goto yy826; + goto yy748; + goto yy742; } - yy838: + yy749: ++p; p = marker; { return (bufsize_t)(p - start); } @@ -12582,890 +12714,890 @@ bufsize_t _scan_entity(const unsigned char *p) { unsigned char yych; yych = *p; if (yych == '&') - goto yy844; + goto yy752; ++p; - yy843 : { return 0; } - yy844: + yy751 : { return 0; } + yy752: yych = *(marker = ++p); if (yych <= '@') { if (yych != '#') - goto yy843; + goto yy751; } else { if (yych <= 'Z') - goto yy847; + goto yy754; if (yych <= '`') - goto yy843; + goto yy751; if (yych <= 'z') - goto yy847; - goto yy843; + goto yy754; + goto yy751; } yych = *++p; if (yych <= 'W') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy848; + goto yy755; } else { if (yych <= 'X') - goto yy849; + goto yy756; if (yych == 'x') - goto yy849; + goto yy756; } - yy846: + yy753: p = marker; - goto yy843; - yy847: + goto yy751; + yy754: yych = *++p; if (yych <= '@') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy850; - goto yy846; + goto yy757; + goto yy753; } else { if (yych <= 'Z') - goto yy850; + goto yy757; if (yych <= '`') - goto yy846; + goto yy753; if (yych <= 'z') - goto yy850; - goto yy846; + goto yy757; + goto yy753; } - yy848: + yy755: yych = *++p; if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy851; + goto yy758; if (yych == ';') - goto yy852; - goto yy846; - yy849: + goto yy759; + goto yy753; + yy756: yych = *++p; if (yych <= '@') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy854; - goto yy846; + goto yy760; + goto yy753; } else { if (yych <= 'F') - goto yy854; + goto yy760; if (yych <= '`') - goto yy846; + goto yy753; if (yych <= 'f') - goto yy854; - goto yy846; + goto yy760; + goto yy753; } - yy850: + yy757: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy855; + goto yy761; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; - goto yy855; + goto yy753; + goto yy761; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych <= 'z') - goto yy855; - goto yy846; + goto yy761; + goto yy753; } } - yy851: + yy758: yych = *++p; if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy856; + goto yy762; if (yych != ';') - goto yy846; - yy852: + goto yy753; + yy759: ++p; { return (bufsize_t)(p - start); } - yy854: + yy760: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy857; + goto yy763; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'F') { if (yych <= '@') - goto yy846; - goto yy857; + goto yy753; + goto yy763; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych <= 'f') - goto yy857; - goto yy846; + goto yy763; + goto yy753; } } - yy855: + yy761: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy858; + goto yy764; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; - goto yy858; + goto yy753; + goto yy764; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych <= 'z') - goto yy858; - goto yy846; + goto yy764; + goto yy753; } } - yy856: + yy762: yych = *++p; if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy859; + goto yy765; if (yych == ';') - goto yy852; - goto yy846; - yy857: + goto yy759; + goto yy753; + yy763: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy860; + goto yy766; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'F') { if (yych <= '@') - goto yy846; - goto yy860; + goto yy753; + goto yy766; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych <= 'f') - goto yy860; - goto yy846; + goto yy766; + goto yy753; } } - yy858: + yy764: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy861; + goto yy767; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; - goto yy861; + goto yy753; + goto yy767; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych <= 'z') - goto yy861; - goto yy846; + goto yy767; + goto yy753; } } - yy859: + yy765: yych = *++p; if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy862; + goto yy768; if (yych == ';') - goto yy852; - goto yy846; - yy860: + goto yy759; + goto yy753; + yy766: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy863; + goto yy769; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'F') { if (yych <= '@') - goto yy846; - goto yy863; + goto yy753; + goto yy769; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych <= 'f') - goto yy863; - goto yy846; + goto yy769; + goto yy753; } } - yy861: + yy767: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy864; + goto yy770; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; - goto yy864; + goto yy753; + goto yy770; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych <= 'z') - goto yy864; - goto yy846; + goto yy770; + goto yy753; } } - yy862: + yy768: yych = *++p; if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy865; + goto yy771; if (yych == ';') - goto yy852; - goto yy846; - yy863: + goto yy759; + goto yy753; + yy769: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy866; + goto yy772; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'F') { if (yych <= '@') - goto yy846; - goto yy866; + goto yy753; + goto yy772; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych <= 'f') - goto yy866; - goto yy846; + goto yy772; + goto yy753; } } - yy864: + yy770: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy867; + goto yy773; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; - goto yy867; + goto yy753; + goto yy773; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych <= 'z') - goto yy867; - goto yy846; + goto yy773; + goto yy753; } } - yy865: + yy771: yych = *++p; if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy868; + goto yy774; if (yych == ';') - goto yy852; - goto yy846; - yy866: + goto yy759; + goto yy753; + yy772: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy868; + goto yy774; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'F') { if (yych <= '@') - goto yy846; - goto yy868; + goto yy753; + goto yy774; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych <= 'f') - goto yy868; - goto yy846; + goto yy774; + goto yy753; } } - yy867: + yy773: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy869; + goto yy775; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; - goto yy869; + goto yy753; + goto yy775; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych <= 'z') - goto yy869; - goto yy846; + goto yy775; + goto yy753; } } - yy868: + yy774: yych = *++p; if (yych == ';') - goto yy852; - goto yy846; - yy869: + goto yy759; + goto yy753; + yy775: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy870; + goto yy776; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; + goto yy753; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych >= '{') - goto yy846; + goto yy753; } } - yy870: + yy776: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy871; + goto yy777; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; + goto yy753; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych >= '{') - goto yy846; + goto yy753; } } - yy871: + yy777: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy872; + goto yy778; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; + goto yy753; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych >= '{') - goto yy846; + goto yy753; } } - yy872: + yy778: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy873; + goto yy779; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; + goto yy753; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych >= '{') - goto yy846; + goto yy753; } } - yy873: + yy779: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy874; + goto yy780; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; + goto yy753; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych >= '{') - goto yy846; + goto yy753; } } - yy874: + yy780: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy875; + goto yy781; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; + goto yy753; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych >= '{') - goto yy846; + goto yy753; } } - yy875: + yy781: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy876; + goto yy782; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; + goto yy753; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych >= '{') - goto yy846; + goto yy753; } } - yy876: + yy782: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy877; + goto yy783; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; + goto yy753; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych >= '{') - goto yy846; + goto yy753; } } - yy877: + yy783: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy878; + goto yy784; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; + goto yy753; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych >= '{') - goto yy846; + goto yy753; } } - yy878: + yy784: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy879; + goto yy785; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; + goto yy753; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych >= '{') - goto yy846; + goto yy753; } } - yy879: + yy785: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy880; + goto yy786; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; + goto yy753; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych >= '{') - goto yy846; + goto yy753; } } - yy880: + yy786: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy881; + goto yy787; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; + goto yy753; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych >= '{') - goto yy846; + goto yy753; } } - yy881: + yy787: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy882; + goto yy788; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; + goto yy753; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych >= '{') - goto yy846; + goto yy753; } } - yy882: + yy788: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy883; + goto yy789; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; + goto yy753; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych >= '{') - goto yy846; + goto yy753; } } - yy883: + yy789: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy884; + goto yy790; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; + goto yy753; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych >= '{') - goto yy846; + goto yy753; } } - yy884: + yy790: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy885; + goto yy791; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; + goto yy753; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych >= '{') - goto yy846; + goto yy753; } } - yy885: + yy791: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy886; + goto yy792; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; + goto yy753; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych >= '{') - goto yy846; + goto yy753; } } - yy886: + yy792: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy887; + goto yy793; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; + goto yy753; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych >= '{') - goto yy846; + goto yy753; } } - yy887: + yy793: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy888; + goto yy794; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; + goto yy753; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych >= '{') - goto yy846; + goto yy753; } } - yy888: + yy794: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy889; + goto yy795; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; + goto yy753; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych >= '{') - goto yy846; + goto yy753; } } - yy889: + yy795: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy890; + goto yy796; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; + goto yy753; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych >= '{') - goto yy846; + goto yy753; } } - yy890: + yy796: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy891; + goto yy797; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; + goto yy753; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych >= '{') - goto yy846; + goto yy753; } } - yy891: + yy797: yych = *++p; if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy892; + goto yy798; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; + goto yy753; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych >= '{') - goto yy846; + goto yy753; } } - yy892: - ++p; - if ((yych = *p) <= ';') { + yy798: + yych = *++p; + if (yych <= ';') { if (yych <= '/') - goto yy846; + goto yy753; if (yych <= '9') - goto yy868; + goto yy774; if (yych <= ':') - goto yy846; - goto yy852; + goto yy753; + goto yy759; } else { if (yych <= 'Z') { if (yych <= '@') - goto yy846; - goto yy868; + goto yy753; + goto yy774; } else { if (yych <= '`') - goto yy846; + goto yy753; if (yych <= 'z') - goto yy868; - goto yy846; + goto yy774; + goto yy753; } } } @@ -13484,304 +13616,441 @@ bufsize_t _scan_dangerous_url(const unsigned char *p) { if (yych <= 'V') { if (yych <= 'F') { if (yych == 'D') - goto yy897; + goto yy801; if (yych >= 'F') - goto yy898; + goto yy802; } else { if (yych == 'J') - goto yy899; + goto yy803; if (yych >= 'V') - goto yy900; + goto yy804; } } else { if (yych <= 'f') { if (yych == 'd') - goto yy897; + goto yy801; if (yych >= 'f') - goto yy898; + goto yy802; } else { if (yych <= 'j') { if (yych >= 'j') - goto yy899; + goto yy803; } else { if (yych == 'v') - goto yy900; + goto yy804; } } } ++p; - yy896 : { return 0; } - yy897: + yy800 : { return 0; } + yy801: yyaccept = 0; yych = *(marker = ++p); if (yych == 'A') - goto yy901; + goto yy805; if (yych == 'a') - goto yy901; - goto yy896; - yy898: + goto yy805; + goto yy800; + yy802: yyaccept = 0; yych = *(marker = ++p); if (yych == 'I') - goto yy903; + goto yy807; if (yych == 'i') - goto yy903; - goto yy896; - yy899: + goto yy807; + goto yy800; + yy803: yyaccept = 0; yych = *(marker = ++p); if (yych == 'A') - goto yy904; + goto yy808; if (yych == 'a') - goto yy904; - goto yy896; - yy900: + goto yy808; + goto yy800; + yy804: yyaccept = 0; yych = *(marker = ++p); if (yych == 'B') - goto yy905; + goto yy809; if (yych == 'b') - goto yy905; - goto yy896; - yy901: + goto yy809; + goto yy800; + yy805: yych = *++p; if (yych == 'T') - goto yy906; + goto yy810; if (yych == 't') - goto yy906; - yy902: + goto yy810; + yy806: p = marker; if (yyaccept == 0) { - goto yy896; + goto yy800; } else { - goto yy914; + goto yy818; } - yy903: + yy807: yych = *++p; if (yych == 'L') - goto yy907; + goto yy811; if (yych == 'l') - goto yy907; - goto yy902; - yy904: + goto yy811; + goto yy806; + yy808: yych = *++p; if (yych == 'V') - goto yy908; + goto yy812; if (yych == 'v') - goto yy908; - goto yy902; - yy905: + goto yy812; + goto yy806; + yy809: yych = *++p; if (yych == 'S') - goto yy909; + goto yy813; if (yych == 's') - goto yy909; - goto yy902; - yy906: + goto yy813; + goto yy806; + yy810: yych = *++p; if (yych == 'A') - goto yy910; + goto yy814; if (yych == 'a') - goto yy910; - goto yy902; - yy907: + goto yy814; + goto yy806; + yy811: yych = *++p; if (yych == 'E') - goto yy911; + goto yy815; if (yych == 'e') - goto yy911; - goto yy902; - yy908: + goto yy815; + goto yy806; + yy812: yych = *++p; if (yych == 'A') - goto yy905; + goto yy809; if (yych == 'a') - goto yy905; - goto yy902; - yy909: + goto yy809; + goto yy806; + yy813: yych = *++p; if (yych == 'C') - goto yy912; + goto yy816; if (yych == 'c') - goto yy912; - goto yy902; - yy910: + goto yy816; + goto yy806; + yy814: yych = *++p; if (yych == ':') - goto yy913; - goto yy902; - yy911: + goto yy817; + goto yy806; + yy815: yych = *++p; if (yych == ':') - goto yy915; - goto yy902; - yy912: + goto yy819; + goto yy806; + yy816: yych = *++p; if (yych == 'R') - goto yy916; + goto yy820; if (yych == 'r') - goto yy916; - goto yy902; - yy913: + goto yy820; + goto yy806; + yy817: yyaccept = 1; yych = *(marker = ++p); if (yych == 'I') - goto yy917; + goto yy821; if (yych == 'i') - goto yy917; - yy914 : { return (bufsize_t)(p - start); } - yy915: - yych = *++p; - goto yy914; - yy916: + goto yy821; + yy818 : { return (bufsize_t)(p - start); } + yy819: + ++p; + goto yy818; + yy820: yych = *++p; if (yych == 'I') - goto yy918; + goto yy822; if (yych == 'i') - goto yy918; - goto yy902; - yy917: + goto yy822; + goto yy806; + yy821: yych = *++p; if (yych == 'M') - goto yy919; + goto yy823; if (yych == 'm') - goto yy919; - goto yy902; - yy918: + goto yy823; + goto yy806; + yy822: yych = *++p; if (yych == 'P') - goto yy920; + goto yy824; if (yych == 'p') - goto yy920; - goto yy902; - yy919: + goto yy824; + goto yy806; + yy823: yych = *++p; if (yych == 'A') - goto yy921; + goto yy825; if (yych == 'a') - goto yy921; - goto yy902; - yy920: + goto yy825; + goto yy806; + yy824: yych = *++p; if (yych == 'T') - goto yy911; + goto yy815; if (yych == 't') - goto yy911; - goto yy902; - yy921: + goto yy815; + goto yy806; + yy825: yych = *++p; if (yych == 'G') - goto yy922; + goto yy826; if (yych != 'g') - goto yy902; - yy922: + goto yy806; + yy826: yych = *++p; if (yych == 'E') - goto yy923; + goto yy827; if (yych != 'e') - goto yy902; - yy923: + goto yy806; + yy827: yych = *++p; if (yych != '/') - goto yy902; + goto yy806; yych = *++p; if (yych <= 'W') { if (yych <= 'J') { if (yych == 'G') - goto yy925; + goto yy828; if (yych <= 'I') - goto yy902; - goto yy926; + goto yy806; + goto yy829; } else { if (yych == 'P') - goto yy927; + goto yy830; if (yych <= 'V') - goto yy902; - goto yy928; + goto yy806; + goto yy831; } } else { if (yych <= 'j') { if (yych == 'g') - goto yy925; + goto yy828; if (yych <= 'i') - goto yy902; - goto yy926; + goto yy806; + goto yy829; } else { if (yych <= 'p') { if (yych <= 'o') - goto yy902; - goto yy927; + goto yy806; + goto yy830; } else { if (yych == 'w') - goto yy928; - goto yy902; + goto yy831; + goto yy806; } } } - yy925: + yy828: yych = *++p; if (yych == 'I') - goto yy929; + goto yy832; if (yych == 'i') - goto yy929; - goto yy902; - yy926: + goto yy832; + goto yy806; + yy829: yych = *++p; if (yych == 'P') - goto yy930; + goto yy833; if (yych == 'p') - goto yy930; - goto yy902; - yy927: + goto yy833; + goto yy806; + yy830: yych = *++p; if (yych == 'N') - goto yy931; + goto yy834; if (yych == 'n') - goto yy931; - goto yy902; - yy928: + goto yy834; + goto yy806; + yy831: yych = *++p; if (yych == 'E') - goto yy932; + goto yy835; if (yych == 'e') - goto yy932; - goto yy902; - yy929: + goto yy835; + goto yy806; + yy832: yych = *++p; if (yych == 'F') - goto yy933; + goto yy836; if (yych == 'f') - goto yy933; - goto yy902; - yy930: + goto yy836; + goto yy806; + yy833: yych = *++p; if (yych == 'E') - goto yy931; + goto yy834; if (yych != 'e') - goto yy902; - yy931: + goto yy806; + yy834: yych = *++p; if (yych == 'G') - goto yy933; + goto yy836; if (yych == 'g') - goto yy933; - goto yy902; - yy932: + goto yy836; + goto yy806; + yy835: yych = *++p; if (yych == 'B') - goto yy935; + goto yy837; if (yych == 'b') - goto yy935; - goto yy902; - yy933: + goto yy837; + goto yy806; + yy836: ++p; { return 0; } - yy935: - ++p; - if ((yych = *p) == 'P') - goto yy933; + yy837: + yych = *++p; + if (yych == 'P') + goto yy836; if (yych == 'p') - goto yy933; - goto yy902; + goto yy836; + goto yy806; + } +} + +// Scans a footnote definition opening. +bufsize_t _scan_footnote_definition(const unsigned char *p) { + const unsigned char *marker = NULL; + const unsigned char *start = p; + + { + unsigned char yych; + static const unsigned char yybm[] = { + 0, 64, 64, 64, 64, 64, 64, 64, 64, 128, 0, 64, 64, 0, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 128, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 0, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }; + yych = *p; + if (yych == '[') + goto yy840; + ++p; + yy839 : { return 0; } + yy840: + yych = *(marker = ++p); + if (yych != '^') + goto yy839; + yych = *++p; + if (yych != ']') + goto yy843; + yy841: + p = marker; + goto yy839; + yy842: + yych = *++p; + yy843: + if (yybm[0 + yych] & 64) { + goto yy842; + } + if (yych <= 0xEC) { + if (yych <= 0xC1) { + if (yych <= ' ') + goto yy841; + if (yych <= ']') + goto yy851; + goto yy841; + } else { + if (yych <= 0xDF) + goto yy844; + if (yych <= 0xE0) + goto yy845; + goto yy846; + } + } else { + if (yych <= 0xF0) { + if (yych <= 0xED) + goto yy847; + if (yych <= 0xEF) + goto yy846; + goto yy848; + } else { + if (yych <= 0xF3) + goto yy849; + if (yych <= 0xF4) + goto yy850; + goto yy841; + } + } + yy844: + yych = *++p; + if (yych <= 0x7F) + goto yy841; + if (yych <= 0xBF) + goto yy842; + goto yy841; + yy845: + yych = *++p; + if (yych <= 0x9F) + goto yy841; + if (yych <= 0xBF) + goto yy844; + goto yy841; + yy846: + yych = *++p; + if (yych <= 0x7F) + goto yy841; + if (yych <= 0xBF) + goto yy844; + goto yy841; + yy847: + yych = *++p; + if (yych <= 0x7F) + goto yy841; + if (yych <= 0x9F) + goto yy844; + goto yy841; + yy848: + yych = *++p; + if (yych <= 0x8F) + goto yy841; + if (yych <= 0xBF) + goto yy846; + goto yy841; + yy849: + yych = *++p; + if (yych <= 0x7F) + goto yy841; + if (yych <= 0xBF) + goto yy846; + goto yy841; + yy850: + yych = *++p; + if (yych <= 0x7F) + goto yy841; + if (yych <= 0x8F) + goto yy846; + goto yy841; + yy851: + yych = *++p; + if (yych != ':') + goto yy841; + yy852: + yych = *++p; + if (yybm[0 + yych] & 128) { + goto yy852; + } + { return (bufsize_t)(p - start); } } } diff --git a/liteidex/src/3rdparty/cmark/src/scanners.h b/liteidex/src/3rdparty/cmark/src/scanners.h old mode 100755 new mode 100644 index bcb5fe8c3..7e6a10aeb --- a/liteidex/src/3rdparty/cmark/src/scanners.h +++ b/liteidex/src/3rdparty/cmark/src/scanners.h @@ -1,4 +1,7 @@ -#include "cmark.h" +#ifndef CMARK_SCANNERS_H +#define CMARK_SCANNERS_H + +#include "cmark-gfm.h" #include "chunk.h" #ifdef __cplusplus @@ -11,6 +14,11 @@ bufsize_t _scan_scheme(const unsigned char *p); bufsize_t _scan_autolink_uri(const unsigned char *p); bufsize_t _scan_autolink_email(const unsigned char *p); bufsize_t _scan_html_tag(const unsigned char *p); +bufsize_t _scan_liberal_html_tag(const unsigned char *p); +bufsize_t _scan_html_comment(const unsigned char *p); +bufsize_t _scan_html_pi(const unsigned char *p); +bufsize_t _scan_html_declaration(const unsigned char *p); +bufsize_t _scan_html_cdata(const unsigned char *p); bufsize_t _scan_html_block_start(const unsigned char *p); bufsize_t _scan_html_block_start_7(const unsigned char *p); bufsize_t _scan_html_block_end_1(const unsigned char *p); @@ -26,11 +34,17 @@ bufsize_t _scan_open_code_fence(const unsigned char *p); bufsize_t _scan_close_code_fence(const unsigned char *p); bufsize_t _scan_entity(const unsigned char *p); bufsize_t _scan_dangerous_url(const unsigned char *p); +bufsize_t _scan_footnote_definition(const unsigned char *p); #define scan_scheme(c, n) _scan_at(&_scan_scheme, c, n) #define scan_autolink_uri(c, n) _scan_at(&_scan_autolink_uri, c, n) #define scan_autolink_email(c, n) _scan_at(&_scan_autolink_email, c, n) #define scan_html_tag(c, n) _scan_at(&_scan_html_tag, c, n) +#define scan_liberal_html_tag(c, n) _scan_at(&_scan_liberal_html_tag, c, n) +#define scan_html_comment(c, n) _scan_at(&_scan_html_comment, c, n) +#define scan_html_pi(c, n) _scan_at(&_scan_html_pi, c, n) +#define scan_html_declaration(c, n) _scan_at(&_scan_html_declaration, c, n) +#define scan_html_cdata(c, n) _scan_at(&_scan_html_cdata, c, n) #define scan_html_block_start(c, n) _scan_at(&_scan_html_block_start, c, n) #define scan_html_block_start_7(c, n) _scan_at(&_scan_html_block_start_7, c, n) #define scan_html_block_end_1(c, n) _scan_at(&_scan_html_block_end_1, c, n) @@ -47,7 +61,10 @@ bufsize_t _scan_dangerous_url(const unsigned char *p); #define scan_close_code_fence(c, n) _scan_at(&_scan_close_code_fence, c, n) #define scan_entity(c, n) _scan_at(&_scan_entity, c, n) #define scan_dangerous_url(c, n) _scan_at(&_scan_dangerous_url, c, n) +#define scan_footnote_definition(c, n) _scan_at(&_scan_footnote_definition, c, n) #ifdef __cplusplus } #endif + +#endif diff --git a/liteidex/src/3rdparty/cmark/src/scanners.re b/liteidex/src/3rdparty/cmark/src/scanners.re deleted file mode 100755 index 447147b4b..000000000 --- a/liteidex/src/3rdparty/cmark/src/scanners.re +++ /dev/null @@ -1,305 +0,0 @@ -#include -#include "chunk.h" -#include "scanners.h" - -bufsize_t _scan_at(bufsize_t (*scanner)(const unsigned char *), cmark_chunk *c, bufsize_t offset) -{ - bufsize_t res; - unsigned char *ptr = (unsigned char *)c->data; - - if (ptr == NULL || offset > c->len) { - return 0; - } else { - unsigned char lim = ptr[c->len]; - - ptr[c->len] = '\0'; - res = scanner(ptr + offset); - ptr[c->len] = lim; - } - - return res; -} - -/*!re2c - re2c:define:YYCTYPE = "unsigned char"; - re2c:define:YYCURSOR = p; - re2c:define:YYMARKER = marker; - re2c:define:YYCTXMARKER = marker; - re2c:yyfill:enable = 0; - - wordchar = [^\x00-\x20]; - - spacechar = [ \t\v\f\r\n]; - - reg_char = [^\\()\x00-\x20]; - - escaped_char = [\\][!"#$%&'()*+,./:;<=>?@[\\\]^_`{|}~-]; - - tagname = [A-Za-z][A-Za-z0-9-]*; - - blocktagname = 'address'|'article'|'aside'|'base'|'basefont'|'blockquote'|'body'|'caption'|'center'|'col'|'colgroup'|'dd'|'details'|'dialog'|'dir'|'div'|'dl'|'dt'|'fieldset'|'figcaption'|'figure'|'footer'|'form'|'frame'|'frameset'|'h1'|'h2'|'h3'|'h4'|'h5'|'h6'|'head'|'header'|'hr'|'html'|'iframe'|'legend'|'li'|'link'|'main'|'menu'|'menuitem'|'nav'|'noframes'|'ol'|'optgroup'|'option'|'p'|'param'|'section'|'source'|'title'|'summary'|'table'|'tbody'|'td'|'tfoot'|'th'|'thead'|'title'|'tr'|'track'|'ul'; - - attributename = [a-zA-Z_:][a-zA-Z0-9:._-]*; - - unquotedvalue = [^ \t\r\n\v\f"'=<>`\x00]+; - singlequotedvalue = ['][^'\x00]*[']; - doublequotedvalue = ["][^"\x00]*["]; - - attributevalue = unquotedvalue | singlequotedvalue | doublequotedvalue; - - attributevaluespec = spacechar* [=] spacechar* attributevalue; - - attribute = spacechar+ attributename attributevaluespec?; - - opentag = tagname attribute* spacechar* [/]? [>]; - closetag = [/] tagname spacechar* [>]; - - htmlcomment = "!---->" | ("!--" ([-]? [^\x00>-]) ([-]? [^\x00-])* "-->"); - - processinginstruction = "?" ([^?>\x00]+ | [?][^>\x00] | [>])* "?>"; - - declaration = "!" [A-Z]+ spacechar+ [^>\x00]* ">"; - - cdata = "![CDATA[" ([^\]\x00]+ | "]" [^\]\x00] | "]]" [^>\x00])* "]]>"; - - htmltag = opentag | closetag | htmlcomment | processinginstruction | - declaration | cdata; - - in_parens_nosp = [(] (reg_char|escaped_char|[\\])* [)]; - - in_double_quotes = ["] (escaped_char|[^"\x00])* ["]; - in_single_quotes = ['] (escaped_char|[^'\x00])* [']; - in_parens = [(] (escaped_char|[^)\x00])* [)]; - - scheme = [A-Za-z][A-Za-z0-9.+-]{1,31}; -*/ - -// Try to match a scheme including colon. -bufsize_t _scan_scheme(const unsigned char *p) -{ - const unsigned char *marker = NULL; - const unsigned char *start = p; -/*!re2c - scheme [:] { return (bufsize_t)(p - start); } - * { return 0; } -*/ -} - -// Try to match URI autolink after first <, returning number of chars matched. -bufsize_t _scan_autolink_uri(const unsigned char *p) -{ - const unsigned char *marker = NULL; - const unsigned char *start = p; -/*!re2c - scheme [:][^\x00-\x20<>]*[>] { return (bufsize_t)(p - start); } - * { return 0; } -*/ -} - -// Try to match email autolink after first <, returning num of chars matched. -bufsize_t _scan_autolink_email(const unsigned char *p) -{ - const unsigned char *marker = NULL; - const unsigned char *start = p; -/*!re2c - [a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+ - [@] - [a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])? - ([.][a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)* - [>] { return (bufsize_t)(p - start); } - * { return 0; } -*/ -} - -// Try to match an HTML tag after first <, returning num of chars matched. -bufsize_t _scan_html_tag(const unsigned char *p) -{ - const unsigned char *marker = NULL; - const unsigned char *start = p; -/*!re2c - htmltag { return (bufsize_t)(p - start); } - * { return 0; } -*/ -} - -// Try to match an HTML block tag start line, returning -// an integer code for the type of block (1-6, matching the spec). -// #7 is handled by a separate function, below. -bufsize_t _scan_html_block_start(const unsigned char *p) -{ - const unsigned char *marker = NULL; -/*!re2c - [<] ('script'|'pre'|'style') (spacechar | [>]) { return 1; } - '' { return (bufsize_t)(p - start); } - * { return 0; } -*/ -} - -// Try to match an HTML block end line of type 3 -bufsize_t _scan_html_block_end_3(const unsigned char *p) -{ - const unsigned char *marker = NULL; - const unsigned char *start = p; -/*!re2c - [^\n\x00]* '?>' { return (bufsize_t)(p - start); } - * { return 0; } -*/ -} - -// Try to match an HTML block end line of type 4 -bufsize_t _scan_html_block_end_4(const unsigned char *p) -{ - const unsigned char *marker = NULL; - const unsigned char *start = p; -/*!re2c - [^\n\x00]* '>' { return (bufsize_t)(p - start); } - * { return 0; } -*/ -} - -// Try to match an HTML block end line of type 5 -bufsize_t _scan_html_block_end_5(const unsigned char *p) -{ - const unsigned char *marker = NULL; - const unsigned char *start = p; -/*!re2c - [^\n\x00]* ']]>' { return (bufsize_t)(p - start); } - * { return 0; } -*/ -} - -// Try to match a link title (in single quotes, in double quotes, or -// in parentheses), returning number of chars matched. Allow one -// level of internal nesting (quotes within quotes). -bufsize_t _scan_link_title(const unsigned char *p) -{ - const unsigned char *marker = NULL; - const unsigned char *start = p; -/*!re2c - ["] (escaped_char|[^"\x00])* ["] { return (bufsize_t)(p - start); } - ['] (escaped_char|[^'\x00])* ['] { return (bufsize_t)(p - start); } - [(] (escaped_char|[^()\x00])* [)] { return (bufsize_t)(p - start); } - * { return 0; } -*/ -} - -// Match space characters, including newlines. -bufsize_t _scan_spacechars(const unsigned char *p) -{ - const unsigned char *start = p; \ -/*!re2c - [ \t\v\f\r\n]+ { return (bufsize_t)(p - start); } - * { return 0; } -*/ -} - -// Match ATX heading start. -bufsize_t _scan_atx_heading_start(const unsigned char *p) -{ - const unsigned char *marker = NULL; - const unsigned char *start = p; -/*!re2c - [#]{1,6} ([ \t]+|[\r\n]) { return (bufsize_t)(p - start); } - * { return 0; } -*/ -} - -// Match setext heading line. Return 1 for level-1 heading, -// 2 for level-2, 0 for no match. -bufsize_t _scan_setext_heading_line(const unsigned char *p) -{ - const unsigned char *marker = NULL; -/*!re2c - [=]+ [ \t]* [\r\n] { return 1; } - [-]+ [ \t]* [\r\n] { return 2; } - * { return 0; } -*/ -} - -// Scan an opening code fence. -bufsize_t _scan_open_code_fence(const unsigned char *p) -{ - const unsigned char *marker = NULL; - const unsigned char *start = p; -/*!re2c - [`]{3,} / [^`\r\n\x00]*[\r\n] { return (bufsize_t)(p - start); } - [~]{3,} / [^\r\n\x00]*[\r\n] { return (bufsize_t)(p - start); } - * { return 0; } -*/ -} - -// Scan a closing code fence with length at least len. -bufsize_t _scan_close_code_fence(const unsigned char *p) -{ - const unsigned char *marker = NULL; - const unsigned char *start = p; -/*!re2c - [`]{3,} / [ \t]*[\r\n] { return (bufsize_t)(p - start); } - [~]{3,} / [ \t]*[\r\n] { return (bufsize_t)(p - start); } - * { return 0; } -*/ -} - -// Scans an entity. -// Returns number of chars matched. -bufsize_t _scan_entity(const unsigned char *p) -{ - const unsigned char *marker = NULL; - const unsigned char *start = p; -/*!re2c - [&] ([#] ([Xx][A-Fa-f0-9]{1,6}|[0-9]{1,7}) |[A-Za-z][A-Za-z0-9]{1,31} ) [;] - { return (bufsize_t)(p - start); } - * { return 0; } -*/ -} - -// Returns positive value if a URL begins in a way that is potentially -// dangerous, with javascript:, vbscript:, file:, or data:, otherwise 0. -bufsize_t _scan_dangerous_url(const unsigned char *p) -{ - const unsigned char *marker = NULL; - const unsigned char *start = p; -/*!re2c - 'data:image/' ('png'|'gif'|'jpeg'|'webp') { return 0; } - 'javascript:' | 'vbscript:' | 'file:' | 'data:' { return (bufsize_t)(p - start); } - * { return 0; } -*/ -} - diff --git a/liteidex/src/3rdparty/cmark/src/syntax_extension.c b/liteidex/src/3rdparty/cmark/src/syntax_extension.c new file mode 100644 index 000000000..d24fe43e6 --- /dev/null +++ b/liteidex/src/3rdparty/cmark/src/syntax_extension.c @@ -0,0 +1,149 @@ +#include +#include + +#include "cmark-gfm.h" +#include "syntax_extension.h" +#include "buffer.h" + +extern cmark_mem CMARK_DEFAULT_MEM_ALLOCATOR; + +static cmark_mem *_mem = &CMARK_DEFAULT_MEM_ALLOCATOR; + +void cmark_syntax_extension_free(cmark_mem *mem, cmark_syntax_extension *extension) { + if (extension->free_function && extension->priv) { + extension->free_function(mem, extension->priv); + } + + cmark_llist_free(mem, extension->special_inline_chars); + mem->free(extension->name); + mem->free(extension); +} + +cmark_syntax_extension *cmark_syntax_extension_new(const char *name) { + cmark_syntax_extension *res = (cmark_syntax_extension *) _mem->calloc(1, sizeof(cmark_syntax_extension)); + res->name = (char *) _mem->calloc(1, sizeof(char) * (strlen(name)) + 1); + strcpy(res->name, name); + return res; +} + +cmark_node_type cmark_syntax_extension_add_node(int is_inline) { + cmark_node_type *ref = !is_inline ? &CMARK_NODE_LAST_BLOCK : &CMARK_NODE_LAST_INLINE; + + if ((*ref & CMARK_NODE_VALUE_MASK) == CMARK_NODE_VALUE_MASK) { + assert(false); + return (cmark_node_type) 0; + } + + return *ref = (cmark_node_type) ((int) *ref + 1); +} + +void cmark_syntax_extension_set_emphasis(cmark_syntax_extension *extension, + int emphasis) { + extension->emphasis = emphasis == 1; +} + +void cmark_syntax_extension_set_open_block_func(cmark_syntax_extension *extension, + cmark_open_block_func func) { + extension->try_opening_block = func; +} + +void cmark_syntax_extension_set_match_block_func(cmark_syntax_extension *extension, + cmark_match_block_func func) { + extension->last_block_matches = func; +} + +void cmark_syntax_extension_set_match_inline_func(cmark_syntax_extension *extension, + cmark_match_inline_func func) { + extension->match_inline = func; +} + +void cmark_syntax_extension_set_inline_from_delim_func(cmark_syntax_extension *extension, + cmark_inline_from_delim_func func) { + extension->insert_inline_from_delim = func; +} + +void cmark_syntax_extension_set_special_inline_chars(cmark_syntax_extension *extension, + cmark_llist *special_chars) { + extension->special_inline_chars = special_chars; +} + +void cmark_syntax_extension_set_get_type_string_func(cmark_syntax_extension *extension, + cmark_get_type_string_func func) { + extension->get_type_string_func = func; +} + +void cmark_syntax_extension_set_can_contain_func(cmark_syntax_extension *extension, + cmark_can_contain_func func) { + extension->can_contain_func = func; +} + +void cmark_syntax_extension_set_contains_inlines_func(cmark_syntax_extension *extension, + cmark_contains_inlines_func func) { + extension->contains_inlines_func = func; +} + +void cmark_syntax_extension_set_commonmark_render_func(cmark_syntax_extension *extension, + cmark_common_render_func func) { + extension->commonmark_render_func = func; +} + +void cmark_syntax_extension_set_plaintext_render_func(cmark_syntax_extension *extension, + cmark_common_render_func func) { + extension->plaintext_render_func = func; +} + +void cmark_syntax_extension_set_latex_render_func(cmark_syntax_extension *extension, + cmark_common_render_func func) { + extension->latex_render_func = func; +} + +void cmark_syntax_extension_set_xml_attr_func(cmark_syntax_extension *extension, + cmark_xml_attr_func func) { + extension->xml_attr_func = func; +} + +void cmark_syntax_extension_set_man_render_func(cmark_syntax_extension *extension, + cmark_common_render_func func) { + extension->man_render_func = func; +} + +void cmark_syntax_extension_set_html_render_func(cmark_syntax_extension *extension, + cmark_html_render_func func) { + extension->html_render_func = func; +} + +void cmark_syntax_extension_set_html_filter_func(cmark_syntax_extension *extension, + cmark_html_filter_func func) { + extension->html_filter_func = func; +} + +void cmark_syntax_extension_set_postprocess_func(cmark_syntax_extension *extension, + cmark_postprocess_func func) { + extension->postprocess_func = func; +} + +void cmark_syntax_extension_set_private(cmark_syntax_extension *extension, + void *priv, + cmark_free_func free_func) { + extension->priv = priv; + extension->free_function = free_func; +} + +void *cmark_syntax_extension_get_private(cmark_syntax_extension *extension) { + return extension->priv; +} + +void cmark_syntax_extension_set_opaque_alloc_func(cmark_syntax_extension *extension, + cmark_opaque_alloc_func func) { + extension->opaque_alloc_func = func; +} + +void cmark_syntax_extension_set_opaque_free_func(cmark_syntax_extension *extension, + cmark_opaque_free_func func) { + extension->opaque_free_func = func; +} + +void cmark_syntax_extension_set_commonmark_escape_func(cmark_syntax_extension *extension, + cmark_commonmark_escape_func func) { + extension->commonmark_escape_func = func; +} diff --git a/liteidex/src/3rdparty/cmark/src/syntax_extension.h b/liteidex/src/3rdparty/cmark/src/syntax_extension.h new file mode 100644 index 000000000..a5fe11e57 --- /dev/null +++ b/liteidex/src/3rdparty/cmark/src/syntax_extension.h @@ -0,0 +1,34 @@ +#ifndef CMARK_SYNTAX_EXTENSION_H +#define CMARK_SYNTAX_EXTENSION_H + +#include "cmark-gfm.h" +#include "cmark-gfm-extension_api.h" +#include "config.h" + +struct cmark_syntax_extension { + cmark_match_block_func last_block_matches; + cmark_open_block_func try_opening_block; + cmark_match_inline_func match_inline; + cmark_inline_from_delim_func insert_inline_from_delim; + cmark_llist * special_inline_chars; + char * name; + void * priv; + bool emphasis; + cmark_free_func free_function; + cmark_get_type_string_func get_type_string_func; + cmark_can_contain_func can_contain_func; + cmark_contains_inlines_func contains_inlines_func; + cmark_common_render_func commonmark_render_func; + cmark_common_render_func plaintext_render_func; + cmark_common_render_func latex_render_func; + cmark_xml_attr_func xml_attr_func; + cmark_common_render_func man_render_func; + cmark_html_render_func html_render_func; + cmark_html_filter_func html_filter_func; + cmark_postprocess_func postprocess_func; + cmark_opaque_alloc_func opaque_alloc_func; + cmark_opaque_free_func opaque_free_func; + cmark_commonmark_escape_func commonmark_escape_func; +}; + +#endif diff --git a/liteidex/src/3rdparty/cmark/src/utf8.c b/liteidex/src/3rdparty/cmark/src/utf8.c old mode 100755 new mode 100644 diff --git a/liteidex/src/3rdparty/cmark/src/utf8.h b/liteidex/src/3rdparty/cmark/src/utf8.h old mode 100755 new mode 100644 index 8e45714d4..04ec1611b --- a/liteidex/src/3rdparty/cmark/src/utf8.h +++ b/liteidex/src/3rdparty/cmark/src/utf8.h @@ -8,13 +8,24 @@ extern "C" { #endif +CMARK_GFM_EXPORT void cmark_utf8proc_case_fold(cmark_strbuf *dest, const uint8_t *str, bufsize_t len); + +CMARK_GFM_EXPORT void cmark_utf8proc_encode_char(int32_t uc, cmark_strbuf *buf); + +CMARK_GFM_EXPORT int cmark_utf8proc_iterate(const uint8_t *str, bufsize_t str_len, int32_t *dst); + +CMARK_GFM_EXPORT void cmark_utf8proc_check(cmark_strbuf *dest, const uint8_t *line, bufsize_t size); + +CMARK_GFM_EXPORT int cmark_utf8proc_is_space(int32_t uc); + +CMARK_GFM_EXPORT int cmark_utf8proc_is_punctuation(int32_t uc); #ifdef __cplusplus diff --git a/liteidex/src/3rdparty/cmark/src/xml.c b/liteidex/src/3rdparty/cmark/src/xml.c old mode 100755 new mode 100644 index 48674ccb7..5753e5ab9 --- a/liteidex/src/3rdparty/cmark/src/xml.c +++ b/liteidex/src/3rdparty/cmark/src/xml.c @@ -4,12 +4,14 @@ #include #include "config.h" -#include "cmark.h" +#include "cmark-gfm.h" #include "node.h" #include "buffer.h" #include "houdini.h" +#include "syntax_extension.h" #define BUFFER_SIZE 100 +#define MAX_INDENT 40 // Functions to convert cmark_nodes to XML strings. @@ -25,7 +27,7 @@ struct render_state { static CMARK_INLINE void indent(struct render_state *state) { int i; - for (i = 0; i < state->indent; i++) { + for (i = 0; i < state->indent && i < MAX_INDENT; i++) { cmark_strbuf_putc(state->xml, ' '); } } @@ -50,6 +52,12 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type, cmark_strbuf_puts(xml, buffer); } + if (node->extension && node->extension->xml_attr_func) { + const char* r = node->extension->xml_attr_func(node->extension, node); + if (r != NULL) + cmark_strbuf_puts(xml, r); + } + literal = false; switch (node->type) { @@ -148,8 +156,12 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type, } char *cmark_render_xml(cmark_node *root, int options) { + return cmark_render_xml_with_mem(root, options, cmark_node_mem(root)); +} + +char *cmark_render_xml_with_mem(cmark_node *root, int options, cmark_mem *mem) { char *result; - cmark_strbuf xml = CMARK_BUF_INIT(cmark_node_mem(root)); + cmark_strbuf xml = CMARK_BUF_INIT(mem); cmark_event_type ev_type; cmark_node *cur; struct render_state state = {&xml, 0}; diff --git a/liteidex/src/plugins/markdown/css/textbrowser.css b/liteidex/src/plugins/markdown/css/textbrowser.css index d1b8c2feb..5856da279 100644 --- a/liteidex/src/plugins/markdown/css/textbrowser.css +++ b/liteidex/src/plugins/markdown/css/textbrowser.css @@ -65,3 +65,20 @@ dl, dd { } hr { border-style: none; border-top: 1px solid black; } + +table { + border-collapse: collapse; + margin: 16px 0; +} +table th, table td { + border: 1px solid #ddd; + padding: 6px 13px; +} +table th { + font-weight: bold; + background: #f6f8fa; +} + +del { + text-decoration: line-through; +}