From 3e1349d29fa00db1fab3a811b60bc9d8de0355e4 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 30 Sep 2016 10:45:14 -0700 Subject: 3431 Improvements to syntax highlighting, particularly for Mu code in C++ files. --- html/056shape_shifting_recipe.cc.html | 210 +++++++++++++++++----------------- 1 file changed, 106 insertions(+), 104 deletions(-) (limited to 'html/056shape_shifting_recipe.cc.html') diff --git a/html/056shape_shifting_recipe.cc.html b/html/056shape_shifting_recipe.cc.html index 4bfbafc1..dc2c8797 100644 --- a/html/056shape_shifting_recipe.cc.html +++ b/html/056shape_shifting_recipe.cc.html @@ -13,17 +13,19 @@ pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background-color: #080808; } body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color: #080808; } * { font-size: 12pt; font-size: 1em; } -.Constant { color: #00a0a0; } -.Normal { color: #eeeeee; background-color: #080808; padding-bottom: 1px; } +.SalientComment { color: #00ffff; } +.CommentedCode { color: #6c6c6c; } +.muRecipe { color: #ff8700; } +.muData { color: #ffff00; } .traceContains { color: #008000; } +.Delimiter { color: #800080; } +.Normal { color: #eeeeee; background-color: #080808; padding-bottom: 1px; } .cSpecial { color: #008000; } +.Comment { color: #9090ff; } +.Constant { color: #00a0a0; } .Special { color: #c00000; } -.Delimiter { color: #800080; } -.SalientComment { color: #00ffff; } .Identifier { color: #fcb165; } -.Comment { color: #9090ff; } .PreProc { color: #800080; } -.CommentedCode { color: #6c6c6c; } --> @@ -38,18 +40,18 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color //:: Like container definitions, recipes too can contain type parameters. :(scenario shape_shifting_recipe) -def main [ +def main [ 10:point <- merge 14, 15 11:point <- foo 10:point ] # non-matching variant -def foo a:num -> result:num [ +def foo a:num -> result:num [ local-scope load-ingredients result <- copy 34 ] # matching shape-shifting variant -def foo a:_t -> result:_t [ +def foo a:_t -> result:_t [ local-scope load-ingredients result <- copy a @@ -533,18 +535,18 @@ string inspect(const } :(scenario shape_shifting_recipe_2) -def main [ +def main [ 10:point <- merge 14, 15 11:point <- foo 10:point ] # non-matching shape-shifting variant -def foo a:_t, b:_t -> result:num [ +def foo a:_t, b:_t -> result:num [ local-scope load-ingredients result <- copy 34 ] # matching shape-shifting variant -def foo a:_t -> result:_t [ +def foo a:_t -> result:_t [ local-scope load-ingredients result <- copy a @@ -553,17 +555,17 @@ def foo a:_t -> result:_t [ +mem: storing 15 in location 12 :(scenario shape_shifting_recipe_nonroot) -def main [ +def main [ 10:foo:point <- merge 14, 15, 16 20:point/raw <- bar 10:foo:point ] # shape-shifting recipe with type ingredient following some other type -def bar a:foo:_t -> result:_t [ +def bar a:foo:_t -> result:_t [ local-scope load-ingredients - result <- get a, x:offset + result <- get a, x:offset ] -container foo:_t [ +container foo:_t [ x:_t y:num ] @@ -571,33 +573,33 @@ container foo:_t [ +mem: storing 15 in location 21 :(scenario shape_shifting_recipe_nested) -container c:_a:_b [ +container c:_a:_b [ a:_a b:_b ] -def main [ +def main [ s:text <- new [abc] {x: (c (address array character) number)} <- merge s, 34 foo x ] -def foo x:c:_bar:_baz [ +def foo x:c:_bar:_baz [ local-scope load-ingredients ] # no errors :(scenario shape_shifting_recipe_type_deduction_ignores_offsets) -def main [ +def main [ 10:foo:point <- merge 14, 15, 16 20:point/raw <- bar 10:foo:point ] -def bar a:foo:_t -> result:_t [ +def bar a:foo:_t -> result:_t [ local-scope load-ingredients x:num <- copy 1 - result <- get a, x:offset # shouldn't collide with other variable + result <- get a, x:offset # shouldn't collide with other variable ] -container foo:_t [ +container foo:_t [ x:_t y:num ] @@ -605,24 +607,24 @@ container foo:_t [ +mem: storing 15 in location 21 :(scenario shape_shifting_recipe_empty) -def main [ +def main [ foo 1 ] # shape-shifting recipe with no body -def foo a:_t [ +def foo a:_t [ ] # shouldn't crash :(scenario shape_shifting_recipe_handles_shape_shifting_new_ingredient) -def main [ +def main [ 1:&:foo:point <- bar 3 11:foo:point <- copy *1:&:foo:point ] -container foo:_t [ +container foo:_t [ x:_t y:num ] -def bar x:num -> result:&:foo:_t [ +def bar x:num -> result:&:foo:_t [ local-scope load-ingredients # new refers to _t in its ingredient *value* @@ -633,18 +635,18 @@ def bar x:num -> result:&:foo:_t [ +mem: storing 0 in location 13 :(scenario shape_shifting_recipe_handles_shape_shifting_new_ingredient_2) -def main [ +def main [ 1:&:foo:point <- bar 3 11:foo:point <- copy *1:&:foo:point ] -def bar x:num -> result:&:foo:_t [ +def bar x:num -> result:&:foo:_t [ local-scope load-ingredients # new refers to _t in its ingredient *value* result <- new {(foo _t) : type} ] # container defined after use -container foo:_t [ +container foo:_t [ x:_t y:num ] @@ -653,10 +655,10 @@ container foo:_t [ +mem: storing 0 in location 13 :(scenario shape_shifting_recipe_called_with_dummy) -def main [ +def main [ _ <- bar 34 ] -def bar x:_t -> result:&:_t [ +def bar x:_t -> result:&:_t [ local-scope load-ingredients result <- copy 0 @@ -691,13 +693,13 @@ $error: 0 } :(scenario shape_shifting_recipe_supports_compound_types) -def main [ - 1:&:point <- new point:type - *1:&:point <- put *1:&:point, y:offset, 34 +def main [ + 1:&:point <- new point:type + *1:&:point <- put *1:&:point, y:offset, 34 3:&:point <- bar 1:&:point # specialize _t to address:point 4:point <- copy *3:&:point ] -def bar a:_t -> result:_t [ +def bar a:_t -> result:_t [ local-scope load-ingredients result <- copy a @@ -706,26 +708,26 @@ def bar a:_t -> result:_t [ :(scenario shape_shifting_recipe_error) % Hide_errors = true; -def main [ +def main [ a:num <- copy 3 b:&:num <- foo a ] -def foo a:_t -> b:_t [ +def foo a:_t -> b:_t [ load-ingredients b <- copy a ] +error: main: no call found for 'b:&:num <- foo a' :(scenario specialize_inside_recipe_without_header) -def main [ +def main [ foo 3 ] -def foo [ +def foo [ local-scope x:num <- next-ingredient # ensure no header 1:num/raw <- bar x # call a shape-shifting recipe ] -def bar x:_elem -> y:_elem [ +def bar x:_elem -> y:_elem [ local-scope load-ingredients y <- add x, 1 @@ -733,12 +735,12 @@ def bar x:_elem -> y:_elem [ +mem: storing 4 in location 1 :(scenario specialize_with_literal) -def main [ +def main [ local-scope # permit literal to map to number 1:num/raw <- foo 3 ] -def foo x:_elem -> y:_elem [ +def foo x:_elem -> y:_elem [ local-scope load-ingredients y <- add x, 1 @@ -746,12 +748,12 @@ def foo x:_elem -> y:_elem [ +mem: storing 4 in location 1 :(scenario specialize_with_literal_2) -def main [ +def main [ local-scope # permit literal to map to character 1:char/raw <- foo 3 ] -def foo x:_elem -> y:_elem [ +def foo x:_elem -> y:_elem [ local-scope load-ingredients y <- add x, 1 @@ -759,12 +761,12 @@ def foo x:_elem -> y:_elem [ +mem: storing 4 in location 1 :(scenario specialize_with_literal_3) -def main [ +def main [ local-scope # permit '0' to map to address to shape-shifting type-ingredient 1:&:char/raw <- foo 0 ] -def foo x:&:_elem -> y:&:_elem [ +def foo x:&:_elem -> y:&:_elem [ local-scope load-ingredients y <- copy x @@ -774,12 +776,12 @@ $error: 0 :(scenario specialize_with_literal_4) % Hide_errors = true; -def main [ +def main [ local-scope # ambiguous call: what's the type of its ingredient?! foo 0 ] -def foo x:&:_elem -> y:&:_elem [ +def foo x:&:_elem -> y:&:_elem [ local-scope load-ingredients y <- copy x @@ -787,10 +789,10 @@ def foo x:&:_elem -> y:&:_elem [ +error: main: instruction 'foo' has no valid specialization :(scenario specialize_with_literal_5) -def main [ +def main [ foo 3, 4 # recipe mapping two variables to literals ] -def foo x:_elem, y:_elem [ +def foo x:_elem, y:_elem [ local-scope load-ingredients 1:num/raw <- add x, y @@ -799,28 +801,28 @@ def foo x:_elem, y:_elem [ :(scenario multiple_shape_shifting_variants) # try to call two different shape-shifting recipes with the same name -def main [ +def main [ e1:d1:num <- merge 3 e2:d2:num <- merge 4, 5 1:num/raw <- foo e1 2:num/raw <- foo e2 ] # the two shape-shifting definitions -def foo a:d1:_elem -> b:num [ +def foo a:d1:_elem -> b:num [ local-scope load-ingredients return 34 ] -def foo a:d2:_elem -> b:num [ +def foo a:d2:_elem -> b:num [ local-scope load-ingredients return 35 ] # the shape-shifting containers they use -container d1:_elem [ +container d1:_elem [ x:_elem ] -container d2:_elem [ +container d2:_elem [ x:num y:_elem ] @@ -829,26 +831,26 @@ container d2:_elem [ :(scenario multiple_shape_shifting_variants_2) # static dispatch between shape-shifting variants, _including pointer lookups_ -def main [ +def main [ e1:d1:num <- merge 3 e2:&:d2:num <- new {(d2 number): type} 1:num/raw <- foo e1 2:num/raw <- foo *e2 # different from previous scenario ] -def foo a:d1:_elem -> b:num [ +def foo a:d1:_elem -> b:num [ local-scope load-ingredients return 34 ] -def foo a:d2:_elem -> b:num [ +def foo a:d2:_elem -> b:num [ local-scope load-ingredients return 35 ] -container d1:_elem [ +container d1:_elem [ x:_elem ] -container d2:_elem [ +container d2:_elem [ x:num y:_elem ] @@ -857,17 +859,17 @@ container d2:_elem [ :(scenario missing_type_in_shape_shifting_recipe) % Hide_errors = true; -def main [ +def main [ a:d1:num <- merge 3 foo a ] -def foo a:d1:_elem -> b:num [ +def foo a:d1:_elem -> b:num [ local-scope load-ingredients copy e # no such variable return 34 ] -container d1:_elem [ +container d1:_elem [ x:_elem ] +error: foo: unknown type for 'e' in 'copy e' (check the name for typos) @@ -876,17 +878,17 @@ container d1:_elem [ :(scenario missing_type_in_shape_shifting_recipe_2) % Hide_errors = true; -def main [ +def main [ a:d1:num <- merge 3 foo a ] -def foo a:d1:_elem -> b:num [ +def foo a:d1:_elem -> b:num [ local-scope load-ingredients - get e, x:offset # unknown variable in a 'get', which does some extra checking + get e, x:offset # unknown variable in a 'get', which does some extra checking return 34 ] -container d1:_elem [ +container d1:_elem [ x:_elem ] +error: foo: unknown type for 'e' in 'get e, x:offset' (check the name for typos) @@ -895,11 +897,11 @@ container d1:_elem [ :(scenarios transform) :(scenario specialize_recursive_shape_shifting_recipe) -def main [ +def main [ 1:num <- copy 34 2:num <- foo 1:num ] -def foo x:_elem -> y:num [ +def foo x:_elem -> y:num [ local-scope load-ingredients { @@ -913,16 +915,16 @@ def foo x:_elem -> y:num [ :(scenarios run) :(scenario specialize_most_similar_variant) -def main [ - 1:&:num <- new number:type +def main [ + 1:&:num <- new number:type 2:num <- foo 1:&:num ] -def foo x:_elem -> y:num [ +def foo x:_elem -> y:num [ local-scope load-ingredients return 34 ] -def foo x:&:_elem -> y:num [ +def foo x:&:_elem -> y:num [ local-scope load-ingredients return 35 @@ -931,19 +933,19 @@ def foo x:&:_elem -> y:num [ :(scenario specialize_most_similar_variant_2) # version with headers padded with lots of unrelated concrete types -def main [ +def main [ 1:num <- copy 23 2:&:@:num <- copy 0 3:num <- foo 2:&:@:num, 1:num ] # variant with concrete type -def foo dummy:&:@:num, x:num -> y:num, dummy:&:@:num [ +def foo dummy:&:@:num, x:num -> y:num, dummy:&:@:num [ local-scope load-ingredients return 34 ] # shape-shifting variant -def foo dummy:&:@:num, x:_elem -> y:num, dummy:&:@:num [ +def foo dummy:&:@:num, x:_elem -> y:num, dummy:&:@:num [ local-scope load-ingredients return 35 @@ -952,29 +954,29 @@ def foo dummy:&:@:num, x:_elem +mem: storing 34 in location 3 :(scenario specialize_most_similar_variant_3) -def main [ +def main [ 1:text <- new [abc] foo 1:text ] -def foo x:text [ +def foo x:text [ 2:num <- copy 34 ] -def foo x:&:_elem [ +def foo x:&:_elem [ 2:num <- copy 35 ] # make sure the more precise version was used +mem: storing 34 in location 2 :(scenario specialize_literal_as_number) -def main [ +def main [ 1:num <- foo 23 ] -def foo x:_elem -> y:num [ +def foo x:_elem -> y:num [ local-scope load-ingredients return 34 ] -def foo x:char -> y:num [ +def foo x:char -> y:num [ local-scope load-ingredients return 35 @@ -983,17 +985,17 @@ def foo x:char -> :(scenario specialize_literal_as_number_2) # version calling with literal -def main [ +def main [ 1:num <- foo 0 ] # variant with concrete type -def foo x:num -> y:num [ +def foo x:num -> y:num [ local-scope load-ingredients return 34 ] # shape-shifting variant -def foo x:&:_elem -> y:num [ +def foo x:&:_elem -> y:num [ local-scope load-ingredients return 35 @@ -1002,17 +1004,17 @@ def foo x:&:_elem -> y:num [ +mem: storing 34 in location 1 :(scenario specialize_literal_as_address) -def main [ +def main [ 1:num <- foo 0 ] # variant with concrete address type -def foo x:&:num -> y:num [ +def foo x:&:num -> y:num [ local-scope load-ingredients return 34 ] # shape-shifting variant -def foo x:&:_elem -> y:num [ +def foo x:&:_elem -> y:num [ local-scope load-ingredients return 35 @@ -1023,13 +1025,13 @@ def foo x:&:_elem -> y:num [ :(scenario missing_type_during_specialization) % Hide_errors = true; # define a shape-shifting recipe -def foo a:_elem [ +def foo a:_elem [ ] # define a container with field 'z' -container foo2 [ +container foo2 [ z:num ] -def main [ +def main [ local-scope x:foo2 <- merge 34 y:num <- get x, z:offse # typo in 'offset' @@ -1043,13 +1045,13 @@ def main [ :(scenario missing_type_during_specialization2) % Hide_errors = true; # define a shape-shifting recipe -def foo a:_elem [ +def foo a:_elem [ ] # define a container with field 'z' -container foo2 [ +container foo2 [ z:num ] -def main [ +def main [ local-scope x:foo2 <- merge 34 y:num <- get x, z:offse # typo in 'offset' @@ -1062,17 +1064,17 @@ def main [ :(scenario tangle_shape_shifting_recipe) # shape-shifting recipe -def foo a:_elem [ +def foo a:_elem [ local-scope load-ingredients <label1> ] # tangle some code that refers to the type ingredient -after <label1> [ +after <label1> [ b:_elem <- copy a ] # trigger specialization -def main [ +def main [ local-scope foo 34 ] @@ -1080,17 +1082,17 @@ $error: 0 :(scenario tangle_shape_shifting_recipe_with_type_abbreviation) # shape-shifting recipe -def foo a:_elem [ +def foo a:_elem [ local-scope load-ingredients <label1> ] # tangle some code that refers to the type ingredient -after <label1> [ +after <label1> [ b:bool <- copy 0 # type abbreviation ] # trigger specialization -def main [ +def main [ local-scope foo 34 ] @@ -1098,10 +1100,10 @@ $error: 0 :(scenario shape_shifting_recipe_coexists_with_primitive) # recipe overloading a primitive with a generic type -def add a:&:foo:_elem [ +def add a:&:foo:_elem [ assert 0, [should not get here] ] -def main [ +def main [ # call primitive add with literal 0 add 0, 0 ] -- cgit 1.4.1-2-gfad0