From e9ec48845765e64f16442a873af971366b3df3b5 Mon Sep 17 00:00:00 2001 From: "Fletcher T. Penney" Date: Wed, 11 Dec 2019 12:20:59 -0500 Subject: [PATCH 01/17] UPDATED: Update notes source text --- DevelopmentNotes/DevelopmentNotes.txt | 85 ++++++++++++++++++++++++++- 1 file changed, 84 insertions(+), 1 deletion(-) diff --git a/DevelopmentNotes/DevelopmentNotes.txt b/DevelopmentNotes/DevelopmentNotes.txt index 64e6414e..4c45086b 100644 --- a/DevelopmentNotes/DevelopmentNotes.txt +++ b/DevelopmentNotes/DevelopmentNotes.txt @@ -1,6 +1,6 @@ Title: MultiMarkdown v6 Development Notes Author: Fletcher T. Penney -Date: 2018-09-01 +Date: 2019-12-11 LaTeX Config: tufte-handout Base Header Level: 3 uuid: dd2d8e76-dc2d-416d-9acd-5395d20871c2 @@ -472,6 +472,89 @@ TextBundle/TextPack, OpenDocument, etc. # Changelog # +* 2019-12-11 - v 6.5.0: + + * ADDED: Add ASCII case detection + * ADDED: Add conversion from ITMZ routines + * ADDED: Add support for random header labels when not manually specified (Addresses #157) + * ADDED: Add title as short caption for figures and tables to be used in list of figures and list of tables. Addresses #177 -- thanks, MArpogaus + * ADDED: Add {{TOC:1}} and {{TOC:1-2}} options + * FIXED: Add byte for null terminator when extracting from zip archive + * FIXED: Allow building libMMD has a child project for testing + * FIXED: Clean up Quick Start guide + * FIXED: Ensure newline at end of header contents when importing from OPML/ITMZ + * FIXED: Fix CMake config for MacPorts (fixes #146) + * FIXED: Fix PATH in convenience scripts + * FIXED: Fix bugs in new zip extraction code + * FIXED: Fix edge case with single item loose lists (fixes #174) + * FIXED: Fix filename + * FIXED: Fix handling of hebrew language option + * FIXED: Fix length of metadata if no trailing line ending + * FIXED: Fix letterhead reference to memoir-footer. (Fixes #143) + * FIXED: Fix memory leak (#172) -- thanks Alfons + * FIXED: Fix pointer dereference (fixes #152) + * FIXED: Fix potential bug when reading OPML/ITMZ + * FIXED: Fix potential errors related to checking for metadata + * FIXED: Fix potential issue in d_string + * FIXED: Fix potential memory address error + * FIXED: Fix prior bad edits to quick start guide + * FIXED: Fix regression + * FIXED: Fix test suite for new captions + * FIXED: Fix trim trailing whitespace + * FIXED: Fix two small potential errors + * FIXED: Fix warning + * FIXED: Fix whitespace issues with headers with manual labels + * FIXED: Improve BOM stripping + * FIXED: Improve efficiency when checking for existence of metadata + * FIXED: Include .html for EPUB and .fodt for ODT when transcluding with wildcard extension + * FIXED: Prevent line breaks in HTML/ODF attributes + * FIXED: Update Quick Start PDF + * FIXED: Update README template + * FIXED: Update re2c scanners and prevent crash on certain documents with unexpected encoding + * FIXED: Use C11 (had old C99 as well, but I suspect that wasn't actually used + * Fixes to README + * Merge branch 'develop' of github.com:fletcher/MultiMarkdown-6 into develop + * Merge branch 'release/6.4.0' into develop + * Merge pull request #144 from cdhutch/patch-3 + * Merge pull request #162 from DivineDominion/patch-1 + * Merge pull request #167 from nickasd/develop + * Revert "remove build folder" + * UPDATED: Add MARKUP token type + * UPDATED: Add OPML routines to libMultiMarkdown.h + * UPDATED: Add UTF-8 validity check function + * UPDATED: Additional README comments about Xcode + * UPDATED: Apply astyle + * UPDATED: Automatically disable libCurl on iOS + * UPDATED: Change convenience scripts for better POSIX compliance (implements #150) (Thanks, Ryan) + * UPDATED: Don't require opening in OPML + * UPDATED: Fix doxygen template + * UPDATED: Fix main() when token pools disabled + * UPDATED: Make astyle + * UPDATED: Refactor XML parsing; improve OPML reading; add ITMZ (iThoughts) reading/writing (experimental feature); a few other small tweaks + * UPDATED: Refactor header file inclusion + * UPDATED: Remove debug statement + * UPDATED: Remove i386 build architecture from default configuration + * UPDATED: Remove some old debugging statements that aren't necessary anymore + * UPDATED: Silence some Xcode warnings + * UPDATED: Silence warnings + * UPDATED: Tidy code + * UPDATED: Tweak smart quote rules to avoid false positive matches when using double quote as inches mark + * UPDATED: Update advanced headers test suite + * UPDATED: Update astyle + * UPDATED: Update astyle settings + * UPDATED: Update char.c + * UPDATED: Update cmake for xcode 11 + * UPDATED: Update d_string + * UPDATED: Update macOS deployment version to 10.6 for Mojave + * UPDATED: reduce false-positive rate of metadata where first line contains colon but metadata is not intended + * UPDATED: remove reliance on version.h when testing + * UPDATED: table id attribute should be on table not caption + * Update mmd6-letterhead-leader.tex + * add how to build Xcode framework to README + * remove build folder + * update README with instructions for Xcode + + * 2018-09-01 - v 6.4.0: * ADDED: Add ODF Header metadata and fix issue with LaTeX Header metadata From f449280da5c24f00f5faeb7a6b0da85353339d1f Mon Sep 17 00:00:00 2001 From: "Fletcher T. Penney" Date: Sun, 15 Dec 2019 18:02:09 -0500 Subject: [PATCH 02/17] FIXED: Fix name mismatch of mmd6-default-metadata (Addresses #173) --- texmf/tex/latex/mmd6/beamer/mmd6-beamer-begin.tex | 2 +- texmf/tex/latex/mmd6/beamer/mmd6-beamer-leader.tex | 2 +- texmf/tex/latex/mmd6/letterhead/mmd6-letterhead-begin.tex | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/texmf/tex/latex/mmd6/beamer/mmd6-beamer-begin.tex b/texmf/tex/latex/mmd6/beamer/mmd6-beamer-begin.tex index 2860c500..ec0eb68a 100644 --- a/texmf/tex/latex/mmd6/beamer/mmd6-beamer-begin.tex +++ b/texmf/tex/latex/mmd6/beamer/mmd6-beamer-begin.tex @@ -28,7 +28,7 @@ \fi -%\input{mmd-title} +%\input{mmd6-title} % Show "current/total" slide counter in footer \title[\mytitle\hspace{2em}\insertframenumber/ diff --git a/texmf/tex/latex/mmd6/beamer/mmd6-beamer-leader.tex b/texmf/tex/latex/mmd6/beamer/mmd6-beamer-leader.tex index 12003fcf..81e41235 100644 --- a/texmf/tex/latex/mmd6/beamer/mmd6-beamer-leader.tex +++ b/texmf/tex/latex/mmd6/beamer/mmd6-beamer-leader.tex @@ -32,7 +32,7 @@ % Configure default metadata -\input{mmd-default-metadata} +\input{mmd6-default-metadata} \AtBeginSection[] diff --git a/texmf/tex/latex/mmd6/letterhead/mmd6-letterhead-begin.tex b/texmf/tex/latex/mmd6/letterhead/mmd6-letterhead-begin.tex index 9db23f22..889dbf6a 100644 --- a/texmf/tex/latex/mmd6/letterhead/mmd6-letterhead-begin.tex +++ b/texmf/tex/latex/mmd6/letterhead/mmd6-letterhead-begin.tex @@ -158,7 +158,7 @@ \renewcommand{\baselinestretch}{1.2} \setlength{\parskip}{12pt} -%\input{mmd-title} +%\input{mmd6-title} % Insert Recipient \myrecipient From 8677ce0bfceadd8ecb9cf3d6fd4545e9bfe68b54 Mon Sep 17 00:00:00 2001 From: "Fletcher T. Penney" Date: Sat, 21 Dec 2019 19:37:09 -0500 Subject: [PATCH 03/17] UPDATED: Shorten hash function for compiling speed since we are hashing shorter strings --- Sources/libMultiMarkdown/i18n.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/libMultiMarkdown/i18n.h b/Sources/libMultiMarkdown/i18n.h index 03d8af61..f1ef53fc 100644 --- a/Sources/libMultiMarkdown/i18n.h +++ b/Sources/libMultiMarkdown/i18n.h @@ -59,7 +59,7 @@ #define H64(s,i,x) H16(s,i,H16(s,i+16,H16(s,i+32,H16(s,i+48,x)))) #define H256(s,i,x) H64(s,i,H64(s,i+64,H64(s,i+128,H64(s,i+192,x)))) - #define HASH(s) ((uint32_t)(H256(s,0,0)^(H256(s,0,0)>>16))) + #define HASH(s) ((uint32_t)(H64(s,0,0)^(H64(s,0,0)>>16))) #define LC(x) Translate(HASH(x), scratch->language) From f246cd9218a14b00fffe3d949d1fb1f737e85299 Mon Sep 17 00:00:00 2001 From: "Fletcher T. Penney" Date: Sat, 21 Dec 2019 19:37:40 -0500 Subject: [PATCH 04/17] FIXED: Fix edge case error in definition lists --- Sources/libMultiMarkdown/mmd.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Sources/libMultiMarkdown/mmd.c b/Sources/libMultiMarkdown/mmd.c index 3bb462a9..90810976 100644 --- a/Sources/libMultiMarkdown/mmd.c +++ b/Sources/libMultiMarkdown/mmd.c @@ -1163,7 +1163,7 @@ void mmd_parse_token_chain(mmd_engine * e, token * chain) { token * remainder; // Hold unparsed tail of chain // Enable to monitor parsing steps - // ParseTrace(stderr, "parser >>"); + // ParseTrace(stderr, "parser >> "); // Remove existing token tree e->root = NULL; @@ -1971,15 +1971,16 @@ void strip_line_tokens_from_deflist(mmd_engine * e, token * deflist) { walker->type = TEXT_EMPTY; break; - case LINE_PLAIN: - walker->type = BLOCK_TERM; - case BLOCK_TERM: break; case BLOCK_DEFINITION: strip_line_tokens_from_block(e, walker); break; + + default: + walker->type = BLOCK_TERM; + } walker = walker->next; @@ -2270,9 +2271,15 @@ token * mmd_engine_parse_substring(mmd_engine * e, size_t byte_start, size_t byt // Tokenize the string token * doc = mmd_tokenize_string(e, byte_start, byte_len, false); + // Describe token chain for debugging purposes + // token_describe(doc, NULL); + // Parse tokens into blocks mmd_parse_token_chain(e, doc); + // Describe token blocks for debugging purposes + // token_describe(doc, NULL); + if (doc) { // Parse blocks for pairs mmd_assign_ambidextrous_tokens_in_block(e, doc, 0); From fa1190c80b938e12e1a6a620b202bb6ad9d17569 Mon Sep 17 00:00:00 2001 From: "Fletcher T. Penney" Date: Sat, 21 Dec 2019 19:37:53 -0500 Subject: [PATCH 05/17] FIXED: Fix edge case in block parsing --- Sources/libMultiMarkdown/parser.c | 177 ++++++++++++++-------------- Sources/libMultiMarkdown/parser.out | 176 +++++++++++++-------------- Sources/libMultiMarkdown/parser.y | 1 + 3 files changed, 180 insertions(+), 174 deletions(-) diff --git a/Sources/libMultiMarkdown/parser.c b/Sources/libMultiMarkdown/parser.c index 1ae42aaa..0251164b 100644 --- a/Sources/libMultiMarkdown/parser.c +++ b/Sources/libMultiMarkdown/parser.c @@ -109,15 +109,15 @@ typedef union { #define ParseARG_STORE yypParser->engine = engine #define YYFALLBACK 1 #define YYNSTATE 47 -#define YYNRULE 156 +#define YYNRULE 157 #define YY_MAX_SHIFT 46 -#define YY_MIN_SHIFTREDUCE 158 -#define YY_MAX_SHIFTREDUCE 313 -#define YY_MIN_REDUCE 314 -#define YY_MAX_REDUCE 469 -#define YY_ERROR_ACTION 470 -#define YY_ACCEPT_ACTION 471 -#define YY_NO_ACTION 472 +#define YY_MIN_SHIFTREDUCE 159 +#define YY_MAX_SHIFTREDUCE 315 +#define YY_MIN_REDUCE 316 +#define YY_MAX_REDUCE 472 +#define YY_ERROR_ACTION 473 +#define YY_ACCEPT_ACTION 474 +#define YY_NO_ACTION 475 /************* End control #defines *******************************************/ /* Define the yytestcase() macro to be a no-op if is not already defined @@ -189,87 +189,87 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (321) +#define YY_ACTTAB_COUNT (322) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 471, 1, 160, 37, 171, 172, 173, 174, 175, 176, - /* 10 */ 45, 178, 29, 180, 32, 41, 40, 30, 14, 187, - /* 20 */ 188, 189, 44, 246, 13, 13, 32, 44, 240, 241, - /* 30 */ 249, 38, 38, 27, 270, 26, 25, 217, 28, 213, - /* 40 */ 41, 40, 210, 8, 222, 43, 263, 15, 15, 314, - /* 50 */ 167, 308, 312, 46, 5, 16, 256, 257, 308, 42, - /* 60 */ 262, 287, 161, 162, 163, 164, 165, 166, 261, 7, - /* 70 */ 6, 17, 4, 3, 2, 18, 169, 5, 302, 224, - /* 80 */ 272, 275, 278, 273, 276, 279, 306, 270, 293, 167, - /* 90 */ 39, 39, 46, 237, 16, 256, 257, 308, 42, 19, - /* 100 */ 287, 161, 162, 163, 164, 165, 166, 261, 7, 6, - /* 110 */ 17, 4, 3, 2, 18, 169, 5, 302, 252, 272, - /* 120 */ 275, 278, 273, 276, 279, 306, 270, 293, 159, 37, - /* 130 */ 171, 172, 173, 174, 175, 176, 45, 178, 29, 180, - /* 140 */ 32, 41, 40, 30, 14, 187, 188, 189, 308, 312, - /* 150 */ 253, 270, 32, 225, 256, 257, 252, 38, 38, 27, - /* 160 */ 190, 26, 25, 185, 28, 304, 41, 40, 283, 8, - /* 170 */ 196, 43, 280, 15, 15, 33, 33, 247, 282, 284, - /* 180 */ 283, 34, 34, 5, 280, 206, 35, 35, 253, 303, - /* 190 */ 282, 284, 12, 44, 12, 13, 13, 203, 218, 220, - /* 200 */ 216, 219, 221, 6, 286, 281, 285, 36, 36, 31, - /* 210 */ 214, 211, 212, 215, 31, 283, 286, 281, 285, 280, - /* 220 */ 31, 9, 9, 20, 20, 282, 284, 199, 199, 191, - /* 230 */ 468, 468, 9, 9, 20, 20, 245, 243, 198, 198, - /* 240 */ 7, 232, 31, 256, 257, 207, 208, 209, 245, 227, - /* 250 */ 31, 286, 281, 285, 9, 9, 20, 20, 31, 206, - /* 260 */ 197, 197, 9, 9, 20, 20, 238, 31, 204, 204, - /* 270 */ 10, 10, 22, 22, 226, 233, 31, 316, 316, 11, - /* 280 */ 11, 23, 23, 297, 228, 31, 316, 294, 316, 190, - /* 290 */ 21, 21, 290, 296, 298, 316, 288, 316, 190, 24, - /* 300 */ 24, 316, 289, 291, 316, 316, 316, 316, 316, 316, - /* 310 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 223, - /* 320 */ 295, + /* 0 */ 474, 1, 161, 37, 172, 173, 174, 175, 176, 177, + /* 10 */ 45, 179, 30, 181, 32, 41, 40, 29, 14, 188, + /* 20 */ 189, 190, 44, 247, 13, 13, 32, 44, 241, 242, + /* 30 */ 250, 38, 38, 27, 271, 26, 25, 218, 28, 214, + /* 40 */ 41, 40, 211, 8, 238, 43, 264, 15, 15, 316, + /* 50 */ 168, 310, 314, 46, 5, 16, 257, 258, 310, 42, + /* 60 */ 263, 288, 162, 163, 164, 165, 166, 167, 262, 7, + /* 70 */ 6, 17, 4, 3, 2, 18, 170, 5, 303, 225, + /* 80 */ 273, 276, 279, 274, 277, 280, 308, 271, 294, 168, + /* 90 */ 39, 39, 46, 223, 16, 257, 258, 310, 42, 19, + /* 100 */ 288, 162, 163, 164, 165, 166, 167, 262, 7, 6, + /* 110 */ 17, 4, 3, 2, 18, 170, 5, 303, 253, 273, + /* 120 */ 276, 279, 274, 277, 280, 308, 271, 294, 160, 37, + /* 130 */ 172, 173, 174, 175, 176, 177, 45, 179, 30, 181, + /* 140 */ 32, 41, 40, 29, 14, 188, 189, 190, 310, 314, + /* 150 */ 254, 271, 32, 226, 257, 258, 253, 38, 38, 27, + /* 160 */ 191, 26, 25, 197, 28, 5, 41, 40, 284, 8, + /* 170 */ 204, 43, 281, 15, 15, 33, 33, 248, 283, 285, + /* 180 */ 284, 34, 34, 6, 281, 207, 35, 35, 254, 228, + /* 190 */ 283, 285, 12, 44, 12, 13, 13, 233, 219, 221, + /* 200 */ 217, 220, 222, 7, 287, 282, 286, 36, 36, 31, + /* 210 */ 215, 212, 213, 216, 31, 284, 287, 282, 286, 281, + /* 220 */ 31, 9, 9, 20, 20, 283, 285, 200, 200, 192, + /* 230 */ 471, 471, 9, 9, 20, 20, 246, 244, 199, 199, + /* 240 */ 246, 207, 31, 257, 258, 208, 209, 210, 239, 318, + /* 250 */ 31, 287, 282, 286, 9, 9, 20, 20, 31, 318, + /* 260 */ 198, 198, 9, 9, 20, 20, 318, 31, 205, 205, + /* 270 */ 10, 10, 22, 22, 227, 234, 31, 318, 318, 11, + /* 280 */ 11, 23, 23, 298, 229, 31, 318, 295, 318, 191, + /* 290 */ 21, 21, 318, 297, 299, 186, 318, 305, 191, 24, + /* 300 */ 24, 291, 318, 306, 318, 289, 318, 318, 318, 318, + /* 310 */ 318, 290, 292, 318, 318, 318, 318, 318, 318, 224, + /* 320 */ 296, 304, }; static const YYCODETYPE yy_lookahead[] = { /* 0 */ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, /* 10 */ 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, /* 20 */ 61, 62, 86, 87, 88, 89, 67, 86, 2, 3, /* 30 */ 89, 72, 73, 74, 38, 76, 77, 75, 79, 75, - /* 40 */ 81, 82, 75, 84, 78, 86, 5, 88, 89, 0, + /* 40 */ 81, 82, 75, 84, 83, 86, 5, 88, 89, 0, /* 50 */ 1, 9, 10, 4, 28, 6, 7, 8, 9, 10, /* 60 */ 19, 12, 13, 14, 15, 16, 17, 18, 19, 20, /* 70 */ 21, 22, 23, 24, 25, 26, 27, 28, 29, 80, /* 80 */ 31, 32, 33, 34, 35, 36, 37, 38, 39, 1, - /* 90 */ 72, 73, 4, 83, 6, 7, 8, 9, 10, 67, + /* 90 */ 72, 73, 4, 78, 6, 7, 8, 9, 10, 67, /* 100 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, /* 110 */ 22, 23, 24, 25, 26, 27, 28, 29, 5, 31, /* 120 */ 32, 33, 34, 35, 36, 37, 38, 39, 43, 44, /* 130 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, /* 140 */ 55, 56, 57, 58, 59, 60, 61, 62, 9, 10, /* 150 */ 37, 38, 67, 67, 7, 8, 5, 72, 73, 74, - /* 160 */ 64, 76, 77, 3, 79, 5, 81, 82, 1, 84, - /* 170 */ 71, 86, 5, 88, 89, 63, 64, 38, 11, 12, - /* 180 */ 1, 63, 64, 28, 5, 38, 63, 64, 37, 29, - /* 190 */ 11, 12, 85, 86, 87, 88, 89, 73, 31, 32, - /* 200 */ 33, 34, 35, 21, 37, 38, 39, 63, 64, 51, + /* 160 */ 64, 76, 77, 71, 79, 28, 81, 82, 1, 84, + /* 170 */ 73, 86, 5, 88, 89, 63, 64, 38, 11, 12, + /* 180 */ 1, 63, 64, 21, 5, 38, 63, 64, 37, 81, + /* 190 */ 11, 12, 85, 86, 87, 88, 89, 82, 31, 32, + /* 200 */ 33, 34, 35, 20, 37, 38, 39, 63, 64, 51, /* 210 */ 31, 32, 33, 34, 51, 1, 37, 38, 39, 5, /* 220 */ 51, 63, 64, 65, 66, 11, 12, 69, 70, 66, /* 230 */ 2, 3, 63, 64, 65, 66, 9, 10, 69, 70, - /* 240 */ 20, 82, 51, 7, 8, 31, 32, 33, 9, 81, - /* 250 */ 51, 37, 38, 39, 63, 64, 65, 66, 51, 38, - /* 260 */ 69, 70, 63, 64, 65, 66, 29, 51, 69, 70, + /* 240 */ 9, 38, 51, 7, 8, 31, 32, 33, 29, 90, + /* 250 */ 51, 37, 38, 39, 63, 64, 65, 66, 51, 90, + /* 260 */ 69, 70, 63, 64, 65, 66, 90, 51, 69, 70, /* 270 */ 63, 64, 65, 66, 38, 68, 51, 90, 90, 63, /* 280 */ 64, 65, 66, 1, 68, 51, 90, 5, 90, 64, - /* 290 */ 65, 66, 1, 11, 12, 90, 5, 90, 64, 65, - /* 300 */ 66, 90, 11, 12, 90, 90, 90, 90, 90, 90, - /* 310 */ 90, 90, 90, 90, 90, 90, 90, 90, 90, 37, - /* 320 */ 38, + /* 290 */ 65, 66, 90, 11, 12, 3, 90, 5, 64, 65, + /* 300 */ 66, 1, 90, 11, 90, 5, 90, 90, 90, 90, + /* 310 */ 90, 11, 12, 90, 90, 90, 90, 90, 90, 37, + /* 320 */ 38, 29, }; -#define YY_SHIFT_USE_DFLT (321) +#define YY_SHIFT_USE_DFLT (322) #define YY_SHIFT_COUNT (46) #define YY_SHIFT_MIN (-4) -#define YY_SHIFT_MAX (291) +#define YY_SHIFT_MAX (300) static const short yy_shift_ofst[] = { /* 0 */ 88, 49, 113, 113, 113, 113, 113, 113, 42, 113, /* 10 */ 113, 113, 42, 139, 26, 42, 151, 151, 151, 151, - /* 20 */ -4, -4, -4, -4, -4, 167, 179, 214, 282, 291, - /* 30 */ 160, 147, 236, 151, 151, 151, 151, 41, 155, 155, - /* 40 */ 182, 220, 228, 227, 239, 221, 237, + /* 20 */ -4, -4, -4, -4, -4, 167, 179, 214, 282, 292, + /* 30 */ 300, 147, 236, 151, 151, 151, 151, 41, 137, 137, + /* 40 */ 162, 183, 228, 227, 231, 203, 219, }; #define YY_REDUCE_USE_DFLT (-65) #define YY_REDUCE_COUNT (41) @@ -278,16 +278,16 @@ static const short yy_shift_ofst[] = { static const short yy_reduce_ofst[] = { /* 0 */ -41, 85, 158, 169, 191, 199, 207, 216, 107, 225, /* 10 */ 234, 234, -64, -59, 18, -59, 112, 118, 123, 144, - /* 20 */ 163, 163, 163, 163, 163, -38, -36, -33, -1, -34, - /* 30 */ 10, 32, 86, 96, 96, 96, 96, 99, 124, 124, - /* 40 */ 159, 168, + /* 20 */ 163, 163, 163, 163, 163, -38, -36, -33, -1, -39, + /* 30 */ 15, 32, 86, 96, 96, 96, 96, 92, 97, 97, + /* 40 */ 115, 108, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 470, 470, 422, 421, 420, 361, 392, 387, 463, 414, - /* 10 */ 390, 385, 398, 404, 342, 406, 461, 424, 423, 349, - /* 20 */ 416, 351, 391, 386, 350, 433, 430, 427, 448, 335, - /* 30 */ 340, 411, 337, 395, 357, 356, 348, 326, 469, 358, - /* 40 */ 339, 338, 400, 467, 467, 333, 324, + /* 0 */ 473, 473, 424, 423, 422, 363, 394, 389, 466, 416, + /* 10 */ 392, 387, 400, 406, 344, 408, 464, 426, 425, 351, + /* 20 */ 418, 353, 393, 388, 352, 435, 432, 429, 450, 342, + /* 30 */ 337, 413, 339, 397, 359, 358, 350, 328, 472, 360, + /* 40 */ 341, 340, 402, 470, 470, 335, 326, }; /********** End of lemon-generated parsing tables *****************************/ @@ -606,15 +606,16 @@ static const char *const yyRuleName[] = { /* 144 */ "meta_block ::= LINE_META", /* 145 */ "meta_line ::= LINE_META", /* 146 */ "meta_line ::= LINE_CONTINUATION", - /* 147 */ "para ::= LINE_PLAIN", - /* 148 */ "para ::= LINE_STOP_COMMENT", - /* 149 */ "table ::= table_header", - /* 150 */ "header_rows ::= LINE_TABLE", - /* 151 */ "table_body ::= table_section", - /* 152 */ "all_rows ::= row", - /* 153 */ "row ::= header_rows", - /* 154 */ "row ::= LINE_TABLE_SEPARATOR", - /* 155 */ "para ::= defs", + /* 147 */ "meta_line ::= LINE_FALLBACK", + /* 148 */ "para ::= LINE_PLAIN", + /* 149 */ "para ::= LINE_STOP_COMMENT", + /* 150 */ "table ::= table_header", + /* 151 */ "header_rows ::= LINE_TABLE", + /* 152 */ "table_body ::= table_section", + /* 153 */ "all_rows ::= row", + /* 154 */ "row ::= header_rows", + /* 155 */ "row ::= LINE_TABLE_SEPARATOR", + /* 156 */ "para ::= defs", }; #endif /* NDEBUG */ @@ -1110,6 +1111,7 @@ static const struct { { 58, 1 }, { 83, 1 }, { 83, 1 }, + { 83, 1 }, { 59, 1 }, { 59, 1 }, { 62, 1 }, @@ -1473,15 +1475,16 @@ static void yy_reduce( /* (144) meta_block ::= LINE_META */ yytestcase(yyruleno==144); /* (145) meta_line ::= LINE_META */ yytestcase(yyruleno==145); /* (146) meta_line ::= LINE_CONTINUATION */ yytestcase(yyruleno==146); - /* (147) para ::= LINE_PLAIN */ yytestcase(yyruleno==147); - /* (148) para ::= LINE_STOP_COMMENT */ yytestcase(yyruleno==148); - /* (149) table ::= table_header */ yytestcase(yyruleno==149); - /* (150) header_rows ::= LINE_TABLE */ yytestcase(yyruleno==150); - /* (151) table_body ::= table_section (OPTIMIZED OUT) */ assert(yyruleno!=151); - /* (152) all_rows ::= row (OPTIMIZED OUT) */ assert(yyruleno!=152); - /* (153) row ::= header_rows */ yytestcase(yyruleno==153); - /* (154) row ::= LINE_TABLE_SEPARATOR */ yytestcase(yyruleno==154); - /* (155) para ::= defs */ yytestcase(yyruleno==155); + /* (147) meta_line ::= LINE_FALLBACK */ yytestcase(yyruleno==147); + /* (148) para ::= LINE_PLAIN */ yytestcase(yyruleno==148); + /* (149) para ::= LINE_STOP_COMMENT */ yytestcase(yyruleno==149); + /* (150) table ::= table_header */ yytestcase(yyruleno==150); + /* (151) header_rows ::= LINE_TABLE */ yytestcase(yyruleno==151); + /* (152) table_body ::= table_section (OPTIMIZED OUT) */ assert(yyruleno!=152); + /* (153) all_rows ::= row (OPTIMIZED OUT) */ assert(yyruleno!=153); + /* (154) row ::= header_rows */ yytestcase(yyruleno==154); + /* (155) row ::= LINE_TABLE_SEPARATOR */ yytestcase(yyruleno==155); + /* (156) para ::= defs */ yytestcase(yyruleno==156); break; /********** End reduce actions ************************************************/ }; diff --git a/Sources/libMultiMarkdown/parser.out b/Sources/libMultiMarkdown/parser.out index 14df9e8f..550485ff 100644 --- a/Sources/libMultiMarkdown/parser.out +++ b/Sources/libMultiMarkdown/parser.out @@ -123,7 +123,7 @@ State 0: LINE_PLAIN shift 16 LINE_INDENTED_TAB shift-reduce 98 indented_line ::= LINE_INDENTED_TAB LINE_INDENTED_SPACE shift-reduce 99 indented_line ::= LINE_INDENTED_SPACE - LINE_TABLE shift-reduce 150 header_rows ::= LINE_TABLE + LINE_TABLE shift-reduce 151 header_rows ::= LINE_TABLE LINE_TABLE_SEPARATOR shift 42 LINE_HTML shift-reduce 129 html_block ::= LINE_HTML LINE_ATX_1 shift-reduce 3 block ::= LINE_ATX_1 @@ -149,7 +149,7 @@ State 0: LINE_FENCE_BACKTICK_START_3 shift-reduce 115 fenced_3 ::= LINE_FENCE_BACKTICK_START_3 LINE_FENCE_BACKTICK_START_4 shift-reduce 118 fenced_4 ::= LINE_FENCE_BACKTICK_START_4 LINE_FENCE_BACKTICK_START_5 shift-reduce 121 fenced_5 ::= LINE_FENCE_BACKTICK_START_5 - LINE_STOP_COMMENT shift-reduce 148 para ::= LINE_STOP_COMMENT + LINE_STOP_COMMENT shift-reduce 149 para ::= LINE_STOP_COMMENT LINE_EMPTY shift-reduce 112 empty ::= LINE_EMPTY LINE_START_COMMENT shift-reduce 135 html_comment ::= LINE_START_COMMENT doc accept @@ -164,12 +164,12 @@ State 0: definition_block shift-reduce 18 block ::= definition_block empty shift 45 fenced_block shift-reduce 20 block ::= fenced_block - html_block shift 29 + html_block shift 30 html_com_block shift-reduce 22 block ::= html_com_block indented_code shift 32 list_bullet shift 41 list_enum shift 40 - meta_block shift 30 + meta_block shift 29 para shift 14 setext_1 shift-reduce 29 block ::= setext_1 setext_2 shift-reduce 30 block ::= setext_2 @@ -313,7 +313,7 @@ State 1: LINE_PLAIN shift 16 LINE_INDENTED_TAB shift-reduce 98 indented_line ::= LINE_INDENTED_TAB LINE_INDENTED_SPACE shift-reduce 99 indented_line ::= LINE_INDENTED_SPACE - LINE_TABLE shift-reduce 150 header_rows ::= LINE_TABLE + LINE_TABLE shift-reduce 151 header_rows ::= LINE_TABLE LINE_TABLE_SEPARATOR shift 42 LINE_HTML shift-reduce 129 html_block ::= LINE_HTML LINE_ATX_1 shift-reduce 3 block ::= LINE_ATX_1 @@ -339,7 +339,7 @@ State 1: LINE_FENCE_BACKTICK_START_3 shift-reduce 115 fenced_3 ::= LINE_FENCE_BACKTICK_START_3 LINE_FENCE_BACKTICK_START_4 shift-reduce 118 fenced_4 ::= LINE_FENCE_BACKTICK_START_4 LINE_FENCE_BACKTICK_START_5 shift-reduce 121 fenced_5 ::= LINE_FENCE_BACKTICK_START_5 - LINE_STOP_COMMENT shift-reduce 148 para ::= LINE_STOP_COMMENT + LINE_STOP_COMMENT shift-reduce 149 para ::= LINE_STOP_COMMENT LINE_EMPTY shift-reduce 112 empty ::= LINE_EMPTY LINE_START_COMMENT shift-reduce 135 html_comment ::= LINE_START_COMMENT block shift-reduce 1 blocks ::= blocks block @@ -352,12 +352,12 @@ State 1: definition_block shift-reduce 18 block ::= definition_block empty shift 45 fenced_block shift-reduce 20 block ::= fenced_block - html_block shift 29 + html_block shift 30 html_com_block shift-reduce 22 block ::= html_com_block indented_code shift 32 list_bullet shift 41 list_enum shift 40 - meta_block shift 30 + meta_block shift 29 para shift 14 setext_1 shift-reduce 29 block ::= setext_1 setext_2 shift-reduce 30 block ::= setext_2 @@ -572,7 +572,7 @@ State 7: State 8: table ::= table_header * table_body - (149) table ::= table_header * + (150) table ::= table_header * header_rows ::= * header_rows LINE_TABLE header_rows ::= * LINE_TABLE table_body ::= * table_body table_section @@ -584,16 +584,16 @@ State 8: row ::= * header_rows row ::= * LINE_TABLE_SEPARATOR - LINE_TABLE shift-reduce 150 header_rows ::= LINE_TABLE - LINE_TABLE reduce 149 ** Parsing conflict ** - LINE_TABLE_SEPARATOR shift-reduce 154 row ::= LINE_TABLE_SEPARATOR - LINE_TABLE_SEPARATOR reduce 149 ** Parsing conflict ** + LINE_TABLE shift-reduce 151 header_rows ::= LINE_TABLE + LINE_TABLE reduce 150 ** Parsing conflict ** + LINE_TABLE_SEPARATOR shift-reduce 155 row ::= LINE_TABLE_SEPARATOR + LINE_TABLE_SEPARATOR reduce 150 ** Parsing conflict ** table_body shift 12 header_rows shift 44 table_section shift 12 /* because table_section==table_body */ all_rows shift 13 row shift 13 /* because row==all_rows */ - {default} reduce 149 table ::= table_header + {default} reduce 150 table ::= table_header State 9: chunk ::= chunk * chunk_line @@ -682,9 +682,9 @@ State 12: row ::= * header_rows row ::= * LINE_TABLE_SEPARATOR - LINE_TABLE shift-reduce 150 header_rows ::= LINE_TABLE + LINE_TABLE shift-reduce 151 header_rows ::= LINE_TABLE LINE_TABLE reduce 84 ** Parsing conflict ** - LINE_TABLE_SEPARATOR shift-reduce 154 row ::= LINE_TABLE_SEPARATOR + LINE_TABLE_SEPARATOR shift-reduce 155 row ::= LINE_TABLE_SEPARATOR LINE_TABLE_SEPARATOR reduce 84 ** Parsing conflict ** header_rows shift 44 table_section shift-reduce 88 table_body ::= table_body table_section @@ -701,9 +701,9 @@ State 13: row ::= * header_rows row ::= * LINE_TABLE_SEPARATOR - LINE_TABLE shift-reduce 150 header_rows ::= LINE_TABLE + LINE_TABLE shift-reduce 151 header_rows ::= LINE_TABLE LINE_TABLE reduce 90 ** Parsing conflict ** - LINE_TABLE_SEPARATOR shift-reduce 154 row ::= LINE_TABLE_SEPARATOR + LINE_TABLE_SEPARATOR shift-reduce 155 row ::= LINE_TABLE_SEPARATOR LINE_TABLE_SEPARATOR reduce 90 ** Parsing conflict ** LINE_EMPTY shift-reduce 89 table_section ::= all_rows LINE_EMPTY LINE_EMPTY reduce 90 ** Parsing conflict ** @@ -737,9 +737,9 @@ State 15: row ::= * LINE_TABLE_SEPARATOR (92) para ::= all_rows * - LINE_TABLE shift-reduce 150 header_rows ::= LINE_TABLE + LINE_TABLE shift-reduce 151 header_rows ::= LINE_TABLE LINE_TABLE reduce 92 ** Parsing conflict ** - LINE_TABLE_SEPARATOR shift-reduce 154 row ::= LINE_TABLE_SEPARATOR + LINE_TABLE_SEPARATOR shift-reduce 155 row ::= LINE_TABLE_SEPARATOR LINE_TABLE_SEPARATOR reduce 92 ** Parsing conflict ** header_rows shift 44 row shift-reduce 91 all_rows ::= all_rows row @@ -751,14 +751,14 @@ State 16: chunk_line ::= * LINE_CONTINUATION chunk_line ::= * LINE_STOP_COMMENT para ::= LINE_PLAIN * chunk - (147) para ::= LINE_PLAIN * + (148) para ::= LINE_PLAIN * LINE_CONTINUATION shift-reduce 94 chunk_line ::= LINE_CONTINUATION LINE_STOP_COMMENT shift-reduce 95 chunk_line ::= LINE_STOP_COMMENT - LINE_STOP_COMMENT reduce 147 ** Parsing conflict ** + LINE_STOP_COMMENT reduce 148 ** Parsing conflict ** chunk shift 33 chunk_line shift 33 /* because chunk_line==chunk */ - {default} reduce 147 para ::= LINE_PLAIN + {default} reduce 148 para ::= LINE_PLAIN State 17: chunk ::= * chunk chunk_line @@ -1018,6 +1018,22 @@ State 28: {default} reduce 134 html_com_block ::= html_comment State 29: + (26) block ::= meta_block * + block ::= meta_block * LINE_SETEXT_2 + meta_block ::= meta_block * meta_line + meta_line ::= * LINE_META + meta_line ::= * LINE_CONTINUATION + meta_line ::= * LINE_FALLBACK + + LINE_SETEXT_2 shift-reduce 27 block ::= meta_block LINE_SETEXT_2 + LINE_CONTINUATION shift-reduce 146 meta_line ::= LINE_CONTINUATION + LINE_FALLBACK shift-reduce 147 meta_line ::= LINE_FALLBACK + LINE_META shift-reduce 145 meta_line ::= LINE_META + LINE_META reduce 26 ** Parsing conflict ** + meta_line shift-reduce 79 meta_block ::= meta_block meta_line + {default} reduce 26 block ::= meta_block + +State 30: (21) block ::= html_block * html_block ::= html_block * html_line html_line ::= * LINE_CONTINUATION @@ -1034,20 +1050,6 @@ State 29: html_line shift-reduce 64 html_block ::= html_block html_line {default} reduce 21 block ::= html_block -State 30: - (26) block ::= meta_block * - block ::= meta_block * LINE_SETEXT_2 - meta_block ::= meta_block * meta_line - meta_line ::= * LINE_META - meta_line ::= * LINE_CONTINUATION - - LINE_SETEXT_2 shift-reduce 27 block ::= meta_block LINE_SETEXT_2 - LINE_CONTINUATION shift-reduce 146 meta_line ::= LINE_CONTINUATION - LINE_META shift-reduce 145 meta_line ::= LINE_META - LINE_META reduce 26 ** Parsing conflict ** - meta_line shift-reduce 79 meta_block ::= meta_block meta_line - {default} reduce 26 block ::= meta_block - State 31: nested_chunk ::= empty * indented_line chunk nested_chunk ::= empty * indented_line @@ -1145,12 +1147,12 @@ State 38: defs ::= defs * def def ::= * LINE_DEFINITION tail def ::= * LINE_DEFINITION - (155) para ::= defs * + (156) para ::= defs * LINE_DEFINITION shift 5 - LINE_DEFINITION reduce 155 ** Parsing conflict ** + LINE_DEFINITION reduce 156 ** Parsing conflict ** def shift-reduce 45 defs ::= defs def - {default} reduce 155 para ::= defs + {default} reduce 156 para ::= defs State 39: (44) definition_block ::= para defs * @@ -1191,65 +1193,65 @@ State 41: State 42: (86) table_header ::= LINE_TABLE_SEPARATOR * - (154) row ::= LINE_TABLE_SEPARATOR * - - $ reduce 154 ** Parsing conflict ** - LINE_HR reduce 154 ** Parsing conflict ** - LINE_SETEXT_1 reduce 154 row ::= LINE_TABLE_SEPARATOR - LINE_SETEXT_2 reduce 154 row ::= LINE_TABLE_SEPARATOR - LINE_YAML reduce 154 ** Parsing conflict ** - LINE_PLAIN reduce 154 ** Parsing conflict ** - LINE_INDENTED_TAB reduce 154 ** Parsing conflict ** - LINE_INDENTED_SPACE reduce 154 ** Parsing conflict ** - LINE_TABLE reduce 154 ** Parsing conflict ** - LINE_TABLE_SEPARATOR reduce 154 ** Parsing conflict ** - LINE_HTML reduce 154 ** Parsing conflict ** - LINE_ATX_1 reduce 154 ** Parsing conflict ** - LINE_ATX_2 reduce 154 ** Parsing conflict ** - LINE_ATX_3 reduce 154 ** Parsing conflict ** - LINE_ATX_4 reduce 154 ** Parsing conflict ** - LINE_ATX_5 reduce 154 ** Parsing conflict ** - LINE_ATX_6 reduce 154 ** Parsing conflict ** - LINE_BLOCKQUOTE reduce 154 ** Parsing conflict ** - LINE_LIST_BULLETED reduce 154 ** Parsing conflict ** - LINE_LIST_ENUMERATED reduce 154 ** Parsing conflict ** - LINE_DEF_ABBREVIATION reduce 154 ** Parsing conflict ** - LINE_DEF_CITATION reduce 154 ** Parsing conflict ** - LINE_DEF_FOOTNOTE reduce 154 ** Parsing conflict ** - LINE_DEF_GLOSSARY reduce 154 ** Parsing conflict ** - LINE_DEF_LINK reduce 154 ** Parsing conflict ** - LINE_TOC reduce 154 ** Parsing conflict ** - LINE_DEFINITION reduce 154 ** Parsing conflict ** - LINE_META reduce 154 ** Parsing conflict ** - LINE_FENCE_BACKTICK_3 reduce 154 ** Parsing conflict ** - LINE_FENCE_BACKTICK_4 reduce 154 ** Parsing conflict ** - LINE_FENCE_BACKTICK_5 reduce 154 ** Parsing conflict ** - LINE_FENCE_BACKTICK_START_3 reduce 154 ** Parsing conflict ** - LINE_FENCE_BACKTICK_START_4 reduce 154 ** Parsing conflict ** - LINE_FENCE_BACKTICK_START_5 reduce 154 ** Parsing conflict ** - LINE_STOP_COMMENT reduce 154 ** Parsing conflict ** - LINE_EMPTY reduce 154 ** Parsing conflict ** - LINE_START_COMMENT reduce 154 ** Parsing conflict ** + (155) row ::= LINE_TABLE_SEPARATOR * + + $ reduce 155 ** Parsing conflict ** + LINE_HR reduce 155 ** Parsing conflict ** + LINE_SETEXT_1 reduce 155 row ::= LINE_TABLE_SEPARATOR + LINE_SETEXT_2 reduce 155 row ::= LINE_TABLE_SEPARATOR + LINE_YAML reduce 155 ** Parsing conflict ** + LINE_PLAIN reduce 155 ** Parsing conflict ** + LINE_INDENTED_TAB reduce 155 ** Parsing conflict ** + LINE_INDENTED_SPACE reduce 155 ** Parsing conflict ** + LINE_TABLE reduce 155 ** Parsing conflict ** + LINE_TABLE_SEPARATOR reduce 155 ** Parsing conflict ** + LINE_HTML reduce 155 ** Parsing conflict ** + LINE_ATX_1 reduce 155 ** Parsing conflict ** + LINE_ATX_2 reduce 155 ** Parsing conflict ** + LINE_ATX_3 reduce 155 ** Parsing conflict ** + LINE_ATX_4 reduce 155 ** Parsing conflict ** + LINE_ATX_5 reduce 155 ** Parsing conflict ** + LINE_ATX_6 reduce 155 ** Parsing conflict ** + LINE_BLOCKQUOTE reduce 155 ** Parsing conflict ** + LINE_LIST_BULLETED reduce 155 ** Parsing conflict ** + LINE_LIST_ENUMERATED reduce 155 ** Parsing conflict ** + LINE_DEF_ABBREVIATION reduce 155 ** Parsing conflict ** + LINE_DEF_CITATION reduce 155 ** Parsing conflict ** + LINE_DEF_FOOTNOTE reduce 155 ** Parsing conflict ** + LINE_DEF_GLOSSARY reduce 155 ** Parsing conflict ** + LINE_DEF_LINK reduce 155 ** Parsing conflict ** + LINE_TOC reduce 155 ** Parsing conflict ** + LINE_DEFINITION reduce 155 ** Parsing conflict ** + LINE_META reduce 155 ** Parsing conflict ** + LINE_FENCE_BACKTICK_3 reduce 155 ** Parsing conflict ** + LINE_FENCE_BACKTICK_4 reduce 155 ** Parsing conflict ** + LINE_FENCE_BACKTICK_5 reduce 155 ** Parsing conflict ** + LINE_FENCE_BACKTICK_START_3 reduce 155 ** Parsing conflict ** + LINE_FENCE_BACKTICK_START_4 reduce 155 ** Parsing conflict ** + LINE_FENCE_BACKTICK_START_5 reduce 155 ** Parsing conflict ** + LINE_STOP_COMMENT reduce 155 ** Parsing conflict ** + LINE_EMPTY reduce 155 ** Parsing conflict ** + LINE_START_COMMENT reduce 155 ** Parsing conflict ** {default} reduce 86 table_header ::= LINE_TABLE_SEPARATOR State 43: table_header ::= header_rows * LINE_TABLE_SEPARATOR header_rows ::= header_rows * LINE_TABLE - (153) row ::= header_rows * + (154) row ::= header_rows * LINE_TABLE shift-reduce 87 header_rows ::= header_rows LINE_TABLE - LINE_TABLE reduce 153 ** Parsing conflict ** + LINE_TABLE reduce 154 ** Parsing conflict ** LINE_TABLE_SEPARATOR shift-reduce 85 table_header ::= header_rows LINE_TABLE_SEPARATOR - LINE_TABLE_SEPARATOR reduce 153 ** Parsing conflict ** - {default} reduce 153 row ::= header_rows + LINE_TABLE_SEPARATOR reduce 154 ** Parsing conflict ** + {default} reduce 154 row ::= header_rows State 44: header_rows ::= header_rows * LINE_TABLE - (153) row ::= header_rows * + (154) row ::= header_rows * LINE_TABLE shift-reduce 87 header_rows ::= header_rows LINE_TABLE - LINE_TABLE reduce 153 ** Parsing conflict ** - {default} reduce 153 row ::= header_rows + LINE_TABLE reduce 154 ** Parsing conflict ** + {default} reduce 154 row ::= header_rows State 45: (19) block ::= empty * @@ -1352,7 +1354,7 @@ Symbols: 80: comment_line: LINE_HR LINE_CONTINUATION LINE_FALLBACK LINE_HTML LINE_EMPTY 81: item_bullet: LINE_LIST_BULLETED 82: item_enum: LINE_LIST_ENUMERATED - 83: meta_line: LINE_CONTINUATION LINE_META + 83: meta_line: LINE_CONTINUATION LINE_FALLBACK LINE_META 84: table_header: LINE_TABLE LINE_TABLE_SEPARATOR 85: table_body: LINE_TABLE LINE_TABLE_SEPARATOR 86: header_rows: LINE_TABLE diff --git a/Sources/libMultiMarkdown/parser.y b/Sources/libMultiMarkdown/parser.y index c8c4d080..0828ba9c 100644 --- a/Sources/libMultiMarkdown/parser.y +++ b/Sources/libMultiMarkdown/parser.y @@ -327,6 +327,7 @@ meta_block(A) ::= LINE_YAML(B) LINE_META(C). { A = B; token_chain_append(B, meta_line ::= LINE_META. meta_line ::= LINE_CONTINUATION. +meta_line ::= LINE_FALLBACK. // Paragraphs From cebe812edc1331da73364a2056f572efa1fce276 Mon Sep 17 00:00:00 2001 From: "Fletcher T. Penney" Date: Sat, 21 Dec 2019 19:40:08 -0500 Subject: [PATCH 06/17] FIXED: Ensure use of bash for creating AllTests.c --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ca59615c..fdd5c9f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -366,7 +366,7 @@ set(test_files # Process source files to look for tests to run add_custom_command ( OUTPUT ${PROJECT_BINARY_DIR}/AllTests.c - COMMAND sh ${PROJECT_SOURCE_DIR}/test/make-tests.sh ${PROJECT_SOURCE_DIR}/Sources/libMultiMarkdown/*.c > ${PROJECT_BINARY_DIR}/AllTests.c + COMMAND bash ${PROJECT_SOURCE_DIR}/test/make-tests.sh ${PROJECT_SOURCE_DIR}/Sources/libMultiMarkdown/*.c > ${PROJECT_BINARY_DIR}/AllTests.c ) if(hasParent) From 466224525ac41b3a006d6188a8d785703ac29b52 Mon Sep 17 00:00:00 2001 From: "Fletcher T. Penney" Date: Sat, 21 Dec 2019 19:40:58 -0500 Subject: [PATCH 07/17] FIXED: Fix typos --- Sources/libMultiMarkdown/writer.c | 2 +- Sources/libMultiMarkdown/xml.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/libMultiMarkdown/writer.c b/Sources/libMultiMarkdown/writer.c index 2a7e0c3d..c074f847 100644 --- a/Sources/libMultiMarkdown/writer.c +++ b/Sources/libMultiMarkdown/writer.c @@ -102,7 +102,7 @@ static char * my_strndup(const char * source, size_t n) { char * result; const char * test = source; - // strlen is too slow is strlen(source) >> n + // strlen is too slow if strlen(source) >> n for (len = 0; len < n; ++len) { if (*test == '\0') { break; diff --git a/Sources/libMultiMarkdown/xml.c b/Sources/libMultiMarkdown/xml.c index 27372adc..754475f5 100644 --- a/Sources/libMultiMarkdown/xml.c +++ b/Sources/libMultiMarkdown/xml.c @@ -128,7 +128,7 @@ static char * my_strndup(const char * source, size_t n) { // strlen is too slow if strlen(source) >> n for (len = 0; len < n; ++len) { - if (test == '\0') { + if (*test == '\0') { break; } From 0425b2472ddb57c58fad8eb6924c2cae18119aab Mon Sep 17 00:00:00 2001 From: "Fletcher T. Penney" Date: Sat, 21 Dec 2019 19:50:34 -0500 Subject: [PATCH 08/17] FIXED: Fix metadata parsing edge case --- Sources/libMultiMarkdown/mmd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/libMultiMarkdown/mmd.c b/Sources/libMultiMarkdown/mmd.c index 90810976..f01dd100 100644 --- a/Sources/libMultiMarkdown/mmd.c +++ b/Sources/libMultiMarkdown/mmd.c @@ -1938,6 +1938,7 @@ void strip_line_tokens_from_metadata(mmd_engine * e, token * metadata) { break; case LINE_TABLE: + case LINE_TABLE_SEPARATOR: if (scan_meta_line(&source[l->start])) { goto meta; } else { From 9e0b6da7fba440bde25d0666972ce3dd183185a1 Mon Sep 17 00:00:00 2001 From: "Fletcher T. Penney" Date: Sat, 21 Dec 2019 19:53:51 -0500 Subject: [PATCH 09/17] FIXED: Fix metadata edge case --- Sources/libMultiMarkdown/mmd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/libMultiMarkdown/mmd.c b/Sources/libMultiMarkdown/mmd.c index 90810976..de03bb21 100644 --- a/Sources/libMultiMarkdown/mmd.c +++ b/Sources/libMultiMarkdown/mmd.c @@ -1938,6 +1938,8 @@ void strip_line_tokens_from_metadata(mmd_engine * e, token * metadata) { break; case LINE_TABLE: + case LINE_TABLE_SEPARATOR: + case LINE_DEFINITION: if (scan_meta_line(&source[l->start])) { goto meta; } else { From 37320b47dc6067dafbd495f2321933cfe5e3eb4d Mon Sep 17 00:00:00 2001 From: "Fletcher T. Penney" Date: Sat, 21 Dec 2019 20:21:43 -0500 Subject: [PATCH 10/17] FIXED: Use more definitive edge case fix --- Sources/libMultiMarkdown/mmd.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Sources/libMultiMarkdown/mmd.c b/Sources/libMultiMarkdown/mmd.c index de03bb21..66aab7d7 100644 --- a/Sources/libMultiMarkdown/mmd.c +++ b/Sources/libMultiMarkdown/mmd.c @@ -1937,18 +1937,13 @@ void strip_line_tokens_from_metadata(mmd_engine * e, token * metadata) { case LINE_YAML: break; - case LINE_TABLE: - case LINE_TABLE_SEPARATOR: - case LINE_DEFINITION: + default: if (scan_meta_line(&source[l->start])) { goto meta; } else { goto plain; } - default: - fprintf(stderr, "ERROR!\n"); - token_describe(l, NULL); break; } From e164a8c9a9b22c6bc24e27be3f13b10e3214eb11 Mon Sep 17 00:00:00 2001 From: "Fletcher T. Penney" Date: Sat, 21 Dec 2019 21:02:35 -0500 Subject: [PATCH 11/17] FIXED: Fix edge case in fenced code blocks --- Sources/libMultiMarkdown/beamer.c | 5 ++++- Sources/libMultiMarkdown/html.c | 5 ++++- Sources/libMultiMarkdown/latex.c | 5 ++++- Sources/libMultiMarkdown/memoir.c | 5 ++++- Sources/libMultiMarkdown/opendocument-content.c | 5 ++++- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Sources/libMultiMarkdown/beamer.c b/Sources/libMultiMarkdown/beamer.c index 479ac1d4..cb12a51a 100644 --- a/Sources/libMultiMarkdown/beamer.c +++ b/Sources/libMultiMarkdown/beamer.c @@ -193,7 +193,10 @@ void mmd_export_token_beamer(DString * out, const char * source, token * t, scra d_string_append_c_array(out, &source[t->child->next->start], temp_token->start - t->child->next->start); scratch->padded = 1; } else { - d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start); + if (t->child->next) { + d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start); + } + scratch->padded = 0; } } diff --git a/Sources/libMultiMarkdown/html.c b/Sources/libMultiMarkdown/html.c index 321fb102..8ec94e04 100644 --- a/Sources/libMultiMarkdown/html.c +++ b/Sources/libMultiMarkdown/html.c @@ -652,7 +652,10 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc d_string_append_c_array(out, &source[t->child->next->start], temp_token->start - t->child->next->start); scratch->padded = 1; } else { - d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start); + if (t->child->next) { + d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start); + } + scratch->padded = 0; } } diff --git a/Sources/libMultiMarkdown/latex.c b/Sources/libMultiMarkdown/latex.c index 36f11d7c..bef248f1 100644 --- a/Sources/libMultiMarkdown/latex.c +++ b/Sources/libMultiMarkdown/latex.c @@ -573,7 +573,10 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat d_string_append_c_array(out, &source[t->child->next->start], temp_token->start - t->child->next->start); scratch->padded = 1; } else { - d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start); + if (t->child->next) { + d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start); + } + scratch->padded = 0; } } diff --git a/Sources/libMultiMarkdown/memoir.c b/Sources/libMultiMarkdown/memoir.c index 3b93d064..a536c73b 100644 --- a/Sources/libMultiMarkdown/memoir.c +++ b/Sources/libMultiMarkdown/memoir.c @@ -102,7 +102,10 @@ void mmd_export_token_memoir(DString * out, const char * source, token * t, scra d_string_append_c_array(out, &source[t->child->next->start], temp_token->start - t->child->next->start); scratch->padded = 1; } else { - d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start); + if (t->child->next) { + d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start); + } + scratch->padded = 0; } } diff --git a/Sources/libMultiMarkdown/opendocument-content.c b/Sources/libMultiMarkdown/opendocument-content.c index 9a30999d..be44394f 100644 --- a/Sources/libMultiMarkdown/opendocument-content.c +++ b/Sources/libMultiMarkdown/opendocument-content.c @@ -799,7 +799,10 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t d_string_append_c_array(out, &source[t->child->next->start], temp_token->start - t->child->next->start); scratch->padded = 1; } else { - d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start); + if (t->child->next) { + d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start); + } + scratch->padded = 0; } } From cd0e55fc62e660c8c83a2826dda40fd82895ad6d Mon Sep 17 00:00:00 2001 From: "Fletcher T. Penney" Date: Sun, 22 Dec 2019 12:48:59 -0500 Subject: [PATCH 12/17] FIXED: Fix null dereference --- Sources/libMultiMarkdown/writer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/libMultiMarkdown/writer.c b/Sources/libMultiMarkdown/writer.c index c074f847..3e7b2486 100644 --- a/Sources/libMultiMarkdown/writer.c +++ b/Sources/libMultiMarkdown/writer.c @@ -2596,6 +2596,10 @@ bool table_has_caption(token * t) { /// or /// ```` perl char * get_fence_language_specifier(token * fence, const char * source) { + if (fence == NULL) { + return NULL; + } + char * result = NULL; size_t start = fence->start + fence->len; size_t len = 0; From 57f4814cf1f9573f5c0a87744d45a3e93dcd73de Mon Sep 17 00:00:00 2001 From: "Fletcher T. Penney" Date: Sun, 22 Dec 2019 15:05:09 -0500 Subject: [PATCH 13/17] FIXED: Fix memory leak --- Sources/libMultiMarkdown/mmd.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Sources/libMultiMarkdown/mmd.c b/Sources/libMultiMarkdown/mmd.c index 66aab7d7..1c3e1037 100644 --- a/Sources/libMultiMarkdown/mmd.c +++ b/Sources/libMultiMarkdown/mmd.c @@ -1282,6 +1282,7 @@ void mmd_assign_ambidextrous_tokens_in_block(mmd_engine * e, token * block, size size_t lead_count, lag_count, pre_count, post_count; token * t = block->child; + token * new; char * str = e->dstr->str; @@ -1331,10 +1332,14 @@ void mmd_assign_ambidextrous_tokens_in_block(mmd_engine * e, token * block, size case CRITIC_SUB_DIV: // Divide this into two tokens - t->child = token_new(CRITIC_SUB_DIV_B, t->start + 1, 1); - t->child->next = t->next; - t->next = t->child; - t->child = NULL; + new = token_new(CRITIC_SUB_DIV_B, t->start + 1, 1); + + new->next = t->next; + new->next->prev = new; + + t->next = new; + new->prev = t; + t->len = 1; t->type = CRITIC_SUB_DIV_A; break; From f6fd9a65edc620df1c2157d697c3cf0a784fe702 Mon Sep 17 00:00:00 2001 From: "Fletcher T. Penney" Date: Sun, 22 Dec 2019 15:10:10 -0500 Subject: [PATCH 14/17] FIXED: Fix null dereference --- Sources/libMultiMarkdown/mmd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/libMultiMarkdown/mmd.c b/Sources/libMultiMarkdown/mmd.c index 1c3e1037..139ac648 100644 --- a/Sources/libMultiMarkdown/mmd.c +++ b/Sources/libMultiMarkdown/mmd.c @@ -1335,7 +1335,10 @@ void mmd_assign_ambidextrous_tokens_in_block(mmd_engine * e, token * block, size new = token_new(CRITIC_SUB_DIV_B, t->start + 1, 1); new->next = t->next; - new->next->prev = new; + + if (new->next) { + new->next->prev = new; + } t->next = new; new->prev = t; From 3b21bdf42e6534061fff0645aa6713d766ff5c07 Mon Sep 17 00:00:00 2001 From: "Fletcher T. Penney" Date: Sun, 22 Dec 2019 15:15:23 -0500 Subject: [PATCH 15/17] FIXED: Fix tests --- tests/MMD6Tests/Fuzz.fodt | 2 +- tests/MMD6Tests/Fuzz.html | 2 +- tests/MMD6Tests/Fuzz.tex | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/MMD6Tests/Fuzz.fodt b/tests/MMD6Tests/Fuzz.fodt index 37acf074..7dae90d5 100644 --- a/tests/MMD6Tests/Fuzz.fodt +++ b/tests/MMD6Tests/Fuzz.fodt @@ -280,7 +280,7 @@ office:mimetype="application/vnd.oasis.opendocument.text"> Collection of test cases identified by American fuzzy lop. ->bar~~} +û~~foo~>bar~~} diff --git a/tests/MMD6Tests/Fuzz.html b/tests/MMD6Tests/Fuzz.html index bb63f28e..7e7774e1 100644 --- a/tests/MMD6Tests/Fuzz.html +++ b/tests/MMD6Tests/Fuzz.html @@ -8,7 +8,7 @@

