interplane.io
Source of interplane.io: a Rust generator that renders the page from the protocol repository's public record, deployed hourly from the Spark.
Brought by drakestapleton
interplane.io / native / translate.om
| 1 | note Script-free reader support. Uses the builder arena/output and its existing checked capacities. |
| 2 | note No translation, browser code, storage or endpoints. Transform and validate share lexical rules. |
| 3 | text trrad "rad:" |
| 4 | text trdid "did:" |
| 5 | text trzero "" |
| 6 | text trno " translate=\"no\"" |
| 7 | text trspan "<span translate=\"no\">" |
| 8 | text trend "</span>" |
| 9 | text tren "<span lang=\"en\">" |
| 10 | text trattr "translate" |
| 11 | text trclass "class" |
| 12 | text trlang "lang" |
| 13 | text trcode "code" |
| 14 | text trpre "pre" |
| 15 | text trkbd "kbd" |
| 16 | text trsamp "samp" |
| 17 | text trbrand "brand" |
| 18 | text trmono "mono" |
| 19 | text trdigest "digest" |
| 20 | text trfiles "files" |
| 21 | text trtitle "title" |
| 22 | text trnov "no" |
| 23 | text trerr "translation protection missing or overridden (hash, ID, file, command or code)" |
| 24 | text trlayout "translation links need a head, header and footer" |
| 25 | text trtxt "index.txt" |
| 26 | text trjson "index.json" |
| 27 | text trhtml ".html" |
| 28 | text trtxext ".txt" |
| 29 | text trjsext ".json" |
| 30 | text tralt1 "<link rel=\"alternate\" type=\"text/plain\" href=\"" |
| 31 | text tralt2 "<link rel=\"alternate\" type=\"application/json\" href=\"" |
| 32 | text tralt3 "\">\n" |
| 33 | text trhead "</header>" |
| 34 | text trflink "<p class=\"foot-fine\" lang=\"en\"><a href=\"/translate/\">Read in your language</a> | <a href=\"" |
| 35 | text trtextl "\">Plain text</a> | <a href=\"" |
| 36 | text trjsonl "\">JSON source</a></p>\n" |
| 37 | text trj1 "{\"source_url\":\"" |
| 38 | text trj2 "\",\"lang\":\"" |
| 39 | text trj3 "\",\"text\":\"" |
| 40 | text trj4 "\",\"html\":\"" |
| 41 | text trj5 "\"}\n" |
| 42 | text trcspnm "content-security-policy:" |
| 43 | text trscript "script-src" |
| 44 | text trnone "'none'" |
| 45 | text trcspbad "served response must have script-src 'none' without other script sources or overrides" |
| 46 | note trq: attribute value offset/length, depth, protected depth, explicit lang depth, raw depth. |
| 47 | global trq ulong 6 |
| 48 | |
| 49 | fn trat a ulong e ulong t view uchar * to bool |
| 50 | if gt add a len t e |
| 51 | ret false |
| 52 | end |
| 53 | ret mistf a t false |
| 54 | end |
| 55 | |
| 56 | fn trname a ulong e ulong to ulong |
| 57 | k = a |
| 58 | while lt k e bound 9223372036854775807 |
| 59 | if not namechar mg k |
| 60 | break |
| 61 | end |
| 62 | k = add k 1 |
| 63 | end |
| 64 | ret k |
| 65 | end |
| 66 | |
| 67 | fn trtagend a ulong e ulong to ulong |
| 68 | q = uchar 0 |
| 69 | k = a |
| 70 | while lt k e bound 9223372036854775807 |
| 71 | c = mg k |
| 72 | if ne q 0 |
| 73 | if eq c q |
| 74 | q = 0 |
| 75 | end |
| 76 | else |
| 77 | if or eq c 34 eq c 39 |
| 78 | q = c |
| 79 | else |
| 80 | if eq c 62 |
| 81 | ret add k 1 |
| 82 | end |
| 83 | end |
| 84 | end |
| 85 | k = add k 1 |
| 86 | end |
| 87 | die ermark |
| 88 | ret e |
| 89 | end |
| 90 | |
| 91 | fn trget a ulong e ulong key view uchar * to bool |
| 92 | note Parse attributes, not substrings inside other attribute values. Markup has already been checked. |
| 93 | k = a |
| 94 | put trq 0 0 |
| 95 | put trq 1 0 |
| 96 | while lt k e bound 9223372036854775807 |
| 97 | if space mg k |
| 98 | k = add k 1 |
| 99 | continue |
| 100 | end |
| 101 | s = k |
| 102 | k = trname k e |
| 103 | if eq s k |
| 104 | ret false |
| 105 | end |
| 106 | hit = mist s sub k s key |
| 107 | while lt k e bound 9223372036854775807 |
| 108 | if not space mg k |
| 109 | break |
| 110 | end |
| 111 | k = add k 1 |
| 112 | end |
| 113 | if eq mg k 61 |
| 114 | k = add k 1 |
| 115 | while space mg k bound 9223372036854775807 |
| 116 | k = add k 1 |
| 117 | end |
| 118 | q = mg k |
| 119 | k = add k 1 |
| 120 | v = k |
| 121 | while lt k e bound 9223372036854775807 |
| 122 | if eq mg k q |
| 123 | break |
| 124 | end |
| 125 | k = add k 1 |
| 126 | end |
| 127 | if hit |
| 128 | put trq 0 v |
| 129 | put trq 1 sub k v |
| 130 | ret true |
| 131 | end |
| 132 | k = add k 1 |
| 133 | end |
| 134 | end |
| 135 | ret false |
| 136 | end |
| 137 | |
| 138 | fn trclasses a ulong e ulong to bool |
| 139 | if not trget a e trclass |
| 140 | ret false |
| 141 | end |
| 142 | k = get trq 0 |
| 143 | lim = add k get trq 1 |
| 144 | while lt k lim bound 9223372036854775807 |
| 145 | if space mg k |
| 146 | k = add k 1 |
| 147 | continue |
| 148 | end |
| 149 | s = k |
| 150 | while lt k lim bound 9223372036854775807 |
| 151 | if space mg k |
| 152 | break |
| 153 | end |
| 154 | k = add k 1 |
| 155 | end |
| 156 | n = sub k s |
| 157 | if or mist s n trbrand mist s n trmono |
| 158 | ret true |
| 159 | end |
| 160 | if or mist s n trdigest mist s n trfiles |
| 161 | ret true |
| 162 | end |
| 163 | end |
| 164 | ret false |
| 165 | end |
| 166 | |
| 167 | fn trmust a ulong n ulong e ulong to bool |
| 168 | z = sub n a |
| 169 | if or mist a z trcode mist a z trpre |
| 170 | ret true |
| 171 | end |
| 172 | if or mist a z trkbd mist a z trsamp |
| 173 | ret true |
| 174 | end |
| 175 | ret trclasses n e |
| 176 | end |
| 177 | |
| 178 | fn trvoid a ulong n ulong e ulong to bool |
| 179 | if eq mg sub e 2 47 |
| 180 | ret true |
| 181 | end |
| 182 | z = sub n a |
| 183 | if or mist a z vtmeta mist a z vtlink |
| 184 | ret true |
| 185 | end |
| 186 | if or mist a z vtbr mist a z vtimg |
| 187 | ret true |
| 188 | end |
| 189 | if or mist a z vthr mist a z vtwbr |
| 190 | ret true |
| 191 | end |
| 192 | ret or mist a z vtinput or mist a z vtsource mist a z vtcol |
| 193 | end |
| 194 | |
| 195 | fn trwc c uchar to bool |
| 196 | ret or alnum c or eq c 95 or eq c 45 or eq c 46 or eq c 47 or eq c 64 eq c 58 |
| 197 | end |
| 198 | |
| 199 | fn trtoken a ulong e ulong to bool |
| 200 | note Protect a hex run of 7+ (upper or lower), identifier prefixes, and path/file-like words. |
| 201 | k = a |
| 202 | hxrun = ulong 0 |
| 203 | digit = false |
| 204 | dot = false |
| 205 | while lt k e bound 9223372036854775807 |
| 206 | c = mg k |
| 207 | if lt hexv c 16 |
| 208 | hxrun = add hxrun 1 |
| 209 | if and ge c 48 le c 57 |
| 210 | digit = true |
| 211 | end |
| 212 | if and ge hxrun 7 digit |
| 213 | ret true |
| 214 | end |
| 215 | else |
| 216 | hxrun = 0 |
| 217 | digit = false |
| 218 | end |
| 219 | if or eq c 46 eq c 47 |
| 220 | dot = true |
| 221 | end |
| 222 | k = add k 1 |
| 223 | end |
| 224 | if dot |
| 225 | ret true |
| 226 | end |
| 227 | if or trat a e trrad trat a e trdid |
| 228 | ret true |
| 229 | end |
| 230 | if ge sub e a 29 |
| 231 | if eq mg a 122 |
| 232 | ret true |
| 233 | end |
| 234 | end |
| 235 | ret false |
| 236 | end |
| 237 | |
| 238 | fn trword s ulong k ulong mode ulong to void |
| 239 | t = k |
| 240 | while gt t s bound 9223372036854775807 |
| 241 | c = mg sub t 1 |
| 242 | if not or eq c 46 or eq c 58 or eq c 45 eq c 47 |
| 243 | break |
| 244 | end |
| 245 | t = sub t 1 |
| 246 | end |
| 247 | hit = false |
| 248 | if gt t s |
| 249 | hit = trtoken s t |
| 250 | end |
| 251 | if and hit eq get trq 3 0 |
| 252 | if eq mode 1 |
| 253 | die trerr |
| 254 | end |
| 255 | ot trspan |
| 256 | om s sub t s |
| 257 | ot trend |
| 258 | om t sub k t |
| 259 | else |
| 260 | if eq mode 0 |
| 261 | om s sub k s |
| 262 | end |
| 263 | end |
| 264 | end |
| 265 | |
| 266 | fn trtext a ulong e ulong mode ulong to void |
| 267 | k = a |
| 268 | while lt k e bound 9223372036854775807 |
| 269 | if not trwc mg k |
| 270 | if eq mode 0 |
| 271 | ob mg k |
| 272 | end |
| 273 | k = add k 1 |
| 274 | continue |
| 275 | end |
| 276 | s = k |
| 277 | while lt k e bound 9223372036854775807 |
| 278 | if not trwc mg k |
| 279 | break |
| 280 | end |
| 281 | k = add k 1 |
| 282 | end |
| 283 | trword s k mode |
| 284 | end |
| 285 | end |
| 286 | |
| 287 | fn tropen a ulong n ulong e ulong mode ulong to void |
| 288 | must = and trmust a n e eq get trq 3 0 |
| 289 | has = trget n e trattr |
| 290 | no = false |
| 291 | if has |
| 292 | no = mist get trq 0 get trq 1 trnov |
| 293 | if and not no or must ne get trq 3 0 |
| 294 | die trerr |
| 295 | end |
| 296 | end |
| 297 | if and must not no |
| 298 | if eq mode 1 |
| 299 | die trerr |
| 300 | end |
| 301 | no = true |
| 302 | end |
| 303 | if eq mode 0 |
| 304 | om sub a 1 add sub n a 1 |
| 305 | if and must not has |
| 306 | ot trno |
| 307 | end |
| 308 | om n sub e n |
| 309 | end |
| 310 | if trvoid a n e |
| 311 | ret |
| 312 | end |
| 313 | d = add get trq 2 1 |
| 314 | put trq 2 d |
| 315 | if and no eq get trq 3 0 |
| 316 | put trq 3 d |
| 317 | end |
| 318 | if and eq get trq 4 0 trget n e trlang |
| 319 | put trq 4 d |
| 320 | end |
| 321 | if mist a sub n a trtitle |
| 322 | put trq 5 d |
| 323 | end |
| 324 | end |
| 325 | |
| 326 | fn trwalk a ulong e ulong mode ulong zh bool to void |
| 327 | for j ulong 6 |
| 328 | put trq j 0 |
| 329 | end |
| 330 | k = a |
| 331 | while lt k e bound 9223372036854775807 |
| 332 | if eq mg k 60 |
| 333 | if trat k e tcmo |
| 334 | q = mfirst k e tcme |
| 335 | if eq q e |
| 336 | die ermark |
| 337 | end |
| 338 | q = add q len tcme |
| 339 | if eq mode 0 |
| 340 | om k sub q k |
| 341 | end |
| 342 | k = q |
| 343 | continue |
| 344 | end |
| 345 | q = trtagend k e |
| 346 | j = add k 1 |
| 347 | if eq mg j 47 |
| 348 | d = get trq 2 |
| 349 | if eq get trq 3 d |
| 350 | put trq 3 0 |
| 351 | end |
| 352 | if eq get trq 4 d |
| 353 | put trq 4 0 |
| 354 | end |
| 355 | if eq get trq 5 d |
| 356 | put trq 5 0 |
| 357 | end |
| 358 | if gt d 0 |
| 359 | put trq 2 sub d 1 |
| 360 | end |
| 361 | if eq mode 0 |
| 362 | om k sub q k |
| 363 | end |
| 364 | else |
| 365 | n = trname j q |
| 366 | if eq n j |
| 367 | if eq mode 0 |
| 368 | om k sub q k |
| 369 | end |
| 370 | else |
| 371 | tropen j n q mode |
| 372 | end |
| 373 | end |
| 374 | k = q |
| 375 | else |
| 376 | s = k |
| 377 | while lt k e bound 9223372036854775807 |
| 378 | if eq mg k 60 |
| 379 | break |
| 380 | end |
| 381 | k = add k 1 |
| 382 | end |
| 383 | if ne get trq 5 0 |
| 384 | if eq mode 0 |
| 385 | om s sub k s |
| 386 | end |
| 387 | else |
| 388 | trtext s k mode |
| 389 | end |
| 390 | end |
| 391 | end |
| 392 | end |
| 393 | |
| 394 | fn trcheck to void |
| 395 | note Validation is run on reread output too; a changed manifest does not bypass it. |
| 396 | mark = sg TOP |
| 397 | n = sg OBN |
| 398 | a = stash |
| 399 | trwalk a add a n 1 false |
| 400 | put st TOP mark |
| 401 | put st OBN n |
| 402 | end |
| 403 | |
| 404 | fn trurl r ulong suffix view uchar * absolute bool to void |
| 405 | b = mul r 8 |
| 406 | if absolute |
| 407 | zurl r |
| 408 | else |
| 409 | om rg add b 2 rg add b 3 |
| 410 | end |
| 411 | ot suffix |
| 412 | end |
| 413 | |
| 414 | fn trlinks r ulong to void |
| 415 | a = stash |
| 416 | e = add a sg FLEN |
| 417 | h = mfirst a e zhead |
| 418 | v = mfirst a e trhead |
| 419 | f = mlast a e zfoot |
| 420 | if or eq h e or eq v e eq f e |
| 421 | die trlayout |
| 422 | end |
| 423 | om a sub h a |
| 424 | ot tralt1 |
| 425 | trurl r trtxt false |
| 426 | ot tralt3 |
| 427 | ot tralt2 |
| 428 | trurl r trjson false |
| 429 | ot tralt3 |
| 430 | om h sub f h |
| 431 | ot trflink |
| 432 | trurl r trtxt false |
| 433 | ot trtextl |
| 434 | trurl r trjson false |
| 435 | ot trjsonl |
| 436 | om f sub e f |
| 437 | end |
| 438 | |
| 439 | fn trpage r ulong to void |
| 440 | trlinks r |
| 441 | note Run the existing text policy and markup checks first so refused input keeps its diagnostic. |
| 442 | polscan true |
| 443 | chkmark true |
| 444 | a = stash |
| 445 | e = add a sg FLEN |
| 446 | trwalk a e 0 false |
| 447 | end |
| 448 | |
| 449 | fn trjesc a ulong n ulong to void |
| 450 | for k ulong n bound 9223372036854775807 |
| 451 | c = mg add a k |
| 452 | if or eq c 34 eq c 92 |
| 453 | ob 92 |
| 454 | ob c |
| 455 | else |
| 456 | if lt c 32 |
| 457 | ob 92 |
| 458 | ob 117 |
| 459 | ob 48 |
| 460 | ob 48 |
| 461 | ob hexc shr ulong c 4 |
| 462 | ob hexc and ulong c 15 |
| 463 | else |
| 464 | ob c |
| 465 | end |
| 466 | end |
| 467 | end |
| 468 | end |
| 469 | |
| 470 | text trmaino "<main" |
| 471 | text trmaine "</main>" |
| 472 | text trbr "br" |
| 473 | text trp "p" |
| 474 | text trli "li" |
| 475 | text trtd "td" |
| 476 | text trdiv "div" |
| 477 | text trsect "section" |
| 478 | text trrow "tr" |
| 479 | text trh1 "h1" |
| 480 | text trh2 "h2" |
| 481 | text trh3 "h3" |
| 482 | text trsvg "svg" |
| 483 | text trapos "'" |
| 484 | text trnbsp " " |
| 485 | text trarr "→" |
| 486 | text trldq "“" |
| 487 | text trrdq "”" |
| 488 | text tromega "Ω" |
| 489 | text trmidd "·" |
| 490 | text trback "```\n" |
| 491 | |
| 492 | fn trnl to void |
| 493 | if gt sg OBN 0 |
| 494 | if ne og sub sg OBN 1 10 |
| 495 | ob 10 |
| 496 | end |
| 497 | end |
| 498 | end |
| 499 | |
| 500 | fn trentity k ulong e ulong to ulong |
| 501 | if trat k e hamp |
| 502 | ob 38 |
| 503 | ret add k len hamp |
| 504 | end |
| 505 | if trat k e hlt |
| 506 | ob 60 |
| 507 | ret add k len hlt |
| 508 | end |
| 509 | if trat k e hgt |
| 510 | ob 62 |
| 511 | ret add k len hgt |
| 512 | end |
| 513 | if trat k e hquot |
| 514 | ob 34 |
| 515 | ret add k len hquot |
| 516 | end |
| 517 | if trat k e trapos |
| 518 | ob 39 |
| 519 | ret add k len trapos |
| 520 | end |
| 521 | if trat k e ptrade |
| 522 | ot ttm |
| 523 | ret add k len ptrade |
| 524 | end |
| 525 | if trat k e trnbsp |
| 526 | ob 32 |
| 527 | ret add k len trnbsp |
| 528 | end |
| 529 | if trat k e trarr |
| 530 | ob 45 |
| 531 | ob 62 |
| 532 | ret add k len trarr |
| 533 | end |
| 534 | if or trat k e trldq trat k e trrdq |
| 535 | ob 34 |
| 536 | ret add k len trldq |
| 537 | end |
| 538 | if trat k e tromega |
| 539 | ob 206 |
| 540 | ob 169 |
| 541 | ret add k len tromega |
| 542 | end |
| 543 | if trat k e trmidd |
| 544 | ob 194 |
| 545 | ob 183 |
| 546 | ret add k len trmidd |
| 547 | end |
| 548 | ob mg k |
| 549 | ret add k 1 |
| 550 | end |
| 551 | |
| 552 | fn trblock a ulong n ulong to bool |
| 553 | z = sub n a |
| 554 | if or mist a z trp mist a z trli |
| 555 | ret true |
| 556 | end |
| 557 | if or mist a z trdiv mist a z trsect |
| 558 | ret true |
| 559 | end |
| 560 | if or mist a z trrow mist a z trbr |
| 561 | ret true |
| 562 | end |
| 563 | if or mist a z trh1 mist a z trh2 |
| 564 | ret true |
| 565 | end |
| 566 | ret mist a z trh3 |
| 567 | end |
| 568 | |
| 569 | fn trplain a ulong e ulong to void |
| 570 | note Text from the same complete HTML; tags do not turn inline words into separate words, but an |
| 571 | note element that starts right after a sibling closed is set apart, as a reader sees adjacent links. |
| 572 | n = mfirst a e trmaino |
| 573 | if eq n e |
| 574 | die erhtml |
| 575 | end |
| 576 | k = trtagend n e |
| 577 | lim = mfirst k e trmaine |
| 578 | if eq lim e |
| 579 | die erhtml |
| 580 | end |
| 581 | pre = false |
| 582 | skip = false |
| 583 | sep = false |
| 584 | while lt k lim bound 9223372036854775807 |
| 585 | if eq mg k 60 |
| 586 | q = trtagend k lim |
| 587 | j = add k 1 |
| 588 | cl = eq mg j 47 |
| 589 | if cl |
| 590 | j = add j 1 |
| 591 | end |
| 592 | n = trname j q |
| 593 | if mist j sub n j trsvg |
| 594 | skip = not cl |
| 595 | end |
| 596 | if mist j sub n j trpre |
| 597 | trnl |
| 598 | ot trback |
| 599 | pre = not cl |
| 600 | end |
| 601 | if and not skip trblock j n |
| 602 | trnl |
| 603 | sep = false |
| 604 | else |
| 605 | if and and sep not cl not skip |
| 606 | if gt sg OBN 0 |
| 607 | if not space og sub sg OBN 1 |
| 608 | ob 32 |
| 609 | end |
| 610 | end |
| 611 | sep = false |
| 612 | end |
| 613 | if and cl not skip |
| 614 | sep = true |
| 615 | end |
| 616 | end |
| 617 | if mist j sub n j trtd |
| 618 | ob 9 |
| 619 | end |
| 620 | k = q |
| 621 | else |
| 622 | if skip |
| 623 | k = add k 1 |
| 624 | else |
| 625 | if eq mg k 38 |
| 626 | sep = false |
| 627 | k = trentity k lim |
| 628 | else |
| 629 | c = mg k |
| 630 | if and not pre space c |
| 631 | if gt sg OBN 0 |
| 632 | if not space og sub sg OBN 1 |
| 633 | ob 32 |
| 634 | end |
| 635 | end |
| 636 | else |
| 637 | sep = false |
| 638 | ob c |
| 639 | end |
| 640 | k = add k 1 |
| 641 | end |
| 642 | end |
| 643 | end |
| 644 | end |
| 645 | trnl |
| 646 | end |
| 647 | |
| 648 | fn trwrite r ulong suffix view uchar * to void |
| 649 | b = mul r 8 |
| 650 | pbroot rg add b 1 |
| 651 | pbaddm rg add b 2 rg add b 3 |
| 652 | pbadd suffix |
| 653 | wrfile rg add b 1 |
| 654 | end |
| 655 | |
| 656 | fn trforms r ulong to void |
| 657 | note HTML already passed policy checks; derivative bytes are checked by exact manifest replay. |
| 658 | a = stash |
| 659 | n = sg FLEN |
| 660 | trplain a add a n |
| 661 | trwrite r trtxt |
| 662 | p = stash |
| 663 | pn = sg FLEN |
| 664 | ot trj1 |
| 665 | trurl r trzero true |
| 666 | ot trj2 |
| 667 | ot zen |
| 668 | ot trj3 |
| 669 | trjesc p pn |
| 670 | ot trj4 |
| 671 | trjesc a n |
| 672 | ot trj5 |
| 673 | trwrite r trjson |
| 674 | end |
| 675 | |
| 676 | fn trformpath s ulong e ulong to bool |
| 677 | if ge sub e s len trtxt |
| 678 | if mist sub e len trtxt len trtxt trtxt |
| 679 | ret true |
| 680 | end |
| 681 | end |
| 682 | if ge sub e s len trjson |
| 683 | if mist sub e len trjson len trjson trjson |
| 684 | ret true |
| 685 | end |
| 686 | end |
| 687 | ret false |
| 688 | end |
| 689 | |
| 690 | fn trcli to void |
| 691 | n = argread 2 pb 0 len pb |
| 692 | if le n 0 |
| 693 | die erarg |
| 694 | end |
| 695 | put st PBL ulong n |
| 696 | put st TOP 0 |
| 697 | a = slurp |
| 698 | sz = sg FLEN |
| 699 | put st OBN 0 |
| 700 | om a sz |
| 701 | put st CXO a |
| 702 | put st CXL 0 |
| 703 | chkmark true |
| 704 | trcheck |
| 705 | end |
| 706 | |
| 707 | fn trheaders to void |
| 708 | n = argread 2 pb 0 len pb |
| 709 | if le n 0 |
| 710 | die erarg |
| 711 | end |
| 712 | put st PBL ulong n |
| 713 | put st TOP 0 |
| 714 | a = slurp |
| 715 | lim = add a sg FLEN |
| 716 | found = false |
| 717 | k = a |
| 718 | while lt k lim bound 9223372036854775807 |
| 719 | e = eol k lim |
| 720 | if trat k e trcspnm |
| 721 | p = add k len trcspnm |
| 722 | while lt p e bound 9223372036854775807 |
| 723 | while lt p e bound 9223372036854775807 |
| 724 | if not or space mg p eq mg p 59 |
| 725 | break |
| 726 | end |
| 727 | p = add p 1 |
| 728 | end |
| 729 | s = p |
| 730 | while lt p e bound 9223372036854775807 |
| 731 | if or space mg p eq mg p 59 |
| 732 | break |
| 733 | end |
| 734 | p = add p 1 |
| 735 | end |
| 736 | is = mist s sub p s trscript |
| 737 | if and trat s p trscript not is |
| 738 | die trcspbad |
| 739 | end |
| 740 | if is |
| 741 | while lt p e bound 9223372036854775807 |
| 742 | if not space mg p |
| 743 | break |
| 744 | end |
| 745 | p = add p 1 |
| 746 | end |
| 747 | if not trat p e trnone |
| 748 | die trcspbad |
| 749 | end |
| 750 | p = add p len trnone |
| 751 | while lt p e bound 9223372036854775807 |
| 752 | if not space mg p |
| 753 | break |
| 754 | end |
| 755 | p = add p 1 |
| 756 | end |
| 757 | if lt p e |
| 758 | if ne mg p 59 |
| 759 | die trcspbad |
| 760 | end |
| 761 | end |
| 762 | found = true |
| 763 | end |
| 764 | while lt p e bound 9223372034775807 |
| 765 | if eq mg p 59 |
| 766 | break |
| 767 | end |
| 768 | p = add p 1 |
| 769 | end |
| 770 | end |
| 771 | end |
| 772 | k = add e 1 |
| 773 | end |
| 774 | if not found |
| 775 | die trcspbad |
| 776 | end |
| 777 | end |