about summary refs log tree commit diff stats
Commit message (Expand)AuthorAgeFilesLines
...
* bugfix: backspace from start of final lineKartik K. Agaram2022-08-102-1/+21
* unnecessary argsKartik K. Agaram2022-08-101-1/+1
* hardcode some assumptions about how this app uses loveKartik K. Agaram2022-08-061-18/+11
* bugfix: imprecision in drawingKartik K. Agaram2022-08-032-0/+4
* round one coordinateKartik K. Agaram2022-07-301-1/+1
* round coordinates to integers in a few placesKartik K. Agaram2022-07-291-7/+11
* click to the left of a lineKartik K. Agaram2022-07-294-4/+28
* copying to clipboard can never scrollKartik K. Agaram2022-07-271-1/+0
* line.y -> line_cache.starty in a few more placesKartik K. Agaram2022-07-273-14/+14
* have file API operate on state objectKartik K. Agaram2022-07-254-21/+20
* update cursor in search boxKartik K. Agaram2022-07-251-3/+1
* bugfix: alt-tab shouldn't emit keypress eventsKartik K. Agaram2022-07-251-1/+20
* moveKartik K. Agaram2022-07-251-2/+3
* simplify hysteresis logicKartik K. Agaram2022-07-251-8/+3
* bugfix: skip over drawings when searchingKartik K. Agaram2022-07-252-15/+17
* extract methodKartik K. Agaram2022-07-232-14/+13
* pre { line-height: 125%; } td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
//: Support jumps to special labels called 'targets'. Targets must be in the
//: same recipe as the jump, and must be unique in that recipe. Targets always
//: start with a '+'.
//:
//: We'll also treat 'break' and 'loop' as jumps. The choice of name is
//: just documentation about intent; use 'break' to indicate you're exiting
//: one or more loop nests, and 'loop' to indicate you're skipping to the next
//: iteration of some containing loop nest.

:(scenario jump_to_label)
recipe main [
  jump +target:label
  1:number <- copy 0
  +target
]
-mem: storing 0 in location 1

:(before "End Mu Types Initialization")
Type_ordinal["label"] = 0;

:(after "int main")
  Transform-5/+5
* switch to line index in a functionKartik K. Agaram2022-07-173-6/+6
* switch to line index in a functionKartik K. Agaram2022-07-171-15/+16
* switch to line index in a functionKartik K. Agaram2022-07-173-4/+5
* drop some extra argsKartik K. Agaram2022-07-171-4/+4
* drop some redundant args when clearing the cacheKartik K. Agaram2022-07-172-11/+11
* fold together two largely similar casesKartik K. Agaram2022-07-171-28/+23
* drop some redundant args from Text.drawKartik K. Agaram2022-07-172-5/+6
* formattingKartik K. Agaram2022-07-162-3/+3
* bring back a set of constantsKartik K. Agaram2022-07-164-90/+89
* more decoupling editor tests from AppKartik K. Agaram2022-07-161-1/+1
* more decoupling editor tests from AppKartik K. Agaram2022-07-161-3/+3
ass="p">) << "duplicate label '" << inst.label << "'" << end(); // have all jumps skip some random but noticeable and deterministic amount of code offset[inst.label] = 9999; } } } for (long long int i = 0; i < SIZE(Recipe[r].steps); ++i) { instruction& inst = Recipe[r].steps.at(i); if (inst.operation == Recipe_ordinal["jump"]) { replace_offset(inst.ingredients.at(0), offset, i, r); } if (inst.operation == Recipe_ordinal["jump-if"] || inst.operation == Recipe_ordinal["jump-unless"]) { replace_offset(inst.ingredients.at(1), offset, i, r); } if ((inst.operation == Recipe_ordinal["loop"] || inst.operation == Recipe_ordinal["break"]) && SIZE(inst.ingredients) == 1) { replace_offset(inst.ingredients.at(0), offset, i, r); } if ((inst.operation == Recipe_ordinal["loop-if"] || inst.operation == Recipe_ordinal["loop-unless"] || inst.operation == Recipe_ordinal["break-if"] || inst.operation == Recipe_ordinal["break-unless"]) && SIZE(inst.ingredients) == 2) { replace_offset(inst.ingredients.at(1), offset, i, r); } } } :(code) void replace_offset(reagent& x, /*const*/ map<string, long long int>& offset, const long long int current_offset, const recipe_ordinal r) { if (!is_literal(x)) { raise_error << maybe(Recipe[r].name) << "jump target must be offset or label but is " << x.original_string << '\n' << end(); x.set_value(0); // no jump by default return; } assert(!x.initialized); if (is_integer(x.name)) return; // non-labels will be handled like other number operands if (!is_jump_target(x.name)) { raise_error << maybe(Recipe[r].name) << "can't jump to label " << x.name << '\n' << end(); x.set_value(0); // no jump by default return; } if (offset.find(x.name) == offset.end()) { raise_error << maybe(Recipe[r].name) << "can't find label " << x.name << '\n' << end(); x.set_value(0); // no jump by default return; } x.set_value(offset[x.name]-current_offset); } bool is_jump_target(string label) { return label.at(0) == '+'; } :(scenario break_to_label) recipe main [ { { break +target:label 1:number <- copy 0 } } +target ] -mem: storing 0 in location 1 :(scenario jump_if_to_label) recipe main [ { { jump-if 1, +target:label 1:number <- copy 0 } } +target ] -mem: storing 0 in location 1 :(scenario loop_unless_to_label) recipe main [ { { loop-unless 0, +target:label # loop/break with a label don't care about braces 1:number <- copy 0 } } +target ] -mem: storing 0 in location 1 :(scenario jump_runs_code_after_label) recipe main [ # first a few lines of padding to exercise the offset computation 1:number <- copy 0 2:number <- copy 0 3:number <- copy 0 jump +target:label 4:number <- copy 0 +target 5:number <- copy 0 ] +mem: storing 0 in location 5 -mem: storing 0 in location 4 :(scenario recipe_fails_on_duplicate_jump_target) % Hide_errors = true; recipe main [ +label 1:number <- copy 0 +label 2:number <- copy 0 ] +error: main: duplicate label '+label' :(scenario jump_ignores_nontarget_label) % Hide_errors = true; recipe main [ # first a few lines of padding to exercise the offset computation 1:number <- copy 0 2:number <- copy 0 3:number <- copy 0 jump $target:label 4:number <- copy 0 $target 5:number <- copy 0 ] +error: main: can't jump to label $target