Collection of test cases identified by American fuzzy lop.

-

>bar~~}

+

û~~foo~>bar~~}

  • list
  • diff --git a/tests/MMD6Tests/Fuzz.tex b/tests/MMD6Tests/Fuzz.tex index 6e11797a..da87dae8 100644 --- a/tests/MMD6Tests/Fuzz.tex +++ b/tests/MMD6Tests/Fuzz.tex @@ -6,7 +6,7 @@ Collection of test cases identified by \href{http://lcamtuf.coredump.cx/afl/}{American fuzzy lop}\footnote{\href{http://lcamtuf.coredump.cx/afl/}{http:\slash \slash lcamtuf.coredump.cx\slash afl\slash }}. ->bar~~\} +û\ensuremath{\sim}\ensuremath{\sim}foo~>bar~~\} \begin{itemize} \item list From 9ae3c9cf8af7c9aff4528f1c067055eb62b9198b Mon Sep 17 00:00:00 2001 From: "Fletcher T. Penney" Date: Sun, 22 Dec 2019 15:44:22 -0500 Subject: [PATCH 16/17] FIXED: Fix array overflow with wide tables --- Sources/libMultiMarkdown/html.c | 31 +++++++++------- Sources/libMultiMarkdown/latex.c | 32 +++++++++-------- .../libMultiMarkdown/opendocument-content.c | 36 ++++++++++--------- 3 files changed, 56 insertions(+), 43 deletions(-) diff --git a/Sources/libMultiMarkdown/html.c b/Sources/libMultiMarkdown/html.c index 8ec94e04..f5566dbc 100644 --- a/Sources/libMultiMarkdown/html.c +++ b/Sources/libMultiMarkdown/html.c @@ -1964,21 +1964,25 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc print_const("\ttable_alignment[scratch->table_cell_count]) { - case 'l': - case 'L': - print_const(" style=\"text-align:left;\""); - break; + if (scratch->table_cell_count < kMaxTableColumns) { + switch (scratch->table_alignment[scratch->table_cell_count]) { + case 'l': + case 'L': + print_const(" style=\"text-align:left;\""); + break; - case 'r': - case 'R': - print_const(" style=\"text-align:right;\""); - break; + case 'r': + case 'R': + print_const(" style=\"text-align:right;\""); + break; - case 'c': - case 'C': - print_const(" style=\"text-align:center;\""); - break; + case 'c': + case 'C': + print_const(" style=\"text-align:center;\""); + break; + } + } else { + print_const(" style=\"text-align:left;\""); } if (t->next && t->next->type == TABLE_DIVIDER) { @@ -2056,6 +2060,7 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc default: fprintf(stderr, "Unknown token type: %d (%lu:%lu)\n", t->type, t->start, t->len); token_describe(t, source); + exit(0); break; } diff --git a/Sources/libMultiMarkdown/latex.c b/Sources/libMultiMarkdown/latex.c index bef248f1..09cb9c82 100644 --- a/Sources/libMultiMarkdown/latex.c +++ b/Sources/libMultiMarkdown/latex.c @@ -1894,20 +1894,24 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat if (t->next->len > 1) { printf("\\multicolumn{%lu}{", t->next->len); - switch (scratch->table_alignment[scratch->table_cell_count]) { - case 'l': - case 'L': - print_const("l}{"); - break; - - case 'r': - case 'R': - print_const("r}{"); - break; - - default: - print_const("c}{"); - break; + if (scratch->table_cell_count < kMaxTableColumns) { + switch (scratch->table_alignment[scratch->table_cell_count]) { + case 'l': + case 'L': + print_const("l}{"); + break; + + case 'r': + case 'R': + print_const("r}{"); + break; + + default: + print_const("c}{"); + break; + } + } else { + print_const("l}{"); } } } diff --git a/Sources/libMultiMarkdown/opendocument-content.c b/Sources/libMultiMarkdown/opendocument-content.c index be44394f..db200649 100644 --- a/Sources/libMultiMarkdown/opendocument-content.c +++ b/Sources/libMultiMarkdown/opendocument-content.c @@ -2092,22 +2092,26 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t } else { print_const(">\ntable_alignment[scratch->table_cell_count]) { - case 'l': - case 'L': - default: - print_const(" text:style-name=\"MMD-Table\""); - break; - - case 'r': - case 'R': - print_const(" text:style-name=\"MMD-Table-Right\""); - break; - - case 'c': - case 'C': - print_const(" text:style-name=\"MMD-Table-Center\""); - break; + if (scratch->table_cell_count < kMaxTableColumns) { + switch (scratch->table_alignment[scratch->table_cell_count]) { + case 'l': + case 'L': + default: + print_const(" text:style-name=\"MMD-Table\""); + break; + + case 'r': + case 'R': + print_const(" text:style-name=\"MMD-Table-Right\""); + break; + + case 'c': + case 'C': + print_const(" text:style-name=\"MMD-Table-Center\""); + break; + } + } else { + print_const(" text:style-name=\"MMD-Table\""); } } From 6a67a627d749ca227f628d610ba12e6c31cea026 Mon Sep 17 00:00:00 2001 From: "Fletcher T. Penney" Date: Sat, 28 Dec 2019 17:42:57 -0500 Subject: [PATCH 17/17] FIXED: Fix error when pruning tokens --- Sources/libMultiMarkdown/token.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/Sources/libMultiMarkdown/token.c b/Sources/libMultiMarkdown/token.c index 3d0b22d1..9f410f80 100644 --- a/Sources/libMultiMarkdown/token.c +++ b/Sources/libMultiMarkdown/token.c @@ -279,9 +279,28 @@ void token_remove_tail(token * head) { } +/// Fix tail at head of token chain (e.g. after pruning) +void fix_token_chain_tail(token * t) { + if (t) { + token * head = t; + + // Find head of chain + while (head->prev) { + head = head->prev; + } + + // Find tail + while (t->next) { + t = t->next; + } + + // Fix tail + head->tail = t; + } +} + /// Pop token out of it's chain, connecting head and tail of chain back together. /// Token must be freed if it is no longer needed. -/// \todo: If t is the tail token of a chain, the tail is no longer correct on the start of chain. void token_pop_link_from_chain(token * t) { if (t == NULL) { return; @@ -296,6 +315,8 @@ void token_pop_link_from_chain(token * t) { if (prev) { prev->next = next; + + fix_token_chain_tail(prev); } if (next) { @@ -315,6 +336,8 @@ void tokens_prune(token * first, token * last) { if (prev != NULL) { prev->next = next; + + fix_token_chain_tail(prev); } if (next != NULL) {