AtlatestRepositorysigil-doc
1
;;; SD-P4 -- passive parse API and parser-state localization.2
;;;3
;;; Every span assertion here recomputes the expected byte offset, byte length,4
;;; line and column INDEPENDENTLY of the parser's own location index, walking5
;;; the manuscript character by character. An arm that asked the parser to6
;;; confirm its own arithmetic would pass under any indexing bug.7
(import (sigil test) (sigil fs) (sigil language) (sigil syntax)8
(sigil doc inspect) (sigil doc private parser))10
;; ---------------------------------------------------------------- helpers12
(define (contains? haystack needle)13
(let ((n (string-length haystack)) (m (string-length needle)))14
(let loop ((i 0))15
(cond ((> (+ i m) n) #f)16
((string=? (substring haystack i (+ i m)) needle) #t)17
(else (loop (+ i 1)))))))19
(define (utf8-width c)20
(let ((n (char->integer c)))21
(cond ((<= n #x7f) 1) ((<= n #x7ff) 2) ((<= n #xffff) 3) (else 4))))23
;; Independent byte offset of scalar index `index`.24
(define (byte-offset source index)25
(let loop ((i 0) (bytes 0))26
(if (= i index) bytes (loop (+ i 1) (+ bytes (utf8-width (string-ref source i)))))))28
;; Independent scalar line/column at scalar index `index`.29
(define (cursor source index)30
(let loop ((i 0) (line 1) (column 1))31
(if (= i index) (list line column)32
(if (char=? (string-ref source i) #\newline)33
(loop (+ i 1) (+ line 1) 1)34
(loop (+ i 1) line (+ column 1))))))36
(define (tree-nodes tree)37
(let walk ((nodes (document-tree-roots tree)) (out '()))38
(if (null? nodes) (reverse out)39
(walk (append (tree-node-children (car nodes)) (cdr nodes))40
(cons (car nodes) out)))))42
(define (source-of path)43
(read-file-string path))45
(define (inspect-file path)46
(let* ((source (source-of path))47
(header (inspect-language-source source path)))48
(inspect-document-source source path (language-header-end header))))50
;; Assert every span of every node against the independently computed truth.51
;; Returns the number of nodes checked so a caller can prove the walk was not52
;; empty: a traversal that checked nothing must never read as a pass.53
(define (check-spans source tree)54
(let ((checked 0))55
(define (check node)56
(let* ((start (tree-node-start node))57
(end (tree-node-end node))58
(loc (tree-node-location node))59
(start-cursor (cursor source start))60
(end-cursor (cursor source end)))61
(set! checked (+ checked 1))62
;; The scalar span must name a real, ordered, in-bounds slice.63
(assert-true (<= 0 start))64
(assert-true (<= start end))65
(assert-true (<= end (string-length source)))66
;; srcloc carries UTF-8 BYTES; start/end carry SCALARS.67
(assert-equal (byte-offset source start) (srcloc-position loc))68
(assert-equal (- (byte-offset source end) (byte-offset source start))69
(srcloc-span loc))70
;; Line/column are scalar counts at both ends of the span.71
(assert-equal (car start-cursor) (srcloc-line loc))72
(assert-equal (cadr start-cursor) (srcloc-column loc))73
(assert-equal (car end-cursor) (tree-node-end-line node))74
(assert-equal (cadr end-cursor) (tree-node-end-column node))75
;; Children are contained, ordered, and non-overlapping.76
(let loop ((children (tree-node-children node)) (previous start))77
(if (null? children) #t78
(let ((child (car children)))79
(assert-true (>= (tree-node-start child) previous))80
(assert-true (<= (tree-node-end child) end))81
(check child)82
(loop (cdr children) (tree-node-end child)))))))83
(for-each check (document-tree-roots tree))84
checked))86
;; ---------------------------------------------------------------- suite88
(test "passive spans round-trip the manuscript at every node"89
(define total 0)90
(for-each91
(lambda (path)92
(let* ((source (source-of path))93
(tree (inspect-file path))94
(checked (check-spans source tree)))95
;; Per-file floor as well as a total, so one file collapsing to zero96
;; cannot hide behind the others' counts.97
(assert-true (> checked 15))98
(set! total (+ total checked))))99
(list "book/practical-sigil/01-useful-first-script.sgd"100
"book/practical-sigil/02-change-the-question.sgd"101
"test/fixtures/sd-p4-collision.sgd"102
"test/fixtures/sd-p4-note-root.sgd"))103
(display "SD_P4_NODES_CHECKED ") (display total) (newline)104
;; Measured 146 across the four manuscripts (32 / 20 / 70 / 24). The floor is105
;; set below that rather than at it: this arm exists to fail when the walk106
;; collapses, not to churn when a chapter gains a paragraph. A span check with107
;; no denominator passes for free when it traverses nothing.108
(assert-true (> total 120)))110
(test "a command's slice opens at its own @ and closes at its own delimiter"111
;; Named for what it checks. It does NOT verify a node's slice against an112
;; independent reconstruction -- the byte/scalar arm above does that -- it113
;; pins that a command's span covers its whole surface syntax including the114
;; closing delimiter, which is the part an off-by-one at either end breaks.115
(let* ((path "test/fixtures/sd-p4-collision.sgd")116
(source (source-of path))117
(tree (inspect-file path))118
(nodes (tree-nodes tree))119
(commands 0))120
(assert-true (> (length nodes) 10))121
(for-each122
(lambda (node)123
(let ((slice (substring source (tree-node-start node) (tree-node-end node))))124
(if (eq? (tree-node-kind node) 'command)125
(begin126
(set! commands (+ commands 1))127
(assert-equal #\@ (string-ref slice 0))128
;; The name follows the '@' immediately.129
(assert-true (> (string-length slice) 1))130
(when (eq? (tree-node-body-kind node) 'brace)131
(assert-equal #\} (string-ref slice (- (string-length slice) 1))))132
(when (eq? (tree-node-body-kind node) 'named)133
(assert-true (contains? slice "@end "))))134
(assert-true (> (string-length slice) 0)))))135
nodes)136
(assert-true (> commands 5))))138
(test "byte spans and scalar spans diverge exactly at multi-byte characters"139
(let* ((source "#lang sigil/doc\n@chapter[\"x\" \"A\"]{@p{καλημέρα @em{ok}}}")140
(tree (inspect-document-source source "multibyte.sgd" 16))141
(nodes (tree-nodes tree))142
(em (let loop ((xs nodes))143
(cond ((null? xs) #f)144
((eq? (tree-node-name (car xs)) 'em) (car xs))145
(else (loop (cdr xs)))))))146
(assert-true (tree-node? em))147
;; Eight two-byte Greek scalars precede @em, so its byte offset must exceed148
;; its scalar offset by exactly eight.149
(assert-equal (+ (tree-node-start em) 8) (srcloc-position (tree-node-location em)))150
;; The scalar span is unaffected by the preceding multi-byte run: "@em{ok}"151
;; is seven scalars wide wherever it sits.152
(assert-equal 7 (- (tree-node-end em) (tree-node-start em)))153
;; ...while its byte span is likewise seven, since its own body is ASCII.154
(assert-equal 7 (srcloc-span (tree-node-location em)))155
(check-spans source tree)))157
(test "argument syntax carries per-field spans addressing the original manuscript"158
;; folio F2 needs a field's span (a task's `status`) separately from the159
;; node's body span. Arguments are ordinary Sigil syntax read by the standard160
;; reader, and their srclocs must address the manuscript, not the delegated161
;; copy the parser reads through.162
(let* ((source "#lang sigil/doc\n@chapter[\"Title\" authors: '(\"A\")]{@p{x}}")163
(tree (inspect-document-source source "fields.sgd" 16))164
(chapter (car (document-tree-roots tree)))165
(arguments (tree-node-arguments chapter))166
(title (car arguments)))167
(assert-equal 'command (tree-node-kind chapter))168
(assert-equal 'chapter (tree-node-name chapter))169
(assert-true (> (length arguments) 1))170
(assert-true (syntax? title))171
(assert-equal "Title" (syntax->datum title))172
(let ((loc (syntax-srcloc title)))173
(assert-equal "fields.sgd" (srcloc-file loc))174
(assert-equal "\"Title\""175
(substring source (srcloc-position loc)176
(+ (srcloc-position loc) (srcloc-span loc)))))))178
(test "commands whose names collide with internal pseudo-kinds stay commands"179
;; The parser's internal tree uses five-slot `text` and `expr` pseudo-nodes.180
;; `@text{...}` and `@expr{...}` are legal author commands with the same head181
;; symbol, so the passive surface classifies on slot count. Reporting an182
;; author's command as parser-generated prose would silently drop it from any183
;; index built on this API.184
(let* ((source "#lang sigil/doc\n@chapter[\"x\" \"A\"]{@p{a @text{b} c @expr{d} e}}")185
(tree (inspect-document-source source "collide.sgd" 16))186
(nodes (tree-nodes tree))187
(named (lambda (name)188
(let loop ((xs nodes))189
(cond ((null? xs) #f)190
((and (eq? (tree-node-kind (car xs)) 'command)191
(eq? (tree-node-name (car xs)) name))192
(car xs))193
(else (loop (cdr xs))))))))194
(assert-true (tree-node? (named 'text)))195
(assert-true (tree-node? (named 'expr)))196
(assert-equal 'brace (tree-node-body-kind (named 'text)))197
(assert-equal 'brace (tree-node-body-kind (named 'expr)))198
;; And the genuine pseudo-kinds are still reported as such.199
(assert-true200
(let loop ((xs nodes))201
(cond ((null? xs) #f)202
((eq? (tree-node-kind (car xs)) 'text) #t)203
(else (loop (cdr xs))))))))205
(test "author expressions are captured unevaluated"206
(let* ((source "#lang sigil/doc\n@(define x 1)\n@chapter[\"x\" \"A\"]{@p{y}}")207
(tree (inspect-document-source source "expr.sgd" 16))208
(roots (document-tree-roots tree))209
(expression (car roots)))210
(assert-equal 'expr (tree-node-kind expression))211
(assert-false (tree-node-name expression))212
;; The captured value is syntax, not a result: nothing was run.213
(assert-true (syntax? (tree-node-expression expression)))214
(assert-equal '(define x 1) (syntax->datum (tree-node-expression expression)))))216
(test "body kinds are reported for brace, line, named, and raw code bodies"217
(let* ((source (string-append218
"#lang sigil/doc\n"219
"@chapter[\"Kinds\" \"A\"]\n"220
"@p{brace}\n"221
"@p: line\n"222
"@tip\n@p{named}\n@end tip\n"223
"@code[\"sigil\"]{(+ 1 2)}\n"224
"@end chapter\n"))225
(tree (inspect-document-source source "kinds.sgd" 16))226
(nodes (tree-nodes tree))227
(kinds (let loop ((xs nodes) (out '()))228
(cond ((null? xs) (reverse out))229
((eq? (tree-node-kind (car xs)) 'command)230
(loop (cdr xs) (cons (list (tree-node-name (car xs))231
(tree-node-body-kind (car xs)))232
out)))233
(else (loop (cdr xs) out))))))234
(assert-true (member (list 'chapter 'named) kinds))235
(assert-true (member (list 'p 'brace) kinds))236
(assert-true (member (list 'p 'line) kinds))237
(assert-true (member (list 'tip 'named) kinds))238
(assert-true (member (list 'code 'brace) kinds))239
(check-spans source tree)))241
(test "raw code content is the source slice; tree-node-text is folded prose"242
;; A sharp edge worth pinning rather than discovering. `tree-node-text` is the243
;; parser's node value, which for a text node is FOLDED prose (single newlines244
;; become spaces). Inside a raw `@code` body that folding is not the content:245
;; the authoritative raw text is the SOURCE SLICE named by the node's span,246
;; which is also what `code-block-content` uses on the lowering path. The two247
;; differ exactly when the raw body spans lines, so this arm asserts both and248
;; asserts that they differ.249
(let* ((source (string-append250
"#lang sigil/doc\n"251
"@chapter[\"Raw\" \"A\"]\n"252
"@code[#f]\n email@example.com\n @@ and @end other and } are inert\n@end code\n"253
"@end chapter\n"))254
(tree (inspect-document-source source "raw.sgd" 16))255
(code (let loop ((xs (tree-nodes tree)))256
(cond ((null? xs) #f)257
((eq? (tree-node-name (car xs)) 'code) (car xs))258
(else (loop (cdr xs)))))))259
(assert-true (tree-node? code))260
(assert-equal 'named (tree-node-body-kind code))261
(let* ((child (car (tree-node-children code)))262
(slice (substring source (tree-node-start child) (tree-node-end child))))263
(assert-equal 'text (tree-node-kind child))264
(assert-equal "email@example.com\n @@ and @end other and } are inert" slice)265
(assert-equal "email@example.com @@ and @end other and } are inert"266
(tree-node-text child))267
(assert-true (not (string=? slice (tree-node-text child)))))))269
(test "the passive tree does not enforce the single-root policy"270
;; A root policy is a LOWERING rule, not a fact about the grammar. It was271
;; "exactly one @chapter" when this arm was written and is "exactly one272
;; @article" since ruling D8 (SD-P8) -- and the point is that the passive path273
;; is indifferent to BOTH. The manuscript below declares `#lang sigil/doc` and274
;; two @note roots, which no sigil/doc profile has ever admitted, and the275
;; passive tree reports it regardless.276
(let* ((source "#lang sigil/doc\n@note[\"topics/x\"]{@p{body}}\n@note[\"topics/y\"]{@p{body}}\n")277
(tree (inspect-document-source source "roots.sgd" 16))278
(commands (let loop ((xs (document-tree-roots tree)) (out '()))279
(cond ((null? xs) (reverse out))280
((eq? (tree-node-kind (car xs)) 'command)281
(loop (cdr xs) (cons (tree-node-name (car xs)) out)))282
(else (loop (cdr xs) out))))))283
(assert-equal (list 'note 'note) commands)284
;; The lowering path still refuses it, unchanged by this phase.285
(assert-error (parse-document-source source "roots.sgd" 16))))287
(test "malformed source raises the identical diagnostic on both paths"288
;; The deferral of a diagnostic-collecting API to the consumer is only safe if289
;; the passive path fails exactly where the ordinary path fails.290
(define (message thunk) (guard (exn (else (exception-message exn))) (thunk) "NO ERROR"))291
(for-each292
(lambda (source)293
(let ((passive (message (lambda () (inspect-document-source source "bad.sgd" 16))))294
(ordinary (message (lambda () (parse-document-source source "bad.sgd" 16)))))295
(assert-true (not (string=? passive "NO ERROR")))296
(assert-equal ordinary passive)))297
(list "#lang sigil/doc\n@chapter[\"x\" \"A\"]{@p{oops}"298
"#lang sigil/doc\n}"299
"#lang sigil/doc\n@chapter[\"x\" authors: '(\"A\")]\n@section[\"s\" id: \"s\"]\n@end chapter\n"300
"#lang sigil/doc\n@chapter[\"x\" \"A\"]{text @em\nbody\n@end em\n}"301
"#lang sigil/doc\n@chapter[\"x\" (1 . 2 . 3)]{body}")))303
(test "the index pass visits each scalar exactly once"304
;; `steps` is COUNTED by the index loop, not assigned from the manuscript's305
;; length. An earlier version stored the length directly, which made this306
;; assertion compare `(string-length source)` with itself -- it would have307
;; passed just as happily over a quadratic index.308
(let* ((small "#lang sigil/doc\n@chapter[\"a\" \"A\"]{@p{x}}")309
(large "#lang sigil/doc\n@chapter[\"a\" \"A\"]{@p{καλημέρα κόσμε ολα καλα}}")310
(padded (string-append large "\n"))311
(small-steps (document-tree-index-steps (inspect-document-source small "s.sgd" 16)))312
(large-steps (document-tree-index-steps (inspect-document-source large "l.sgd" 16)))313
(padded-steps (document-tree-index-steps (inspect-document-source padded "p.sgd" 16))))314
(assert-equal (string-length small) small-steps)315
(assert-equal (string-length large) large-steps)316
;; The count is in SCALARS, so multi-byte prose does not inflate it, and one317
;; more character costs exactly one more step.318
(assert-equal (+ large-steps 1) padded-steps)))320
(test "location accessors read the state handed to them, not a shared index"321
;; THE discriminating test for finding I3, and the only one here that can see322
;; the defect. An adversarial review defeated every other state assertion in323
;; this file by restoring a module-level shared location index spelled WITHOUT324
;; `set!` (a vector cell plus an accessor): the suite stayed green and the325
;; gate's `set!` grep stayed blind, because nothing held a state handle across326
;; another parse and then USED it.327
;;328
;; This does. Two manuscripts whose byte offsets differ at the same scalar329
;; index; capture a location from alpha's state, parse beta, then ask alpha's330
;; state again. Any index shared between parses -- however it is spelled --331
;; answers the second question from beta.332
(let* ((alpha "#lang sigil/doc\n@chapter[\"καλημέρα κόσμε πάλι\" \"A\"]{@p{καλημέρα}}")333
(beta "#lang sigil/doc\n@chapter[\"plain ascii title here\" \"B\"]{@p{plain}}")334
(alpha-state (car (parse-document-nodes alpha "alpha.sgd" 16)))335
(alpha-before (parser-node-location alpha-state 30 40))336
(alpha-cursor-before (parser-node-cursor alpha-state 40))337
;; beta is parsed AFTER alpha's handle was taken.338
(beta-state (car (parse-document-nodes beta "beta.sgd" 16)))339
(beta-location (parser-node-location beta-state 30 40))340
;; ...and now alpha's handle is used again.341
(alpha-after (parser-node-location alpha-state 30 40))342
(alpha-cursor-after (parser-node-cursor alpha-state 40)))343
;; The precondition that makes this discriminating: at these indices the two344
;; manuscripts genuinely disagree, so answering from the wrong one is345
;; detectable. Without this the assertions below could pass vacuously.346
(assert-true (not (= (srcloc-position alpha-before) (srcloc-position beta-location))))347
(assert-true (not (= (srcloc-span alpha-before) (srcloc-span beta-location))))348
;; The state must still answer about its own manuscript.349
(assert-equal "alpha.sgd" (srcloc-file alpha-after))350
(assert-equal (srcloc-position alpha-before) (srcloc-position alpha-after))351
(assert-equal (srcloc-span alpha-before) (srcloc-span alpha-after))352
(assert-equal alpha-cursor-before alpha-cursor-after)353
(assert-equal alpha (parser-state-source alpha-state))354
(assert-equal beta (parser-state-source beta-state))))356
(test "the surface survives a document with a thousand block children"357
;; `copy-list` sits on every traversal path and was written in the natural358
;; recursive spelling, which overflowed the stack at ~1000 children -- on a359
;; document the lowering path handled, and well inside the parser's own 8192360
;; command budget. The consumer of this API indexes untrusted, half-written361
;; manuscripts, so a size a real note can reach must not crash it.362
(let* ((count 1200)363
(source364
(let loop ((i 0) (out "#lang sigil/doc\n@chapter[\"Big\" \"A\"]{\n"))365
(if (= i count)366
(string-append out "}\n")367
(loop (+ i 1)368
(string-append out "@p{paragraph " (number->string i) "}\n")))))369
(tree (inspect-document-source source "big.sgd" 16))370
(chapter (car (document-tree-roots tree)))371
(children (tree-node-children chapter)))372
(assert-true (>= (length children) count))373
;; Walk iteratively and touch every accessor, including the copying ones.374
(let loop ((rest children) (paragraphs 0))375
(if (null? rest)376
(assert-equal count paragraphs)377
(let ((node (car rest)))378
(if (and (eq? (tree-node-kind node) 'command)379
(eq? (tree-node-name node) 'p))380
(begin381
(assert-true (tree-node? node))382
(assert-equal '() (tree-node-arguments node))383
(assert-true (>= (length (tree-node-children node)) 1))384
(assert-true (> (srcloc-span (tree-node-location node)) 0))385
(loop (cdr rest) (+ paragraphs 1)))386
(loop (cdr rest) paragraphs)))))))388
(test "argument groups with many bracket candidates still parse"389
;; The candidate-']' bound must be a backstop, not a limit a real manuscript390
;; meets. At 1024 this manuscript stopped parsing and the base revision parsed391
;; it fine -- a regression introduced by the bound itself.392
(let* ((brackets (make-string 2000 #\]))393
(source (string-append "#lang sigil/doc\n@chapter[\"" brackets "\" \"A\"]{@p{ok}}"))394
(tree (inspect-document-source source "brackets.sgd" 16))395
(chapter (car (document-tree-roots tree))))396
(assert-equal 'chapter (tree-node-name chapter))397
(assert-equal brackets (syntax->datum (car (tree-node-arguments chapter))))))399
(test "parses do not observe each other through parser state"400
;; The property module-level parser state destroyed: a parse begun while401
;; another is in flight, or interleaved with it, must produce byte-identical402
;; results to the same parse run alone. `@(...)` author expressions are the403
;; sharpest case because they used to accumulate into a module-level list.404
(define alpha "#lang sigil/doc\n@(define a 1)\n@(define b 2)\n@chapter[\"Alpha\" \"A\"]{@p{καλημέρα}}")405
(define beta "#lang sigil/doc\n@(define c 3)\n@chapter[\"Beta\" \"B\"]{@p{@em{x}} @p{y}}")406
(define (summary tree)407
(list (document-tree-source-name tree)408
(document-tree-index-steps tree)409
(let walk ((nodes (document-tree-roots tree)) (out '()))410
(if (null? nodes) (reverse out)411
(walk (append (tree-node-children (car nodes)) (cdr nodes))412
(cons (list (tree-node-kind (car nodes))413
(tree-node-name (car nodes))414
(tree-node-start (car nodes))415
(tree-node-end (car nodes))416
(srcloc-position (tree-node-location (car nodes)))417
(srcloc-span (tree-node-location (car nodes))))418
out))))))419
(let* ((alpha-alone (summary (inspect-document-source alpha "alpha.sgd" 16)))420
(beta-alone (summary (inspect-document-source beta "beta.sgd" 16)))421
;; Interleaved: beta parses entirely between alpha's two parses, and a422
;; lowering parse of a third manuscript runs in between as well.423
(alpha-first (summary (inspect-document-source alpha "alpha.sgd" 16)))424
(beta-middle (summary (inspect-document-source beta "beta.sgd" 16)))425
(_lowered (parse-document-source "#lang sigil/doc\n@article[\"Gamma\" \"C\"]{@p{z}}" "gamma.sgd" 16))426
(alpha-again (summary (inspect-document-source alpha "alpha.sgd" 16))))427
(assert-equal alpha-alone alpha-first)428
(assert-equal alpha-alone alpha-again)429
(assert-equal beta-alone beta-middle)))431
(test "nested parses do not corrupt the enclosing parse"432
;; The exact reentrancy finding I3 names: a parse running INSIDE another433
;; parse. With module-level state the inner parse overwrote the outer one's434
;; location index; with per-parse state the outer result is unaffected.435
(define outer "#lang sigil/doc\n@chapter[\"Outer\" \"A\"]{@p{καλημέρα @em{inner}}}")436
(define inner "#lang sigil/doc\n@chapter[\"Inner-and-much-longer-manuscript\" \"B\"]{@p{padding padding padding}}")437
(let* ((clean (inspect-document-source outer "outer.sgd" 16))438
(clean-spans (map (lambda (n) (list (tree-node-start n) (srcloc-position (tree-node-location n))))439
(tree-nodes clean)))440
;; Interleave at node granularity: inspect the outer tree, and between441
;; reading its nodes run a complete inner parse.442
(staged (inspect-document-source outer "outer.sgd" 16))443
(staged-nodes (tree-nodes staged))444
(_inner (inspect-document-source inner "inner.sgd" 16))445
(staged-spans (map (lambda (n) (list (tree-node-start n) (srcloc-position (tree-node-location n))))446
staged-nodes)))447
(assert-equal clean-spans staged-spans)))449
(test "argument groups tolerate delimiters and report the reader's own diagnostic"450
;; Finding I5. The valid cases must keep working (positive control) or the451
;; error case proves nothing.452
(assert-true (document-tree?453
(inspect-document-source "#lang sigil/doc\n@chapter[\"a ] title\" \"A\"]{@p{ok}}" "ok.sgd" 16)))454
(assert-true (document-tree?455
(inspect-document-source "#lang sigil/doc\n@chapter[\"t\" ; ] in a comment\n \"A\"]{@p{ok}}" "ok2.sgd" 16)))456
(define (message source)457
(guard (exn (else (exception-message exn)))458
(inspect-document-source source "i5.sgd" 16)459
"NO ERROR"))460
;; A genuine Sigil syntax error inside [...] must surface the standard461
;; reader's message AND its own location, not "missing ']'" at the '['.462
(let ((dotted (message "#lang sigil/doc\n@chapter[\"x\" (1 . 2 . 3)]{body}")))463
(assert-true (contains? dotted "expected single element after dot"))464
(assert-true (contains? dotted "i5.sgd:2:21")))465
(let ((unterminated (message "#lang sigil/doc\n@chapter[\"x\" \"unterminated]{body}")))466
(assert-true (contains? unterminated "unterminated string")))467
;; A group with no closer at all is still the EOF diagnostic.468
(let ((none (message "#lang sigil/doc\n@chapter[\"x\" \"A\"{body}")))469
(assert-true (contains? none "missing ']'"))))