Add more detailed interactive code

master
Araozu 2024-05-19 23:40:31 -05:00
parent e52ce64bce
commit c7b429105d
2 changed files with 75 additions and 18 deletions

View File

@ -122,7 +122,7 @@ const codeHtml = highlightCode(trimAndDedent(code));
<div class="p-1 border-b border-white">state</div> <div class="p-1 border-b border-white">state</div>
<div class="h-24 p-1"> <div class="h-24 p-1">
<template x-for="(value, key) in state"> <template x-for="(value, key) in state">
<div x-text="key + ' = ' + value"></div> <div x-text="key.replaceAll(' ', '&nbsp;') + ' = ' + value"></div>
</template> </template>
</div> </div>
</div> </div>

View File

@ -87,39 +87,96 @@ Use a naked `try` when you want to rethrow an error, if there is any.
[["line", 14]], [["line", 14]],
[["line", 7]], [["line", 7]],
[ [
["line", 10], ["line", 8],
["set", "Int result", "..."] ["set", "= = =", "run() = = = ="]
], ],
[["line", 1]],
[["line", 3]],
[ [
["line", 10], ["line", 10],
["set", " dangerous()", "..."],
],
[["line", 1]],
[
["line", 2],
["set", " = = =", "dangerous() = = = ="]
],
[["line", 3]],
[
["set", " Math.random()", "0.2"]
],
[
["unset", " Math.random()"],
["set", " return", "Int 50"]
],
[["line", 5]],
[
["line", 10],
["unset", " return"],
["unset", " = = ="],
["set", " dangerous()", "Int 50"]
],
[
["unset", " dangerous()"],
["set", " Int result", "Int 50"] ["set", " Int result", "Int 50"]
], ],
[["line", 11]], [["line", 11]],
[ [
["line", 14], ["line", 12],
["out", "The result is 50\\n"], ["out", "The result is 50\\n"],
],
[
["line", 14],
["unset", " Int result"], ["unset", " Int result"],
["unset", "= = ="],
], ],
[ [
["line", 15], ["line", 15],
["set", "res1", "<empty>"], ["set", "!Exception res1", "<empty>"],
], ],
[["line", 7]], [["line", 7]],
[["line", 10]], [
[["line", 1]], ["line", 8],
[["line", 3]], ["set", "= = =", "run() = = = ="]
[["line", 4]], ],
[ [
["line", 10], ["line", 10],
["set", "result", "Exception(\\"Unlucky\\")"] ["set", " dangerous()", "..."],
], ],
[["line", 15]], [["line", 1]],
[ [
["line", 0,], ["line", 2],
["set", "res2", "Exception(\\"Unlucky\\")"], ["set", " = = =", "dangerous() = = = ="],
] ],
[["line", 3]],
[
["set", " Math.random()", "0.9"],
],
[
["line", "4"],
["unset", " Math.random()"],
["set", " return", "Exception(\\"Unlucky\\")"],
],
[["line", 5]],
[
["line", 10],
["unset", " return"],
["unset", " = = ="],
["set", " dangerous()", "Exception \\"Unlucky\\""],
],
[
["line", 12],
["unset", " dangerous()"],
["set", " return", "Exception(\\"Unlucky\\")"],
],
[
["line", 15],
["unset", " return"],
["unset", "= = ="],
],
[
["line", 16],
["set", "!Exception res2", "Exception(\\"Unlucky\\")"],
],
]`} ]`}
></InteractiveCode> ></InteractiveCode>