Skip to content

Commit

Permalink
wip debugging failure on first insertion
Browse files Browse the repository at this point in the history
  • Loading branch information
dm0n3y committed Dec 13, 2024
1 parent 5e1b5ef commit 31f1406
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 30 deletions.
12 changes: 10 additions & 2 deletions src/core/material/Walker.re
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,19 @@ let walk_filter_by_swing = (from: Dir.t, walks: list(Walk.t)): list(Walk.t) => {
// - [DONE] strengthen minimality check to rule out multiple grout levels
// - [DOING} apply additional filter that rules outs walks that accommodate the same thing as another existing walk

// WIP: inspecting the diff `git show -m bdc35446 -- src/core/material` to see why
// there is a difference between precompiled entry from root vs regular entry from
// root
let is_minimal = (w: Walk.t) =>
!(
Walk.is_neq(w)
&& List.exists(Mtrl.is_tile, Walk.stance_sorts(w).mid)
|| List.length(List.filter(Mtrl.is_grout, Chain.links(w))) > 1
&& (
// avoid walks with spurious mid levels like the paren in `# <. ( <. 2`
List.exists(Mtrl.is_tile, Walk.stance_sorts(w).mid)
// avoid walk withs multiple grout levels eg `# <. << <. << <. Int`
|| List.length(List.filter(Mtrl.is_grout, Walk.stance_sorts(w).mid))
> 1
)
);

let walk_all =
Expand Down
37 changes: 33 additions & 4 deletions src/core/parser/Melder.re
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,39 @@ let complete_bounded =
// P.log("--- Melder.complete_bounded");
// P.show("completed slope", Cell.show(fill));
// };
Walker.walk_eq(~from=onto, fc_onto, fc_from)
|> Grouter.pick(~repair=true, [fill], ~from=onto)
|> Option.map(grouted => snd(Chain.hd(grouted)))
|> Options.get_fail("hmmm");
try(
Walker.walk_eq(~from=onto, fc_onto, fc_from)
|> Grouter.pick(~repair=true, [fill], ~from=onto)
|> Option.map(grouted => snd(Chain.hd(grouted)))
|> Options.get_fail("hmmm")
) {
| _ =>
P.log("--- Melder.complete_bounded/failed");
P.show("onto", Dir.show(onto));
P.show("fc_onto", Bound.show(Mtrl.T.pp, fc_onto));
P.show("fc_from", Bound.show(Mtrl.T.pp, fc_from));
P.show("fill", Cell.show(fill));
Walker.walk_eq(~from=onto, fc_onto, fc_from)
|> List.iter(w => {
P.show("walk", Walk.show(w));
let sw = Chain.hd(w);
let nt = Chain.hd(sw);
P.show("entering precompiled nt", Mtrl.NT.show(nt));
Walker.enter_all_precompiled(~from=L, nt)
|> Walk.Index.iter((dst, w) => {
P.show("dst", Walk.End.show(dst));
P.show("walk", Walk.show(w));
});
P.show("entering nt", Mtrl.NT.show(nt));
Walker.enter_all(~from=L, nt)
|> Walk.Index.iter((dst, w) => {
P.show("dst", Walk.End.show(dst));
P.show("walk", Walk.show(w));
});
});
// P.sexp("fill", Cell.sexp_of_t(fill));
failwith("");
};
};

let connect_eq =
Expand Down
16 changes: 13 additions & 3 deletions src/core/parser/Molder.re
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,19 @@ let rec mold =
{
let (fill, slope) = Slope.Dn.unroll(fill);
let stack = Stack.cat(slope, stack);
Melder.push(deferred, ~fill, stack, ~onto=L)
|> Option.map(((grouted, stack)) => (deferred, grouted, stack))
|> Options.get_fail("bug: failed to push space");
try(
Melder.push(deferred, ~fill, stack, ~onto=L)
|> Option.map(((grouted, stack)) =>
(deferred, grouted, stack)
)
|> Options.get_fail("bug: failed to push space")
) {
| _ =>
P.log("--- Molder.mold/failed defer");
P.show("deferred", Token.show(deferred));
P.show("stack", Stack.show(stack));
failwith("");
};
},
);
}
Expand Down
43 changes: 22 additions & 21 deletions src/web/Store.re
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,28 @@ let save_syntax_key: int => string =
let save_syntax = (save_idx: int, z: Zipper.t) =>
LocalStorage.set(save_syntax_key(save_idx), z |> serialize);

let tasks = [
//Data.epzz,
// Data.epz0,
// Data.epz1,
// Data.epz2,
// Data.epz3,
// Data.epz4,
//Data.t0_transcribe,
Data.t1_transcribe,
Data.t2_transcribe,
Data.t3_transcribe,
Data.t4_transcribe,
// Data.emoji_paint,
// Data.t0_modify,
// Data.t1_modify,
// Data.t2_modify,
// Data.t3_modify,
// (("case 7\n| x => 7")),
// (("let (a, b) =\n(8*9<6, 17==6) in\n(a,(a, b))")),
// (("let f = fun z -> 9 in f(9)")),
];
// let tasks = [
// //Data.epzz,
// // Data.epz0,
// // Data.epz1,
// // Data.epz2,
// // Data.epz3,
// // Data.epz4,
// //Data.t0_transcribe,
// Data.t1_transcribe,
// Data.t2_transcribe,
// Data.t3_transcribe,
// Data.t4_transcribe,
// // Data.emoji_paint,
// // Data.t0_modify,
// // Data.t1_modify,
// // Data.t2_modify,
// // Data.t3_modify,
// // (("case 7\n| x => 7")),
// // (("let (a, b) =\n(8*9<6, 17==6) in\n(a,(a, b))")),
// // (("let f = fun z -> 9 in f(9)")),
// ];
let tasks = [];

let editor_defaults =
[serialize(Zipper.empty)]
Expand Down

0 comments on commit 31f1406

Please sign in to comment.