From f0c55e6b97edf8971ce4adad3ee53cbfa406b7ef Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 27 Dec 2017 20:38:53 -0800 Subject: 4165 --- html/061text.mu.html | 58 ++++++------ html/063array.mu.html | 10 +-- html/064list.mu.html | 8 +- html/065duplex_list.mu.html | 26 +++--- html/066stream.mu.html | 4 +- html/068random.mu.html | 6 +- html/075channel.mu.html | 20 ++--- html/081print.mu.html | 42 ++++----- html/084console.mu.html | 12 +-- html/088file.mu.html | 24 ++--- html/092socket.mu.html | 10 +-- html/channel.mu.html | 4 +- html/chessboard.mu.html | 26 +++--- html/console.mu.html | 2 +- html/continuation1.mu.html | 2 +- html/continuation2.mu.html | 2 +- html/continuation4.mu.html | 4 +- html/continuation5.mu.html | 4 +- html/edit/001-editor.mu.html | 24 ++--- html/edit/002-typing.mu.html | 40 ++++----- html/edit/003-shortcuts.mu.html | 124 +++++++++++++------------- html/edit/004-programming-environment.mu.html | 18 ++-- html/edit/005-sandbox.mu.html | 34 +++---- html/edit/006-sandbox-copy.mu.html | 10 +-- html/edit/007-sandbox-delete.mu.html | 4 +- html/edit/008-sandbox-edit.mu.html | 2 +- html/edit/009-sandbox-test.mu.html | 10 +-- html/edit/010-sandbox-trace.mu.html | 10 +-- html/edit/011-errors.mu.html | 6 +- html/edit/012-editor-undo.mu.html | 12 +-- html/factorial.mu.html | 2 +- html/filesystem.mu.html | 2 +- html/fork.mu.html | 4 +- html/http-client.mu.html | 2 +- html/lambda-to-mu.mu.html | 12 +-- html/nqueens.mu.html | 12 +-- html/same-fringe.mu.html | 2 +- html/tangle.mu.html | 2 +- mu.vim | 28 ++++-- 39 files changed, 317 insertions(+), 307 deletions(-) diff --git a/html/061text.mu.html b/html/061text.mu.html index 61022255..3852f0d6 100644 --- a/html/061text.mu.html +++ b/html/061text.mu.html @@ -87,9 +87,9 @@ if ('onhashchange' in window) { 25 ¦ chars-match?:bool <- equal a2, b2 26 ¦ return-unless chars-match?, 0/false 27 ¦ i <- add i, 1 - 28 ¦ loop + 28 ¦ loop 29 } - 30 return 1/true + 30 return 1/true 31 ] 32 33 scenario text-equal-reflexive [ @@ -196,7 +196,7 @@ if ('onhashchange' in window) { 134 } 135 data:&:@:_elem <- new _elem:type, capacity 136 *result <- put *result, data:offset, data - 137 return result + 137 return result 138 ] 139 140 def grow-buffer buf:&:buffer:_elem -> buf:&:buffer:_elem [ @@ -216,7 +216,7 @@ if ('onhashchange' in window) { 154 ¦ src:_elem <- index *olddata, i 155 ¦ *newdata <- put-index *newdata, i, src 156 ¦ i <- add i, 1 - 157 ¦ loop + 157 ¦ loop 158 } 159 ] 160 @@ -268,7 +268,7 @@ if ('onhashchange' in window) { 206 ¦ return-if empty? 207 ¦ len <- subtract len, 1 208 ¦ *buf <- put *buf, length:offset, len - 209 ¦ return + 209 ¦ return 210 } 211 { 212 ¦ # grow buffer if necessary @@ -293,7 +293,7 @@ if ('onhashchange' in window) { 231 ¦ x:_elem <- index *t, i 232 ¦ buf <- append buf, x 233 ¦ i <- add i, 1 - 234 ¦ loop + 234 ¦ loop 235 } 236 ] 237 @@ -413,7 +413,7 @@ if ('onhashchange' in window) { 351 ¦ src:_elem <- index *s, i 352 ¦ *result <- put-index *result, i, src 353 ¦ i <- add i, 1 - 354 ¦ loop + 354 ¦ loop 355 } 356 ] 357 @@ -448,7 +448,7 @@ if ('onhashchange' in window) { 386 ¦ break-unless arg-found? 387 ¦ loop-unless arg 388 ¦ buf <- append buf, arg - 389 ¦ loop + 389 ¦ loop 390 } 391 result <- buffer-to-array buf 392 ] @@ -593,7 +593,7 @@ if ('onhashchange' in window) { 531 ¦ a-len:num <- length *a 532 ¦ result-len <- add result-len, a-len 533 ¦ result-len <- subtract result-len, 1 - 534 ¦ loop + 534 ¦ loop 535 } 536 rewind-inputs 537 _ <- next-input # skip template @@ -618,7 +618,7 @@ if ('onhashchange' in window) { 556 ¦ ¦ *result <- put-index *result, result-idx, in 557 ¦ ¦ i <- add i, 1 558 ¦ ¦ result-idx <- add result-idx, 1 - 559 ¦ ¦ loop + 559 ¦ ¦ loop 560 ¦ } 561 ¦ # copy 'a' into result 562 ¦ j:num <- copy 0 @@ -631,11 +631,11 @@ if ('onhashchange' in window) { 569 ¦ ¦ *result <- put-index *result, result-idx, in 570 ¦ ¦ j <- add j, 1 571 ¦ ¦ result-idx <- add result-idx, 1 - 572 ¦ ¦ loop + 572 ¦ ¦ loop 573 ¦ } 574 ¦ # skip '_' in template 575 ¦ i <- add i, 1 - 576 ¦ loop # interpolate next arg + 576 ¦ loop # interpolate next arg 577 } 578 +done 579 # done with holes; copy rest of template directly into result @@ -648,7 +648,7 @@ if ('onhashchange' in window) { 586 ¦ *result <- put-index *result, result-idx, in 587 ¦ i <- add i, 1 588 ¦ result-idx <- add result-idx, 1 - 589 ¦ loop + 589 ¦ loop 590 } 591 ] 592 @@ -765,13 +765,13 @@ if ('onhashchange' in window) { 703 ¦ ¦ at-end?:bool <- greater-or-equal start, len 704 ¦ ¦ break-unless at-end? 705 ¦ ¦ result <- new character:type, 0 - 706 ¦ ¦ return + 706 ¦ ¦ return 707 ¦ } 708 ¦ curr:char <- index *s, start 709 ¦ whitespace?:bool <- space? curr 710 ¦ break-unless whitespace? 711 ¦ start <- add start, 1 - 712 ¦ loop + 712 ¦ loop 713 } 714 # right trim: compute end 715 end:num <- subtract len, 1 @@ -782,7 +782,7 @@ if ('onhashchange' in window) { 720 ¦ whitespace?:bool <- space? curr 721 ¦ break-unless whitespace? 722 ¦ end <- subtract end, 1 - 723 ¦ loop + 723 ¦ loop 724 } 725 # result = new character[end+1 - start] 726 new-len:num <- subtract end, start, -1 @@ -799,7 +799,7 @@ if ('onhashchange' in window) { 737 ¦ *result <- put-index *result, j, src 738 ¦ i <- add i, 1 739 ¦ j <- add j, 1 - 740 ¦ loop + 740 ¦ loop 741 } 742 ] 743 @@ -875,9 +875,9 @@ if ('onhashchange' in window) { 813 ¦ found?:bool <- equal curr, pattern 814 ¦ break-if found? 815 ¦ idx <- add idx, 1 - 816 ¦ loop + 816 ¦ loop 817 } - 818 return idx + 818 return idx 819 ] 820 821 scenario text-find-next [ @@ -985,9 +985,9 @@ if ('onhashchange' in window) { 923 ¦ idx <- add idx, 1 924 ¦ # optimization: skip past indices that definitely won't match 925 ¦ idx <- find-next text, first, idx - 926 ¦ loop + 926 ¦ loop 927 } - 928 return idx + 928 return idx 929 ] 930 931 scenario find-next-text-1 [ @@ -1071,9 +1071,9 @@ if ('onhashchange' in window) { 1009 ¦ return-unless match?, 0/not-found 1010 ¦ idx <- add idx, 1 1011 ¦ pattern-idx <- add pattern-idx, 1 -1012 ¦ loop +1012 ¦ loop 1013 } -1014 return 1/found +1014 return 1/found 1015 ] 1016 1017 scenario match-at-checks-pattern-at-index [ @@ -1191,7 +1191,7 @@ if ('onhashchange' in window) { 1129 ¦ empty?:bool <- equal len, 0 1130 ¦ break-unless empty? 1131 ¦ result <- new {(address array character): type}, 0 -1132 ¦ return +1132 ¦ return 1133 } 1134 # count #pieces we need room for 1135 count:num <- copy 1 # n delimiters = n+1 pieces @@ -1202,7 +1202,7 @@ if ('onhashchange' in window) { 1140 ¦ break-if done? 1141 ¦ idx <- add idx, 1 1142 ¦ count <- add count, 1 -1143 ¦ loop +1143 ¦ loop 1144 } 1145 # allocate space 1146 result <- new {(address array character): type}, count @@ -1220,7 +1220,7 @@ if ('onhashchange' in window) { 1158 ¦ # slide over to next slice 1159 ¦ start <- add end, 1 1160 ¦ curr-result <- add curr-result, 1 -1161 ¦ loop +1161 ¦ loop 1162 } 1163 ] 1164 @@ -1324,7 +1324,7 @@ if ('onhashchange' in window) { 1262 ¦ break-unless empty? 1263 ¦ x:text <- new [] 1264 ¦ y:text <- new [] -1265 ¦ return +1265 ¦ return 1266 } 1267 idx:num <- find-next text, delim, 0 1268 x:text <- copy-range text, 0, idx @@ -1365,7 +1365,7 @@ if ('onhashchange' in window) { 1303 ¦ *result <- put-index *result, dest-idx, src 1304 ¦ src-idx <- add src-idx, 1 1305 ¦ dest-idx <- add dest-idx, 1 -1306 ¦ loop +1306 ¦ loop 1307 } 1308 ] 1309 @@ -1422,7 +1422,7 @@ if ('onhashchange' in window) { 1360 ¦ result <- multiply result, 10 1361 ¦ result <- add result, digit 1362 ¦ i <- add i, 1 -1363 ¦ loop +1363 ¦ loop 1364 } 1365 # no error; all digits were valid 1366 out <- copy result diff --git a/html/063array.mu.html b/html/063array.mu.html index a80e9678..2542328c 100644 --- a/html/063array.mu.html +++ b/html/063array.mu.html @@ -82,7 +82,7 @@ if ('onhashchange' in window) { 21 ¦ curr-value:_elem, exists?:bool <- next-input 22 ¦ break-unless exists? 23 ¦ capacity <- add capacity, 1 - 24 ¦ loop + 24 ¦ loop 25 } 26 result <- new _elem:type, capacity 27 rewind-inputs @@ -95,9 +95,9 @@ if ('onhashchange' in window) { 34 ¦ assert exists?, [error in rewinding inputs to new-array] 35 ¦ *result <- put-index *result, i, curr-value 36 ¦ i <- add i, 1 - 37 ¦ loop + 37 ¦ loop 38 } - 39 return result + 39 return result 40 ] 41 42 # fill an existing array with a set of numbers @@ -114,7 +114,7 @@ if ('onhashchange' in window) { 53 ¦ break-unless arg-received? 54 ¦ *array <- put-index *array, loopn, object 55 ¦ loopn <- add loopn, 1 - 56 ¦ loop + 56 ¦ loop 57 } 58 ] 59 @@ -204,7 +204,7 @@ if ('onhashchange' in window) { 143 ¦ array <- swap array, start, end 144 ¦ start <- add start, 1 145 ¦ end <- subtract end, 1 -146 ¦ loop +146 ¦ loop 147 } 148 ] 149 diff --git a/html/064list.mu.html b/html/064list.mu.html index 88228bdb..cc383bf3 100644 --- a/html/064list.mu.html +++ b/html/064list.mu.html @@ -118,7 +118,7 @@ if ('onhashchange' in window) { 56 ¦ break-unless l 57 ¦ result <- add result, 1 58 ¦ l <- rest l - 59 ¦ loop + 59 ¦ loop 60 } 61 ] 62 @@ -387,7 +387,7 @@ if ('onhashchange' in window) { 325 { 326 ¦ break-if in 327 ¦ buf <- append buf, [[]] -328 ¦ return +328 ¦ return 329 } 330 # append in.value to buf 331 val:_elem <- get *in, value:offset @@ -403,14 +403,14 @@ if ('onhashchange' in window) { 341 ¦ break-if optional-input-found? 342 ¦ # unlimited recursion 343 ¦ buf <- to-buffer next, buf -344 ¦ return +344 ¦ return 345 } 346 { 347 ¦ break-unless remaining 348 ¦ # limited recursion 349 ¦ remaining <- subtract remaining, 1 350 ¦ buf <- to-buffer next, buf, remaining -351 ¦ return +351 ¦ return 352 } 353 # past recursion depth; insert ellipses and stop 354 append buf, [...] diff --git a/html/065duplex_list.mu.html b/html/065duplex_list.mu.html index c0557ad9..bfd37e7b 100644 --- a/html/065duplex_list.mu.html +++ b/html/065duplex_list.mu.html @@ -96,7 +96,7 @@ if ('onhashchange' in window) { 34 load-inputs 35 return-unless in, 0 36 result <- get *in, prev:offset - 37 return result + 37 return result 38 ] 39 40 scenario duplex-list-handling [ @@ -149,7 +149,7 @@ if ('onhashchange' in window) { 87 ¦ break-unless l 88 ¦ result <- add result, 1 89 ¦ l <- next l - 90 ¦ loop + 90 ¦ loop 91 } 92 ] 93 @@ -302,11 +302,11 @@ if ('onhashchange' in window) { 240 { 241 ¦ break-unless prev-node 242 ¦ *prev-node <- put *prev-node, next:offset, next-node -243 ¦ return +243 ¦ return 244 } 245 # if prev-node is null, then we removed the head node at 'in' 246 # return the new head rather than the old 'in' -247 return next-node +247 return next-node 248 ] 249 250 scenario removing-from-duplex-list [ @@ -420,7 +420,7 @@ if ('onhashchange' in window) { 358 ¦ in <- remove curr, in 359 ¦ curr <- copy next 360 ¦ i <- add i, 1 -361 ¦ loop +361 ¦ loop 362 } 363 ] 364 @@ -618,7 +618,7 @@ if ('onhashchange' in window) { 556 ¦ # next iter 557 ¦ curr <- next curr 558 ¦ idx <- add idx, 1 -559 ¦ loop +559 ¦ loop 560 } 561 ] 562 @@ -639,7 +639,7 @@ if ('onhashchange' in window) { 577 ¦ next:&:duplex-list:_elem <- next result 578 ¦ break-unless next 579 ¦ result <- copy next -580 ¦ loop +580 ¦ loop 581 } 582 ] 583 @@ -659,9 +659,9 @@ if ('onhashchange' in window) { 597 ¦ return-unless curr-matches?, 0/no-match 598 ¦ x <- next x 599 ¦ i <- add i, 1 -600 ¦ loop +600 ¦ loop 601 } -602 return 1/successful-match +602 return 1/successful-match 603 ] 604 605 scenario duplex-list-match [ @@ -704,7 +704,7 @@ if ('onhashchange' in window) { 642 ¦ ¦ $print 10/newline 643 ¦ ¦ $print x, [: ] 644 ¦ } -645 ¦ loop +645 ¦ loop 646 } 647 $print 10/newline, [---], 10/newline 648 ] @@ -745,7 +745,7 @@ if ('onhashchange' in window) { 683 { 684 ¦ break-if in 685 ¦ buf <- append buf, [[]] -686 ¦ return +686 ¦ return 687 } 688 # append in.value to buf 689 val:_elem <- get *in, value:offset @@ -761,14 +761,14 @@ if ('onhashchange' in window) { 699 ¦ break-if optional-input-found? 700 ¦ # unlimited recursion 701 ¦ buf <- to-buffer next, buf -702 ¦ return +702 ¦ return 703 } 704 { 705 ¦ break-unless remaining 706 ¦ # limited recursion 707 ¦ remaining <- subtract remaining, 1 708 ¦ buf <- to-buffer next, buf, remaining -709 ¦ return +709 ¦ return 710 } 711 # past recursion depth; insert ellipses and stop 712 append buf, [...] diff --git a/html/066stream.mu.html b/html/066stream.mu.html index 02747cbc..bc62e576 100644 --- a/html/066stream.mu.html +++ b/html/066stream.mu.html @@ -93,7 +93,7 @@ if ('onhashchange' in window) { 32 { 33 ¦ break-unless at-end? 34 ¦ empty-result:&:_elem <- new _elem:type -35 ¦ return *empty-result, 1/true +35 ¦ return *empty-result, 1/true 36 } 37 result <- index *s, idx 38 idx <- add idx, 1 @@ -112,7 +112,7 @@ if ('onhashchange' in window) { 51 { 52 ¦ break-unless at-end? 53 ¦ empty-result:&:_elem <- new _elem:type -54 ¦ return *empty-result, 1/true +54 ¦ return *empty-result, 1/true 55 } 56 result <- index *s, idx 57 ] diff --git a/html/068random.mu.html b/html/068random.mu.html index bad6f85d..ef5f172e 100644 --- a/html/068random.mu.html +++ b/html/068random.mu.html @@ -66,7 +66,7 @@ if ('onhashchange' in window) { 5 ¦ break-if generator 6 ¦ # generator is 0? use real random-number generator 7 ¦ result <- real-random - 8 ¦ return result, 0/false + 8 ¦ return result, 0/false 9 } 10 result, fail?, generator <- read generator 11 ] @@ -81,7 +81,7 @@ if ('onhashchange' in window) { 20 ¦ _, arg-received?:bool <- next-input 21 ¦ break-unless arg-received? 22 ¦ result-len <- add result-len, 1 -23 ¦ loop +23 ¦ loop 24 } 25 rewind-inputs 26 result-data:&:@:num <- new number:type, result-len @@ -91,7 +91,7 @@ if ('onhashchange' in window) { 30 ¦ break-unless arg-received? 31 ¦ *result-data <- put-index *result-data, idx, curr 32 ¦ idx <- add idx, 1 -33 ¦ loop +33 ¦ loop 34 } 35 result <- new-stream result-data 36 ] diff --git a/html/075channel.mu.html b/html/075channel.mu.html index 6aa979d9..0b432389 100644 --- a/html/075channel.mu.html +++ b/html/075channel.mu.html @@ -149,7 +149,7 @@ if ('onhashchange' in window) { 85 ¦ reset lock 86 ¦ current-routine-is-blocked 87 ¦ switch # avoid spinlocking - 88 ¦ loop + 88 ¦ loop 89 } 90 current-routine-is-unblocked 91 #? $print [performing write], 10/newline @@ -196,7 +196,7 @@ if ('onhashchange' in window) { 132 ¦ current-routine-is-blocked 133 ¦ <channel-read-empty> 134 ¦ switch # avoid spinlocking -135 ¦ loop +135 ¦ loop 136 } 137 current-routine-is-unblocked 138 # pull result off @@ -381,7 +381,7 @@ if ('onhashchange' in window) { 317 ¦ empty?:bool <- channel-empty? chan 318 ¦ break-if empty? 319 ¦ _, _, in <- read in -320 ¦ loop +320 ¦ loop 321 } 322 ] 323 @@ -424,7 +424,7 @@ if ('onhashchange' in window) { 360 ¦ break-unless closed? 361 ¦ empty-result:&:_elem <- new _elem:type 362 ¦ current-routine-is-unblocked -363 ¦ return *empty-result, 1/true +363 ¦ return *empty-result, 1/true 364 } 365 ] 366 @@ -495,13 +495,13 @@ if ('onhashchange' in window) { 431 ¦ ¦ ¦ ¦ *line <- put *line, length:offset, buffer-length 432 ¦ ¦ ¦ } 433 ¦ ¦ ¦ # and don't append this one -434 ¦ ¦ ¦ loop +next-character +434 ¦ ¦ ¦ loop +next-character 435 ¦ ¦ } 436 ¦ ¦ # append anything else 437 ¦ ¦ line <- append line, c 438 ¦ ¦ line-done?:bool <- equal c, 10/newline 439 ¦ ¦ break-if line-done? -440 ¦ ¦ loop +440 ¦ ¦ loop 441 ¦ } 442 ¦ # copy line into 'buffered-out' 443 ¦ i:num <- copy 0 @@ -513,14 +513,14 @@ if ('onhashchange' in window) { 449 ¦ ¦ c:char <- index *line-contents, i 450 ¦ ¦ buffered-out <- write buffered-out, c 451 ¦ ¦ i <- add i, 1 -452 ¦ ¦ loop +452 ¦ ¦ loop 453 ¦ } 454 ¦ { 455 ¦ ¦ break-unless eof? 456 ¦ ¦ buffered-out <- close buffered-out -457 ¦ ¦ return +457 ¦ ¦ return 458 ¦ } -459 ¦ loop +459 ¦ loop 460 } 461 ] 462 @@ -576,7 +576,7 @@ if ('onhashchange' in window) { 512 ¦ c:char, done?:bool <- read source 513 ¦ break-if done? 514 ¦ buf <- append buf, c -515 ¦ loop +515 ¦ loop 516 } 517 result <- buffer-to-array buf 518 ] diff --git a/html/081print.mu.html b/html/081print.mu.html index a7e278be..b9751aa4 100644 --- a/html/081print.mu.html +++ b/html/081print.mu.html @@ -114,7 +114,7 @@ if ('onhashchange' in window) { 51 ¦ break-if screen 52 ¦ # real screen 53 ¦ clear-display - 54 ¦ return + 54 ¦ return 55 } 56 # fake screen 57 buf:&:@:screen-cell <- get *screen, data:offset @@ -126,7 +126,7 @@ if ('onhashchange' in window) { 63 ¦ curr:screen-cell <- merge 0/empty, 7/white 64 ¦ *buf <- put-index *buf, i, curr 65 ¦ i <- add i, 1 - 66 ¦ loop + 66 ¦ loop 67 } 68 # reset cursor 69 *screen <- put *screen, cursor-row:offset, 0 @@ -150,9 +150,9 @@ if ('onhashchange' in window) { 87 ¦ i <- add i, 1 88 ¦ loop-unless curr-contents 89 ¦ # not 0 - 90 ¦ return 0/false + 90 ¦ return 0/false 91 } - 92 return 1/true + 92 return 1/true 93 ] 94 95 def print screen:&:screen, c:char -> screen:&:screen [ @@ -176,7 +176,7 @@ if ('onhashchange' in window) { 113 ¦ # real screen 114 ¦ break-if screen 115 ¦ print-character-to-display c, color, bg-color -116 ¦ return +116 ¦ return 117 } 118 # fake screen 119 # (handle special cases exactly like in the real screen) @@ -221,14 +221,14 @@ if ('onhashchange' in window) { 158 ¦ newline?:bool <- equal c, 10/newline 159 ¦ break-unless newline? 160 ¦ cursor-down-on-fake-screen screen # doesn't modify column -161 ¦ return +161 ¦ return 162 } 163 # special-case: linefeed 164 { 165 ¦ linefeed?:bool <- equal c, 13/linefeed 166 ¦ break-unless linefeed? 167 ¦ *screen <- put *screen, cursor-column:offset, 0 -168 ¦ return +168 ¦ return 169 } 170 # special-case: backspace 171 # moves cursor left but does not erase @@ -240,7 +240,7 @@ if ('onhashchange' in window) { 177 ¦ ¦ column <- subtract column, 1 178 ¦ ¦ *screen <- put *screen, cursor-column:offset, column 179 ¦ } -180 ¦ return +180 ¦ return 181 } 182 # save character in fake screen 183 top-idx:num <- get *screen, top-idx:offset @@ -303,7 +303,7 @@ if ('onhashchange' in window) { 240 ¦ top-idx <- add top-idx, 1 241 ¦ # no modulo; top-idx is always a multiple of width, 242 ¦ # so it can never wrap around inside this loop -243 ¦ loop +243 ¦ loop 244 } 245 # top-idx now same as next-top-idx; wrap around if necessary 246 capacity:num <- multiply width, height @@ -593,7 +593,7 @@ if ('onhashchange' in window) { 530 ¦ break-if screen 531 ¦ # real screen 532 ¦ clear-line-on-display -533 ¦ return +533 ¦ return 534 } 535 # fake screen 536 width:num <- get *screen, num-columns:offset @@ -606,7 +606,7 @@ if ('onhashchange' in window) { 543 ¦ break-if done? 544 ¦ print screen, space 545 ¦ column <- add column, 1 -546 ¦ loop +546 ¦ loop 547 } 548 # now back to where the cursor was 549 *screen <- put *screen, cursor-column:offset, original-column @@ -633,7 +633,7 @@ if ('onhashchange' in window) { 570 ¦ break-if done? 571 ¦ screen <- print screen, space, 7/white, bg-color # foreground color is mostly unused except if the cursor shows up at this cell 572 ¦ column <- add column, 1 -573 ¦ loop +573 ¦ loop 574 } 575 ] 576 @@ -644,7 +644,7 @@ if ('onhashchange' in window) { 581 ¦ break-if screen 582 ¦ # real screen 583 ¦ row, column <- cursor-position-on-display -584 ¦ return +584 ¦ return 585 } 586 # fake screen 587 row:num <- get *screen, cursor-row:offset @@ -659,7 +659,7 @@ if ('onhashchange' in window) { 596 ¦ break-if screen 597 ¦ # real screen 598 ¦ move-cursor-on-display new-row, new-column -599 ¦ return +599 ¦ return 600 } 601 # fake screen 602 *screen <- put *screen, cursor-row:offset, new-row @@ -713,7 +713,7 @@ if ('onhashchange' in window) { 650 ¦ break-if screen 651 ¦ # real screen 652 ¦ move-cursor-down-on-display -653 ¦ return +653 ¦ return 654 } 655 # fake screen 656 cursor-down-on-fake-screen screen @@ -756,7 +756,7 @@ if ('onhashchange' in window) { 693 ¦ break-if screen 694 ¦ # real screen 695 ¦ move-cursor-up-on-display -696 ¦ return +696 ¦ return 697 } 698 # fake screen 699 row:num <- get *screen, cursor-row:offset @@ -774,7 +774,7 @@ if ('onhashchange' in window) { 711 ¦ break-if screen 712 ¦ # real screen 713 ¦ move-cursor-right-on-display -714 ¦ return +714 ¦ return 715 } 716 # fake screen 717 width:num <- get *screen, num-columns:offset @@ -794,7 +794,7 @@ if ('onhashchange' in window) { 731 ¦ break-if screen 732 ¦ # real screen 733 ¦ move-cursor-left-on-display -734 ¦ return +734 ¦ return 735 } 736 # fake screen 737 column:num <- get *screen, cursor-column:offset @@ -836,7 +836,7 @@ if ('onhashchange' in window) { 773 ¦ break-unless screen 774 ¦ # fake screen 775 ¦ width <- get *screen, num-columns:offset -776 ¦ return +776 ¦ return 777 } 778 # real screen 779 width <- display-width @@ -850,7 +850,7 @@ if ('onhashchange' in window) { 787 ¦ break-unless screen 788 ¦ # fake screen 789 ¦ height <- get *screen, num-rows:offset -790 ¦ return +790 ¦ return 791 } 792 # real screen 793 height <- display-height @@ -879,7 +879,7 @@ if ('onhashchange' in window) { 816 ¦ c:char <- index *s, i 817 ¦ print screen, c, color, bg-color 818 ¦ i <- add i, 1 -819 ¦ loop +819 ¦ loop 820 } 821 ] 822 diff --git a/html/084console.mu.html b/html/084console.mu.html index 635710f5..2364af89 100644 --- a/html/084console.mu.html +++ b/html/084console.mu.html @@ -105,16 +105,16 @@ if ('onhashchange' in window) { 44 ¦ ¦ done?:bool <- greater-or-equal current-event-index, max 45 ¦ ¦ break-unless done? 46 ¦ ¦ dummy:&:event <- new event:type - 47 ¦ ¦ return *dummy, 1/found, 1/quit + 47 ¦ ¦ return *dummy, 1/found, 1/quit 48 ¦ } 49 ¦ result <- index *buf, current-event-index 50 ¦ current-event-index <- add current-event-index, 1 51 ¦ *console <- put *console, current-event-index:offset, current-event-index - 52 ¦ return result, 1/found, 0/quit + 52 ¦ return result, 1/found, 0/quit 53 } 54 switch # real event source is infrequent; avoid polling it too much 55 result:event, found?:bool <- check-for-interaction - 56 return result, found?, 0/quit + 56 return result, found?, 0/quit 57 ] 58 59 # variant of read-event for just keyboard events. Discards everything that @@ -128,7 +128,7 @@ if ('onhashchange' in window) { 67 return-unless found?, 0, found?, quit? 68 c:char, converted?:bool <- maybe-convert x, text:variant 69 return-unless converted?, 0, 0/found, 0/quit - 70 return c, 1/found, 0/quit + 70 return c, 1/found, 0/quit 71 ] 72 73 def send-keys-to-channel console:&:console, chan:&:sink:char, screen:&:screen -> console:&:console, chan:&:sink:char, screen:&:screen [ @@ -141,7 +141,7 @@ if ('onhashchange' in window) { 80 ¦ assert c, [invalid event, expected text] 81 ¦ screen <- print screen, c 82 ¦ chan <- write chan, c - 83 ¦ loop + 83 ¦ loop 84 } 85 chan <- close chan 86 ] @@ -153,7 +153,7 @@ if ('onhashchange' in window) { 92 ¦ _, found?:bool <- read-event console 93 ¦ break-if found? 94 ¦ switch - 95 ¦ loop + 95 ¦ loop 96 } 97 ] 98 diff --git a/html/088file.mu.html b/html/088file.mu.html index 686127dc..dab16db6 100644 --- a/html/088file.mu.html +++ b/html/088file.mu.html @@ -87,7 +87,7 @@ if ('onhashchange' in window) { 26 ¦ break-unless resources 27 ¦ # fake file system 28 ¦ contents, error? <- start-reading-from-fake-resource resources, filename - 29 ¦ return + 29 ¦ return 30 } 31 # real file system 32 file:num <- $open-file-for-reading filename @@ -106,7 +106,7 @@ if ('onhashchange' in window) { 45 ¦ c:char, done?:bool, source <- read source 46 ¦ break-if done? 47 ¦ buf <- append buf, c - 48 ¦ loop + 48 ¦ loop 49 } 50 contents <- buffer-to-array buf 51 ] @@ -129,9 +129,9 @@ if ('onhashchange' in window) { 68 ¦ contents:&:source:char, sink:&:sink:char <- new-channel 30 69 ¦ curr-contents:text <- get tmp, contents:offset 70 ¦ start-running receive-from-text curr-contents, sink - 71 ¦ return + 71 ¦ return 72 } - 73 return 0/not-found, 1/error + 73 return 0/not-found, 1/error 74 ] 75 76 def receive-from-file file:num, sink:&:sink:char -> sink:&:sink:char [ @@ -141,7 +141,7 @@ if ('onhashchange' in window) { 80 ¦ c:char, eof?:bool <- $read-from-file file 81 ¦ break-if eof? 82 ¦ sink <- write sink, c - 83 ¦ loop + 83 ¦ loop 84 } 85 sink <- close sink 86 file <- $close-file file @@ -158,7 +158,7 @@ if ('onhashchange' in window) { 97 ¦ c:char <- index *contents, i 98 ¦ sink <- write sink, c 99 ¦ i <- add i, 1 -100 ¦ loop +100 ¦ loop 101 } 102 sink <- close sink 103 ] @@ -172,7 +172,7 @@ if ('onhashchange' in window) { 111 ¦ break-unless resources 112 ¦ # fake file system 113 ¦ routine-id <- start-running transmit-to-fake-resource resources, filename, source -114 ¦ return +114 ¦ return 115 } 116 # real file system 117 file:num <- $open-file-for-writing filename @@ -200,7 +200,7 @@ if ('onhashchange' in window) { 139 ¦ c:char <- index *contents, i 140 ¦ sink-file <- write sink-file, c 141 ¦ i <- add i, 1 -142 ¦ loop +142 ¦ loop 143 } 144 close sink-file 145 # make sure to wait for the file to be actually written to disk @@ -215,7 +215,7 @@ if ('onhashchange' in window) { 154 ¦ c:char, done?:bool, source <- read source 155 ¦ break-if done? 156 ¦ $write-to-file file, c -157 ¦ loop +157 ¦ loop 158 } 159 file <- $close-file file 160 ] @@ -231,7 +231,7 @@ if ('onhashchange' in window) { 170 ¦ c:char, done?:bool, source <- read source 171 ¦ break-if done? 172 ¦ buf <- append buf, c -173 ¦ loop +173 ¦ loop 174 } 175 contents:text <- buffer-to-array buf 176 new-resource:resource <- merge filename, contents @@ -250,10 +250,10 @@ if ('onhashchange' in window) { 189 ¦ { 190 ¦ ¦ break-unless found? 191 ¦ ¦ put-index *data, i, new-resource -192 ¦ ¦ jump +unlock-and-exit +192 ¦ ¦ jump +unlock-and-exit 193 ¦ } 194 ¦ i <- add i, 1 -195 ¦ loop +195 ¦ loop 196 } 197 # if file didn't already exist, make room for it 198 new-len:num <- add len, 1 diff --git a/html/092socket.mu.html b/html/092socket.mu.html index b26e42b7..7b49de34 100644 --- a/html/092socket.mu.html +++ b/html/092socket.mu.html @@ -88,7 +88,7 @@ if ('onhashchange' in window) { 26 def example-handler query:text -> response:text [ 27 local-scope 28 load-inputs - 29 return [abc] + 29 return [abc] 30 ] 31 32 # To test client operations, use 'assume-resources' with a filename that @@ -140,7 +140,7 @@ if ('onhashchange' in window) { 78 ¦ break-unless resources 79 ¦ # fake network 80 ¦ contents <- start-reading-from-fake-resource resources, uri - 81 ¦ return + 81 ¦ return 82 } 83 # real network 84 host:text, path:text <- split-at uri, 47/slash @@ -179,7 +179,7 @@ if ('onhashchange' in window) { 117 ¦ ¦ break-if found? 118 ¦ ¦ switch 119 ¦ } -120 ¦ loop +120 ¦ loop 121 } 122 sink <- close sink 123 ] @@ -202,7 +202,7 @@ if ('onhashchange' in window) { 140 ¦ c:char <- index *s, i 141 ¦ $write-to-socket socket, c 142 ¦ i <- add i, 1 -143 ¦ loop +143 ¦ loop 144 } 145 ] 146 @@ -217,7 +217,7 @@ if ('onhashchange' in window) { 155 ¦ break-unless empty? 156 ¦ x:text <- new [] 157 ¦ y:text <- new [] -158 ¦ return +158 ¦ return 159 } 160 idx:num <- find-next text, delim, 0 161 x:text <- copy-range text, 0, idx diff --git a/html/channel.mu.html b/html/channel.mu.html index d3ce4953..4aad1713 100644 --- a/html/channel.mu.html +++ b/html/channel.mu.html @@ -74,7 +74,7 @@ if ('onhashchange' in window) { 14 ] 15 ¦ sink <- write sink, n 16 ¦ n <- add n, 1 -17 ¦ loop +17 ¦ loop 18 } 19 close sink 20 ] @@ -90,7 +90,7 @@ if ('onhashchange' in window) { 30 ¦ # other threads might get between these prints 31 ¦ $print [consume: ], n:char, [ 32 ] -33 ¦ loop +33 ¦ loop 34 } 35 ] 36 diff --git a/html/chessboard.mu.html b/html/chessboard.mu.html index 3ad48a2d..34e6d9ee 100644 --- a/html/chessboard.mu.html +++ b/html/chessboard.mu.html @@ -161,7 +161,7 @@ if ('onhashchange' in window) { 97 ¦ } 98 ¦ board <- make-move board, m 99 ¦ screen <- clear-screen screen -100 ¦ loop +100 ¦ loop 101 } 102 +quit 103 ] @@ -184,7 +184,7 @@ if ('onhashchange' in window) { 120 ¦ file:&:@:char <- new-file initial-position, col 121 ¦ *board <- put-index *board, col, file 122 ¦ col <- add col, 1 -123 ¦ loop +123 ¦ loop 124 } 125 ] 126 @@ -201,7 +201,7 @@ if ('onhashchange' in window) { 137 ¦ *result <- put-index *result, row, square 138 ¦ row <- add row, 1 139 ¦ index <- add index, 1 -140 ¦ loop +140 ¦ loop 141 } 142 ] 143 @@ -228,11 +228,11 @@ if ('onhashchange' in window) { 164 ¦ ¦ print screen, c 165 ¦ ¦ print screen, space 166 ¦ ¦ col <- add col, 1 -167 ¦ ¦ loop +167 ¦ ¦ loop 168 ¦ } 169 ¦ row <- subtract row, 1 170 ¦ cursor-to-next-line screen -171 ¦ loop +171 ¦ loop 172 } 173 # print file letters as legend 174 print screen, [ +----------------] @@ -342,7 +342,7 @@ if ('onhashchange' in window) { 278 ¦ newline?:bool <- equal c, 10/newline 279 ¦ break-unless newline? 280 ¦ print screen, [that's not enough] -281 ¦ return 0/dummy, 0/quit, 1/error +281 ¦ return 0/dummy, 0/quit, 1/error 282 } 283 file:num <- subtract c, 97/a 284 # 'a' <= file <= 'h' @@ -352,16 +352,16 @@ if ('onhashchange' in window) { 288 ¦ print screen, [file too low: ] 289 ¦ print screen, c 290 ¦ cursor-to-next-line screen -291 ¦ return 0/dummy, 0/quit, 1/error +291 ¦ return 0/dummy, 0/quit, 1/error 292 } 293 { 294 ¦ below-max:bool <- lesser-than file, 8 295 ¦ break-if below-max 296 ¦ print screen, [file too high: ] 297 ¦ print screen, c -298 ¦ return 0/dummy, 0/quit, 1/error +298 ¦ return 0/dummy, 0/quit, 1/error 299 } -300 return file, 0/quit, 0/error +300 return file, 0/quit, 0/error 301 ] 302 303 # valid values for rank: 0-7 @@ -380,7 +380,7 @@ if ('onhashchange' in window) { 316 ¦ newline?:bool <- equal c, 10 # newline 317 ¦ break-unless newline? 318 ¦ print screen, [that's not enough] -319 ¦ return 0/dummy, 0/quit, 1/error +319 ¦ return 0/dummy, 0/quit, 1/error 320 } 321 rank:num <- subtract c, 49/'1' 322 # assert'1' <= rank <= '8' @@ -389,16 +389,16 @@ if ('onhashchange' in window) { 325 ¦ break-if above-min 326 ¦ print screen, [rank too low: ] 327 ¦ print screen, c -328 ¦ return 0/dummy, 0/quit, 1/error +328 ¦ return 0/dummy, 0/quit, 1/error 329 } 330 { 331 ¦ below-max:bool <- lesser-or-equal rank, 7 332 ¦ break-if below-max 333 ¦ print screen, [rank too high: ] 334 ¦ print screen, c -335 ¦ return 0/dummy, 0/quit, 1/error +335 ¦ return 0/dummy, 0/quit, 1/error 336 } -337 return rank, 0/quit, 0/error +337 return rank, 0/quit, 0/error 338 ] 339 340 # read a character from the given channel and check that it's what we expect diff --git a/html/console.mu.html b/html/console.mu.html index 5b6682c1..97304cc9 100644 --- a/html/console.mu.html +++ b/html/console.mu.html @@ -69,7 +69,7 @@ if ('onhashchange' in window) { 9 ¦ e:event, found?:bool <- check-for-interaction 10 ¦ break-if found? 11 ¦ print-character-to-display 97, 7/white -12 ¦ loop +12 ¦ loop 13 } 14 close-console 15 $print e, 10/newline diff --git a/html/continuation1.mu.html b/html/continuation1.mu.html index 0d652ffd..7eeca335 100644 --- a/html/continuation1.mu.html +++ b/html/continuation1.mu.html @@ -79,7 +79,7 @@ if ('onhashchange' in window) { 21 local-scope 22 load-inputs 23 return-continuation-until-mark 100/mark -24 return 1 +24 return 1 25 ] diff --git a/html/continuation2.mu.html b/html/continuation2.mu.html index 7746bca0..997c54bc 100644 --- a/html/continuation2.mu.html +++ b/html/continuation2.mu.html @@ -82,7 +82,7 @@ if ('onhashchange' in window) { 22 ¦ x:num, done?:bool <- call k 23 ¦ break-if done? 24 ¦ $print x 10/newline -25 ¦ loop +25 ¦ loop 26 } 27 ] 28 diff --git a/html/continuation4.mu.html b/html/continuation4.mu.html index 7e62e661..ecb81b8a 100644 --- a/html/continuation4.mu.html +++ b/html/continuation4.mu.html @@ -84,7 +84,7 @@ if ('onhashchange' in window) { 24 ¦ break-if done? 25 ¦ $print x 10/newline 26 ¦ k, x:num, done?:bool <- call k -27 ¦ loop +27 ¦ loop 28 } 29 ] 30 @@ -97,7 +97,7 @@ if ('onhashchange' in window) { 37 ¦ n <- first l 38 ¦ l <- rest l 39 ¦ return-continuation-until-mark 100/mark, n, done? -40 ¦ loop +40 ¦ loop 41 } 42 # A function that returns continuations shouldn't get the opportunity to 43 # return. Calling functions should stop calling its continuation after this diff --git a/html/continuation5.mu.html b/html/continuation5.mu.html index b0b45a3b..27da4fff 100644 --- a/html/continuation5.mu.html +++ b/html/continuation5.mu.html @@ -87,7 +87,7 @@ if ('onhashchange' in window) { 27 ¦ $print x 10/newline 28 ¦ k, x:num, done?:bool <- call k, a # resume; x = a + next l value 29 ¦ a <- add a, 1 -30 ¦ loop +30 ¦ loop 31 } 32 ] 33 @@ -102,7 +102,7 @@ if ('onhashchange' in window) { 42 ¦ l <- rest l 43 ¦ n <- add n, a 44 ¦ a <- return-continuation-until-mark 100/mark, n, done? # pause/resume -45 ¦ loop +45 ¦ loop 46 } 47 return-continuation-until-mark 100/mark, -1, done? 48 assert 0/false, [called too many times, ran out of continuations to return] diff --git a/html/edit/001-editor.mu.html b/html/edit/001-editor.mu.html index 73ae7ae3..ae537bc5 100644 --- a/html/edit/001-editor.mu.html +++ b/html/edit/001-editor.mu.html @@ -225,7 +225,7 @@ if ('onhashchange' in window) { 161 ¦ ¦ screen <- move-cursor screen, row, column 162 ¦ ¦ curr <- next curr 163 ¦ ¦ prev <- next prev -164 ¦ ¦ loop +next-character +164 ¦ ¦ loop +next-character 165 ¦ } 166 ¦ { 167 ¦ ¦ # at right? wrap. even if there's only one more letter left; we need @@ -239,13 +239,13 @@ if ('onhashchange' in window) { 175 ¦ ¦ row <- add row, 1 176 ¦ ¦ screen <- move-cursor screen, row, column 177 ¦ ¦ # don't increment curr -178 ¦ ¦ loop +next-character +178 ¦ ¦ loop +next-character 179 ¦ } 180 ¦ print screen, c, color 181 ¦ curr <- next curr 182 ¦ prev <- next prev 183 ¦ column <- add column, 1 -184 ¦ loop +184 ¦ loop 185 } 186 # save first character off-screen 187 *editor <- put *editor, bottom-of-screen:offset, curr @@ -265,7 +265,7 @@ if ('onhashchange' in window) { 201 *editor <- put *editor, cursor-row:offset, cursor-row 202 *editor <- put *editor, cursor-column:offset, cursor-column 203 *editor <- put *editor, before-cursor:offset, before-cursor -204 return row, column +204 return row, column 205 ] 206 207 def clear-screen-from screen:&:screen, row:num, column:num, left:num, right:num -> screen:&:screen [ @@ -276,7 +276,7 @@ if ('onhashchange' in window) { 212 { 213 ¦ break-if screen 214 ¦ clear-display-from row, column, left, right -215 ¦ return +215 ¦ return 216 } 217 # if not, go the slower route 218 screen <- move-cursor screen, row, column @@ -292,7 +292,7 @@ if ('onhashchange' in window) { 228 { 229 ¦ break-if screen 230 ¦ clear-display-from row, left, left, right -231 ¦ return +231 ¦ return 232 } 233 screen <- move-cursor screen, row, left 234 screen-height:num <- screen-height screen @@ -302,7 +302,7 @@ if ('onhashchange' in window) { 238 ¦ screen <- move-cursor screen, row, left 239 ¦ clear-line-until screen, right 240 ¦ row <- add row, 1 -241 ¦ loop +241 ¦ loop 242 } 243 ] 244 @@ -468,7 +468,7 @@ if ('onhashchange' in window) { 404 ¦ starting-comment?:bool <- equal c, 35/# 405 ¦ break-unless starting-comment? 406 ¦ trace 90, [app], [switch color back to blue] -407 ¦ return 12/lightblue +407 ¦ return 12/lightblue 408 } 409 # if color is blue and next character is newline, switch color to white 410 { @@ -477,14 +477,14 @@ if ('onhashchange' in window) { 413 ¦ ending-comment?:bool <- equal c, 10/newline 414 ¦ break-unless ending-comment? 415 ¦ trace 90, [app], [switch color back to white] -416 ¦ return 7/white +416 ¦ return 7/white 417 } 418 # if color is white (no comments) and next character is '<', switch color to red 419 { 420 ¦ break-unless color-is-white? 421 ¦ starting-assignment?:bool <- equal c, 60/< 422 ¦ break-unless starting-assignment? -423 ¦ return 1/red +423 ¦ return 1/red 424 } 425 # if color is red and next character is space, switch color to white 426 { @@ -492,10 +492,10 @@ if ('onhashchange' in window) { 428 ¦ break-unless color-is-red? 429 ¦ ending-assignment?:bool <- equal c, 32/space 430 ¦ break-unless ending-assignment? -431 ¦ return 7/white +431 ¦ return 7/white 432 } 433 # otherwise no change -434 return color +434 return color 435 ] 436 437 scenario render-colors-assignment [ diff --git a/html/edit/002-typing.mu.html b/html/edit/002-typing.mu.html index e05555a2..477bee1d 100644 --- a/html/edit/002-typing.mu.html +++ b/html/edit/002-typing.mu.html @@ -94,7 +94,7 @@ if ('onhashchange' in window) { 31 ¦ { 32 ¦ ¦ break-unless is-touch? 33 ¦ ¦ move-cursor editor, screen, t - 34 ¦ ¦ loop +next-event + 34 ¦ ¦ loop +next-event 35 ¦ } 36 ¦ # keyboard events 37 ¦ { @@ -105,7 +105,7 @@ if ('onhashchange' in window) { 42 ¦ ¦ ¦ screen <- editor-render screen, editor 43 ¦ ¦ } 44 ¦ } - 45 ¦ loop + 45 ¦ loop 46 } 47 ] 48 @@ -129,7 +129,7 @@ if ('onhashchange' in window) { 66 undo-coalesce-tag:num <- copy 0/never 67 <end-move-cursor> 68 # gain focus - 69 return 1/true + 69 return 1/true 70 ] 71 72 # Variant of 'render' that only moves the cursor (coordinates and @@ -190,7 +190,7 @@ if ('onhashchange' in window) { 127 ¦ ¦ column <- copy left 128 ¦ ¦ curr <- next curr 129 ¦ ¦ prev <- next prev - 130 ¦ ¦ loop +next-character + 130 ¦ ¦ loop +next-character 131 ¦ } 132 ¦ { 133 ¦ ¦ # at right? wrap. even if there's only one more letter left; we need @@ -200,12 +200,12 @@ if ('onhashchange' in window) { 137 ¦ ¦ column <- copy left 138 ¦ ¦ row <- add row, 1 139 ¦ ¦ # don't increment curr/prev - 140 ¦ ¦ loop +next-character + 140 ¦ ¦ loop +next-character 141 ¦ } 142 ¦ curr <- next curr 143 ¦ prev <- next prev 144 ¦ column <- add column, 1 - 145 ¦ loop + 145 ¦ loop 146 } 147 # is cursor to the right of the last line? move to end 148 { @@ -253,14 +253,14 @@ if ('onhashchange' in window) { 190 ¦ <begin-insert-character> 191 ¦ go-render? <- insert-at-cursor editor, c, screen 192 ¦ <end-insert-character> - 193 ¦ return + 193 ¦ return 194 } 195 # special key to modify the text or move the cursor 196 k:num, is-keycode?:bool <- maybe-convert e:event, keycode:variant 197 assert is-keycode?, [event was of unknown type; neither keyboard nor mouse] 198 # handlers for each special key will go here 199 <handle-special-key> - 200 return 1/go-render + 200 return 1/go-render 201 ] 202 203 def insert-at-cursor editor:&:editor, c:char, screen:&:screen -> go-render?:bool, editor:&:editor, screen:&:screen [ @@ -295,7 +295,7 @@ if ('onhashchange' in window) { 232 ¦ break-if overflow? 233 ¦ move-cursor screen, save-row, save-column 234 ¦ print screen, c - 235 ¦ return 0/don't-render + 235 ¦ return 0/don't-render 236 } 237 { 238 ¦ # not at right margin? print the character and rest of line @@ -317,11 +317,11 @@ if ('onhashchange' in window) { 254 ¦ ¦ print screen, currc 255 ¦ ¦ curr-column <- add curr-column, 1 256 ¦ ¦ curr <- next curr - 257 ¦ ¦ loop + 257 ¦ ¦ loop 258 ¦ } - 259 ¦ return 0/don't-render + 259 ¦ return 0/don't-render 260 } - 261 return 1/go-render + 261 return 1/go-render 262 ] 263 264 # helper for tests @@ -800,7 +800,7 @@ if ('onhashchange' in window) { 737 ¦ ¦ break-unless below-screen? 738 ¦ ¦ <scroll-down> 739 ¦ } - 740 ¦ return 1/go-render + 740 ¦ return 1/go-render 741 } 742 ] 743 @@ -924,7 +924,7 @@ if ('onhashchange' in window) { 861 ¦ <begin-insert-enter> 862 ¦ insert-new-line-and-indent editor, screen 863 ¦ <end-insert-enter> - 864 ¦ return 1/go-render + 864 ¦ return 1/go-render 865 } 866 ] 867 @@ -970,7 +970,7 @@ if ('onhashchange' in window) { 907 ¦ break-if indent-done? 908 ¦ insert-at-cursor editor, 32/space, screen 909 ¦ i <- add i, 1 - 910 ¦ loop + 910 ¦ loop 911 } 912 ] 913 @@ -989,7 +989,7 @@ if ('onhashchange' in window) { 926 return-if cursor-after-newline?, 0/false 927 # if cursor is at left margin and not at start, but previous character is not a newline, 928 # then we're at start of a wrapped line - 929 return 1/true + 929 return 1/true 930 ] 931 932 # takes a pointer 'curr' into the doubly-linked list and its sentinel, counts @@ -1020,7 +1020,7 @@ if ('onhashchange' in window) { 957 ¦ ¦ break-if is-space? 958 ¦ ¦ result <- copy 0 959 ¦ } - 960 ¦ loop + 960 ¦ loop 961 } 962 ] 963 @@ -1161,7 +1161,7 @@ if ('onhashchange' in window) { 1098 ¦ paste-start?:bool <- equal k, 65507/paste-start 1099 ¦ break-unless paste-start? 1100 ¦ *editor <- put *editor, indent?:offset, 0/false -1101 ¦ return 1/go-render +1101 ¦ return 1/go-render 1102 } 1103 ] 1104 @@ -1170,7 +1170,7 @@ if ('onhashchange' in window) { 1107 ¦ paste-end?:bool <- equal k, 65506/paste-end 1108 ¦ break-unless paste-end? 1109 ¦ *editor <- put *editor, indent?:offset, 1/true -1110 ¦ return 1/go-render +1110 ¦ return 1/go-render 1111 } 1112 ] 1113 @@ -1204,7 +1204,7 @@ if ('onhashchange' in window) { 1141 ¦ break-unless continue? 1142 ¦ print screen, style, color, bg-color 1143 ¦ x <- add x, 1 -1144 ¦ loop +1144 ¦ loop 1145 } 1146 ] diff --git a/html/edit/003-shortcuts.mu.html b/html/edit/003-shortcuts.mu.html index 89d573d7..ce5f7289 100644 --- a/html/edit/003-shortcuts.mu.html +++ b/html/edit/003-shortcuts.mu.html @@ -120,7 +120,7 @@ if ('onhashchange' in window) { 58 ¦ insert-at-cursor editor, 32/space, screen 59 ¦ go-render? <- insert-at-cursor editor, 32/space, screen 60 ¦ <end-insert-character> - 61 ¦ return + 61 ¦ return 62 } 63 ] 64 @@ -161,7 +161,7 @@ if ('onhashchange' in window) { 99 ¦ <begin-backspace-character> 100 ¦ go-render?:bool, backspaced-cell:&:duplex-list:char <- delete-before-cursor editor, screen 101 ¦ <end-backspace-character> - 102 ¦ return + 102 ¦ return 103 } 104 ] 105 @@ -207,7 +207,7 @@ if ('onhashchange' in window) { 145 ¦ screen <- print screen, currc 146 ¦ curr-column <- add curr-column, 1 147 ¦ curr <- next curr - 148 ¦ loop + 148 ¦ loop 149 } 150 # we're guaranteed not to be at the right margin 151 space:char <- copy 32/space @@ -230,7 +230,7 @@ if ('onhashchange' in window) { 168 ¦ trace 10, [app], [decrementing cursor column] 169 ¦ cursor-column <- subtract cursor-column, 1 170 ¦ *editor <- put *editor, cursor-column:offset, cursor-column - 171 ¦ return + 171 ¦ return 172 } 173 # if at left margin, we must move to previous row: 174 top-of-screen?:bool <- equal cursor-row, 1 # exclude menu bar @@ -267,7 +267,7 @@ if ('onhashchange' in window) { 205 ¦ ¦ cursor-column <- add left, end-of-line 206 ¦ ¦ *editor <- put *editor, cursor-column:offset, cursor-column 207 ¦ } - 208 ¦ return + 208 ¦ return 209 } 210 # case 2: if previous-character was not newline, we're just at a wrapped line 211 trace 10, [app], [wrapping to previous line] @@ -294,7 +294,7 @@ if ('onhashchange' in window) { 232 ¦ at-newline?:bool <- equal c, 10/newline 233 ¦ break-if at-newline? 234 ¦ result <- add result, 1 - 235 ¦ loop + 235 ¦ loop 236 } 237 ] 238 @@ -428,7 +428,7 @@ if ('onhashchange' in window) { 366 ¦ <begin-delete-character> 367 ¦ go-render?:bool, deleted-cell:&:duplex-list:char <- delete-at-cursor editor, screen 368 ¦ <end-delete-character> - 369 ¦ return + 369 ¦ return 370 } 371 ] 372 @@ -461,7 +461,7 @@ if ('onhashchange' in window) { 399 ¦ screen <- print screen, currc 400 ¦ curr-column <- add curr-column, 1 401 ¦ curr <- next curr - 402 ¦ loop + 402 ¦ loop 403 } 404 # we're guaranteed not to be at the right margin 405 space:char <- copy 32/space @@ -508,7 +508,7 @@ if ('onhashchange' in window) { 446 ¦ screen <- move-cursor screen, cursor-row, cursor-column 447 ¦ undo-coalesce-tag:num <- copy 2/right-arrow 448 ¦ <end-move-cursor> - 449 ¦ return + 449 ¦ return 450 } 451 ] 452 @@ -534,7 +534,7 @@ if ('onhashchange' in window) { 472 ¦ <scroll-down> 473 ¦ cursor-row <- subtract cursor-row, 1 # bring back into screen range 474 ¦ *editor <- put *editor, cursor-row:offset, cursor-row - 475 ¦ return 1/go-render + 475 ¦ return 1/go-render 476 } 477 # if the line wraps, move cursor to start of next row 478 { @@ -557,7 +557,7 @@ if ('onhashchange' in window) { 495 ¦ <scroll-down> 496 ¦ cursor-row <- subtract cursor-row, 1 # bring back into screen range 497 ¦ *editor <- put *editor, cursor-row:offset, cursor-row - 498 ¦ return 1/go-render + 498 ¦ return 1/go-render 499 } 500 # otherwise move cursor one character right 501 cursor-column <- add cursor-column, 1 @@ -791,7 +791,7 @@ if ('onhashchange' in window) { 729 ¦ *editor <- put *editor, before-cursor:offset, before-cursor 730 ¦ undo-coalesce-tag:num <- copy 1/left-arrow 731 ¦ <end-move-cursor> - 732 ¦ return + 732 ¦ return 733 } 734 ] 735 @@ -1055,7 +1055,7 @@ if ('onhashchange' in window) { 993 ¦ go-render? <- move-to-previous-line editor 994 ¦ undo-coalesce-tag:num <- copy 3/up-arrow 995 ¦ <end-move-cursor> - 996 ¦ return + 996 ¦ return 997 } 998 ] 999 @@ -1110,15 +1110,15 @@ if ('onhashchange' in window) { 1048 ¦ ¦ *editor <- put *editor, before-cursor:offset, before-cursor 1049 ¦ ¦ cursor-column <- add cursor-column, 1 1050 ¦ ¦ *editor <- put *editor, cursor-column:offset, cursor-column -1051 ¦ ¦ loop +1051 ¦ ¦ loop 1052 ¦ } -1053 ¦ return +1053 ¦ return 1054 } 1055 { 1056 ¦ # if cursor already at top, scroll up 1057 ¦ break-unless already-at-top? 1058 ¦ <scroll-up> -1059 ¦ return 1/go-render +1059 ¦ return 1/go-render 1060 } 1061 ] 1062 @@ -1409,7 +1409,7 @@ if ('onhashchange' in window) { 1347 ¦ go-render? <- move-to-next-line editor, screen-height 1348 ¦ undo-coalesce-tag:num <- copy 4/down-arrow 1349 ¦ <end-move-cursor> -1350 ¦ return +1350 ¦ return 1351 } 1352 ] 1353 @@ -1428,11 +1428,11 @@ if ('onhashchange' in window) { 1366 ¦ break-if before-cursor 1367 ¦ { 1368 ¦ ¦ break-if at-bottom-of-screen? -1369 ¦ ¦ return 0/don't-render +1369 ¦ ¦ return 0/don't-render 1370 ¦ } 1371 ¦ { 1372 ¦ ¦ break-unless at-bottom-of-screen? -1373 ¦ ¦ jump +try-to-scroll +1373 ¦ ¦ jump +try-to-scroll 1374 ¦ } 1375 } 1376 next:&:duplex-list:char <- next before-cursor @@ -1440,11 +1440,11 @@ if ('onhashchange' in window) { 1378 ¦ break-if next 1379 ¦ { 1380 ¦ ¦ break-if at-bottom-of-screen? -1381 ¦ ¦ return 0/don't-render +1381 ¦ ¦ return 0/don't-render 1382 ¦ } 1383 ¦ { 1384 ¦ ¦ break-unless at-bottom-of-screen? -1385 ¦ ¦ jump +try-to-scroll +1385 ¦ ¦ jump +try-to-scroll 1386 ¦ } 1387 } 1388 already-at-bottom?:bool <- greater-or-equal cursor-row, last-line @@ -1463,17 +1463,17 @@ if ('onhashchange' in window) { 1401 ¦ ¦ c:char <- get *next, value:offset 1402 ¦ ¦ at-newline?:bool <- equal c, 10/newline 1403 ¦ ¦ break-if at-newline? -1404 ¦ ¦ loop +1404 ¦ ¦ loop 1405 ¦ } 1406 ¦ { 1407 ¦ ¦ break-if next 1408 ¦ ¦ { 1409 ¦ ¦ ¦ break-if at-bottom-of-screen? -1410 ¦ ¦ ¦ return 0/don't-render +1410 ¦ ¦ ¦ return 0/don't-render 1411 ¦ ¦ } 1412 ¦ ¦ { 1413 ¦ ¦ ¦ break-unless at-bottom-of-screen? -1414 ¦ ¦ ¦ jump +try-to-scroll +1414 ¦ ¦ ¦ jump +try-to-scroll 1415 ¦ ¦ } 1416 ¦ } 1417 ¦ cursor-row <- add cursor-row, 1 @@ -1488,12 +1488,12 @@ if ('onhashchange' in window) { 1426 ¦ ¦ break-if done? 1427 ¦ ¦ cursor-column <- add cursor-column, 1 1428 ¦ ¦ before-cursor <- copy next -1429 ¦ ¦ loop +1429 ¦ ¦ loop 1430 ¦ } 1431 ¦ *editor <- put *editor, before-cursor:offset, before-cursor 1432 ¦ *editor <- put *editor, cursor-column:offset, cursor-column 1433 ¦ *editor <- put *editor, cursor-row:offset, cursor-row -1434 ¦ return 0/don't-render +1434 ¦ return 0/don't-render 1435 } 1436 +try-to-scroll 1437 <scroll-down> @@ -1606,7 +1606,7 @@ if ('onhashchange' in window) { 1544 ¦ move-to-start-of-screen-line editor 1545 ¦ undo-coalesce-tag:num <- copy 0/never 1546 ¦ <end-move-cursor> -1547 ¦ return 0/don't-render +1547 ¦ return 0/don't-render 1548 } 1549 ] 1550 @@ -1618,7 +1618,7 @@ if ('onhashchange' in window) { 1556 ¦ move-to-start-of-screen-line editor 1557 ¦ undo-coalesce-tag:num <- copy 0/never 1558 ¦ <end-move-cursor> -1559 ¦ return 0/don't-render +1559 ¦ return 0/don't-render 1560 } 1561 ] 1562 @@ -1639,7 +1639,7 @@ if ('onhashchange' in window) { 1577 ¦ assert curr, [move-to-start-of-line tried to move before start of text] 1578 ¦ curr <- prev curr 1579 ¦ col <- subtract col, 1 -1580 ¦ loop +1580 ¦ loop 1581 } 1582 *editor <- put *editor, cursor-column:offset, col 1583 *editor <- put *editor, before-cursor:offset, curr @@ -1831,7 +1831,7 @@ if ('onhashchange' in window) { 1769 ¦ move-to-end-of-line editor 1770 ¦ undo-coalesce-tag:num <- copy 0/never 1771 ¦ <end-move-cursor> -1772 ¦ return 0/don't-render +1772 ¦ return 0/don't-render 1773 } 1774 ] 1775 @@ -1843,7 +1843,7 @@ if ('onhashchange' in window) { 1781 ¦ move-to-end-of-line editor 1782 ¦ undo-coalesce-tag:num <- copy 0/never 1783 ¦ <end-move-cursor> -1784 ¦ return 0/don't-render +1784 ¦ return 0/don't-render 1785 } 1786 ] 1787 @@ -1866,7 +1866,7 @@ if ('onhashchange' in window) { 1804 ¦ *editor <- put *editor, cursor-column:offset, cursor-column 1805 ¦ before-cursor <- copy next 1806 ¦ *editor <- put *editor, before-cursor:offset, before-cursor -1807 ¦ loop +1807 ¦ loop 1808 } 1809 ] 1810 @@ -2026,7 +2026,7 @@ if ('onhashchange' in window) { 1964 ¦ deleted-cells:&:duplex-list:char <- delete-to-start-of-line editor 1965 ¦ <end-delete-to-start-of-line> 1966 ¦ go-render?:bool <- minimal-render-for-ctrl-u screen, editor, deleted-cells -1967 ¦ return +1967 ¦ return 1968 } 1969 ] 1970 @@ -2050,7 +2050,7 @@ if ('onhashchange' in window) { 1988 ¦ break-if b 1989 ¦ buf <- append buf, c 1990 ¦ i <- add i, 1 -1991 ¦ loop +1991 ¦ loop 1992 } 1993 # if the line used to be wrapped, give up and render the whole screen 1994 num-deleted-cells:num <- length deleted-cells @@ -2062,7 +2062,7 @@ if ('onhashchange' in window) { 2000 curr-line:text <- buffer-to-array buf 2001 curr-row:num <- get *editor, cursor-row:offset 2002 render-code screen, curr-line, curr-column, right, curr-row -2003 return 0/dont-render +2003 return 0/dont-render 2004 ] 2005 2006 def delete-to-start-of-line editor:&:editor -> result:&:duplex-list:char, editor:&:editor [ @@ -2086,7 +2086,7 @@ if ('onhashchange' in window) { 2024 ¦ update-top-of-screen?:bool <- or update-top-of-screen?, at-top-of-screen? 2025 ¦ start <- prev start 2026 ¦ assert start, [delete-to-start-of-line tried to move before start of text] -2027 ¦ loop +2027 ¦ loop 2028 } 2029 # snip it out 2030 result:&:duplex-list:char <- next start @@ -2150,13 +2150,13 @@ if ('onhashchange' in window) { 2088 ¦ ¦ ¦ space:char <- copy 32/space 2089 ¦ ¦ ¦ print screen, space 2090 ¦ ¦ ¦ column <- add column, 1 -2091 ¦ ¦ ¦ loop +2091 ¦ ¦ ¦ loop 2092 ¦ ¦ } 2093 ¦ ¦ row <- add row, 1 2094 ¦ ¦ column <- copy left 2095 ¦ ¦ screen <- move-cursor screen, row, column 2096 ¦ ¦ i <- add i, 1 -2097 ¦ ¦ loop +next-character +2097 ¦ ¦ loop +next-character 2098 ¦ } 2099 ¦ { 2100 ¦ ¦ # at right? wrap. @@ -2169,12 +2169,12 @@ if ('onhashchange' in window) { 2107 ¦ ¦ row <- add row, 1 2108 ¦ ¦ screen <- move-cursor screen, row, column 2109 ¦ ¦ # don't increment i -2110 ¦ ¦ loop +next-character +2110 ¦ ¦ loop +next-character 2111 ¦ } 2112 ¦ i <- add i, 1 2113 ¦ print screen, c, color 2114 ¦ column <- add column, 1 -2115 ¦ loop +2115 ¦ loop 2116 } 2117 was-at-left?:bool <- equal column, left 2118 clear-line-until screen, right @@ -2604,7 +2604,7 @@ if ('onhashchange' in window) { 2542 ¦ <end-delete-to-end-of-line> 2543 ¦ # checks if we can do a minimal render and if we can it will do a minimal render 2544 ¦ go-render?:bool <- minimal-render-for-ctrl-k screen, editor, deleted-cells -2545 ¦ return +2545 ¦ return 2546 } 2547 ] 2548 @@ -2623,7 +2623,7 @@ if ('onhashchange' in window) { 2561 wrap?:bool <- greater-or-equal old-row-len, end 2562 return-if wrap?, 1/go-render 2563 clear-line-until screen, right -2564 return 0/dont-render +2564 return 0/dont-render 2565 ] 2566 2567 def delete-to-end-of-line editor:&:editor -> result:&:duplex-list:char, editor:&:editor [ @@ -2639,7 +2639,7 @@ if ('onhashchange' in window) { 2577 ¦ at-end-of-line?:bool <- equal curr, 10/newline 2578 ¦ break-if at-end-of-line? 2579 ¦ end <- next end -2580 ¦ loop +2580 ¦ loop 2581 } 2582 # snip it out 2583 result <- next start @@ -2885,10 +2885,10 @@ if ('onhashchange' in window) { 2823 ¦ break-if at-newline? 2824 ¦ curr <- next curr 2825 ¦ count <- add count, 1 -2826 ¦ loop +2826 ¦ loop 2827 } 2828 return-unless curr, original -2829 return curr +2829 return curr 2830 ] 2831 2832 scenario editor-scrolls-down-past-wrapped-line-using-arrow-keys [ @@ -3252,7 +3252,7 @@ if ('onhashchange' in window) { 3190 ¦ # empty line; just skip this newline 3191 ¦ prev:&:duplex-list:char <- prev curr 3192 ¦ return-unless prev, curr -3193 ¦ return prev +3193 ¦ return prev 3194 } 3195 _, max:num <- divide-with-remainder len, max-line-length 3196 # remainder 0 => scan one width-worth @@ -3270,9 +3270,9 @@ if ('onhashchange' in window) { 3208 ¦ break-unless prev 3209 ¦ curr <- copy prev 3210 ¦ count <- add count, 1 -3211 ¦ loop +3211 ¦ loop 3212 } -3213 return curr +3213 return curr 3214 ] 3215 3216 scenario editor-scrolls-up-past-wrapped-line-using-arrow-keys [ @@ -3635,7 +3635,7 @@ if ('onhashchange' in window) { 3573 ¦ <end-move-cursor> 3574 ¦ top-of-screen:&:duplex-list:char <- get *editor, top-of-screen:offset 3575 ¦ movement?:bool <- not-equal top-of-screen, old-top -3576 ¦ return movement?/go-render +3576 ¦ return movement?/go-render 3577 } 3578 ] 3579 @@ -3650,7 +3650,7 @@ if ('onhashchange' in window) { 3588 ¦ <end-move-cursor> 3589 ¦ top-of-screen:&:duplex-list:char <- get *editor, top-of-screen:offset 3590 ¦ movement?:bool <- not-equal top-of-screen, old-top -3591 ¦ return movement?/go-render +3591 ¦ return movement?/go-render 3592 } 3593 ] 3594 @@ -3701,7 +3701,7 @@ if ('onhashchange' in window) { 3639 ¦ before-cursor <- prev before-cursor 3640 ¦ *editor <- put *editor, before-cursor:offset, before-cursor 3641 ¦ assert before-cursor, [move-to-start-of-line tried to move before start of text] -3642 ¦ loop +3642 ¦ loop 3643 } 3644 ] 3645 @@ -3859,7 +3859,7 @@ if ('onhashchange' in window) { 3797 ¦ <end-move-cursor> 3798 ¦ top-of-screen:&:duplex-list:char <- get *editor, top-of-screen:offset 3799 ¦ movement?:bool <- not-equal top-of-screen, old-top -3800 ¦ return movement?/go-render +3800 ¦ return movement?/go-render 3801 } 3802 ] 3803 @@ -3875,7 +3875,7 @@ if ('onhashchange' in window) { 3813 ¦ top-of-screen:&:duplex-list:char <- get *editor, top-of-screen:offset 3814 ¦ movement?:bool <- not-equal top-of-screen, old-top 3815 ¦ # don't bother re-rendering if nothing changed. todo: test this -3816 ¦ return movement?/go-render +3816 ¦ return movement?/go-render 3817 } 3818 ] 3819 @@ -3893,7 +3893,7 @@ if ('onhashchange' in window) { 3831 ¦ top-of-screen <- copy prev 3832 ¦ *editor <- put *editor, top-of-screen:offset, top-of-screen 3833 ¦ count <- add count, 1 -3834 ¦ loop +3834 ¦ loop 3835 } 3836 ] 3837 @@ -4204,7 +4204,7 @@ if ('onhashchange' in window) { 4142 ¦ go-render?:bool, editor <- line-up editor, screen-height 4143 ¦ undo-coalesce-tag:num <- copy 5/line-up 4144 ¦ <end-move-cursor> -4145 ¦ return go-render? +4145 ¦ return go-render? 4146 } 4147 ] 4148 @@ -4221,7 +4221,7 @@ if ('onhashchange' in window) { 4159 ¦ break-unless movement? 4160 ¦ *editor <- put *editor, top-of-screen:offset, new-top 4161 } -4162 return movement? +4162 return movement? 4163 ] 4164 4165 # ctrl-x - scroll down by one line @@ -4235,7 +4235,7 @@ if ('onhashchange' in window) { 4173 ¦ go-render?:bool, editor <- line-down editor, screen-height 4174 ¦ undo-coalesce-tag:num <- copy 6/line-down 4175 ¦ <end-move-cursor> -4176 ¦ return go-render? +4176 ¦ return go-render? 4177 } 4178 ] 4179 @@ -4249,7 +4249,7 @@ if ('onhashchange' in window) { 4187 ¦ break-unless movement? 4188 ¦ *editor <- put *editor, top-of-screen:offset, new-top 4189 } -4190 return movement? +4190 return movement? 4191 ] 4192 4193 # ctrl-t - move current line to top of screen @@ -4269,7 +4269,7 @@ if ('onhashchange' in window) { 4207 ¦ go-render?:bool <- not-equal new-top, old-top 4208 ¦ undo-coalesce-tag:num <- copy 0/never 4209 ¦ <end-move-cursor> -4210 ¦ return go-render? +4210 ¦ return go-render? 4211 } 4212 ] 4213 @@ -4302,7 +4302,7 @@ if ('onhashchange' in window) { 4240 ¦ ¦ go-render? <- render-line-from-start screen, editor, 0 4241 ¦ } 4242 ¦ <end-insert-character> -4243 ¦ return +4243 ¦ return 4244 } 4245 ] 4246 @@ -4333,10 +4333,10 @@ if ('onhashchange' in window) { 4271 ¦ print screen, c, color 4272 ¦ curr <- next curr 4273 ¦ i <- add i, 1 -4274 ¦ loop +4274 ¦ loop 4275 } 4276 clear-line-until screen, right -4277 return 0/dont-render +4277 return 0/dont-render 4278 ] 4279 4280 def before-start-of-screen-line editor:&:editor -> result:&:duplex-list:char [ diff --git a/html/edit/004-programming-environment.mu.html b/html/edit/004-programming-environment.mu.html index 04eb525e..2a1dd7f6 100644 --- a/html/edit/004-programming-environment.mu.html +++ b/html/edit/004-programming-environment.mu.html @@ -147,7 +147,7 @@ if ('onhashchange' in window) { 84 ¦ ¦ sandbox-in-focus?:bool <- move-cursor current-sandbox, screen, t 85 ¦ ¦ *env <- put *env, sandbox-in-focus?:offset, sandbox-in-focus? 86 ¦ ¦ screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env - 87 ¦ ¦ loop +next-event + 87 ¦ ¦ loop +next-event 88 ¦ } 89 ¦ # 'resize' event - redraw editor 90 ¦ # todo: test this after supporting resize in assume-console @@ -156,7 +156,7 @@ if ('onhashchange' in window) { 93 ¦ ¦ break-unless is-resize? 94 ¦ ¦ env, screen <- resize screen, env 95 ¦ ¦ screen <- render-all screen, env, render-without-moving-cursor - 96 ¦ ¦ loop +next-event + 96 ¦ ¦ loop +next-event 97 ¦ } 98 ¦ # if it's not global and not a touch event, send to appropriate editor 99 ¦ { @@ -187,7 +187,7 @@ if ('onhashchange' in window) { 124 ¦ ¦ } 125 ¦ ¦ screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env 126 ¦ } -127 ¦ loop +127 ¦ loop 128 } 129 ] 130 @@ -269,7 +269,7 @@ if ('onhashchange' in window) { 206 ¦ ¦ screen <- move-cursor screen, row, column 207 ¦ ¦ curr <- next curr 208 ¦ ¦ prev <- next prev -209 ¦ ¦ loop +next-character +209 ¦ ¦ loop +next-character 210 ¦ } 211 ¦ { 212 ¦ ¦ # at right? wrap. even if there's only one more letter left; we need @@ -283,18 +283,18 @@ if ('onhashchange' in window) { 220 ¦ ¦ row <- add row, 1 221 ¦ ¦ screen <- move-cursor screen, row, column 222 ¦ ¦ # don't increment curr -223 ¦ ¦ loop +next-character +223 ¦ ¦ loop +next-character 224 ¦ } 225 ¦ print screen, c, color 226 ¦ curr <- next curr 227 ¦ prev <- next prev 228 ¦ column <- add column, 1 -229 ¦ loop +229 ¦ loop 230 } 231 # save first character off-screen 232 *editor <- put *editor, bottom-of-screen:offset, curr 233 *editor <- put *editor, bottom:offset, row -234 return row, column +234 return row, column 235 ] 236 237 scenario point-at-multiple-editors [ @@ -560,7 +560,7 @@ if ('onhashchange' in window) { 497 ¦ sandbox-in-focus? <- not sandbox-in-focus? 498 ¦ *env <- put *env, sandbox-in-focus?:offset, sandbox-in-focus? 499 ¦ screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env -500 ¦ loop +next-event +500 ¦ loop +next-event 501 } 502 ] 503 @@ -586,7 +586,7 @@ if ('onhashchange' in window) { 523 ¦ screen <- move-cursor screen, y, col 524 ¦ print screen, style, color 525 ¦ y <- add y, 1 -526 ¦ loop +526 ¦ loop 527 } 528 ] 529 diff --git a/html/edit/005-sandbox.mu.html b/html/edit/005-sandbox.mu.html index f91232db..d46cf41e 100644 --- a/html/edit/005-sandbox.mu.html +++ b/html/edit/005-sandbox.mu.html @@ -202,7 +202,7 @@ if ('onhashchange' in window) { 139 ¦ ¦ screen <- update-status screen, [ ], 245/grey 140 ¦ } 141 ¦ screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env - 142 ¦ loop +next-event + 142 ¦ loop +next-event 143 } 144 ] 145 @@ -245,7 +245,7 @@ if ('onhashchange' in window) { 182 ¦ curr <- update-sandbox curr, env, idx 183 ¦ curr <- get *curr, next-sandbox:offset 184 ¦ idx <- add idx, 1 - 185 ¦ loop + 185 ¦ loop 186 } 187 <end-run-sandboxes> 188 +return @@ -298,7 +298,7 @@ if ('onhashchange' in window) { 235 ¦ resources <- save-sandbox resources, curr, idx 236 ¦ idx <- add idx, 1 237 ¦ curr <- get *curr, next-sandbox:offset - 238 ¦ loop + 238 ¦ loop 239 } 240 ] 241 @@ -485,13 +485,13 @@ if ('onhashchange' in window) { 422 ¦ ¦ ¦ space:char <- copy 32/space 423 ¦ ¦ ¦ print screen, space 424 ¦ ¦ ¦ column <- add column, 1 - 425 ¦ ¦ ¦ loop + 425 ¦ ¦ ¦ loop 426 ¦ ¦ } 427 ¦ ¦ row <- add row, 1 428 ¦ ¦ column <- copy left 429 ¦ ¦ screen <- move-cursor screen, row, column 430 ¦ ¦ i <- add i, 1 - 431 ¦ ¦ loop +next-character + 431 ¦ ¦ loop +next-character 432 ¦ } 433 ¦ { 434 ¦ ¦ # at right? wrap. @@ -504,12 +504,12 @@ if ('onhashchange' in window) { 441 ¦ ¦ row <- add row, 1 442 ¦ ¦ screen <- move-cursor screen, row, column 443 ¦ ¦ # don't increment i - 444 ¦ ¦ loop +next-character + 444 ¦ ¦ loop +next-character 445 ¦ } 446 ¦ i <- add i, 1 447 ¦ print screen, c, color 448 ¦ column <- add column, 1 - 449 ¦ loop + 449 ¦ loop 450 } 451 was-at-left?:bool <- equal column, left 452 clear-line-until screen, right @@ -561,7 +561,7 @@ if ('onhashchange' in window) { 498 ¦ } 499 ¦ idx <- add idx, 1 500 ¦ prev <- copy curr - 501 ¦ loop + 501 ¦ loop 502 } 503 # update sandbox count 504 *env <- put *env, number-of-sandboxes:offset, idx @@ -616,7 +616,7 @@ if ('onhashchange' in window) { 553 ¦ ¦ print screen, c, color 554 ¦ ¦ column <- add column, 1 555 ¦ ¦ i <- add i, 1 - 556 ¦ ¦ loop + 556 ¦ ¦ loop 557 ¦ } 558 ¦ # print final '.' 559 ¦ print screen, full-stop, 245/grey @@ -627,10 +627,10 @@ if ('onhashchange' in window) { 564 ¦ ¦ break-if line-done? 565 ¦ ¦ print screen, space 566 ¦ ¦ column <- add column, 1 - 567 ¦ ¦ loop + 567 ¦ ¦ loop 568 ¦ } 569 ¦ row <- add row, 1 - 570 ¦ loop + 570 ¦ loop 571 } 572 ] 573 @@ -757,7 +757,7 @@ if ('onhashchange' in window) { 694 ¦ c:char <- get *curr, value:offset 695 ¦ buf <- append buf, c 696 ¦ curr <- next curr - 697 ¦ loop + 697 ¦ loop 698 } 699 result <- buffer-to-array buf 700 ] @@ -969,7 +969,7 @@ if ('onhashchange' in window) { 906 ¦ } 907 ¦ screen <- render-sandbox-side screen, env, render 908 ¦ screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env - 909 ¦ loop +next-event + 909 ¦ loop +next-event 910 } 911 ] 912 @@ -982,7 +982,7 @@ if ('onhashchange' in window) { 919 ¦ break-unless scrolling? 920 ¦ cursor-column:num <- get *current-sandbox, left:offset 921 ¦ screen <- move-cursor screen, 2/row, cursor-column # highlighted sandbox will always start at row 2 - 922 ¦ return + 922 ¦ return 923 } 924 ] 925 @@ -999,7 +999,7 @@ if ('onhashchange' in window) { 936 ¦ *env <- put *env, render-from:offset, render-from 937 ¦ screen <- render-sandbox-side screen, env, render 938 ¦ screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env - 939 ¦ loop +next-event + 939 ¦ loop +next-event 940 } 941 ] 942 @@ -1017,9 +1017,9 @@ if ('onhashchange' in window) { 954 ¦ break-if found? 955 ¦ curr <- copy next 956 ¦ next <- get *curr, next-sandbox:offset - 957 ¦ loop + 957 ¦ loop 958 } - 959 return curr + 959 return curr 960 ] 961 962 scenario scrolling-through-multiple-sandboxes [ diff --git a/html/edit/006-sandbox-copy.mu.html b/html/edit/006-sandbox-copy.mu.html index bcc6e301..782450c4 100644 --- a/html/edit/006-sandbox-copy.mu.html +++ b/html/edit/006-sandbox-copy.mu.html @@ -194,7 +194,7 @@ if ('onhashchange' in window) { 132 ¦ break-unless copy? 133 ¦ screen <- render-sandbox-side screen, env, render 134 ¦ screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env -135 ¦ loop +next-event +135 ¦ loop +next-event 136 } 137 ] 138 @@ -244,9 +244,9 @@ if ('onhashchange' in window) { 182 ¦ found?:bool <- equal click-row, start 183 ¦ return-if found?, curr-sandbox 184 ¦ curr-sandbox <- get *curr-sandbox, next-sandbox:offset -185 ¦ loop +185 ¦ loop 186 } -187 return 0/not-found +187 return 0/not-found 188 ] 189 190 def click-on-sandbox-area? click-row:num, click-column:num, env:&:environment -> result:bool [ @@ -414,7 +414,7 @@ if ('onhashchange' in window) { 352 ¦ *env <- put *env, sandbox-in-focus?:offset, 0/false 353 ¦ screen <- render-recipes screen, env, render 354 ¦ screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env -355 ¦ loop +next-event +355 ¦ loop +next-event 356 } 357 ] 358 @@ -453,7 +453,7 @@ if ('onhashchange' in window) { 391 *recipe-editor <- put *recipe-editor, before-cursor:offset, recipe-data 392 *recipe-editor <- put *recipe-editor, cursor-row:offset, 1 393 *recipe-editor <- put *recipe-editor, cursor-column:offset, 0 -394 return 1/true +394 return 1/true 395 ] diff --git a/html/edit/007-sandbox-delete.mu.html b/html/edit/007-sandbox-delete.mu.html index 524a7fca..223e8baa 100644 --- a/html/edit/007-sandbox-delete.mu.html +++ b/html/edit/007-sandbox-delete.mu.html @@ -137,7 +137,7 @@ if ('onhashchange' in window) { 75 ¦ break-unless delete? 76 ¦ screen <- render-sandbox-side screen, env, render 77 ¦ screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env - 78 ¦ loop +next-event + 78 ¦ loop +next-event 79 } 80 ] 81 @@ -189,7 +189,7 @@ if ('onhashchange' in window) { 127 ¦ ¦ break-if found? 128 ¦ ¦ prev-sandbox <- copy curr-sandbox 129 ¦ ¦ curr-sandbox <- get *curr-sandbox, next-sandbox:offset -130 ¦ ¦ loop +130 ¦ ¦ loop 131 ¦ } 132 ¦ # snip sandbox out of its list 133 ¦ next-sandbox:&:sandbox <- get *curr-sandbox, next-sandbox:offset diff --git a/html/edit/008-sandbox-edit.mu.html b/html/edit/008-sandbox-edit.mu.html index 40bc00ef..23a66210 100644 --- a/html/edit/008-sandbox-edit.mu.html +++ b/html/edit/008-sandbox-edit.mu.html @@ -177,7 +177,7 @@ if ('onhashchange' in window) { 115 ¦ break-unless edit? 116 ¦ screen <- render-sandbox-side screen, env, render 117 ¦ screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env -118 ¦ loop +next-event +118 ¦ loop +next-event 119 } 120 ] 121 diff --git a/html/edit/009-sandbox-test.mu.html b/html/edit/009-sandbox-test.mu.html index 2934ebd7..e092c8f0 100644 --- a/html/edit/009-sandbox-test.mu.html +++ b/html/edit/009-sandbox-test.mu.html @@ -208,7 +208,7 @@ if ('onhashchange' in window) { 145 ¦ ¦ draw-horizontal screen, row, sandbox-left-margin, sandbox-right-margin 146 ¦ } 147 ¦ screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env -148 ¦ loop +next-event +148 ¦ loop +next-event 149 } 150 ] 151 @@ -230,14 +230,14 @@ if ('onhashchange' in window) { 167 ¦ break-if found? 168 ¦ sandbox <- copy next-sandbox 169 ¦ sandbox-index <- add sandbox-index, 1 -170 ¦ loop +170 ¦ loop 171 } 172 # return sandbox if click is in its output region 173 response-starting-row:num <- get *sandbox, response-starting-row-on-screen:offset 174 return-unless response-starting-row, 0/no-click-in-sandbox-output, 0/sandbox-index 175 click-in-response?:bool <- greater-or-equal click-row, response-starting-row 176 return-unless click-in-response?, 0/no-click-in-sandbox-output, 0/sandbox-index -177 return sandbox, sandbox-index +177 return sandbox, sandbox-index 178 ] 179 180 def toggle-expected-response sandbox:&:sandbox -> sandbox:&:sandbox [ @@ -263,7 +263,7 @@ if ('onhashchange' in window) { 200 ¦ break-unless sandbox-response 201 ¦ *sandbox <- put *sandbox, response-starting-row-on-screen:offset, row 202 ¦ row <- render-sandbox-response screen, sandbox, left, right -203 ¦ jump +render-sandbox-end +203 ¦ jump +render-sandbox-end 204 } 205 ] 206 @@ -276,7 +276,7 @@ if ('onhashchange' in window) { 213 { 214 ¦ break-if expected-response 215 ¦ row <- render-text screen, sandbox-response, left, right, 245/grey, row -216 ¦ return +216 ¦ return 217 } 218 response-is-expected?:bool <- equal expected-response, sandbox-response 219 { diff --git a/html/edit/010-sandbox-trace.mu.html b/html/edit/010-sandbox-trace.mu.html index 10435b66..a37ec663 100644 --- a/html/edit/010-sandbox-trace.mu.html +++ b/html/edit/010-sandbox-trace.mu.html @@ -146,7 +146,7 @@ if ('onhashchange' in window) { 83 ¦ [lesson/recipes.mu] <- [ 84 ¦ ¦ |recipe foo [| 85 ¦ ¦ | stash [abc]| - 86 ¦ ¦ | reply 4| + 86 ¦ ¦ | reply 4| 87 ¦ ¦ |]| 88 ¦ ] 89 ] @@ -268,7 +268,7 @@ if ('onhashchange' in window) { 205 ¦ *sandbox <- put *sandbox, display-trace?:offset, x 206 ¦ screen <- render-sandbox-side screen, env, render 207 ¦ screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env -208 ¦ loop +next-event +208 ¦ loop +next-event 209 } 210 ] 211 @@ -288,7 +288,7 @@ if ('onhashchange' in window) { 225 ¦ found?:bool <- lesser-than click-row, next-start 226 ¦ break-if found? 227 ¦ sandbox <- copy next-sandbox -228 ¦ loop +228 ¦ loop 229 } 230 # return sandbox if click is in its code region 231 code-ending-row:num <- get *sandbox, code-ending-row-on-screen:offset @@ -298,9 +298,9 @@ if ('onhashchange' in window) { 235 click-on-sandbox-code?:bool <- and click-above-response?, click-below-menu? 236 { 237 ¦ break-if click-on-sandbox-code? -238 ¦ return 0/no-click-in-sandbox-output +238 ¦ return 0/no-click-in-sandbox-output 239 } -240 return sandbox +240 return sandbox 241 ] 242 243 # when rendering a sandbox, dump its trace before response/warning if display-trace? property is set diff --git a/html/edit/011-errors.mu.html b/html/edit/011-errors.mu.html index 13c73c2b..f694b5b9 100644 --- a/html/edit/011-errors.mu.html +++ b/html/edit/011-errors.mu.html @@ -81,7 +81,7 @@ if ('onhashchange' in window) { 18 ¦ break-unless recipe-errors 19 ¦ update-status screen, [errors found ], 1/red 20 ¦ errors-found? <- copy 1/true - 21 ¦ return + 21 ¦ return 22 } 23 errors-found? <- copy 0/false 24 ] @@ -190,7 +190,7 @@ if ('onhashchange' in window) { 127 ¦ *sandbox <- put *sandbox, response-starting-row-on-screen:offset, 0 # no response 128 ¦ row, screen <- render-text screen, sandbox-errors, left, right, 1/red, row 129 ¦ # don't try to print anything more for this sandbox -130 ¦ jump +render-sandbox-end +130 ¦ jump +render-sandbox-end 131 } 132 ] 133 @@ -866,7 +866,7 @@ if ('onhashchange' in window) { 803 ¦ ¦ | b:num <- next-ingredient| 804 ¦ ¦ | stash [dividing by], b| 805 ¦ ¦ | _, c:num <- divide-with-remainder a, b| -806 ¦ ¦ | reply b| +806 ¦ ¦ | reply b| 807 ¦ ¦ |]| 808 ¦ ] 809 ] diff --git a/html/edit/012-editor-undo.mu.html b/html/edit/012-editor-undo.mu.html index 0a88703f..9306b1c8 100644 --- a/html/edit/012-editor-undo.mu.html +++ b/html/edit/012-editor-undo.mu.html @@ -139,7 +139,7 @@ if ('onhashchange' in window) { 76 ¦ redo <- push op, redo 77 ¦ *editor <- put *editor, redo:offset, redo 78 ¦ <handle-undo> - 79 ¦ return 1/go-render + 79 ¦ return 1/go-render 80 } 81 ] 82 @@ -157,7 +157,7 @@ if ('onhashchange' in window) { 94 ¦ undo <- push op, undo 95 ¦ *editor <- put *editor, undo:offset, undo 96 ¦ <handle-redo> - 97 ¦ return 1/go-render + 97 ¦ return 1/go-render 98 } 99 ] 100 @@ -227,7 +227,7 @@ if ('onhashchange' in window) { 164 ¦ typing <- put typing, after-column:offset, cursor-column 165 ¦ typing <- put typing, after-top-of-screen:offset, top-after 166 ¦ *op <- merge 0/insert-operation, typing - 167 ¦ break +done-adding-insert-operation + 167 ¦ break +done-adding-insert-operation 168 } 169 # if not, create a new operation 170 insert-from:&:duplex-list:char <- next cursor-before @@ -806,7 +806,7 @@ if ('onhashchange' in window) { 743 ¦ move <- put move, after-column:offset, cursor-column 744 ¦ move <- put move, after-top-of-screen:offset, top-after 745 ¦ *op <- merge 1/move-operation, move - 746 ¦ break +done-adding-move-operation + 746 ¦ break +done-adding-move-operation 747 } 748 op:&:operation <- new operation:type 749 *op <- merge 1/move-operation, cursor-row-before, cursor-column-before, top-before, cursor-row/after, cursor-column/after, top-after, undo-coalesce-tag @@ -1707,7 +1707,7 @@ if ('onhashchange' in window) { 1644 ¦ ¦ deletion <- put deletion, after-column:offset, cursor-column 1645 ¦ ¦ deletion <- put deletion, after-top-of-screen:offset, top-after 1646 ¦ ¦ *op <- merge 2/delete-operation, deletion -1647 ¦ ¦ break +done-adding-backspace-operation +1647 ¦ ¦ break +done-adding-backspace-operation 1648 ¦ } 1649 ¦ # if not, create a new operation 1650 ¦ op:&:operation <- new operation:type @@ -1934,7 +1934,7 @@ if ('onhashchange' in window) { 1871 ¦ ¦ deletion <- put deletion, after-column:offset, cursor-column 1872 ¦ ¦ deletion <- put deletion, after-top-of-screen:offset, top-after 1873 ¦ ¦ *op <- merge 2/delete-operation, deletion -1874 ¦ ¦ break +done-adding-delete-operation +1874 ¦ ¦ break +done-adding-delete-operation 1875 ¦ } 1876 ¦ # if not, create a new operation 1877 ¦ op:&:operation <- new operation:type diff --git a/html/factorial.mu.html b/html/factorial.mu.html index e5ac5761..078d8474 100644 --- a/html/factorial.mu.html +++ b/html/factorial.mu.html @@ -75,7 +75,7 @@ if ('onhashchange' in window) { 14 ¦ # if n=0 return 1 15 ¦ zero?:bool <- equal n, 0 16 ¦ break-unless zero? -17 ¦ return 1 +17 ¦ return 1 18 } 19 # return n * factorial(n-1) 20 x:num <- subtract n, 1 diff --git a/html/filesystem.mu.html b/html/filesystem.mu.html index 4a64232e..0c9d72b8 100644 --- a/html/filesystem.mu.html +++ b/html/filesystem.mu.html @@ -71,7 +71,7 @@ if ('onhashchange' in window) { 11 ¦ c:char, done?:bool, source-file <- read source-file 12 ¦ break-if done? 13 ¦ sink-file <- write sink-file, c -14 ¦ loop +14 ¦ loop 15 } 16 close sink-file 17 # make sure to wait for the file to be actually written to disk diff --git a/html/fork.mu.html b/html/fork.mu.html index 976c0db3..75023398 100644 --- a/html/fork.mu.html +++ b/html/fork.mu.html @@ -63,14 +63,14 @@ if ('onhashchange' in window) { 4 start-running thread2 5 { 6 ¦ $print 34 - 7 ¦ loop + 7 ¦ loop 8 } 9 ] 10 11 def thread2 [ 12 { 13 ¦ $print 35 -14 ¦ loop +14 ¦ loop 15 } 16 ] diff --git a/html/http-client.mu.html b/html/http-client.mu.html index c83886f4..615574c2 100644 --- a/html/http-client.mu.html +++ b/html/http-client.mu.html @@ -77,7 +77,7 @@ if ('onhashchange' in window) { 17 ¦ ¦ break-if a 18 ¦ ¦ $print n 10/newline 19 ¦ } -20 ¦ loop +20 ¦ loop 21 } 22 result:text <- buffer-to-array buf 23 open-console diff --git a/html/lambda-to-mu.mu.html b/html/lambda-to-mu.mu.html index c15a22b1..53f9926d 100644 --- a/html/lambda-to-mu.mu.html +++ b/html/lambda-to-mu.mu.html @@ -268,7 +268,7 @@ if ('onhashchange' in window) { 204 ¦ ¦ break-if done? 205 ¦ ¦ c <- read in 206 ¦ ¦ buf <- append buf, c -207 ¦ ¦ loop +207 ¦ ¦ loop 208 ¦ } 209 ¦ s:text <- buffer-to-array buf 210 ¦ out <- new-atom s @@ -302,7 +302,7 @@ if ('onhashchange' in window) { 238 ¦ ¦ ¦ close-paren?:bool <- equal c, 41/close-paren 239 ¦ ¦ ¦ break-unless close-paren? 240 ¦ ¦ ¦ read in # skip ')' -241 ¦ ¦ ¦ break +end-pair +241 ¦ ¦ ¦ break +end-pair 242 ¦ ¦ } 243 ¦ ¦ # still here? read next element of pair 244 ¦ ¦ next:&:cell, in <- parse in @@ -329,7 +329,7 @@ if ('onhashchange' in window) { 265 ¦ ¦ ¦ close-paren?:bool <- equal c, 41/close-paren 266 ¦ ¦ ¦ assert close-paren?, ['.' must be followed by exactly one expression before ')'] 267 ¦ ¦ } -268 ¦ ¦ loop +268 ¦ ¦ loop 269 ¦ } 270 ¦ +end-pair 271 } @@ -345,7 +345,7 @@ if ('onhashchange' in window) { 281 ¦ space?:bool <- space? c 282 ¦ break-unless space? 283 ¦ read in # skip -284 ¦ loop +284 ¦ loop 285 } 286 ] 287 @@ -364,14 +364,14 @@ if ('onhashchange' in window) { 300 { 301 ¦ break-if x 302 ¦ buf <- append buf, [<>] -303 ¦ return +303 ¦ return 304 } 305 # base case: atom 306 { 307 ¦ s:text, atom?:bool <- maybe-convert *x, atom:variant 308 ¦ break-unless atom? 309 ¦ buf <- append buf, s -310 ¦ return +310 ¦ return 311 } 312 # recursive case: pair 313 buf <- append buf, [< ] diff --git a/html/nqueens.mu.html b/html/nqueens.mu.html index ac2fe88c..54cdecbc 100644 --- a/html/nqueens.mu.html +++ b/html/nqueens.mu.html @@ -78,7 +78,7 @@ if ('onhashchange' in window) { 17 ¦ done?:bool <- greater-or-equal added-so-far, n 18 ¦ break-unless done? 19 ¦ stash queens - 20 ¦ return 1 + 20 ¦ return 1 21 } 22 # still work to do 23 next-rank:num <- copy 0 @@ -102,7 +102,7 @@ if ('onhashchange' in window) { 41 ¦ ¦ result <- add result, sub-result 42 ¦ } 43 ¦ next-file <- add next-file, 1 - 44 ¦ loop + 44 ¦ loop 45 } 46 ] 47 @@ -129,9 +129,9 @@ if ('onhashchange' in window) { 68 ¦ file-match?:bool <- equal curr-file, qfile 69 ¦ return-if file-match?, 1/conflict-found 70 ¦ queens <- rest queens - 71 ¦ loop + 71 ¦ loop 72 } - 73 return 0/no-conflict-found + 73 return 0/no-conflict-found 74 ] 75 76 def conflicting-diagonal? curr:square, queens:&:list:square -> result:bool [ @@ -151,9 +151,9 @@ if ('onhashchange' in window) { 90 ¦ diagonal-match?:bool <- equal rank-delta, file-delta 91 ¦ return-if diagonal-match?, 1/conflict-found 92 ¦ queens <- rest queens - 93 ¦ loop + 93 ¦ loop 94 } - 95 return 0/no-conflict-found + 95 return 0/no-conflict-found 96 ] 97 98 def main [ diff --git a/html/same-fringe.mu.html b/html/same-fringe.mu.html index 6c4a09ce..b6489a73 100644 --- a/html/same-fringe.mu.html +++ b/html/same-fringe.mu.html @@ -100,7 +100,7 @@ if ('onhashchange' in window) { 39 ¦ break-if b-done? 40 ¦ match?:bool <- equal x, y 41 ¦ return-unless match?, 0/false -42 ¦ loop +42 ¦ loop 43 } 44 result <- and a-done?, b-done? 45 ] diff --git a/html/tangle.mu.html b/html/tangle.mu.html index 3f9de231..28338947 100644 --- a/html/tangle.mu.html +++ b/html/tangle.mu.html @@ -84,7 +84,7 @@ if ('onhashchange' in window) { 24 ¦ x:num <- subtract n, 1 25 ¦ subresult:num <- factorial x 26 ¦ result <- multiply subresult, n -27 ¦ return result +27 ¦ return result 28 } 29 ] 30 diff --git a/mu.vim b/mu.vim index 202ea481..bf8e4924 100644 --- a/mu.vim +++ b/mu.vim @@ -63,24 +63,34 @@ highlight link muAssign SpecialChar syntax match muGlobal %[^ ]\+:global/\?[^ ,]*% | highlight link muGlobal SpecialChar " common keywords +" use regular expressions for common words that may come after '/' syntax keyword muKeyword default-space local-scope -syntax keyword muKeyword next-input input rewind-inputs load-inputs -syntax keyword muKeyword next-ingredient ingredient rewind-ingredients load-ingredients +syntax keyword muKeyword next-input rewind-inputs load-inputs +syntax keyword muKeyword next-ingredient rewind-ingredients load-ingredients +syntax match muKeyword " input\>\| ingredient\>" highlight link muKeyword Constant syntax keyword muControl return return-if return-unless syntax keyword muControl reply reply-if reply-unless -syntax keyword muControl output output-if output-unless -syntax keyword muControl jump jump-if jump-unless -syntax keyword muControl break break-if break-unless -syntax keyword muControl loop loop-if loop-unless +syntax keyword muControl output-if output-unless +syntax match muControl "^return\>\| return\>\|^reply\>\| reply\>\|^output\|^ output\>" +syntax keyword muControl jump-if jump-unless +syntax keyword muControl break-if break-unless +syntax keyword muControl loop-if loop-unless +syntax match muControl "^jump\>\| jump\>\|^break\>\| break\>\|^loop\>\| loop\>" syntax keyword muControl start-running syntax keyword muControl call-with-continuation-mark return-continuation-until-mark highlight muControl ctermfg=3 -syntax match muRecipe "^recipe\>\|^recipe!\>\|^def\>\|^def!\>\|^before\>\|^after\>\| -> " | highlight muRecipe ctermfg=208 +syntax match muRecipe "->" +syntax match muRecipe "^recipe\>\|^def\>\|^before\>\|^after\>\| -> " +syntax keyword muRecipe recipe! def! +highlight muRecipe ctermfg=208 + syntax match muScenario "^scenario\>" | highlight muScenario ctermfg=34 -syntax match muPendingScenario "^pending-scenario\>" | highlight link muPendingScenario SpecialChar -syntax match muData "^type\>\|^container\>\|^exclusive-container\>" | highlight muData ctermfg=226 +syntax keyword muPendingScenario pending-scenario | highlight link muPendingScenario SpecialChar +syntax match muData "^type\>\|^container\>" +syntax keyword muData exclusive-container +highlight muData ctermfg=226 let &cpo = s:save_cpo -- cgit 1.4.1-2-gfad0