diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-07-13 20:53:41 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-07-13 20:53:41 -0700 |
commit | 83fcebf3210b638d9f8248e0007e9f0c9804980a (patch) | |
tree | 95c4855bef341e1d46eb4725b54a3eaaf6858f08 /html/060string.mu.html | |
parent | 8b9f1750c74c7d3cca99d6949a90cd61eb8e0218 (diff) | |
download | mu-83fcebf3210b638d9f8248e0007e9f0c9804980a.tar.gz |
1778
Diffstat (limited to 'html/060string.mu.html')
-rw-r--r-- | html/060string.mu.html | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/html/060string.mu.html b/html/060string.mu.html index 45ff99e2..eb98cd88 100644 --- a/html/060string.mu.html +++ b/html/060string.mu.html @@ -13,14 +13,14 @@ pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background-color: #080808; } body { font-family: monospace; color: #eeeeee; background-color: #080808; } * { font-size: 1.05em; } -.muScenario { color: #00af00; } +.muRecipe { color: #ff8700; } .Delimiter { color: #a04060; } +.muScenario { color: #00af00; } .Comment { color: #9090ff; } .Constant { color: #00a0a0; } .Special { color: #ff6060; } .CommentedCode { color: #6c6c6c; } .muControl { color: #c0a020; } -.muRecipe { color: #ff8700; } --> </style> @@ -35,7 +35,7 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="Comment"># Some useful helpers for dealing with strings.</span> <span class="muRecipe">recipe</span> string-equal [ - <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + <span class="Constant">new-default-space</span> a:address:array:character<span class="Special"> <- </span><span class="Constant">next-ingredient</span> a-len:number<span class="Special"> <- </span>length a:address:array:character/deref b:address:array:character<span class="Special"> <- </span><span class="Constant">next-ingredient</span> @@ -138,7 +138,7 @@ container buffer [ ] <span class="muRecipe">recipe</span> new-buffer [ - <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + <span class="Constant">new-default-space</span> <span class="CommentedCode">#? $print default-space:address:array:location, [</span> <span class="CommentedCode">#? ]</span> result:address:buffer<span class="Special"> <- </span>new buffer:type @@ -154,7 +154,7 @@ container buffer [ ] <span class="muRecipe">recipe</span> grow-buffer [ - <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + <span class="Constant">new-default-space</span> in:address:buffer<span class="Special"> <- </span><span class="Constant">next-ingredient</span> <span class="Comment"># double buffer size</span> x:address:address:array:character<span class="Special"> <- </span>get-address in:address:buffer/deref, data:offset @@ -177,7 +177,7 @@ container buffer [ ] <span class="muRecipe">recipe</span> buffer-full? [ - <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + <span class="Constant">new-default-space</span> in:address:buffer<span class="Special"> <- </span><span class="Constant">next-ingredient</span> len:number<span class="Special"> <- </span>get in:address:buffer/deref, length:offset s:address:array:character<span class="Special"> <- </span>get in:address:buffer/deref, data:offset @@ -188,7 +188,7 @@ container buffer [ <span class="Comment"># in:address:buffer <- buffer-append in:address:buffer, c:character</span> <span class="muRecipe">recipe</span> buffer-append [ - <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + <span class="Constant">new-default-space</span> in:address:buffer<span class="Special"> <- </span><span class="Constant">next-ingredient</span> c:character<span class="Special"> <- </span><span class="Constant">next-ingredient</span> len:address:number<span class="Special"> <- </span>get-address in:address:buffer/deref, length:offset @@ -222,7 +222,7 @@ container buffer [ <span class="muScenario">scenario</span> buffer-append-works [ run [ - <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + <span class="Constant">new-default-space</span> x:address:buffer<span class="Special"> <- </span>new-buffer <span class="Constant">3:literal</span> s1:address:array:character<span class="Special"> <- </span>get x:address:buffer/deref, data:offset x:address:buffer<span class="Special"> <- </span>buffer-append x:address:buffer, <span class="Constant">97:literal</span> <span class="Comment"># 'a'</span> @@ -274,7 +274,7 @@ container buffer [ <span class="muScenario">scenario</span> buffer-append-handles-backspace [ run [ - <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + <span class="Constant">new-default-space</span> x:address:buffer<span class="Special"> <- </span>new-buffer <span class="Constant">3:literal</span> x:address:buffer<span class="Special"> <- </span>buffer-append x:address:buffer, <span class="Constant">97:literal</span> <span class="Comment"># 'a'</span> x:address:buffer<span class="Special"> <- </span>buffer-append x:address:buffer, <span class="Constant">98:literal</span> <span class="Comment"># 'b'</span> @@ -291,7 +291,7 @@ container buffer [ <span class="Comment"># result:address:array:character <- integer-to-decimal-string n:number</span> <span class="muRecipe">recipe</span> integer-to-decimal-string [ - <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + <span class="Constant">new-default-space</span> n:number<span class="Special"> <- </span><span class="Constant">next-ingredient</span> <span class="Comment"># is it zero?</span> <span class="Delimiter">{</span> @@ -347,7 +347,7 @@ container buffer [ ] <span class="muRecipe">recipe</span> buffer-to-array [ - <span class="Constant">default-space</span>:address:array:character<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + <span class="Constant">new-default-space</span> in:address:buffer<span class="Special"> <- </span><span class="Constant">next-ingredient</span> <span class="Delimiter">{</span> <span class="Comment"># propagate null buffer</span> @@ -408,7 +408,7 @@ container buffer [ <span class="Comment"># result:address:array:character <- string-append a:address:array:character, b:address:array:character</span> <span class="muRecipe">recipe</span> string-append [ - <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + <span class="Constant">new-default-space</span> <span class="Comment"># result = new character[a.length + b.length]</span> a:address:array:character<span class="Special"> <- </span><span class="Constant">next-ingredient</span> a-len:number<span class="Special"> <- </span>length a:address:array:character/deref @@ -467,7 +467,7 @@ container buffer [ <span class="Comment"># replace underscores in first with remaining args</span> <span class="Comment"># result:address:array:character <- interpolate template:address:array:character, ...</span> <span class="muRecipe">recipe</span> interpolate [ - <span class="Constant">default-space</span>:array:address:location<span class="Special"> <- </span>new location:type, <span class="Constant">60:literal</span> + <span class="Constant">new-default-space</span> template:address:array:character<span class="Special"> <- </span><span class="Constant">next-ingredient</span> <span class="Comment"># compute result-len, space to allocate for result</span> tem-len:number<span class="Special"> <- </span>length template:address:array:character/deref @@ -592,7 +592,7 @@ container buffer [ <span class="Comment"># result:boolean <- space? c:character</span> <span class="muRecipe">recipe</span> space? [ - <span class="Constant">default-space</span>:array:address:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + <span class="Constant">new-default-space</span> c:character<span class="Special"> <- </span><span class="Constant">next-ingredient</span> <span class="Comment"># most common case first</span> result:boolean<span class="Special"> <- </span>equal c:character, <span class="Constant">32:literal/space</span> @@ -657,7 +657,7 @@ container buffer [ <span class="Comment"># result:address:array:character <- trim s:address:array:character</span> <span class="muRecipe">recipe</span> trim [ - <span class="Constant">default-space</span>:array:address:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + <span class="Constant">new-default-space</span> s:address:array:character<span class="Special"> <- </span><span class="Constant">next-ingredient</span> len:number<span class="Special"> <- </span>length s:address:array:character/deref <span class="Comment"># left trim: compute start</span> @@ -766,7 +766,7 @@ container buffer [ <span class="Comment"># next-index:number <- find-next text:address:array:character, pattern:character</span> <span class="muRecipe">recipe</span> find-next [ - <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + <span class="Constant">new-default-space</span> text:address:array:character<span class="Special"> <- </span><span class="Constant">next-ingredient</span> pattern:character<span class="Special"> <- </span><span class="Constant">next-ingredient</span> idx:number<span class="Special"> <- </span><span class="Constant">next-ingredient</span> @@ -866,7 +866,7 @@ container buffer [ <span class="Comment"># like find-next, but searches for multiple characters</span> <span class="Comment"># fairly dumb algorithm</span> <span class="muRecipe">recipe</span> find-substring [ - <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + <span class="Constant">new-default-space</span> text:address:array:character<span class="Special"> <- </span><span class="Constant">next-ingredient</span> pattern:address:array:character<span class="Special"> <- </span><span class="Constant">next-ingredient</span> idx:number<span class="Special"> <- </span><span class="Constant">next-ingredient</span> @@ -945,7 +945,7 @@ container buffer [ <span class="Comment"># result:boolean <- match-at text:address:array:character, pattern:address:array:character, idx:number</span> <span class="Comment"># checks if substring matches at index 'idx'</span> <span class="muRecipe">recipe</span> match-at [ - <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + <span class="Constant">new-default-space</span> text:address:array:character<span class="Special"> <- </span><span class="Constant">next-ingredient</span> pattern:address:array:character<span class="Special"> <- </span><span class="Constant">next-ingredient</span> idx:number<span class="Special"> <- </span><span class="Constant">next-ingredient</span> @@ -1076,7 +1076,7 @@ container buffer [ <span class="Comment"># result:address:array:address:array:character <- split s:address:array:character, delim:character</span> <span class="muRecipe">recipe</span> split [ - <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + <span class="Constant">new-default-space</span> s:address:array:character<span class="Special"> <- </span><span class="Constant">next-ingredient</span> delim:character<span class="Special"> <- </span><span class="Constant">next-ingredient</span> <span class="Comment"># empty string? return empty array</span> @@ -1206,7 +1206,7 @@ container buffer [ <span class="Comment"># x:address:array:character, y:address:array:character <- split-first text:address:array:character, delim:character</span> <span class="muRecipe">recipe</span> split-first [ - <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + <span class="Constant">new-default-space</span> text:address:array:character<span class="Special"> <- </span><span class="Constant">next-ingredient</span> delim:character<span class="Special"> <- </span><span class="Constant">next-ingredient</span> <span class="Comment"># empty string? return empty strings</span> @@ -1241,7 +1241,7 @@ container buffer [ <span class="Comment"># result:address:array:character <- string-copy buf:address:array:character, start:number, end:number</span> <span class="Comment"># todo: make this generic</span> <span class="muRecipe">recipe</span> string-copy [ - <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + <span class="Constant">new-default-space</span> buf:address:array:character<span class="Special"> <- </span><span class="Constant">next-ingredient</span> start:number<span class="Special"> <- </span><span class="Constant">next-ingredient</span> end:number<span class="Special"> <- </span><span class="Constant">next-ingredient</span> @@ -1301,7 +1301,7 @@ container buffer [ ] <span class="muRecipe">recipe</span> min [ - <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + <span class="Constant">new-default-space</span> x:number<span class="Special"> <- </span><span class="Constant">next-ingredient</span> y:number<span class="Special"> <- </span><span class="Constant">next-ingredient</span> <span class="Delimiter">{</span> @@ -1313,7 +1313,7 @@ container buffer [ ] <span class="muRecipe">recipe</span> max [ - <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + <span class="Constant">new-default-space</span> x:number<span class="Special"> <- </span><span class="Constant">next-ingredient</span> y:number<span class="Special"> <- </span><span class="Constant">next-ingredient</span> <span class="Delimiter">{</span> |